9#ifndef DECLARATIVEADAPTER_H
10#define DECLARATIVEADAPTER_H
12#include <QQmlListProperty>
13#include <qqmlregistration.h>
16#include "declarativedevice.h"
17#include "pendingcall.h"
19class DeclarativeAdapter :
public QObject
22 QML_NAMED_ELEMENT(Adapter)
23 QML_UNCREATABLE(
"Adapter cannot be created")
29 Q_PROPERTY(quint32 adapterClass READ adapterClass NOTIFY adapterClassChanged)
30 Q_PROPERTY(
bool powered READ isPowered WRITE setPowered NOTIFY poweredChanged)
31 Q_PROPERTY(
bool discoverable READ isDiscoverable WRITE setDiscoverable NOTIFY discoverableChanged)
32 Q_PROPERTY(quint32 discoverableTimeout READ discoverableTimeout WRITE setDiscoverableTimeout NOTIFY discoverableTimeoutChanged)
33 Q_PROPERTY(
bool pairable READ isPairable WRITE setPairable NOTIFY pairableChanged)
34 Q_PROPERTY(quint32 pairableTimeout READ pairableTimeout WRITE setPairableTimeout NOTIFY pairableTimeoutChanged)
35 Q_PROPERTY(
bool discovering READ isDiscovering NOTIFY discoveringChanged)
41 explicit DeclarativeAdapter(BluezQt::AdapterPtr adapter,
QObject *
parent =
nullptr);
48 void setName(const
QString &name);
52 quint32 adapterClass() const;
54 bool isPowered() const;
55 void setPowered(
bool powered);
57 bool isDiscoverable() const;
58 void setDiscoverable(
bool discoverable);
60 quint32 discoverableTimeout() const;
61 void setDiscoverableTimeout(quint32 timeout);
63 bool isPairable() const;
64 void setPairable(
bool pairable);
66 quint32 pairableTimeout() const;
67 void setPairableTimeout(quint32 timeout);
77 BluezQt::AdapterPtr m_adapter;
81 DeclarativeDevice *deviceForAddress(const
QString &address) const;
82 BluezQt::PendingCall *startDiscovery();
83 BluezQt::PendingCall *stopDiscovery();
84 BluezQt::PendingCall *removeDevice(DeclarativeDevice *device);
87 void adapterRemoved(DeclarativeAdapter *adapter);
88 void adapterChanged(DeclarativeAdapter *adapter);
89 void nameChanged(const
QString &name);
90 void systemNameChanged(const
QString &name);
91 void adapterClassChanged(quint32 adapterClass);
92 void poweredChanged(
bool powered);
93 void discoverableChanged(
bool discoverable);
94 void discoverableTimeoutChanged(quint32 timeout);
95 void pairableChanged(
bool pairable);
96 void pairableTimeoutChanged(quint32 timeout);
97 void discoveringChanged(
bool discovering);
99 void modaliasChanged(const
QString &modalias);
100 void deviceFound(DeclarativeDevice *device);
101 void deviceRemoved(DeclarativeDevice *device);
102 void deviceChanged(DeclarativeDevice *device);
107 void slotDeviceAdded(BluezQt::DevicePtr device);
108 void slotDeviceRemoved(BluezQt::DevicePtr device);
111 DeclarativeDevice *declarativeDeviceFromPtr(BluezQt::DevicePtr ptr) const;
QObject * parent() const const