diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2017-06-21 15:45:26 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2017-06-28 07:05:25 +0000 |
commit | 0b475c565843e6c0901558d6342a02722d57acbc (patch) | |
tree | 934169816d8379fb8c8f49c9c40d0b7b72929357 /src/bluetooth/qlowenergycontroller_p.h | |
parent | 75e933c612b63bd130c19078fdc1201738745e3e (diff) |
Provide a way to define GAP/GATT services for central roles
Some devices require the Generic Access (GAP) and Generic Attribute (GATT)
services to be defined. Otherwise they refuse a proper interaction.
This is done implicitly by Android and BlueZ. The reason why BlueZ does
not do this for QtBluetooth is because QtBluetooth sets up its own GATT
infrastructure.
Normally a QLEController in central role cannot do that via public API
as the QLEController::addService() function blocks on peripheral use
cases. This patch sets the profiles up.
In the future the feature really requires a better form of API
(beyond the above env variable) or should be enabled by default
but since we need this earlier than Qt 5.10 a more subtle
approach was chosen. For now the feature can
only be enabled if the QT_DEFAULT_CENTRAL_SERVICES was set.
Another limitation is that the characteristics of the added services
are completely static.
Task-number: QTBUG-61554
Change-Id: Id03bddb2e54cc4f0869838e13ddf281311ad3a26
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/bluetooth/qlowenergycontroller_p.h')
-rw-r--r-- | src/bluetooth/qlowenergycontroller_p.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/bluetooth/qlowenergycontroller_p.h b/src/bluetooth/qlowenergycontroller_p.h index 5811376b..5c680c3b 100644 --- a/src/bluetooth/qlowenergycontroller_p.h +++ b/src/bluetooth/qlowenergycontroller_p.h @@ -147,6 +147,8 @@ public: QLowEnergyHandle handle); QLowEnergyDescriptor descriptorForHandle( QLowEnergyHandle handle); + QLowEnergyService *addServiceHelper(const QLowEnergyServiceData &service); + quint16 updateValueOfCharacteristic(QLowEnergyHandle charHandle, const QByteArray &value, @@ -416,6 +418,7 @@ private: void restartRequestTimer(); void establishL2cpClientSocket(); + void createServicesForCentralIfRequired(); private slots: void l2cpConnected(); |