summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qlowenergycontroller_bluezdbus_p.h
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2017-12-14 14:29:53 +0100
committerAlex Blasche <alexander.blasche@qt.io>2018-01-05 09:06:57 +0000
commit4462750a68cb93b5d363b6efdbe1d6a6f0e5811f (patch)
tree026f77cb960ae62f983ab0bea615b5f4c80bf5cf /src/bluetooth/qlowenergycontroller_bluezdbus_p.h
parent4a008da8dd7acec3ef45392e024e31552dbc3c49 (diff)
Implement QLEService::discoverDetails for DBus Bluez
This includes support for reading of characteristics and descriptors. Task-number: QTBUG-46819 Change-Id: I8ac1ef3bcd5bc475941f1a9f889d0742eb8def35 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/bluetooth/qlowenergycontroller_bluezdbus_p.h')
-rw-r--r--src/bluetooth/qlowenergycontroller_bluezdbus_p.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/bluetooth/qlowenergycontroller_bluezdbus_p.h b/src/bluetooth/qlowenergycontroller_bluezdbus_p.h
index c4589381..84326e48 100644
--- a/src/bluetooth/qlowenergycontroller_bluezdbus_p.h
+++ b/src/bluetooth/qlowenergycontroller_bluezdbus_p.h
@@ -59,11 +59,16 @@
class OrgBluezAdapter1Interface;
class OrgBluezDevice1Interface;
+class OrgBluezGattCharacteristic1Interface;
+class OrgBluezGattDescriptor1Interface;
+class OrgBluezGattService1Interface;
class OrgFreedesktopDBusObjectManagerInterface;
class OrgFreedesktopDBusPropertiesInterface;
QT_BEGIN_NAMESPACE
+class QDBusPendingCallWatcher;
+
class QLowEnergyControllerPrivateBluezDBus : public QLowEnergyControllerPrivate
{
Q_OBJECT
@@ -116,11 +121,15 @@ private:
void connectToDeviceHelper();
void resetController();
+ void scheduleNextJob();
+
private slots:
void devicePropertiesChanged(const QString &interface, const QVariantMap &changedProperties,
const QStringList &/*invalidatedProperties*/);
void interfacesRemoved(const QDBusObjectPath &objectPath, const QStringList &interfaces);
+ void onCharReadFinished(QDBusPendingCallWatcher *call);
+ void onDescReadFinished(QDBusPendingCallWatcher *call);
private:
OrgBluezAdapter1Interface* adapter{};
OrgBluezDevice1Interface* device{};
@@ -130,6 +139,43 @@ private:
bool pendingConnect = false;
bool pendingDisconnect = false;
bool disconnectSignalRequired = false;
+
+ struct GattCharacteristic
+ {
+ QSharedPointer<OrgBluezGattCharacteristic1Interface> characteristic;
+ QVector<QSharedPointer<OrgBluezGattDescriptor1Interface>> descriptors;
+ };
+
+ struct GattService
+ {
+ QString servicePath;
+ QVector<GattCharacteristic> characteristics;
+ };
+
+ QHash<QBluetoothUuid, GattService> dbusServices;
+ QLowEnergyHandle runningHandle = 1;
+
+ struct GattJob {
+ enum JobFlag {
+ Unset = 0x00,
+ CharRead = 0x01,
+ CharWrite = 0x02,
+ DescRead = 0x04,
+ DescWrite = 0x08,
+ ServiceDiscovery = 0x10,
+ LastServiceDiscovery = 0x20
+ };
+ Q_DECLARE_FLAGS(JobFlags, JobFlag)
+
+ JobFlags flags = GattJob::Unset;
+ QLowEnergyHandle handle;
+ QSharedPointer<QLowEnergyServicePrivate> service;
+ };
+
+ QVector<GattJob> jobs;
+ bool jobPending = false;
+
+ void prepareNextJob();
};
QT_END_NAMESPACE