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

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_GATTAPPLICATION_H
0010 #define BLUEZQT_GATTAPPLICATION_H
0011 
0012 #include <QObject>
0013 
0014 #include "bluezqt_export.h"
0015 
0016 #include <memory>
0017 
0018 class QDBusObjectPath;
0019 
0020 namespace BluezQt
0021 {
0022 /**
0023  * @class BluezQt::GattApplication GattApplication.h <BluezQt/GattApplication>
0024  *
0025  * Bluetooth GattApplication.
0026  *
0027  * This class represents a Bluetooth GattApplication, which is the root node of
0028  * a GATT object hierarchy. Its child nodes can be GattServices,
0029  * GattCharacteristics and GattDescriptors that belong to that GattApplication.
0030  * The object path prefix for GattApplications is freely definable and its
0031  * children's paths follow the application path hierarchy automatically, while
0032  * all instances are enumerated automatically as well.
0033  *
0034  * Object path: [variable prefix]/appXX/serviceYY/charZZ
0035  *
0036  */
0037 class BLUEZQT_EXPORT GattApplication : public QObject
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042     /**
0043      * Creates a new GattApplication object with default object path prefix.
0044      *
0045      * Object path: /org/kde/bluezqt/appXX/serviceYY/charZZ
0046      *
0047      * @param parent
0048      */
0049     explicit GattApplication(QObject *parent = nullptr);
0050 
0051     /**
0052      * Creates a new GattApplication object with custom object path prefix.
0053      *
0054      * Object path: [objectPathPrefix]/appXX/serviceYY/charZZ
0055      *
0056      * @param objectPathPrefix
0057      * @param parent
0058      */
0059     explicit GattApplication(const QString &objectPathPrefix, QObject *parent = nullptr);
0060 
0061     /**
0062      * Destroys a GattApplication object.
0063      */
0064     ~GattApplication() override;
0065 
0066 private:
0067     /**
0068      * D-Bus object path of the GATT application.
0069      *
0070      * The path where the GATT application will be registered.
0071      *
0072      * @note You must provide valid object path!
0073      *
0074      * @return object path of GATT application
0075      */
0076     virtual QDBusObjectPath objectPath() const;
0077 
0078     std::unique_ptr<class GattApplicationPrivate> const d;
0079 
0080     friend class GattManager;
0081     friend class GattService;
0082     friend class ObjectManagerAdaptor;
0083 };
0084 
0085 } // namespace BluezQt
0086 
0087 #endif