summaryrefslogtreecommitdiffstats
path: root/examples/bluetooth/lowenergyscanner/device.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-07-06 13:54:35 +0200
committerLiang Qi <liang.qi@qt.io>2017-07-06 13:55:28 +0200
commit4feae652c9c12ec4e5ef4c7bd575f8f316494add (patch)
tree06571ec9b38fe312cba430092ab4a82ace5c6af1 /examples/bluetooth/lowenergyscanner/device.cpp
parent7761bb88000c19d2f5bfb1182f5c5ddf7dae6c5a (diff)
parentb0089abb05e6f60cc252068be1ba40be32e29bd3 (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts: .qmake.conf Change-Id: I7a55929aefa1f7a4dc96f841317b78b248899f67
Diffstat (limited to 'examples/bluetooth/lowenergyscanner/device.cpp')
-rw-r--r--examples/bluetooth/lowenergyscanner/device.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/examples/bluetooth/lowenergyscanner/device.cpp b/examples/bluetooth/lowenergyscanner/device.cpp
index 28a051f5..0275c435 100644
--- a/examples/bluetooth/lowenergyscanner/device.cpp
+++ b/examples/bluetooth/lowenergyscanner/device.cpp
@@ -55,11 +55,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 +169,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 +235,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 +250,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()