summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNedim Hadzic <nhadzic@blackberry.com>2014-02-28 14:42:56 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-06 11:02:15 +0100
commit183c4304f0ad909e729e6ada854ee873617cce51 (patch)
tree93e6d49975f72bbaf6700cccf9487fef7b43179d
parent9e1fa32246f2524d342ca5d0d53c0c8bcd79bd4c (diff)
QNX service discovery for dual mode devices fix
For devices which have standard and LE services LE services were not read. Discovery of all custom services implemented. Change-Id: I41c89d8d4ea442153c12cd647fd2cd1a6dd7f0f7 Reviewed-by: Alex Blasche <alexander.blasche@digia.com> Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp
index 4ef40497..37fabfab 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp
@@ -276,14 +276,14 @@ void QBluetoothServiceDiscoveryAgentPrivate::remoteDevicesChanged(int fd)
pps_decoder_cleanup(&ppsDecoder);
return;
}
-
+ // Checking for standard Bluetooth services
pps_decoder_push(&ppsDecoder, "available_services");
-
+ bool standardService = false;
const char *next_service = 0;
for (int service_count=0; pps_decoder_get_string(&ppsDecoder, 0, &next_service ) == PPS_DECODER_OK; service_count++) {
if (next_service == 0)
break;
-
+ standardService = true;
qCDebug(QT_BT_QNX) << Q_FUNC_INFO << "Service" << next_service;
QBluetoothServiceInfo serviceInfo;
@@ -343,6 +343,9 @@ void QBluetoothServiceDiscoveryAgentPrivate::remoteDevicesChanged(int fd)
}
}
+ if (standardService) // we need to pop back for the LE service scan
+ pps_decoder_pop(&ppsDecoder);
+ //Checking for Bluetooth Low Energy services
pps_decoder_push(&ppsDecoder, "gatt_available_services");
for (int service_count=0; pps_decoder_get_string(&ppsDecoder, 0, &next_service ) == PPS_DECODER_OK; service_count++) {
@@ -350,17 +353,17 @@ void QBluetoothServiceDiscoveryAgentPrivate::remoteDevicesChanged(int fd)
break;
QString lowEnergyUuid(next_service);
- lowEnergyUuid = QStringLiteral("0x") + lowEnergyUuid;
qCDebug(QT_BT_QNX) << "LE Service: " << lowEnergyUuid << next_service;
QBluetoothUuid leUuid;
- //In case of UUIDs that are id development phase (e.g. Texas Instruments SenstorTag LE Device)
- if ( lowEnergyUuid.toUShort(0, 0) == 0 && lowEnergyUuid.contains("000000000000") ) {
- lowEnergyUuid = lowEnergyUuid.remove(0,2);
+ //In case of custom UUIDs (e.g. Texas Instruments SenstorTag LE Device)
+ if ( lowEnergyUuid.length() > 4 ) {
leUuid = QBluetoothUuid(lowEnergyUuid);
}
- else
+ else {// Official UUIDs are presented in 4 characters (for instance 180A)
+ lowEnergyUuid = QStringLiteral("0x") + lowEnergyUuid;
leUuid = QBluetoothUuid(lowEnergyUuid.toUShort(0,0));
+ }
QLowEnergyServiceInfo lowEnergyService(leUuid);
lowEnergyService.setDevice(discoveredDevices.at(0));