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.cpp39
1 files changed, 21 insertions, 18 deletions
diff --git a/src/ui/ui_fsm.cpp b/src/ui/ui_fsm.cpp
index b3546d55..55c8c84b 100644
--- a/src/ui/ui_fsm.cpp
+++ b/src/ui/ui_fsm.cpp
@@ -77,30 +77,33 @@ lua::Property UiState::sBatteryPct{0};
lua::Property UiState::sBatteryMv{0};
lua::Property UiState::sBatteryCharging{false};
-lua::Property UiState::sBluetoothEnabled {
- false, [](const lua::LuaValue& val) {
- if (!std::holds_alternative<bool>(val)) {
- return false;
- }
- if (std::get<bool>(val)) {
- sServices->bluetooth().Enable();
- sServices->bluetooth().SetDeviceDiscovery(true);
- sServices->nvs().OutputMode(drivers::NvsStorage::Output::kBluetooth);
- } else {
- sServices->bluetooth().Disable();
- sServices->nvs().OutputMode(drivers::NvsStorage::Output::kHeadphones);
- }
- events::Audio().Dispatch(audio::OutputModeChanged{});
- return true;
- }
-};
+lua::Property UiState::sBluetoothEnabled{
+ false, [](const lua::LuaValue& val) {
+ if (!std::holds_alternative<bool>(val)) {
+ return false;
+ }
+ if (std::get<bool>(val)) {
+ sServices->nvs().OutputMode(drivers::NvsStorage::Output::kBluetooth);
+ sServices->bluetooth().Enable();
+ sServices->bluetooth().SetDeviceDiscovery(true);
+ } else {
+ sServices->nvs().OutputMode(drivers::NvsStorage::Output::kHeadphones);
+ sServices->bluetooth().Disable();
+ }
+ events::Audio().Dispatch(audio::OutputModeChanged{});
+ return true;
+ }};
lua::Property UiState::sBluetoothConnected{false};
lua::Property UiState::sBluetoothPairedDevice{
std::monostate{}, [](const lua::LuaValue& val) {
if (std::holds_alternative<drivers::bluetooth::Device>(val)) {
auto dev = std::get<drivers::bluetooth::Device>(val);
- sServices->bluetooth().SetPreferredDevice(dev.address);
+ sServices->bluetooth().SetPreferredDevice(
+ drivers::bluetooth::MacAndName{
+ .mac = dev.address,
+ .name = {dev.name.data(), dev.name.size()},
+ });
}
return false;
}};