コード例 #1
0
ファイル: plaintextcode.c プロジェクト: DineshLMS/mbeddr.core
}
 
void processUnconnectedState(inputData* inputData, outputData* outputData) { 
  // some platform-specific stuff 
  if (inputData->isSpecialStateRequested) { 
    enterPrepareSpecialModeState(); 
  } else if (inputData->isResetRequested) { 
    enterResettingState(outputData); 
  } else if (inputData->isConnectRequested) { 
    enterConnectingState(outputData); 
  } else if (inputData->message != null) { 
    if (inputData->message->nrOfKeys > 0) { 
      enterConnectingState(outputData); 
コード例 #2
0
ファイル: plaintextcode.c プロジェクト: DineshLMS/mbeddr.core
void processInitializingState(inputData* inputData, outputData* outputData) { 
  // Keys or accelerometer may trigger a wake-up from standby. For this to work, the  
 keyboard
/accelerometer interface must stop to bring the hardware in the correct 
 state. For this to be allowed, the keyboard interface must first be started.
 
  startDevice(keyboard); 
  stopDevice(keyboard); 
  startDevice(accelerometer); 
  stopDevice(accelerometer); 
   
  if (inputData->hostState == connected) { 
    enterConnectedStateFromInitializingState(); 
  } else { 
    enterConnectingState(outputData); 
  } if 
コード例 #3
0
ファイル: plaintextcode.c プロジェクト: DineshLMS/mbeddr.core
}
 
void processConnectedState(inputData* inputData, outputData* outputData) { 
  // some platform-specific stuff 
  if (inputData->isSpecialStateRequested) { 
    enterPrepareSpecialModeState(); 
  } else if (inputData->isResetRequested) { 
    enterResettingState(outputData); 
  } else if (inputData->isUpdateRequested) { 
    enterUpdatingState(outputData); 
  } else if (inputData->isConnectRequested) { 
    enterConnectingState(outputData); 
  } else if (inputData->hostState == unconnected) { 
    enterPrepareStandbyStateFromConnectedState(outputData); 
  } else if (connected2StandbyConditionsMet(inputData)) { 
    enterPrepareStandbyStateFromConnectedState(outputData); 
コード例 #4
0
ファイル: ApplicationCore.cpp プロジェクト: KDAB/Charm
void ApplicationCore::setState(State state)
{
    if (m_state == state)
        return;
    qDebug() << "ApplicationCore::setState: going from" << StateNames[m_state]
             << "to" << StateNames[state];
    State previous = m_state;

    try {
        switch (m_state) {
        case Constructed:
            break; // ignore, but this state is never re-entered
        case StartingUp:
            leaveStartingUpState();
            break;
        case Configuring:
            leaveConfiguringState();
            break;
        case Connecting:
            leaveConnectingState();
            break;
        case Connected:
            leaveConnectedState();
            break;
        case Disconnecting:
            leaveDisconnectingState();
            break;
        case ShuttingDown:
            leaveShuttingDownState();
            break;
        default:
            Q_ASSERT_X(false, "ApplicationCore::setState",
                       "Unknown previous application state");
        }

        m_state = state;
        Q_FOREACH (auto e, m_uiElements)
            e->stateChanged(m_state);

        switch (m_state) {
        case StartingUp:
            m_model.charmDataModel()->stateChanged(previous, state);
            m_controller.stateChanged(previous, state);
            // FIXME unnecessary?
            // m_mainWindow.stateChanged(previous);
            // m_timeTracker.stateChanged( previous );
            enterStartingUpState();
            break;
        case Configuring:
            enterConfiguringState();
            break;
        case Connecting:
            m_model.charmDataModel()->stateChanged(previous, state);
            m_controller.stateChanged(previous, state);
            // FIXME unnecessary?
            // m_mainWindow.stateChanged(previous);
            // m_timeTracker.stateChanged( previous );
            enterConnectingState();
            break;
        case Connected:
            m_model.charmDataModel()->stateChanged(previous, state);
            m_controller.stateChanged(previous, state);
            // FIXME unnecessary?
            // m_mainWindow.stateChanged(previous);
            // m_timeTracker.stateChanged( previous );
            enterConnectedState();
            break;
        case Disconnecting:
            // FIXME unnecessary?
            // m_timeTracker.stateChanged( previous );
            // m_mainWindow.stateChanged(previous);
            m_model.charmDataModel()->stateChanged(previous, state);
            m_controller.stateChanged(previous, state);
            enterDisconnectingState();
            break;
        case ShuttingDown:
            // FIXME unnecessary?
            // m_timeTracker.stateChanged( previous );
            // m_mainWindow.stateChanged(previous);
            m_model.charmDataModel()->stateChanged(previous, state);
            m_controller.stateChanged(previous, state);
            enterShuttingDownState();
            break;
        default:
            Q_ASSERT_X(false, "ApplicationCore::setState",
                       "Unknown new application state");
        }
    } catch (const CharmException &e) {
        showCritical(tr("Critical Charm Problem"), e.what());
        QCoreApplication::quit();
    }
}