summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qlowenergycontroller_bluez.cpp
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-03-14 16:30:33 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-15 23:17:36 +0100
commit38ccc79dc70c1bf2ccd982b6699304db819f0d7f (patch)
treead18b0e70c49ded742d796362723385c5dfb3ec4 /src/bluetooth/qlowenergycontroller_bluez.cpp
parent8ba83c809febcc38d72f69d8ca206ba5402e5f4d (diff)
Bind QLowEnergyController to a particular local adapter.
This simplifies the internal LEServiceInfo logic and let's us later deal with multiple adapters. Change-Id: I7d3e991207cd6571b5d644ae99c6bf1a2c99ec68 Reviewed-by: Nedim Hadzic <nhadzic@blackberry.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src/bluetooth/qlowenergycontroller_bluez.cpp')
-rw-r--r--src/bluetooth/qlowenergycontroller_bluez.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/bluetooth/qlowenergycontroller_bluez.cpp b/src/bluetooth/qlowenergycontroller_bluez.cpp
index eba8bad5..fcf94bda 100644
--- a/src/bluetooth/qlowenergycontroller_bluez.cpp
+++ b/src/bluetooth/qlowenergycontroller_bluez.cpp
@@ -39,6 +39,7 @@
**
****************************************************************************/
+#include <QtBluetooth/QBluetoothLocalDevice>
#include "qlowenergycontroller.h"
#include "qlowenergycontroller_p.h"
#include "qlowenergyserviceinfo_p.h"
@@ -83,7 +84,14 @@ void QLowEnergyControllerPrivate::connectService(const QLowEnergyServiceInfo &se
connectToTerminal();
else {
QObject::connect(process, SIGNAL(replySend(const QString &)), q_ptr, SLOT(_q_replyReceived(const QString &)));
- QString command = QStringLiteral("gatttool -i ") + service.d_ptr->adapterAddress.toString() + QStringLiteral(" -b ") + service.d_ptr->deviceInfo.address().toString() + QStringLiteral(" -I");
+ if (localAdapter.isNull()) {
+ QBluetoothLocalDevice localDevice;
+ localAdapter = localDevice.address();
+ }
+ QString command = QStringLiteral("gatttool -i ") + localAdapter.toString()
+ + QStringLiteral(" -b ")
+ + service.d_ptr->deviceInfo.address().toString()
+ + QStringLiteral(" -I");
if (m_randomAddress)
command += QStringLiteral(" -t random");
qCDebug(QT_BT_BLUEZ) << "[REGISTER] uuid inside: " << service.d_ptr->uuid << command;