summaryrefslogtreecommitdiffstats
path: root/examples/bluetooth/lowenergyscanner/device.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/bluetooth/lowenergyscanner/device.cpp')
-rw-r--r--examples/bluetooth/lowenergyscanner/device.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/bluetooth/lowenergyscanner/device.cpp b/examples/bluetooth/lowenergyscanner/device.cpp
index 0891f040..7ba27ad1 100644
--- a/examples/bluetooth/lowenergyscanner/device.cpp
+++ b/examples/bluetooth/lowenergyscanner/device.cpp
@@ -138,6 +138,7 @@ QString Device::getUpdate()
void Device::scanServices(const QString &address)
{
// We need the current device for service discovery.
+
for (int i = 0; i < devices.size(); i++) {
if (((DeviceInfo*)devices.at(i))->getAddress() == address )
currentDevice.setDevice(((DeviceInfo*)devices.at(i))->getDevice());
@@ -157,7 +158,12 @@ void Device::scanServices(const QString &address)
setUpdate("Back\n(Connecting to device...)");
+#ifdef Q_OS_MAC
+ if (controller && m_previousAddress != currentDevice.getAddress()) {
+ m_previousAddress = currentDevice.getAddress();
+#else
if (controller && controller->remoteAddress() != currentDevice.getDevice().address()) {
+#endif
controller->disconnectFromDevice();
delete controller;
controller = 0;