diff options
author | Alex Blasche <alexander.blasche@theqtcompany.com> | 2016-05-25 16:49:57 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2016-06-08 09:40:55 +0000 |
commit | be8c8951744558070d72665f111909fb32b70d4f (patch) | |
tree | 2bddf1521626c06f2a34399a933179c40ab062f2 /src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp | |
parent | f59d75eb8b161be9c58d1fe534afa2fa08cf4382 (diff) |
Bluez5: Run SDP on target devices which do not support public scans
PUBLIC_BROWSE_GROUP scans are not always supported. In such cases
more targeted service scans are to be used. This patch modifies
QBluetoothServiceDiscoveryAgent such that when a uuid filter
is set targeted service scans are used rather than generic
PUBLIC_BROWSE_GROUP ones.
QBluetoothSocket always scans with an applied uuid filter and
therefore directly benefits from the patch.
Change-Id: I94997d2cf8f70fa7db5422d78c8bfdbe2aa1dbbc
Task-number: QTBUG-53041
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Diffstat (limited to 'src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp index e24ee802..716d80be 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp @@ -214,15 +214,23 @@ void QBluetoothServiceDiscoveryAgentPrivate::runExternalSdpScan( sdpScannerProcess = new QProcess(q); sdpScannerProcess->setReadChannel(QProcess::StandardOutput); + if (QT_BT_BLUEZ().isDebugEnabled()) + sdpScannerProcess->setProcessChannelMode(QProcess::ForwardedErrorChannel); sdpScannerProcess->setProgram(fileInfo.canonicalFilePath()); q->connect(sdpScannerProcess, SIGNAL(finished(int,QProcess::ExitStatus)), q, SLOT(_q_sdpScannerDone(int,QProcess::ExitStatus))); - } QStringList arguments; arguments << remoteAddress.toString() << localAddress.toString(); + // No filter implies PUBLIC_BROWSE_GROUP based SDP scan + if (!uuidFilter.isEmpty()) { + arguments << QLatin1String("-u"); // cmd line option for list of uuids + foreach (const QBluetoothUuid& uuid, uuidFilter) + arguments << uuid.toString(); + } + sdpScannerProcess->setArguments(arguments); sdpScannerProcess->start(); } |