diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2017-10-17 09:42:01 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2017-10-17 09:42:13 +0200 |
commit | fc2a206322f6190226ebc1f04062f2c9170f0bac (patch) | |
tree | 7df8ca41816c24ccfa6e0c6add4612689a933bdd /examples/bluetooth/lowenergyscanner | |
parent | ca5490859338f28e30104668a353275d23df1ec6 (diff) | |
parent | 125cdccc346903d6e70ed26289cdaed85e26ec3f (diff) |
Merge remote-tracking branch 'gerrit/dev' into btle
Change-Id: Ia1cbaac9774ce2bc1b6972c02bad34fa593d40ff
Diffstat (limited to 'examples/bluetooth/lowenergyscanner')
-rw-r--r-- | examples/bluetooth/lowenergyscanner/device.cpp | 37 | ||||
-rw-r--r-- | examples/bluetooth/lowenergyscanner/device.h | 1 | ||||
-rw-r--r-- | examples/bluetooth/lowenergyscanner/doc/src/lowenergyscanner.qdoc | 10 |
3 files changed, 24 insertions, 24 deletions
diff --git a/examples/bluetooth/lowenergyscanner/device.cpp b/examples/bluetooth/lowenergyscanner/device.cpp index 28a051f5..765a0d1c 100644 --- a/examples/bluetooth/lowenergyscanner/device.cpp +++ b/examples/bluetooth/lowenergyscanner/device.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "device.h" + #include <qbluetoothaddress.h> #include <qbluetoothdevicediscoveryagent.h> #include <qbluetoothlocaldevice.h> @@ -55,11 +56,11 @@ Device::Device(): //! [les-devicediscovery-1] discoveryAgent = new QBluetoothDeviceDiscoveryAgent(); discoveryAgent->setLowEnergyDiscoveryTimeout(5000); - connect(discoveryAgent, SIGNAL(deviceDiscovered(const QBluetoothDeviceInfo&)), - this, SLOT(addDevice(const QBluetoothDeviceInfo&))); - connect(discoveryAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error)), - this, SLOT(deviceScanError(QBluetoothDeviceDiscoveryAgent::Error))); - connect(discoveryAgent, SIGNAL(finished()), this, SLOT(deviceScanFinished())); + connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered, + this, &Device::addDevice); + connect(discoveryAgent, QOverload<QBluetoothDeviceDiscoveryAgent::Error>::of(&QBluetoothDeviceDiscoveryAgent::error), + this, &Device::deviceScanError); + connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::finished, this, &Device::deviceScanFinished); //! [les-devicediscovery-1] setUpdate("Search"); @@ -169,16 +170,16 @@ void Device::scanServices(const QString &address) if (!controller) { // Connecting signals and slots for connecting to LE services. controller = new QLowEnergyController(currentDevice.getDevice()); - connect(controller, SIGNAL(connected()), - this, SLOT(deviceConnected())); - connect(controller, SIGNAL(error(QLowEnergyController::Error)), - this, SLOT(errorReceived(QLowEnergyController::Error))); - connect(controller, SIGNAL(disconnected()), - this, SLOT(deviceDisconnected())); - connect(controller, SIGNAL(serviceDiscovered(QBluetoothUuid)), - this, SLOT(addLowEnergyService(QBluetoothUuid))); - connect(controller, SIGNAL(discoveryFinished()), - this, SLOT(serviceScanDone())); + connect(controller, &QLowEnergyController::connected, + this, &Device::deviceConnected); + connect(controller, QOverload<QLowEnergyController::Error>::of(&QLowEnergyController::error), + this, &Device::errorReceived); + connect(controller, &QLowEnergyController::disconnected, + this, &Device::deviceDisconnected); + connect(controller, &QLowEnergyController::serviceDiscovered, + this, &Device::addLowEnergyService); + connect(controller, &QLowEnergyController::discoveryFinished, + this, &Device::serviceScanDone); } if (isRandomAddress()) @@ -235,8 +236,8 @@ void Device::connectToService(const QString &uuid) if (service->state() == QLowEnergyService::DiscoveryRequired) { //! [les-service-3] - connect(service, SIGNAL(stateChanged(QLowEnergyService::ServiceState)), - this, SLOT(serviceDetailsDiscovered(QLowEnergyService::ServiceState))); + connect(service, &QLowEnergyService::stateChanged, + this, &Device::serviceDetailsDiscovered); service->discoverDetails(); setUpdate("Back\n(Discovering details...)"); //! [les-service-3] @@ -250,7 +251,7 @@ void Device::connectToService(const QString &uuid) m_characteristics.append(cInfo); } - QTimer::singleShot(0, this, SIGNAL(characteristicsUpdated())); + QTimer::singleShot(0, this, &Device::characteristicsUpdated); } void Device::deviceConnected() diff --git a/examples/bluetooth/lowenergyscanner/device.h b/examples/bluetooth/lowenergyscanner/device.h index 331d4458..1dc10300 100644 --- a/examples/bluetooth/lowenergyscanner/device.h +++ b/examples/bluetooth/lowenergyscanner/device.h @@ -41,7 +41,6 @@ #ifndef DEVICE_H #define DEVICE_H -#include <qbluetoothglobal.h> #include <qbluetoothlocaldevice.h> #include <QObject> #include <QVariant> diff --git a/examples/bluetooth/lowenergyscanner/doc/src/lowenergyscanner.qdoc b/examples/bluetooth/lowenergyscanner/doc/src/lowenergyscanner.qdoc index b4ad9fa2..bb2372a0 100644 --- a/examples/bluetooth/lowenergyscanner/doc/src/lowenergyscanner.qdoc +++ b/examples/bluetooth/lowenergyscanner/doc/src/lowenergyscanner.qdoc @@ -1,8 +1,8 @@ /**************************************************************************** ** ** Copyright (C) 2013 BlackBerry Limited all rights reserved -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. ** @@ -12,8 +12,8 @@ ** 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 The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free @@ -21,7 +21,7 @@ ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ |