~aleteoryx/muditaos

ref: 71e43a90af2c71a3649fef9220c30c575d1ac98a muditaos/module-services/service-desktop/endpoints/developerMode/DeveloperModeHelper.hpp -rw-r--r-- 1.9 KiB
71e43a90 — Marcin Smoczyński Merge branch 'stable' - release v0.57.1 5 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
56
// 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 <endpoints/Context.hpp>

#include <Common/Query.hpp>
#include <Service/Common.hpp>
#include <Service/Service.hpp>
#include <bsp/keyboard/key_codes.hpp>
#include <input/InputEvent.hpp>
#include <module-db/Interface/SMSRecord.hpp>

namespace sys
{
    class Service;
} // namespace sys

namespace parserFSM
{

    class DeveloperModeHelper
    {
        sys::Service *ownerServicePtr = nullptr;
        static auto getKeyCode(int val) noexcept -> bsp::KeyCodes;
        void sendKeypress(bsp::KeyCodes keyCode, gui::InputEvent::State state);

        void requestSimChange(const int simSelected);
        auto smsRecordFromJson(json11::Json msgJson) -> SMSRecord;
        auto prepareSMS(Context &context) -> sys::ReturnCodes;

      public:
        DeveloperModeHelper(sys::Service *_ownerServicePtr) : ownerServicePtr(_ownerServicePtr){};
        auto processPutRequest(Context &context) -> sys::ReturnCodes;
        auto processGetRequest(Context &context) -> sys::ReturnCodes;
    };

    namespace json::developerMode
    {
        inline constexpr auto keyPressed    = "keyPressed";
        inline constexpr auto state         = "state";
        inline constexpr auto systemStarted = "systemStarted";
        inline constexpr auto ATResponse    = "ATResponse";
        inline constexpr auto AT            = "AT";
        inline constexpr auto focus         = "focus";
        inline constexpr auto isLocked      = "isLocked";
        inline constexpr auto changeSim     = "changeSim";
        inline constexpr auto smsCommand    = "smsCommand";
        inline constexpr auto getInfo       = "getInfo";
        /// values for getInfo cmd
        inline constexpr auto simStateInfo = "simState";
        /// values for smsCommand
        inline constexpr auto smsAdd = "smsAdd";
    }
} // namespace parserFSM