BluezQt

leadvertisement.h
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
18class QDBusObjectPath;
19
20namespace 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 */
29class BLUEZQT_EXPORT LEAdvertisement : public QObject
30{
31 Q_OBJECT
32
33public:
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 * Returns the manufacturer data included in the advertisement.
70 *
71 * @return A QHash representing the manufaturer IDs and associated data. Keys are manufaturer ID.
72 * @since 6.1
73 */
74 QHash<quint16, QByteArray> manufacturerData() const;
75
76 /**
77 * Sets the manufacturer data to be included in the advertisement.
78 *
79 * @param data QHash representing the manufacturer IDs and associated data. Keys are manufacturer ID.
80 * @since 6.1
81 */
82 void setManufacturerData(const QHash<quint16, QByteArray> &data);
83
84 /**
85 * Indicates that the LEAdvertisement was unregistered.
86 *
87 * This method gets called when the service daemon removes the Advertisement.
88 * A client can use it to do cleanup tasks. There is no need to call
89 * UnregisterAdvertisement because when this method gets called it has
90 * already been unregistered.
91 */
92 virtual void release();
93
94protected:
95 /**
96 * D-Bus object path of the advertisement.
97 *
98 * The path where the advertisement will be registered.
99 *
100 * @note You must provide valid object path!
101 *
102 * @return object path of advertisement
103 */
104 virtual QDBusObjectPath objectPath() const;
105
106private:
107 std::unique_ptr<class LEAdvertisementPrivate> const d;
108
109 friend class LEAdvertisingManager;
110};
111
112} // namespace BluezQt
113
114#endif // BLUEZQT_LEADVERTISEMENT_H
Bluetooth LE advertisement.
~LEAdvertisement() override
Destroys a LEAdvertisement object.
Bluetooth LE advertising manager.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:46:08 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.