diff options
Diffstat (limited to 'src/bluetooth/qlowenergycontroller_bluezdbus_p.h')
-rw-r--r-- | src/bluetooth/qlowenergycontroller_bluezdbus_p.h | 46 |
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 |