File indexing completed on 2024-12-01 12:29:47

0001 /*
0002  * BluezQt - Asynchronous Bluez wrapper library
0003  *
0004  * SPDX-FileCopyrightText: 2014 David Rosca <nowrep@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_DEVICE_P_H
0010 #define BLUEZQT_DEVICE_P_H
0011 
0012 #include <QObject>
0013 #include <QStringList>
0014 
0015 #include "bluezdevice1.h"
0016 #include "bluezqt_dbustypes.h"
0017 #include "dbusproperties.h"
0018 #include "types.h"
0019 
0020 namespace BluezQt
0021 {
0022 typedef org::bluez::Device1 BluezDevice;
0023 typedef org::freedesktop::DBus::Properties DBusProperties;
0024 
0025 class DevicePrivate : public QObject
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     explicit DevicePrivate(const QString &path, const QVariantMap &properties, const AdapterPtr &adapter);
0031 
0032     void init(const QVariantMap &properties);
0033 
0034     void interfacesAdded(const QString &path, const QVariantMapMap &interfaces);
0035     void interfacesRemoved(const QString &path, const QStringList &interfaces);
0036 
0037     void addGattService(const QString &gattServicePath, const QVariantMap &properties);
0038     void removeGattService(const QString &gattServicePath);
0039 
0040     QDBusPendingReply<> setDBusProperty(const QString &name, const QVariant &value);
0041     void propertiesChanged(const QString &path, const QString &interface, const QVariantMap &changed, const QStringList &invalidated);
0042     void namePropertyChanged(const QString &value);
0043     void aliasPropertyChanged(const QString &value);
0044     void addressPropertyChanged(const QString &value);
0045     void classPropertyChanged(quint32 value);
0046     void serviceDataChanged(const QHash<QString, QByteArray> &value);
0047 
0048     QWeakPointer<Device> q;
0049     BluezDevice *m_bluezDevice;
0050     DBusProperties *m_dbusProperties;
0051 
0052     QString m_address;
0053     QString m_name;
0054     QString m_alias;
0055     quint32 m_deviceClass;
0056     quint16 m_appearance;
0057     QString m_icon;
0058     bool m_paired;
0059     bool m_trusted;
0060     bool m_blocked;
0061     bool m_legacyPairing;
0062     qint16 m_rssi;
0063     ManData m_manufacturerData;
0064     bool m_servicesResolved;
0065     bool m_connected;
0066     QStringList m_uuids;
0067     QString m_modalias;
0068     QHash<QString, QByteArray> m_serviceData;
0069     BatteryPtr m_battery;
0070     InputPtr m_input;
0071     MediaPlayerPtr m_mediaPlayer;
0072     MediaTransportPtr m_mediaTransport;
0073     QList<GattServiceRemotePtr> m_services;
0074     AdapterPtr m_adapter;
0075 };
0076 
0077 } // namespace BluezQt
0078 
0079 #endif // BLUEZQT_DEVICE_P_H