summaryrefslogtreecommitdiff
path: root/src/ui/ui_fsm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/ui_fsm.cpp')
-rw-r--r--src/ui/ui_fsm.cpp13
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();