/usr/include/KF5/BluezQt/bluezqt/device.h is in libkf5bluezqt-dev 5.18.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | /*
* BluezQt - Asynchronous BlueZ wrapper library
*
* Copyright (C) 2014-2015 David Rosca <nowrep@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) version 3, or any
* later version accepted by the membership of KDE e.V. (or its
* successor approved by the membership of KDE e.V.), which shall
* act as a proxy defined in Section 6 of version 3 of the license.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BLUEZQT_DEVICE_H
#define BLUEZQT_DEVICE_H
#include <QObject>
#include "types.h"
#include "bluezqt_export.h"
namespace BluezQt
{
class Adapter;
class PendingCall;
/**
* Bluetooth device.
*
* This class represents a Bluetooth device.
*/
class BLUEZQT_EXPORT Device : public QObject
{
Q_OBJECT
Q_ENUMS(Type)
Q_PROPERTY(QString ubi READ ubi)
Q_PROPERTY(QString address READ address)
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
Q_PROPERTY(QString friendlyName READ friendlyName NOTIFY friendlyNameChanged)
Q_PROPERTY(QString remoteName READ remoteName NOTIFY remoteNameChanged)
Q_PROPERTY(quint32 deviceClass READ deviceClass NOTIFY deviceClassChanged)
Q_PROPERTY(Type type READ type NOTIFY typeChanged)
Q_PROPERTY(quint16 appearance READ appearance NOTIFY appearanceChanged)
Q_PROPERTY(QString icon READ icon NOTIFY iconChanged)
Q_PROPERTY(bool paired READ isPaired NOTIFY pairedChanged)
Q_PROPERTY(bool trusted READ isTrusted WRITE setTrusted NOTIFY trustedChanged)
Q_PROPERTY(bool blocked READ isBlocked WRITE setBlocked NOTIFY blockedChanged)
Q_PROPERTY(bool legacyPairing READ hasLegacyPairing NOTIFY legacyPairingChanged)
Q_PROPERTY(qint16 rssi READ rssi NOTIFY rssiChanged)
Q_PROPERTY(bool connected READ isConnected NOTIFY connectedChanged)
Q_PROPERTY(QStringList uuids READ uuids NOTIFY uuidsChanged)
Q_PROPERTY(QString modalias READ modalias NOTIFY modaliasChanged)
Q_PROPERTY(InputPtr input READ input NOTIFY inputChanged)
Q_PROPERTY(MediaPlayerPtr mediaPlayer READ mediaPlayer NOTIFY mediaPlayerChanged)
Q_PROPERTY(AdapterPtr adapter READ adapter)
public:
/**
* %Device types.
*/
enum Type {
/** The device is a phone. */
Phone,
/** The device is a modem. */
Modem,
/** The device is a computer. */
Computer,
/** The device is a network. */
Network,
/** The device is a headset. */
Headset,
/** The device is a headphones. */
Headphones,
/** The device is an uncategorized audio video device. */
AudioVideo,
/** The device is a keyboard. */
Keyboard,
/** The device is a mouse. */
Mouse,
/** The device is a joypad. */
Joypad,
/** The device is a graphics tablet (input device). */
Tablet,
/** The deivce is an uncategorized peripheral device. */
Peripheral,
/** The device is a camera. */
Camera,
/** The device is a printer. */
Printer,
/** The device is an uncategorized imaging device. */
Imaging,
/** The device is a wearable device. */
Wearable,
/** The device is a toy. */
Toy,
/** The device is a health device. */
Health,
/** The device is not of any of the known types. */
Uncategorized
};
/**
* Destroys a Device object.
*/
~Device();
/**
* Returns a shared pointer from this.
*
* @return DevicePtr
*/
DevicePtr toSharedPtr() const;
/**
* Returns an UBI of the device.
*
* Example UBI: "/org/bluez/hci0/dev_40_79_6A_0C_39_75"
*
* @return UBI of device
*/
QString ubi() const;
/**
* Returns an address of the device.
*
* Example address: "40:79:6A:0C:39:75"
*
* @return address of device
*/
QString address() const;
/**
* Returns a name of the device.
*
* If the name of the device wasn't previously changed,
* remoteName is returned.
*
* @return name of device
*/
QString name() const;
/**
* Sets the name of the device.
*
* @param name name for device
* @return void pending call
*/
PendingCall *setName(const QString &name);
/**
* Returns a friendly name of the device.
*
* Friendly name is a string "name (remoteName)".
* If the remoteName is same as name, it returns just name.
*
* @return friendly name of device
*/
QString friendlyName() const;
/**
* Returns a remote name of the device.
*
* @return remote name of device
*/
QString remoteName() const;
/**
* Returns a class of the device.
*
* In case of Bluetooth Low Energy only devices,
* device class is invalid (0).
*
* @see type() const
*
* @return class of device
*/
quint32 deviceClass() const;
/**
* Returns a type of the device.
*
* Type of device is deduced from its class.
*
* @see deviceClass() const
*
* @return type of device
*/
Device::Type type() const;
/**
* Returns an appearance of the device.
*
* @return appearance of device
*/
quint16 appearance() const;
/**
* Returns an icon name of the device.
*
* In case the icon is empty, "preferences-system-bluetooth" is returned.
*
* @return icon name of device
*/
QString icon() const;
/**
* Returns whether the device is paired.
*
* @return true if device is paired
*/
bool isPaired() const;
/**
* Returns whether the device is trusted.
*
* @return true if device is trusted
*/
bool isTrusted() const;
/**
* Sets the trusted state of the device.
*
* @param trusted trusted state
* @return void pending call
*/
PendingCall *setTrusted(bool trusted);
/**
* Returns whether the device is blocked.
*
* @return true if device is blocked
*/
bool isBlocked() const;
/**
* Sets the blocked state of the device.
*
* @param blocked blocked state
* @return void pending call
*/
PendingCall *setBlocked(bool blocked);
/**
* Returns whether the device has legacy pairing.
*
* @return true if device has legacy pairing
*/
bool hasLegacyPairing() const;
/**
* Returns Received Signal Strength Indicator of the device.
*
* The bigger value indicates better signal strength.
*
* @note RSSI is only updated during discovery.
*
* @return RSSI of device
*/
qint16 rssi() const;
/**
* Returns whether the device is connected.
*
* @return true if connected
*/
bool isConnected() const;
/**
* Returns UUIDs of supported services by the device.
*
* UUIDs will always be returned in uppercase.
*
* @return UUIDs of supported services
*/
QStringList uuids() const;
/**
* Returns remote device ID in modalias format.
*
* @return device modalias
*/
QString modalias() const;
/**
* Returns the input interface for the device.
*
* Only input devices will have valid input interface.
*
* @return null if device have no input
*/
InputPtr input() const;
/**
* Returns the media player interface for the device.
*
* Only devices with connected appropriate profile will
* have valid media player interface.
*
* @return null if device have no media player
*/
MediaPlayerPtr mediaPlayer() const;
/**
* Returns an adapter that discovered this device.
*
* @return adapter of device
*/
AdapterPtr adapter() const;
/**
* Returns a string for device type.
*
* @param type device type
* @return device type string
*/
static QString typeToString(Device::Type type);
/**
* Returns a device type for string.
*
* @param typeString type string
* @return device type
*/
static Device::Type stringToType(const QString &typeString);
public Q_SLOTS:
/**
* Connects all auto-connectable profiles of the device.
*
* This method indicates success if at least one profile was connected.
*
* Possible errors: PendingCall::NotReady, PendingCall::Failed,
* PendingCall::InProgress, PendingCall::AlreadyConnected
*
* @return void pending call
*/
PendingCall *connectToDevice();
/**
* Disconnects all connected profiles of the device.
*
* This method can be used to cancel not-yet finished connectDevice() call.
*
* Possible errors: PendingCall::NotConnected
*
* @return void pending call
*/
PendingCall *disconnectFromDevice();
/**
* Connects a specific profile of the device.
*
* Possible errors: PendingCall::DoesNotExist, PendingCall::AlreadyConnected,
* PendingCall::ConnectFailed
*
* @param uuid service UUID
* @return void pending call
*/
PendingCall *connectProfile(const QString &uuid);
/**
* Disconnects a specific profile of the device.
*
* Possible errors: PendingCall::DoesNotExist, PendingCall::Failed,
* PendingCall::NotConnected, PendingCall::NotSupported
*
* @param uuid service UUID
* @return void pending call
*/
PendingCall *disconnectProfile(const QString &uuid);
/**
* Initiates a pairing with the device.
*
* Possible errors: PendingCall::InvalidArguments, PendingCall::Failed,
* PendingCall::AlreadyExists, PendingCall::AuthenticationCanceled,
* PendingCall::AuthenticationFailed, PendingCall::AuthenticationRejected,
* PendingCall::AuthenticationTimeout, PendingCall::ConnectionAttemptFailed
*
* @return void pending call
*/
PendingCall *pair();
/**
* Cancels a pairing with the device.
*
* This method can be used to cancel pairing operation inititated with pair().
*
* Possible errors: PendingCall::DoesNotExist, PendingCall::Failed
*
* @return void pending call
*/
PendingCall *cancelPairing();
Q_SIGNALS:
/**
* Indicates that the device was removed.
*/
void deviceRemoved(DevicePtr device);
/**
* Indicates that at least one of the device's properties have changed.
*/
void deviceChanged(DevicePtr device);
/**
* Indicates that device's name have changed.
*/
void nameChanged(const QString &name);
/**
* Indicates that device's friendly name have changed.
*/
void friendlyNameChanged(const QString &friendlyName);
/**
* Indicates that device's remote name have changed.
*/
void remoteNameChanged(const QString &remoteName);
/**
* Indicates that device's class have changed.
*/
void deviceClassChanged(quint32 deviceClass);
/**
* Indicates that device's type have changed.
*/
void typeChanged(Type type);
/**
* Indicates that device's appearance have changed.
*/
void appearanceChanged(quint16 appearance);
/**
* Indicates that device's icon have changed.
*/
void iconChanged(const QString &icon);
/**
* Indicates that device's paired state have changed.
*/
void pairedChanged(bool paired);
/**
* Indicates that device's trusted state have changed.
*/
void trustedChanged(bool trusted);
/**
* Indicates that device's blocked state have changed.
*/
void blockedChanged(bool blocked);
/**
* Indicates that device's legacy pairing state have changed.
*/
void legacyPairingChanged(bool legacyPairing);
/**
* Indicates that device's RSSI have changed.
*/
void rssiChanged(qint16 rssi);
/**
* Indicates that device's connected state have changed.
*/
void connectedChanged(bool connected);
/**
* Indicates that device's UUIDs have changed.
*/
void uuidsChanged(const QStringList &uuids);
/**
* Indicates that device's modalias have changed.
*/
void modaliasChanged(const QString &modalias);
/**
* Indicates that device's input have changed.
*/
void inputChanged(InputPtr input);
/**
* Indicates that device's media player have changed.
*/
void mediaPlayerChanged(MediaPlayerPtr mediaPlayer);
private:
explicit Device(const QString &path, const QVariantMap &properties, AdapterPtr adapter);
class DevicePrivate *const d;
friend class DevicePrivate;
friend class ManagerPrivate;
friend class Adapter;
};
} // namespace BluezQt
#endif // BLUEZQT_DEVICE_H
|