diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/drivers/bluetooth.cpp | 6 | ||||
| -rw-r--r-- | src/drivers/include/drivers/bluetooth.hpp | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/drivers/bluetooth.cpp b/src/drivers/bluetooth.cpp index 64e45e23..1fd80c51 100644 --- a/src/drivers/bluetooth.cpp +++ b/src/drivers/bluetooth.cpp @@ -188,6 +188,8 @@ auto Bluetooth::knownDevices() -> std::vector<bluetooth::MacAndName> { auto Bluetooth::forgetKnownDevice(const bluetooth::mac_addr_t& mac) -> void { nvs_.BluetoothName(mac, {}); + std::invoke(bluetooth::BluetoothState::eventHandler(), + bluetooth::SimpleEvent::kKnownDevicesChanged); } auto Bluetooth::discoveryEnabled(bool en) -> void { @@ -414,6 +416,10 @@ auto BluetoothState::pairedDevice(std::optional<MacAndName> dev) -> void { bluetooth::events::PairedDeviceChanged{}); } +auto BluetoothState::eventHandler() -> std::function<void(Event)>& { + return sEventHandler_; +} + auto BluetoothState::discovery() -> bool { return sScanner_->enabled(); } diff --git a/src/drivers/include/drivers/bluetooth.hpp b/src/drivers/include/drivers/bluetooth.hpp index b333bd15..7ee49e2a 100644 --- a/src/drivers/include/drivers/bluetooth.hpp +++ b/src/drivers/include/drivers/bluetooth.hpp @@ -162,6 +162,8 @@ class BluetoothState : public tinyfsm::Fsm<BluetoothState> { static auto pairedDevice() -> std::optional<bluetooth::MacAndName>; static auto pairedDevice(std::optional<bluetooth::MacAndName>) -> void; + static auto eventHandler() -> std::function<void(Event)>&; + static auto discovery() -> bool; static auto discovery(bool) -> void; static auto discoveredDevices() -> std::vector<Device>; |
