File indexing completed on 2024-04-28 15:17:51

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