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

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_GATTSERVICE_H
0010 #define BLUEZQT_GATTSERVICE_H
0011 
0012 #include "bluezqt_export.h"
0013 #include "types.h"
0014 
0015 #include <QDBusObjectPath>
0016 
0017 namespace BluezQt
0018 {
0019 /**
0020  * @class BluezQt::GattService GattService.h <BluezQt/GattService>
0021  *
0022  * Bluetooth GattService.
0023  *
0024  * This class represents a Bluetooth GattService.
0025  */
0026 class GattApplication;
0027 class BLUEZQT_EXPORT GattService : public QObject
0028 {
0029     Q_OBJECT
0030 
0031 public:
0032     /**
0033      * Creates a new GattService object.
0034      *
0035      * @param parent
0036      */
0037     explicit GattService(const QString &uuid, bool isPrimary, GattApplication *parent);
0038 
0039     /**
0040      * Destroys a GattService object.
0041      */
0042     ~GattService() override;
0043 
0044     /**
0045      * 128-bit service UUID.
0046      *
0047      * @return uuid of gatt service
0048      */
0049     QString uuid() const;
0050 
0051     /**
0052      * Indicates whether or not this GATT service is a
0053      * primary service. If false, the service is secondary.
0054      *
0055      * @return true if gatt service is primary
0056      */
0057     bool isPrimary() const;
0058 
0059 protected:
0060     /**
0061      * D-Bus object path of the GattService.
0062      *
0063      * The path where the GattService will be registered.
0064      *
0065      * @note You must provide valid object path!
0066      *
0067      * @return object path of GattService
0068      */
0069     virtual QDBusObjectPath objectPath() const;
0070 
0071 private:
0072     class GattServicePrivate *const d;
0073 
0074     friend class GattApplicationPrivate;
0075     friend class GattCharacterisiticPrivate;
0076     friend class GattCharacteristicAdaptor;
0077     friend class GattManager;
0078 };
0079 
0080 } // namespace BluezQt
0081 
0082 #endif