9#ifndef DECLARATIVEDEVICE_H
10#define DECLARATIVEDEVICE_H
13#include <qqmlregistration.h>
15class DeclarativeAdapter;
16class DeclarativeBattery;
17class DeclarativeInput;
18class DeclarativeMediaPlayer;
20class DeclarativeDevice :
public QObject
23 QML_NAMED_ELEMENT(Device)
24 QML_UNCREATABLE(
"Device cannot be created")
31 Q_PROPERTY(quint32 deviceClass READ deviceClass NOTIFY deviceClassChanged)
32 Q_PROPERTY(BluezQt::Device::Type type READ type NOTIFY typeChanged)
33 Q_PROPERTY(quint16 appearance READ appearance NOTIFY appearanceChanged)
35 Q_PROPERTY(
bool paired READ isPaired NOTIFY pairedChanged)
36 Q_PROPERTY(
bool trusted READ isTrusted WRITE setTrusted NOTIFY trustedChanged)
37 Q_PROPERTY(
bool blocked READ isBlocked WRITE setBlocked NOTIFY blockedChanged)
38 Q_PROPERTY(
bool legacyPairing READ hasLegacyPairing NOTIFY legacyPairingChanged)
39 Q_PROPERTY(qint16 rssi READ rssi NOTIFY rssiChanged)
40 Q_PROPERTY(
bool connected READ isConnected NOTIFY connectedChanged)
43 Q_PROPERTY(DeclarativeBattery *battery READ battery NOTIFY batteryChanged)
44 Q_PROPERTY(DeclarativeInput *input READ input NOTIFY inputChanged)
45 Q_PROPERTY(DeclarativeMediaPlayer *mediaPlayer READ mediaPlayer NOTIFY mediaPlayerChanged)
46 Q_PROPERTY(DeclarativeAdapter *adapter READ adapter CONSTANT)
49 explicit DeclarativeDevice(BluezQt::DevicePtr device, DeclarativeAdapter *adapter);
56 void setName(const
QString &name);
62 quint32 deviceClass() const;
64 BluezQt::Device::Type type() const;
66 quint16 appearance() const;
70 bool isPaired() const;
72 bool isTrusted() const;
73 void setTrusted(
bool trusted);
75 bool isBlocked() const;
76 void setBlocked(
bool blocked);
78 bool hasLegacyPairing() const;
82 bool isConnected() const;
88 DeclarativeBattery *battery() const;
90 DeclarativeInput *input() const;
92 DeclarativeMediaPlayer *mediaPlayer() const;
94 DeclarativeAdapter *adapter() const;
97 BluezQt::PendingCall *connectToDevice();
98 BluezQt::PendingCall *disconnectFromDevice();
99 BluezQt::PendingCall *connectProfile(const
QString &uuid);
100 BluezQt::PendingCall *disconnectProfile(const
QString &uuid);
101 BluezQt::PendingCall *pair();
102 BluezQt::PendingCall *cancelPairing();
105 void deviceRemoved(DeclarativeDevice *device);
106 void deviceChanged(DeclarativeDevice *device);
107 void nameChanged(const
QString &name);
108 void friendlyNameChanged(const
QString &friendlyName);
109 void remoteNameChanged(const
QString &remoteName);
110 void deviceClassChanged(quint32 deviceClass);
111 void typeChanged(BluezQt::Device::Type type);
112 void appearanceChanged(quint16 appearance);
113 void iconChanged(const
QString &icon);
114 void pairedChanged(
bool paired);
115 void trustedChanged(
bool trusted);
116 void blockedChanged(
bool blocked);
117 void legacyPairingChanged(
bool legacyPairing);
118 void rssiChanged(qint16 rssi);
119 void connectedChanged(
bool connected);
121 void modaliasChanged(const
QString &modalias);
122 void batteryChanged(DeclarativeBattery *battery);
123 void inputChanged(DeclarativeInput *input);
124 void mediaPlayerChanged(DeclarativeMediaPlayer *mediaPlayer);
127 void updateBattery();
129 void updateMediaPlayer();
131 BluezQt::DevicePtr m_device;
132 DeclarativeAdapter *m_adapter;
133 DeclarativeBattery *m_battery;
134 DeclarativeInput *m_input;
135 DeclarativeMediaPlayer *m_mediaPlayer;