~aleteoryx/muditaos

ref: a405cad694b867fcd2498984830bd97d4b9bde2f muditaos/module-bluetooth/Bluetooth/interface/profiles/HFP/HFP.hpp -rw-r--r-- 2.5 KiB
a405cad6Aleteoryx trim readme 7 days 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-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/blob/master/LICENSE.md

#pragma once

#include "Profile.hpp"
#include <interface/profiles/PhoneInterface.hpp>
#include <service-bluetooth/BluetoothMessage.hpp>
#include <btstack_run_loop.h>
#include <PhoneNumber.hpp>

namespace bluetooth
{

    class HFP : public CallProfile
    {
        // static constexpr auto CLASS_OF_DEVICE = 0x400204;
        // Service class: Telephony, Major device class: Phone, Minor device class: Cellular
      public:
        HFP();
        ~HFP() override;

        HFP(const HFP &other) = delete;
        auto operator=(const HFP &rhs) -> HFP & = delete;
        HFP(HFP &&other) noexcept;
        auto operator=(HFP &&other) noexcept -> HFP &;

        auto init() -> Result::Code override;
        void setDevice(const Devicei &device) override;
        void setOwnerService(sys::Service *service) override;

        void connect() override;
        void disconnect() override;
        [[nodiscard]] auto incomingCallStarted() const noexcept -> Result::Code override;
        [[nodiscard]] auto outgoingCallStarted(const std::string &number) const noexcept -> Result::Code override;
        [[nodiscard]] auto incomingCallAnswered() const noexcept -> Result::Code override;
        [[nodiscard]] auto outgoingCallAnswered() const noexcept -> Result::Code override;
        [[nodiscard]] auto callTerminated() const noexcept -> Result::Code override;
        [[nodiscard]] auto callMissed() const noexcept -> Result::Code override;
        [[nodiscard]] auto setIncomingCallNumber(const std::string &num) const noexcept -> Result::Code override;
        /// @brief Sets the signal strength bars data
        /// @return Success
        [[nodiscard]] auto setSignalStrength(int bars) const noexcept -> Result::Code override;
        [[nodiscard]] auto setOperatorName(const std::string_view &name) const noexcept -> Result::Code override;
        [[nodiscard]] auto setBatteryLevel(const BatteryLevel &level) const noexcept -> Result::Code override;
        [[nodiscard]] auto setNetworkRegistrationStatus(bool registered) const noexcept -> Result::Code override;
        auto setRoamingStatus(bool enabled) const noexcept -> Result::Code override;

        void setAudioDevice(std::shared_ptr<bluetooth::BluetoothAudioDevice> audioDevice) override;

      private:
        class HFPImpl;
        std::unique_ptr<HFPImpl> pimpl;
    };

} // namespace bluetooth