diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-02-06 17:56:17 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-02-06 17:56:17 +1100 |
| commit | aff28342d94f9140e36a793353575d243cc789b8 (patch) | |
| tree | bb1a0ac55b17070676ef445bac6f5b9aa6f0fd20 /src/drivers/include | |
| parent | a75adfc124e4afa461aea438a1e42649de7115cd (diff) | |
| download | tangara-fw-aff28342d94f9140e36a793353575d243cc789b8.tar.gz | |
let the bluetooth stack handle its own discovery state
Diffstat (limited to 'src/drivers/include')
| -rw-r--r-- | src/drivers/include/bluetooth.hpp | 14 | ||||
| -rw-r--r-- | src/drivers/include/bluetooth_types.hpp | 1 |
2 files changed, 2 insertions, 13 deletions
diff --git a/src/drivers/include/bluetooth.hpp b/src/drivers/include/bluetooth.hpp index 00ddb0c0..6464c8de 100644 --- a/src/drivers/include/bluetooth.hpp +++ b/src/drivers/include/bluetooth.hpp @@ -36,13 +36,6 @@ class Bluetooth { auto IsConnected() -> bool; auto ConnectedDevice() -> std::optional<bluetooth::Device>; - /* - * Sets whether or not the bluetooth stack is allowed to actively scan for - * new devices. - */ - auto SetDeviceDiscovery(bool) -> void; - auto IsDiscovering() -> bool; - auto KnownDevices() -> std::vector<bluetooth::Device>; auto SetPreferredDevice(std::optional<bluetooth::MacAndName> dev) -> void; @@ -62,7 +55,6 @@ struct Disable : public tinyfsm::Event {}; struct PreferredDeviceChanged : public tinyfsm::Event {}; struct SourceChanged : public tinyfsm::Event {}; -struct DiscoveryChanged : public tinyfsm::Event {}; struct DeviceDiscovered : public tinyfsm::Event { const Device& device; }; @@ -134,7 +126,6 @@ class BluetoothState : public tinyfsm::Fsm<BluetoothState> { virtual void react(const events::Disable& ev) = 0; virtual void react(const events::PreferredDeviceChanged& ev){}; virtual void react(const events::SourceChanged& ev){}; - virtual void react(const events::DiscoveryChanged&); virtual void react(const events::ChangeVolume&) {} virtual void react(const events::DeviceDiscovered&); @@ -151,23 +142,22 @@ class BluetoothState : public tinyfsm::Fsm<BluetoothState> { static std::map<mac_addr_t, Device> sDevices_; static std::optional<bluetooth::MacAndName> sPreferredDevice_; static std::optional<bluetooth::MacAndName> sConnectingDevice_; - static bool sIsDiscoveryAllowed_; static std::atomic<StreamBufferHandle_t> sSource_; static std::function<void(Event)> sEventHandler_; + + auto connect(const bluetooth::MacAndName&) -> void; }; class Disabled : public BluetoothState { public: void entry() override; - void exit() override; void react(const events::Enable& ev) override; void react(const events::Disable& ev) override{}; void react(const events::internal::Gap& ev) override {} void react(const events::internal::A2dp& ev) override {} - void react(const events::DiscoveryChanged& ev) override{}; using BluetoothState::react; }; diff --git a/src/drivers/include/bluetooth_types.hpp b/src/drivers/include/bluetooth_types.hpp index 87da0ab5..74434182 100644 --- a/src/drivers/include/bluetooth_types.hpp +++ b/src/drivers/include/bluetooth_types.hpp @@ -27,7 +27,6 @@ enum class Event { kKnownDevicesChanged, kConnectionStateChanged, kPreferredDeviceChanged, - kDiscoveryChanged, }; } // namespace bluetooth |
