Files
MuditaOS/module-sys/common/include/system/messages/SystemManagerMessage.hpp
Marcin Smoczyński 57874cab33 [BH-912] Improve sys module structure
Improve structure of the module sys. Problems within this module
prevents from linking others.

Signed-off-by: Marcin Smoczyński <smoczynski.marcin@gmail.com>
2021-09-24 10:01:19 +02:00

43 lines
1.3 KiB
C++

// 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 <MessageType.hpp>
#include <Service/Message.hpp>
#include "system/Constants.hpp"
#include "SystemManager/data/SystemManagerActionsParams.hpp"
#include <service-appmgr/Actions.hpp>
namespace sys
{
class SystemManagerMessage : public sys::DataMessage
{
public:
SystemManagerMessage() : sys::DataMessage(MessageType::PMChangePowerMode){};
};
class CriticalBatteryLevelNotification : public sys::DataMessage, public app::manager::actions::ConvertibleToAction
{
public:
explicit CriticalBatteryLevelNotification(bool isActive, bool isCharging = false)
: isActive(isActive), isCharging(isCharging)
{}
[[nodiscard]] auto toAction() const -> std::unique_ptr<app::manager::ActionRequest>
{
return std::make_unique<app::manager::ActionRequest>(
service::name::system_manager,
app::manager::actions::DisplayLowBatteryScreen,
std::make_unique<app::manager::actions::LowBatteryNotificationParams>(isActive, isCharging));
}
private:
bool isActive;
bool isCharging;
};
} // namespace sys