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

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