void Adsb_device::Process_on_disable(ugcs::vsm::Request::Ptr request) { LOG_DEBUG("ADSB Device disable in progress."); while(!read_requests.empty()) { read_requests.front()->Abort(); read_requests.pop(); } On_disable(); request->Complete(); }
/** [Define sample request processing implementation] */ void Sample_processor::Process_api_call(int param, ugcs::vsm::Request::Ptr request, Handler handler) { auto lock = request->Lock(); if (!request->Is_processing()) { /* It might be canceled. */ return; } handler.Set_args(param * 2); request->Complete(ugcs::vsm::Request::Status::OK, std::move(lock)); }
void Red_button_processor::Fire_event_handler(Event_id event_id, ugcs::vsm::Request::Ptr req, Event_handler handler) { Event &event = event_queue[event_id & (EVENT_QUEUE_SIZE - 1)]; ugcs::vsm::Io_result result = event.state == State_code::INITIAL ? ugcs::vsm::Io_result::CLOSED : ugcs::vsm::Io_result::OK; bool pressed = event.state == State_code::PRESSED; auto lock = req->Lock(); if (req->Is_processing()) { handler.Set_args(pressed, result); req->Complete(ugcs::vsm::Request::Status::OK, std::move(lock)); } }
void Adsb_device::Process_on_enable(ugcs::vsm::Request::Ptr request) { On_enable(); request->Complete(); }