5#ifndef DBLUETOOTHADAPTER_H
6#define DBLUETOOTHADAPTER_H
10#include <QScopedPointer>
14DBLUETOOTH_BEGIN_NAMESPACE
16using DTK_CORE_NAMESPACE::DExpected;
17using DTK_CORE_NAMESPACE::DObject;
26 explicit DAdapter(quint64 adapter, QObject *parent =
nullptr);
32 Q_PROPERTY(QString address READ address CONSTANT)
34 Q_PROPERTY(QString name READ name NOTIFY nameChanged)
35 Q_PROPERTY(QString alias READ alias WRITE setAlias NOTIFY aliasChanged)
36 Q_PROPERTY(
bool powered READ powered WRITE setPowered NOTIFY poweredChanged)
37 Q_PROPERTY(
bool discoverable READ discoverable WRITE setDiscoverable NOTIFY discoverableChanged)
39 quint32 discoverableTimeout READ discoverableTimeout WRITE setDiscoverableTimeout NOTIFY discoverableTimeoutChanged)
40 Q_PROPERTY(
bool discovering READ discovering NOTIFY discoveringChanged)
42 QString address() const;
45 QString alias() const;
46 void setAlias(const QString &alias);
48 void setPowered(
bool powered);
49 bool discoverable() const;
50 void setDiscoverable(
bool discoverable);
51 quint32 discoverableTimeout() const;
52 void setDiscoverableTimeout(quint32 discoverableTimeout);
53 bool discovering() const;
55 DExpected<QSharedPointer<
DDevice>> deviceFromAddress(const QString &deviceAddress) const;
56 DExpected<QStringList> devices() const;
58 DExpected<
void> removeDevice(const QString &device) const;
59 DExpected<
void> startDiscovery() const;
60 DExpected<
void> stopDiscovery() const;
63 void addressTypeChanged(
DDevice::AddressType type);
64 void nameChanged(const QString &name);
65 void aliasChanged(const QString &alias);
66 void poweredChanged(
bool powered);
67 void discoverableChanged(
bool discoverable);
68 void discoverableTimeoutChanged(quint32 discoverableTimeout);
69 void discoveringChanged(
bool discovering);
72 void deviceAdded(const QString &deviceAddress);
73 void deviceRemoved(const QString &deviceAddress);
79DBLUETOOTH_END_NAMESPACE
对于蓝牙适配器的封装
Definition: dbluetoothadapter.h:24
对于蓝牙设备的封装
Definition: dbluetoothdevice.h:22
AddressType
Definition: dbluetoothdevice.h:31
蓝牙管理类, DAdapter对象由此创建
Definition: dbluetoothmanager.h:22