~aleteoryx/muditaos

ref: 9ff089462e3817417adb6931bc8dd80da695c4fc muditaos/module-bluetooth/Bluetooth/interface/profiles/HSP/HSPImpl.hpp -rw-r--r-- 1.4 KiB
9ff08946 — KacperLewandowski [EGD-5073] Add UI modifications in Calendar after review 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
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once
#include "HSP.hpp"
#include "Error.hpp"
#include "SCO.hpp"
#include <Audio/AudioCommon.hpp>

namespace Bt
{
    static constexpr int serviceBufferLength = 150;
    static constexpr int commandBufferLength = 150;

    class HSP::HSPImpl
    {
      public:
        static void packetHandler(uint8_t packetType, uint16_t channel, uint8_t *event, uint16_t eventSize);
        auto init() -> Error::Code;
        void start();
        void stop();
        void setDeviceAddress(bd_addr_t addr);
        void setOwnerService(const sys::Service *service);
        auto getStreamData() -> std::shared_ptr<BluetoothStreamData>;

      private:
        static void sendAudioEvent(audio::EventType event, audio::Event::DeviceState state);
        static void processHCIEvent(uint8_t *event);
        static void processHSPEvent(uint8_t *event);
        static std::array<uint8_t, serviceBufferLength> serviceBuffer;
        static constexpr uint8_t rfcommChannelNr = 1;
        static std::string agServiceName;
        static uint16_t scoHandle;
        static std::unique_ptr<SCO> sco;
        static std::array<char, commandBufferLength> ATcommandBuffer;
        static bd_addr_t deviceAddr;
        static const sys::Service *ownerService;
    };
} // namespace Bt