diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-02-06 12:38:11 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-02-06 13:37:20 +1100 |
| commit | 99c56641e9ee531a0553ff19422009dd667a3add (patch) | |
| tree | 8cb4dcd954a563b42bee9e991e8ad9bb99a0f3c7 /src/drivers/include/bluetooth.hpp | |
| parent | ab314b82e10aadb674fab223bffa4933a9a65750 (diff) | |
| download | tangara-fw-99c56641e9ee531a0553ff19422009dd667a3add.tar.gz | |
fix various of bluetooth issues
connecting and disconnecting is a bit more consistent now!
Diffstat (limited to 'src/drivers/include/bluetooth.hpp')
| -rw-r--r-- | src/drivers/include/bluetooth.hpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/drivers/include/bluetooth.hpp b/src/drivers/include/bluetooth.hpp index 4aefbc42..291d049d 100644 --- a/src/drivers/include/bluetooth.hpp +++ b/src/drivers/include/bluetooth.hpp @@ -44,8 +44,8 @@ class Bluetooth { auto KnownDevices() -> std::vector<bluetooth::Device>; - auto SetPreferredDevice(const bluetooth::mac_addr_t& mac) -> void; - auto PreferredDevice() -> std::optional<bluetooth::mac_addr_t>; + auto SetPreferredDevice(std::optional<bluetooth::MacAndName> dev) -> void; + auto PreferredDevice() -> std::optional<bluetooth::MacAndName>; auto SetSource(StreamBufferHandle_t) -> void; auto SetEventHandler(std::function<void(bluetooth::Event)> cb) -> void; @@ -107,8 +107,8 @@ class BluetoothState : public tinyfsm::Fsm<BluetoothState> { static auto devices() -> std::vector<Device>; - static auto preferred_device() -> std::optional<mac_addr_t>; - static auto preferred_device(std::optional<mac_addr_t>) -> void; + static auto preferred_device() -> std::optional<bluetooth::MacAndName>; + static auto preferred_device(std::optional<bluetooth::MacAndName>) -> void; static auto scanning() -> bool; static auto discovery() -> bool; @@ -142,8 +142,8 @@ class BluetoothState : public tinyfsm::Fsm<BluetoothState> { static std::mutex sDevicesMutex_; static std::map<mac_addr_t, Device> sDevices_; - static std::optional<mac_addr_t> sPreferredDevice_; - static std::optional<Device> sCurrentDevice_; + static std::optional<bluetooth::MacAndName> sPreferredDevice_; + static std::optional<bluetooth::MacAndName> sConnectingDevice_; static bool sIsDiscoveryAllowed_; static std::atomic<StreamBufferHandle_t> sSource_; @@ -205,6 +205,9 @@ class Connected : public BluetoothState { void react(const events::internal::Avrc& ev) override; using BluetoothState::react; + + private: + mac_addr_t connected_to_; }; } // namespace bluetooth |
