From 1e8082e02c0868f6d20254e2055c2ae661f722e6 Mon Sep 17 00:00:00 2001 From: Wojtek Rzepecki Date: Tue, 21 Sep 2021 14:37:29 +0200 Subject: [PATCH] [EGD-7570] Add Alarm Clock status bar indicator Added indicator on status bar if any alarm is on --- .../ApplicationAlarmClock.cpp | 5 +-- .../ApplicationAlarmClock.hpp | 13 +++--- .../models/NewEditAlarmModel.cpp | 1 + .../widgets/AlarmItem.cpp | 2 +- .../widgets/AlarmTimeItem.cpp | 1 + .../ApplicationAntenna.hpp | 6 ++- .../ApplicationCalculator.cpp | 5 +-- .../ApplicationCalculator.hpp | 16 +++---- .../ApplicationCalendar.cpp | 5 +-- .../ApplicationCalendar.hpp | 15 ++++--- .../application-call/ApplicationCall.cpp | 5 +-- .../application-call/ApplicationCall.hpp | 12 ++--- .../ApplicationCallLog.cpp | 5 +-- .../ApplicationCallLog.hpp | 12 ++--- .../ApplicationDesktop.cpp | 5 +-- .../ApplicationDesktop.hpp | 13 +++--- .../windows/DesktopMainWindow.cpp | 1 + .../ApplicationMeditation.cpp | 6 +-- .../ApplicationMeditation.hpp | 18 ++++---- .../ApplicationMessages.cpp | 7 ++- .../ApplicationMessages.hpp | 13 +++--- .../ApplicationMusicPlayer.cpp | 11 ++--- .../ApplicationMusicPlayer.hpp | 18 ++++---- .../application-notes/ApplicationNotes.cpp | 5 +-- .../application-notes/ApplicationNotes.hpp | 15 ++++--- .../ApplicationOnBoarding.cpp | 6 +-- .../ApplicationOnBoarding.hpp | 18 ++++---- .../ApplicationPhonebook.cpp | 6 +-- .../ApplicationPhonebook.hpp | 13 +++--- .../ApplicationSettings.cpp | 8 ++-- .../ApplicationSettings.hpp | 16 +++---- .../advanced/StatusBarImageTypeWindow.cpp | 1 + .../ApplicationSpecialInput.cpp | 5 +-- .../ApplicationSpecialInput.hpp | 9 ++-- module-apps/apps-common/ApplicationCommon.cpp | 25 +++++++---- module-apps/apps-common/ApplicationCommon.hpp | 25 ++++++----- .../apps-common/ApplicationLauncher.hpp | 20 +++------ .../actions/AlarmClockStatusChangeParams.hpp | 24 ++++++++++ .../locks/windows/LockInputWindow.cpp | 1 + .../lock-popups/PhoneLockInputWindow.cpp | 1 + .../lock-popups/PhoneLockedInfoWindow.cpp | 1 + .../popups/lock-popups/PhoneLockedWindow.cpp | 1 + .../popups/lock-popups/SimInfoWindow.cpp | 1 + .../popups/lock-popups/SimLockInputWindow.cpp | 1 + .../popups/lock-popups/SimNotReadyWindow.cpp | 1 + module-apps/apps-common/windows/AppWindow.cpp | 8 ++++ module-apps/apps-common/windows/AppWindow.hpp | 1 + module-gui/gui/widgets/CMakeLists.txt | 1 + module-gui/gui/widgets/StatusBar.cpp | 42 ++++++++++++++++++ module-gui/gui/widgets/StatusBar.hpp | 44 +++++++++++++++---- .../gui/widgets/status-bar/AlarmClock.cpp | 20 +++++++++ .../gui/widgets/status-bar/AlarmClock.hpp | 18 ++++++++ .../include/service-appmgr/Actions.hpp | 1 + .../model/ApplicationHandle.hpp | 8 +--- .../model/ApplicationHandle.cpp | 12 ++--- .../service-time/AlarmMessageHandler.cpp | 6 +++ .../service-time/AlarmMessageHandler.hpp | 1 + .../service-time/AlarmOperations.cpp | 17 +++++++ .../service-time/AlarmOperations.hpp | 5 +++ .../service-time/AlarmServiceAPI.cpp | 5 +++ module-services/service-time/ServiceTime.cpp | 9 ++++ .../include/service-time/AlarmMessage.hpp | 22 ++++++++++ .../include/service-time/AlarmServiceAPI.hpp | 1 + .../ApplicationBellAlarm.cpp | 5 +-- .../ApplicationBellAlarm.hpp | 12 +++-- .../ApplicationBellBackgroundSounds.cpp | 5 +-- .../ApplicationBellBackgroundSounds.hpp | 10 ++--- .../ApplicationBellMain.cpp | 5 +-- .../ApplicationBellMain.hpp | 12 +++-- .../ApplicationBellOnBoarding.cpp | 5 +-- .../ApplicationBellOnBoarding.hpp | 9 ++-- .../ApplicationBellPowerNap.cpp | 5 +-- .../ApplicationBellPowerNap.hpp | 9 ++-- .../ApplicationBellSettings.cpp | 5 +-- .../ApplicationBellSettings.hpp | 9 ++-- .../services/appmgr/ApplicationManager.cpp | 2 +- .../services/appmgr/ApplicationManager.cpp | 39 +++++++++++++++- .../include/appmgr/ApplicationManager.hpp | 3 ++ 78 files changed, 486 insertions(+), 268 deletions(-) create mode 100644 module-apps/apps-common/actions/AlarmClockStatusChangeParams.hpp create mode 100644 module-gui/gui/widgets/status-bar/AlarmClock.cpp create mode 100644 module-gui/gui/widgets/status-bar/AlarmClock.hpp diff --git a/module-apps/application-alarm-clock/ApplicationAlarmClock.cpp b/module-apps/application-alarm-clock/ApplicationAlarmClock.cpp index 6a8765b9954deb3023da39026d284beeee0d4ce8..a5d09a6ab7a2b0f6066aa13c28ce603e668c6ec0 100644 --- a/module-apps/application-alarm-clock/ApplicationAlarmClock.cpp +++ b/module-apps/application-alarm-clock/ApplicationAlarmClock.cpp @@ -19,11 +19,10 @@ namespace app ApplicationAlarmClock::ApplicationAlarmClock(std::string name, std::string parent, - sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, uint32_t stackDepth, sys::ServicePriority priority) - : Application(name, parent, phoneMode, bluetoothMode, false, stackDepth, priority) + : Application(name, parent, statusIndicators, false, stackDepth, priority) { bus.channels.push_back(sys::BusChannel::ServiceDBNotifications); } diff --git a/module-apps/application-alarm-clock/ApplicationAlarmClock.hpp b/module-apps/application-alarm-clock/ApplicationAlarmClock.hpp index cc26a6d085751919d2887aabe14e7116d7945071..2db4e0674114939464d05ea37c10633eba80ff1e 100644 --- a/module-apps/application-alarm-clock/ApplicationAlarmClock.hpp +++ b/module-apps/application-alarm-clock/ApplicationAlarmClock.hpp @@ -14,10 +14,9 @@ namespace app public: ApplicationAlarmClock(std::string name, std::string parent, - sys::phone_modes::PhoneMode phoneMode = sys::phone_modes::PhoneMode::Connected, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - uint32_t stackDepth = 4096 * 2, - sys::ServicePriority priority = sys::ServicePriority::Idle); + StatusIndicators statusIndicators = StatusIndicators{}, + uint32_t stackDepth = 4096 * 2, + sys::ServicePriority priority = sys::ServicePriority::Idle); sys::MessagePointer DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) override; @@ -36,8 +35,10 @@ namespace app { static auto GetManifest() -> manager::ApplicationManifest { - return { - {manager::actions::Launch, manager::actions::PhoneModeChanged, manager::actions::BluetoothModeChanged}}; + return {{manager::actions::Launch, + manager::actions::PhoneModeChanged, + manager::actions::BluetoothModeChanged, + manager::actions::AlarmClockStatusChanged}}; } }; } // namespace app diff --git a/module-apps/application-alarm-clock/models/NewEditAlarmModel.cpp b/module-apps/application-alarm-clock/models/NewEditAlarmModel.cpp index f30f489fe31f4baec5e19ed89a1b1f620d2ba620..a045a464dc53fbc9ae842057aa2102763b83af3d 100644 --- a/module-apps/application-alarm-clock/models/NewEditAlarmModel.cpp +++ b/module-apps/application-alarm-clock/models/NewEditAlarmModel.cpp @@ -110,6 +110,7 @@ namespace app::alarmClock [this](bool) { application->switchWindow(gui::name::window::main_window); }); } else { + alarm->enabled = true; alarmsRepository->add(*alarm, [this](bool) { application->returnToPreviousWindow(); }); } list->reset(); diff --git a/module-apps/application-alarm-clock/widgets/AlarmItem.cpp b/module-apps/application-alarm-clock/widgets/AlarmItem.cpp index 01675ba9a1a7ac8cbdc84370e42608b913c64014..7e6cad94f264d7116ae3072dc37a63f5ce45e296 100644 --- a/module-apps/application-alarm-clock/widgets/AlarmItem.cpp +++ b/module-apps/application-alarm-clock/widgets/AlarmItem.cpp @@ -51,7 +51,7 @@ namespace gui void AlarmItem::setAlarm() { timeLabel->setText(TimePointToLocalizedTimeString(getPresenter()->getAlarm()->startDate)); - onOffImage->switchState(getPresenter()->getAlarm()->enabled ? ButtonState::Off : ButtonState::On); + onOffImage->switchState(getPresenter()->getAlarm()->enabled ? ButtonState::On : ButtonState::Off); if (getPresenter()->hasRecurrence()) { periodLabel->setText(getPresenter()->getDescription()); diff --git a/module-apps/application-alarm-clock/widgets/AlarmTimeItem.cpp b/module-apps/application-alarm-clock/widgets/AlarmTimeItem.cpp index 8a95c142285f4f7866527b1998198309cd45e885..66a88f6662994c99cc5970e5834208655f4ce54e 100644 --- a/module-apps/application-alarm-clock/widgets/AlarmTimeItem.cpp +++ b/module-apps/application-alarm-clock/widgets/AlarmTimeItem.cpp @@ -120,6 +120,7 @@ namespace gui hours = date::make24(hours, isPm(mode12hInput->getText())); } record->startDate = TimePointFromYearMonthDay(TimePointToYearMonthDay(TimePointNow())) + hours + minutes; + record->endDate = record->startDate; }; onInputCallback(*hourInput); diff --git a/module-apps/application-antenna/include/application-antenna/ApplicationAntenna.hpp b/module-apps/application-antenna/include/application-antenna/ApplicationAntenna.hpp index 3e2f199eeb570d9591ffe8a58a29d0ae4024e912..45b31f942112b02f115b279078259de17dd850fb 100644 --- a/module-apps/application-antenna/include/application-antenna/ApplicationAntenna.hpp +++ b/module-apps/application-antenna/include/application-antenna/ApplicationAntenna.hpp @@ -74,8 +74,10 @@ namespace app { static auto GetManifest() -> manager::ApplicationManifest { - return { - {manager::actions::Launch, manager::actions::PhoneModeChanged, manager::actions::BluetoothModeChanged}}; + return {{manager::actions::Launch, + manager::actions::PhoneModeChanged, + manager::actions::BluetoothModeChanged, + manager::actions::AlarmClockStatusChanged}}; } }; } /* namespace app */ diff --git a/module-apps/application-calculator/ApplicationCalculator.cpp b/module-apps/application-calculator/ApplicationCalculator.cpp index 54419e0c8695c5a12eda770f8a6f00d5ed38882d..acbe352458fc19346678eee682c7ca0626f018bc 100644 --- a/module-apps/application-calculator/ApplicationCalculator.cpp +++ b/module-apps/application-calculator/ApplicationCalculator.cpp @@ -9,10 +9,9 @@ namespace app { ApplicationCalculator::ApplicationCalculator(std::string name, std::string parent, - sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, StartInBackground startInBackground) - : Application(name, parent, phoneMode, bluetoothMode, startInBackground, stack_size) + : Application(name, parent, statusIndicators, startInBackground, stack_size) {} sys::MessagePointer ApplicationCalculator::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) diff --git a/module-apps/application-calculator/include/application-calculator/ApplicationCalculator.hpp b/module-apps/application-calculator/include/application-calculator/ApplicationCalculator.hpp index 723788911d79fc41a369be01b70d6973312174bd..ce3fbf57effd2045a9f449c13da3fc32e703df1d 100644 --- a/module-apps/application-calculator/include/application-calculator/ApplicationCalculator.hpp +++ b/module-apps/application-calculator/include/application-calculator/ApplicationCalculator.hpp @@ -13,12 +13,10 @@ namespace app class ApplicationCalculator : public Application { public: - explicit ApplicationCalculator( - std::string name = name_calculator, - std::string parent = {}, - sys::phone_modes::PhoneMode phoneMode = sys::phone_modes::PhoneMode::Connected, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - StartInBackground startInBackground = {false}); + explicit ApplicationCalculator(std::string name = name_calculator, + std::string parent = {}, + StatusIndicators statusIndicators = StatusIndicators{}, + StartInBackground startInBackground = {false}); ~ApplicationCalculator() override = default; sys::MessagePointer DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) override; @@ -37,8 +35,10 @@ namespace app { static auto GetManifest() -> manager::ApplicationManifest { - return { - {manager::actions::Launch, manager::actions::PhoneModeChanged, manager::actions::BluetoothModeChanged}}; + return {{manager::actions::Launch, + manager::actions::PhoneModeChanged, + manager::actions::BluetoothModeChanged, + manager::actions::AlarmClockStatusChanged}}; } }; } /* namespace app */ diff --git a/module-apps/application-calendar/ApplicationCalendar.cpp b/module-apps/application-calendar/ApplicationCalendar.cpp index a0fab476809c07c6954d928c1d839985ec5996ba..2f3f3c1bf99dfd127bf1675acfd6c6ceebf4e1fc 100644 --- a/module-apps/application-calendar/ApplicationCalendar.cpp +++ b/module-apps/application-calendar/ApplicationCalendar.cpp @@ -8,12 +8,11 @@ namespace app { ApplicationCalendar::ApplicationCalendar(std::string name, std::string parent, - sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, StartInBackground startInBackground, uint32_t stackDepth, sys::ServicePriority priority) - : Application(name, parent, phoneMode, bluetoothMode, startInBackground, stackDepth, priority) + : Application(name, parent, statusIndicators, startInBackground, stackDepth, priority) {} sys::MessagePointer ApplicationCalendar::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) diff --git a/module-apps/application-calendar/include/application-calendar/ApplicationCalendar.hpp b/module-apps/application-calendar/include/application-calendar/ApplicationCalendar.hpp index 5e142c1684e442f09981a9252d739349eea1880b..c9307d1888f7fa5c5b06e1818e92c084f3f89160 100644 --- a/module-apps/application-calendar/include/application-calendar/ApplicationCalendar.hpp +++ b/module-apps/application-calendar/include/application-calendar/ApplicationCalendar.hpp @@ -17,11 +17,10 @@ namespace app public: ApplicationCalendar(std::string name, std::string parent, - sys::phone_modes::PhoneMode phoneMode = sys::phone_modes::PhoneMode::Connected, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - StartInBackground startInBackground = {false}, - uint32_t stackDepth = 8192, - sys::ServicePriority priority = sys::ServicePriority::Idle); + StatusIndicators statusIndicators = StatusIndicators{}, + StartInBackground startInBackground = {false}, + uint32_t stackDepth = 8192, + sys::ServicePriority priority = sys::ServicePriority::Idle); sys::MessagePointer DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) override; sys::ReturnCodes InitHandler() override; @@ -39,8 +38,10 @@ namespace app { static auto GetManifest() -> manager::ApplicationManifest { - return { - {manager::actions::Launch, manager::actions::PhoneModeChanged, manager::actions::BluetoothModeChanged}}; + return {{manager::actions::Launch, + manager::actions::PhoneModeChanged, + manager::actions::BluetoothModeChanged, + manager::actions::AlarmClockStatusChanged}}; } }; } /* namespace app */ diff --git a/module-apps/application-call/ApplicationCall.cpp b/module-apps/application-call/ApplicationCall.cpp index f99d0be3a7666f8b840023a249a971abcb875e42..29bf5cf7b71b3e2589a46b5cea0b749b4a1930ca 100644 --- a/module-apps/application-call/ApplicationCall.cpp +++ b/module-apps/application-call/ApplicationCall.cpp @@ -27,10 +27,9 @@ namespace app { ApplicationCall::ApplicationCall(std::string name, std::string parent, - sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, StartInBackground startInBackground) - : Application(name, parent, phoneMode, bluetoothMode, startInBackground, app::call_stack_size) + : Application(name, parent, statusIndicators, startInBackground, app::call_stack_size) { using namespace gui::status_bar; statusBarManager->enableIndicators( diff --git a/module-apps/application-call/include/application-call/ApplicationCall.hpp b/module-apps/application-call/include/application-call/ApplicationCall.hpp index 46bbbf40e4a57268e6f8c64eec0b4cf43c411cdd..905a35d1ee13fc4c11434ec3d901313ecc6a46f2 100644 --- a/module-apps/application-call/include/application-call/ApplicationCall.hpp +++ b/module-apps/application-call/include/application-call/ApplicationCall.hpp @@ -71,11 +71,10 @@ namespace app call::State callState = call::State::IDLE; public: - explicit ApplicationCall(std::string name = name_call, - std::string parent = {}, - sys::phone_modes::PhoneMode phoneMode = sys::phone_modes::PhoneMode::Connected, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - StartInBackground startInBackground = {false}); + explicit ApplicationCall(std::string name = name_call, + std::string parent = {}, + StatusIndicators statusIndicators = StatusIndicators{}, + StartInBackground startInBackground = {false}); sys::MessagePointer DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) override; sys::ReturnCodes InitHandler() override; bool isPopupPermitted(gui::popup::ID popupId) const override; @@ -142,7 +141,8 @@ namespace app manager::actions::HandleIncomingCall, manager::actions::HandleCallerId, manager::actions::HandleCallerId, - manager::actions::BluetoothModeChanged}, + manager::actions::BluetoothModeChanged, + manager::actions::AlarmClockStatusChanged}, locks::AutoLockPolicy::PreventPermanently}; } }; diff --git a/module-apps/application-calllog/ApplicationCallLog.cpp b/module-apps/application-calllog/ApplicationCallLog.cpp index b971338cc043bd9301d21c0aaa4cc740df83f65d..a60e0940e540326acffb782b8e15aff8dcd4ec91 100644 --- a/module-apps/application-calllog/ApplicationCallLog.cpp +++ b/module-apps/application-calllog/ApplicationCallLog.cpp @@ -24,10 +24,9 @@ namespace app { ApplicationCallLog::ApplicationCallLog(std::string name, std::string parent, - sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, StartInBackground startInBackground) - : Application(name, parent, phoneMode, bluetoothMode, startInBackground, 4096) + : Application(name, parent, statusIndicators, startInBackground, 4096) { bus.channels.push_back(sys::BusChannel::ServiceDBNotifications); addActionReceiver(manager::actions::ShowCallLog, [this](auto &&data) { diff --git a/module-apps/application-calllog/include/application-calllog/ApplicationCallLog.hpp b/module-apps/application-calllog/include/application-calllog/ApplicationCallLog.hpp index 3652b0db8ec672ad6bb0da58d596dd1d29698f9b..7ba79627265752d352cb56cd8b7e6f4ae962e20f 100644 --- a/module-apps/application-calllog/include/application-calllog/ApplicationCallLog.hpp +++ b/module-apps/application-calllog/include/application-calllog/ApplicationCallLog.hpp @@ -15,11 +15,10 @@ namespace app class ApplicationCallLog : public Application { public: - ApplicationCallLog(std::string name = CallLogAppStr, - std::string parent = {}, - sys::phone_modes::PhoneMode phoneMode = sys::phone_modes::PhoneMode::Connected, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - StartInBackground startInBackground = {false}); + ApplicationCallLog(std::string name = CallLogAppStr, + std::string parent = {}, + StatusIndicators statusIndicators = StatusIndicators{}, + StartInBackground startInBackground = {false}); ~ApplicationCallLog() override; sys::MessagePointer DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) override; @@ -46,7 +45,8 @@ namespace app return {{manager::actions::Launch, manager::actions::ShowCallLog, manager::actions::PhoneModeChanged, - manager::actions::BluetoothModeChanged}}; + manager::actions::BluetoothModeChanged, + manager::actions::AlarmClockStatusChanged}}; } }; } /* namespace app */ diff --git a/module-apps/application-desktop/ApplicationDesktop.cpp b/module-apps/application-desktop/ApplicationDesktop.cpp index 39d9f3705355f6ea58e88fc6d4301ab26d917617..cff3b7c0303b941e7ec93e3daf1e6c50a39d4564 100644 --- a/module-apps/application-desktop/ApplicationDesktop.cpp +++ b/module-apps/application-desktop/ApplicationDesktop.cpp @@ -37,10 +37,9 @@ namespace app { ApplicationDesktop::ApplicationDesktop(std::string name, std::string parent, - sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, StartInBackground startInBackground) - : Application(std::move(name), std::move(parent), phoneMode, bluetoothMode, startInBackground), + : Application(std::move(name), std::move(parent), statusIndicators, startInBackground), AsyncCallbackReceiver(this), dbNotificationHandler(this) { using namespace gui::status_bar; diff --git a/module-apps/application-desktop/include/application-desktop/ApplicationDesktop.hpp b/module-apps/application-desktop/include/application-desktop/ApplicationDesktop.hpp index e9567d3ab57ccbea5c1415e70d1a8bac67eca6a7..b773df63e34316be104e24fa23324306c5bae016 100644 --- a/module-apps/application-desktop/include/application-desktop/ApplicationDesktop.hpp +++ b/module-apps/application-desktop/include/application-desktop/ApplicationDesktop.hpp @@ -26,12 +26,10 @@ namespace app class ApplicationDesktop : public Application, public AsyncCallbackReceiver { public: - explicit ApplicationDesktop( - std::string name = name_desktop, - std::string parent = {}, - sys::phone_modes::PhoneMode phoneMode = sys::phone_modes::PhoneMode::Connected, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - StartInBackground startInBackground = {false}); + explicit ApplicationDesktop(std::string name = name_desktop, + std::string parent = {}, + StatusIndicators statusIndicators = StatusIndicators{}, + StartInBackground startInBackground = {false}); sys::MessagePointer DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) override; sys::ReturnCodes InitHandler() override; @@ -70,7 +68,8 @@ namespace app manager::actions::DisplayLogoAtExit, manager::actions::PhoneModeChanged, manager::actions::BluetoothModeChanged, - manager::actions::NotificationsChanged}}; + manager::actions::NotificationsChanged, + manager::actions::AlarmClockStatusChanged}}; } }; diff --git a/module-apps/application-desktop/windows/DesktopMainWindow.cpp b/module-apps/application-desktop/windows/DesktopMainWindow.cpp index 66d3021a9bc5a9ff7f9653065b1fe47bc635db49..d023688928ff7d5ddf839ae64ca51917977e2406 100644 --- a/module-apps/application-desktop/windows/DesktopMainWindow.cpp +++ b/module-apps/application-desktop/windows/DesktopMainWindow.cpp @@ -93,6 +93,7 @@ namespace gui appConfiguration.enable(status_bar::Indicator::Signal); appConfiguration.enable(status_bar::Indicator::SimCard); appConfiguration.enable(status_bar::Indicator::Bluetooth); + appConfiguration.enable(status_bar::Indicator::AlarmClock); return appConfiguration; } diff --git a/module-apps/application-meditation/ApplicationMeditation.cpp b/module-apps/application-meditation/ApplicationMeditation.cpp index 2155b0d6ffc58ff0d94cee7580c0c1d1b791a991..5da4fb9b845d82e00114e7438b5f526721b3ed1c 100644 --- a/module-apps/application-meditation/ApplicationMeditation.cpp +++ b/module-apps/application-meditation/ApplicationMeditation.cpp @@ -11,11 +11,9 @@ namespace app { ApplicationMeditation::ApplicationMeditation(std::string name, std::string parent, - sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, StartInBackground startInBackground) - : Application{name, parent, phoneMode, bluetoothMode, startInBackground}, - state{std::make_unique()} + : Application{name, parent, statusIndicators, startInBackground}, state{std::make_unique()} {} auto ApplicationMeditation::InitHandler() -> sys::ReturnCodes diff --git a/module-apps/application-meditation/include/application-meditation/ApplicationMeditation.hpp b/module-apps/application-meditation/include/application-meditation/ApplicationMeditation.hpp index 9c5a52eef6fcd892b2fb7529e7453e73bfe3eae2..f478ce65d6000186d6aaa1fe7c46e316fb4e940f 100644 --- a/module-apps/application-meditation/include/application-meditation/ApplicationMeditation.hpp +++ b/module-apps/application-meditation/include/application-meditation/ApplicationMeditation.hpp @@ -16,12 +16,10 @@ namespace app class ApplicationMeditation : public Application { public: - explicit ApplicationMeditation( - std::string name = name_meditation, - std::string parent = {}, - sys::phone_modes::PhoneMode phoneMode = sys::phone_modes::PhoneMode::Connected, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - StartInBackground startInBackground = {false}); + explicit ApplicationMeditation(std::string name = name_meditation, + std::string parent = {}, + StatusIndicators statusIndicators = StatusIndicators{}, + StartInBackground startInBackground = {false}); auto InitHandler() -> sys::ReturnCodes override; auto DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) -> sys::MessagePointer override; @@ -36,9 +34,11 @@ namespace app { static auto GetManifest() -> manager::ApplicationManifest { - return { - {manager::actions::Launch, manager::actions::PhoneModeChanged, manager::actions::BluetoothModeChanged}, - locks::AutoLockPolicy::PreventPermanently}; + return {{manager::actions::Launch, + manager::actions::PhoneModeChanged, + manager::actions::BluetoothModeChanged, + manager::actions::AlarmClockStatusChanged}, + locks::AutoLockPolicy::PreventPermanently}; } }; } // namespace app diff --git a/module-apps/application-messages/ApplicationMessages.cpp b/module-apps/application-messages/ApplicationMessages.cpp index cd2f8638612520f2748ca8283c2c1942b67cb19c..b9b3479411146ac7373f24ab416990bdbb98047a 100644 --- a/module-apps/application-messages/ApplicationMessages.cpp +++ b/module-apps/application-messages/ApplicationMessages.cpp @@ -40,11 +40,10 @@ namespace app ApplicationMessages::ApplicationMessages(std::string name, std::string parent, - sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, StartInBackground startInBackground) - : Application(name, parent, phoneMode, bluetoothMode, startInBackground, messagesStackDepth), - AsyncCallbackReceiver{this} + : Application(name, parent, statusIndicators, startInBackground, messagesStackDepth), AsyncCallbackReceiver{ + this} { bus.channels.push_back(sys::BusChannel::ServiceDBNotifications); addActionReceiver(manager::actions::CreateSms, [this](auto &&data) { diff --git a/module-apps/application-messages/include/application-messages/ApplicationMessages.hpp b/module-apps/application-messages/include/application-messages/ApplicationMessages.hpp index e128b87e7cfee929172b414a1c4d036edc2219cb..dd458a43ad59412b7e67ada6ec5df330c072d0b2 100644 --- a/module-apps/application-messages/include/application-messages/ApplicationMessages.hpp +++ b/module-apps/application-messages/include/application-messages/ApplicationMessages.hpp @@ -24,12 +24,10 @@ namespace app class ApplicationMessages : public app::Application, public app::AsyncCallbackReceiver { public: - explicit ApplicationMessages( - std::string name = name_messages, - std::string parent = {}, - sys::phone_modes::PhoneMode phoneMode = sys::phone_modes::PhoneMode::Connected, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - StartInBackground startInBackground = {false}); + explicit ApplicationMessages(std::string name = name_messages, + std::string parent = {}, + StatusIndicators statusIndicators = StatusIndicators{}, + StartInBackground startInBackground = {false}); sys::MessagePointer DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) override; sys::ReturnCodes InitHandler() override; @@ -78,7 +76,8 @@ namespace app manager::actions::SmsRejectNoSim, manager::actions::SMSRejectedByOfflineNotification, manager::actions::PhoneModeChanged, - manager::actions::BluetoothModeChanged}}; + manager::actions::BluetoothModeChanged, + manager::actions::AlarmClockStatusChanged}}; } }; } /* namespace app */ diff --git a/module-apps/application-music-player/ApplicationMusicPlayer.cpp b/module-apps/application-music-player/ApplicationMusicPlayer.cpp index c22861ec46d6da9ddcffd0d45055f36d7678077a..4bd7f5699afab5b8d0fbcfbe49fbd30e61b26471 100644 --- a/module-apps/application-music-player/ApplicationMusicPlayer.cpp +++ b/module-apps/application-music-player/ApplicationMusicPlayer.cpp @@ -35,15 +35,10 @@ namespace app ApplicationMusicPlayer::ApplicationMusicPlayer(std::string name, std::string parent, - sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, StartInBackground startInBackground) - : Application(std::move(name), - std::move(parent), - phoneMode, - bluetoothMode, - startInBackground, - applicationMusicPlayerStackSize), + : Application( + std::move(name), std::move(parent), statusIndicators, startInBackground, applicationMusicPlayerStackSize), priv{std::make_unique()} { LOG_INFO("ApplicationMusicPlayer::create"); diff --git a/module-apps/application-music-player/include/application-music-player/ApplicationMusicPlayer.hpp b/module-apps/application-music-player/include/application-music-player/ApplicationMusicPlayer.hpp index be8b1cb22c478fbdd48eb7b35eae1dd472a9c076..fb0315551553785e26b4a1c3e0aadb70d5702e33 100644 --- a/module-apps/application-music-player/include/application-music-player/ApplicationMusicPlayer.hpp +++ b/module-apps/application-music-player/include/application-music-player/ApplicationMusicPlayer.hpp @@ -34,12 +34,10 @@ namespace app { public: - explicit ApplicationMusicPlayer( - std::string name = name_music_player, - std::string parent = {}, - sys::phone_modes::PhoneMode phoneMode = sys::phone_modes::PhoneMode::Connected, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - StartInBackground startInBackground = {false}); + explicit ApplicationMusicPlayer(std::string name = name_music_player, + std::string parent = {}, + StatusIndicators statusIndicators = StatusIndicators{}, + StartInBackground startInBackground = {false}); ~ApplicationMusicPlayer() override; sys::MessagePointer DataReceivedHandler(sys::DataMessage *msgl, @@ -66,9 +64,11 @@ namespace app { static auto GetManifest() -> manager::ApplicationManifest { - return { - {manager::actions::Launch, manager::actions::PhoneModeChanged, manager::actions::BluetoothModeChanged}, - locks::AutoLockPolicy::DetermineByWindow}; + return {{manager::actions::Launch, + manager::actions::PhoneModeChanged, + manager::actions::BluetoothModeChanged, + manager::actions::AlarmClockStatusChanged}, + locks::AutoLockPolicy::DetermineByWindow}; } }; } /* namespace app */ diff --git a/module-apps/application-notes/ApplicationNotes.cpp b/module-apps/application-notes/ApplicationNotes.cpp index cdd10e93f4b308a2c20df7d1a1f71689e1b7ab9a..18d084c07a92c4dc7c9188a42a269d7e93f4c8ec 100644 --- a/module-apps/application-notes/ApplicationNotes.cpp +++ b/module-apps/application-notes/ApplicationNotes.cpp @@ -29,10 +29,9 @@ namespace app ApplicationNotes::ApplicationNotes(std::string name, std::string parent, - sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, StartInBackground startInBackground) - : Application(std::move(name), std::move(parent), phoneMode, bluetoothMode, startInBackground, NotesStackSize) + : Application(std::move(name), std::move(parent), statusIndicators, startInBackground, NotesStackSize) { bus.channels.push_back(sys::BusChannel::ServiceDBNotifications); } diff --git a/module-apps/application-notes/include/application-notes/ApplicationNotes.hpp b/module-apps/application-notes/include/application-notes/ApplicationNotes.hpp index 0c208c310c9ce74a4b105a4cb59bba4ee4745dea..8afd8dbe43b60ce753d11e6ff68bc4e5a56351d1 100644 --- a/module-apps/application-notes/include/application-notes/ApplicationNotes.hpp +++ b/module-apps/application-notes/include/application-notes/ApplicationNotes.hpp @@ -23,11 +23,10 @@ namespace app class ApplicationNotes : public Application { public: - explicit ApplicationNotes(std::string name = name_notes, - std::string parent = {}, - sys::phone_modes::PhoneMode phoneMode = sys::phone_modes::PhoneMode::Connected, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - StartInBackground startInBackground = {false}); + explicit ApplicationNotes(std::string name = name_notes, + std::string parent = {}, + StatusIndicators statusIndicators = StatusIndicators{}, + StartInBackground startInBackground = {false}); sys::MessagePointer DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) override; sys::ReturnCodes InitHandler() override; @@ -42,8 +41,10 @@ namespace app { static auto GetManifest() -> manager::ApplicationManifest { - return { - {manager::actions::Launch, manager::actions::PhoneModeChanged, manager::actions::BluetoothModeChanged}}; + return {{manager::actions::Launch, + manager::actions::PhoneModeChanged, + manager::actions::BluetoothModeChanged, + manager::actions::AlarmClockStatusChanged}}; } }; } // namespace app diff --git a/module-apps/application-onboarding/ApplicationOnBoarding.cpp b/module-apps/application-onboarding/ApplicationOnBoarding.cpp index d361ed3a7d046d729a730c0bdab0c2f0e0617d2c..332cca7113e1fab8f5108094cf33fe1701ec6de4 100644 --- a/module-apps/application-onboarding/ApplicationOnBoarding.cpp +++ b/module-apps/application-onboarding/ApplicationOnBoarding.cpp @@ -31,11 +31,9 @@ namespace app ApplicationOnBoarding::ApplicationOnBoarding(std::string name, std::string parent, - sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, StartInBackground startInBackground) - : Application( - std::move(name), std::move(parent), phoneMode, bluetoothMode, startInBackground, OnBoardingStackSize) + : Application(std::move(name), std::move(parent), statusIndicators, startInBackground, OnBoardingStackSize) { using namespace gui::status_bar; statusBarManager->enableIndicators( diff --git a/module-apps/application-onboarding/ApplicationOnBoarding.hpp b/module-apps/application-onboarding/ApplicationOnBoarding.hpp index 2a41fa39afc57a355a43d5deae372e792215f2a4..86fb0644985ad798e7c7664581b64cf66b474bed 100644 --- a/module-apps/application-onboarding/ApplicationOnBoarding.hpp +++ b/module-apps/application-onboarding/ApplicationOnBoarding.hpp @@ -27,12 +27,10 @@ namespace app class ApplicationOnBoarding : public Application { public: - explicit ApplicationOnBoarding( - std::string name = name_onboarding, - std::string parent = {}, - sys::phone_modes::PhoneMode phoneMode = sys::phone_modes::PhoneMode::Connected, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - StartInBackground startInBackground = {false}); + explicit ApplicationOnBoarding(std::string name = name_onboarding, + std::string parent = {}, + StatusIndicators statusIndicators = StatusIndicators{}, + StartInBackground startInBackground = {false}); sys::MessagePointer DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) override; sys::ReturnCodes InitHandler() override; @@ -49,9 +47,11 @@ namespace app { static auto GetManifest() -> manager::ApplicationManifest { - return { - {manager::actions::Launch, manager::actions::PhoneModeChanged, manager::actions::BluetoothModeChanged}, - locks::AutoLockPolicy::PreventPermanently}; + return {{manager::actions::Launch, + manager::actions::PhoneModeChanged, + manager::actions::BluetoothModeChanged, + manager::actions::AlarmClockStatusChanged}, + locks::AutoLockPolicy::PreventPermanently}; } }; } // namespace app diff --git a/module-apps/application-phonebook/ApplicationPhonebook.cpp b/module-apps/application-phonebook/ApplicationPhonebook.cpp index 7064ae62d96ef3aef3befd95ec0068b78169b2ba..afe9948459010727b2b302e916c3d9ce88b942e4 100644 --- a/module-apps/application-phonebook/ApplicationPhonebook.cpp +++ b/module-apps/application-phonebook/ApplicationPhonebook.cpp @@ -22,11 +22,9 @@ namespace app { ApplicationPhonebook::ApplicationPhonebook(std::string name, std::string parent, - sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, StartInBackground startInBackground) - : Application( - std::move(name), std::move(parent), phoneMode, bluetoothMode, startInBackground, phonebook_stack_size) + : Application(std::move(name), std::move(parent), statusIndicators, startInBackground, phonebook_stack_size) { bus.channels.push_back(sys::BusChannel::ServiceDBNotifications); addActionReceiver(manager::actions::ShowContacts, [this](auto &&data) { diff --git a/module-apps/application-phonebook/include/application-phonebook/ApplicationPhonebook.hpp b/module-apps/application-phonebook/include/application-phonebook/ApplicationPhonebook.hpp index e453492b51cf773b1128890133066649aa3b0ab9..b88cc41d91f109c52f8abd6aa9c3733ea4c05822 100644 --- a/module-apps/application-phonebook/include/application-phonebook/ApplicationPhonebook.hpp +++ b/module-apps/application-phonebook/include/application-phonebook/ApplicationPhonebook.hpp @@ -30,12 +30,10 @@ namespace app class ApplicationPhonebook : public app::Application { public: - explicit ApplicationPhonebook( - std::string name = name_phonebook, - std::string parent = {}, - sys::phone_modes::PhoneMode phoneMode = sys::phone_modes::PhoneMode::Connected, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - StartInBackground startInBackground = {false}); + explicit ApplicationPhonebook(std::string name = name_phonebook, + std::string parent = {}, + StatusIndicators statusIndicators = StatusIndicators{}, + StartInBackground startInBackground = {false}); ~ApplicationPhonebook() override = default; auto DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) -> sys::MessagePointer override; @@ -64,7 +62,8 @@ namespace app manager::actions::ShowContactDetails, manager::actions::ShowEmergencyContacts, manager::actions::PhoneModeChanged, - manager::actions::BluetoothModeChanged}}; + manager::actions::BluetoothModeChanged, + manager::actions::AlarmClockStatusChanged}}; } }; } // namespace app diff --git a/module-apps/application-settings/ApplicationSettings.cpp b/module-apps/application-settings/ApplicationSettings.cpp index 92a4eda0660899f83a097fa48112f6787c10f6f4..9facc41c236b6c3e9f756b873438ff5f2c65f015 100644 --- a/module-apps/application-settings/ApplicationSettings.cpp +++ b/module-apps/application-settings/ApplicationSettings.cpp @@ -99,11 +99,9 @@ namespace app ApplicationSettings::ApplicationSettings(std::string name, std::string parent, - sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, StartInBackground startInBackground) - : Application( - std::move(name), std::move(parent), phoneMode, bluetoothMode, startInBackground, settingStackDepth), + : Application(std::move(name), std::move(parent), statusIndicators, startInBackground, settingStackDepth), AsyncCallbackReceiver{this}, soundsPlayer{std::make_shared(this)} { bus.channels.push_back(sys::BusChannel::ServiceAudioNotifications); @@ -749,7 +747,7 @@ namespace app auto ApplicationSettings::getCurrentPhoneMode() const noexcept -> sys::phone_modes::PhoneMode { - return phoneMode; + return statusIndicators.phoneMode; } void ApplicationSettings::setAutoLockTime(std::chrono::seconds lockTime) diff --git a/module-apps/application-settings/include/application-settings/ApplicationSettings.hpp b/module-apps/application-settings/include/application-settings/ApplicationSettings.hpp index 589bce4e0c12a48b509ef436d60c9d8f3732c925..05b815868bdd06c41c3b2e515fde4a798c2ea113 100644 --- a/module-apps/application-settings/include/application-settings/ApplicationSettings.hpp +++ b/module-apps/application-settings/include/application-settings/ApplicationSettings.hpp @@ -119,12 +119,10 @@ namespace app public AsyncCallbackReceiver { public: - explicit ApplicationSettings( - std::string name = name_settings, - std::string parent = {}, - sys::phone_modes::PhoneMode phoneMode = sys::phone_modes::PhoneMode::Connected, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - StartInBackground startInBackground = {false}); + explicit ApplicationSettings(std::string name = name_settings, + std::string parent = {}, + StatusIndicators statusIndicators = StatusIndicators{}, + StartInBackground startInBackground = {false}); ~ApplicationSettings() override; auto DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) -> sys::MessagePointer override; auto InitHandler() -> sys::ReturnCodes override; @@ -196,8 +194,10 @@ namespace app { static auto GetManifest() -> manager::ApplicationManifest { - return { - {manager::actions::Launch, manager::actions::PhoneModeChanged, manager::actions::BluetoothModeChanged}}; + return {{manager::actions::Launch, + manager::actions::PhoneModeChanged, + manager::actions::BluetoothModeChanged, + manager::actions::AlarmClockStatusChanged}}; } }; } /* namespace app */ diff --git a/module-apps/application-settings/windows/advanced/StatusBarImageTypeWindow.cpp b/module-apps/application-settings/windows/advanced/StatusBarImageTypeWindow.cpp index 20a870c130921c2fae471762c28316651efce552..cddc6c835059187cbfc5ca005c9c7653026a66bc 100644 --- a/module-apps/application-settings/windows/advanced/StatusBarImageTypeWindow.cpp +++ b/module-apps/application-settings/windows/advanced/StatusBarImageTypeWindow.cpp @@ -76,6 +76,7 @@ namespace gui appConfiguration.enable(status_bar::Indicator::Signal); appConfiguration.enable(status_bar::Indicator::SimCard); appConfiguration.enable(status_bar::Indicator::Bluetooth); + appConfiguration.enable(status_bar::Indicator::AlarmClock); return appConfiguration; } } /* namespace gui */ diff --git a/module-apps/application-special-input/ApplicationSpecialInput.cpp b/module-apps/application-special-input/ApplicationSpecialInput.cpp index 61b09d8883f2f205fd9fd321ccec7f890730df3d..71449f1e622d460ff493a2bc177f43c7fd9d1510 100644 --- a/module-apps/application-special-input/ApplicationSpecialInput.cpp +++ b/module-apps/application-special-input/ApplicationSpecialInput.cpp @@ -14,10 +14,9 @@ namespace ApplicationSpecialInput::ApplicationSpecialInput(std::string name, std::string parent, - sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, StartInBackground startInBackground) - : Application(name, parent, phoneMode, bluetoothMode, startInBackground, SpecialInputAppStackDepth) + : Application(name, parent, statusIndicators, startInBackground, SpecialInputAppStackDepth) { addActionReceiver(manager::actions::ShowSpecialInput, [this](auto &&data) { switchWindow(app::char_select, std::move(data)); diff --git a/module-apps/application-special-input/include/application-special-input/ApplicationSpecialInput.hpp b/module-apps/application-special-input/include/application-special-input/ApplicationSpecialInput.hpp index e41fc66f02de040d58c550a164d28db10b8d1107..85adeefeea1bb04a8c40e13ab35fbeee527a67c3 100644 --- a/module-apps/application-special-input/include/application-special-input/ApplicationSpecialInput.hpp +++ b/module-apps/application-special-input/include/application-special-input/ApplicationSpecialInput.hpp @@ -19,11 +19,10 @@ namespace app public: std::string requester = ""; - ApplicationSpecialInput(std::string name = special_input, - std::string parent = {}, - sys::phone_modes::PhoneMode phoneMode = sys::phone_modes::PhoneMode::Connected, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - StartInBackground startInBackground = {true}); + ApplicationSpecialInput(std::string name = special_input, + std::string parent = {}, + StatusIndicators statusIndicators = StatusIndicators{}, + StartInBackground startInBackground = {true}); virtual ~ApplicationSpecialInput() = default; sys::MessagePointer DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) override; diff --git a/module-apps/apps-common/ApplicationCommon.cpp b/module-apps/apps-common/ApplicationCommon.cpp index 7a4265474ee97509fab1f137938bbf0366f904ea..edf61561e30adf49adcc2ae22ad414c631b49fb2 100644 --- a/module-apps/apps-common/ApplicationCommon.cpp +++ b/module-apps/apps-common/ApplicationCommon.cpp @@ -17,6 +17,7 @@ #include // for LOG_INFO #include "messages/AppMessage.hpp" // for AppSwitchMe... #include "service-appmgr/Controller.hpp" // for Controller +#include "actions/AlarmClockStatusChangeParams.hpp" #include #include #include @@ -102,8 +103,7 @@ namespace app ApplicationCommon::ApplicationCommon(std::string name, std::string parent, - sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, StartInBackground startInBackground, uint32_t stackDepth, sys::ServicePriority priority) @@ -111,8 +111,8 @@ namespace app default_window(gui::name::window::main_window), windowsStack(this), keyTranslator{std::make_unique()}, startInBackground{startInBackground}, callbackStorage{std::make_unique()}, statusBarManager{std::make_unique()}, - settings(std::make_unique()), phoneMode{phoneMode}, bluetoothMode(bluetoothMode), - phoneLockSubject(this), lockPolicyHandler(this), simLockSubject(this) + settings(std::make_unique()), statusIndicators{statusIndicators}, phoneLockSubject(this), + lockPolicyHandler(this), simLockSubject(this) { statusBarManager->enableIndicators({gui::status_bar::Indicator::Time}); @@ -136,14 +136,22 @@ namespace app addActionReceiver(app::manager::actions::PhoneModeChanged, [this](auto &¶ms) { if (params != nullptr) { auto modeParams = static_cast(params.get()); - this->phoneMode = modeParams->getPhoneMode(); + this->statusIndicators.phoneMode = modeParams->getPhoneMode(); } return actionHandled(); }); addActionReceiver(app::manager::actions::BluetoothModeChanged, [this](auto &¶ms) { if (params != nullptr) { auto modeParams = static_cast(params.get()); - this->bluetoothMode = modeParams->getBluetoothMode(); + this->statusIndicators.bluetoothMode = modeParams->getBluetoothMode(); + refreshWindow(gui::RefreshModes::GUI_REFRESH_FAST); + } + return actionHandled(); + }); + addActionReceiver(app::manager::actions::AlarmClockStatusChanged, [this](auto &¶ms) { + if (params != nullptr) { + auto status = static_cast(params.get())->getAlarmClockStatus(); + this->statusIndicators.alarmClockStatus = status; refreshWindow(gui::RefreshModes::GUI_REFRESH_FAST); } return actionHandled(); @@ -212,12 +220,13 @@ namespace app if (state == State::ACTIVE_FORGROUND) { auto window = getCurrentWindow(); window->updateBatteryStatus(); - window->updateBluetooth(bluetoothMode); + window->updateBluetooth(statusIndicators.bluetoothMode); + window->updateAlarmClock(statusIndicators.alarmClockStatus); window->updateSim(); window->updateSignalStrength(); window->updateNetworkAccessTechnology(); window->updateTime(); - window->updatePhoneMode(phoneMode); + window->updatePhoneMode(statusIndicators.phoneMode); auto message = std::make_shared(window->buildDrawList(), mode); diff --git a/module-apps/apps-common/ApplicationCommon.hpp b/module-apps/apps-common/ApplicationCommon.hpp index f6165b0e4373d301de8fd6386e9b6939a2f69e4e..6642581a46a8c4087d04330ba05b5c4a7b7a0dab 100644 --- a/module-apps/apps-common/ApplicationCommon.hpp +++ b/module-apps/apps-common/ApplicationCommon.hpp @@ -119,6 +119,14 @@ namespace app return ManifestTraits::GetManifest(); } + class StatusIndicators + { + public: + sys::phone_modes::PhoneMode phoneMode = sys::phone_modes::PhoneMode::Connected; + sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled; + bool alarmClockStatus = false; + }; + /// This is template for creating new applications. Main difference between Application and service is that: /// 1. Application has access to GUI and Input /// 2. Application lifetime is managed with app::manager::ApplicationManager @@ -197,14 +205,12 @@ namespace app sys::TimerHandle longPressTimer; void clearLongPressTimeout(); - explicit ApplicationCommon( - std::string name, - std::string parent = "", - sys::phone_modes::PhoneMode phoneMode = sys::phone_modes::PhoneMode::Connected, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - StartInBackground startInBackground = {false}, - uint32_t stackDepth = 4096, - sys::ServicePriority priority = sys::ServicePriority::Idle); + explicit ApplicationCommon(std::string name, + std::string parent = "", + StatusIndicators statusIndicators = StatusIndicators{}, + StartInBackground startInBackground = {false}, + uint32_t stackDepth = 4096, + sys::ServicePriority priority = sys::ServicePriority::Idle); virtual ~ApplicationCommon() noexcept; @@ -415,8 +421,7 @@ namespace app /// application's settings std::unique_ptr settings; - sys::phone_modes::PhoneMode phoneMode; - sys::bluetooth::BluetoothMode bluetoothMode; + StatusIndicators statusIndicators; locks::PhoneLockSubject phoneLockSubject; locks::LockPolicyHandler lockPolicyHandler; diff --git a/module-apps/apps-common/ApplicationLauncher.hpp b/module-apps/apps-common/ApplicationLauncher.hpp index 5704061bae13f85d54fc807e2a5796ca2437da8c..56a91925e22ba39c51679fe764bc15982ec5589f 100644 --- a/module-apps/apps-common/ApplicationLauncher.hpp +++ b/module-apps/apps-common/ApplicationLauncher.hpp @@ -59,16 +59,12 @@ namespace app return (handle == nullptr || handle->getLockPolicyHandler().preventsAutoLocking()); } - virtual bool run(sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, - sys::Service *caller = nullptr) + virtual bool run(StatusIndicators statusIndicators, sys::Service *caller = nullptr) { return false; } - virtual bool runBackground(sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, - sys::Service *caller = nullptr) + virtual bool runBackground(StatusIndicators statusIndicators, sys::Service *caller = nullptr) { return false; } @@ -84,22 +80,18 @@ namespace app : ApplicationLauncher(std::move(name), std::move(manifest), isCloseable) {} - bool run(sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, - sys::Service *caller) override + bool run(StatusIndicators statusIndicators, sys::Service *caller) override { parent = (caller == nullptr ? "" : caller->GetName()); - handle = std::make_shared(name, parent, phoneMode, bluetoothMode); + handle = std::make_shared(name, parent, statusIndicators); setAutoLockPolicy(); return sys::SystemManagerCommon::RunApplication(handle, caller); } - bool runBackground(sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, - sys::Service *caller) override + bool runBackground(StatusIndicators statusIndicators, sys::Service *caller) override { parent = (caller == nullptr ? "" : caller->GetName()); - handle = std::make_shared(name, parent, phoneMode, bluetoothMode, true); + handle = std::make_shared(name, parent, statusIndicators, true); setAutoLockPolicy(); return sys::SystemManagerCommon::RunApplication(handle, caller); } diff --git a/module-apps/apps-common/actions/AlarmClockStatusChangeParams.hpp b/module-apps/apps-common/actions/AlarmClockStatusChangeParams.hpp new file mode 100644 index 0000000000000000000000000000000000000000..10a828dcd6d3a295f9ca7aa426c5e0c05827a3d8 --- /dev/null +++ b/module-apps/apps-common/actions/AlarmClockStatusChangeParams.hpp @@ -0,0 +1,24 @@ +// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md + +#pragma once + +#include + +namespace app +{ + class AlarmClockStatusParams : public app::manager::actions::ActionParams + { + public: + explicit AlarmClockStatusParams(bool status) : status{status} + {} + + [[nodiscard]] auto getAlarmClockStatus() const noexcept + { + return status; + } + + private: + bool status; + }; +} // namespace app diff --git a/module-apps/apps-common/locks/windows/LockInputWindow.cpp b/module-apps/apps-common/locks/windows/LockInputWindow.cpp index 0264e1a91578f68dd32f956b2d0c258e017116cf..400bf1d364502aa869ea8d655b507c038f685a73 100644 --- a/module-apps/apps-common/locks/windows/LockInputWindow.cpp +++ b/module-apps/apps-common/locks/windows/LockInputWindow.cpp @@ -112,6 +112,7 @@ namespace gui appConfiguration.enable(status_bar::Indicator::Signal); appConfiguration.enable(status_bar::Indicator::SimCard); appConfiguration.enable(status_bar::Indicator::Bluetooth); + appConfiguration.enable(status_bar::Indicator::AlarmClock); return appConfiguration; } diff --git a/module-apps/apps-common/popups/lock-popups/PhoneLockInputWindow.cpp b/module-apps/apps-common/popups/lock-popups/PhoneLockInputWindow.cpp index 2dd32e58ad476d436d10fc953a935e9e6ff9711f..1254667480eac7c64d87ca42f76144b88256bdff 100644 --- a/module-apps/apps-common/popups/lock-popups/PhoneLockInputWindow.cpp +++ b/module-apps/apps-common/popups/lock-popups/PhoneLockInputWindow.cpp @@ -43,6 +43,7 @@ namespace gui appConfiguration.enable(status_bar::Indicator::Signal); appConfiguration.enable(status_bar::Indicator::SimCard); appConfiguration.enable(status_bar::Indicator::Bluetooth); + appConfiguration.enable(status_bar::Indicator::AlarmClock); } else { appConfiguration.enable(status_bar::Indicator::Time); diff --git a/module-apps/apps-common/popups/lock-popups/PhoneLockedInfoWindow.cpp b/module-apps/apps-common/popups/lock-popups/PhoneLockedInfoWindow.cpp index fe9d32055a9e27967c4b8aaac510825a2756b8c9..f677be28dac8779b1556300bb11fc6133044e436 100644 --- a/module-apps/apps-common/popups/lock-popups/PhoneLockedInfoWindow.cpp +++ b/module-apps/apps-common/popups/lock-popups/PhoneLockedInfoWindow.cpp @@ -100,6 +100,7 @@ status_bar::Configuration PhoneLockedInfoWindow::configureStatusBar(status_bar:: appConfiguration.enable(status_bar::Indicator::Signal); appConfiguration.enable(status_bar::Indicator::SimCard); appConfiguration.enable(status_bar::Indicator::Bluetooth); + appConfiguration.enable(status_bar::Indicator::AlarmClock); return appConfiguration; } diff --git a/module-apps/apps-common/popups/lock-popups/PhoneLockedWindow.cpp b/module-apps/apps-common/popups/lock-popups/PhoneLockedWindow.cpp index 90ab7f50230828406c624eb665d671fe6361aa5f..5b0d095cac50d911ffe8c8e68df41f05ffd7ee99 100644 --- a/module-apps/apps-common/popups/lock-popups/PhoneLockedWindow.cpp +++ b/module-apps/apps-common/popups/lock-popups/PhoneLockedWindow.cpp @@ -58,6 +58,7 @@ namespace gui appConfiguration.enable(status_bar::Indicator::Signal); appConfiguration.enable(status_bar::Indicator::SimCard); appConfiguration.enable(status_bar::Indicator::Bluetooth); + appConfiguration.enable(status_bar::Indicator::AlarmClock); return appConfiguration; } diff --git a/module-apps/apps-common/popups/lock-popups/SimInfoWindow.cpp b/module-apps/apps-common/popups/lock-popups/SimInfoWindow.cpp index 23e1a2e06c11a575fb01f5977e51faae6dafcaef..204abc63fd762dc473b8ac8ff700317dc3e8f8dc 100644 --- a/module-apps/apps-common/popups/lock-popups/SimInfoWindow.cpp +++ b/module-apps/apps-common/popups/lock-popups/SimInfoWindow.cpp @@ -22,6 +22,7 @@ status_bar::Configuration SimInfoWindow::configureStatusBar(status_bar::Configur appConfiguration.enable(status_bar::Indicator::Signal); appConfiguration.enable(status_bar::Indicator::SimCard); appConfiguration.enable(status_bar::Indicator::Bluetooth); + appConfiguration.enable(status_bar::Indicator::AlarmClock); return appConfiguration; } diff --git a/module-apps/apps-common/popups/lock-popups/SimLockInputWindow.cpp b/module-apps/apps-common/popups/lock-popups/SimLockInputWindow.cpp index 6bca0daa4355b9b3b0a039f471e21a8c3b068d01..90b73285298ab107705d7737416e45ab88157b51 100644 --- a/module-apps/apps-common/popups/lock-popups/SimLockInputWindow.cpp +++ b/module-apps/apps-common/popups/lock-popups/SimLockInputWindow.cpp @@ -52,6 +52,7 @@ namespace gui appConfiguration.enable(status_bar::Indicator::Signal); appConfiguration.enable(status_bar::Indicator::SimCard); appConfiguration.enable(status_bar::Indicator::Bluetooth); + appConfiguration.enable(status_bar::Indicator::AlarmClock); return appConfiguration; } diff --git a/module-apps/apps-common/popups/lock-popups/SimNotReadyWindow.cpp b/module-apps/apps-common/popups/lock-popups/SimNotReadyWindow.cpp index 5d660aee14ab42087928fb7e959ea17e012e9194..90663fd2469ad060b2a52c57028e4e986a7dffcc 100644 --- a/module-apps/apps-common/popups/lock-popups/SimNotReadyWindow.cpp +++ b/module-apps/apps-common/popups/lock-popups/SimNotReadyWindow.cpp @@ -24,6 +24,7 @@ status_bar::Configuration SimNotReadyWindow::configureStatusBar(status_bar::Conf appConfiguration.enable(status_bar::Indicator::Signal); appConfiguration.enable(status_bar::Indicator::SimCard); appConfiguration.enable(status_bar::Indicator::Bluetooth); + appConfiguration.enable(status_bar::Indicator::AlarmClock); return appConfiguration; } diff --git a/module-apps/apps-common/windows/AppWindow.cpp b/module-apps/apps-common/windows/AppWindow.cpp index 8b1d98d816e38950be6fa7497ef73db0f1281a2c..8c4ef5b7529cc1c0f13a4ef74c48f9646b09c684 100644 --- a/module-apps/apps-common/windows/AppWindow.cpp +++ b/module-apps/apps-common/windows/AppWindow.cpp @@ -79,6 +79,14 @@ namespace gui return statusBar->updateBluetooth(mode); } + bool AppWindow::updateAlarmClock(bool status) + { + if (statusBar == nullptr) { + return false; + } + return statusBar->updateAlarmClock(status); + } + bool AppWindow::updateSim() { if (statusBar == nullptr) { diff --git a/module-apps/apps-common/windows/AppWindow.hpp b/module-apps/apps-common/windows/AppWindow.hpp index f4de3d7b0a00db0e83275d434993e758d24736a5..dd78c050d6b10a766b06450753c42fd6c02cc448 100644 --- a/module-apps/apps-common/windows/AppWindow.hpp +++ b/module-apps/apps-common/windows/AppWindow.hpp @@ -74,6 +74,7 @@ namespace gui virtual bool onDatabaseMessage(sys::Message *msg); bool updateBluetooth(sys::bluetooth::BluetoothMode mode); + bool updateAlarmClock(bool status); bool updateSim(); bool updateBatteryStatus(); bool updateSignalStrength(); diff --git a/module-gui/gui/widgets/CMakeLists.txt b/module-gui/gui/widgets/CMakeLists.txt index 9158c51601d0ab92c35db49ba6507d602959ab7a..60e7e59cf29bd2f2754e7edb45427bfd198a79b9 100644 --- a/module-gui/gui/widgets/CMakeLists.txt +++ b/module-gui/gui/widgets/CMakeLists.txt @@ -31,6 +31,7 @@ target_sources( ${PROJECT_NAME} "${CMAKE_CURRENT_LIST_DIR}/SideListView.cpp" "${CMAKE_CURRENT_LIST_DIR}/Spinner.cpp" "${CMAKE_CURRENT_LIST_DIR}/StatusBar.cpp" + "${CMAKE_CURRENT_LIST_DIR}/status-bar/AlarmClock.cpp" "${CMAKE_CURRENT_LIST_DIR}/status-bar/BT.cpp" "${CMAKE_CURRENT_LIST_DIR}/status-bar/SIM.cpp" "${CMAKE_CURRENT_LIST_DIR}/status-bar/BatteryBase.cpp" diff --git a/module-gui/gui/widgets/StatusBar.cpp b/module-gui/gui/widgets/StatusBar.cpp index a19b2c760632c1ad50d532d8f06ee0db0913df18..fcb300d9e6c65eecb433895b3220fef1fc01320c 100644 --- a/module-gui/gui/widgets/StatusBar.cpp +++ b/module-gui/gui/widgets/StatusBar.cpp @@ -13,6 +13,7 @@ #include "status-bar/SignalStrengthText.hpp" #include "status-bar/NetworkAccessTechnology.hpp" #include "status-bar/PhoneMode.hpp" +#include "status-bar/AlarmClock.hpp" #include "status-bar/BT.hpp" #include "status-bar/SIM.hpp" #include "status-bar/Time.hpp" @@ -76,6 +77,16 @@ namespace gui::status_bar mBluetoothMode = bluetoothMode; } + void Configuration::setAlarmClockStatus(bool alarmClockStatus) + { + mAlarmClockStatus = alarmClockStatus; + } + + auto Configuration::getAlarmClockStatus() const noexcept -> bool + { + return mAlarmClockStatus; + } + auto Configuration::isEnabled(Indicator indicator) const -> bool { return indicatorStatuses.at(indicator); @@ -149,6 +160,8 @@ namespace gui::status_bar sim->setMargins(gui::Margins(0, 0, margins::between, margins::iconBottom)); bluetooth = new BT(rightBox, 0, 0); bluetooth->setMargins(gui::Margins(0, 0, margins::between, margins::iconBottom)); + alarmClock = new AlarmClock(rightBox, 0, 0); + alarmClock->setMargins(gui::Margins(0, 0, margins::between, margins::iconBottom)); updateSignalStrength(); updateNetworkAccessTechnology(); @@ -181,6 +194,10 @@ namespace gui::status_bar bluetooth->setBluetoothMode(config.getBluetoothMode()); } + if (config.isEnabled(Indicator::AlarmClock)) { + alarmClock->setAlarmClockStatus(config.getAlarmClockStatus()); + } + for (auto &[indicator, modifier] : config.getIndicatorsModifiers()) { setIndicatorModifier(indicator, *modifier); } @@ -215,6 +232,9 @@ namespace gui::status_bar case Indicator::Bluetooth: showBluetooth(enabled); break; + case Indicator::AlarmClock: + showAlarmClock(enabled); + break; case Indicator::NetworkAccessTechnology: showNetworkAccessTechnology(enabled); break; @@ -257,6 +277,17 @@ namespace gui::status_bar rightBox->resizeItems(); } + void StatusBar::showAlarmClock(bool enabled) + { + if (enabled && configuration.getAlarmClockStatus()) { + alarmClock->show(); + } + else { + alarmClock->hide(); + } + rightBox->resizeItems(); + } + void StatusBar::showSim(bool enabled) { if (enabled) { @@ -280,6 +311,17 @@ namespace gui::status_bar return true; } + bool StatusBar::updateAlarmClock(bool status) + { + if (alarmClock == nullptr || !configuration.isEnabled(Indicator::AlarmClock)) { + return false; + } + configuration.setAlarmClockStatus(status); + alarmClock->setAlarmClockStatus(status); + rightBox->resizeItems(); + return true; + } + bool StatusBar::updateSim() { if (sim == nullptr) { diff --git a/module-gui/gui/widgets/StatusBar.hpp b/module-gui/gui/widgets/StatusBar.hpp index 6295561bf2759391860526edcdae4b21e8549f6c..676357191d0bbc77582c7c64f950b5f2e7e70581 100644 --- a/module-gui/gui/widgets/StatusBar.hpp +++ b/module-gui/gui/widgets/StatusBar.hpp @@ -7,6 +7,7 @@ #include #include +#include "status-bar/AlarmClock.hpp" #include #include @@ -46,6 +47,7 @@ namespace gui::status_bar SimCard, /// sim card info NetworkAccessTechnology, /// NAT (eg 3G, 4G, LTE) PhoneMode, /// phone mode + AlarmClock, /// alarm clock active }; using Indicators = std::vector; @@ -81,6 +83,10 @@ namespace gui::status_bar /// @param bluetoothMode desired bluetooth mode configuration void setBluetoothMode(sys::bluetooth::BluetoothMode bluetoothMode); + /// Set alarm clock status + /// @param alarmClockStatus desired alarm clock status + void setAlarmClockStatus(bool alarmClockStatus); + /// Set a configuration modifier to the specified indicator /// @param indicator indicator type /// @param config desired indicator's configuration @@ -94,6 +100,10 @@ namespace gui::status_bar /// @return bluetooth mode [[nodiscard]] auto getBluetoothMode() const noexcept -> sys::bluetooth::BluetoothMode; + /// Get the Alarm Clock status configuration + /// @return alarm clock status + [[nodiscard]] auto getAlarmClockStatus() const noexcept -> bool; + /// Check if the specified indicator is enabled /// @param indicator indicator to be checked /// @return indicator status @@ -109,14 +119,17 @@ namespace gui::status_bar private: /// Current indicator statuses - IndicatorStatuses indicatorStatuses = {{Indicator::Signal, false}, - {Indicator::PhoneMode, false}, - {Indicator::Time, false}, - {Indicator::Lock, false}, - {Indicator::Battery, false}, - {Indicator::Bluetooth, false}, - {Indicator::SimCard, false}, - {Indicator::NetworkAccessTechnology, false}}; + IndicatorStatuses indicatorStatuses = { + {Indicator::Signal, false}, + {Indicator::PhoneMode, false}, + {Indicator::Time, false}, + {Indicator::Lock, false}, + {Indicator::Battery, false}, + {Indicator::Bluetooth, false}, + {Indicator::SimCard, false}, + {Indicator::NetworkAccessTechnology, false}, + {Indicator::AlarmClock, false}, + }; /// Phone mode sys::phone_modes::PhoneMode mPhoneMode = sys::phone_modes::PhoneMode::Connected; @@ -124,6 +137,9 @@ namespace gui::status_bar /// Bluetooth mode sys::bluetooth::BluetoothMode mBluetoothMode = sys::bluetooth::BluetoothMode::Disabled; + /// Alarm Clock status + bool mAlarmClockStatus = false; + /// Indicator modifiers: IndicatorsModifiers indicatorsModifiers; }; @@ -152,9 +168,12 @@ namespace gui::status_bar /// @return configuration stored in Configuration class [[nodiscard]] auto getConfiguration() const noexcept -> const Configuration &; - /// Update sim card status widget state depending on the current configuration + /// Update bluetooth status widget state depending on the current configuration bool updateBluetooth(sys::bluetooth::BluetoothMode mode); + /// Update alarm clock status widget state depending on the current configuration + bool updateAlarmClock(bool status); + /// Update sim card status widget state depending on the current configuration bool updateSim(); @@ -184,6 +203,10 @@ namespace gui::status_bar /// @param enabled true to show false to hide the widget void showBluetooth(bool enabled); + /// Show/hide alarm clock status widget + /// @param enabled true to show false to hide the widget + void showAlarmClock(bool enabled); + /// Show/hide sim card status widget /// @param enabled true to show false to hide the widget void showSim(bool enabled); @@ -240,6 +263,9 @@ namespace gui::status_bar /// Pointer to widget with bluetooth status BT *bluetooth = nullptr; + /// Pointer to widget with alarm clock status + AlarmClock *alarmClock = nullptr; + /// Pointer to widget with sim card status SIM *sim = nullptr; diff --git a/module-gui/gui/widgets/status-bar/AlarmClock.cpp b/module-gui/gui/widgets/status-bar/AlarmClock.cpp new file mode 100644 index 0000000000000000000000000000000000000000..159de563a2e18f62275bcc0c5b4080c9c1463c66 --- /dev/null +++ b/module-gui/gui/widgets/status-bar/AlarmClock.cpp @@ -0,0 +1,20 @@ +// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md + +#include "AlarmClock.hpp" +#include "Style.hpp" + +namespace gui::status_bar +{ + constexpr auto alarm_status = "alarmclock_status"; + + AlarmClock::AlarmClock(Item *parent, uint32_t x, uint32_t y) : StatusBarWidgetBase(parent, x, y, 0, 0) + { + set(alarm_status, style::status_bar::imageTypeSpecifier); + } + + void AlarmClock::setAlarmClockStatus(bool status) + { + setVisible(status); + } +}; // namespace gui::status_bar diff --git a/module-gui/gui/widgets/status-bar/AlarmClock.hpp b/module-gui/gui/widgets/status-bar/AlarmClock.hpp new file mode 100644 index 0000000000000000000000000000000000000000..07fe9a20618ba545d616df83543d51c11f1f8573 --- /dev/null +++ b/module-gui/gui/widgets/status-bar/AlarmClock.hpp @@ -0,0 +1,18 @@ +// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md + +#pragma once + +#include "Image.hpp" +#include "StatusBarWidgetBase.hpp" + +namespace gui::status_bar +{ + class AlarmClock : public StatusBarWidgetBase + { + public: + AlarmClock(Item *parent, uint32_t x, uint32_t y); + + void setAlarmClockStatus(bool status); + }; +} // namespace gui::status_bar diff --git a/module-services/service-appmgr/include/service-appmgr/Actions.hpp b/module-services/service-appmgr/include/service-appmgr/Actions.hpp index d093819be084ca127835fe39409b71b0e2d40542..bacd2dbfb1cf958d96bbc0c8c40245faea67bfac 100644 --- a/module-services/service-appmgr/include/service-appmgr/Actions.hpp +++ b/module-services/service-appmgr/include/service-appmgr/Actions.hpp @@ -55,6 +55,7 @@ namespace app::manager CallRejectedByOfflineNotification, PhoneModeChanged, BluetoothModeChanged, + AlarmClockStatusChanged, NotificationsChanged, ShowPopup, AbortPopup, diff --git a/module-services/service-appmgr/include/service-appmgr/model/ApplicationHandle.hpp b/module-services/service-appmgr/include/service-appmgr/model/ApplicationHandle.hpp index 18bd1a0f183a060d94012b6807becc149bec9ac4..49fee28520a3cb369dc36d51a2fa022a4c184ca5 100644 --- a/module-services/service-appmgr/include/service-appmgr/model/ApplicationHandle.hpp +++ b/module-services/service-appmgr/include/service-appmgr/model/ApplicationHandle.hpp @@ -23,12 +23,8 @@ namespace app::manager explicit ApplicationHandle(std::unique_ptr &&_launcher); void setState(State state) noexcept; - void run(sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, - sys::Service *caller); - void runInBackground(sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, - sys::Service *caller); + void run(StatusIndicators statusIndicators, sys::Service *caller); + void runInBackground(StatusIndicators statusIndicators, sys::Service *caller); void close() noexcept; auto valid() const noexcept -> bool; diff --git a/module-services/service-appmgr/model/ApplicationHandle.cpp b/module-services/service-appmgr/model/ApplicationHandle.cpp index a40d8f3a621b324cafd0e676212f7733c35e0de6..de93c8ea00de73f1f01a36befbb7f9b476c0326e 100644 --- a/module-services/service-appmgr/model/ApplicationHandle.cpp +++ b/module-services/service-appmgr/model/ApplicationHandle.cpp @@ -71,18 +71,14 @@ namespace app::manager return manifest.getActionFlag(action); } - void ApplicationHandle::run(sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, - sys::Service *caller) + void ApplicationHandle::run(StatusIndicators statusIndicators, sys::Service *caller) { - launcher->run(phoneMode, bluetoothMode, caller); + launcher->run(statusIndicators, caller); } - void ApplicationHandle::runInBackground(sys::phone_modes::PhoneMode phoneMode, - sys::bluetooth::BluetoothMode bluetoothMode, - sys::Service *caller) + void ApplicationHandle::runInBackground(StatusIndicators statusIndicators, sys::Service *caller) { - launcher->runBackground(phoneMode, bluetoothMode, caller); + launcher->runBackground(statusIndicators, caller); } void ApplicationHandle::close() noexcept diff --git a/module-services/service-time/AlarmMessageHandler.cpp b/module-services/service-time/AlarmMessageHandler.cpp index 85254dd66a72e2a448b2d0055fe5fbeae67ca128..b4ab13f31a3c9c072ceb23377e1bfadb31af0fdc 100644 --- a/module-services/service-time/AlarmMessageHandler.cpp +++ b/module-services/service-time/AlarmMessageHandler.cpp @@ -111,6 +111,12 @@ namespace alarms alarmOperations->addSnoozedAlarmsCountChangeCallback(callback); } + auto AlarmMessageHandler::handleAddActiveAlarmCountChangeCallback( + AlarmOperationsCommon::OnActiveAlarmCountChange callback) -> void + { + alarmOperations->addActiveAlarmCountChangeCallback(callback); + } + template auto AlarmMessageHandler::handleWithCallback( RequestType *request, diff --git a/module-services/service-time/AlarmMessageHandler.hpp b/module-services/service-time/AlarmMessageHandler.hpp index 82eb2a63f30c2b869595c73f7b34981c0c09b0ea..d5b13189f231681b42f0fd6c1eef64bfee56bfb1 100644 --- a/module-services/service-time/AlarmMessageHandler.hpp +++ b/module-services/service-time/AlarmMessageHandler.hpp @@ -37,6 +37,7 @@ namespace alarms auto handleStopAllSnoozedAlarms() -> void; auto handleAddSnoozedAlarmCountChangeCallback(AlarmOperationsCommon::OnSnoozedAlarmsCountChange callback) -> void; + auto handleAddActiveAlarmCountChangeCallback(AlarmOperationsCommon::OnActiveAlarmCountChange callback) -> void; private: stm::ServiceTime *service = nullptr; diff --git a/module-services/service-time/AlarmOperations.cpp b/module-services/service-time/AlarmOperations.cpp index 3c8d5e4760a592a4546e5ff6a5f6ee8e0f0fc6bc..11abfdbc911b5312e6adeea290a4ba1e2d135826 100644 --- a/module-services/service-time/AlarmOperations.cpp +++ b/module-services/service-time/AlarmOperations.cpp @@ -30,6 +30,7 @@ namespace alarms for (auto &ev : singleEvents) { nextSingleEvents.emplace_back(std::make_unique(ev)); } + handleActiveAlarmsCountChange(); }; getNextSingleEvents(now, callback); } @@ -158,6 +159,7 @@ namespace alarms ongoingSingleEvents.erase(found); handleSnoozedAlarmsCountChange(); + handleActiveAlarmsCountChange(); callback(true); } @@ -243,6 +245,7 @@ namespace alarms if (!isHandlingInProgress && !ongoingSingleEvents.empty()) { switchAlarmExecution(*(ongoingSingleEvents.front()), true); } + handleActiveAlarmsCountChange(); } void AlarmOperationsCommon::addAlarmExecutionHandler(const alarms::AlarmType type, @@ -311,6 +314,7 @@ namespace alarms { snoozedSingleEvents.clear(); handleSnoozedAlarmsCountChange(); + handleActiveAlarmsCountChange(); } auto AlarmOperationsCommon::addSnoozedAlarmsCountChangeCallback(OnSnoozedAlarmsCountChange callback) -> void @@ -318,6 +322,11 @@ namespace alarms onSnoozedAlarmsCountChangeCallback = callback; } + auto AlarmOperationsCommon::addActiveAlarmCountChangeCallback(OnActiveAlarmCountChange callback) -> void + { + onActiveAlarmCountChangeCallback = callback; + } + TimePoint AlarmOperationsCommon::getCurrentTime() { if (!getCurrentTimeCallback) { @@ -333,4 +342,12 @@ namespace alarms } } + void AlarmOperationsCommon::handleActiveAlarmsCountChange() + { + if (onActiveAlarmCountChangeCallback) { + onActiveAlarmCountChangeCallback(!nextSingleEvents.empty() || !snoozedSingleEvents.empty() || + !ongoingSingleEvents.empty()); + } + } + } // namespace alarms diff --git a/module-services/service-time/AlarmOperations.hpp b/module-services/service-time/AlarmOperations.hpp index e055b9b159d38c12a15b7cfad57a949fac6ae824..78b9290968084ab8c70d8653c7b13023fe9310ea 100644 --- a/module-services/service-time/AlarmOperations.hpp +++ b/module-services/service-time/AlarmOperations.hpp @@ -26,6 +26,7 @@ namespace alarms using OnSnoozeRingingAlarm = std::function; using OnTurnOffRingingAlarm = std::function; using OnSnoozedAlarmsCountChange = std::function; + using OnActiveAlarmCountChange = std::function; virtual ~IAlarmOperations() noexcept = default; @@ -52,6 +53,7 @@ namespace alarms const std::shared_ptr handler) = 0; virtual void stopAllSnoozedAlarms() = 0; virtual void addSnoozedAlarmsCountChangeCallback(OnSnoozedAlarmsCountChange) = 0; + virtual void addActiveAlarmCountChangeCallback(OnActiveAlarmCountChange) = 0; }; class IAlarmOperationsFactory @@ -92,6 +94,7 @@ namespace alarms const std::shared_ptr handler) override; void stopAllSnoozedAlarms() override; void addSnoozedAlarmsCountChangeCallback(OnSnoozedAlarmsCountChange callback) override; + void addActiveAlarmCountChangeCallback(OnActiveAlarmCountChange callback) override; protected: std::unique_ptr alarmEventsRepo; @@ -110,6 +113,7 @@ namespace alarms private: GetCurrentTime getCurrentTimeCallback; OnSnoozedAlarmsCountChange onSnoozedAlarmsCountChangeCallback = nullptr; + OnActiveAlarmCountChange onActiveAlarmCountChangeCallback = nullptr; // Max 100 alarms for one minute seems reasonable, next events will be dropped constexpr static auto getNextSingleEventsOffset = 0; @@ -133,6 +137,7 @@ namespace alarms TimePoint getCurrentTime(); void handleSnoozedAlarmsCountChange(); + void handleActiveAlarmsCountChange(); }; class CommonAlarmOperationsFactory : public IAlarmOperationsFactory diff --git a/module-services/service-time/AlarmServiceAPI.cpp b/module-services/service-time/AlarmServiceAPI.cpp index 01ebf94c4db26b46552c9c493fa71b502ccce72b..a2bc10f2c47718a838a1d2f3569337ed4e073760 100644 --- a/module-services/service-time/AlarmServiceAPI.cpp +++ b/module-services/service-time/AlarmServiceAPI.cpp @@ -69,6 +69,11 @@ namespace alarms { return sendRequest(serv); } + + bool requestRegisterActiveAlarmsIndicatorHandler(sys::Service *serv) + { + return sendRequest(serv); + } }; // namespace AlarmServiceAPI } // namespace alarms diff --git a/module-services/service-time/ServiceTime.cpp b/module-services/service-time/ServiceTime.cpp index d32c01e7bab09c52228f73b7e081704468eea37f..70f52f78f31a2544a9d28d9df501898ebcc87da7 100644 --- a/module-services/service-time/ServiceTime.cpp +++ b/module-services/service-time/ServiceTime.cpp @@ -172,6 +172,15 @@ namespace stm }); return std::make_shared(); }); + connect(typeid(alarms::RegisterActiveAlarmsIndicatorHandlerRequestMessage), + [&](sys::Message *request) -> sys::MessagePointer { + auto senderName = request->sender; + alarmMessageHandler->handleAddActiveAlarmCountChangeCallback( + [this, senderName](bool isAnyAlarmActive) { + bus.sendUnicast(std::make_shared(isAnyAlarmActive), senderName); + }); + return std::make_shared(); + }); } auto ServiceTime::handleSetAutomaticDateAndTimeRequest(sys::Message *request) diff --git a/module-services/service-time/include/service-time/AlarmMessage.hpp b/module-services/service-time/include/service-time/AlarmMessage.hpp index 646fb21d13e8b98c85473aa1c027146aac07dc49..7e47bb23011424c8120daddee142a93c8adc02cd 100644 --- a/module-services/service-time/include/service-time/AlarmMessage.hpp +++ b/module-services/service-time/include/service-time/AlarmMessage.hpp @@ -175,4 +175,26 @@ namespace alarms unsigned snoozedCount = 0; }; + /// Message to register service (sender) awaiting for ActiveAlarmMessage + class RegisterActiveAlarmsIndicatorHandlerRequestMessage : public AlarmMessage + { + public: + explicit RegisterActiveAlarmsIndicatorHandlerRequestMessage(){}; + }; + + /// Message to indicate if any alarm is currently actively waiting for execution + class ActiveAlarmMessage : public AlarmMessage + { + public: + explicit ActiveAlarmMessage(bool anyAlarmActive) : anyAlarmActive{anyAlarmActive} {}; + + [[nodiscard]] bool isAnyAlarmActive() const noexcept + { + return anyAlarmActive; + } + + private: + bool anyAlarmActive = 0; + }; + } // namespace alarms diff --git a/module-services/service-time/include/service-time/AlarmServiceAPI.hpp b/module-services/service-time/include/service-time/AlarmServiceAPI.hpp index fd0611600b55941c91cf7c04a1e8ffb8e36a72b7..2388530daa193148751ed5f18f1b2fc0b75335b0 100644 --- a/module-services/service-time/include/service-time/AlarmServiceAPI.hpp +++ b/module-services/service-time/include/service-time/AlarmServiceAPI.hpp @@ -31,6 +31,7 @@ namespace alarms bool requestSnoozeRingingAlarm(sys::Service *serv, const std::uint32_t id, const TimePoint nextAlarmTime); bool requestStopAllSnoozedAlarms(sys::Service *serv); bool requestRegisterSnoozedAlarmsCountChangeCallback(sys::Service *serv); + bool requestRegisterActiveAlarmsIndicatorHandler(sys::Service *serv); }; // namespace AlarmServiceAPI } // namespace alarms diff --git a/products/BellHybrid/apps/application-bell-alarm/ApplicationBellAlarm.cpp b/products/BellHybrid/apps/application-bell-alarm/ApplicationBellAlarm.cpp index a03b4137d6de4ceb6e8493b96241fb8206d0dfdd..d697291c6251f1f69eb4ba0373b92393ab0e21d5 100644 --- a/products/BellHybrid/apps/application-bell-alarm/ApplicationBellAlarm.cpp +++ b/products/BellHybrid/apps/application-bell-alarm/ApplicationBellAlarm.cpp @@ -24,11 +24,10 @@ namespace app ApplicationBellAlarm::ApplicationBellAlarm(std::string name, std::string parent, - sys::phone_modes::PhoneMode mode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, StartInBackground startInBackground, uint32_t stackDepth) - : Application(std::move(name), std::move(parent), mode, bluetoothMode, startInBackground, stackDepth), + : Application(std::move(name), std::move(parent), statusIndicators, startInBackground, stackDepth), priv{std::make_unique()} {} ApplicationBellAlarm::~ApplicationBellAlarm() = default; diff --git a/products/BellHybrid/apps/application-bell-alarm/include/application-bell-alarm/ApplicationBellAlarm.hpp b/products/BellHybrid/apps/application-bell-alarm/include/application-bell-alarm/ApplicationBellAlarm.hpp index 972df0e89dbd3a319f92550b7d91d3deb8f45ce5..3eb6acdb758f0a548b079d91d88ad62d2a1305c4 100644 --- a/products/BellHybrid/apps/application-bell-alarm/include/application-bell-alarm/ApplicationBellAlarm.hpp +++ b/products/BellHybrid/apps/application-bell-alarm/include/application-bell-alarm/ApplicationBellAlarm.hpp @@ -25,13 +25,11 @@ namespace app std::unique_ptr priv; public: - explicit ApplicationBellAlarm( - std::string name = applicationBellAlarmName, - std::string parent = "", - sys::phone_modes::PhoneMode mode = sys::phone_modes::PhoneMode::Offline, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - StartInBackground startInBackground = {false}, - std::uint32_t stackDepth = 8192); + explicit ApplicationBellAlarm(std::string name = applicationBellAlarmName, + std::string parent = "", + StatusIndicators statusIndicators = StatusIndicators{}, + StartInBackground startInBackground = {false}, + std::uint32_t stackDepth = 8192); ~ApplicationBellAlarm() override; sys::ReturnCodes InitHandler() override; diff --git a/products/BellHybrid/apps/application-bell-background-sounds/ApplicationBellBackgroundSounds.cpp b/products/BellHybrid/apps/application-bell-background-sounds/ApplicationBellBackgroundSounds.cpp index 94d66ea37319481fe940157e69d502759f0bc932..5c1784e29bcf4c85434495521a4abb6c782ac47f 100644 --- a/products/BellHybrid/apps/application-bell-background-sounds/ApplicationBellBackgroundSounds.cpp +++ b/products/BellHybrid/apps/application-bell-background-sounds/ApplicationBellBackgroundSounds.cpp @@ -9,10 +9,9 @@ namespace app { ApplicationBellBackgroundSounds::ApplicationBellBackgroundSounds(std::string name, std::string parent, - sys::phone_modes::PhoneMode mode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, StartInBackground startInBackground) - : Application(std::move(name), std::move(parent), mode, bluetoothMode, startInBackground) + : Application(std::move(name), std::move(parent), statusIndicators, startInBackground) {} sys::ReturnCodes ApplicationBellBackgroundSounds::InitHandler() diff --git a/products/BellHybrid/apps/application-bell-background-sounds/include/application-bell-background-sounds/ApplicationBellBackgroundSounds.hpp b/products/BellHybrid/apps/application-bell-background-sounds/include/application-bell-background-sounds/ApplicationBellBackgroundSounds.hpp index ccb0412122086d4693965e39c7b294442a630851..c5a59eda1aa217a24792ef8963498d771f0b0c35 100644 --- a/products/BellHybrid/apps/application-bell-background-sounds/include/application-bell-background-sounds/ApplicationBellBackgroundSounds.hpp +++ b/products/BellHybrid/apps/application-bell-background-sounds/include/application-bell-background-sounds/ApplicationBellBackgroundSounds.hpp @@ -12,12 +12,10 @@ namespace app class ApplicationBellBackgroundSounds : public Application { public: - ApplicationBellBackgroundSounds( - std::string name = applicationBellBackgroundSoundsName, - std::string parent = "", - sys::phone_modes::PhoneMode mode = sys::phone_modes::PhoneMode::Offline, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - StartInBackground startInBackground = {false}); + ApplicationBellBackgroundSounds(std::string name = applicationBellBackgroundSoundsName, + std::string parent = "", + StatusIndicators statusIndicators = StatusIndicators{}, + StartInBackground startInBackground = {false}); sys::ReturnCodes InitHandler() override; diff --git a/products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp b/products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp index b68d9b8a4b5b956509ada3a8f36156269a85a79d..83c2759e2dd877d82ffaf13ce7cf32c567e8986e 100644 --- a/products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp +++ b/products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp @@ -17,11 +17,10 @@ namespace app { ApplicationBellMain::ApplicationBellMain(std::string name, std::string parent, - sys::phone_modes::PhoneMode mode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, StartInBackground startInBackground, std::uint32_t stackDepth) - : Application(name, parent, mode, bluetoothMode, startInBackground, stackDepth) + : Application(name, parent, statusIndicators, startInBackground, stackDepth) { bus.channels.push_back(sys::BusChannel::ServiceDBNotifications); addActionReceiver(manager::actions::ShowAlarm, [this](auto &&data) { diff --git a/products/BellHybrid/apps/application-bell-main/include/application-bell-main/ApplicationBellMain.hpp b/products/BellHybrid/apps/application-bell-main/include/application-bell-main/ApplicationBellMain.hpp index d8c86b2350a4824a03c3172a1d9afc07a082c842..9b79747aff688ba35b73889f73ada278a1b35f88 100644 --- a/products/BellHybrid/apps/application-bell-main/include/application-bell-main/ApplicationBellMain.hpp +++ b/products/BellHybrid/apps/application-bell-main/include/application-bell-main/ApplicationBellMain.hpp @@ -19,13 +19,11 @@ namespace app class ApplicationBellMain : public Application { public: - explicit ApplicationBellMain( - std::string name = applicationBellName, - std::string parent = "", - sys::phone_modes::PhoneMode mode = sys::phone_modes::PhoneMode::Offline, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - StartInBackground startInBackground = {false}, - std::uint32_t stackDepth = 8192); + explicit ApplicationBellMain(std::string name = applicationBellName, + std::string parent = "", + StatusIndicators statusIndicators = StatusIndicators{}, + StartInBackground startInBackground = {false}, + std::uint32_t stackDepth = 8192); sys::ReturnCodes InitHandler() override; diff --git a/products/BellHybrid/apps/application-bell-onboarding/ApplicationBellOnBoarding.cpp b/products/BellHybrid/apps/application-bell-onboarding/ApplicationBellOnBoarding.cpp index a0b9ca7edee610336aa54e74f57e09496a7539b8..5f46c466deb2f8f0f191704732d51a0aabef73c6 100644 --- a/products/BellHybrid/apps/application-bell-onboarding/ApplicationBellOnBoarding.cpp +++ b/products/BellHybrid/apps/application-bell-onboarding/ApplicationBellOnBoarding.cpp @@ -22,10 +22,9 @@ namespace app { ApplicationBellOnBoarding::ApplicationBellOnBoarding(std::string name, std::string parent, - sys::phone_modes::PhoneMode mode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, StartInBackground startInBackground) - : Application(std::move(name), std::move(parent), mode, bluetoothMode, startInBackground) + : Application(std::move(name), std::move(parent), statusIndicators, startInBackground) {} sys::ReturnCodes ApplicationBellOnBoarding::InitHandler() diff --git a/products/BellHybrid/apps/application-bell-onboarding/include/application-bell-onboarding/ApplicationBellOnBoarding.hpp b/products/BellHybrid/apps/application-bell-onboarding/include/application-bell-onboarding/ApplicationBellOnBoarding.hpp index 47ccbbf01578170c3665ad3309518942a7baca01..7b01ac5ed6c4a5c8559a20d431b3788e1499655a 100644 --- a/products/BellHybrid/apps/application-bell-onboarding/include/application-bell-onboarding/ApplicationBellOnBoarding.hpp +++ b/products/BellHybrid/apps/application-bell-onboarding/include/application-bell-onboarding/ApplicationBellOnBoarding.hpp @@ -11,11 +11,10 @@ namespace app class ApplicationBellOnBoarding : public Application { public: - ApplicationBellOnBoarding(std::string name = applicationBellOnBoardingName, - std::string parent = "", - sys::phone_modes::PhoneMode mode = sys::phone_modes::PhoneMode::Offline, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - StartInBackground startInBackground = {false}); + ApplicationBellOnBoarding(std::string name = applicationBellOnBoardingName, + std::string parent = "", + StatusIndicators statusIndicators = StatusIndicators{}, + StartInBackground startInBackground = {false}); sys::ReturnCodes InitHandler() override; sys::MessagePointer DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) override; diff --git a/products/BellHybrid/apps/application-bell-powernap/ApplicationBellPowerNap.cpp b/products/BellHybrid/apps/application-bell-powernap/ApplicationBellPowerNap.cpp index 30c15eb982d6410d01fc35e7a808cb5c726b689c..02762a280ea5b5ecae2cd04ce1ced0bc0a6450c9 100644 --- a/products/BellHybrid/apps/application-bell-powernap/ApplicationBellPowerNap.cpp +++ b/products/BellHybrid/apps/application-bell-powernap/ApplicationBellPowerNap.cpp @@ -15,10 +15,9 @@ namespace app { ApplicationBellPowerNap::ApplicationBellPowerNap(std::string name, std::string parent, - sys::phone_modes::PhoneMode mode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, StartInBackground startInBackground) - : Application(std::move(name), std::move(parent), mode, bluetoothMode, startInBackground), + : Application(std::move(name), std::move(parent), statusIndicators, startInBackground), alarm{std::make_unique(this)} {} diff --git a/products/BellHybrid/apps/application-bell-powernap/include/application-bell-powernap/ApplicationBellPowerNap.hpp b/products/BellHybrid/apps/application-bell-powernap/include/application-bell-powernap/ApplicationBellPowerNap.hpp index fcc05ca4d2f049540fa3233a65cdd0c890350309..b1c6c5708d89f5b78161bc079108ba831f468fc5 100644 --- a/products/BellHybrid/apps/application-bell-powernap/include/application-bell-powernap/ApplicationBellPowerNap.hpp +++ b/products/BellHybrid/apps/application-bell-powernap/include/application-bell-powernap/ApplicationBellPowerNap.hpp @@ -24,11 +24,10 @@ namespace app std::unique_ptr alarm; public: - ApplicationBellPowerNap(std::string name = applicationBellPowerNapName, - std::string parent = "", - sys::phone_modes::PhoneMode mode = sys::phone_modes::PhoneMode::Offline, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - StartInBackground startInBackground = {false}); + ApplicationBellPowerNap(std::string name = applicationBellPowerNapName, + std::string parent = "", + StatusIndicators statusIndicators = StatusIndicators{}, + StartInBackground startInBackground = {false}); ~ApplicationBellPowerNap(); sys::ReturnCodes InitHandler() override; diff --git a/products/BellHybrid/apps/application-bell-settings/ApplicationBellSettings.cpp b/products/BellHybrid/apps/application-bell-settings/ApplicationBellSettings.cpp index e58c9277edeab4d1495ac7c1253c72b7c4b52399..26e387756fe1401f33a3e0e8a579eb5296136d31 100644 --- a/products/BellHybrid/apps/application-bell-settings/ApplicationBellSettings.cpp +++ b/products/BellHybrid/apps/application-bell-settings/ApplicationBellSettings.cpp @@ -32,10 +32,9 @@ namespace app { ApplicationBellSettings::ApplicationBellSettings(std::string name, std::string parent, - sys::phone_modes::PhoneMode mode, - sys::bluetooth::BluetoothMode bluetoothMode, + StatusIndicators statusIndicators, StartInBackground startInBackground) - : Application(std::move(name), std::move(parent), mode, bluetoothMode, startInBackground) + : Application(std::move(name), std::move(parent), statusIndicators, startInBackground) {} sys::ReturnCodes ApplicationBellSettings::InitHandler() diff --git a/products/BellHybrid/apps/application-bell-settings/include/application-bell-settings/ApplicationBellSettings.hpp b/products/BellHybrid/apps/application-bell-settings/include/application-bell-settings/ApplicationBellSettings.hpp index 143b45ce21f88eda05e2d6627f78971686ce400b..ca309a7efa1006ec878fc019e17110a4fd20521e 100644 --- a/products/BellHybrid/apps/application-bell-settings/include/application-bell-settings/ApplicationBellSettings.hpp +++ b/products/BellHybrid/apps/application-bell-settings/include/application-bell-settings/ApplicationBellSettings.hpp @@ -46,11 +46,10 @@ namespace app class ApplicationBellSettings : public Application, public settingsInterface::BellScreenLightSettings { public: - ApplicationBellSettings(std::string name = applicationBellSettingsName, - std::string parent = "", - sys::phone_modes::PhoneMode mode = sys::phone_modes::PhoneMode::Offline, - sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled, - StartInBackground startInBackground = {false}); + ApplicationBellSettings(std::string name = applicationBellSettingsName, + std::string parent = "", + StatusIndicators statusIndicators = StatusIndicators{}, + StartInBackground startInBackground = {false}); sys::ReturnCodes InitHandler() override; diff --git a/products/BellHybrid/services/appmgr/ApplicationManager.cpp b/products/BellHybrid/services/appmgr/ApplicationManager.cpp index 1d6149dd9adf1666d5f542ad39e75b0cfc00fec4..bb4b48439a36a3d5ec216f8788c3c7e7964cd629 100644 --- a/products/BellHybrid/services/appmgr/ApplicationManager.cpp +++ b/products/BellHybrid/services/appmgr/ApplicationManager.cpp @@ -19,7 +19,7 @@ namespace app::manager { if (not ApplicationManagerCommon::startApplication(app)) { LOG_INFO("Starting application %s", app.name().c_str()); - app.run(sys::phone_modes::PhoneMode::Offline, sys::bluetooth::BluetoothMode::Disabled, this); + app.run(StatusIndicators{}, this); } return true; } diff --git a/products/PurePhone/services/appmgr/ApplicationManager.cpp b/products/PurePhone/services/appmgr/ApplicationManager.cpp index 0b1d4a58812487aee7ea03a6fd869a754bb8ccb1..926d9375393d7cbe0fe41e9a33684c78ced0cd03 100644 --- a/products/PurePhone/services/appmgr/ApplicationManager.cpp +++ b/products/PurePhone/services/appmgr/ApplicationManager.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -125,7 +126,11 @@ namespace app::manager { for (const auto &name : std::vector{app::special_input}) { if (auto app = getApplication(name); app != nullptr) { - app->runInBackground(phoneModeObserver->getCurrentPhoneMode(), bluetoothMode, this); + StatusIndicators statusIndicators; + statusIndicators.phoneMode = phoneModeObserver->getCurrentPhoneMode(); + statusIndicators.bluetoothMode = bluetoothMode; + statusIndicators.alarmClockStatus = alarmClockStatus; + app->runInBackground(statusIndicators, this); } } } @@ -344,6 +349,13 @@ namespace app::manager return sys::msgHandled(); }); + alarms::AlarmServiceAPI::requestRegisterActiveAlarmsIndicatorHandler(this); + connect(typeid(alarms::ActiveAlarmMessage), [&](sys::Message *request) -> sys::MessagePointer { + auto data = static_cast(request); + handleAlarmClockStatusChanged(data->isAnyAlarmActive()); + return sys::msgHandled(); + }); + auto convertibleToActionHandler = [this](sys::Message *request) { return handleMessageAsAction(request); }; connect(typeid(CellularMMIResultMessage), convertibleToActionHandler); connect(typeid(CellularMMIResponseMessage), convertibleToActionHandler); @@ -391,6 +403,24 @@ namespace app::manager actionsRegistry.enqueue(std::move(action)); } + void ApplicationManager::handleAlarmClockStatusChanged(bool status) + { + if (alarmClockStatus != status) { + alarmClockStatus = status; + for (const auto app : getStackedApplications()) { + changeAlarmClockStatus(app); + } + } + } + + void ApplicationManager::changeAlarmClockStatus(const ApplicationHandle *app) + { + ActionEntry action{actions::AlarmClockStatusChanged, + std::make_unique(alarmClockStatus)}; + action.setTargetApplication(app->name()); + actionsRegistry.enqueue(std::move(action)); + } + void ApplicationManager::handleTetheringChanged(sys::phone_modes::Tethering tethering) { notificationProvider.handle(tethering); @@ -473,7 +503,11 @@ namespace app::manager { if (not ApplicationManagerCommon::startApplication(app)) { LOG_INFO("Starting application %s", app.name().c_str()); - app.run(phoneModeObserver->getCurrentPhoneMode(), bluetoothMode, this); + StatusIndicators statusIndicators; + statusIndicators.phoneMode = phoneModeObserver->getCurrentPhoneMode(); + statusIndicators.bluetoothMode = bluetoothMode; + statusIndicators.alarmClockStatus = alarmClockStatus; + app.run(statusIndicators, this); } return true; } @@ -524,6 +558,7 @@ namespace app::manager switch (action.actionId) { case actions::BluetoothModeChanged: case actions::PhoneModeChanged: + case actions::AlarmClockStatusChanged: return handleActionOnActiveApps(action); default: return ApplicationManagerCommon::handleAction(action); diff --git a/products/PurePhone/services/appmgr/include/appmgr/ApplicationManager.hpp b/products/PurePhone/services/appmgr/include/appmgr/ApplicationManager.hpp index 799cf5c2979b95223f07201194931d60cd627a91..771e8b601c6d885e63dac5da538a42bb0cdd63cb 100644 --- a/products/PurePhone/services/appmgr/include/appmgr/ApplicationManager.hpp +++ b/products/PurePhone/services/appmgr/include/appmgr/ApplicationManager.hpp @@ -24,7 +24,9 @@ namespace app::manager void handlePhoneModeChanged(sys::phone_modes::PhoneMode phoneMode); auto handleBluetoothModeChangedAction(ActionEntry &action) -> ActionProcessStatus; void handleBluetoothModeChanged(sys::bluetooth::BluetoothMode mode); + void handleAlarmClockStatusChanged(bool status); void changeBluetoothMode(const ApplicationHandle *app); + void changeAlarmClockStatus(const ApplicationHandle *app); void handleTetheringChanged(sys::phone_modes::Tethering tethering); void handleSnoozeCountChange(unsigned snoozeCount); void processKeypadBacklightState(bsp::keypad_backlight::State keypadLightState); @@ -50,6 +52,7 @@ namespace app::manager std::shared_ptr phoneModeObserver; sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled; + bool alarmClockStatus = false; locks::PhoneLockHandler phoneLockHandler; locks::SimLockHandler simLockHandler;