diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2014-08-21 12:15:20 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@digia.com> | 2014-09-03 08:38:55 +0200 |
commit | 5a694018992051a3c99339d5860eda4bbb703275 (patch) | |
tree | 6e9cf5f194873509fac7abc3c730184b929cb0ef /tests | |
parent | da7ccfcd08c587283f4656b30ca15011ebdbeb5c (diff) |
Remove QLowEnergyServiceInfo
There is no need for this class anymore as QBluetoothServiceInfo
covers the same information.
Change-Id: I411a8abb68b34a3a4893a67ee9fac096f44bbd62
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/auto.pro | 1 | ||||
-rw-r--r-- | tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp | 30 | ||||
-rw-r--r-- | tests/auto/qlowenergyserviceinfo/qlowenergyserviceinfo.pro | 9 | ||||
-rw-r--r-- | tests/auto/qlowenergyserviceinfo/tst_qlowenergyserviceinfo.cpp | 243 | ||||
-rw-r--r-- | tests/bttestui/btlocaldevice.cpp | 8 | ||||
-rw-r--r-- | tests/bttestui/btlocaldevice.h | 1 |
6 files changed, 0 insertions, 292 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 8966e5d9..a5e66030 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -19,7 +19,6 @@ qtHaveModule(bluetooth) { qbluetoothserver \ qlowenergycharacteristic \ qlowenergydescriptor \ - qlowenergyserviceinfo \ qlowenergycontroller } diff --git a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp index 253ca50a..5e832f2c 100644 --- a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp +++ b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp @@ -43,13 +43,11 @@ #include <qbluetoothlocaldevice.h> #include <qbluetoothserver.h> #include <qbluetoothserviceinfo.h> -#include <qlowenergyserviceinfo.h> QT_USE_NAMESPACE Q_DECLARE_METATYPE(QBluetoothDeviceInfo) Q_DECLARE_METATYPE(QBluetoothServiceDiscoveryAgent::Error) -Q_DECLARE_METATYPE(QLowEnergyServiceInfo) // Maximum time to for bluetooth device scan const int MaxScanTime = 5 * 60 * 1000; // 5 minutes in ms @@ -65,7 +63,6 @@ public: public slots: void deviceDiscoveryDebug(const QBluetoothDeviceInfo &info); void serviceDiscoveryDebug(const QBluetoothServiceInfo &info); - void leServiceDiscoveryDebug(const QLowEnergyServiceInfo &info); void serviceError(const QBluetoothServiceDiscoveryAgent::Error err); private slots: @@ -95,7 +92,6 @@ tst_QBluetoothServiceDiscoveryAgent::tst_QBluetoothServiceDiscoveryAgent() qRegisterMetaType<QBluetoothDeviceInfo>("QBluetoothDeviceInfo"); qRegisterMetaType<QBluetoothServiceInfo>("QBluetoothServiceInfo"); - qRegisterMetaType<QLowEnergyServiceInfo>("QLowEnergyServiceInfo"); qRegisterMetaType<QList<QBluetoothUuid> >("QList<QBluetoothUuid>"); qRegisterMetaType<QBluetoothServiceDiscoveryAgent::Error>("QBluetoothServiceDiscoveryAgent::Error"); qRegisterMetaType<QBluetoothDeviceDiscoveryAgent::Error>("QBluetoothDeviceDiscoveryAgent::Error"); @@ -176,14 +172,6 @@ void tst_QBluetoothServiceDiscoveryAgent::serviceDiscoveryDebug(const QBluetooth qDebug() << "\tRFCOMM server channel:" << info.serverChannel(); } -void tst_QBluetoothServiceDiscoveryAgent::leServiceDiscoveryDebug(const QLowEnergyServiceInfo &info) -{ - qDebug() << "Discovered LE service on" - << info.device().name() << info.device().address().toString(); - qDebug() << "\tService name:" << info.serviceName(); - qDebug() << "\tUUID:" << info.serviceUuid(); -} - static void dumpAttributeVariant(const QVariant &var, const QString indent) { if (!var.isValid()) { @@ -387,11 +375,8 @@ void tst_QBluetoothServiceDiscoveryAgent::tst_serviceDiscovery() QSignalSpy finishedSpy(&discoveryAgent, SIGNAL(finished())); QSignalSpy errorSpy(&discoveryAgent, SIGNAL(error(QBluetoothServiceDiscoveryAgent::Error))); QSignalSpy discoveredSpy(&discoveryAgent, SIGNAL(serviceDiscovered(QBluetoothServiceInfo))); - QSignalSpy leDiscoveredSpy(&discoveryAgent, SIGNAL(serviceDiscovered(QLowEnergyServiceInfo))); // connect(&discoveryAgent, SIGNAL(serviceDiscovered(QBluetoothServiceInfo)), // this, SLOT(serviceDiscoveryDebug(QBluetoothServiceInfo))); -// connect(&discoveryAgent, SIGNAL(serviceDiscovered(QLowEnergyServiceInfo)), -// this, SLOT(leServiceDiscoveryDebug(QLowEnergyServiceInfo))); connect(&discoveryAgent, SIGNAL(error(QBluetoothServiceDiscoveryAgent::Error)), this, SLOT(serviceError(QBluetoothServiceDiscoveryAgent::Error))); @@ -457,21 +442,6 @@ void tst_QBluetoothServiceDiscoveryAgent::tst_serviceDiscovery() } - while (!leDiscoveredSpy.isEmpty()) { - const QVariant v = leDiscoveredSpy.takeFirst().at(0); - if (v.userType() == qMetaTypeId<QLowEnergyServiceInfo>()) - { - const QLowEnergyServiceInfo info = - *reinterpret_cast<const QLowEnergyServiceInfo*>(v.constData()); - - QVERIFY(info.isValid()); - QVERIFY(info.device().coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration); - } else { - QFAIL("Unknown type returned by service discovery"); - } - - } - QVERIFY(discoveryAgent.discoveredServices().count() != 0); discoveryAgent.clear(); QVERIFY(discoveryAgent.discoveredServices().count() == 0); diff --git a/tests/auto/qlowenergyserviceinfo/qlowenergyserviceinfo.pro b/tests/auto/qlowenergyserviceinfo/qlowenergyserviceinfo.pro deleted file mode 100644 index 1dd24a97..00000000 --- a/tests/auto/qlowenergyserviceinfo/qlowenergyserviceinfo.pro +++ /dev/null @@ -1,9 +0,0 @@ -SOURCES += tst_qlowenergyserviceinfo.cpp -TARGET = tst_qlowenergyserviceinfo -CONFIG += testcase - -QT = core bluetooth testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -blackberry { - LIBS += -lbtapi -} diff --git a/tests/auto/qlowenergyserviceinfo/tst_qlowenergyserviceinfo.cpp b/tests/auto/qlowenergyserviceinfo/tst_qlowenergyserviceinfo.cpp deleted file mode 100644 index 23ea6dd2..00000000 --- a/tests/auto/qlowenergyserviceinfo/tst_qlowenergyserviceinfo.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/*************************************************************************** -** -** Copyright (C) 2013 BlackBerry Limited all rights reserved -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtBluetooth module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtTest/QtTest> -#include <QUuid> - -#include <QDebug> - -#include <qbluetoothdeviceinfo.h> -#include <qlowenergyserviceinfo.h> -#include <qbluetoothaddress.h> -#include <qbluetoothlocaldevice.h> -#include <qbluetoothuuid.h> - -QT_USE_NAMESPACE - -Q_DECLARE_METATYPE(QUuid) -Q_DECLARE_METATYPE(QBluetoothDeviceInfo::CoreConfiguration) -Q_DECLARE_METATYPE(QLowEnergyServiceInfo) -Q_DECLARE_METATYPE(QBluetoothUuid::ServiceClassUuid) - -class tst_QLowEnergyServiceInfo : public QObject -{ - Q_OBJECT - -public: - tst_QLowEnergyServiceInfo(); - ~tst_QLowEnergyServiceInfo(); - -private slots: - void initTestCase(); - void tst_construction(); - void tst_assignment_data(); - void tst_assignment(); -}; - -tst_QLowEnergyServiceInfo::tst_QLowEnergyServiceInfo() -{ -} - -tst_QLowEnergyServiceInfo::~tst_QLowEnergyServiceInfo() -{ -} - -void tst_QLowEnergyServiceInfo::initTestCase() -{ - // start Bluetooth if not started - QBluetoothLocalDevice *device = new QBluetoothLocalDevice(); - device->powerOn(); - delete device; -} - -void tst_QLowEnergyServiceInfo::tst_construction() -{ - const QBluetoothUuid serviceUuid(QBluetoothUuid::HeartRate); - const QBluetoothUuid alternateServiceUuid(QBluetoothUuid::BatteryService); - const QBluetoothDeviceInfo deviceInfo(QBluetoothAddress("001122334455"), "Test Device", 0); - const QBluetoothDeviceInfo alternatedeviceInfo(QBluetoothAddress("554433221100"), "Test Device2", 0); - - { - QLowEnergyServiceInfo serviceInfo; - - QVERIFY(!serviceInfo.isValid()); - QCOMPARE(serviceInfo.serviceName(), QStringLiteral("Unknown Service")); - QCOMPARE(serviceInfo.serviceUuid().toString(), QBluetoothUuid().toString()); - QCOMPARE(serviceInfo.device(), QBluetoothDeviceInfo()); - } - - { - QLowEnergyServiceInfo serviceInfo(serviceUuid); - serviceInfo.setDevice(deviceInfo); - - QVERIFY(serviceInfo.isValid()); - - QCOMPARE(serviceInfo.serviceUuid().toString(), serviceUuid.toString()); - QCOMPARE(serviceInfo.device().address(), deviceInfo.address()); - - QLowEnergyServiceInfo copyInfo(serviceInfo); - - QVERIFY(copyInfo.isValid()); - - QCOMPARE(copyInfo.serviceUuid().toString(), serviceUuid.toString()); - QCOMPARE(copyInfo.device().address(), deviceInfo.address()); - - - copyInfo = QLowEnergyServiceInfo(alternateServiceUuid); - copyInfo.setDevice(alternatedeviceInfo); - QCOMPARE(copyInfo.serviceUuid(), alternateServiceUuid); - - QCOMPARE(copyInfo.device().address(), alternatedeviceInfo.address()); - - } -} - -void tst_QLowEnergyServiceInfo::tst_assignment_data() -{ - QTest::addColumn<QBluetoothAddress>("address"); - QTest::addColumn<QString>("name"); - QTest::addColumn<quint32>("classOfDevice"); - QTest::addColumn<QBluetoothUuid>("serviceClassUuid"); - QTest::addColumn<QBluetoothDeviceInfo::CoreConfiguration>("coreConfiguration"); - - // bits 12-8 Major - // bits 7-2 Minor - // bits 1-0 0 - - QTest::newRow("0x000000 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device" - << quint32(0x000000) - << QBluetoothUuid(QBluetoothUuid::GenericAccess) - << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration; - QTest::newRow("0x000100 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device" - << quint32(0x000100) - << QBluetoothUuid(QBluetoothUuid::GenericAttribute) - << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration; - QTest::newRow("0x000104 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device" - << quint32(0x000104) - << QBluetoothUuid(QBluetoothUuid::HeartRate) - << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration; - QTest::newRow("0x000118 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device" - << quint32(0x000118) - << QBluetoothUuid(QBluetoothUuid::CyclingSpeedAndCadence) - << QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration; - QTest::newRow("0x000200 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device" - << quint32(0x000200) - << QBluetoothUuid(QBluetoothUuid::CyclingPower) - << QBluetoothDeviceInfo::LowEnergyCoreConfiguration; - QTest::newRow("0x000204 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device" - << quint32(0x000204) - << QBluetoothUuid(QBluetoothUuid::ScanParameters) - << QBluetoothDeviceInfo::LowEnergyCoreConfiguration; - QTest::newRow("0x000214 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device" - << quint32(0x000214) - << QBluetoothUuid(QBluetoothUuid::DeviceInformation) - << QBluetoothDeviceInfo::LowEnergyCoreConfiguration; - QTest::newRow("0x000300 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device" - << quint32(0x000300) - << QBluetoothUuid(QBluetoothUuid::CurrentTimeService) - << QBluetoothDeviceInfo::LowEnergyCoreConfiguration; - QTest::newRow("0x000320 COD") << QBluetoothAddress("000000000000") << "My Bluetooth Device" - << quint32(0x000320) - << QBluetoothUuid(QBluetoothUuid::LocationAndNavigation) - << QBluetoothDeviceInfo::LowEnergyCoreConfiguration; -} - -void tst_QLowEnergyServiceInfo::tst_assignment() -{ - QFETCH(QBluetoothAddress, address); - QFETCH(QString, name); - QFETCH(quint32, classOfDevice); - QFETCH(QBluetoothUuid, serviceClassUuid); - QFETCH(QBluetoothDeviceInfo::CoreConfiguration, coreConfiguration); - - QBluetoothDeviceInfo deviceInfo(address, name, classOfDevice); - deviceInfo.setCoreConfigurations(coreConfiguration); - QCOMPARE(deviceInfo.coreConfigurations(), coreConfiguration); - - QLowEnergyServiceInfo serviceInfo(serviceClassUuid); - serviceInfo.setDevice(deviceInfo); - QCOMPARE(serviceInfo.device(), deviceInfo); - - QVERIFY(serviceInfo.isValid()); - - { - QLowEnergyServiceInfo copyInfo = serviceInfo; - - QVERIFY(copyInfo.isValid()); - - QCOMPARE(copyInfo.device().address(), address); - QCOMPARE(copyInfo.serviceUuid(), serviceClassUuid); - QCOMPARE(copyInfo.device().coreConfigurations(), coreConfiguration); - QCOMPARE(copyInfo.device(), deviceInfo); - } - - { - QLowEnergyServiceInfo copyInfo; - - QVERIFY(!copyInfo.isValid()); - - copyInfo = serviceInfo; - - QVERIFY(copyInfo.isValid()); - - QCOMPARE(copyInfo.device().address(), address); - QCOMPARE(copyInfo.serviceUuid(), serviceClassUuid); - QCOMPARE(copyInfo.device().coreConfigurations(), coreConfiguration); - } - - { - QLowEnergyServiceInfo copyInfo1; - QLowEnergyServiceInfo copyInfo2; - - QVERIFY(!copyInfo1.isValid()); - QVERIFY(!copyInfo2.isValid()); - - copyInfo1 = copyInfo2 = serviceInfo; - - QVERIFY(copyInfo1.isValid()); - QVERIFY(copyInfo2.isValid()); - - QCOMPARE(copyInfo1.device().address(), address); - QCOMPARE(copyInfo2.device().address(), address); - QCOMPARE(copyInfo1.serviceUuid(), serviceClassUuid); - QCOMPARE(copyInfo2.serviceUuid(), serviceClassUuid); - QCOMPARE(copyInfo1.device().coreConfigurations(), coreConfiguration); - QCOMPARE(copyInfo2.device().coreConfigurations(), coreConfiguration); - QCOMPARE(copyInfo1.device(), deviceInfo); - QCOMPARE(copyInfo2.device(), deviceInfo); - } -} - -QTEST_MAIN(tst_QLowEnergyServiceInfo) - -#include "tst_qlowenergyserviceinfo.moc" diff --git a/tests/bttestui/btlocaldevice.cpp b/tests/bttestui/btlocaldevice.cpp index 247c00e6..fcc0494a 100644 --- a/tests/bttestui/btlocaldevice.cpp +++ b/tests/bttestui/btlocaldevice.cpp @@ -75,8 +75,6 @@ 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()), @@ -325,12 +323,6 @@ void BtLocalDevice::serviceDiscovered(const QBluetoothServiceInfo &info) } } -void BtLocalDevice::leServiceDiscovered(const QLowEnergyServiceInfo &info) -{ - qDebug() << "$$ Found new BTLE service" << info.device().address().toString() - << info.serviceUuid() << info.serviceName(); -} - void BtLocalDevice::serviceDiscoveryFinished() { qDebug() << "###### Service Discovery Finished"; diff --git a/tests/bttestui/btlocaldevice.h b/tests/bttestui/btlocaldevice.h index 53e4797b..5112d142 100644 --- a/tests/bttestui/btlocaldevice.h +++ b/tests/bttestui/btlocaldevice.h @@ -82,7 +82,6 @@ public slots: void startTargettedServiceDiscovery(); void stopServiceDiscovery(); void serviceDiscovered(const QBluetoothServiceInfo &info); - void leServiceDiscovered(const QLowEnergyServiceInfo &leInfo); void serviceDiscoveryFinished(); void serviceDiscoveryCanceled(); void serviceDiscoveryError(QBluetoothServiceDiscoveryAgent::Error error); |