void Scheduler::_runLocal() { while ( !_terminate.load( std::memory_order::memory_order_relaxed ) ) { auto maybeUpdate = _stateUpdateIn.timeoutDequeue( _heartbeat.threshold() / 10 ); if ( !maybeUpdate.isNothing() ) { auto update = maybeUpdate.value(); _globalState.update( update.state ); std::cerr << "state update: { id = " << update.state.id << ", timestamp = " << update.state.timestamp << ", changeType = " << showChange( update.changeType ) << ", changeFloor = " << update.changeFloor << ", stopped = " << update.state.stopped << ", direction = " << int( update.state.direction ) << " }" << std::endl; if ( update.state.id == _localElevId ) { _stateUpdateOut.enqueue( update ); // propagate update } // each elevator is responsible for scheduling commnads from its hardware switch ( update.changeType ) { case ChangeType::None: case ChangeType::KeepAlive: case ChangeType::OtherChange: continue; case ChangeType::ButtonUpPressed: _handleButtonPress( update.state.id, ButtonType::CallUp, update.changeFloor ); break; case ChangeType::ButtonDownPressed: _handleButtonPress( update.state.id, ButtonType::CallDown, update.changeFloor ); break; case ChangeType::ServedDown: _forwardToTargets( Command{ CommandType::TurnOffLightDown, _localElevId, update.changeFloor } ); break; case ChangeType::ServedUp: _forwardToTargets( Command{ CommandType::TurnOffLightUp, _localElevId, update.changeFloor } ); break; } } _heartbeat.beat(); } }
void tipClass::addText() { ChangeDialog *changedlg = new ChangeDialog(this); connect(changedlg, SIGNAL(sendInfo(std::string, QDate, QDateTime)), this, SLOT(showChange(std::string, QDate, QDateTime))); changedlg->show(); }