File indexing completed on 2024-12-08 12:15:34
0001 /* 0002 * BluezQt - Asynchronous BlueZ wrapper library 0003 * 0004 * SPDX-FileCopyrightText: 2019 Manuel Weichselbaumer <mincequi@web.de> 0005 * 0006 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #ifndef BLUEZQT_LEADVERTISINGMANAGER_H 0010 #define BLUEZQT_LEADVERTISINGMANAGER_H 0011 0012 #include <QObject> 0013 0014 #include "bluezqt_export.h" 0015 0016 namespace BluezQt 0017 { 0018 class LEAdvertisement; 0019 class PendingCall; 0020 0021 /** 0022 * @class BluezQt::LEAdvertisingManager leadvertisingmanager.h <BluezQt/LEAdvertisingManager> 0023 * 0024 * Bluetooth LE advertising manager. 0025 * 0026 * The Advertising Manager allows external applications to register Advertisement 0027 * Data which should be broadcast to devices. Advertisement Data elements must 0028 * follow the API for LE Advertisement Data. 0029 * 0030 * @see LEAdvertisement 0031 */ 0032 class BLUEZQT_EXPORT LEAdvertisingManager : public QObject 0033 { 0034 Q_OBJECT 0035 0036 public: 0037 /** 0038 * Destroys an LEAdvertisingManager object. 0039 */ 0040 ~LEAdvertisingManager() override; 0041 0042 /** 0043 * Registers advertisement. 0044 * 0045 * Registers an advertisement object to be sent over the LE Advertising 0046 * channel. The service must be exported under interface LEAdvertisement1. 0047 * 0048 * InvalidArguments error indicates invalid or conflicting properties. 0049 * InvalidLength error indicates that provided data results in too long data packet. 0050 * The properties of this object are parsed on register, any changes are ignored. 0051 * If the same object is registered twice it will result in an AlreadyExists error. 0052 * NotPermitted error indicates that the maximum number of advertisements is reached. 0053 * 0054 * Possible errors: PendingCall::InvalidArguments, PendingCall::AlreadyExists, 0055 * PendingCall::InvalidLength, PendingCall::NotPermitted 0056 * 0057 * @param advertisement advertisement to be registered 0058 * @return void pending call 0059 */ 0060 PendingCall *registerAdvertisement(LEAdvertisement *advertisement); 0061 0062 /** 0063 * Unregisters advertisement. 0064 * 0065 * This unregisters an advertisement that has been previously registered. 0066 * The object path must match the same value that has been used on registration. 0067 * 0068 * Possible errors: PendingCall::InvalidArguments, PendingCall::DoesNotExist 0069 * 0070 * @param advertisement advertisement to be unregistered 0071 * @return void pending call 0072 */ 0073 PendingCall *unregisterAdvertisement(LEAdvertisement *advertisement); 0074 0075 private: 0076 BLUEZQT_NO_EXPORT explicit LEAdvertisingManager(const QString &path, QObject *parent = nullptr); 0077 0078 class LEAdvertisingManagerPrivate *const d; 0079 0080 friend class AdapterPrivate; 0081 }; 0082 0083 } // namespace BluezQt 0084 0085 #endif // BLUEZQT_LEADVERTISINGMANAGER_H