From 33b19759ff265d669ced2e406a90ccadcec9e755 Mon Sep 17 00:00:00 2001 From: Bartosz Cichocki Date: Tue, 12 Oct 2021 12:01:00 +0200 Subject: [PATCH] [EGD-7440] Fix BT statusbar after BT disconnect BT statusbar was set by disconnect message, which was not aware of BT on/off status, thus always after disconnect the statusbar icon was set to idle/enabled --- module-services/service-bluetooth/ServiceBluetooth.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/module-services/service-bluetooth/ServiceBluetooth.cpp b/module-services/service-bluetooth/ServiceBluetooth.cpp index 254d8f62319125002b2be3063e03b90eb8e86d79..d1573648a65d2f9184098efea7118993229fd96c 100644 --- a/module-services/service-bluetooth/ServiceBluetooth.cpp +++ b/module-services/service-bluetooth/ServiceBluetooth.cpp @@ -334,8 +334,12 @@ auto ServiceBluetooth::handle(message::bluetooth::DisconnectResult *msg) -> std: } bluetoothDevicesModel->syncDevicesWithApp(); settingsHolder->setValue(bluetooth::Settings::ConnectedDevice, std::string()); - bus.sendMulticast(std::make_shared(sys::bluetooth::BluetoothMode::Enabled), - sys::BusChannel::BluetoothModeChanges); + + if (auto btOn = std::visit(bluetooth::BoolVisitor(), settingsHolder->getValue(bluetooth::Settings::State)); btOn) { + bus.sendMulticast( + std::make_shared(sys::bluetooth::BluetoothMode::Enabled), + sys::BusChannel::BluetoothModeChanges); + } bus.sendMulticast(std::make_shared(msg->getDevice()), sys::BusChannel::BluetoothNotifications);