~aleteoryx/muditaos

ref: 7bcc1c9bd4add82ca6d53aa22e12e620551ba172 muditaos/module-services/service-desktop/DesktopMessages.cpp -rw-r--r-- 2.2 KiB
7bcc1c9b — Lucjan Bryndza [EGD-6013] Fix no copy syscall 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// 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"

namespace sdesktop
{
    using namespace parserFSM;
    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::isLocked, isLocked}});
        }

        CellularStateInfoRequestEvent::CellularStateInfoRequestEvent(std::string stateStr)
        {
            context.setResponseStatus(http::Code::OK);
            context.setEndpoint(EndpointType::developerMode);
            context.setResponseBody(json11::Json::object{{json::developerMode::cellularStateInfo, stateStr}});
        }
    } // namespace developerMode
    namespace bluetooth
    {
        BluetoothStatusRequestEvent::BluetoothStatusRequestEvent(int state)
        {
            context.setResponseStatus(http::Code::OK);
            context.setEndpoint(EndpointType::bluetooth);
            context.setResponseBody(json11::Json::object{{json::bluetooth::state, state}});
        }
        ScanStartedEvent::ScanStartedEvent()
        {
            context.setResponseStatus(http::Code::OK);
            context.setEndpoint(EndpointType::bluetooth);
            context.setResponseBody(json11::Json::object{{json::bluetooth::scan, json::bluetooth::btOn}});
        }
        ScanStoppedEvent::ScanStoppedEvent()
        {
            context.setResponseStatus(http::Code::OK);
            context.setEndpoint(EndpointType::bluetooth);
            context.setResponseBody(json11::Json::object{{json::bluetooth::scan, json::bluetooth::btOff}});
        }
    } // namespace bluetooth
} // namespace sdesktop