diff options
Diffstat (limited to 'src/bluetooth/qlowenergycontroller.cpp')
-rw-r--r-- | src/bluetooth/qlowenergycontroller.cpp | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/src/bluetooth/qlowenergycontroller.cpp b/src/bluetooth/qlowenergycontroller.cpp index 03278276..a3aad282 100644 --- a/src/bluetooth/qlowenergycontroller.cpp +++ b/src/bluetooth/qlowenergycontroller.cpp @@ -359,7 +359,12 @@ void QLowEnergyControllerPrivate::invalidateServices() QSharedPointer<QLowEnergyServicePrivate> QLowEnergyControllerPrivate::serviceForHandle( QLowEnergyHandle handle) { - foreach (QSharedPointer<QLowEnergyServicePrivate> service, serviceList.values()) + ServiceDataMap ¤tList = serviceList; + if (role == QLowEnergyController::PeripheralRole) + currentList = localServices; + + const QList<QSharedPointer<QLowEnergyServicePrivate>> values = currentList.values(); + for (auto service: values) if (service->startHandle <= handle && handle <= service->endHandle) return service; @@ -963,19 +968,35 @@ QLowEnergyService *QLowEnergyController::addService(const QLowEnergyServiceData /*! Requests the controller to update the connection according to \a parameters. If the request is successful, the \l connectionUpdated() signal will be emitted - with the actual new parameters. - See the \l QLowEnergyConnectionParameters class for more information on connection parameters. - \note Currently, this functionality is only implemented on Linux. - + with the actual new parameters. See the \l QLowEnergyConnectionParameters class for more + information on connection parameters. + + Android only indirectly permits the adjustment of this parameter set. + The connection parameters are separated into three categories (high, low & balanced priority). + Each category implies a pre-configured set of values for + \l QLowEnergyConnectionParameters::minimumInterval(), + \l QLowEnergyConnectionParameters::maximumInterval() and + \l QLowEnergyConnectionParameters::latency(). Although the connection request is an asynchronous + operation, Android does not provide a callback stating the result of the request. This is + an acknowledged Android bug. Due to this bug Android does not emit the \l connectionUpdated() + signal. + + \note Currently, this functionality is only implemented on Linux and Android. + + \sa connectionUpdated() \since 5.7 */ void QLowEnergyController::requestConnectionUpdate(const QLowEnergyConnectionParameters ¶meters) { - if (state() != ConnectedState) { + switch (state()) { + case ConnectedState: + case DiscoveredState: + case DiscoveringState: + d_ptr->requestConnectionUpdate(parameters); + break; + default: qCWarning(QT_BT) << "Connection update request only possible in connected state"; - return; } - d_ptr->requestConnectionUpdate(parameters); } /*! |