~aleteoryx/muditaos

ref: 6c32205e1be369cbadf752c77eff68d1a2f963e1 muditaos/module-services/service-desktop/endpoints/bluetooth/BluetoothHelper.hpp -rw-r--r-- 2.3 KiB
6c32205e — Marek Niepieklo [CP-371] Updater miscelanous developer mode and logs changes 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
56
57
58
59
60
61
62
63
64
65
66
// 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>

namespace sys
{
    class Service;
} // namespace sys

namespace parserFSM
{

    class BluetoothHelper
    {
        sys::Service *ownerServicePtr = nullptr;
        void sendRequest(parserFSM::Context &context, std::unique_ptr<sys::Message> msg);

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

    namespace json::bluetooth
    {
        inline constexpr auto state   = "state";
        namespace states
        {
            inline constexpr auto power      = "power";
            inline constexpr auto visibility = "visibility";
        } // namespace states
        inline constexpr auto on   = "on";
        inline constexpr auto off  = "off";
        inline constexpr auto scan = "scan";

        inline constexpr auto command = "command";
        namespace commands
        {
            inline constexpr auto scanOn           = "scanOn";
            inline constexpr auto scanOff          = "scanOff";
            inline constexpr auto disconnect       = "disconnect";
            inline constexpr auto changeVisibility = "changeVisibility";
        } // namespace commands
        inline constexpr auto success = "success";
        inline constexpr auto failure = "failure";

        inline constexpr auto pair    = "pair";
        inline constexpr auto unpair  = "unpair";
        inline constexpr auto connect = "connect";
        inline constexpr auto devices = "devices";
        namespace devicesValues
        {
            inline constexpr auto address = "address";
            inline constexpr auto name    = "name";
            inline constexpr auto scanned = "scanned";
            inline constexpr auto bonded  = "bonded";
        } // namespace devicesValues
    } // namespace json::bluetooth
} // namespace parserFSM