diff --git a/module-apps/Application.cpp b/module-apps/Application.cpp index a89db0fc1..871b30320 100644 --- a/module-apps/Application.cpp +++ b/module-apps/Application.cpp @@ -77,7 +77,7 @@ namespace app settings(std::make_unique(this)) { topBarManager->enableIndicators({gui::top_bar::Indicator::Time}); - busChannels.push_back(sys::BusChannels::ServiceCellularNotifications); + bus.channels.push_back(sys::BusChannel::ServiceCellularNotifications); longPressTimer = std::make_unique("LongPress", this, key_timer_ms); longPressTimer->connect([&](sys::Timer &) { longPressTimerCallback(); }); @@ -146,7 +146,7 @@ namespace app else if (suspendInProgress) { message->setCommandType(service::gui::DrawMessage::Type::SUSPEND); } - sys::Bus::SendUnicast(std::move(message), service::name::gui, this); + bus.sendUnicast(std::move(message), service::name::gui); } if (suspendInProgress) @@ -171,12 +171,12 @@ namespace app window = getCurrentWindow()->getName(); auto msg = std::make_shared(window, getCurrentWindow()->getName(), std::move(data), cmd); - sys::Bus::SendUnicast(msg, this->GetName(), this); + bus.sendUnicast(msg, this->GetName()); } else { auto msg = std::make_shared( windowName, getCurrentWindow() ? getCurrentWindow()->getName() : "", std::move(data), cmd); - sys::Bus::SendUnicast(msg, this->GetName(), this); + bus.sendUnicast(msg, this->GetName()); } } @@ -195,7 +195,7 @@ namespace app { if (not windowsStack.isEmpty()) { auto msg = std::make_shared(mode, getCurrentWindow()->getName()); - sys::Bus::SendUnicast(msg, this->GetName(), this); + bus.sendUnicast(msg, this->GetName()); } } @@ -549,10 +549,8 @@ namespace app { using namespace bsp; - auto retGetState = sys::Bus::SendUnicast(std::make_shared(torch::Action::getState), - service::name::evt_manager, - this, - pdMS_TO_TICKS(1500)); + auto message = std::make_shared(torch::Action::getState); + auto retGetState = bus.sendUnicast(std::move(message), service::name::evt_manager, pdMS_TO_TICKS(1500)); if (retGetState.first == sys::ReturnCodes::Success) { auto msgGetState = dynamic_cast(retGetState.second.get()); if (msgGetState == nullptr) { @@ -569,7 +567,7 @@ namespace app msgSetState->state = torch::State::off; break; } - sys::Bus::SendUnicast(msgSetState, service::name::evt_manager, this); + bus.sendUnicast(msgSetState, service::name::evt_manager); } } @@ -579,7 +577,7 @@ namespace app manager::actions::ActionParamsPtr &&data) { auto msg = std::make_shared(actionId, std::move(data)); - sys::Bus::SendUnicast(msg, applicationName, sender); + sender->bus.sendUnicast(msg, applicationName); } void Application::messageSwitchApplication(sys::Service *sender, @@ -588,26 +586,26 @@ namespace app std::unique_ptr data) { auto msg = std::make_shared(application, window, std::move(data)); - sys::Bus::SendUnicast(msg, application, sender); + sender->bus.sendUnicast(msg, application); } void Application::messageCloseApplication(sys::Service *sender, std::string application) { auto msg = std::make_shared(MessageType::AppClose); - sys::Bus::SendUnicast(msg, application, sender); + sender->bus.sendUnicast(msg, application); } void Application::messageRebuildApplication(sys::Service *sender, std::string application) { auto msg = std::make_shared(); - sys::Bus::SendUnicast(msg, application, sender); + sender->bus.sendUnicast(msg, application); } void Application::messageApplicationLostFocus(sys::Service *sender, std::string application) { auto msg = std::make_shared(); - sys::Bus::SendUnicast(msg, application, sender); + sender->bus.sendUnicast(msg, application); } void Application::messageInputEventApplication(sys::Service *sender, @@ -615,7 +613,7 @@ namespace app const gui::InputEvent &event) { auto msg = std::make_shared(event); - sys::Bus::SendUnicast(msg, application, sender); + sender->bus.sendUnicast(msg, application); } bool Application::popToWindow(const std::string &window) diff --git a/module-apps/Application.hpp b/module-apps/Application.hpp index c2cb2d4e1..68cc6fa24 100644 --- a/module-apps/Application.hpp +++ b/module-apps/Application.hpp @@ -7,7 +7,6 @@ #include "Audio/AudioCommon.hpp" // for Volume, Play... #include "Audio/Profiles/Profile.hpp" // for Profile, Pro... #include "CallbackStorage.hpp" -#include "Service/Bus.hpp" // for Bus #include "Service/Common.hpp" // for ReturnCodes #include "Service/Message.hpp" // for MessagePointer #include "Service/Service.hpp" // for Service diff --git a/module-apps/application-alarm-clock/ApplicationAlarmClock.cpp b/module-apps/application-alarm-clock/ApplicationAlarmClock.cpp index 561991748..1e20fc56f 100644 --- a/module-apps/application-alarm-clock/ApplicationAlarmClock.cpp +++ b/module-apps/application-alarm-clock/ApplicationAlarmClock.cpp @@ -23,7 +23,7 @@ namespace app sys::ServicePriority priority) : Application(name, parent, false, stackDepth, priority) { - busChannels.push_back(sys::BusChannels::ServiceDBNotifications); + bus.channels.push_back(sys::BusChannel::ServiceDBNotifications); } sys::MessagePointer ApplicationAlarmClock::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) diff --git a/module-apps/application-antenna/ApplicationAntenna.cpp b/module-apps/application-antenna/ApplicationAntenna.cpp index 0f2dbdf71..0869b221c 100644 --- a/module-apps/application-antenna/ApplicationAntenna.cpp +++ b/module-apps/application-antenna/ApplicationAntenna.cpp @@ -37,8 +37,7 @@ namespace app ApplicationAntenna::ApplicationAntenna(std::string name, std::string parent, StartInBackground startInBackground) : Application(name, parent, startInBackground, 4096 * 2) { - busChannels.push_back(sys::BusChannels::AntennaNotifications); - busChannels.push_back(sys::BusChannels::AntennaNotifications); + bus.channels.push_back(sys::BusChannel::AntennaNotifications); appTimer = std::make_unique("Antena", this, 2000); appTimer->connect([=](sys::Timer &) { timerHandler(); }); appTimer->start(); diff --git a/module-apps/application-calendar/ApplicationCalendar.cpp b/module-apps/application-calendar/ApplicationCalendar.cpp index 8736f5c47..0e00a2260 100644 --- a/module-apps/application-calendar/ApplicationCalendar.cpp +++ b/module-apps/application-calendar/ApplicationCalendar.cpp @@ -49,7 +49,7 @@ namespace app sys::ServicePriority priority) : Application(name, parent, startInBackground, stackDepth, priority) { - busChannels.push_back(sys::BusChannels::ServiceDBNotifications); + bus.channels.push_back(sys::BusChannel::ServiceDBNotifications); addActionReceiver(manager::actions::ShowReminder, [this](auto &&data) { switchWindow(style::window::calendar::name::event_reminder_window, std::move(data)); return msgHandled(); diff --git a/module-apps/application-desktop/ApplicationDesktop.cpp b/module-apps/application-desktop/ApplicationDesktop.cpp index cc897dca5..9adb5bf2b 100644 --- a/module-apps/application-desktop/ApplicationDesktop.cpp +++ b/module-apps/application-desktop/ApplicationDesktop.cpp @@ -44,7 +44,7 @@ namespace app Indicator::Battery, Indicator::SimCard, Indicator::NetworkAccessTechnology}); - busChannels.push_back(sys::BusChannels::ServiceDBNotifications); + bus.channels.push_back(sys::BusChannel::ServiceDBNotifications); addActionReceiver(app::manager::actions::RequestPin, [this](auto &&data) { lockHandler.handlePasscodeRequest(gui::PinLock::LockType::SimPin, std::move(data)); @@ -169,7 +169,7 @@ namespace app if (event != nullptr) { auto event = std::make_unique(lockHandler.isScreenLocked()); auto msg = std::make_shared(std::move(event)); - sys::Bus::SendUnicast(std::move(msg), service::name::service_desktop, this); + bus.sendUnicast(std::move(msg), service::name::service_desktop); } return true; @@ -240,9 +240,8 @@ namespace app return true; } else if (need_sim_select == false) { - sys::Bus::SendUnicast(std::make_shared(MessageType::CellularSimProcedure), - ServiceCellular::serviceName, - this); + bus.sendUnicast(std::make_shared(MessageType::CellularSimProcedure), + ServiceCellular::serviceName); } } if (msg->request == cellular::State::ST::ModemFatalFailure) { @@ -327,7 +326,7 @@ namespace app auto msgToSend = std::make_shared(updateos::UpdateMessageType::UpdateCheckForUpdateOnce); - sys::Bus::SendUnicast(msgToSend, service::name::service_desktop, this); + bus.sendUnicast(msgToSend, service::name::service_desktop); settings->registerValueChange( settings::SystemProperties::activeSim, diff --git a/module-apps/application-desktop/widgets/PinLockHandler.cpp b/module-apps/application-desktop/widgets/PinLockHandler.cpp index 87f3f8ba7..f51e3d761 100644 --- a/module-apps/application-desktop/widgets/PinLockHandler.cpp +++ b/module-apps/application-desktop/widgets/PinLockHandler.cpp @@ -173,8 +173,7 @@ namespace gui { if (type == PinLock::LockType::SimPin) { setSimLockHandled(); - sys::Bus::SendUnicast( - std::make_shared(simLock.sim, passcode), serviceCellular, app); + app->bus.sendUnicast(std::make_shared(simLock.sim, passcode), serviceCellular); } else if (type == PinLock::LockType::SimPuk) { handlePasscodeChange(passcode); @@ -213,12 +212,12 @@ namespace gui { setSimLockHandled(); if (type == PinLock::LockType::SimPin) { - sys::Bus::SendUnicast( - std::make_shared(simLock.sim, passcode, pin), serviceCellular, app); + app->bus.sendUnicast(std::make_shared(simLock.sim, passcode, pin), + serviceCellular); } else if (type == PinLock::LockType::SimPuk) { - sys::Bus::SendUnicast( - std::make_shared(simLock.sim, passcode, pin), serviceCellular, app); + app->bus.sendUnicast(std::make_shared(simLock.sim, passcode, pin), + serviceCellular); } } diff --git a/module-apps/application-desktop/windows/DesktopMainWindow.cpp b/module-apps/application-desktop/windows/DesktopMainWindow.cpp index 8f484c7e2..803c32b25 100644 --- a/module-apps/application-desktop/windows/DesktopMainWindow.cpp +++ b/module-apps/application-desktop/windows/DesktopMainWindow.cpp @@ -109,8 +109,7 @@ namespace gui setFocusItem(nullptr); buildNotifications(app); - sys::Bus::SendUnicast( - std::make_shared(), service::name::service_time, application); + application->bus.sendUnicast(std::make_shared(), service::name::service_time); } else { if (!buildNotifications(app)) { @@ -122,8 +121,7 @@ namespace gui app::manager::Controller::sendAction(application, app::manager::actions::SelectSimCard); } - sys::Bus::SendUnicast( - std::make_shared(), service::name::service_time, application); + application->bus.sendUnicast(std::make_shared(), service::name::service_time); } application->refreshWindow(RefreshModes::GUI_REFRESH_FAST); } diff --git a/module-apps/application-desktop/windows/Update.cpp b/module-apps/application-desktop/windows/Update.cpp index 5e2f34c05..29f1ac77c 100644 --- a/module-apps/application-desktop/windows/Update.cpp +++ b/module-apps/application-desktop/windows/Update.cpp @@ -228,7 +228,7 @@ namespace gui percentLabel->setVisible(true); percentLabel->setText(utils::localize.get("app_desktop_update_start")); auto msgToSend = std::make_shared(updateFile.c_str(), 0); - sys::Bus::SendUnicast(msgToSend, service::name::service_desktop, application); + application->bus.sendUnicast(msgToSend, service::name::service_desktop); return true; } diff --git a/module-apps/application-messages/ApplicationMessages.cpp b/module-apps/application-messages/ApplicationMessages.cpp index 4a0c010e7..a27117aea 100644 --- a/module-apps/application-messages/ApplicationMessages.cpp +++ b/module-apps/application-messages/ApplicationMessages.cpp @@ -40,7 +40,7 @@ namespace app ApplicationMessages::ApplicationMessages(std::string name, std::string parent, StartInBackground startInBackground) : Application(name, parent, startInBackground, 4096 * 2), AsyncCallbackReceiver{this} { - busChannels.push_back(sys::BusChannels::ServiceDBNotifications); + bus.channels.push_back(sys::BusChannel::ServiceDBNotifications); addActionReceiver(manager::actions::CreateSms, [this](auto &&data) { switchWindow(gui::name::window::new_sms, std::move(data)); return msgHandled(); diff --git a/module-apps/application-notes/ApplicationNotes.cpp b/module-apps/application-notes/ApplicationNotes.cpp index a61f03733..f5ca5050d 100644 --- a/module-apps/application-notes/ApplicationNotes.cpp +++ b/module-apps/application-notes/ApplicationNotes.cpp @@ -30,7 +30,7 @@ namespace app ApplicationNotes::ApplicationNotes(std::string name, std::string parent, StartInBackground startInBackground) : Application(name, parent, startInBackground, NotesStackSize) { - busChannels.push_back(sys::BusChannels::ServiceDBNotifications); + bus.channels.push_back(sys::BusChannel::ServiceDBNotifications); } // Invoked upon receiving data message diff --git a/module-apps/application-phonebook/ApplicationPhonebook.cpp b/module-apps/application-phonebook/ApplicationPhonebook.cpp index 48cef132d..4c5feebbb 100644 --- a/module-apps/application-phonebook/ApplicationPhonebook.cpp +++ b/module-apps/application-phonebook/ApplicationPhonebook.cpp @@ -24,7 +24,7 @@ namespace app StartInBackground startInBackground) : Application(name, parent, startInBackground, phonebook_stack_size) { - busChannels.push_back(sys::BusChannels::ServiceDBNotifications); + bus.channels.push_back(sys::BusChannel::ServiceDBNotifications); addActionReceiver(manager::actions::ShowContacts, [this](auto &&data) { switchWindow(gui::name::window::main_window, std::move(data)); return msgHandled(); diff --git a/module-apps/application-settings-new/ApplicationSettings.cpp b/module-apps/application-settings-new/ApplicationSettings.cpp index 48b51ae89..f0c00fdd3 100644 --- a/module-apps/application-settings-new/ApplicationSettings.cpp +++ b/module-apps/application-settings-new/ApplicationSettings.cpp @@ -374,8 +374,8 @@ namespace app { constexpr int timeout = pdMS_TO_TICKS(1500); - auto response = sys::Bus::SendUnicast( - std::make_shared(), service::name::evt_manager, this, timeout); + auto response = bus.sendUnicast( + std::make_shared(), service::name::evt_manager, timeout); if (response.first == sys::ReturnCodes::Success) { auto msgState = dynamic_cast(response.second.get()); @@ -392,39 +392,35 @@ namespace app void ApplicationSettingsNew::setBrightness(bsp::eink_frontlight::BrightnessPercentage value) { screen_light_control::Parameters parameters{value}; - sys::Bus::SendUnicast(std::make_shared( - screen_light_control::Action::setManualModeBrightness, parameters), - service::name::evt_manager, - this); + bus.sendUnicast(std::make_shared( + screen_light_control::Action::setManualModeBrightness, parameters), + service::name::evt_manager); } void ApplicationSettingsNew::setMode(bool isAutoLightSwitchOn) { - sys::Bus::SendUnicast(std::make_shared( - isAutoLightSwitchOn ? screen_light_control::Action::enableAutomaticMode - : screen_light_control::Action::disableAutomaticMode), - service::name::evt_manager, - this); + bus.sendUnicast(std::make_shared( + isAutoLightSwitchOn ? screen_light_control::Action::enableAutomaticMode + : screen_light_control::Action::disableAutomaticMode), + service::name::evt_manager); } void ApplicationSettingsNew::setStatus(bool isDisplayLightSwitchOn) { - sys::Bus::SendUnicast( - std::make_shared( - isDisplayLightSwitchOn ? screen_light_control::Action::turnOn : screen_light_control::Action::turnOff), - service::name::evt_manager, - this); + bus.sendUnicast(std::make_shared(isDisplayLightSwitchOn + ? screen_light_control::Action::turnOn + : screen_light_control::Action::turnOff), + service::name::evt_manager); } auto ApplicationSettingsNew::isKeypadBacklightOn() -> bool { constexpr int timeout = pdMS_TO_TICKS(1500); - auto response = sys::Bus::SendUnicast( - std::make_shared(bsp::keypad_backlight::Action::checkState), - service::name::evt_manager, - this, - timeout); + auto response = + bus.sendUnicast(std::make_shared(bsp::keypad_backlight::Action::checkState), + service::name::evt_manager, + timeout); if (response.first == sys::ReturnCodes::Success) { auto msgState = dynamic_cast(response.second.get()); @@ -439,11 +435,9 @@ namespace app void ApplicationSettingsNew::setKeypadBacklightState(bool newState) { - sys::Bus::SendUnicast( - std::make_shared(newState ? bsp::keypad_backlight::Action::turnOn - : bsp::keypad_backlight::Action::turnOff), - service::name::evt_manager, - this); + bus.sendUnicast(std::make_shared( + newState ? bsp::keypad_backlight::Action::turnOn : bsp::keypad_backlight::Action::turnOff), + service::name::evt_manager); } } /* namespace app */ diff --git a/module-apps/application-settings-new/models/ApnSettingsModel.cpp b/module-apps/application-settings-new/models/ApnSettingsModel.cpp index f6772aa7a..be05bbead 100644 --- a/module-apps/application-settings-new/models/ApnSettingsModel.cpp +++ b/module-apps/application-settings-new/models/ApnSettingsModel.cpp @@ -10,7 +10,7 @@ ApnSettingsModel::ApnSettingsModel(app::Application *application) : application{ void ApnSettingsModel::requestAPNList() { - sys::Bus::SendUnicast(std::make_shared(), ServiceCellular::serviceName, application); + application->bus.sendUnicast(std::make_shared(), ServiceCellular::serviceName); } void ApnSettingsModel::saveAPN(std::shared_ptr apn) @@ -31,5 +31,5 @@ void ApnSettingsModel::removeAPN(std::shared_ptr apn) void ApnSettingsModel::setAsDefaultAPN(std::shared_ptr apn) { apn->apnType = packet_data::APN::APNType::Default; - sys::Bus::SendUnicast(std::make_shared(apn), ServiceCellular::serviceName, application); + application->bus.sendUnicast(std::make_shared(apn), ServiceCellular::serviceName); } diff --git a/module-apps/application-settings-new/models/LanguagesModel.cpp b/module-apps/application-settings-new/models/LanguagesModel.cpp index 3ca22a35d..91afdd238 100644 --- a/module-apps/application-settings-new/models/LanguagesModel.cpp +++ b/module-apps/application-settings-new/models/LanguagesModel.cpp @@ -7,7 +7,6 @@ void LanguagesModel::requestCurrentDisplayLanguage() { - sys::Bus::SendUnicast(std::make_shared(), - app::manager::ApplicationManager::ServiceName, - application); + application->bus.sendUnicast(std::make_shared(), + app::manager::ApplicationManager::ServiceName); } diff --git a/module-apps/application-settings-new/windows/AddDeviceWindow.cpp b/module-apps/application-settings-new/windows/AddDeviceWindow.cpp index 767e477dc..636baa6bc 100644 --- a/module-apps/application-settings-new/windows/AddDeviceWindow.cpp +++ b/module-apps/application-settings-new/windows/AddDeviceWindow.cpp @@ -33,10 +33,9 @@ namespace gui device.name, [=](gui::Item &item) { LOG_DEBUG("Device: %s", device.name.c_str()); - sys::Bus::SendUnicast(std::make_shared(bd_addr_to_str(device.address)), - "ServiceBluetooth", - application, - 5000); + application->bus.sendUnicast(std::make_shared(bd_addr_to_str(device.address)), + "ServiceBluetooth", + 5000); return true; }, nullptr, @@ -44,8 +43,8 @@ namespace gui gui::option::SettingRightItem::Bt)); } - sys::Bus::SendUnicast( - std::make_shared(BluetoothMessage::Request::StopScan), "ServiceBluetooth", application); + application->bus.sendUnicast(std::make_shared(BluetoothMessage::Request::StopScan), + "ServiceBluetooth"); bottomBar->setText(BottomBar::Side::CENTER, utils::localize.get(style::strings::common::add)); diff --git a/module-apps/application-settings-new/windows/AllDevicesWindow.cpp b/module-apps/application-settings-new/windows/AllDevicesWindow.cpp index 9d0fffcef..85aaf3257 100644 --- a/module-apps/application-settings-new/windows/AllDevicesWindow.cpp +++ b/module-apps/application-settings-new/windows/AllDevicesWindow.cpp @@ -21,8 +21,8 @@ namespace gui AllDevicesWindow::AllDevicesWindow(app::Application *app) : OptionWindow(app, gui::window::name::all_devices) { setTitle(utils::localize.get("app_settings_bluetooth_all_devices")); - sys::Bus::SendUnicast( - std::make_shared<::message::bluetooth::RequestBondedDevices>(), service::name::bluetooth, application); + application->bus.sendUnicast(std::make_shared<::message::bluetooth::RequestBondedDevices>(), + service::name::bluetooth); } void AllDevicesWindow::onBeforeShow(ShowMode mode, SwitchData *data) @@ -38,9 +38,8 @@ namespace gui if (inputEvent.state == InputEvent::State::keyReleasedShort) { if (inputEvent.keyCode == KeyCode::KEY_LEFT) { - sys::Bus::SendUnicast(std::make_shared(BluetoothMessage::Request::Scan), - "ServiceBluetooth", - application); + application->bus.sendUnicast(std::make_shared(BluetoothMessage::Request::Scan), + "ServiceBluetooth"); gui::DialogMetadata meta; meta.icon = "search_big"; meta.text = utils::localize.get("app_settings_bluetooth_searching_devices"); diff --git a/module-apps/application-settings-new/windows/BluetoothWindow.cpp b/module-apps/application-settings-new/windows/BluetoothWindow.cpp index a1d4e4e21..65156c9b4 100644 --- a/module-apps/application-settings-new/windows/BluetoothWindow.cpp +++ b/module-apps/application-settings-new/windows/BluetoothWindow.cpp @@ -15,8 +15,7 @@ namespace gui BluetoothWindow::BluetoothWindow(app::Application *app) : OptionWindow(app, gui::window::name::bluetooth) { - sys::Bus::SendUnicast( - std::make_shared<::message::bluetooth::RequestStatus>(), service::name::bluetooth, application); + application->bus.sendUnicast(std::make_shared<::message::bluetooth::RequestStatus>(), service::name::bluetooth); } void BluetoothWindow::onBeforeShow(ShowMode mode, SwitchData *data) @@ -111,17 +110,15 @@ namespace gui void BluetoothWindow::changeBluetoothState(bool currentState) { ::message::bluetooth::SetStatus setStatus(makeDesiredStatus(!currentState, isPhoneVisibilitySwitchOn)); - sys::Bus::SendUnicast(std::make_shared<::message::bluetooth::SetStatus>(std::move(setStatus)), - service::name::bluetooth, - application); + application->bus.sendUnicast(std::make_shared<::message::bluetooth::SetStatus>(std::move(setStatus)), + service::name::bluetooth); } void BluetoothWindow::changeVisibility(bool currentVisibility) { ::message::bluetooth::SetStatus setStatus(makeDesiredStatus(isBluetoothSwitchOn, !currentVisibility)); - sys::Bus::SendUnicast(std::make_shared<::message::bluetooth::SetStatus>(std::move(setStatus)), - service::name::bluetooth, - application); + application->bus.sendUnicast(std::make_shared<::message::bluetooth::SetStatus>(std::move(setStatus)), + service::name::bluetooth); } BluetoothStatus BluetoothWindow::makeDesiredStatus(bool desiredBluetoothState, bool desiredVisibility) noexcept diff --git a/module-apps/application-settings-new/windows/DisplayLightWindow.cpp b/module-apps/application-settings-new/windows/DisplayLightWindow.cpp index 1ae896ab3..9b91ba25d 100644 --- a/module-apps/application-settings-new/windows/DisplayLightWindow.cpp +++ b/module-apps/application-settings-new/windows/DisplayLightWindow.cpp @@ -10,7 +10,6 @@ #include #include -#include namespace gui { diff --git a/module-apps/application-settings-new/windows/PhoneNameWindow.cpp b/module-apps/application-settings-new/windows/PhoneNameWindow.cpp index 9d0761a54..3ba746089 100644 --- a/module-apps/application-settings-new/windows/PhoneNameWindow.cpp +++ b/module-apps/application-settings-new/windows/PhoneNameWindow.cpp @@ -33,8 +33,8 @@ namespace gui bottomBar->setText(BottomBar::Side::CENTER, utils::localize.get(style::strings::common::save)); bottomBar->setText(BottomBar::Side::RIGHT, utils::localize.get(style::strings::common::back)); - sys::Bus::SendUnicast( - std::make_shared<::message::bluetooth::RequestDeviceName>(), service::name::bluetooth, application); + application->bus.sendUnicast(std::make_shared<::message::bluetooth::RequestDeviceName>(), + service::name::bluetooth); setFocusItem(inputField); } @@ -59,7 +59,7 @@ namespace gui if (inputEvent.is(gui::KeyCode::KEY_ENTER) && !inputField->isEmpty()) { auto result = std::make_shared<::message::bluetooth::SetDeviceName>(inputField->getText()); - sys::Bus::SendUnicast(std::move(result), service::name::bluetooth, application); + application->bus.sendUnicast(std::move(result), service::name::bluetooth); return true; } diff --git a/module-apps/application-settings/ApplicationSettings.cpp b/module-apps/application-settings/ApplicationSettings.cpp index 5e339b020..9e21b4a43 100644 --- a/module-apps/application-settings/ApplicationSettings.cpp +++ b/module-apps/application-settings/ApplicationSettings.cpp @@ -43,7 +43,7 @@ namespace app ApplicationSettings::ApplicationSettings(std::string name, std::string parent, StartInBackground startInBackground) : Application(name, parent, startInBackground) { - busChannels.push_back(sys::BusChannels::AntennaNotifications); + bus.channels.push_back(sys::BusChannel::AntennaNotifications); addActionReceiver(manager::actions::SelectSimCard, [this](auto &&data) { switchWindow(app::sim_select); return msgHandled(); diff --git a/module-apps/application-settings/windows/BtScanWindow.cpp b/module-apps/application-settings/windows/BtScanWindow.cpp index 0a0624866..c6f59cea8 100644 --- a/module-apps/application-settings/windows/BtScanWindow.cpp +++ b/module-apps/application-settings/windows/BtScanWindow.cpp @@ -43,7 +43,7 @@ namespace gui sys::ReturnCodes message_bt2(app::Application *app, BluetoothMessage::Request req) { std::shared_ptr msg = std::make_shared(req); - auto ret = sys::Bus::SendUnicast(msg, "ServiceBluetooth", app); + auto ret = app->bus.sendUnicast(msg, "ServiceBluetooth"); if (!ret) { LOG_ERROR("err: %d", static_cast(ret)); } @@ -68,7 +68,7 @@ namespace gui std::shared_ptr msg = std::make_shared(bd_addr_to_str(device.address)); - sys::Bus::SendUnicast(msg, "ServiceBluetooth", application, 5000); + application->bus.sendUnicast(msg, "ServiceBluetooth", 5000); message_bt2(application, BluetoothMessage::Request::StopScan); // message_bt2(application, BluetoothMessage::Request::Start); diff --git a/module-apps/application-settings/windows/BtWindow.cpp b/module-apps/application-settings/windows/BtWindow.cpp index 71552f114..e6952b5c2 100644 --- a/module-apps/application-settings/windows/BtWindow.cpp +++ b/module-apps/application-settings/windows/BtWindow.cpp @@ -45,7 +45,7 @@ namespace gui sys::ReturnCodes message_bt(app::Application *app, BluetoothMessage::Request req) { std::shared_ptr msg = std::make_shared(req); - auto ret = sys::Bus::SendUnicast(msg, "ServiceBluetooth", app); + auto ret = app->bus.sendUnicast(msg, "ServiceBluetooth"); if (!ret) { LOG_ERROR("err: %d", static_cast(ret)); } diff --git a/module-apps/application-settings/windows/ColorTestWindow.cpp b/module-apps/application-settings/windows/ColorTestWindow.cpp index 819660583..d5e3e8ebe 100644 --- a/module-apps/application-settings/windows/ColorTestWindow.cpp +++ b/module-apps/application-settings/windows/ColorTestWindow.cpp @@ -78,10 +78,8 @@ namespace gui { if (scheme != currentColorScheme) { currentColorScheme = scheme; - sys::Bus::SendUnicast(std::make_shared(std::move(scheme)), - service::name::gui, - this->application, - 100); + application->bus.sendUnicast( + std::make_shared(std::move(scheme)), service::name::gui, 100); LOG_INFO("Updated color scheme"); application->refreshWindow(RefreshModes::GUI_REFRESH_DEEP); diff --git a/module-apps/application-settings/windows/EinkModeWindow.cpp b/module-apps/application-settings/windows/EinkModeWindow.cpp index c43414c48..8d4ca7e31 100644 --- a/module-apps/application-settings/windows/EinkModeWindow.cpp +++ b/module-apps/application-settings/windows/EinkModeWindow.cpp @@ -39,10 +39,8 @@ namespace gui last_mode = service::eink::EinkModeMessage::Mode::Normal; } - sys::Bus::SendUnicast(std::make_shared(last_mode), - service::name::eink, - this->application, - 5000); + application->bus.sendUnicast( + std::make_shared(last_mode), service::name::eink, 5000); return true; }; setFocusItem(label); diff --git a/module-apps/application-settings/windows/Fota.cpp b/module-apps/application-settings/windows/Fota.cpp index 3c98d953e..33c3ab25a 100644 --- a/module-apps/application-settings/windows/Fota.cpp +++ b/module-apps/application-settings/windows/Fota.cpp @@ -19,19 +19,13 @@ Fota::Fota(gui::FotaWindow *parent) : currentState(State::Disconnected), parent( { app = std::shared_ptr(parent->getApplication(), [](app::Application *) {}); /// with deleter that doesn't delete. - app->busChannels.push_back(sys::BusChannels::ServiceFotaNotifications); + app->bus.channels.push_back(sys::BusChannel::ServiceFotaNotifications); registerHandlers(); - sys::Bus::Add(std::static_pointer_cast(app)); getCurrentVersion(); parent->statusLabel->setText(getStateString()); } -Fota::~Fota() -{ - sys::Bus::Remove(std::static_pointer_cast(app)); -} - void Fota::next() { switch (currentState) { @@ -200,7 +194,7 @@ void Fota::reboot() currentState = State::Reboot; parent->statusLabel->setText(getStateString()); auto msg = std::make_shared(sys::Code::Reboot); - sys::Bus::SendUnicast(std::move(msg), service::name::system_manager, app.get()); + app->bus.sendUnicast(std::move(msg), service::name::system_manager); } void Fota::registerHandlers() diff --git a/module-apps/application-settings/windows/Fota.hpp b/module-apps/application-settings/windows/Fota.hpp index d152dee9e..29936a089 100644 --- a/module-apps/application-settings/windows/Fota.hpp +++ b/module-apps/application-settings/windows/Fota.hpp @@ -40,7 +40,6 @@ class Fota }; using VersionMap = std::unordered_map; Fota(gui::FotaWindow *parent); - virtual ~Fota(); void next(); std::string getCurrentFirmwareVersion() { diff --git a/module-bluetooth/Bluetooth/interface/profiles/A2DP/A2DP.cpp b/module-bluetooth/Bluetooth/interface/profiles/A2DP/A2DP.cpp index 2b728f625..b1f0dc3d7 100644 --- a/module-bluetooth/Bluetooth/interface/profiles/A2DP/A2DP.cpp +++ b/module-bluetooth/Bluetooth/interface/profiles/A2DP/A2DP.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include