1/*
2 * BluezQt - Asynchronous BlueZ wrapper library
3 *
4 * SPDX-FileCopyrightText: 2019 Manuel Weichselbaumer <mincequi@web.de>
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
18namespace BluezQt
19{
20class LEAdvertisement;
21class PendingCall;
22
23/**
24 * @class BluezQt::LEAdvertisingManager leadvertisingmanager.h <BluezQt/LEAdvertisingManager>
25 *
26 * Bluetooth LE advertising manager.
27 *
28 * The Advertising Manager allows external applications to register Advertisement
29 * Data which should be broadcast to devices. Advertisement Data elements must
30 * follow the API for LE Advertisement Data.
31 *
32 * @see LEAdvertisement
33 */
34class BLUEZQT_EXPORT LEAdvertisingManager : public QObject
35{
36 Q_OBJECT
37
38public:
39 /**
40 * Destroys an LEAdvertisingManager object.
41 */
42 ~LEAdvertisingManager() override;
43
44 /**
45 * Registers advertisement.
46 *
47 * Registers an advertisement object to be sent over the LE Advertising
48 * channel. The service must be exported under interface LEAdvertisement1.
49 *
50 * InvalidArguments error indicates invalid or conflicting properties.
51 * InvalidLength error indicates that provided data results in too long data packet.
52 * The properties of this object are parsed on register, any changes are ignored.
53 * If the same object is registered twice it will result in an AlreadyExists error.
54 * NotPermitted error indicates that the maximum number of advertisements is reached.
55 *
56 * Possible errors: PendingCall::InvalidArguments, PendingCall::AlreadyExists,
57 * PendingCall::InvalidLength, PendingCall::NotPermitted
58 *
59 * @param advertisement advertisement to be registered
60 * @return void pending call
61 */
62 PendingCall *registerAdvertisement(LEAdvertisement *advertisement);
63
64 /**
65 * Unregisters advertisement.
66 *
67 * This unregisters an advertisement that has been previously registered.
68 * The object path must match the same value that has been used on registration.
69 *
70 * Possible errors: PendingCall::InvalidArguments, PendingCall::DoesNotExist
71 *
72 * @param advertisement advertisement to be unregistered
73 * @return void pending call
74 */
75 PendingCall *unregisterAdvertisement(LEAdvertisement *advertisement);
76
77private:
78 BLUEZQT_NO_EXPORT explicit LEAdvertisingManager(const QString &path, QObject *parent = nullptr);
79
80 std::unique_ptr<class LEAdvertisingManagerPrivate> const d;
81
82 friend class AdapterPrivate;
83};
84
85} // namespace BluezQt
86
87#endif // BLUEZQT_LEADVERTISINGMANAGER_H
88

source code of bluez-qt/src/leadvertisingmanager.h