File indexing completed on 2024-11-10 12:17:15
0001 /* 0002 * SPDX-FileCopyrightText: 2014-2015 David Rosca <nowrep@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 ADAPTERINTERFACE_H 0008 #define ADAPTERINTERFACE_H 0009 0010 #include "object.h" 0011 0012 #include <QDBusAbstractAdaptor> 0013 0014 class QDBusObjectPath; 0015 0016 class GattManagerInterface; 0017 class LEAdvertisingManagerInterface; 0018 class MediaInterface; 0019 0020 class AdapterObject : public QObject 0021 { 0022 public: 0023 explicit AdapterObject(const QDBusObjectPath &path, QObject *parent = nullptr); 0024 }; 0025 0026 class AdapterInterface : public QDBusAbstractAdaptor, public Object 0027 { 0028 Q_OBJECT 0029 Q_CLASSINFO("D-Bus Interface", "org.bluez.Adapter1") 0030 Q_PROPERTY(QString Address READ address) 0031 Q_PROPERTY(QString Name READ name) 0032 Q_PROPERTY(QString Alias READ alias WRITE setAlias) 0033 Q_PROPERTY(quint32 Class READ adapterClass) 0034 Q_PROPERTY(bool Powered READ powered WRITE setPowered) 0035 Q_PROPERTY(bool Discoverable READ discoverable WRITE setDiscoverable) 0036 Q_PROPERTY(bool Pairable READ pairable WRITE setPairable) 0037 Q_PROPERTY(quint32 PairableTimeout READ pairableTimeout WRITE setPairableTimeout) 0038 Q_PROPERTY(quint32 DiscoverableTimeout READ discoverableTimeout WRITE setDiscoverableTimeout) 0039 Q_PROPERTY(bool Discovering READ discovering) 0040 Q_PROPERTY(QStringList UUIDs READ uuids) 0041 Q_PROPERTY(QString Modalias READ modalias) 0042 0043 public: 0044 explicit AdapterInterface(const QDBusObjectPath &path, const QVariantMap &properties, QObject *parent = nullptr); 0045 0046 QString address() const; 0047 0048 QString name() const; 0049 0050 QString alias() const; 0051 void setAlias(const QString &alias); 0052 0053 quint32 adapterClass() const; 0054 0055 bool powered() const; 0056 void setPowered(bool powered); 0057 0058 bool discoverable() const; 0059 void setDiscoverable(bool discoverable); 0060 0061 bool pairable() const; 0062 void setPairable(bool pairable); 0063 0064 quint32 pairableTimeout() const; 0065 void setPairableTimeout(quint32 timeout); 0066 0067 quint32 discoverableTimeout() const; 0068 void setDiscoverableTimeout(quint32 timeout); 0069 0070 bool discovering() const; 0071 0072 QStringList uuids() const; 0073 0074 QString modalias() const; 0075 0076 MediaInterface *media() const; 0077 0078 LEAdvertisingManagerInterface *leAdvertisingManager() const; 0079 0080 GattManagerInterface *gattManager() const; 0081 0082 public Q_SLOTS: 0083 void StartDiscovery(); 0084 void StopDiscovery(); 0085 void RemoveDevice(const QDBusObjectPath &device); 0086 void SetDiscoveryFilter(const QVariantMap &filter); 0087 QStringList GetDiscoveryFilters(); 0088 0089 private Q_SLOTS: 0090 void resetPairable(); 0091 void resetDiscoverable(); 0092 0093 private: 0094 MediaInterface *m_media; 0095 LEAdvertisingManagerInterface *m_leAdvertisingManager; 0096 GattManagerInterface *m_gattManager; 0097 }; 0098 0099 #endif // ADAPTERINTERFACE_H