From 99c56641e9ee531a0553ff19422009dd667a3add Mon Sep 17 00:00:00 2001 From: jacqueline Date: Tue, 6 Feb 2024 12:38:11 +1100 Subject: fix various of bluetooth issues connecting and disconnecting is a bit more consistent now! --- src/drivers/include/bluetooth.hpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/drivers/include/bluetooth.hpp') 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; - auto SetPreferredDevice(const bluetooth::mac_addr_t& mac) -> void; - auto PreferredDevice() -> std::optional; + auto SetPreferredDevice(std::optional dev) -> void; + auto PreferredDevice() -> std::optional; auto SetSource(StreamBufferHandle_t) -> void; auto SetEventHandler(std::function cb) -> void; @@ -107,8 +107,8 @@ class BluetoothState : public tinyfsm::Fsm { static auto devices() -> std::vector; - static auto preferred_device() -> std::optional; - static auto preferred_device(std::optional) -> void; + static auto preferred_device() -> std::optional; + static auto preferred_device(std::optional) -> void; static auto scanning() -> bool; static auto discovery() -> bool; @@ -142,8 +142,8 @@ class BluetoothState : public tinyfsm::Fsm { static std::mutex sDevicesMutex_; static std::map sDevices_; - static std::optional sPreferredDevice_; - static std::optional sCurrentDevice_; + static std::optional sPreferredDevice_; + static std::optional sConnectingDevice_; static bool sIsDiscoveryAllowed_; static std::atomic 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 -- cgit v1.2.3