diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-02-06 21:47:28 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-02-06 21:47:28 +1100 |
| commit | 1b7821a474da216bd89052902347f97f2a1d796c (patch) | |
| tree | 066ff68b9a3476113bfa17a3c809ca88b1cc37cb /src/drivers/include/bluetooth.hpp | |
| parent | d23435fab7a7878d4a82f6b7a113f65c12ec33a7 (diff) | |
| download | tangara-fw-1b7821a474da216bd89052902347f97f2a1d796c.tar.gz | |
improve the locking strategy of the bluetooth fsm
Diffstat (limited to 'src/drivers/include/bluetooth.hpp')
| -rw-r--r-- | src/drivers/include/bluetooth.hpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/drivers/include/bluetooth.hpp b/src/drivers/include/bluetooth.hpp index c2962e64..2936fb8e 100644 --- a/src/drivers/include/bluetooth.hpp +++ b/src/drivers/include/bluetooth.hpp @@ -105,6 +105,8 @@ class BluetoothState : public tinyfsm::Fsm<BluetoothState> { public: static auto Init(NvsStorage& storage) -> void; + static auto lock() -> std::lock_guard<std::mutex>; + static auto devices() -> std::vector<Device>; static auto preferred_device() -> std::optional<bluetooth::MacAndName>; @@ -141,7 +143,7 @@ class BluetoothState : public tinyfsm::Fsm<BluetoothState> { static NvsStorage* sStorage_; static Scanner* sScanner_; - static std::mutex sDevicesMutex_; + static std::mutex sFsmMutex; static std::map<mac_addr_t, Device> sDevices_; static std::optional<bluetooth::MacAndName> sPreferredDevice_; |
