From b192975cb1eeb4e6b7c7bf53cdf42701c55f034a Mon Sep 17 00:00:00 2001 From: jacqueline Date: Fri, 22 Sep 2023 15:48:41 +1000 Subject: make bluetooth pairing ui functional --- src/drivers/include/bluetooth.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/drivers/include/bluetooth.hpp') diff --git a/src/drivers/include/bluetooth.hpp b/src/drivers/include/bluetooth.hpp index fc72d393..1489b790 100644 --- a/src/drivers/include/bluetooth.hpp +++ b/src/drivers/include/bluetooth.hpp @@ -26,15 +26,17 @@ namespace drivers { */ class Bluetooth { public: - Bluetooth(NvsStorage* storage); + Bluetooth(NvsStorage& storage); auto Enable() -> bool; auto Disable() -> void; + auto IsEnabled() -> bool; auto KnownDevices() -> std::vector; auto SetPreferredDevice(const bluetooth::mac_addr_t& mac) -> void; auto SetSource(StreamBufferHandle_t) -> void; + auto SetEventHandler(std::function cb) -> void; }; namespace bluetooth { @@ -64,7 +66,7 @@ struct Avrc : public tinyfsm::Event { class BluetoothState : public tinyfsm::Fsm { public: - static auto Init(NvsStorage* storage) -> void; + static auto Init(NvsStorage& storage) -> void; static auto devices() -> std::vector; static auto preferred_device() -> std::optional; @@ -73,6 +75,8 @@ class BluetoothState : public tinyfsm::Fsm { static auto source() -> StreamBufferHandle_t; static auto source(StreamBufferHandle_t) -> void; + static auto event_handler(std::function) -> void; + virtual ~BluetoothState(){}; virtual void entry() {} @@ -96,6 +100,7 @@ class BluetoothState : public tinyfsm::Fsm { static mac_addr_t sCurrentDevice_; static std::atomic sSource_; + static std::function sEventHandler_; }; class Disabled : public BluetoothState { -- cgit v1.2.3