diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2014-02-17 11:54:35 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-20 22:29:30 +0100 |
commit | 7326f1789db31fb69c98d7e37a25f08549c73454 (patch) | |
tree | 4b3f8849344bd342e8e28c825c885571f3d0070e /tests | |
parent | dc75ca260e79b01cb5dcbf6682660c948a2935a3 (diff) |
Fix some BTLE service discovery issues
1.) In Bluez avoid incomplete and/or premature finish of service
discovery process.
2.) Add Testcode for
QBluetoothServiceInfo::serviceDiscovered(QLowEnergyServiceInfo) to
bttestui application
Change-Id: I037a6303862dcf2e29aef4b761731b13c85b29aa
Reviewed-by: Nedim Hadzic <nedimhadzija@gmail.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bttestui/btlocaldevice.cpp | 14 | ||||
-rw-r--r-- | tests/bttestui/btlocaldevice.h | 1 |
2 files changed, 14 insertions, 1 deletions
diff --git a/tests/bttestui/btlocaldevice.cpp b/tests/bttestui/btlocaldevice.cpp index b73a2a73..60df26d5 100644 --- a/tests/bttestui/btlocaldevice.cpp +++ b/tests/bttestui/btlocaldevice.cpp @@ -80,6 +80,8 @@ BtLocalDevice::BtLocalDevice(QObject *parent) : serviceAgent = new QBluetoothServiceDiscoveryAgent(this); connect(serviceAgent, SIGNAL(serviceDiscovered(QBluetoothServiceInfo)), this, SLOT(serviceDiscovered(QBluetoothServiceInfo))); + connect(serviceAgent, SIGNAL(serviceDiscovered(QLowEnergyServiceInfo)), + this, SLOT(leServiceDiscovered(QLowEnergyServiceInfo))); connect(serviceAgent, SIGNAL(finished()), this, SLOT(serviceDiscoveryFinished())); connect(serviceAgent, SIGNAL(canceled()), @@ -271,9 +273,13 @@ void BtLocalDevice::stopServiceDiscovery() void BtLocalDevice::serviceDiscovered(const QBluetoothServiceInfo &info) { + QStringList classIds; + const QList<QBluetoothUuid> classIdsList = info.serviceClassUuids(); + foreach (const QBluetoothUuid &id, classIdsList) + classIds.append(id.toString()); qDebug() << "$$ Found new service" << info.device().address().toString() - << info.serviceUuid() << info.serviceName() << info.serviceDescription(); + << info.serviceUuid() << info.serviceName() << info.serviceDescription() << classIds; if (info.serviceUuid() == QBluetoothUuid(QString(TEST_SERVICE_UUID)) || info.serviceClassUuids().contains(QBluetoothUuid(QString(TEST_SERVICE_UUID)))) @@ -294,6 +300,12 @@ void BtLocalDevice::serviceDiscovered(const QBluetoothServiceInfo &info) } } +void BtLocalDevice::leServiceDiscovered(const QLowEnergyServiceInfo &info) +{ + qDebug() << "$$ Found new BTLE service" << info.device().address().toString() + << info.uuid() << info.name(); +} + void BtLocalDevice::serviceDiscoveryFinished() { qDebug() << "###### Service Discovery Finished"; diff --git a/tests/bttestui/btlocaldevice.h b/tests/bttestui/btlocaldevice.h index 759599b7..a9571ecc 100644 --- a/tests/bttestui/btlocaldevice.h +++ b/tests/bttestui/btlocaldevice.h @@ -89,6 +89,7 @@ public slots: void startServiceDiscovery(bool isMinimalDiscovery); void stopServiceDiscovery(); void serviceDiscovered(const QBluetoothServiceInfo &info); + void leServiceDiscovered(const QLowEnergyServiceInfo &leInfo); void serviceDiscoveryFinished(); void serviceDiscoveryCanceled(); void serviceDiscoveryError(QBluetoothServiceDiscoveryAgent::Error error); |