void Geolocation::startRequest(GeoNotifier *notifier) { if (frame()->settings()->strictPowerfulFeatureRestrictions()) { String errorMessage; if (!executionContext()->securityOrigin()->canAccessFeatureRequiringSecureOrigin(errorMessage)) { notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, errorMessage)); return; } } // Check whether permissions have already been denied. Note that if this is the case, // the permission state can not change again in the lifetime of this page. if (isDenied()) notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage)); else if (haveSuitableCachedPosition(notifier->options())) notifier->setUseCachedPosition(); else if (!notifier->options().timeout()) notifier->startTimer(); else if (!isAllowed()) { // if we don't yet have permission, request for permission before calling startUpdating() m_pendingForPermissionNotifiers.add(notifier); requestPermission(); } else if (startUpdating(notifier)) notifier->startTimer(); else notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, failedToStartServiceErrorMessage)); }
void Geolocation::startRequest(GeoNotifier* notifier) { if (shouldBlockGeolocationRequests()) { notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, originCannotRequestGeolocationErrorMessage)); return; } document()->setGeolocationAccessed(); // Check whether permissions have already been denied. Note that if this is the case, // the permission state can not change again in the lifetime of this page. if (isDenied()) notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage)); else if (haveSuitableCachedPosition(notifier->options())) notifier->setUseCachedPosition(); else if (notifier->hasZeroTimeout()) notifier->startTimerIfNeeded(); else if (!isAllowed()) { // if we don't yet have permission, request for permission before calling startUpdating() m_pendingForPermissionNotifiers.add(notifier); requestPermission(); } else if (startUpdating(notifier)) notifier->startTimerIfNeeded(); else notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, failedToStartServiceErrorMessage)); }
void Geolocation::makeCachedPositionCallbacks() { // All modifications to m_requestsAwaitingCachedPosition are done // asynchronously, so we don't need to worry about it being modified from // the callbacks. for (auto& notifier : m_requestsAwaitingCachedPosition) { // FIXME: This seems wrong, since makeCachedPositionCallbacks() is called in a branch where // lastPosition() is known to be null in Geolocation::setIsAllowed(). notifier->runSuccessCallback(lastPosition()); // If this is a one-shot request, stop it. Otherwise, if the watch still // exists, start the service to get updates. if (!m_oneShots.remove(notifier.get()) && m_watchers.contains(notifier.get())) { if (notifier->hasZeroTimeout() || startUpdating(notifier.get())) notifier->startTimerIfNeeded(); else notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, failedToStartServiceErrorMessage)); } } m_requestsAwaitingCachedPosition.clear(); if (!hasListeners()) stopUpdating(); }
void ScreenOrientationController::notifyDispatcher() { if (m_orientation && page()->visibilityState() == PageVisibilityStateVisible) startUpdating(); else stopUpdating(); }
QDroneDesktop::QDroneDesktop() { setupUi(this); _dctrl = new DeviceController(); _pDashboard = new QDroneDashboard(_dctrl, this->wCtrlContainer); _pDriveCtrl = new QDriveControl(_dctrl, this->wCtrlContainer); _pAnimCtrl = new QAnimationControl(_dctrl, this->wCtrlContainer); this->wCtrlContainer->layout()->addWidget(_pDashboard); this->wCtrlContainer->layout()->addWidget(_pDriveCtrl); this->wCtrlContainer->layout()->addWidget(_pAnimCtrl); QGridLayout* videoLayout = new QGridLayout(); videoLayout->setContentsMargins(0, 0, 0, 0); videoLayout->setObjectName(QString::fromUtf8("videoLayout")); wVideoContainer->setLayout(videoLayout); connect(actionConnect, SIGNAL(triggered()), this, SLOT(connectDrone())); connect(actionDisonnect, SIGNAL(triggered()), this, SLOT(disconnectDrone())); connect(actionStart_Video, SIGNAL(triggered()), this, SLOT(startVideo())); connect(actionStop_Video, SIGNAL(triggered()), this, SLOT(stopVideo())); connect(actionStart_Updating, SIGNAL(triggered()), _pDashboard, SLOT(startUpdating())); connect(actionStop_Updating, SIGNAL(triggered()), _pDashboard, SLOT(stopUpdating())); }
void ScreenOrientationController::notifyDispatcher() { if (m_orientation && page()->isPageVisible()) startUpdating(); else stopUpdating(); }
PassRefPtr<Geolocation::GeoNotifier> Geolocation::startRequest(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options) { RefPtr<GeoNotifier> notifier = GeoNotifier::create(this, successCallback, errorCallback, options); // Check whether permissions have already been denied. Note that if this is the case, // the permission state can not change again in the lifetime of this page. if (isDenied()) notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage)); else if (haveSuitableCachedPosition(notifier->m_options.get())) notifier->setUseCachedPosition(); else if (notifier->hasZeroTimeout()) notifier->startTimerIfNeeded(); #if USE(PREEMPT_GEOLOCATION_PERMISSION) else if (!isAllowed()) { // if we don't yet have permission, request for permission before calling startUpdating() m_pendingForPermissionNotifiers.add(notifier); requestPermission(); } #endif else if (startUpdating(notifier.get())) notifier->startTimerIfNeeded(); else notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, failedToStartServiceErrorMessage)); return notifier.release(); }
void Geolocation::onGeolocationPermissionUpdated( mojom::blink::PermissionStatus status) { // This may be due to either a new position from the service, or a cached // position. m_geolocationPermission = status == mojom::blink::PermissionStatus::GRANTED ? PermissionAllowed : PermissionDenied; m_permissionService.reset(); // While we iterate through the list, we need not worry about the list being // modified as the permission is already set to Yes/No and no new listeners // will be added to the pending list. for (GeoNotifier* notifier : m_pendingForPermissionNotifiers) { if (isAllowed()) { // Start all pending notification requests as permission granted. // The notifier is always ref'ed by m_oneShots or m_watchers. startUpdating(notifier); notifier->startTimer(); } else { notifier->setFatalError(PositionError::create( PositionError::kPermissionDenied, permissionDeniedErrorMessage)); } } m_pendingForPermissionNotifiers.clear(); }
void Geolocation::makeCachedPositionCallbacks() { // All modifications to m_requestsAwaitingCachedPosition are done // asynchronously, so we don't need to worry about it being modified from // the callbacks. GeoNotifierSet::const_iterator end = m_requestsAwaitingCachedPosition.end(); for (GeoNotifierSet::const_iterator iter = m_requestsAwaitingCachedPosition.begin(); iter != end; ++iter) { GeoNotifier* notifier = iter->get(); notifier->runSuccessCallback(lastPosition()); // If this is a one-shot request, stop it. Otherwise, if the watch still // exists, start the service to get updates. if (m_oneShots.contains(notifier)) m_oneShots.remove(notifier); else if (m_watchers.contains(notifier)) { if (notifier->hasZeroTimeout() || startUpdating(notifier)) notifier->startTimerIfNeeded(); else notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, failedToStartServiceErrorMessage)); } } m_requestsAwaitingCachedPosition.clear(); if (!hasListeners()) stopUpdating(); }
void Geolocation::startRequest(GeoNotifier* notifier) { recordOriginTypeAccess(); String errorMessage; if (!frame()->settings()->allowGeolocationOnInsecureOrigins() && !getExecutionContext()->isSecureContext(errorMessage)) { notifier->setFatalError( PositionError::create(PositionError::kPermissionDenied, errorMessage)); return; } // Check whether permissions have already been denied. Note that if this is // the case, the permission state can not change again in the lifetime of // this page. if (isDenied()) notifier->setFatalError(PositionError::create( PositionError::kPermissionDenied, permissionDeniedErrorMessage)); else if (haveSuitableCachedPosition(notifier->options())) notifier->setUseCachedPosition(); else if (!notifier->options().timeout()) notifier->startTimer(); else if (!isAllowed()) { // If we don't yet have permission, request for permission before calling // startUpdating() m_pendingForPermissionNotifiers.add(notifier); requestPermission(); } else { startUpdating(notifier); notifier->startTimer(); } }
WebKitGamepadList* NavigatorGamepad::webkitGamepads() { startUpdating(); if (!m_webkitGamepads) m_webkitGamepads = WebKitGamepadList::create(); sampleGamepads<WebKitGamepad>(m_webkitGamepads.get()); return m_webkitGamepads.get(); }
void NavigatorGamepad::didAddEventListener(LocalDOMWindow*, const AtomicString& eventType) { if (isGamepadEvent(eventType)) { if (page() && page()->visibilityState() == PageVisibilityStateVisible) startUpdating(); m_hasEventListener = true; } }
void DeviceOrientationController::didAddEventListener(DOMWindow* window, const AtomicString& eventType) { if (eventType == EventTypeNames::deviceorientation && RuntimeEnabledFeatures::deviceOrientationEnabled()) { if (page() && page()->visibilityState() == PageVisibilityStateVisible) startUpdating(); m_hasEventListener = true; } }
void NavigatorGamepad::didAddEventListener(DOMWindow*, const AtomicString& eventType) { if (RuntimeEnabledFeatures::gamepadEnabled() && (eventType == EventTypeNames::gamepadconnected || eventType == EventTypeNames::gamepaddisconnected)) { if (page() && page()->visibilityState() == PageVisibilityStateVisible) startUpdating(); m_hasEventListener = true; } }
GamepadList* NavigatorGamepad::gamepads() { startUpdating(); if (!m_gamepads) m_gamepads = GamepadList::create(); sampleGamepads<Gamepad>(m_gamepads.get()); return m_gamepads.get(); }
void PlatformEventController::pageVisibilityChanged() { if (!m_hasEventListener) return; if (page()->isPageVisible()) startUpdating(); else stopUpdating(); }
bool NavigatorGamepad::startUpdatingIfAttached() { // The frame must be attached to start updating. if (frame() && frame()->host()) { startUpdating(); return true; } return false; }
void DeviceEventControllerBase::pageVisibilityChanged() { if (!m_hasEventListener) return; if (page()->visibilityState() == PageVisibilityStateVisible) startUpdating(); else stopUpdating(); }
void DeviceSingleWindowEventController::didAddEventListener(LocalDOMWindow* window, const AtomicString& eventType) { if (eventType != eventTypeName()) return; if (page() && page()->isPageVisible()) startUpdating(); m_hasEventListener = true; }
GamepadList* NavigatorGamepad::gamepads() { if (!m_gamepads) m_gamepads = GamepadList::create(); if (frame() && frame()->host()) { // The frame must be attached to start updating. startUpdating(); sampleGamepads<Gamepad>(m_gamepads.get()); } return m_gamepads.get(); }
void Geolocation::handlePendingPermissionNotifiers() { // While we iterate through the list, we need not worry about list being modified as the permission // is already set to Yes/No and no new listeners will be added to the pending list for (auto& notifier : m_pendingForPermissionNotifiers) { if (isAllowed()) { // start all pending notification requests as permission granted. // The notifier is always ref'ed by m_oneShots or m_watchers. if (startUpdating(notifier.get())) notifier->startTimerIfNeeded(); else notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, failedToStartServiceErrorMessage)); } else notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage)); } }
void Geolocation::requestUsesCachedPosition(GeoNotifier* notifier) { DCHECK(isAllowed()); notifier->runSuccessCallback(m_lastPosition); // If this is a one-shot request, stop it. Otherwise, if the watch still // exists, start the service to get updates. if (m_oneShots.contains(notifier)) { m_oneShots.remove(notifier); } else if (m_watchers.contains(notifier)) { if (notifier->options().timeout()) startUpdating(notifier); notifier->startTimer(); } if (!hasListeners()) stopUpdating(); }
ScriptPromise BatteryManager::startRequest(ScriptState* scriptState) { if (m_state == Pending) return m_resolver->promise(); m_resolver = ScriptPromiseResolverWithContext::create(scriptState); ScriptPromise promise = m_resolver->promise(); if (m_state == Resolved) { // FIXME: Consider returning the same promise in this case. See crbug.com/385025. m_resolver->resolve(this); } else if (m_state == NotStarted) { m_state = Pending; m_hasEventListener = true; startUpdating(); } return promise; }
void Geolocation::handlePendingPermissionNotifiers() { // While we iterate through the list, we need not worry about list being modified as the permission // is already set to Yes/No and no new listeners will be added to the pending list GeoNotifierSet::const_iterator end = m_pendingForPermissionNotifiers.end(); for (GeoNotifierSet::const_iterator iter = m_pendingForPermissionNotifiers.begin(); iter != end; ++iter) { GeoNotifier* notifier = iter->get(); if (isAllowed()) { // start all pending notification requests as permission granted. // The notifier is always ref'ed by m_oneShots or m_watchers. if (startUpdating(notifier)) notifier->startTimerIfNeeded(); else notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, ASCIILiteral(failedToStartServiceErrorMessage))); } else notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, ASCIILiteral(permissionDeniedErrorMessage))); } }
PassRefPtr<Geolocation::GeoNotifier> Geolocation::startRequest(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options) { RefPtr<GeoNotifier> notifier = GeoNotifier::create(this, successCallback, errorCallback, options); // Check whether permissions have already been denied. Note that if this is the case, // the permission state can not change again in the lifetime of this page. if (isDenied()) notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage)); else if (haveSuitableCachedPosition(notifier->m_options.get())) notifier->setUseCachedPosition(); else if (notifier->hasZeroTimeout() || startUpdating(notifier.get())) { #if ENABLE(CLIENT_BASED_GEOLOCATION) // Only start timer if we're not waiting for user permission. if (!m_startRequestPermissionNotifier) #endif notifier->startTimerIfNeeded(); } else notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, failedToStartServiceErrorMessage)); return notifier.release(); }
ScriptPromise BatteryManager::startRequest(ScriptState* scriptState) { if (m_state == Pending) return m_resolver->promise(); m_resolver = ScriptPromiseResolver::create(scriptState); ScriptPromise promise = m_resolver->promise(); ASSERT(executionContext()); // If the context is in a stopped state already, do not start updating. if (m_state == Resolved || executionContext()->activeDOMObjectsAreStopped()) { // FIXME: Consider returning the same promise in this case. See crbug.com/385025. m_state = Resolved; m_resolver->resolve(this); } else if (m_state == NotStarted) { m_state = Pending; m_hasEventListener = true; startUpdating(); } return promise; }
void Geolocation::startRequest(GeoNotifier *notifier) { if (frame()->settings()->strictPowerfulFeatureRestrictions()) { String errorMessage; if (!executionContext()->isSecureContext(errorMessage)) { notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, errorMessage)); return; } } if (RuntimeEnabledFeatures::restrictIFramePermissionsEnabled()) { // TODO(keenanb): kill the request if the parent is blocking the requester Element* owner = document()->ownerElement(); if (owner && owner->hasAttribute(HTMLNames::permissionsAttr)) { String errorMessage = "A cross-origin iframe needs its permissions attribute properly set in order to use the geolocation API."; notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, errorMessage)); return; } } // Check whether permissions have already been denied. Note that if this is the case, // the permission state can not change again in the lifetime of this page. if (isDenied()) notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage)); else if (haveSuitableCachedPosition(notifier->options())) notifier->setUseCachedPosition(); else if (!notifier->options().timeout()) notifier->startTimer(); else if (!isAllowed()) { // if we don't yet have permission, request for permission before calling startUpdating() m_pendingForPermissionNotifiers.add(notifier); requestPermission(); } else if (startUpdating(notifier)) notifier->startTimer(); else notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, failedToStartServiceErrorMessage)); }
void NavigatorGamepad::pageVisibilityChanged() { // Inform the embedder whether it needs to provide gamepad data for us. bool visible = page()->visibilityState() == PageVisibilityStateVisible; if (visible && (m_hasEventListener || m_gamepads)) startUpdating(); else stopUpdating(); if (!visible || !m_hasEventListener) return; // Tell the page what has changed. m_gamepads contains the state before we became hidden. // We create a new snapshot and compare them. GamepadList* oldGamepads = m_gamepads.release(); gamepads(); GamepadList* newGamepads = m_gamepads.get(); ASSERT(newGamepads); for (unsigned i = 0; i < WebGamepads::itemsLengthCap; ++i) { Gamepad* oldGamepad = oldGamepads ? oldGamepads->item(i) : 0; Gamepad* newGamepad = newGamepads->item(i); bool oldWasConnected = oldGamepad && oldGamepad->connected(); bool newIsConnected = newGamepad && newGamepad->connected(); bool connectedGamepadChanged = oldWasConnected && newIsConnected && oldGamepad->id() != newGamepad->id(); if (connectedGamepadChanged || (oldWasConnected && !newIsConnected)) { oldGamepad->setConnected(false); m_pendingEvents.append(oldGamepad); } if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { m_pendingEvents.append(newGamepad); } } if (!m_pendingEvents.isEmpty()) m_dispatchOneEventRunner.runAsync(); }
int main( int argc, char *argv[] ) { try { _2Real::app::Engine testEngine; auto loadedBundle = testEngine.loadBundle( "TestBundle_BasicBlocksAndCustomTypes" ); // -------print the block metainfo--------- auto bundleinfo = loadedBundle.second; std::cout << "basic bundle info" << std::endl; std::cout << "description " << bundleinfo.getDescription() << std::endl; std::cout << "category " << bundleinfo.getCategory() << std::endl; std::cout << "author " << bundleinfo.getAuthor() << std::endl; std::cout << "contact " << bundleinfo.getContact() << std::endl; std::cout << "version " << bundleinfo.getVersion() << std::endl; std::cout << std::endl; // i know that these are custom types, so no need for casting around auto typeinfos = bundleinfo.getExportedTypes(); std::cout << "number of exported types : " << typeinfos.size() << std::endl; if ( !typeinfos.empty() ) std::cout << "--------------------------------" << std::endl; for ( auto it : typeinfos ) { printCustomTypeMetainfo( it ); std::cout << "--------------------------------" << std::endl; } std::cout << std::endl; auto blockinfos = bundleinfo.getExportedBlocks(); std::cout << "exported blocks " << blockinfos.size() << std::endl; for ( auto it : blockinfos ) { std::cout << "\t" << it.getName() << std::endl; std::cout << "\t" << it.getDescription() << std::endl; auto dependencies = it.getDependenciesByName(); std::cout << "\tdependencies\t"; for ( auto it : dependencies ) std::cout << it << " "; std::cout << std::endl; std::vector< _2Real::app::InletMetainfo > inletinfos = it.getInlets(); std::cout << "\tinlets " << inletinfos.size() << std::endl; for ( auto it : inletinfos ) { std::cout << "\t\tname " << it.getName() << std::endl; std::cout << "\t\tdescription " << it.getDescription() << std::endl; std::cout << "\t\tdatatype " << it.getTypeMetainfo()->getName() << std::endl; std::cout << "\t\tinitial "; boost::apply_visitor< _2Real::PrintOutVisitor >( _2Real::PrintOutVisitor( std::cout ), it.getInitialValue() ); std::cout << std::endl; std::cout << "\t\tis multi " << std::boolalpha << it.isMulti() << std::endl; } std::vector< _2Real::app::OutletMetainfo > outletinfos = it.getOutlets(); std::cout << "\toutlets " << outletinfos.size() << std::endl; for ( auto it : outletinfos ) { std::cout << "\t\tname " << it.getName() << std::endl; std::cout << "\t\tdescription " << it.getDescription() << std::endl; std::cout << "\t\tdatatype " << it.getTypeMetainfo()->getName() << std::endl; std::cout << "\t\tinitial "; boost::apply_visitor< _2Real::PrintOutVisitor >( _2Real::PrintOutVisitor( std::cout ), it.getInitialValue() ); std::cout << std::endl; } std::vector< _2Real::app::ParameterMetainfo > paraminfos = it.getParameters(); std::cout << "\tparameters " << paraminfos.size() << std::endl; for ( auto it : paraminfos ) { std::cout << "\t\tname " << it.getName() << std::endl; std::cout << "\t\tdescription " << it.getDescription() << std::endl; std::cout << "\t\tdatatype " << it.getTypeMetainfo()->getName() << std::endl; std::cout << "\t\tinitial "; boost::apply_visitor< _2Real::PrintOutVisitor >( _2Real::PrintOutVisitor( std::cout ), it.getInitialValue() ); std::cout << std::endl; } } // -------create block instances--------- auto bundle = loadedBundle.first; auto threadpool = testEngine.createThreadpool( _2Real::ThreadpoolPolicy::FIFO ); auto counter = loadedBundle.first.createBlock( "counter", threadpool, std::vector< _2Real::app::BlockHandle >() ); auto io = counter.getBlockIo(); auto counterinfo = bundleinfo.getExportedBlock( "counter" ); auto inc = std::static_pointer_cast< _2Real::app::InletHandle >( counter.getBlockIo().mInlets[ 0 ] ); auto incinfo = counterinfo.getInlet( "increment" ); auto stringy = std::static_pointer_cast< _2Real::app::InletHandle >( counter.getBlockIo().mInlets[ 1 ] ); auto stringyinfo = counterinfo.getInlet( "stringy" ); auto multiinlet = std::static_pointer_cast< _2Real::app::MultiInletHandle >( counter.getBlockIo().mInlets[ 2 ] ); auto multiinletinfo = counterinfo.getInlet( "multi" ); std::deque< _2Real::app::InletHandle > subinlets; auto info = incinfo.getTypeMetainfo(); auto custominfo = std::static_pointer_cast< _2Real::app::CustomTypeMetainfo >( info ); auto basicinfo = stringyinfo.getTypeMetainfo(); uint32_t aNumber = 0; auto aSimple = custominfo->makeCustomData(); aSimple.set( "uint_field", aNumber ); std::string aString = ""; auto policy = counter.getUpdatePolicy(); policy.set( _2Real::DefaultUpdatePolicy::ANY ); auto timer = testEngine.createTimer( 4.0 ); timer.start(); std::future< _2Real::BlockResult > setup = counter.setup(); handleFuture( setup ); while( 1 ) { std::this_thread::yield(); std::string line; char lineEnd = '\n'; std::getline( std::cin, line, lineEnd ); if ( line == "q" ) break; else if ( line == "test" ) { //aNumber += 1; //aSimple.set( "uint_field", aNumber ); //inc->setValue( aSimple ); //aString.appeqnd( " next" ); //stringy->setValue( aString ); for ( auto it : subinlets ) { std::shared_ptr< _2Real::DataItem > data( new _2Real::DataItem( ( uint32_t ) 10 ) ); it.setValue( data ); } std::this_thread::sleep_for( std::chrono::milliseconds( 200 ) ); //aNumber += 1; //aSimple.set( "uint_field", aNumber ); //inc->setValue( aSimple ); //aString.append( " next" ); //stringy->setValue( aString );q std::this_thread::sleep_for( std::chrono::milliseconds( 200 ) ); //aNumber += 1; //aSimple.set( "uint_field", aNumber ); //inc->setValue( aSimple ); //aString.append( " next" ); //stringy->setqValue( aString ); } else if ( line == "policy" ) { std::future< _2Real::BlockResult > start = counter.startUpdating(); handleFuture( start ); } else if ( line == "timer" ) { std::future< _2Real::BlockResult > start = counter.startUpdating( timer ); handleFuture( start ); } else if ( line == "done" ) { std::future< _2Real::BlockResult > stop = counter.stopUpdating(); handleFuture( stop ); } else if ( line == "add" ) { _2Real::app::InletHandle subinlet = multiinlet->add(); subinlets.push_back( subinlet ); } else if ( line == "del" ) { if ( !subinlets.empty() ) { multiinlet->remove( subinlets.back() ); subinlets.pop_back(); } } } std::future< _2Real::BlockResult > stop = counter.stopUpdating(); handleFuture( stop ); std::future< _2Real::BlockResult > shutdown = counter.shutdown(); handleFuture( shutdown ); while( 1 ) { std::this_thread::yield(); std::string line; char lineEnd = '\n'; std::getline( std::cin, line, lineEnd ); if ( line == "q" ) break; } testEngine.clear(); while( 1 ) { std::this_thread::yield(); std::string line; char lineEnd = '\n'; std::getline( std::cin, line, lineEnd ); if ( line == "q" ) break; } } catch ( _2Real::Exception &e ) { std::cout << "-------------exception caught in main------------" << std::endl; std::cout << e.what() << " " << e.message() << std::endl; std::cout << "-------------exception caught in main------------" << std::endl; } catch ( std::exception const& e ) { std::cout << "-------------exception caught in main------------" << std::endl; std::cout << e.what() << std::endl; std::cout << "-------------exception caught in main------------" << std::endl; } while( 1 ) { std::this_thread::yield(); std::string line; char lineEnd = '\n'; std::getline( std::cin, line, lineEnd ); if ( line == "q" ) break; } return 0; }
void BatteryManager::resume() { m_hasEventListener = true; startUpdating(); }