summaryrefslogtreecommitdiff
path: root/src/drivers/bluetooth.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-02-12 17:07:39 +1100
committerjacqueline <me@jacqueline.id.au>2024-02-12 17:07:39 +1100
commit26df5c4a7f54d493a09724a5f4f8f4a3a5c90f31 (patch)
tree168c313734ed388efa1847226d6cea61b8c0c7e0 /src/drivers/bluetooth.cpp
parenta7ac34eaa9b895e16aed816c504d167027898d7b (diff)
downloadtangara-fw-26df5c4a7f54d493a09724a5f4f8f4a3a5c90f31.tar.gz
Remember per-device bluetooth volume
Diffstat (limited to 'src/drivers/bluetooth.cpp')
-rw-r--r--src/drivers/bluetooth.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/drivers/bluetooth.cpp b/src/drivers/bluetooth.cpp
index 1a303748..84c81de0 100644
--- a/src/drivers/bluetooth.cpp
+++ b/src/drivers/bluetooth.cpp
@@ -103,21 +103,12 @@ auto Bluetooth::IsConnected() -> bool {
return bluetooth::BluetoothState::is_in_state<bluetooth::Connected>();
}
-auto Bluetooth::ConnectedDevice() -> std::optional<bluetooth::Device> {
+auto Bluetooth::ConnectedDevice() -> std::optional<bluetooth::MacAndName> {
auto lock = bluetooth::BluetoothState::lock();
if (!bluetooth::BluetoothState::is_in_state<bluetooth::Connected>()) {
return {};
}
- auto looking_for = bluetooth::BluetoothState::preferred_device();
- if (!looking_for) {
- return {};
- }
- for (const auto& dev : bluetooth::BluetoothState::devices()) {
- if (dev.address == looking_for->mac) {
- return dev;
- }
- }
- return {};
+ return bluetooth::BluetoothState::preferred_device();
}
auto Bluetooth::KnownDevices() -> std::vector<bluetooth::Device> {