summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Wassmuth <c.wassmuth@oculus.de>2019-08-22 11:28:02 +0200
committerChristian Waßmuth <c.wassmuth@oculus.de>2019-12-05 13:38:19 +0000
commit27c0ae9ff94d545fb43446179e95276112b9f2cc (patch)
treece75f6b86acc6baa49bbbc73c3a5e46450d7511d
parent85bbb2e2e0e87e1b935a62da0eee44004952c542 (diff)
bluez-dbus: Invalidate btle service when it has disappeared
When a previous existing service UUID has disapperad we will now invalidate that service and remove it from the service list [ChangeLog][QtBluetooth][BlueZ-DBus] Invalidate btle service when it has disappeared Fixes: QTBUG-77766 Change-Id: Id03a054c1f781dbcef5614623c2dae9b156d12e2 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/bluetooth/qlowenergycontroller_bluezdbus.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/bluetooth/qlowenergycontroller_bluezdbus.cpp b/src/bluetooth/qlowenergycontroller_bluezdbus.cpp
index 2a0fafdf..5dde8774 100644
--- a/src/bluetooth/qlowenergycontroller_bluezdbus.cpp
+++ b/src/bluetooth/qlowenergycontroller_bluezdbus.cpp
@@ -112,6 +112,23 @@ void QLowEnergyControllerPrivateBluezDBus::devicePropertiesChanged(
}
}
}
+
+ if (changedProperties.contains(QStringLiteral("UUIDs"))) {
+ const QStringList newUuidStringList = changedProperties.value(QStringLiteral("UUIDs")).toStringList();
+ QVector<QBluetoothUuid> newUuidList;
+ for (const QString &uuidString : newUuidStringList)
+ newUuidList.append(QBluetoothUuid(uuidString));
+
+ for (const QBluetoothUuid &uuid : serviceList.keys()) {
+ if (!newUuidList.contains(uuid)) {
+ qCDebug(QT_BT_BLUEZ) << __func__ << "Service" << uuid << "has been removed";
+ QSharedPointer<QLowEnergyServicePrivate> service = serviceList.take(uuid);
+ service->setController(nullptr);
+ dbusServices.remove(uuid);
+ }
+ }
+ }
+
} else if (interface == QStringLiteral("org.bluez.Battery1")) {
qCDebug(QT_BT_BLUEZ) << "######" << interface << changedProperties;
if (changedProperties.contains(QStringLiteral("Percentage"))) {