Commit 1750983d authored by Alex Blasche's avatar Alex Blasche
Browse files

Restrict the BTLE examples to Low Energy use cases


This change vastely descreases the search time. There is no need to
perform a traditional SDP scan too.

Change-Id: I63d7e16dca77fb1b1db42bb330f91e917a9dd054
Reviewed-by: default avatarTimur Pocheptsov <timur.pocheptsov@qt.io>
Showing with 4 additions and 2 deletions
......@@ -50,6 +50,7 @@ HeartRate::HeartRate():
{
//! [devicediscovery-1]
m_deviceDiscoveryAgent = new QBluetoothDeviceDiscoveryAgent(this);
m_deviceDiscoveryAgent->setLowEnergyDiscoveryTimeout(5000);
connect(m_deviceDiscoveryAgent, SIGNAL(deviceDiscovered(const QBluetoothDeviceInfo&)),
this, SLOT(addDevice(const QBluetoothDeviceInfo&)));
......@@ -73,7 +74,7 @@ void HeartRate::deviceSearch()
qDeleteAll(m_devices);
m_devices.clear();
//! [devicediscovery-2]
m_deviceDiscoveryAgent->start();
m_deviceDiscoveryAgent->start(QBluetoothDeviceDiscoveryAgent::LowEnergyMethod);
//! [devicediscovery-2]
setMessage("Scanning for devices...");
}
......
......@@ -54,6 +54,7 @@ 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)),
......@@ -84,7 +85,7 @@ void Device::startDeviceDiscovery()
setUpdate("Scanning for devices ...");
//! [les-devicediscovery-2]
discoveryAgent->start();
discoveryAgent->start(QBluetoothDeviceDiscoveryAgent::LowEnergyMethod);
//! [les-devicediscovery-2]
if (discoveryAgent->isActive()) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment