Ejemplo n.º 1
0
void GameController::togglePause() {
  if (state == Running) {
    handlePaused();
  } else {
    handleRunning();
  }
}
Ejemplo n.º 2
0
/*!
    A report that a new connection to the LabTool Hardware has been made.
    The \a newComm instance is sent to the \ref LabToolCaptureDevice
    and \ref LabToolGeneratorDevice after updating all signal connections.
*/
void LabToolDevice::handleNewConnection(LabToolDeviceComm *newComm)
{
    if (mDeviceComm != NULL) {
        mDeviceComm->disconnect();
        delete mDeviceComm;
    }
    mDeviceComm = newComm;

    /* Handle signals related to connection status */

    QObject::connect(mDeviceComm, SIGNAL(connectionStatus(bool)),
            this, SLOT(handleConnectedStatus(bool)));


    /* Handle signals related to capture */

    QObject::connect(mDeviceComm, SIGNAL(captureStopped()),
            mCaptureDevice, SLOT(handleStopped()));

    QObject::connect(mDeviceComm, SIGNAL(captureReceivedSamples(LabToolDeviceTransfer*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int)),
            mCaptureDevice, SLOT(handleReceivedSamples(LabToolDeviceTransfer*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int)));

    QObject::connect(mDeviceComm, SIGNAL(captureConfigurationDone()),
            mCaptureDevice, SLOT(handleConfigurationDone()));

    QObject::connect(mDeviceComm, SIGNAL(captureFailed(const char*)),
            mCaptureDevice, SLOT(handleFailedCapture(const char*)));

    QObject::connect(mDeviceComm, SIGNAL(captureConfigurationFailed(const char*)),
            mCaptureDevice, SLOT(handleConfigurationFailure(const char*)));


    /* Handle signals related to generator */

    QObject::connect(mDeviceComm, SIGNAL(generatorStopped()),
            mGeneratorDevice, SLOT(handleStopped()));

    QObject::connect(mDeviceComm, SIGNAL(generatorConfigurationDone()),
            mGeneratorDevice, SLOT(handleConfigurationDone()));

    QObject::connect(mDeviceComm, SIGNAL(generatorConfigurationFailed(const char*)),
            mGeneratorDevice, SLOT(handleConfigurationFailure(const char*)));

    QObject::connect(mDeviceComm, SIGNAL(generatorRunFailed(const char*)),
            mGeneratorDevice, SLOT(handleRunningFailure(const char*)));

    QObject::connect(mDeviceComm, SIGNAL(generatorRunning()),
            mGeneratorDevice, SLOT(handleRunning()));


    mCaptureDevice->setDeviceComm(newComm);
    mGeneratorDevice->setDeviceComm(newComm);

    handleConnectedStatus(true);
}