From 193ed20a9d6f4b65fdffd4d3c43d7824eb450089 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Thu, 7 May 2015 14:03:23 +0200 Subject: Reduce platform specific code lines QLEController(QBluetoothAddress) ctor is not usable on iOS and OSX. On those platforms we have to use QLECOntroller(QBluetoothDeviceInfo). We mark the QBluetoothAddress based ctors of QLEController obsolete and remove most uses of them. This cleans up some ifdefs throughout the QtBluetooth code base. Change-Id: Ibe1e3fa271a29461e39fc3c0eeba7a910a250077 Reviewed-by: Timur Pocheptsov --- examples/bluetooth/lowenergyscanner/device.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'examples/bluetooth/lowenergyscanner') diff --git a/examples/bluetooth/lowenergyscanner/device.cpp b/examples/bluetooth/lowenergyscanner/device.cpp index a95bc48b..5ef2cf76 100644 --- a/examples/bluetooth/lowenergyscanner/device.cpp +++ b/examples/bluetooth/lowenergyscanner/device.cpp @@ -158,12 +158,7 @@ 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; @@ -172,11 +167,7 @@ void Device::scanServices(const QString &address) //! [les-controller-1] if (!controller) { // Connecting signals and slots for connecting to LE services. -#ifdef Q_OS_MAC controller = new QLowEnergyController(currentDevice.getDevice()); -#else - controller = new QLowEnergyController(currentDevice.getDevice().address()); -#endif connect(controller, SIGNAL(connected()), this, SLOT(deviceConnected())); connect(controller, SIGNAL(error(QLowEnergyController::Error)), @@ -195,6 +186,8 @@ void Device::scanServices(const QString &address) controller->setRemoteAddressType(QLowEnergyController::PublicAddress); controller->connectToDevice(); //! [les-controller-1] + + m_previousAddress = currentDevice.getAddress(); } void Device::addLowEnergyService(const QBluetoothUuid &serviceUuid) -- cgit v1.2.3