diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-02-12 17:07:39 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-02-12 17:07:39 +1100 |
| commit | 26df5c4a7f54d493a09724a5f4f8f4a3a5c90f31 (patch) | |
| tree | 168c313734ed388efa1847226d6cea61b8c0c7e0 /src/ui/ui_fsm.cpp | |
| parent | a7ac34eaa9b895e16aed816c504d167027898d7b (diff) | |
| download | tangara-fw-26df5c4a7f54d493a09724a5f4f8f4a3a5c90f31.tar.gz | |
Remember per-device bluetooth volume
Diffstat (limited to 'src/ui/ui_fsm.cpp')
| -rw-r--r-- | src/ui/ui_fsm.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/ui/ui_fsm.cpp b/src/ui/ui_fsm.cpp index 12584ec7..630238e7 100644 --- a/src/ui/ui_fsm.cpp +++ b/src/ui/ui_fsm.cpp @@ -326,14 +326,20 @@ void UiState::react(const audio::VolumeLimitChanged& ev) { void UiState::react(const system_fsm::BluetoothEvent& ev) { auto bt = sServices->bluetooth(); + auto dev = bt.ConnectedDevice(); switch (ev.event) { case drivers::bluetooth::Event::kKnownDevicesChanged: sBluetoothDevices.Update(bt.KnownDevices()); break; case drivers::bluetooth::Event::kConnectionStateChanged: sBluetoothConnected.Update(bt.IsConnected()); - if (bt.ConnectedDevice()) { - sBluetoothPairedDevice.Update(bt.ConnectedDevice().value()); + if (dev) { + sBluetoothPairedDevice.Update(drivers::bluetooth::Device{ + .address = dev->mac, + .name = {dev->name.data(), dev->name.size()}, + .class_of_device = 0, + .signal_strength = 0, + }); } else { sBluetoothPairedDevice.Update(std::monostate{}); } @@ -457,9 +463,6 @@ void Lua::entry() { auto bt = sServices->bluetooth(); sBluetoothEnabled.Update(bt.IsEnabled()); sBluetoothConnected.Update(bt.IsConnected()); - if (bt.ConnectedDevice()) { - sBluetoothPairedDevice.Update(bt.ConnectedDevice().value()); - } sBluetoothDevices.Update(bt.KnownDevices()); sCurrentScreen.reset(); |
