File indexing completed on 2024-10-06 03:36:44

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 GATTDESCRIPTORINTERFACE_H
0008 #define GATTDESCRIPTORINTERFACE_H
0009 
0010 #include "object.h"
0011 
0012 #include <QDBusAbstractAdaptor>
0013 #include <QStringList>
0014 
0015 class QDBusObjectPath;
0016 
0017 class GattDescriptorObject : public QObject
0018 {
0019 public:
0020     explicit GattDescriptorObject(const QDBusObjectPath &path, QObject *parent = nullptr);
0021 };
0022 
0023 class GattDescriptorInterface : public QDBusAbstractAdaptor, public Object
0024 {
0025     Q_OBJECT
0026     Q_CLASSINFO("D-Bus Interface", "org.bluez.GattDescriptor1")
0027     Q_PROPERTY(QString UUID READ UUID)
0028     Q_PROPERTY(QDBusObjectPath Characteristic READ characteristic)
0029     Q_PROPERTY(QByteArray Value READ value)
0030     Q_PROPERTY(QStringList Flags READ flags)
0031     Q_PROPERTY(quint16 Handle READ handle WRITE setHandle)
0032 
0033 public:
0034     explicit GattDescriptorInterface(const QDBusObjectPath &path, const QVariantMap &properties, QObject *parent = nullptr);
0035 
0036     QString UUID() const;
0037 
0038     QDBusObjectPath characteristic() const;
0039 
0040     QByteArray value() const;
0041 
0042     QStringList flags() const;
0043 
0044     quint16 handle() const;
0045     void setHandle(const quint16 handle);
0046 
0047 public Q_SLOTS:
0048     QByteArray ReadValue(const QVariantMap& options);
0049     void WriteValue(const QByteArray& value, const QVariantMap& options);
0050 
0051 private:
0052 
0053     friend class DeviceManager;
0054 };
0055 
0056 #endif // GATTDESCRIPTORINTERFACE_H