File indexing completed on 2024-09-15 03:35:57
0001 /* 0002 * SPDX-FileCopyrightText: 2021 Ivan Podkurkov <podkiva2@gmail.com> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #ifndef GATTCHARACTERISTICINTERFACE_H 0008 #define GATTCHARACTERISTICINTERFACE_H 0009 0010 #include "object.h" 0011 0012 #include <QDBusAbstractAdaptor> 0013 #include <QStringList> 0014 0015 class QDBusObjectPath; 0016 0017 class GattCharacteristicObject : public QObject 0018 { 0019 public: 0020 explicit GattCharacteristicObject(const QDBusObjectPath &path, QObject *parent = nullptr); 0021 }; 0022 0023 class GattCharacteristicInterface : public QDBusAbstractAdaptor, public Object 0024 { 0025 Q_OBJECT 0026 Q_CLASSINFO("D-Bus Interface", "org.bluez.GattCharacteristic1") 0027 Q_PROPERTY(QString UUID READ UUID) 0028 Q_PROPERTY(QDBusObjectPath Service READ service) 0029 Q_PROPERTY(QByteArray Value READ value) 0030 Q_PROPERTY(bool Notifying READ notifying) 0031 Q_PROPERTY(QStringList Flags READ flags) 0032 Q_PROPERTY(quint16 Handle READ handle WRITE setHandle) 0033 Q_PROPERTY(quint16 MTU READ MTU) 0034 0035 public: 0036 explicit GattCharacteristicInterface(const QDBusObjectPath &path, const QVariantMap &properties, QObject *parent = nullptr); 0037 0038 QString UUID() const; 0039 0040 QDBusObjectPath service() const; 0041 0042 QByteArray value() const; 0043 0044 bool notifying() const; 0045 0046 QStringList flags() const; 0047 0048 quint16 handle() const; 0049 void setHandle(const quint16 handle); 0050 0051 quint16 MTU() const; 0052 0053 public Q_SLOTS: 0054 QByteArray ReadValue(const QVariantMap& options); 0055 void WriteValue(const QByteArray& value, const QVariantMap& options); 0056 void StartNotify(); 0057 void StopNotify(); 0058 0059 private: 0060 0061 friend class DeviceManager; 0062 }; 0063 0064 #endif // GATTCHARACTERISTICINTERFACE_H