File indexing completed on 2024-12-08 12:15:33

0001 /*
0002  * BluezQt - Asynchronous Bluez wrapper library
0003  *
0004  * SPDX-FileCopyrightText: 2021 Ivan Podkurkov <podkiva2@gmail.com>
0005  *
0006  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007  */
0008 
0009 #ifndef BLUEZQT_GATTCHARACTERISTIC_P_H
0010 #define BLUEZQT_GATTCHARACTERISTIC_P_H
0011 
0012 #include <QObject>
0013 #include <QStringList>
0014 
0015 #include "types.h"
0016 #include "bluezgattcharacteristic1.h"
0017 #include "dbusproperties.h"
0018 #include "bluezqt_dbustypes.h"
0019 
0020 namespace BluezQt
0021 {
0022 
0023 typedef org::bluez::GattCharacteristic1 BluezGattCharacteristic;
0024 typedef org::freedesktop::DBus::Properties DBusProperties;
0025 
0026 class GattCharacteristicRemotePrivate : public QObject
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031     explicit GattCharacteristicRemotePrivate(const QString &path, const QVariantMap &properties, const GattServiceRemotePtr &service);
0032 
0033     void init(const QVariantMap &properties);
0034 
0035     void interfacesAdded(const QString &path, const QVariantMapMap &interfaces);
0036     void interfacesRemoved(const QString &path, const QStringList &interfaces);
0037 
0038     void addGattDescriptor(const QString &gattDescriptorPath, const QVariantMap &properties);
0039     void removeGattDescriptor(const QString &gattDescriptorPath);
0040 
0041     QDBusPendingReply<> setDBusProperty(const QString &name, const QVariant &value);
0042     void propertiesChanged(const QString &path, const QString &interface, const QVariantMap &changed, const QStringList &invalidated);
0043 
0044     QWeakPointer<GattCharacteristicRemote> q;
0045     BluezGattCharacteristic *m_bluezGattCharacteristic;
0046     DBusProperties *m_dbusProperties;
0047 
0048     QString m_uuid;
0049     QByteArray m_value;
0050     bool m_writeAcquired;
0051     bool m_notifyAcquired;
0052     bool m_notifying;
0053     QStringList m_flags;
0054     quint16 m_handle;
0055     quint16 m_MTU;
0056     const GattServiceRemotePtr m_service;
0057     QList<GattDescriptorRemotePtr> m_descriptors;
0058 };
0059 
0060 } // namespace BluezQt
0061 
0062 #endif // BLUEZQT_GATTCHARACTERISTIC_P_H