mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-04-20 23:17:35 -04:00
Reworked AppSettings handling of BT devices to be prepared for handling the HFP profile, eliminating by the way few bugs and speeding up the flow (by getting rid of few refreshes). Added unit tests for handling the BT devices flow
30 lines
1.3 KiB
C++
30 lines
1.3 KiB
C++
// 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 <functional>
|
|
#include "Device.hpp"
|
|
#include "Error.hpp"
|
|
|
|
namespace bluetooth
|
|
{
|
|
class AbstractDriver
|
|
{
|
|
public:
|
|
using ErrorCallback = std::function<void(uint8_t)>;
|
|
virtual ~AbstractDriver() noexcept = default;
|
|
|
|
[[nodiscard]] virtual auto init() -> Error::Code = 0;
|
|
[[nodiscard]] virtual auto run() -> Error::Code = 0;
|
|
[[nodiscard]] virtual auto stop() -> Error::Code = 0;
|
|
[[nodiscard]] virtual auto scan() -> Error = 0;
|
|
virtual void stopScan() = 0;
|
|
virtual void setVisibility(bool visibility) = 0;
|
|
[[nodiscard]] virtual auto pair(Devicei device, std::uint8_t protectionLevel = 0) -> bool = 0;
|
|
[[nodiscard]] virtual auto unpair(Devicei device) -> bool = 0;
|
|
|
|
virtual void registerErrorCallback(const ErrorCallback &newCallback) = 0;
|
|
};
|
|
} // namespace bluetooth
|