From cdc3ee8b00380ad208561e6c9bf575762fa398fb Mon Sep 17 00:00:00 2001 From: Nedim Hadzic Date: Wed, 19 Feb 2014 15:59:53 +0100 Subject: Renaming QLowEnergyServiceInfo methods Ensures that QLowEnergyServiceInfo and QBluetoothServiceInfo are more alike. Tests and examples updated as well. Change-Id: I0f6a97900891a9673f99578bdc8d156a8c403513 Reviewed-by: Alex Blasche --- .../tst_qbluetoothservicediscoveryagent.cpp | 11 +++++------ .../tst_qlowenergycharacteristicinfo.cpp | 4 ---- .../tst_qlowenergyserviceinfo.cpp | 22 +++++++++------------- tests/bttestui/btlocaldevice.cpp | 2 +- 4 files changed, 15 insertions(+), 24 deletions(-) (limited to 'tests') diff --git a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp index cd5b1166..2355f4d5 100644 --- a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp +++ b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp @@ -190,8 +190,8 @@ void tst_QBluetoothServiceDiscoveryAgent::leServiceDiscoveryDebug(const QLowEner { qDebug() << "Discovered LE service on" << info.device().name() << info.device().address().toString(); - qDebug() << "\tService name:" << info.name(); - qDebug() << "\tUUID:" << info.uuid(); + qDebug() << "\tService name:" << info.serviceName(); + qDebug() << "\tUUID:" << info.serviceUuid(); } static void dumpAttributeVariant(const QVariant &var, const QString indent) @@ -504,9 +504,9 @@ void tst_QBluetoothServiceDiscoveryAgent::tst_serviceDiscovery() *reinterpret_cast(v.constData()); QVERIFY(info.isValid()); - QCOMPARE(info.errorString(), QString()); + QCOMPARE(leController.errorString(), QString()); QVERIFY((info.characteristics().size() > 0)); - qDebug() << "LE Service Connected: " << info.name() << info.uuid(); + qDebug() << "LE Service Connected: " << info.serviceName() << info.serviceUuid(); leTestCounter++; for (int i = 0; i < info.characteristics().size(); i++) QVERIFY(info.characteristics().at(i).isValid()); @@ -531,8 +531,7 @@ void tst_QBluetoothServiceDiscoveryAgent::tst_serviceDiscovery() *reinterpret_cast(v.constData()); QVERIFY(info.isValid()); - QCOMPARE(info.errorString(), QString()); - qDebug() << "LE Service Disconnected: " << info.name() << info.uuid(); + qDebug() << "LE Service Disconnected: " << info.serviceName() << info.serviceUuid(); } else { QFAIL("Unknown type returned by service discovery"); } diff --git a/tests/auto/qlowenergycharacteristicinfo/tst_qlowenergycharacteristicinfo.cpp b/tests/auto/qlowenergycharacteristicinfo/tst_qlowenergycharacteristicinfo.cpp index fa585ffd..fc8095bf 100644 --- a/tests/auto/qlowenergycharacteristicinfo/tst_qlowenergycharacteristicinfo.cpp +++ b/tests/auto/qlowenergycharacteristicinfo/tst_qlowenergycharacteristicinfo.cpp @@ -103,7 +103,6 @@ void tst_QLowEnergyCharacteristicInfo::tst_construction() QCOMPARE(characteristicInfo.name(), QString("")); QCOMPARE(characteristicInfo.isNotificationCharacteristic(), false); QCOMPARE(characteristicInfo.descriptors().count(), 0); - QCOMPARE(characteristicInfo.errorString(), QString("")); } { @@ -118,7 +117,6 @@ void tst_QLowEnergyCharacteristicInfo::tst_construction() QCOMPARE(characteristicInfo.name(), QString("")); QCOMPARE(characteristicInfo.isNotificationCharacteristic(), false); QCOMPARE(characteristicInfo.descriptors().count(), 0); - QCOMPARE(characteristicInfo.errorString(), QString("")); QLowEnergyCharacteristicInfo copyInfo(characteristicInfo); @@ -136,9 +134,7 @@ void tst_QLowEnergyCharacteristicInfo::tst_construction() QCOMPARE(copyInfo.name(), QString("")); QCOMPARE(copyInfo.isNotificationCharacteristic(), false); QCOMPARE(copyInfo.descriptors().count(), 0); - QCOMPARE(copyInfo.errorString(), QString("")); copyInfo.writeValue("test"); - QVERIFY(copyInfo.errorString().size() > 0); } } diff --git a/tests/auto/qlowenergyserviceinfo/tst_qlowenergyserviceinfo.cpp b/tests/auto/qlowenergyserviceinfo/tst_qlowenergyserviceinfo.cpp index 96db5a63..fc3ba25d 100644 --- a/tests/auto/qlowenergyserviceinfo/tst_qlowenergyserviceinfo.cpp +++ b/tests/auto/qlowenergyserviceinfo/tst_qlowenergyserviceinfo.cpp @@ -100,12 +100,11 @@ void tst_QLowEnergyServiceInfo::tst_construction() QLowEnergyServiceInfo serviceInfo; QVERIFY(!serviceInfo.isValid()); - QCOMPARE(serviceInfo.name(), QString()); - QCOMPARE(serviceInfo.uuid().toString(), QBluetoothUuid().toString()); + QCOMPARE(serviceInfo.serviceName(), QString()); + QCOMPARE(serviceInfo.serviceUuid().toString(), QBluetoothUuid().toString()); QCOMPARE(serviceInfo.serviceType(), QLowEnergyServiceInfo::PrimaryService); QCOMPARE(serviceInfo.isConnected(), false); QCOMPARE(serviceInfo.characteristics().size(), 0); - QCOMPARE(serviceInfo.errorString(), QString("")); QCOMPARE(serviceInfo.device(), QBluetoothDeviceInfo()); } @@ -115,20 +114,20 @@ void tst_QLowEnergyServiceInfo::tst_construction() QVERIFY(serviceInfo.isValid()); - QCOMPARE(serviceInfo.uuid().toString(), serviceUuid.toString()); + QCOMPARE(serviceInfo.serviceUuid().toString(), serviceUuid.toString()); QCOMPARE(serviceInfo.device().address(), deviceInfo.address()); QLowEnergyServiceInfo copyInfo(serviceInfo); QVERIFY(copyInfo.isValid()); - QCOMPARE(copyInfo.uuid().toString(), serviceUuid.toString()); + QCOMPARE(copyInfo.serviceUuid().toString(), serviceUuid.toString()); QCOMPARE(copyInfo.device().address(), deviceInfo.address()); copyInfo = QLowEnergyServiceInfo(alternateServiceUuid); copyInfo.setDevice(alternatedeviceInfo); - QCOMPARE(copyInfo.uuid(), alternateServiceUuid); + QCOMPARE(copyInfo.serviceUuid(), alternateServiceUuid); QCOMPARE(copyInfo.device().address(), alternatedeviceInfo.address()); @@ -220,12 +219,11 @@ void tst_QLowEnergyServiceInfo::tst_assignment() QVERIFY(copyInfo.isValid()); QCOMPARE(copyInfo.device().address(), address); - QCOMPARE(copyInfo.uuid(), serviceClassUuid); + QCOMPARE(copyInfo.serviceUuid(), serviceClassUuid); QCOMPARE(copyInfo.device().coreConfiguration(), coreConfiguration); QCOMPARE(copyInfo.serviceType(), serviceType); QCOMPARE(copyInfo.isConnected(), false); QCOMPARE(copyInfo.characteristics().size(), 0); - QCOMPARE(copyInfo.errorString(), QString("")); QCOMPARE(copyInfo.device(), deviceInfo); } @@ -239,7 +237,7 @@ void tst_QLowEnergyServiceInfo::tst_assignment() QVERIFY(copyInfo.isValid()); QCOMPARE(copyInfo.device().address(), address); - QCOMPARE(copyInfo.uuid(), serviceClassUuid); + QCOMPARE(copyInfo.serviceUuid(), serviceClassUuid); QCOMPARE(copyInfo.device().coreConfiguration(), coreConfiguration); QCOMPARE(copyInfo.serviceType(), serviceType); } @@ -259,8 +257,8 @@ void tst_QLowEnergyServiceInfo::tst_assignment() QCOMPARE(copyInfo1.device().address(), address); QCOMPARE(copyInfo2.device().address(), address); - QCOMPARE(copyInfo1.uuid(), serviceClassUuid); - QCOMPARE(copyInfo2.uuid(), serviceClassUuid); + QCOMPARE(copyInfo1.serviceUuid(), serviceClassUuid); + QCOMPARE(copyInfo2.serviceUuid(), serviceClassUuid); QCOMPARE(copyInfo1.serviceType(), serviceType); QCOMPARE(copyInfo2.serviceType(), serviceType); QCOMPARE(copyInfo1.device().coreConfiguration(), coreConfiguration); @@ -269,8 +267,6 @@ void tst_QLowEnergyServiceInfo::tst_assignment() QCOMPARE(copyInfo2.isConnected(), false); QCOMPARE(copyInfo1.characteristics().size(), 0); QCOMPARE(copyInfo2.characteristics().size(), 0); - QCOMPARE(copyInfo1.errorString(), QString("")); - QCOMPARE(copyInfo2.errorString(), QString("")); QCOMPARE(copyInfo1.device(), deviceInfo); QCOMPARE(copyInfo2.device(), deviceInfo); } diff --git a/tests/bttestui/btlocaldevice.cpp b/tests/bttestui/btlocaldevice.cpp index 60df26d5..fc3a6104 100644 --- a/tests/bttestui/btlocaldevice.cpp +++ b/tests/bttestui/btlocaldevice.cpp @@ -303,7 +303,7 @@ 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(); + << info.serviceUuid() << info.serviceName(); } void BtLocalDevice::serviceDiscoveryFinished() -- cgit v1.2.3