diff --git a/module-apps/application-notes/ApplicationNotes.cpp b/module-apps/application-notes/ApplicationNotes.cpp index 178e56298..045a659fc 100644 --- a/module-apps/application-notes/ApplicationNotes.cpp +++ b/module-apps/application-notes/ApplicationNotes.cpp @@ -29,7 +29,7 @@ namespace app sys::Message_t ApplicationNotes::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) { - auto retMsg = Application::DataReceivedHandler(msgl); + auto retMsg = Application::DataReceivedHandler(msgl); // if message was handled by application's template there is no need to process further. if ((reinterpret_cast(retMsg.get())->retCode == sys::ReturnCodes::Success)) { return retMsg; diff --git a/module-services/service-evtmgr/EventManager.cpp b/module-services/service-evtmgr/EventManager.cpp index 3bf3107a3..fae741432 100644 --- a/module-services/service-evtmgr/EventManager.cpp +++ b/module-services/service-evtmgr/EventManager.cpp @@ -19,6 +19,7 @@ #include "service-appmgr/ApplicationManager.hpp" #include "service-db/api/DBServiceAPI.hpp" #include "service-db/messages/DBNotificationMessage.hpp" +#include "AudioServiceAPI.hpp" #include "bsp/harness/bsp_harness.hpp" #include "harness/Parser.hpp" @@ -153,6 +154,13 @@ sys::Message_t EventManager::DataReceivedHandler(sys::DataMessage *msgl, sys::Re handled = true; } + else if (msgl->messageType == MessageType::AudioRoutingHeadset && msgl->sender == this->GetName()) { + auto *msg = dynamic_cast(msgl); + if (msg != nullptr) { + AudioServiceAPI::RoutingHeadset(this, msg->enable); + handled = true; + } + } else if (!targetApplication.empty() && dynamic_cast(msgl) != nullptr) { sys::Bus::SendUnicast(std::make_shared(), targetApplication, this); } @@ -210,7 +218,7 @@ sys::ReturnCodes EventManager::InitHandler() // create queues for worker // keyboard irq queue sys::WorkerQueueInfo qIrq = {"qIrq", sizeof(uint8_t), 10}; - // keyboard irq queue + // headset irq queue sys::WorkerQueueInfo qHeadset = {"qHeadset", sizeof(uint8_t), 10}; // battery manager queue sys::WorkerQueueInfo qBattery = {"qBattery", sizeof(uint8_t), 10}; diff --git a/module-services/service-evtmgr/WorkerEvent.cpp b/module-services/service-evtmgr/WorkerEvent.cpp index 1c1dba56b..b1e0c6c7d 100644 --- a/module-services/service-evtmgr/WorkerEvent.cpp +++ b/module-services/service-evtmgr/WorkerEvent.cpp @@ -71,7 +71,9 @@ bool WorkerEvent::handleMessage(uint32_t queueID) if (bsp::headset::Handler(notification) == true) { bool state = bsp::headset::IsInserted(); - AudioServiceAPI::RoutingHeadset(this->service, state); + auto message = std::make_shared(MessageType::AudioRoutingHeadset); + message->enable = state; + sys::Bus::SendUnicast(message, service::name::evt_manager, this->service); } }