BluezQt

declarativedevice.h
1 /*
2  * BluezQt - Asynchronous BlueZ wrapper library
3  *
4  * SPDX-FileCopyrightText: 2015 David Rosca <[email protected]>
5  *
6  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7  */
8 
9 #ifndef DECLARATIVEDEVICE_H
10 #define DECLARATIVEDEVICE_H
11 
12 #include "declarativeinput.h"
13 #include "declarativemediaplayer.h"
14 #include "device.h"
15 
16 class DeclarativeAdapter;
17 class DeclarativeBattery;
18 
19 class DeclarativeDevice : public QObject
20 {
21  Q_OBJECT
22 
23  Q_PROPERTY(QString ubi READ ubi CONSTANT)
24  Q_PROPERTY(QString address READ address CONSTANT)
25  Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
26  Q_PROPERTY(QString friendlyName READ friendlyName NOTIFY friendlyNameChanged)
27  Q_PROPERTY(QString remoteName READ remoteName NOTIFY remoteNameChanged)
28  Q_PROPERTY(quint32 deviceClass READ deviceClass NOTIFY deviceClassChanged)
29  Q_PROPERTY(BluezQt::Device::Type type READ type NOTIFY typeChanged)
30  Q_PROPERTY(quint16 appearance READ appearance NOTIFY appearanceChanged)
31  Q_PROPERTY(QString icon READ icon NOTIFY iconChanged)
32  Q_PROPERTY(bool paired READ isPaired NOTIFY pairedChanged)
33  Q_PROPERTY(bool trusted READ isTrusted WRITE setTrusted NOTIFY trustedChanged)
34  Q_PROPERTY(bool blocked READ isBlocked WRITE setBlocked NOTIFY blockedChanged)
35  Q_PROPERTY(bool legacyPairing READ hasLegacyPairing NOTIFY legacyPairingChanged)
36  Q_PROPERTY(qint16 rssi READ rssi NOTIFY rssiChanged)
37  Q_PROPERTY(bool connected READ isConnected NOTIFY connectedChanged)
38  Q_PROPERTY(QStringList uuids READ uuids NOTIFY uuidsChanged)
39  Q_PROPERTY(QString modalias READ modalias NOTIFY modaliasChanged)
40  Q_PROPERTY(DeclarativeInput *input READ input NOTIFY inputChanged)
41  Q_PROPERTY(DeclarativeMediaPlayer *mediaPlayer READ mediaPlayer NOTIFY mediaPlayerChanged)
42  Q_PROPERTY(DeclarativeAdapter *adapter READ adapter CONSTANT)
43 
44 public:
45  explicit DeclarativeDevice(BluezQt::DevicePtr device, DeclarativeAdapter *adapter);
46 
47  QString ubi() const;
48 
49  QString address() const;
50 
51  QString name() const;
52  void setName(const QString &name);
53 
54  QString friendlyName() const;
55 
56  QString remoteName() const;
57 
58  quint32 deviceClass() const;
59 
61 
62  quint16 appearance() const;
63 
64  QString icon() const;
65 
66  bool isPaired() const;
67 
68  bool isTrusted() const;
69  void setTrusted(bool trusted);
70 
71  bool isBlocked() const;
72  void setBlocked(bool blocked);
73 
74  bool hasLegacyPairing() const;
75 
76  qint16 rssi() const;
77 
78  bool isConnected() const;
79 
80  QStringList uuids() const;
81 
82  QString modalias() const;
83 
84  DeclarativeBattery *battery() const;
85 
86  DeclarativeInput *input() const;
87 
88  DeclarativeMediaPlayer *mediaPlayer() const;
89 
90  DeclarativeAdapter *adapter() const;
91 
92 public Q_SLOTS:
93  BluezQt::PendingCall *connectToDevice();
94  BluezQt::PendingCall *disconnectFromDevice();
95  BluezQt::PendingCall *connectProfile(const QString &uuid);
96  BluezQt::PendingCall *disconnectProfile(const QString &uuid);
97  BluezQt::PendingCall *pair();
98  BluezQt::PendingCall *cancelPairing();
99 
100 Q_SIGNALS:
101  void deviceRemoved(DeclarativeDevice *device);
102  void deviceChanged(DeclarativeDevice *device);
103  void nameChanged(const QString &name);
104  void friendlyNameChanged(const QString &friendlyName);
105  void remoteNameChanged(const QString &remoteName);
106  void deviceClassChanged(quint32 deviceClass);
107  void typeChanged(BluezQt::Device::Type type);
108  void appearanceChanged(quint16 appearance);
109  void iconChanged(const QString &icon);
110  void pairedChanged(bool paired);
111  void trustedChanged(bool trusted);
112  void blockedChanged(bool blocked);
113  void legacyPairingChanged(bool legacyPairing);
114  void rssiChanged(qint16 rssi);
115  void connectedChanged(bool connected);
116  void uuidsChanged(const QStringList &uuids);
117  void modaliasChanged(const QString &modalias);
118  void batteryChanged(DeclarativeBattery *battery);
119  void inputChanged(DeclarativeInput *input);
120  void mediaPlayerChanged(DeclarativeMediaPlayer *mediaPlayer);
121 
122 private:
123  void updateBattery();
124  void updateInput();
125  void updateMediaPlayer();
126 
127  BluezQt::DevicePtr m_device;
128  DeclarativeAdapter *m_adapter;
129  DeclarativeBattery *m_battery;
130  DeclarativeInput *m_input;
131  DeclarativeMediaPlayer *m_mediaPlayer;
132 };
133 
134 #endif // DECLARATIVEDEVICE_H
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SLOTSQ_SLOTS
Type
Device types.
Definition: device.h:65
PostalAddress address(const QVariant &location)
Q_SIGNALSQ_SIGNALS
VehicleSection::Type type(QStringView coachNumber, QStringView coachClassification)
QString name(StandardShortcut id)
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Sep 25 2022 04:19:10 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.