summaryrefslogtreecommitdiff
path: root/src/drivers/include
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-02-06 21:47:28 +1100
committerjacqueline <me@jacqueline.id.au>2024-02-06 21:47:28 +1100
commit1b7821a474da216bd89052902347f97f2a1d796c (patch)
tree066ff68b9a3476113bfa17a3c809ca88b1cc37cb /src/drivers/include
parentd23435fab7a7878d4a82f6b7a113f65c12ec33a7 (diff)
downloadtangara-fw-1b7821a474da216bd89052902347f97f2a1d796c.tar.gz
improve the locking strategy of the bluetooth fsm
Diffstat (limited to 'src/drivers/include')
-rw-r--r--src/drivers/include/bluetooth.hpp4
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_;