11#include "pendingcall.h"
16Device::Device(
const QString &path,
const QVariantMap &properties, AdapterPtr adapter)
22Device::~Device() =
default;
26 return d->q.toStrongRef();
31 return d->m_bluezDevice->path();
46 return new PendingCall(d->setDBusProperty(QStringLiteral(
"Alias"), name), PendingCall::ReturnVoid,
this);
51 if (name().isEmpty() || name() == remoteName()) {
54 if (remoteName().isEmpty()) {
57 return QStringLiteral(
"%1 (%2)").
arg(name(), remoteName());
65quint32 Device::deviceClass()
const
67 return d->m_deviceClass;
72 if (deviceClass() == 0) {
73 return appearanceToType(appearance());
76 return classToType(d->m_deviceClass);
79quint16 Device::appearance()
const
81 return d->m_appearance;
88 return QStringLiteral(
"audio-headset");
90 return QStringLiteral(
"audio-headphones");
92 return d->m_icon.isEmpty() ? QStringLiteral(
"preferences-system-bluetooth") : d->m_icon;
108 return new PendingCall(d->setDBusProperty(QStringLiteral(
"Trusted"), trusted), PendingCall::ReturnVoid,
this);
118 return new PendingCall(d->setDBusProperty(QStringLiteral(
"Blocked"), blocked), PendingCall::ReturnVoid,
this);
123 return d->m_legacyPairing;
126qint16 Device::rssi()
const
131ManData Device::manufacturerData()
const
133 return d->m_manufacturerData;
138 return d->m_servicesResolved;
143 return d->m_connected;
153 return d->m_modalias;
158 return d->m_serviceData;
161BatteryPtr Device::battery()
const
166InputPtr Device::input()
const
171MediaPlayerPtr Device::mediaPlayer()
const
173 return d->m_mediaPlayer;
176MediaTransportPtr Device::mediaTransport()
const
178 return d->m_mediaTransport;
181AdapterPtr Device::adapter()
const
188 return d->m_services;
195 return QStringLiteral(
"phone");
197 return QStringLiteral(
"modem");
199 return QStringLiteral(
"computer");
201 return QStringLiteral(
"network");
203 return QStringLiteral(
"headset");
205 return QStringLiteral(
"headphones");
207 return QStringLiteral(
"audiovideo");
209 return QStringLiteral(
"keyboard");
211 return QStringLiteral(
"mouse");
213 return QStringLiteral(
"joypad");
215 return QStringLiteral(
"tablet");
217 return QStringLiteral(
"peripheral");
219 return QStringLiteral(
"camera");
221 return QStringLiteral(
"printer");
223 return QStringLiteral(
"imaging");
225 return QStringLiteral(
"wearable");
227 return QStringLiteral(
"toy");
229 return QStringLiteral(
"health");
231 return QStringLiteral(
"uncategorized");
279 return new PendingCall(d->m_bluezDevice->Connect(), PendingCall::ReturnVoid,
this);
284 return new PendingCall(d->m_bluezDevice->Disconnect(), PendingCall::ReturnVoid,
this);
289 return new PendingCall(d->m_bluezDevice->ConnectProfile(uuid), PendingCall::ReturnVoid,
this);
294 return new PendingCall(d->m_bluezDevice->DisconnectProfile(uuid), PendingCall::ReturnVoid,
this);
299 return new PendingCall(d->m_bluezDevice->Pair(), PendingCall::ReturnVoid,
this);
304 return new PendingCall(d->m_bluezDevice->CancelPairing(), PendingCall::ReturnVoid,
this);
309#include "moc_device.cpp"
PendingCall * connectProfile(const QString &uuid)
Connects a specific profile of the device.
bool isTrusted() const
Returns whether the device is trusted.
bool isConnected() const
Returns whether the device is connected.
bool hasLegacyPairing() const
Returns whether the device has legacy pairing.
PendingCall * pair()
Initiates a pairing with the device.
PendingCall * setTrusted(bool trusted)
Sets the trusted state of the device.
QHash< QString, QByteArray > serviceData() const
Returns the service advertisement data.
@ Modem
The device is a modem.
@ Wearable
The device is a wearable device.
@ Uncategorized
The device is not of any of the known types.
@ Headset
The device is a headset.
@ Imaging
The device is an uncategorized imaging device.
@ Tablet
The device is a graphics tablet (input device).
@ Camera
The device is a camera.
@ Peripheral
The device is an uncategorized peripheral device.
@ AudioVideo
The device is an uncategorized audio video device.
@ Toy
The device is a toy.
@ Network
The device is a network.
@ Mouse
The device is a mouse.
@ Phone
The device is a phone.
@ Headphones
The device is a headphones.
@ Computer
The device is a computer.
@ Joypad
The device is a joypad.
@ Printer
The device is a printer.
@ Keyboard
The device is a keyboard.
@ Health
The device is a health device.
PendingCall * connectToDevice()
Connects all auto-connectable profiles of the device.
PendingCall * cancelPairing()
Cancels a pairing with the device.
PendingCall * setBlocked(bool blocked)
Sets the blocked state of the device.
bool isPaired() const
Returns whether the device is paired.
bool isBlocked() const
Returns whether the device is blocked.
PendingCall * disconnectProfile(const QString &uuid)
Disconnects a specific profile of the device.
static Device::Type stringToType(const QString &typeString)
Returns a device type for string.
PendingCall * setName(const QString &name)
Sets the name of the device.
DevicePtr toSharedPtr() const
Returns a shared pointer from this.
static QString typeToString(Device::Type type)
Returns a string for device type.
PendingCall * disconnectFromDevice()
Disconnects all connected profiles of the device.
bool isServicesResolved() const
Returns whether or not service discovery has been resolved.
QString path(const QString &relativePath)
QString arg(Args &&... args) const const