From 971ec9a75cb961511549be2dad487613b9a60551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Mon, 22 Mar 2021 11:18:30 +0100 Subject: [PATCH] Undo initial testing descriptor read --- nuki/bluez/bluetoothgattdescriptor.cpp | 12 +++++------- nuki/integrationpluginnuki.cpp | 6 ++++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/nuki/bluez/bluetoothgattdescriptor.cpp b/nuki/bluez/bluetoothgattdescriptor.cpp index 35531c9a..c50c1410 100644 --- a/nuki/bluez/bluetoothgattdescriptor.cpp +++ b/nuki/bluez/bluetoothgattdescriptor.cpp @@ -76,13 +76,11 @@ BluetoothGattDescriptor::BluetoothGattDescriptor(const QDBusObjectPath &path, co processProperties(properties); - readValue(); - -// QDBusPendingCall readingCall = m_descriptorInterface->asyncCall("GetAll", QVariantMap()); -// QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(readingCall, this); -// connect(watcher, &QDBusPendingCallWatcher::finished, this, [=](){ -// qCDebug(dcBluez()) << "Get descriptor properties finished"; -// }); + QDBusPendingCall readingCall = m_descriptorInterface->asyncCall("GetAll", QVariantMap()); + QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(readingCall, this); + connect(watcher, &QDBusPendingCallWatcher::finished, this, [=](){ + qCDebug(dcBluez()) << "Get descriptor properties finished"; + }); } void BluetoothGattDescriptor::processProperties(const QVariantMap &properties) diff --git a/nuki/integrationpluginnuki.cpp b/nuki/integrationpluginnuki.cpp index cf0ff92f..915283b7 100644 --- a/nuki/integrationpluginnuki.cpp +++ b/nuki/integrationpluginnuki.cpp @@ -308,8 +308,9 @@ void IntegrationPluginNuki::onBluetoothDiscoveryFinished(ThingDiscoveryInfo *inf m_bluetoothAdapter->stopDiscovering(); foreach (BluetoothDevice *thing, m_bluetoothAdapter->devices()) { - if (!bluetoothDeviceAlreadyAdded(thing->address()) && thing->name().contains("Nuki")) { - ThingDescriptor descriptor(nukiThingClassId, "Nuki", thing->address().toString()); + qCDebug(dcNuki()) << "Found bluetooth device" << thing->name() << thing->address().toString(); + if (!bluetoothDeviceAlreadyAdded(thing->address()) && thing->name().toLower().contains("nuki")) { + qCDebug(dcNuki()) << "Found nuki smart lock which has not been added yet"; // Get serial number from name QString serialNumber; @@ -320,6 +321,7 @@ void IntegrationPluginNuki::onBluetoothDiscoveryFinished(ThingDiscoveryInfo *inf qCWarning(dcNuki()) << "Could not read serial number from bluetooth thing name" << thing->name(); } + ThingDescriptor descriptor(nukiThingClassId, "Nuki", thing->address().toString()); ParamList params; params.append(Param(nukiThingNameParamTypeId, thing->name())); params.append(Param(nukiThingMacParamTypeId, thing->address().toString()));