summaryrefslogtreecommitdiffstats
path: root/examples/bluetooth/lowenergyscanner/device.cpp
diff options
context:
space:
mode:
authorTimur Pocheptsov <Timur.Pocheptsov@digia.com>2014-12-05 10:58:47 +0100
committerTimur Pocheptsov <Timur.Pocheptsov@digia.com>2014-12-05 14:20:32 +0100
commit228b54c723a2f05e493eab6b67dece29ab7de687 (patch)
tree9a00eaedc9994a4e41b55a1a1b9f346efdb75624 /examples/bluetooth/lowenergyscanner/device.cpp
parent3ff29159e8ca3deb2705aea92f673e0ea51c2aaa (diff)
Bluetooth example - lowenergyscanner (OS X and iOS)
Core Bluetooth hides addresses and uses unique UUIDs instead. This patch updates/adjusts lowenergyscanner example to work with UUIDs on iOS and OS X instead of (empty on these platforms) device addresses. Change-Id: Iad0b35250f434b736616fe60e356f2088e6dc279 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
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;