void toggleOrangeLed() { static char ledState = 0; if((ledState ^= 1) == 1) { ledOrangeOn(); } else { ledOrangeOff(); } setLedState(ledState); }
Driver:: Driver(const std::string& iIpAddress, const int iMtu) { mImp.reset(new Imp(this)); mImp->mChannel = crl::multisense::Channel::Create(iIpAddress); if (mImp->mChannel == NULL) { std::cerr << "error: failed to create multisense channel" << std::endl; return; } std::cout << "successfully connected to device" << std::endl; auto status = mImp->mChannel->setMtu(iMtu); if (crl::multisense::Status_Ok != status) { std::cout << "warning: could not set mtu to " << iMtu << " (" << mImp->mChannel->statusString(status) << ")" << std::endl; } setLedState(false, 0); mImp->mImu.reset(new Imu(mImp->mChannel)); mImp->mLaser.reset(new Laser(mImp->mChannel)); mImp->mCamera.reset(new Camera(mImp->mChannel)); }
bool Driver:: stop() { if (!mImp->mIsRunning) return false; mImp->mIsRunning = false; if (mImp->mCommandSubscription != NULL) { mImp->mSubscribeLcm->unsubscribe(mImp->mCommandSubscription); } mImp->mCamera->stop(); if (mImp->mEnableLaser) { mImp->mLaser->stop(); } if (mImp->mEnableImu) { mImp->mImu->stop(); } setLedState(false, 0); std::cout << "driver stopped" << std::endl; return true; }