Exemplo n.º 1
0
DWORD CService::WatcherThreadMemberProc()
{
   DWORD dwWait = 0;
   bool bControlWait = true;

   // Wait for any events to signal
   while(bControlWait)
   {
      dwWait = WaitForMultipleObjects(NUMEVENTS, m_hEvents, FALSE, INFINITE);

      switch(dwWait - WAIT_OBJECT_0)
      {
      case STOP:
         OnStop();
         bControlWait = false;
         break;

      case PAUSE:
         OnPause();
         ResetEvent(m_hEvents[PAUSE]);
         break;

      case CONTINUE:
         OnContinue();
         ResetEvent(m_hEvents[CONTINUE]);
         break;

      case SHUTDOWN:
         OnShutdown();
         bControlWait = false;
         break;
      }
   }
   return 0;
}
//
//   FUNCTION: CServiceBase::Pause()
//
//   PURPOSE: The function pauses the service if the service supports pause 
//   and continue. It calls the OnPause virtual function in which you can 
//   specify the actions to take when the service pauses. If an error occurs, 
//   the error will be logged in the Application event log, and the service 
//   will become running.
//
void CServiceBase::Pause()
{
    try
    {
        // Tell SCM that the service is pausing.
        SetServiceStatus(SERVICE_PAUSE_PENDING);

        // Perform service-specific pause operations.
        OnPause();

        // Tell SCM that the service is paused.
        SetServiceStatus(SERVICE_PAUSED);
    }
    catch (DWORD dwError)
    {
        // Log the error.
        WriteErrorLogEntry(L"Service failed to pause.", dwError);

        // Tell SCM that the service is still running.
        SetServiceStatus(SERVICE_RUNNING);
    }
    catch (...)
    {
        // Log the error.
        WriteEventLogEntry(L"Service failed to pause.", TRACE_LEVEL_ERROR);

        // Tell SCM that the service is still running.
        SetServiceStatus(SERVICE_RUNNING);
    }
}
Exemplo n.º 3
0
// Returns:
//   The previous suspension state; true if the thread was running or false if it was
//   closed, not running, or paused.
//
void SysThreadBase::Pause()
{
	if( IsSelf() || !IsRunning() ) return;

	// shortcut ExecMode check to avoid deadlocking on redundant calls to Suspend issued
	// from Resume or OnResumeReady code.
	if( (m_ExecMode == ExecMode_Closed) || (m_ExecMode == ExecMode_Paused) ) return;

	{
		ScopedLock locker( m_ExecModeMutex );

		// Check again -- status could have changed since above.
		if( (m_ExecMode == ExecMode_Closed) || (m_ExecMode == ExecMode_Paused) ) return;

		if( m_ExecMode == ExecMode_Opened )
			m_ExecMode = ExecMode_Pausing;

		pxAssertDev( m_ExecMode == ExecMode_Pausing, "ExecMode should be nothing other than Pausing..." );

		OnPause();
		m_sem_event.Post();
	}

	m_RunningLock.Wait();
}
Exemplo n.º 4
0
void Service::Run()
{
    // We use a message loop here because this is arguably the easiest
    // way to deal with the potential race conditions that exist between
    // the service thread and the handler thread.  The SCM will make no
    // provisions for synchronizing status activity, the best bet is to
    // ensure that all calls are handled through the service main thread.
    MSG msg;
    while (GetMessage(&msg, NULL, WM_USER, WM_USER) > 0) {
        WPARAM opcode = msg.wParam;
        if (opcode == SERVICE_CONTROL_STOP) {
            SetStatus(SERVICE_STOP_PENDING);
            OnStop();
            break;
        }
        else if (opcode == SERVICE_CONTROL_PAUSE) {
            OnPause();
        }
        else if (opcode == SERVICE_CONTROL_CONTINUE) {
            OnContinue();
        }
        else if (opcode == SERVICE_CONTROL_INTERROGATE) {
            OnInterrogate();
        }
        else if (opcode == SERVICE_CONTROL_SHUTDOWN) {
            OnShutdown();
        }
        ::SetServiceStatus(m_pThis->m_hServiceStatus, &m_pThis->m_Status);
    }
}
Exemplo n.º 5
0
//---------------------------------------------------------------------------- 
// Nome: Execute(void)
// Desc: Executa o jogo. Verifica cada estado da máquina e chama o método adequado.
// Pams: nenhum
//---------------------------------------------------------------------------- 
void CLevel::Execute(void)
{
	switch(State)
	{
		case GS_MENU:
		{
			OnMenu();
			break;
		}
		case GS_GAME:
		{
			OnGame();
			break;
		}
		case GS_PAUSE:
		{
			OnPause();
			break;
		}
		case GS_CONGRATULATIONS:
		{
			OnCongratulations();
			break;
		}
		case GS_GAMEOVER:
		{
			OnGameOver();
			break;
		}
	}
}
Exemplo n.º 6
0
void QTE::Pause () {
	if (!mIsStarted || mIsPaused)
		return;

	mIsPaused = true;

	OnPause ();
}
Exemplo n.º 7
0
void ControlToolBar::Pause()
{
   if (!CanStopAudioStream())
      gAudioIO->SetPaused(!gAudioIO->IsPaused());
   else {
      wxCommandEvent dummy;
      OnPause(dummy);
   }
}
Exemplo n.º 8
0
void OnCommand(HWND hwnd)
{
	if (hwnd == g_btOpen)
		OnOpen();
	else if (hwnd == g_btPlay)
		OnPlay();
	else if (hwnd == g_btPause)
		OnPause();
	else if (hwnd == g_btStop)
		OnStop();
}
Exemplo n.º 9
0
void App::Pause()
{
	if (!mPause)
	{
		OnPause();

		d_printf("---: Lost device...");

		mRenderSystem->OnLostDevice();

		mPause = true;
	}
}
Exemplo n.º 10
0
DWORD Service::_HandlerEx(DWORD dwOpcode,DWORD dwEventType,LPVOID lpEventData,LPVOID lpContext)
{
	m_dbgMsg(L"Service::Handler(%lu)", dwOpcode);
    switch (dwOpcode) {
    case SERVICE_CONTROL_STOP: // 1
        SetStatus(SERVICE_STOP_PENDING);
        OnStop();
        m_bIsRunning = FALSE;
		EVLOG_INFO(EVMSG_STOPPED);
        break;

    case SERVICE_CONTROL_PAUSE: // 2
        OnPause();
        break;

    case SERVICE_CONTROL_CONTINUE: // 3
        OnContinue();
        break;

    case SERVICE_CONTROL_INTERROGATE: // 4
        OnInterrogate();
        break;

    case SERVICE_CONTROL_SHUTDOWN: // 5
        OnShutdown();
        break;

    case SERVICE_CONTROL_DEVICEEVENT:
        OnDeviceEvent(dwEventType,lpEventData);
        break;

    default:
        if (dwOpcode >= SERVICE_CONTROL_USER) {
            if (!OnUserControl(dwOpcode)) {
				EVLOG_ERROR(EVMSG_BADREQUEST);
            }
        } else {
            EVLOG_ERROR(EVMSG_BADREQUEST);
        }
        break;
    }

    // Report current status
	m_dbgMsg(L"Updating status (%lu, %lu)", m_hServiceStatus, m_Status.dwCurrentState);

    ::SetServiceStatus(m_hServiceStatus, &m_Status);

#ifdef HANDLEREX
    return NO_ERROR;
#endif HANDLEREX
}
Exemplo n.º 11
0
void SysThreadBase::PauseSelf()
{
	if( !IsSelf() || !IsRunning() ) return;

	{
		ScopedLock locker( m_ExecModeMutex );
		
		if( m_ExecMode == ExecMode_Opened )
			m_ExecMode = ExecMode_Pausing;
		
		OnPause();
		m_sem_event.Post();
	}
}
Exemplo n.º 12
0
bool ServiceBase::OnCommand(DWORD dwControl, DWORD dwEventType, void *lpEventData) {
	TRC(2, ServiceName << ": " << ServiceControlToString(dwControl));

	switch (dwControl) {
	case SERVICE_CONTROL_STOP:
		Stop();
		break;
	case SERVICE_CONTROL_SHUTDOWN:
		Status = SERVICE_STOP_PENDING;
		OnShutdown();
		break;
	case SERVICE_CONTROL_PAUSE:
		Status = SERVICE_PAUSE_PENDING;
		OnPause();
		break;
	case SERVICE_CONTROL_CONTINUE:
		Status = SERVICE_CONTINUE_PENDING;
		OnContinue();
		break;
	case SERVICE_CONTROL_INTERROGATE:
		Status = m_status;
		break;
	case SERVICE_CONTROL_POWEREVENT:
		OnPowerEvent((PowerBroadcastStatus)dwEventType);
		break;
	case SERVICE_CONTROL_SESSIONCHANGE:
		{
			SessionChangeDescription scd = { (SessionChangeReason)dwEventType, (int)((WTSSESSION_NOTIFICATION*)lpEventData)->dwSessionId };
			TRC(2, ReasonToString(scd.Reason));
			OnSessionChange(scd);
		}
		break;
	case SERVICE_CONTROL_PARAMCHANGE:
		OnParamChange();
		break;
	case SERVICE_CONTROL_TIMECHANGE:
		OnTimeChange();
		break;
	case SERVICE_CONTROL_HARDWAREPROFILECHANGE:
		OnHardwareProfileChange();
		break;
	default:
		if (dwControl >= 128 && dwControl <= 255)
			OnCustomCommand(dwControl);
		else
			return false;
	}
	return true;
}
Exemplo n.º 13
0
    //  Pause playback.
    void Player_::pause( ev::Pause const& ev)    
    {
//      if (m_state != Started)
//      {
//        throw win32_error_exception(MF_E_INVALIDREQUEST);
//      }
//
//      if (!m_pSession  || !m_pSource)
//      {
//       throw win32_error_exception(E_UNEXPECTED);
//      }
      THROW_IF_ERR(m_pSession->Pause());
      OnPause()(static_cast<this_type&>(*this));
      
      //m_state = Paused;
    }
Exemplo n.º 14
0
/*++

Routine Description:

    The function pauses the service if the service supports pause
    and continue. It calls the OnPause virtual function in which you can
    specify the actions to take when the service pauses. If an error occurs,
    the error will be logged in the Application event log, and the service
    will become running.

Arguments:

    VOID

Return Value:

    VOID

--*/
VOID
CServiceBase::Pause()
{
    try
    {
        //
        // Tell SCM that the service is pausing.
        //
        SetServiceStatus(SERVICE_PAUSE_PENDING);

        //
        // Perform service-specific pause operations.
        //
        OnPause();

        //
        // Tell SCM that the service is paused.
        //
        SetServiceStatus(SERVICE_PAUSED);
    }
    catch (DWORD Error)
    {
        //
        // Log the error.
        //
        WriteToErrorLog(L"Service Pause", Error);

        //
        // Tell SCM that the service is still running.
        //
        SetServiceStatus(SERVICE_RUNNING);
    }
    catch (...)
    {
        //
        // Log the error.
        //
        WriteToEventLog(L"Service failed to pause.", EVENTLOG_ERROR_TYPE);

        //
        // Tell SCM that the service is still running.
        //
        SetServiceStatus(SERVICE_RUNNING);
    }
}
Exemplo n.º 15
0
// The function pauses the service if the service supports pause and continue.
// It calls the OnPause virtual function.
void GServiceBase::Pause() {
  try {
    // Tell SCM that the service is pausing.
    SetServiceStatus(SERVICE_PAUSE_PENDING);

    // Perform service-specific pause operations.
    OnPause();

    // Tell SCM that the service is paused.
    SetServiceStatus(SERVICE_PAUSED);
  } catch (DWORD error) {
    WriteErrorLogEntry(L"Service Pause", error);

    // Tell SCM that the service is still running.
    SetServiceStatus(SERVICE_RUNNING);
  } catch (...) {
    LogOperationalMessage(L"Service failed to pause.");

    // Tell SCM that the service is still running.
    SetServiceStatus(SERVICE_RUNNING);
  }
}
Exemplo n.º 16
0
GDisAsmView::GDisAsmView(QWidget* parent, EmuThread& emu_thread) : QDockWidget(parent), base_addr(0), emu_thread(emu_thread)
{
    disasm_ui.setupUi(this);

    model = new QStandardItemModel(this);
    model->setColumnCount(3);
    disasm_ui.treeView->setModel(model);

    RegisterHotkey("Disassembler", "Step", QKeySequence(Qt::Key_F10), Qt::ApplicationShortcut);
//    RegisterHotkey("Disassembler", "Step into", QKeySequence(Qt::Key_F11), Qt::ApplicationShortcut);
//    RegisterHotkey("Disassembler", "Pause", QKeySequence(Qt::Key_F5), Qt::ApplicationShortcut);
    RegisterHotkey("Disassembler", "Continue", QKeySequence(Qt::Key_F5), Qt::ApplicationShortcut);
    RegisterHotkey("Disassembler", "Set Breakpoint", QKeySequence(Qt::Key_F9), Qt::ApplicationShortcut);

    connect(disasm_ui.button_breakpoint, SIGNAL(clicked()), this, SLOT(OnSetBreakpoint()));
    connect(disasm_ui.button_step, SIGNAL(clicked()), this, SLOT(OnStep()));
    connect(disasm_ui.button_pause, SIGNAL(clicked()), this, SLOT(OnPause()));
    connect(disasm_ui.button_continue, SIGNAL(clicked()), this, SLOT(OnContinue()));
    connect(GetHotkey("Disassembler", "Step", this), SIGNAL(activated()), this, SLOT(OnStep()));
//    connect(GetHotkey("Disassembler", "Step into", this), SIGNAL(activated()), this, SLOT(OnStepInto()));
//    connect(GetHotkey("Disassembler", "Pause", this), SIGNAL(activated()), this, SLOT(OnPause()));
    connect(GetHotkey("Disassembler", "Continue", this), SIGNAL(activated()), this, SLOT(OnContinue()));
    connect(GetHotkey("Disassembler", "Set Breakpoint", this), SIGNAL(activated()), this, SLOT(OnSetBreakpoint()));
}
Exemplo n.º 17
0
void *wxDownloadThread::Entry()
{
    wxInputStream *in = m_url.GetInputStream();

    // check the stream
    if (in == NULL)
    {
        // something is wrong with the input URL...
        OnAbort();
        return NULL;
    }
    if (!in->IsOk())
    {
        delete in;

        // something is wrong with the input URL...
        OnAbort();
        return NULL;
    }

    // we successfully connected with the server
    OnConnect();

    // we are starting the download of a file; update our datetime field
    wxLogDebug(_("wxDownloadThread::Entry - downloading [%s]"),
               m_url.GetURL().c_str());
    m_dtStart = wxDateTime::UNow();

    wxASSERT(m_output->IsOk());

    // get size of download, if available
    size_t sz = in->GetSize();
    m_nFinalSize = (sz == (size_t)-1) ? wxInvalidSize : sz;

    // begin the download
    char buf[wxDT_BUF_TEMP_SIZE];
    bool paused = false;
    while (!TestDestroy())
    {
        if (GetFlag() == wxDTF_ABORT)
        {
            wxLogDebug(wxS("wxDownloadThread::Entry - user-aborting"));
            delete in;
            OnUserAbort();
            return NULL;
        }
        else if (GetFlag() == wxDTF_PAUSE)
        {
            wxLogDebug(wxS("wxDownloadThread::Entry - sleeping"));

            // did we warn our event handler that the download was paused?
            if (!paused)
            {
                paused = true;
                OnPause();
            }

            // sleep 100 msec and then test again our flag to see
            // if it has changed to wxDTF_CONTINUE or to wxDTF_ABORT
            wxMilliSleep(100);
            continue;
        }

        paused = false;

        // write the downloaded stuff in the output file
        // without using the
        //      out.Write(*in);
        // command; that would be easier but would not allow
        // the program to stop this thread while downloading
        // the file since the TestDestroy() function would not
        // be called in that way...
        size_t bytes_read = in->Read(buf, WXSIZEOF(buf)).LastRead();
        if ( !bytes_read )
            break;      // no more data to read

        if ( m_output->Write(buf, bytes_read).LastWrite() != bytes_read )
        {
            // something wrong with saving downloaded data!
            OnAbort();
            return NULL;
        }

        // update our downloaded bytes var
        m_nCurrentSize = m_output->GetSize();

        // notify our even handler that we made progress
        OnUpdate();
    }

    // we don't need the INPUT stream anymore...
    delete in;

    wxASSERT_MSG(m_nCurrentSize == m_nFinalSize || m_nFinalSize == wxInvalidSize,
                 wxS("All errors should have already been catched!"));

    wxLogDebug(_("wxDownloadThread::Entry - completed download of %lu bytes"),
               m_nCurrentSize.ToULong());

    // download is complete
    OnComplete();
    wxLogDebug(wxS("sent complete event"));
    return NULL;
}
Exemplo n.º 18
0
/*----------------------------------------------------------------------
|   PLT_MediaRenderer::OnAction
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaRenderer::OnAction(PLT_ActionReference&          action,
                            const PLT_HttpRequestContext& context)
{
    NPT_COMPILER_UNUSED(context);

    /* parse the action name */
    NPT_String name = action->GetActionDesc().GetName();

    // since all actions take an instance ID and we only support 1 instance
    // verify that the Instance ID is 0 and return an error here now if not
    NPT_String serviceType = action->GetActionDesc().GetService()->GetServiceType();
    if (serviceType.Compare("urn:schemas-upnp-org:service:AVTransport:1", true) == 0) {
        if (NPT_FAILED(action->VerifyArgumentValue("InstanceID", "0"))) {
            action->SetError(718, "Not valid InstanceID");
            return NPT_FAILURE;
        }
    }
    serviceType = action->GetActionDesc().GetService()->GetServiceType();
    if (serviceType.Compare("urn:schemas-upnp-org:service:RenderingControl:1", true) == 0) {
        if (NPT_FAILED(action->VerifyArgumentValue("InstanceID", "0"))) {
            action->SetError(702, "Not valid InstanceID");
            return NPT_FAILURE;
        }
    }

    /* Is it a ConnectionManager Service Action ? */
    if (name.Compare("GetCurrentConnectionInfo", true) == 0) {
        return OnGetCurrentConnectionInfo(action);
    }

    /* Is it a AVTransport Service Action ? */
    if (name.Compare("Next", true) == 0) {
        return OnNext(action);
    }
    if (name.Compare("Pause", true) == 0) {
        return OnPause(action);
    }
    if (name.Compare("Play", true) == 0) {
        return OnPlay(action);
    }
    if (name.Compare("Previous", true) == 0) {
        return OnPrevious(action);
    }
    if (name.Compare("Seek", true) == 0) {
        return OnSeek(action);
    }
    if (name.Compare("Stop", true) == 0) {
        return OnStop(action);
    }
    if (name.Compare("SetAVTransportURI", true) == 0) {
        return OnSetAVTransportURI(action);
    }
    if (name.Compare("SetNextAVTransportURI", true) == 0) {
        return OnSetNextAVTransportURI(action);
    }
    if (name.Compare("SetPlayMode", true) == 0) {
        return OnSetPlayMode(action);
    }

    /* Is it a RendererControl Service Action ? */
    if (name.Compare("SetVolume", true) == 0) {
        return OnSetVolume(action);
    }
    if (name.Compare("SetVolumeDB", true) == 0) {
        return OnSetVolumeDB(action);
    }
    if (name.Compare("GetVolumeDBRange", true) == 0) {
        return OnGetVolumeDBRange(action);

    }
    if (name.Compare("SetMute", true) == 0) {
        return OnSetMute(action);
    }

    // other actions rely on state variables
    NPT_CHECK_LABEL_WARNING(action->SetArgumentsOutFromStateVariable(), failure);
    return NPT_SUCCESS;

failure:
    action->SetError(401,"No Such Action.");
    return NPT_FAILURE;
}
	bool LynxUserInterfaceModel::OnMenuCommand( uint32_t menuCommandID )
	{
	    bool result = true;

		DoWithTerminationOnException( [&]()
		{
			DoWithFileHandlingErrorReportsToUser( "", [&] ()
			{
				switch( menuCommandID )
				{
					case ID_FILE_LOADSTATESNAPSHOT:       OnLoadStateSnapshot(); break;
					case ID_FILE_SAVESTATESNAPSHOT:       OnSaveStateSnapshot(); break;
					case ID_FILE_RUNTAPFILE:              OnRunTAPFile(); break;
					case ID_FILE_OPENTAPFILE:             OnOpenTAPFile(); break;
					case ID_FILE_INSERTBLANKTAPE:         OnNewAudioTape(); break;
					case ID_FILE_SAVETAPE:                OnSaveTAPFileAs(); break;
					case ID_FILE_REWINDTAPE:              OnRewindAudioTape(); break;
					case ID_FILE_DIRECTORY:               OnTypeTapeDirectoryIntoLynx(); break;
					case ID_FILE_EXIT:                    OnExit(); break;

					case ID_EMULATION_PAUSE:		      OnPause(); break;
					case ID_EMULATION_RESET:		      OnResetEmulation(); break;
					case ID_EMULATION_LYNX48K:		      OnEmulation48K(); break;
					case ID_EMULATION_LYNX96K:		      OnEmulation96K(); break;
					case ID_EMULATION_LYNX96KSCORPION:    OnEmulation96KScorpion(); break;
					case ID_EMULATION_PAUSEAFTERTAPOPERATION:  OnPauseAfterTapLoad(); break;

					case ID_SPEED_SPEED50:                OnSetSpeedPercentage( 50 ); break;
					case ID_SPEED_SPEED100:               OnSetSpeedPercentage( 100 ); break;
					case ID_SPEED_SPEED200:               OnSetSpeedPercentage( 200 ); break;
					case ID_SPEED_SPEED400:               OnSetSpeedPercentage( 400 ); break;
					case ID_SPEED_SPEED800:               OnSetSpeedPercentage( 800 ); break;
					case ID_SPEED_MAXSPEEDCASSETTE:       OnSpeedMaxCassette(); break;
					case ID_SPEED_MAXSPEEDCONSOLE:        OnSpeedMaxConsoleCommands(); break;
					case ID_SPEED_MAXSPEEDALWAYS:         OnSpeedMaxPermanently(); break;

					case ID_SOUND_LISTENTOTAPESOUNDS:     OnListenToTapeSounds(); break;
					case ID_SOUND_RECORDTOFILE:           OnRecordToFile(); break;
					case ID_SOUND_FINISHRECORDING:        OnFinishRecording(); break;
					case ID_SOUND_ENABLE:                 OnEnableDisableSound(); break;

					case ID_TEXT_RECORDLYNXTEXT:                 OnRecordLynxTextToFile(); break;
					case ID_TEXT_STOPRECORDINGLYNXTEXT:          OnFinishRecordingLynxText(); break;
					case ID_TEXT_TYPEINFROMFILE:                 OnTypeInTextFromFile(); break;
					case ID_TEXT_LYNXBASICREMCOMMANDEXTENSIONS:  OnLynxBasicRemCommandExtensions(); break;

					case ID_DISPLAY_FITTOWINDOW:          OnFitToWindow(); break;
					case ID_DISPLAY_SQUAREPIXELS:         OnSquarePixels(); break;
					case ID_DISPLAY_FILLWINDOW:           OnFillWindow(); break;
					case ID_DISPLAY_FULLSCREENENABLE:     OnEnableDisableFullScreen(); break;

					case ID_DISPLAY_COLOURSET_NORMALRGB:            OnChangeColourSet( Jynx::LynxColourSet::NormalRGB ); break;
					case ID_DISPLAY_COLOURSET_GREENONLY:            OnChangeColourSet( Jynx::LynxColourSet::GreenOnly ); break;
					case ID_DISPLAY_COLOURSET_LEVEL9:               OnChangeColourSet( Jynx::LynxColourSet::Level9 ); break;
					case ID_DISPLAY_COLOURSET_BLACKANDWHITETV:      OnChangeColourSet( Jynx::LynxColourSet::BlackAndWhiteTV ); break;
					case ID_DISPLAY_COLOURSET_GREENSCREENMONITOR:   OnChangeColourSet( Jynx::LynxColourSet::GreenScreenMonitor ); break;

					case ID_HELP_ABOUT:                             OnShowTheAboutBox(); break;

					default:
						result = false; // not processed
				}
			} );
		} );

		return result;
	}
Exemplo n.º 20
0
bool CProtocolCore::Pause()
{
	return OnPause();
}
Exemplo n.º 21
0
long CMainWindow::OnCommand(unsigned short nID, unsigned short nCmd, HWND hControl)
{
	if(!IsWindowEnabled(m_hWnd))
	{
		return TRUE;
	}

	switch(nID)
	{
	case ID_FILE_ABOUT:
		OnAbout();
		break;
	case ID_FILE_ENABLEREVERB:
		OnClickReverbEnabled();
		break;
	case ID_FILE_EXIT:
		DestroyWindow(m_hWnd);
		break;
	case ID_FILE_NEXTTRACK:
		OnNext();
		break;
	case ID_FILE_PREVIOUSTRACK:
		OnPrev();
		break;
	case IDC_PAUSE_BUTTON:
	case ID_FILE_PAUSE:
		OnPause();
		break;
	case ID_FILE_AUDIOPLUGIN_PLUGIN_0 + 0:
	case ID_FILE_AUDIOPLUGIN_PLUGIN_0 + 1:
	case ID_FILE_AUDIOPLUGIN_PLUGIN_0 + 2:
	case ID_FILE_AUDIOPLUGIN_PLUGIN_0 + 3:
	case ID_FILE_AUDIOPLUGIN_PLUGIN_0 + 4:
	case ID_FILE_AUDIOPLUGIN_PLUGIN_0 + 5:
	case ID_FILE_AUDIOPLUGIN_PLUGIN_0 + 6:
	case ID_FILE_AUDIOPLUGIN_PLUGIN_0 + 7:
	case ID_FILE_AUDIOPLUGIN_PLUGIN_0 + 8:
	case ID_FILE_AUDIOPLUGIN_PLUGIN_0 + 9:
		ChangeAudioPlugin(nID - ID_FILE_AUDIOPLUGIN_PLUGIN_0);
		break;
	case ID_FILE_CHARENCODING_ENCODING_0 + 0:
	case ID_FILE_CHARENCODING_ENCODING_0 + 1:
	case ID_FILE_CHARENCODING_ENCODING_0 + 2:
	case ID_FILE_CHARENCODING_ENCODING_0 + 3:
	case ID_FILE_CHARENCODING_ENCODING_0 + 4:
	case ID_FILE_CHARENCODING_ENCODING_0 + 5:
	case ID_FILE_CHARENCODING_ENCODING_0 + 6:
	case ID_FILE_CHARENCODING_ENCODING_0 + 7:
	case ID_FILE_CHARENCODING_ENCODING_0 + 8:
	case ID_FILE_CHARENCODING_ENCODING_0 + 9:
		ChangeCharEncoding(nID - ID_FILE_CHARENCODING_ENCODING_0);
		break;
	case IDC_CONFIG_BUTTON:
		OnConfig();
		break;
	case IDC_LOOPMODE_BUTTON:
		OnRepeat();
		break;
	case IDC_PREVTAB_BUTTON:
		OnPrevPanel();
		break;
	case IDC_NEXTTAB_BUTTON:
		OnNextPanel();
		break;
	case IDC_EJECT_BUTTON:
		OnFileOpen();
		break;
	}
	return TRUE;
}
Exemplo n.º 22
0
void CCallThread::DispatchCallerCmd(CallerCmd& callerCmd)
{
	switch(callerCmd.GetCmdType())
	{
	case cmdLogin:
		{
			OnLogin(callerCmd);
		}
		break;
	case cmdQuit:
		{
			OnQuit(callerCmd);
		}
		break;
	case cmdCall:
		{
			OnCall(callerCmd);
		}
		break;
	case cmdRecall:
		{
			OnRecall(callerCmd);
		}
		break;
	case cmdDiscard:
		{
			OnDiscard(callerCmd);
		}
		break;
	case cmdWait:
		{
			OnWait(callerCmd);
		}
		break;
	case cmdEvaReq:
		{
			OnEvaReq(callerCmd);
		}
		break;
	case cmdPause:
		{
			OnPause(callerCmd);
		}
		break;
	case cmdResume:
		{
			OnResume(callerCmd);
		}
		break;
	case cmdCallNum:
		{
			OnCallNum(callerCmd);
		}
		break;
	case cmdCallSec:
		{
			OnCallSec(callerCmd);
		}
		break;
	case cmdCallMana:
		{
			OnCallMana(callerCmd);
		}
		break;
	case cmdCallBusc:
		{
			OnCallBusc(callerCmd);
		}
		break;
	case cmdExChange:
		{
			OnExChange(callerCmd);
		}
		break;
	case callerCmdShowAdd:
		break;
	default:
		{
			return;
		}
		break;
	}
	///处理完后返回
	ReturnToCaller(callerCmd);
}
Exemplo n.º 23
0
bool
TopWindow::OnEvent(const Event &event)
{
  switch (event.type) {
    Window *w;

  case Event::NOP:
  case Event::QUIT:
  case Event::TIMER:
  case Event::USER:
  case Event::CALLBACK:
    break;

  case Event::KEY_DOWN:
    w = GetFocusedWindow();
    if (w == nullptr)
      w = this;

    return w->OnKeyDown(event.param);

  case Event::KEY_UP:
    w = GetFocusedWindow();
    if (w == nullptr)
      w = this;

    return w->OnKeyUp(event.param);

  case Event::MOUSE_MOTION:
    // XXX keys
    return OnMouseMove(event.point.x, event.point.y, 0);

  case Event::MOUSE_DOWN:
    return double_click.Check(event.point)
      ? OnMouseDouble(event.point.x, event.point.y)
      : OnMouseDown(event.point.x, event.point.y);

  case Event::MOUSE_UP:
    double_click.Moved(event.point);

    return OnMouseUp(event.point.x, event.point.y);

  case Event::MOUSE_WHEEL:
    return OnMouseWheel(event.point.x, event.point.y, (int)event.param);

  case Event::POINTER_DOWN:
    return OnMultiTouchDown();

  case Event::POINTER_UP:
    return OnMultiTouchUp();

  case Event::RESIZE:
    if (!surface_valid)
      /* postpone the resize if we're paused; the real resize will be
         handled by TopWindow::refresh() as soon as XCSoar is
         resumed */
      return true;

    if (unsigned(event.point.x) == GetWidth() &&
        unsigned(event.point.y) == GetHeight())
      /* no-op */
      return true;

    /* it seems the first page flip after a display orientation change
       is ignored on Android (tested on a Dell Streak / Android
       2.2.2); let's do one dummy call before we really draw
       something */
    screen->Flip();

    Resize(event.point.x, event.point.y);
    return true;

  case Event::PAUSE:
    OnPause();
    return true;

  case Event::RESUME:
    OnResume();
    return true;
  }

  return false;
}
Exemplo n.º 24
0
LRESULT MainWindow::OnReceiveMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;

	HRESULT hr;

	switch (message)
	{

	case WM_CREATE:
		hr = OnCreate();
		if (FAILED(hr))
		{
			// Fail and quit.
			NotifyError(m_hwnd, TEXT("Cannot initialize the application."), hr);
			return -1;
		}
		break;
		
	case WM_SIZE:
		OnSize();
		break;

	case WM_PAINT:
		OnPaint();
		break;

	case WM_MOVE:
		OnPaint();
		break;

	case WM_DISPLAYCHANGE:
		m_pPlayer->DisplayModeChanged();
		break;

	case WM_ERASEBKGND:
		return 1;

	case WM_DESTROY:
		PostQuitMessage(0);
		break;

	case WM_TIMER:
		OnTimer();
		break;

	case WM_NOTIFY:
        OnWmNotify((NMHDR*)lParam);
		break;

	case WM_COMMAND:
		wmId    = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		switch (wmId)
		{
		case IDM_EXIT:
			DestroyWindow(m_hwnd);
			break;

		case ID_FILE_OPENFILE:
			OnFileOpen();
			break;

		case IDC_BUTTON_PLAY:
			OnPlay();
			break;

		case IDC_BUTTON_STOP:
			OnStop();
			break;

		case IDC_BUTTON_PAUSE:
			OnPause();
			break;
	
		case IDC_BUTTON_MUTE:
			OnMute();
			break;
		}
		break;

    // Private filter graph message.
	case WM_GRAPH_EVENT:
		hr = m_pPlayer->HandleGraphEvent(this);
		break;

	default:
		return BaseWindow::OnReceiveMessage(message, wParam, lParam);
	}
	return 0;
}
Exemplo n.º 25
0
NPT_Result
GPAC_MediaRenderer::OnAction(PLT_ActionReference&          action,
                            const PLT_HttpRequestContext& context)
{
    NPT_COMPILER_UNUSED(context);

    /* parse the action name */
    NPT_String name = action->GetActionDesc().GetName();

	m_ip_src = context.GetRemoteAddress().GetIpAddress().ToString();

	/* Is it a ConnectionManager Service Action ? */
    if (name.Compare("GetCurrentConnectionIDs", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("GetProtocolInfo", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("GetCurrentConnectionInfo", true) == 0) {
        return OnGetCurrentConnectionInfo(action);
    }
    if (name.Compare("StopForMigration", true) == 0) {
		NPT_String res = m_pUPnP->OnMigrate();
        m_pMigrationService->SetStateVariable("MigrationStatus", "OK");
        m_pMigrationService->SetStateVariable("MigrationMetaData", res);

		if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }

    /* Is it a AVTransport Service Action ? */

    // since all actions take an instance ID and we only support 1 instance
    // verify that the Instance ID is 0 and return an error here now if not
    NPT_String serviceType = action->GetActionDesc().GetService()->GetServiceType();
    if (serviceType.Compare("urn:schemas-upnp-org:service:AVTransport:1", true) == 0) {
        if (NPT_FAILED(action->VerifyArgumentValue("InstanceID", "0"))) {
            action->SetError(802,"Not valid InstanceID.");
            return NPT_FAILURE;
        }
    }

    if (name.Compare("GetCurrentTransportActions", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("GetDeviceCapabilities", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("GetMediaInfo", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("GetPositionInfo", true) == 0) {
		if (m_pUPnP->m_pTerm->root_scene) {
			char szVal[100];

			m_pAVService->SetStateVariable("CurrentTrack", "0");
			format_time_string(szVal, m_Duration);
			m_pAVService->SetStateVariable("CurrentTrackDuration", szVal);

			m_pAVService->SetStateVariable("CurrentTrackMetadata", "");
			m_pAVService->SetStateVariable("CurrentTrackURI", "");
			format_time_string(szVal, m_Time);
			m_pAVService->SetStateVariable("RelativeTimePosition", szVal);
			m_pAVService->SetStateVariable("AbsoluteTimePosition", szVal);
			m_pAVService->SetStateVariable("RelativeCounterPosition", "2147483647"); // means NOT_IMPLEMENTED
			m_pAVService->SetStateVariable("AbsoluteCounterPosition", "2147483647"); // means NOT_IMPLEMENTED
		} else {
			if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
				return NPT_FAILURE;
			}
		}
        return NPT_SUCCESS;
    }
    if (name.Compare("GetTransportInfo", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("GetTransportSettings", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("Next", true) == 0) {
        return OnNext(action);
    }
    if (name.Compare("Pause", true) == 0) {
        return OnPause(action);
    }
    if (name.Compare("Play", true) == 0) {
        return OnPlay(action);
    }
    if (name.Compare("Previous", true) == 0) {
        return OnPrevious(action);
    }
    if (name.Compare("Seek", true) == 0) {
        return OnSeek(action);
    }
    if (name.Compare("Stop", true) == 0) {
        return OnStop(action);
    }
    if (name.Compare("SetAVTransportURI", true) == 0) {
        return OnSetAVTransportURI(action);
    }
    if (name.Compare("SetPlayMode", true) == 0) {
        return OnSetPlayMode(action);
    }

    /* Is it a RendererControl Service Action ? */
    if (serviceType.Compare("urn:schemas-upnp-org:service:RenderingControl:1", true) == 0) {
        /* we only support master channel */
        if (NPT_FAILED(action->VerifyArgumentValue("Channel", "Master"))) {
            action->SetError(402,"Invalid Args.");
            return NPT_FAILURE;
        }
    }

    if (name.Compare("GetVolume", true) == 0) {
        NPT_CHECK_SEVERE(action->SetArgumentsOutFromStateVariable());
        return NPT_SUCCESS;
    }

    if (name.Compare("GetMute", true) == 0) {
        NPT_CHECK_SEVERE(action->SetArgumentsOutFromStateVariable());
        return NPT_SUCCESS;
    }

    if (name.Compare("SetVolume", true) == 0) {
          return OnSetVolume(action);
    }

    if (name.Compare("SetMute", true) == 0) {
          return OnSetMute(action);
    }

    action->SetError(401,"No Such Action.");
    return NPT_FAILURE;
}
Exemplo n.º 26
0
/*----------------------------------------------------------------------
|   PLT_MediaRenderer::OnAction
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaRenderer::OnAction(PLT_ActionReference& action, NPT_SocketInfo* info /* = NULL */)
{
    NPT_COMPILER_UNUSED(info);

    /* parse the action name */
    NPT_String name = action->GetActionDesc()->GetName();

    /* Is it a ConnectionManager Service Action ? */
    if (name.Compare("GetCurrentConnectionIDs", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("GetProtocolInfo", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }    
    if (name.Compare("GetCurrentConnectionInfo", true) == 0) {
        return OnGetCurrentConnectionInfo(action);
    }  

    /* Is it a AVTransport Service Action ? */

    // since all actions take an instance ID and we only support 1 instance
    // verify that the Instance ID is 0 and return an error here now if not
    NPT_String serviceType = action->GetActionDesc()->GetService()->GetServiceType();
    if (serviceType.Compare("urn:schemas-upnp-org:service:AVTransport:1", true) == 0) {
        if (NPT_FAILED(action->VerifyArgumentValue("InstanceID", "0"))) {
            action->SetError(802,"Not valid InstanceID.");
            return NPT_FAILURE;
        }
    }

    if (name.Compare("GetCurrentTransportActions", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("GetDeviceCapabilities", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("GetMediaInfo", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("GetPositionInfo", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("GetTransportInfo", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("GetTransportSettings", true) == 0) {
        if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
            return NPT_FAILURE;
        }
        return NPT_SUCCESS;
    }
    if (name.Compare("Next", true) == 0) {
        return OnNext(action);
    }
    if (name.Compare("Pause", true) == 0) {
        return OnPause(action);
    }
    if (name.Compare("Play", true) == 0) {
        return OnPlay(action);
    }
    if (name.Compare("Previous", true) == 0) {
        return OnPrevious(action);
    }
    if (name.Compare("Seek", true) == 0) {
        return OnSeek(action);
    }
    if (name.Compare("Stop", true) == 0) {
        return OnStop(action);
    }
    if (name.Compare("SetAVTransportURI", true) == 0) {
        return OnSetAVTransportURI(action);
    }
    if (name.Compare("SetPlayMode", true) == 0) {
        return OnSetPlayMode(action);
    }

    action->SetError(401,"No Such Action.");
    return NPT_FAILURE;
}
Exemplo n.º 27
0
void cxEngine::Pause()
{
    pause = true;
    istouch = false;
    OnPause();
}