diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2014-02-27 14:02:38 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-27 16:13:49 +0100 |
commit | b03495fd43b0ffb402fe076773569ca67186d685 (patch) | |
tree | f4cc561a89787bb272b20b42364fe3de4d882d60 /src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp | |
parent | eb632012c2cf13922b08f4e2606d1452da9aaacb (diff) |
Don't create invalid LEServices on Bluez due to default adapter usage
A valid LEServiceInfo on Bluez requires an adapter address. If the
service discorvery was initialized with a default adapter,
the internal service discovery never actually determines
the adapter address. Subsequently every LEServiceInfo object got an
invalid adapter address.
Change-Id: I3d95ee5b2169f8a049121fe6cc4591d3b79262d9
Reviewed-by: Nedim Hadzic <nedimhadzija@gmail.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp index 503d614f..8b80ed11 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp @@ -100,6 +100,15 @@ void QBluetoothServiceDiscoveryAgentPrivate::start(const QBluetoothAddress &addr adapter = new OrgBluezAdapterInterface(QLatin1String("org.bluez"), reply.value().path(), QDBusConnection::systemBus()); + if (m_deviceAdapterAddress.isNull()) { + QDBusPendingReply<QVariantMap> reply = adapter->GetProperties(); + reply.waitForFinished(); + if (!reply.isError()) { + const QBluetoothAddress path_address(reply.value().value(QStringLiteral("Address")).toString()); + m_deviceAdapterAddress = path_address; + } + } + QDBusPendingReply<QDBusObjectPath> deviceObjectPath = adapter->CreateDevice(address.toString()); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(deviceObjectPath, q); @@ -212,7 +221,6 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_createdDevice(QDBusPendingCallWa qCDebug(QT_BT_BLUEZ) << "Discovered BLE service" << uuid << uuidFilter.size(); QLowEnergyServiceInfo lowEnergyService(uuid); - //TODO Fix m_DeviceAdapterAddress may not be the actual address lowEnergyService.d_ptr->adapterAddress = m_deviceAdapterAddress; lowEnergyService.setDevice(discoveredDevices.at(0)); if (uuidFilter.isEmpty()) |