diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2020-09-07 15:01:18 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-09-09 14:39:49 +0000 |
commit | 09854eefb2a1d37d0de6c6e41ad58345616b3169 (patch) | |
tree | de0201850473ae26f70bc0ae88ec80c0d367b22a /src | |
parent | 0dfebafe57adf8fbe66997ac39fac8f6746d0781 (diff) |
QLowEnergyController (Darwin) - restore the logic we had in 5.12
where serviceDiscovered was invoked via QueuedConnection and the controller
was in the correct state for details discovery in case an application
wants to discover details in the slot, attached to the serviceDiscovered
signal.
Change-Id: I3cbd0a0fa9913003d7b1c388a1c3653e04a505b0
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 7ff8f2d0546262816ab94684a992428cc2cb8a9e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/bluetooth/qlowenergycontroller_darwin.mm | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/bluetooth/qlowenergycontroller_darwin.mm b/src/bluetooth/qlowenergycontroller_darwin.mm index 253956e2..e2b3d618 100644 --- a/src/bluetooth/qlowenergycontroller_darwin.mm +++ b/src/bluetooth/qlowenergycontroller_darwin.mm @@ -460,11 +460,16 @@ void QLowEnergyControllerPrivateDarwin::_q_serviceDiscoveryFinished() qCDebug(QT_BT_OSX) << "no services found"; } - for (ServiceMap::const_iterator it = serviceList.constBegin(); it != serviceList.constEnd(); ++it) - emit q_ptr->serviceDiscovered(it.key()); - setState(QLowEnergyController::DiscoveredState); - emit q_ptr->discoveryFinished(); + state = QLowEnergyController::DiscoveredState; + + for (auto it = serviceList.constBegin(); it != serviceList.constEnd(); ++it) { + QMetaObject::invokeMethod(q_ptr, "serviceDiscovered", Qt::QueuedConnection, + Q_ARG(QBluetoothUuid, it.key())); + } + + QMetaObject::invokeMethod(q_ptr, "stateChanged", Qt::QueuedConnection, Q_ARG(QLowEnergyController::ControllerState, state)); + QMetaObject::invokeMethod(q_ptr, "discoveryFinished", Qt::QueuedConnection); } void QLowEnergyControllerPrivateDarwin::_q_serviceDetailsDiscoveryFinished(QSharedPointer<QLowEnergyServicePrivate> service) |