~aleteoryx/muditaos

ref: 2ae306bd40be7dbf5ecc3de00e84d4d0e84f59d0 muditaos/module-bluetooth/Bluetooth/interface/profiles/Profile.hpp -rw-r--r-- 2.1 KiB
2ae306bd — Paweł Joński [BH-662] Handle alarm turn off and snooze 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
// 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 "Error.hpp"
#include <audio/BluetoothAudioDevice.hpp>
#include <Service/Message.hpp>
#include <service-bluetooth/ServiceBluetoothCommon.hpp>

#include <memory>

namespace bluetooth
{
    class Profile
    {
      public:
        virtual ~Profile()                                                                        = default;
        virtual auto init() -> Error::Code                                                        = 0;
        virtual void setDeviceAddress(uint8_t *addr)                                              = 0;
        virtual void setOwnerService(const sys::Service *service)                                 = 0;
        virtual void connect()                                                                    = 0;
        virtual void start()                                                                      = 0;
        virtual void stop()                                                                       = 0;
        virtual void disconnect()                                                                 = 0;
        virtual void setAudioDevice(std::shared_ptr<bluetooth::BluetoothAudioDevice> audioDevice) = 0;
        /// Starts ringing
        /// @return Error code that determines, whether operation was successful or not
        [[nodiscard]] virtual auto startRinging() const noexcept -> Error::Code = 0;
        /// Stops ringing
        /// @return Error code that determines, whether operation was successful or not
        [[nodiscard]] virtual auto stopRinging() const noexcept -> Error::Code = 0;
        /// Initializes call
        /// @return Error code that determines, whether operation was successful or not
        [[nodiscard]] virtual auto initializeCall() const noexcept -> Error::Code = 0;

      protected:
        static void initSdp();
        static void initL2cap();

      private:
        static bool isL2CapInitialized;
        static bool isSdpInitialized;
    };

} // namespace bluetooth