| 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_LEADVERTISINGMANAGER_H |
| 10 |
#define BLUEZQT_LEADVERTISINGMANAGER_H |
| 11 |
|
| 12 |
#include <QObject> |
| 13 |
|
| 14 |
#include "bluezqt_export.h" |
| 15 |
|
| 16 |
#include <memory> |
| 17 |
|
| 18 |
namespace BluezQt |
| 19 |
{ |
| 20 |
class LEAdvertisement; |
| 21 |
class PendingCall; |
| 22 |
|
| 23 |
/*! |
| 24 |
* \inmodule BluezQt |
| 25 |
* \class BluezQt::LEAdvertisingManager |
| 26 |
* \inheaderfile BluezQt/LEAdvertisingManager |
| 27 |
* \brief Bluetooth LE advertising manager. |
| 28 |
* |
| 29 |
* The Advertising Manager allows external applications to register Advertisement |
| 30 |
* Data which should be broadcast to devices. Advertisement Data elements must |
| 31 |
* follow the API for LE Advertisement Data. |
| 32 |
* |
| 33 |
* \sa LEAdvertisement |
| 34 |
*/ |
| 35 |
class BLUEZQT_EXPORT LEAdvertisingManager : public QObject |
| 36 |
{ |
| 37 |
Q_OBJECT |
| 38 |
|
| 39 |
public: |
| 40 |
~LEAdvertisingManager() override; |
| 41 |
|
| 42 |
/*! |
| 43 |
* Registers an \a advertisement object to be sent over the LE Advertising |
| 44 |
* channel. |
| 45 |
* |
| 46 |
* The service must be exported under interface LEAdvertisement1. |
| 47 |
* |
| 48 |
* InvalidArguments error indicates invalid or conflicting properties. |
| 49 |
* |
| 50 |
* InvalidLength error indicates that provided data results in too long data packet. |
| 51 |
* |
| 52 |
* The properties of this object are parsed on register, any changes are ignored. |
| 53 |
* |
| 54 |
* If the same object is registered twice it will result in an AlreadyExists error. |
| 55 |
* |
| 56 |
* NotPermitted error indicates that the maximum number of advertisements is reached. |
| 57 |
* |
| 58 |
* Possible errors: |
| 59 |
* |
| 60 |
* \list |
| 61 |
* \li PendingCall::InvalidArguments |
| 62 |
* \li PendingCall::AlreadyExists |
| 63 |
* \li PendingCall::InvalidLength |
| 64 |
* \li PendingCall::NotPermitted |
| 65 |
* \endlist |
| 66 |
* |
| 67 |
* Returns void pending call. |
| 68 |
*/ |
| 69 |
PendingCall *registerAdvertisement(LEAdvertisement *advertisement); |
| 70 |
|
| 71 |
/*! |
| 72 |
* Unregisters \a advertisement. |
| 73 |
* |
| 74 |
* This unregisters an advertisement that has been previously registered. |
| 75 |
* The object path must match the same value that has been used on registration. |
| 76 |
* |
| 77 |
* Possible errors: |
| 78 |
* |
| 79 |
* \list |
| 80 |
* \li PendingCall::InvalidArguments |
| 81 |
* \li PendingCall::DoesNotExist |
| 82 |
* \endlist |
| 83 |
* |
| 84 |
* Returns void pending call. |
| 85 |
*/ |
| 86 |
PendingCall *unregisterAdvertisement(LEAdvertisement *advertisement); |
| 87 |
|
| 88 |
private: |
| 89 |
BLUEZQT_NO_EXPORT explicit LEAdvertisingManager(const QString &path, QObject *parent = nullptr); |
| 90 |
|
| 91 |
std::unique_ptr<class LEAdvertisingManagerPrivate> const d; |
| 92 |
|
| 93 |
friend class AdapterPrivate; |
| 94 |
}; |
| 95 |
|
| 96 |
} // namespace BluezQt |
| 97 |
|
| 98 |
#endif // BLUEZQT_LEADVERTISINGMANAGER_H |