D .idea/PurePhone.iml => .idea/PurePhone.iml +0 -2
@@ 1,2 0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module classpath="CMake" type="CPP_MODULE" version="4" />>
\ No newline at end of file
M => +2 -0
@@ 34,6 34,8 @@ namespace gui::popup
return gui::popup::window::sim_not_ready_window;
case ID::AlarmActivated:
return gui::popup::window::alarm_activated_window;
case ID::AlarmDeactivated:
return gui::popup::window::alarm_deactivated_window;
}
return {};
M => +3 -1
@@ 23,7 23,8 @@ namespace gui
SimLock,
SimInfo,
SimNotReady,
AlarmActivated
AlarmActivated,
AlarmDeactivated
};
namespace window
@@ 43,6 44,7 @@ namespace gui
inline constexpr auto sim_info_window = "SimInfoPopup";
inline constexpr auto sim_not_ready_window = "SimNotReadyPopup";
inline constexpr auto alarm_activated_window = "AlarmActivatedPopup";
inline constexpr auto alarm_deactivated_window = "AlarmDeactivatedPopup";
} // namespace window
std::string resolveWindowName(ID id);
M module-sys/Service/Common.hpp => module-sys/Service/Common.hpp +0 -3
@@ 24,7 24,6 @@ namespace sys
ServiceEvtmgrNotifications,
PhoneModeChanges,
PhoneLockChanges,
- AlarmChanges,
BluetoothModeChanges,
BluetoothNotifications
};
@@ 129,8 128,6 @@ inline const char *c_str(sys::BusChannel channel)
return "BluetoothNotifications";
case sys::BusChannel::PhoneLockChanges:
return "PhoneLockChanges";
- case sys::BusChannel::AlarmChanges:
- return "AlarmChanges";
}
return "";
}
M products/BellHybrid/alarms/CMakeLists.txt => products/BellHybrid/alarms/CMakeLists.txt +2 -1
@@ 14,7 14,8 @@ target_sources(alarms
src/actions/FrontlightAction.hpp
src/actions/NotifyGUIAction.hpp
PUBLIC
- include/popups/AlarmPopupRequestParams.hpp
+ include/popups/AlarmActivatedPopupRequestParams.hpp
+ include/popups/AlarmDeactivatedPopupRequestParams.hpp
)
target_include_directories(alarms
R => +2 -2
@@ 7,10 7,10 @@
namespace gui
{
class AlarmPopupRequestParams : public PopupRequestParams
class AlarmActivatedPopupRequestParams : public PopupRequestParams
{
public:
AlarmPopupRequestParams() : PopupRequestParams{gui::popup::ID::AlarmActivated}
AlarmActivatedPopupRequestParams() : PopupRequestParams{gui::popup::ID::AlarmActivated}
{}
};
} // namespace gui
A => +16 -0
@@ 0,0 1,16 @@
// 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 <apps-common/popups/data/PopupRequestParams.hpp>
namespace gui
{
class AlarmDeactivatedPopupRequestParams : public PopupRequestParams
{
public:
AlarmDeactivatedPopupRequestParams() : PopupRequestParams{gui::popup::ID::AlarmDeactivated}
{}
};
} // namespace gui
M products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp => products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp +1 -1
@@ 83,7 83,7 @@ namespace app
void ApplicationBellMain::showPopup(gui::popup::ID id, const gui::PopupRequestParams *params)
{
- if (id == gui::popup::ID::AlarmActivated) {
+ if (id == gui::popup::ID::AlarmActivated || id == gui::popup::ID::AlarmDeactivated) {
if (not isHomeScreenFocused()) {
switchWindow(gui::popup::resolveWindowName(id));
}
M products/BellHybrid/services/appmgr/ApplicationManager.cpp => products/BellHybrid/services/appmgr/ApplicationManager.cpp +2 -2
@@ 3,7 3,7 @@
#include <appmgr/ApplicationManager.hpp>
-#include <evtmgr/messages/AlarmMessage.hpp>
+#include <appmgr/messages/AlarmMessage.hpp>
namespace app::manager
{
@@ 12,7 12,6 @@ namespace app::manager
const ApplicationName &_rootApplicationName)
: ApplicationManagerCommon(serviceName, std::move(launchers), _rootApplicationName)
{
- bus.channels.push_back(sys::BusChannel::AlarmChanges);
registerMessageHandlers();
}
@@ 35,5 34,6 @@ namespace app::manager
auto convertibleToActionHandler = [this](sys::Message *request) { return handleMessageAsAction(request); };
connect(typeid(AlarmActivated), convertibleToActionHandler);
+ connect(typeid(AlarmDeactivated), convertibleToActionHandler);
}
} // namespace app::manager
M products/BellHybrid/services/appmgr/CMakeLists.txt => products/BellHybrid/services/appmgr/CMakeLists.txt +3 -2
@@ 4,6 4,7 @@ target_sources(appmgr
PRIVATE
ApplicationManager.cpp
PUBLIC
+ include/appmgr/messages/AlarmMessage.hpp
include/appmgr/ApplicationManager.hpp
)
@@ 14,8 15,8 @@ target_include_directories(appmgr
target_link_libraries(appmgr
PRIVATE
- alarms
- evtmgr
module-apps
service-appmgr
+ PUBLIC
+ alarms
)
R products/BellHybrid/services/evtmgr/include/evtmgr/messages/AlarmMessage.hpp => products/BellHybrid/services/appmgr/include/appmgr/messages/AlarmMessage.hpp +16 -2
@@ 4,7 4,8 @@
#pragma once
#include <module-sys/Service/Message.hpp>
-#include <popups/AlarmPopupRequestParams.hpp>
+#include <popups/AlarmActivatedPopupRequestParams.hpp>
+#include <popups/AlarmDeactivatedPopupRequestParams.hpp>
#include <service-appmgr/Actions.hpp>
#include <service-appmgr/messages/ActionRequest.hpp>
@@ 17,6 18,19 @@ class AlarmActivated : public sys::DataMessage, public app::manager::actions::Co
[[nodiscard]] auto toAction() const -> std::unique_ptr<app::manager::ActionRequest> override
{
return std::make_unique<app::manager::ActionRequest>(
- sender, app::manager::actions::ShowPopup, std::make_unique<gui::AlarmPopupRequestParams>());
+ sender, app::manager::actions::ShowPopup, std::make_unique<gui::AlarmActivatedPopupRequestParams>());
+ }
+};
+
+class AlarmDeactivated : public sys::DataMessage, public app::manager::actions::ConvertibleToAction
+{
+ public:
+ AlarmDeactivated() : sys::DataMessage{MessageType::MessageTypeUninitialized}
+ {}
+
+ [[nodiscard]] auto toAction() const -> std::unique_ptr<app::manager::ActionRequest> override
+ {
+ return std::make_unique<app::manager::ActionRequest>(
+ sender, app::manager::actions::ShowPopup, std::make_unique<gui::AlarmDeactivatedPopupRequestParams>());
}
};
M products/BellHybrid/services/evtmgr/CMakeLists.txt => products/BellHybrid/services/evtmgr/CMakeLists.txt +1 -2
@@ 14,7 14,6 @@ target_sources(evtmgr
PUBLIC
include/evtmgr/EventManager.hpp
include/evtmgr/api/TemperatureApi.hpp
- include/evtmgr/messages/AlarmMessage.hpp
)
target_include_directories(evtmgr
@@ 26,9 25,9 @@ target_include_directories(evtmgr
target_link_libraries(evtmgr
PRIVATE
- alarms
keymap
module-bsp
module-utils
service-evtmgr
+ sys
)
M products/BellHybrid/services/evtmgr/EventManager.cpp => products/BellHybrid/services/evtmgr/EventManager.cpp +14 -5
@@ 5,14 5,14 @@
#include "WorkerEvent.hpp"
#include <evtmgr/EventManager.hpp>
-#include <evtmgr/messages/AlarmMessage.hpp>
#include <keymap/KeyMap.hpp>
#include <module-bsp/hal/temperature_source/TemperatureSource.hpp>
-#include <service-evtmgr/KbdMessage.hpp>
+#include <module-sys/SystemManager/Constants.hpp>
#include <screen-light-control/ScreenLightControl.hpp>
-#include <service-evtmgr/EVMessages.hpp>
+#include <service-evtmgr/KbdMessage.hpp>
#include <service-evtmgr/ScreenLightControlMessage.hpp>
#include <service-evtmgr/WorkerEventCommon.hpp>
+#include <sys/messages/AlarmActivationStatusChangeRequest.hpp>
namespace
{
@@ 47,8 47,17 @@ void EventManager::handleKeyEvent(sys::Message *msg)
auto key = mapKey(static_cast<gui::KeyCode>(kbdMessage->key.keyCode));
- if (key == KeyMap::DeepPressUp && kbdMessage->key.state == RawKey::State::Released) {
- bus.sendMulticast(std::make_unique<AlarmActivated>(), sys::BusChannel::AlarmChanges);
+ if (kbdMessage->key.state == RawKey::State::Released) {
+ if (key == KeyMap::DeepPressUp) {
+ bus.sendUnicast(
+ std::make_shared<sys::AlarmActivationStatusChangeRequest>(sys::AlarmActivationStatus::ACTIVATED),
+ service::name::system_manager);
+ }
+ else if (key == KeyMap::DeepPressDown) {
+ bus.sendUnicast(
+ std::make_shared<sys::AlarmActivationStatusChangeRequest>(sys::AlarmActivationStatus::DEACTIVATED),
+ service::name::system_manager);
+ }
}
}
M products/BellHybrid/sys/CMakeLists.txt => products/BellHybrid/sys/CMakeLists.txt +2 -0
@@ 4,6 4,7 @@ target_sources(sys
PRIVATE
SystemManager.cpp
PUBLIC
+ include/sys/messages/AlarmActivationStatusChangeRequest.hpp
include/sys/SystemManager.hpp
)
@@ 14,5 15,6 @@ target_include_directories(sys
target_link_libraries(sys
PRIVATE
+ appmgr
module-sys
)
M products/BellHybrid/sys/SystemManager.cpp => products/BellHybrid/sys/SystemManager.cpp +30 -0
@@ 2,10 2,40 @@
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include <sys/SystemManager.hpp>
+#include <sys/messages/AlarmActivationStatusChangeRequest.hpp>
+
+#include <appmgr/messages/AlarmMessage.hpp>
+#include <service-appmgr/Constants.hpp>
namespace sys
{
SystemManager::SystemManager(std::vector<std::unique_ptr<BaseServiceCreator>> &&creators)
: SystemManagerCommon(std::move(creators))
{}
+
+ auto SystemManager::InitHandler() -> ReturnCodes
+ {
+ SystemManagerCommon::InitHandler();
+
+ connect(typeid(AlarmActivationStatusChangeRequest), [this](sys::Message *message) -> sys::MessagePointer {
+ auto request = static_cast<AlarmActivationStatusChangeRequest *>(message);
+ return handleAlarmActivationStatusChangeRequest(request);
+ });
+
+ return ReturnCodes::Success;
+ }
+
+ auto SystemManager::handleAlarmActivationStatusChangeRequest(AlarmActivationStatusChangeRequest *request)
+ -> MessagePointer
+ {
+ switch (request->getStatus()) {
+ case AlarmActivationStatus::ACTIVATED:
+ bus.sendUnicast(std::make_shared<AlarmActivated>(), service::name::appmgr);
+ break;
+ case AlarmActivationStatus::DEACTIVATED:
+ bus.sendUnicast(std::make_shared<AlarmDeactivated>(), service::name::appmgr);
+ break;
+ }
+ return MessageNone{};
+ }
} // namespace sys
M products/BellHybrid/sys/include/sys/SystemManager.hpp => products/BellHybrid/sys/include/sys/SystemManager.hpp +7 -0
@@ 7,9 7,16 @@
namespace sys
{
+ class AlarmActivationStatusChangeRequest;
+
class SystemManager : public SystemManagerCommon
{
public:
explicit SystemManager(std::vector<std::unique_ptr<BaseServiceCreator>> &&creators);
+
+ private:
+ auto InitHandler() -> ReturnCodes override;
+
+ auto handleAlarmActivationStatusChangeRequest(AlarmActivationStatusChangeRequest *request) -> MessagePointer;
};
} // namespace sys
A products/BellHybrid/sys/include/sys/messages/AlarmActivationStatusChangeRequest.hpp => products/BellHybrid/sys/include/sys/messages/AlarmActivationStatusChangeRequest.hpp +29 -0
@@ 0,0 1,29 @@
+// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
+// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+#pragma once
+
+namespace sys
+{
+ enum class AlarmActivationStatus
+ {
+ ACTIVATED,
+ DEACTIVATED
+ };
+
+ class AlarmActivationStatusChangeRequest : public sys::DataMessage
+ {
+ public:
+ explicit AlarmActivationStatusChangeRequest(AlarmActivationStatus status)
+ : sys::DataMessage(MessageType::MessageTypeUninitialized), status{status}
+ {}
+
+ [[nodiscard]] auto getStatus() const noexcept -> AlarmActivationStatus
+ {
+ return status;
+ }
+
+ private:
+ const AlarmActivationStatus status;
+ };
+} // namespace sys