diff options
author | Alex Blasche <alexander.blasche@theqtcompany.com> | 2016-06-10 16:35:05 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2016-06-17 06:44:24 +0000 |
commit | 701670ec91fdd2ccafc334a73c50c94abd5c62db (patch) | |
tree | f270977bfee71c46452ade9756375577a1d4dd7f /src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp | |
parent | cb0975669e136acf2bca30d75cc9ff94f9d778f2 (diff) |
Android: Allow to set BTLE device search timeout
Task-number: QTBUG-53012
Change-Id: I282cb76871eec857b6df8001f9f726ee4ce91e29
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Diffstat (limited to 'src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp index 1d5e2c99..adcd7f50 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp @@ -66,7 +66,7 @@ QBluetoothDeviceDiscoveryAgentPrivate::QBluetoothDeviceDiscoveryAgentPrivate( leScanTimeout(0), pendingCancel(false), pendingStart(false), - lowEnergySearchTimeout(-1), //TODO change when implemented + lowEnergySearchTimeout(25000), q_ptr(parent) { adapter = QAndroidJniObject::callStaticObjectMethod("android/bluetooth/BluetoothAdapter", @@ -279,15 +279,18 @@ void QBluetoothDeviceDiscoveryAgentPrivate::startLowEnergyScan() return; } + // wait interval and sum up what was found if (!leScanTimeout) { leScanTimeout = new QTimer(this); leScanTimeout->setSingleShot(true); - leScanTimeout->setInterval(25000); connect(leScanTimeout, &QTimer::timeout, this, &QBluetoothDeviceDiscoveryAgentPrivate::stopLowEnergyScan); } - leScanTimeout->start(); + if (lowEnergySearchTimeout > 0) { // otherwise no timeout and stop() required + leScanTimeout->setInterval(lowEnergySearchTimeout); + leScanTimeout->start(); + } } void QBluetoothDeviceDiscoveryAgentPrivate::stopLowEnergyScan() |