summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2018-09-25 15:20:33 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-09-25 16:41:13 -0700
commit0ba105d2a71d65fb272837a753bf54c3e5094f8f (patch)
treed1bb5c2cd9b2b9318ce5cace49625d0cf4e3d0b1 /core
parentb19fe27e19e4174930ab1fb8983c532d92fc6d56 (diff)
downloadsubsurface-0ba105d2a71d65fb272837a753bf54c3e5094f8f.tar.gz
qt-ble: only connect the signals to the preferred service
We used to just find all services and connect the characteristics change signal etc to them all, but we really only care about the actual preferred service that we'll be using. So move the qt ble signal connection to after we've selected the preferred service that we will actually be enabling notifications on and do the writes to. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'core')
-rw-r--r--core/qt-ble.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/core/qt-ble.cpp b/core/qt-ble.cpp
index 6ddc1a9b8..4fc2cd5df 100644
--- a/core/qt-ble.cpp
+++ b/core/qt-ble.cpp
@@ -100,10 +100,6 @@ void BLEObject::addService(const QBluetoothUuid &newService)
qDebug() << " .. created service object" << service;
if (service) {
services.append(service);
- connect(service, &QLowEnergyService::stateChanged, this, &BLEObject::serviceStateChanged);
- connect(service, &QLowEnergyService::characteristicChanged, this, &BLEObject::characteristcStateChanged);
- connect(service, &QLowEnergyService::characteristicWritten, this, &BLEObject::characteristicWritten);
- connect(service, &QLowEnergyService::descriptorWritten, this, &BLEObject::writeCompleted);
service->discoverDetails();
}
}
@@ -285,6 +281,11 @@ dc_status_t BLEObject::select_preferred_service(void)
return DC_STATUS_IO;
}
+ connect(preferred, &QLowEnergyService::stateChanged, this, &BLEObject::serviceStateChanged);
+ connect(preferred, &QLowEnergyService::characteristicChanged, this, &BLEObject::characteristcStateChanged);
+ connect(preferred, &QLowEnergyService::characteristicWritten, this, &BLEObject::characteristicWritten);
+ connect(preferred, &QLowEnergyService::descriptorWritten, this, &BLEObject::writeCompleted);
+
return DC_STATUS_SUCCESS;
}