diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-09-22 15:48:41 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-09-22 21:19:19 +1000 |
| commit | b192975cb1eeb4e6b7c7bf53cdf42701c55f034a (patch) | |
| tree | 39755851543d596f2630704be9efb56be1f39bfc /src/drivers/include/bluetooth.hpp | |
| parent | cbd99b2134c6c471708deb409a4b0fcc4c31516d (diff) | |
| download | tangara-fw-b192975cb1eeb4e6b7c7bf53cdf42701c55f034a.tar.gz | |
make bluetooth pairing ui functional
Diffstat (limited to 'src/drivers/include/bluetooth.hpp')
| -rw-r--r-- | src/drivers/include/bluetooth.hpp | 9 |
1 files changed, 7 insertions, 2 deletions
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<bluetooth::Device>; auto SetPreferredDevice(const bluetooth::mac_addr_t& mac) -> void; auto SetSource(StreamBufferHandle_t) -> void; + auto SetEventHandler(std::function<void(bluetooth::Event)> cb) -> void; }; namespace bluetooth { @@ -64,7 +66,7 @@ struct Avrc : public tinyfsm::Event { class BluetoothState : public tinyfsm::Fsm<BluetoothState> { public: - static auto Init(NvsStorage* storage) -> void; + static auto Init(NvsStorage& storage) -> void; static auto devices() -> std::vector<Device>; static auto preferred_device() -> std::optional<mac_addr_t>; @@ -73,6 +75,8 @@ class BluetoothState : public tinyfsm::Fsm<BluetoothState> { static auto source() -> StreamBufferHandle_t; static auto source(StreamBufferHandle_t) -> void; + static auto event_handler(std::function<void(Event)>) -> void; + virtual ~BluetoothState(){}; virtual void entry() {} @@ -96,6 +100,7 @@ class BluetoothState : public tinyfsm::Fsm<BluetoothState> { static mac_addr_t sCurrentDevice_; static std::atomic<StreamBufferHandle_t> sSource_; + static std::function<void(Event)> sEventHandler_; }; class Disabled : public BluetoothState { |
