| 1 |
/* |
| 2 |
* BluezQt - Asynchronous BlueZ wrapper library |
| 3 |
* |
| 4 |
* SPDX-FileCopyrightText: 2019 Manuel Weichselbaumer <[email protected]> |
| 5 |
* |
| 6 |
* SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 7 |
*/ |
| 8 |
|
| 9 |
#ifndef BLUEZQT_LEADVERTISEMENT_H |
| 10 |
#define BLUEZQT_LEADVERTISEMENT_H |
| 11 |
|
| 12 |
#include <QObject> |
| 13 |
|
| 14 |
#include "bluezqt_export.h" |
| 15 |
|
| 16 |
#include <memory> |
| 17 |
|
| 18 |
class QDBusObjectPath; |
| 19 |
|
| 20 |
namespace BluezQt |
| 21 |
{ |
| 22 |
/*! |
| 23 |
* \inmodule BluezQt |
| 24 |
* \class BluezQt::LEAdvertisement |
| 25 |
* \inheaderfile BluezQt/LEAdvertisement |
| 26 |
* \brief Bluetooth LE advertisement. |
| 27 |
* |
| 28 |
* This class represents a Bluetooth LE advertisement. |
| 29 |
*/ |
| 30 |
class BLUEZQT_EXPORT LEAdvertisement : public QObject |
| 31 |
{ |
| 32 |
Q_OBJECT |
| 33 |
|
| 34 |
public: |
| 35 |
/*! |
| 36 |
* Creates a new LEAdvertisement object with the given \a serviceUuids as a child of \a parent. |
| 37 |
*/ |
| 38 |
explicit LEAdvertisement(const QStringList &serviceUuids, QObject *parent = nullptr); |
| 39 |
|
| 40 |
~LEAdvertisement() override; |
| 41 |
|
| 42 |
/*! |
| 43 |
* List of UUIDs to include in the "Service UUID" field of the Advertising Data. |
| 44 |
*/ |
| 45 |
virtual QStringList serviceUuids() const; |
| 46 |
|
| 47 |
/*! |
| 48 |
* Returns the service data included in the advertisement. |
| 49 |
* \since 5.75 |
| 50 |
*/ |
| 51 |
QHash<QString, QByteArray> serviceData() const; |
| 52 |
|
| 53 |
/*! |
| 54 |
* Sets the service data to include in the advertisement. |
| 55 |
* |
| 56 |
* Keys are the UUIDs of the associated data. |
| 57 |
* \since 5.75 |
| 58 |
*/ |
| 59 |
void setServiceData(const QHash<QString, QByteArray> &data); |
| 60 |
|
| 61 |
/*! |
| 62 |
* Returns the manufacturer IDs and associated data included in the advertisement. |
| 63 |
* |
| 64 |
* Keys are the manufacturer ID. |
| 65 |
* \since 6.1 |
| 66 |
*/ |
| 67 |
QHash<quint16, QByteArray> manufacturerData() const; |
| 68 |
|
| 69 |
/*! |
| 70 |
* Sets the manufacturer IDs and associated \a data to be included in the advertisement. |
| 71 |
* |
| 72 |
* Keys are the manufacturer ID. |
| 73 |
* \since 6.1 |
| 74 |
*/ |
| 75 |
void setManufacturerData(const QHash<quint16, QByteArray> &data); |
| 76 |
|
| 77 |
/*! |
| 78 |
* Indicates that the LEAdvertisement was unregistered. |
| 79 |
* |
| 80 |
* This method gets called when the service daemon removes the Advertisement. |
| 81 |
* |
| 82 |
* A client can use it to do cleanup tasks. |
| 83 |
* |
| 84 |
* There is no need to call UnregisterAdvertisement because |
| 85 |
* when this method gets called it has already been unregistered. |
| 86 |
*/ |
| 87 |
virtual void release(); |
| 88 |
|
| 89 |
protected: |
| 90 |
/*! |
| 91 |
* Returns the D-Bus object path of the advertisement. |
| 92 |
* |
| 93 |
* The path where the advertisement will be registered. |
| 94 |
* |
| 95 |
* \note You must provide valid object path! |
| 96 |
*/ |
| 97 |
virtual QDBusObjectPath objectPath() const; |
| 98 |
|
| 99 |
private: |
| 100 |
std::unique_ptr<class LEAdvertisementPrivate> const d; |
| 101 |
|
| 102 |
friend class LEAdvertisingManager; |
| 103 |
}; |
| 104 |
|
| 105 |
} // namespace BluezQt |
| 106 |
|
| 107 |
#endif // BLUEZQT_LEADVERTISEMENT_H |