diff options
author | Alex Blasche <alexander.blasche@theqtcompany.com> | 2016-07-08 14:27:00 +0200 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> | 2016-07-13 09:50:41 +0000 |
commit | 1de888375e3bafb44c9cc8dafce68e2b6b4f7a48 (patch) | |
tree | d7245429a761fb8ed744c6187d3a4c6706368a38 /src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp | |
parent | 5ce6ed270db4a693f62c14347203d7b367a56488 (diff) |
Permit selection of discovery mode (btle vs classic)
This change introduces the new API but does not yet implement the specific selection.
In any case BlueZ does not need any specific implementation as classic and BTLE
devices are found using the same method. iOS does not need any specific implementation
as it only supports BTLE discovery.
Task-number: QTBUG-46253
Change-Id: Ie6365966091effe5f3a68f8a283657c7cb43b692
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Diffstat (limited to 'src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp index 43f5ce1d..5288eaf8 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp @@ -117,8 +117,17 @@ bool QBluetoothDeviceDiscoveryAgentPrivate::isActive() const return (adapter || adapterBluez5); } -void QBluetoothDeviceDiscoveryAgentPrivate::start() +QBluetoothDeviceDiscoveryAgent::DiscoveryMethods QBluetoothDeviceDiscoveryAgent::supportedDiscoveryMethods() { + return (ClassicMethod | LowEnergyMethod); +} + +void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent::DiscoveryMethods /*methods*/) +{ + // Currently both BlueZ backends do not distinguish discovery methods. + // The DBus API's always return both device types. Therefore we ignore + // the passed in methods. + if (pendingCancel == true) { pendingStart = true; return; @@ -440,7 +449,9 @@ void QBluetoothDeviceDiscoveryAgentPrivate::_q_propertyChanged(const QString &na pendingStart = false; pendingCancel = false; - start(); + // start parameter ignored since Bluez 4 doesn't distinguish them + start(QBluetoothDeviceDiscoveryAgent::ClassicMethod + | QBluetoothDeviceDiscoveryAgent::LowEnergyMethod); } else { // happens when agent is created while other agent called StopDiscovery() if (!adapter) @@ -518,7 +529,8 @@ void QBluetoothDeviceDiscoveryAgentPrivate::_q_discoveryFinished() } else if (pendingStart) { pendingStart = false; pendingCancel = false; - start(); + start(QBluetoothDeviceDiscoveryAgent::ClassicMethod + | QBluetoothDeviceDiscoveryAgent::LowEnergyMethod); } else { emit q->finished(); } |