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 { 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 dev) -> void { bluetooth::events::PairedDeviceChanged{}); } +auto BluetoothState::eventHandler() -> std::function& { + 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 { static auto pairedDevice() -> std::optional; static auto pairedDevice(std::optional) -> void; + static auto eventHandler() -> std::function&; + static auto discovery() -> bool; static auto discovery(bool) -> void; static auto discoveredDevices() -> std::vector;