summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-06-19 15:05:39 +0200
committerAlex Blasche <alexander.blasche@digia.com>2014-06-20 16:55:21 +0200
commit0576823fc0c4595208b3569e804224534fd3ec72 (patch)
tree23d709859be332262fba5e97a88d253b5e13da06 /tests
parent0a2838e25e5be4779ea719a3a68d62eff2150d45 (diff)
Send and process ReadByType request/responses
The characteristic information is not yet incorporated into the internal QLEService data strcutures. This change introduces the concept of a pending request queue to be able to refer to the request's context information when processing the response. Change-Id: Id699856543b0fd3a8471721b48679f917096a99b Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
index 61f3e460..0c9e051c 100644
--- a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
+++ b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
@@ -803,6 +803,7 @@ void tst_QLowEnergyController::tst_connectNew()
QTRY_VERIFY_WITH_TIMEOUT(discoveryFinishedSpy.count() == 1, 10000);
QCOMPARE(serviceFoundSpy.count(), foundServices.count());
+ QVERIFY(!serviceFoundSpy.isEmpty());
QList<QBluetoothUuid> listing;
for (int i = 0; i < serviceFoundSpy.count(); i++) {
const QVariant v = serviceFoundSpy[i].at(0);
@@ -819,6 +820,26 @@ void tst_QLowEnergyController::tst_connectNew()
QCOMPARE(service->type(), QLowEnergyService::PrimaryService);
QCOMPARE(service->state(), QLowEnergyService::DiscoveryRequired);
}
+
+ // initiate characteristic discovery
+ foreach (QLowEnergyService *service, savedReferences) {
+ //qDebug() << "Discoverying" << service->serviceUuid();
+ QSignalSpy stateSpy(service,
+ SIGNAL(stateChanged(QLowEnergyService::ServiceState)));
+ QSignalSpy errorSpy(service, SIGNAL(error(QLowEnergyService::ServiceError)));
+ service->discoverDetails();
+
+ QTRY_VERIFY_WITH_TIMEOUT(
+ service->state() == QLowEnergyService::ServiceDiscovered, 10000);
+
+ QCOMPARE(errorSpy.count(), 0); //no error
+ QCOMPARE(stateSpy.count(), 2); //
+
+// for (int i = 0; i < stateSpy.count(); i++) {
+// const QVariant v = stateSpy[i].at(0);
+// //qDebug() << v;
+// }
+ }
}
// Finish off