summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlowenergycontroller
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-06-25 14:11:08 +0200
committerAlex Blasche <alexander.blasche@digia.com>2014-06-26 16:36:40 +0200
commit87192100ccd7ba04e81610ca7a74988462d795ae (patch)
tree0de0902f5f2bf109d32328e5717b3620f09157c4 /tests/auto/qlowenergycontroller
parent004491a61de53d128aade26d497dcf7a557e09c4 (diff)
Fix a bug whereby the last descriptor of a service was always skipped
This was caused by the service end handle being used as starting handle for the next service. Very often the last service handle is a descriptor attribute. Most debug output shifted to categorised logging. Change-Id: I6cdd4a6bc43a6290c42674c805d4be2da9d48977 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Diffstat (limited to 'tests/auto/qlowenergycontroller')
-rw-r--r--tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp55
1 files changed, 45 insertions, 10 deletions
diff --git a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
index 62108e32..e8794f6d 100644
--- a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
+++ b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
@@ -839,11 +839,6 @@ void tst_QLowEnergyController::tst_connectNew()
QCOMPARE(stateSpy.count(), 2); //
verifyServiceProperties(service);
-
-// for (int i = 0; i < stateSpy.count(); i++) {
-// const QVariant v = stateSpy[i].at(0);
-// //qDebug() << v;
-// }
}
}
@@ -1081,7 +1076,15 @@ void tst_QLowEnergyController::verifyServiceProperties(
(QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Write));
QCOMPARE(chars[1].value(), QByteArray("00"));
QVERIFY(chars[1].isValid());
- QCOMPARE(chars[1].descriptors().count(), 0);
+
+ QCOMPARE(chars[1].descriptors().count(), 1);
+ //descriptor checks
+ QCOMPARE(chars[1].descriptors().at(0).isValid(), true);
+ QCOMPARE(chars[1].descriptors().at(0).handle(), 0x2au);
+ QCOMPARE(chars[1].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[1].descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
} else if (info->serviceUuid() ==
QBluetoothUuid(QString("0000ffe0-0000-1000-8000-00805f9b34fb"))) {
qDebug() << "Verifying Simple Keys";
@@ -1172,7 +1175,15 @@ void tst_QLowEnergyController::verifyServiceProperties(
(QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Write));
QCOMPARE(chars[2].value(), QByteArray("64")); // don't change it or set it to 0x64
QVERIFY(chars[2].isValid());
- QCOMPARE(chars[2].descriptors().count(), 0);
+
+ QCOMPARE(chars[2].descriptors().count(), 1);
+ //descriptor checks
+ QCOMPARE(chars[2].descriptors().at(0).isValid(), true);
+ QCOMPARE(chars[2].descriptors().at(0).handle(), 0x35u);
+ QCOMPARE(chars[2].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[2].descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
} else if (info->serviceUuid() ==
QBluetoothUuid(QString("f000aa20-0451-4000-b000-000000000000"))) {
qDebug() << "Verifying Humidity";
@@ -1212,7 +1223,15 @@ void tst_QLowEnergyController::verifyServiceProperties(
(QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Write));
QCOMPARE(chars[1].value(), QByteArray("00"));
QVERIFY(chars[1].isValid());
- QCOMPARE(chars[1].descriptors().count(), 0);
+
+ QCOMPARE(chars[1].descriptors().count(), 1);
+ //descriptor checks
+ QCOMPARE(chars[1].descriptors().at(0).isValid(), true);
+ QCOMPARE(chars[1].descriptors().at(0).handle(), 0x3du);
+ QCOMPARE(chars[1].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[1].descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
} else if (info->serviceUuid() ==
QBluetoothUuid(QString("f000aa30-0451-4000-b000-000000000000"))) {
qDebug() << "Verifying Magnetometer";
@@ -1392,7 +1411,15 @@ void tst_QLowEnergyController::verifyServiceProperties(
(QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Write));
QCOMPARE(chars[1].value(), QByteArray("00"));
QVERIFY(chars[1].isValid());
- QCOMPARE(chars[1].descriptors().count(), 0);
+
+ QCOMPARE(chars[1].descriptors().count(), 1);
+ //descriptor checks
+ QCOMPARE(chars[1].descriptors().at(0).isValid(), true);
+ QCOMPARE(chars[1].descriptors().at(0).handle(), 0x5cu);
+ QCOMPARE(chars[1].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[1].descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
} else if (info->serviceUuid() ==
QBluetoothUuid(QString("f000aa60-0451-4000-b000-000000000000"))) {
qDebug() << "Verifying Test Service";
@@ -1424,7 +1451,15 @@ void tst_QLowEnergyController::verifyServiceProperties(
(QLowEnergyCharacteristic::Read|QLowEnergyCharacteristic::Write));
QCOMPARE(chars[1].value(), QByteArray("00"));
QVERIFY(chars[1].isValid());
- QCOMPARE(chars[1].descriptors().count(), 0);
+
+ QCOMPARE(chars[1].descriptors().count(), 1);
+ //descriptor checks
+ QCOMPARE(chars[1].descriptors().at(0).isValid(), true);
+ QCOMPARE(chars[1].descriptors().at(0).handle(), 0x68u);
+ QCOMPARE(chars[1].descriptors().at(0).uuid(),
+ QBluetoothUuid(QBluetoothUuid::CharacteristicUserDescription));
+ QCOMPARE(chars[1].descriptors().at(0).type(),
+ QBluetoothUuid::CharacteristicUserDescription);
} else if (info->serviceUuid() ==
QBluetoothUuid(QString("f000ffc0-0451-4000-b000-000000000000"))) {
qDebug() << "Verifying Unknown Service";