Files
MuditaOS/module-services/service-desktop/DesktopMessages.cpp
Artur Śleszyński b15006a94c [CP-564] Make desktop endpoints a separate lib
In order to have different sets of endpoints for different products,
we need to separate endpoints from the desktop service.
2021-09-21 10:41:37 +02:00

58 lines
2.1 KiB
C++

// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "service-desktop/DesktopMessages.hpp"
#include "parser/MessageHandler.hpp"
#include <module-bluetooth/Bluetooth/Device.hpp>
#include <endpoints/developerMode/DeveloperModeEndpoint.hpp>
namespace sdesktop
{
using namespace endpoints;
namespace developerMode
{
AppFocusChangeEvent::AppFocusChangeEvent(std::string appName)
{
context.setResponseStatus(http::Code::OK);
context.setEndpoint(EndpointType::developerMode);
context.setResponseBody(json11::Json::object{{json::developerMode::focus, appName}});
}
ScreenlockCheckEvent::ScreenlockCheckEvent(bool isLocked)
{
context.setResponseStatus(http::Code::OK);
context.setEndpoint(EndpointType::developerMode);
context.setResponseBody(json11::Json::object{{json::developerMode::phoneLocked, isLocked}});
}
CellularStateInfoRequestEvent::CellularStateInfoRequestEvent(std::string stateStr)
{
context.setResponseStatus(http::Code::OK);
context.setEndpoint(EndpointType::developerMode);
context.setResponseBody(json11::Json::object{{json::developerMode::cellularStateInfo, stateStr}});
}
CellularSleepModeInfoRequestEvent::CellularSleepModeInfoRequestEvent(bool isInSleepMode)
{
context.setResponseStatus(http::Code::OK);
context.setEndpoint(EndpointType::developerMode);
context.setResponseBody(json11::Json::object{{json::developerMode::cellularSleepModeInfo, isInSleepMode}});
}
} // namespace developerMode
namespace usb
{
USBConfigured::USBConfigured(USBConfigurationType configurationType)
: sys::DataMessage(MessageType::USBConfigured), configurationType(configurationType)
{}
USBConfigurationType USBConfigured::getConfigurationType() const noexcept
{
return configurationType;
}
} // namespace usb
} // namespace sdesktop