File indexing completed on 2024-05-05 03:52:30

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 #include <memory>
0017 
0018 namespace BluezQt
0019 {
0020 class LEAdvertisement;
0021 class PendingCall;
0022 
0023 /**
0024  * @class BluezQt::LEAdvertisingManager leadvertisingmanager.h <BluezQt/LEAdvertisingManager>
0025  *
0026  * Bluetooth LE advertising manager.
0027  *
0028  * The Advertising Manager allows external applications to register Advertisement
0029  * Data which should be broadcast to devices. Advertisement Data elements must
0030  * follow the API for LE Advertisement Data.
0031  *
0032  * @see LEAdvertisement
0033  */
0034 class BLUEZQT_EXPORT LEAdvertisingManager : public QObject
0035 {
0036     Q_OBJECT
0037 
0038 public:
0039     /**
0040      * Destroys an LEAdvertisingManager object.
0041      */
0042     ~LEAdvertisingManager() override;
0043 
0044     /**
0045      * Registers advertisement.
0046      *
0047      * Registers an advertisement object to be sent over the LE Advertising
0048      * channel. The service must be exported under interface LEAdvertisement1.
0049      *
0050      * InvalidArguments error indicates invalid or conflicting properties.
0051      * InvalidLength error indicates that provided data results in too long data packet.
0052      * The properties of this object are parsed on register, any changes are ignored.
0053      * If the same object is registered twice it will result in an AlreadyExists error.
0054      * NotPermitted error indicates that the maximum number of advertisements is reached.
0055      *
0056      * Possible errors: PendingCall::InvalidArguments, PendingCall::AlreadyExists,
0057      *                  PendingCall::InvalidLength, PendingCall::NotPermitted
0058      *
0059      * @param advertisement advertisement to be registered
0060      * @return void pending call
0061      */
0062     PendingCall *registerAdvertisement(LEAdvertisement *advertisement);
0063 
0064     /**
0065      * Unregisters advertisement.
0066      *
0067      * This unregisters an advertisement that has been previously registered.
0068      * The object path must match the same value that has been used on registration.
0069      *
0070      * Possible errors: PendingCall::InvalidArguments, PendingCall::DoesNotExist
0071      *
0072      * @param advertisement advertisement to be unregistered
0073      * @return void pending call
0074      */
0075     PendingCall *unregisterAdvertisement(LEAdvertisement *advertisement);
0076 
0077 private:
0078     BLUEZQT_NO_EXPORT explicit LEAdvertisingManager(const QString &path, QObject *parent = nullptr);
0079 
0080     std::unique_ptr<class LEAdvertisingManagerPrivate> const d;
0081 
0082     friend class AdapterPrivate;
0083 };
0084 
0085 } // namespace BluezQt
0086 
0087 #endif // BLUEZQT_LEADVERTISINGMANAGER_H