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_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 | * @class BluezQt::LEAdvertisement leadvertisement.h <BluezQt/LEAdvertisement> |
24 | * |
25 | * Bluetooth LE advertisement. |
26 | * |
27 | * This class represents a Bluetooth LE advertisement. |
28 | */ |
29 | class BLUEZQT_EXPORT LEAdvertisement : public QObject |
30 | { |
31 | Q_OBJECT |
32 | |
33 | public: |
34 | /** |
35 | * Creates a new LEAdvertisement object. |
36 | * |
37 | * @param parent |
38 | */ |
39 | explicit LEAdvertisement(const QStringList &serviceUuids, QObject *parent = nullptr); |
40 | |
41 | /** |
42 | * Destroys a LEAdvertisement object. |
43 | */ |
44 | ~LEAdvertisement() override; |
45 | |
46 | /** |
47 | * List of UUIDs to include in the "Service UUID" field of the Advertising Data. |
48 | * |
49 | * @return UUIDs of the advertisement |
50 | */ |
51 | virtual QStringList serviceUuids() const; |
52 | |
53 | /** |
54 | * Returns the service data included in the advertisement. |
55 | * |
56 | * @since 5.75 |
57 | */ |
58 | QHash<QString, QByteArray> serviceData() const; |
59 | |
60 | /** |
61 | * Sets the service data to include in the advertisement. |
62 | * Keys are the UUIDs of the associated data. |
63 | * |
64 | * @since 5.75 |
65 | */ |
66 | void setServiceData(const QHash<QString, QByteArray> &data); |
67 | |
68 | /** |
69 | * Indicates that the LEAdvertisement was unregistered. |
70 | * |
71 | * This method gets called when the service daemon removes the Advertisement. |
72 | * A client can use it to do cleanup tasks. There is no need to call |
73 | * UnregisterAdvertisement because when this method gets called it has |
74 | * already been unregistered. |
75 | */ |
76 | virtual void release(); |
77 | |
78 | protected: |
79 | /** |
80 | * D-Bus object path of the advertisement. |
81 | * |
82 | * The path where the advertisement will be registered. |
83 | * |
84 | * @note You must provide valid object path! |
85 | * |
86 | * @return object path of advertisement |
87 | */ |
88 | virtual QDBusObjectPath objectPath() const; |
89 | |
90 | private: |
91 | std::unique_ptr<class LEAdvertisementPrivate> const d; |
92 | |
93 | friend class LEAdvertisingManager; |
94 | }; |
95 | |
96 | } // namespace BluezQt |
97 | |
98 | #endif // BLUEZQT_LEADVERTISEMENT_H |
99 | |