diff options
author | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2016-01-12 12:22:11 +0100 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2016-01-18 07:46:35 +0000 |
commit | e94fe90e7d2e1df9bd7d1d014fb468e5e73da834 (patch) | |
tree | 440a4e0359661b6cc4ac2e95455475ff0d64ebcd /src/bluetooth/qlowenergycontroller.cpp | |
parent | 1046db1a91f264db6714975daa27f56a457a6778 (diff) |
Bluetooth LE: Add connection update functionality.
Implemented for BlueZ only.
Change-Id: I358a98bbc7499d5ce5437fb0d4672fde46c3b831
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/bluetooth/qlowenergycontroller.cpp')
-rw-r--r-- | src/bluetooth/qlowenergycontroller.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/bluetooth/qlowenergycontroller.cpp b/src/bluetooth/qlowenergycontroller.cpp index 8a6a2e1d..cf712e17 100644 --- a/src/bluetooth/qlowenergycontroller.cpp +++ b/src/bluetooth/qlowenergycontroller.cpp @@ -35,6 +35,7 @@ #include "qlowenergycontroller_p.h" #include "qlowenergycharacteristicdata.h" +#include "qlowenergyconnectionparameters.h" #include "qlowenergydescriptordata.h" #include "qlowenergyservicedata.h" @@ -238,12 +239,25 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT) \sa discoverServices(), error() */ +/*! + \fn void QLowEnergyController::connectionUpdated(const QLowEnergyConnectionParameters &newParameters) + + This signal is emitted when the connection parameters change. This can happen as a result + of calling \l requestConnectionUpdate() or due to other reasons, for instance because + the other side of the connection requested new parameters. The new values can be retrieved + from \a newParameters. + + \sa requestConnectionUpdate() +*/ + + void registerQLowEnergyControllerMetaType() { static bool initDone = false; if (!initDone) { qRegisterMetaType<QLowEnergyController::ControllerState>(); qRegisterMetaType<QLowEnergyController::Error>(); + qRegisterMetaType<QLowEnergyConnectionParameters>(); initDone = true; } } @@ -882,6 +896,22 @@ 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. + */ +void QLowEnergyController::requestConnectionUpdate(const QLowEnergyConnectionParameters ¶meters) +{ + if (state() != ConnectedState) { + qCWarning(QT_BT) << "Connection update request only possible in connected state"; + return; + } + d_ptr->requestConnectionUpdate(parameters); +} + +/*! Returns the last occurred error or \l NoError. */ QLowEnergyController::Error QLowEnergyController::error() const |