M module-apps/application-alarm-clock/ApplicationAlarmClock.cpp => module-apps/application-alarm-clock/ApplicationAlarmClock.cpp +2 -3
@@ 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);
}
M module-apps/application-alarm-clock/ApplicationAlarmClock.hpp => module-apps/application-alarm-clock/ApplicationAlarmClock.hpp +7 -6
@@ 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
M module-apps/application-alarm-clock/models/NewEditAlarmModel.cpp => module-apps/application-alarm-clock/models/NewEditAlarmModel.cpp +1 -0
@@ 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();
M module-apps/application-alarm-clock/widgets/AlarmItem.cpp => module-apps/application-alarm-clock/widgets/AlarmItem.cpp +1 -1
@@ 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());
M module-apps/application-alarm-clock/widgets/AlarmTimeItem.cpp => module-apps/application-alarm-clock/widgets/AlarmTimeItem.cpp +1 -0
@@ 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);
M module-apps/application-antenna/include/application-antenna/ApplicationAntenna.hpp => module-apps/application-antenna/include/application-antenna/ApplicationAntenna.hpp +4 -2
@@ 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 */
M module-apps/application-calculator/ApplicationCalculator.cpp => module-apps/application-calculator/ApplicationCalculator.cpp +2 -3
@@ 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)
M module-apps/application-calculator/include/application-calculator/ApplicationCalculator.hpp => module-apps/application-calculator/include/application-calculator/ApplicationCalculator.hpp +8 -8
@@ 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 */
M module-apps/application-calendar/ApplicationCalendar.cpp => module-apps/application-calendar/ApplicationCalendar.cpp +2 -3
@@ 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)
M module-apps/application-calendar/include/application-calendar/ApplicationCalendar.hpp => module-apps/application-calendar/include/application-calendar/ApplicationCalendar.hpp +8 -7
@@ 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 */
M module-apps/application-call/ApplicationCall.cpp => module-apps/application-call/ApplicationCall.cpp +2 -3
@@ 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(
M module-apps/application-call/include/application-call/ApplicationCall.hpp => module-apps/application-call/include/application-call/ApplicationCall.hpp +6 -6
@@ 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};
}
};
M module-apps/application-calllog/ApplicationCallLog.cpp => module-apps/application-calllog/ApplicationCallLog.cpp +2 -3
@@ 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) {
M module-apps/application-calllog/include/application-calllog/ApplicationCallLog.hpp => module-apps/application-calllog/include/application-calllog/ApplicationCallLog.hpp +6 -6
@@ 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 */
M module-apps/application-desktop/ApplicationDesktop.cpp => module-apps/application-desktop/ApplicationDesktop.cpp +2 -3
@@ 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;
M module-apps/application-desktop/include/application-desktop/ApplicationDesktop.hpp => module-apps/application-desktop/include/application-desktop/ApplicationDesktop.hpp +6 -7
@@ 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}};
}
};
M module-apps/application-desktop/windows/DesktopMainWindow.cpp => module-apps/application-desktop/windows/DesktopMainWindow.cpp +1 -0
@@ 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;
}
M module-apps/application-meditation/ApplicationMeditation.cpp => module-apps/application-meditation/ApplicationMeditation.cpp +2 -4
@@ 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<gui::OptionsData>()}
+ : Application{name, parent, statusIndicators, startInBackground}, state{std::make_unique<gui::OptionsData>()}
{}
auto ApplicationMeditation::InitHandler() -> sys::ReturnCodes
M module-apps/application-meditation/include/application-meditation/ApplicationMeditation.hpp => module-apps/application-meditation/include/application-meditation/ApplicationMeditation.hpp +9 -9
@@ 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
M module-apps/application-messages/ApplicationMessages.cpp => module-apps/application-messages/ApplicationMessages.cpp +3 -4
@@ 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) {
M module-apps/application-messages/include/application-messages/ApplicationMessages.hpp => module-apps/application-messages/include/application-messages/ApplicationMessages.hpp +6 -7
@@ 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 */
M module-apps/application-music-player/ApplicationMusicPlayer.cpp => module-apps/application-music-player/ApplicationMusicPlayer.cpp +3 -8
@@ 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<music_player::internal::MusicPlayerPriv>()}
{
LOG_INFO("ApplicationMusicPlayer::create");
M module-apps/application-music-player/include/application-music-player/ApplicationMusicPlayer.hpp => module-apps/application-music-player/include/application-music-player/ApplicationMusicPlayer.hpp +9 -9
@@ 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 */
M module-apps/application-notes/ApplicationNotes.cpp => module-apps/application-notes/ApplicationNotes.cpp +2 -3
@@ 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);
}
M module-apps/application-notes/include/application-notes/ApplicationNotes.hpp => module-apps/application-notes/include/application-notes/ApplicationNotes.hpp +8 -7
@@ 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
M module-apps/application-onboarding/ApplicationOnBoarding.cpp => module-apps/application-onboarding/ApplicationOnBoarding.cpp +2 -4
@@ 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(
M module-apps/application-onboarding/ApplicationOnBoarding.hpp => module-apps/application-onboarding/ApplicationOnBoarding.hpp +9 -9
@@ 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
M module-apps/application-phonebook/ApplicationPhonebook.cpp => module-apps/application-phonebook/ApplicationPhonebook.cpp +2 -4
@@ 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) {
M module-apps/application-phonebook/include/application-phonebook/ApplicationPhonebook.hpp => module-apps/application-phonebook/include/application-phonebook/ApplicationPhonebook.hpp +6 -7
@@ 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
M module-apps/application-settings/ApplicationSettings.cpp => module-apps/application-settings/ApplicationSettings.cpp +3 -5
@@ 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<SoundsPlayer>(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)
M module-apps/application-settings/include/application-settings/ApplicationSettings.hpp => module-apps/application-settings/include/application-settings/ApplicationSettings.hpp +8 -8
@@ 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 */
M module-apps/application-settings/windows/advanced/StatusBarImageTypeWindow.cpp => module-apps/application-settings/windows/advanced/StatusBarImageTypeWindow.cpp +1 -0
@@ 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 */
M module-apps/application-special-input/ApplicationSpecialInput.cpp => module-apps/application-special-input/ApplicationSpecialInput.cpp +2 -3
@@ 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));
M module-apps/application-special-input/include/application-special-input/ApplicationSpecialInput.hpp => module-apps/application-special-input/include/application-special-input/ApplicationSpecialInput.hpp +4 -5
@@ 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;
M module-apps/apps-common/ApplicationCommon.cpp => module-apps/apps-common/ApplicationCommon.cpp +17 -8
@@ 17,6 17,7 @@
#include <log.hpp> // for LOG_INFO
#include "messages/AppMessage.hpp" // for AppSwitchMe...
#include "service-appmgr/Controller.hpp" // for Controller
+#include "actions/AlarmClockStatusChangeParams.hpp"
#include <service-cellular-api>
#include <service-cellular/CellularMessage.hpp>
#include <service-evtmgr/BatteryMessages.hpp>
@@ 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<gui::KeyInputSimpleTranslation>()}, startInBackground{startInBackground},
callbackStorage{std::make_unique<CallbackStorage>()}, statusBarManager{std::make_unique<StatusBarManager>()},
- settings(std::make_unique<settings::Settings>()), phoneMode{phoneMode}, bluetoothMode(bluetoothMode),
- phoneLockSubject(this), lockPolicyHandler(this), simLockSubject(this)
+ settings(std::make_unique<settings::Settings>()), 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<gui::PhoneModeParams *>(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<gui::BluetoothModeParams *>(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<AlarmClockStatusParams *>(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<service::gui::DrawMessage>(window->buildDrawList(), mode);
M module-apps/apps-common/ApplicationCommon.hpp => module-apps/apps-common/ApplicationCommon.hpp +15 -10
@@ 119,6 119,14 @@ namespace app
return ManifestTraits<T>::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::Settings> settings;
- sys::phone_modes::PhoneMode phoneMode;
- sys::bluetooth::BluetoothMode bluetoothMode;
+ StatusIndicators statusIndicators;
locks::PhoneLockSubject phoneLockSubject;
locks::LockPolicyHandler lockPolicyHandler;
M module-apps/apps-common/ApplicationLauncher.hpp => module-apps/apps-common/ApplicationLauncher.hpp +6 -14
@@ 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<T>(name, parent, phoneMode, bluetoothMode);
+ handle = std::make_shared<T>(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<T>(name, parent, phoneMode, bluetoothMode, true);
+ handle = std::make_shared<T>(name, parent, statusIndicators, true);
setAutoLockPolicy();
return sys::SystemManagerCommon::RunApplication(handle, caller);
}
A module-apps/apps-common/actions/AlarmClockStatusChangeParams.hpp => module-apps/apps-common/actions/AlarmClockStatusChangeParams.hpp +24 -0
@@ 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 <service-appmgr/Actions.hpp>
+
+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
M module-apps/apps-common/locks/windows/LockInputWindow.cpp => module-apps/apps-common/locks/windows/LockInputWindow.cpp +1 -0
@@ 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;
}
M => +1 -0
@@ 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);
M => +1 -0
@@ 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;
}
M => +1 -0
@@ 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;
}
M => +1 -0
@@ 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;
}
M => +1 -0
@@ 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;
}
M => +1 -0
@@ 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;
}
M module-apps/apps-common/windows/AppWindow.cpp => module-apps/apps-common/windows/AppWindow.cpp +8 -0
@@ 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) {
M module-apps/apps-common/windows/AppWindow.hpp => module-apps/apps-common/windows/AppWindow.hpp +1 -0
@@ 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();
M module-gui/gui/widgets/CMakeLists.txt => module-gui/gui/widgets/CMakeLists.txt +1 -0
@@ 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"
M module-gui/gui/widgets/StatusBar.cpp => module-gui/gui/widgets/StatusBar.cpp +42 -0
@@ 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) {
M module-gui/gui/widgets/StatusBar.hpp => module-gui/gui/widgets/StatusBar.hpp +35 -9
@@ 7,6 7,7 @@
#include <PhoneModes/Common.hpp>
#include <service-bluetooth/Constants.hpp>
+#include "status-bar/AlarmClock.hpp"
#include <vector>
#include <map>
@@ 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<Indicator>;
@@ 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;
A module-gui/gui/widgets/status-bar/AlarmClock.cpp => module-gui/gui/widgets/status-bar/AlarmClock.cpp +20 -0
@@ 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
A module-gui/gui/widgets/status-bar/AlarmClock.hpp => module-gui/gui/widgets/status-bar/AlarmClock.hpp +18 -0
@@ 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<Image>
+ {
+ public:
+ AlarmClock(Item *parent, uint32_t x, uint32_t y);
+
+ void setAlarmClockStatus(bool status);
+ };
+} // namespace gui::status_bar
M module-services/service-appmgr/include/service-appmgr/Actions.hpp => module-services/service-appmgr/include/service-appmgr/Actions.hpp +1 -0
@@ 55,6 55,7 @@ namespace app::manager
CallRejectedByOfflineNotification,
PhoneModeChanged,
BluetoothModeChanged,
+ AlarmClockStatusChanged,
NotificationsChanged,
ShowPopup,
AbortPopup,
M module-services/service-appmgr/include/service-appmgr/model/ApplicationHandle.hpp => module-services/service-appmgr/include/service-appmgr/model/ApplicationHandle.hpp +2 -6
@@ 23,12 23,8 @@ namespace app::manager
explicit ApplicationHandle(std::unique_ptr<app::ApplicationLauncher> &&_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;
M module-services/service-appmgr/model/ApplicationHandle.cpp => module-services/service-appmgr/model/ApplicationHandle.cpp +4 -8
@@ 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
M module-services/service-time/AlarmMessageHandler.cpp => module-services/service-time/AlarmMessageHandler.cpp +6 -0
@@ 111,6 111,12 @@ namespace alarms
alarmOperations->addSnoozedAlarmsCountChangeCallback(callback);
}
+ auto AlarmMessageHandler::handleAddActiveAlarmCountChangeCallback(
+ AlarmOperationsCommon::OnActiveAlarmCountChange callback) -> void
+ {
+ alarmOperations->addActiveAlarmCountChangeCallback(callback);
+ }
+
template <class RequestType, class ResponseType, class CallbackParamType>
auto AlarmMessageHandler::handleWithCallback(
RequestType *request,
M module-services/service-time/AlarmMessageHandler.hpp => module-services/service-time/AlarmMessageHandler.hpp +1 -0
@@ 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;
M module-services/service-time/AlarmOperations.cpp => module-services/service-time/AlarmOperations.cpp +17 -0
@@ 30,6 30,7 @@ namespace alarms
for (auto &ev : singleEvents) {
nextSingleEvents.emplace_back(std::make_unique<SingleEventRecord>(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
M module-services/service-time/AlarmOperations.hpp => module-services/service-time/AlarmOperations.hpp +5 -0
@@ 26,6 26,7 @@ namespace alarms
using OnSnoozeRingingAlarm = std::function<void(bool)>;
using OnTurnOffRingingAlarm = std::function<void(bool)>;
using OnSnoozedAlarmsCountChange = std::function<void(unsigned)>;
+ using OnActiveAlarmCountChange = std::function<void(bool)>;
virtual ~IAlarmOperations() noexcept = default;
@@ 52,6 53,7 @@ namespace alarms
const std::shared_ptr<alarms::AlarmHandler> 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<alarms::AlarmHandler> handler) override;
void stopAllSnoozedAlarms() override;
void addSnoozedAlarmsCountChangeCallback(OnSnoozedAlarmsCountChange callback) override;
+ void addActiveAlarmCountChangeCallback(OnActiveAlarmCountChange callback) override;
protected:
std::unique_ptr<AbstractAlarmEventsRepository> 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
M module-services/service-time/AlarmServiceAPI.cpp => module-services/service-time/AlarmServiceAPI.cpp +5 -0
@@ 69,6 69,11 @@ namespace alarms
{
return sendRequest<RegisterSnoozedAlarmsCountChangeHandlerRequestMessage>(serv);
}
+
+ bool requestRegisterActiveAlarmsIndicatorHandler(sys::Service *serv)
+ {
+ return sendRequest<RegisterActiveAlarmsIndicatorHandlerRequestMessage>(serv);
+ }
}; // namespace AlarmServiceAPI
} // namespace alarms
M module-services/service-time/ServiceTime.cpp => module-services/service-time/ServiceTime.cpp +9 -0
@@ 172,6 172,15 @@ namespace stm
});
return std::make_shared<sys::ResponseMessage>();
});
+ connect(typeid(alarms::RegisterActiveAlarmsIndicatorHandlerRequestMessage),
+ [&](sys::Message *request) -> sys::MessagePointer {
+ auto senderName = request->sender;
+ alarmMessageHandler->handleAddActiveAlarmCountChangeCallback(
+ [this, senderName](bool isAnyAlarmActive) {
+ bus.sendUnicast(std::make_shared<alarms::ActiveAlarmMessage>(isAnyAlarmActive), senderName);
+ });
+ return std::make_shared<sys::ResponseMessage>();
+ });
}
auto ServiceTime::handleSetAutomaticDateAndTimeRequest(sys::Message *request)
M module-services/service-time/include/service-time/AlarmMessage.hpp => module-services/service-time/include/service-time/AlarmMessage.hpp +22 -0
@@ 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
M module-services/service-time/include/service-time/AlarmServiceAPI.hpp => module-services/service-time/include/service-time/AlarmServiceAPI.hpp +1 -0
@@ 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
M products/BellHybrid/apps/application-bell-alarm/ApplicationBellAlarm.cpp => products/BellHybrid/apps/application-bell-alarm/ApplicationBellAlarm.cpp +2 -3
@@ 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<app::internal::BellAlarmPriv>()}
{}
ApplicationBellAlarm::~ApplicationBellAlarm() = default;
M products/BellHybrid/apps/application-bell-alarm/include/application-bell-alarm/ApplicationBellAlarm.hpp => products/BellHybrid/apps/application-bell-alarm/include/application-bell-alarm/ApplicationBellAlarm.hpp +5 -7
@@ 25,13 25,11 @@ namespace app
std::unique_ptr<internal::BellAlarmPriv> 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;
M products/BellHybrid/apps/application-bell-background-sounds/ApplicationBellBackgroundSounds.cpp => products/BellHybrid/apps/application-bell-background-sounds/ApplicationBellBackgroundSounds.cpp +2 -3
@@ 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()
M products/BellHybrid/apps/application-bell-background-sounds/include/application-bell-background-sounds/ApplicationBellBackgroundSounds.hpp => products/BellHybrid/apps/application-bell-background-sounds/include/application-bell-background-sounds/ApplicationBellBackgroundSounds.hpp +4 -6
@@ 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;
M products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp => products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp +2 -3
@@ 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) {
M products/BellHybrid/apps/application-bell-main/include/application-bell-main/ApplicationBellMain.hpp => products/BellHybrid/apps/application-bell-main/include/application-bell-main/ApplicationBellMain.hpp +5 -7
@@ 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;
M products/BellHybrid/apps/application-bell-onboarding/ApplicationBellOnBoarding.cpp => products/BellHybrid/apps/application-bell-onboarding/ApplicationBellOnBoarding.cpp +2 -3
@@ 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()
M products/BellHybrid/apps/application-bell-onboarding/include/application-bell-onboarding/ApplicationBellOnBoarding.hpp => products/BellHybrid/apps/application-bell-onboarding/include/application-bell-onboarding/ApplicationBellOnBoarding.hpp +4 -5
@@ 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;
M products/BellHybrid/apps/application-bell-powernap/ApplicationBellPowerNap.cpp => products/BellHybrid/apps/application-bell-powernap/ApplicationBellPowerNap.cpp +2 -3
@@ 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<powernap::PowerNapAlarmImpl>(this)}
{}
M products/BellHybrid/apps/application-bell-powernap/include/application-bell-powernap/ApplicationBellPowerNap.hpp => products/BellHybrid/apps/application-bell-powernap/include/application-bell-powernap/ApplicationBellPowerNap.hpp +4 -5
@@ 24,11 24,10 @@ namespace app
std::unique_ptr<powernap::PowerNapAlarmImpl> 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;
M products/BellHybrid/apps/application-bell-settings/ApplicationBellSettings.cpp => products/BellHybrid/apps/application-bell-settings/ApplicationBellSettings.cpp +2 -3
@@ 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()
M products/BellHybrid/apps/application-bell-settings/include/application-bell-settings/ApplicationBellSettings.hpp => products/BellHybrid/apps/application-bell-settings/include/application-bell-settings/ApplicationBellSettings.hpp +4 -5
@@ 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;
M products/BellHybrid/services/appmgr/ApplicationManager.cpp => products/BellHybrid/services/appmgr/ApplicationManager.cpp +1 -1
@@ 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;
}
M products/PurePhone/services/appmgr/ApplicationManager.cpp => products/PurePhone/services/appmgr/ApplicationManager.cpp +37 -2
@@ 9,6 9,7 @@
#include <application-special-input/ApplicationSpecialInput.hpp>
#include <apps-common/popups/data/PhoneModeParams.hpp>
#include <apps-common/popups/data/PopupRequestParams.hpp>
+#include <apps-common/actions/AlarmClockStatusChangeParams.hpp>
#include <module-db/queries/notifications/QueryNotificationsGetAll.hpp>
#include <SystemManager/messages/TetheringQuestionRequest.hpp>
#include <Timers/TimerFactory.hpp>
@@ 125,7 126,11 @@ namespace app::manager
{
for (const auto &name : std::vector<ApplicationName>{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<alarms::ActiveAlarmMessage *>(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<app::AlarmClockStatusParams>(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);
M products/PurePhone/services/appmgr/include/appmgr/ApplicationManager.hpp => products/PurePhone/services/appmgr/include/appmgr/ApplicationManager.hpp +3 -0
@@ 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<sys::phone_modes::Observer> phoneModeObserver;
sys::bluetooth::BluetoothMode bluetoothMode = sys::bluetooth::BluetoothMode::Disabled;
+ bool alarmClockStatus = false;
locks::PhoneLockHandler phoneLockHandler;
locks::SimLockHandler simLockHandler;