diff options
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 da8d8999..24145ead 100644 --- a/src/ui/ui_fsm.cpp +++ b/src/ui/ui_fsm.cpp @@ -368,14 +368,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{}); } @@ -505,9 +511,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(); |
