File indexing completed on 2024-12-01 12:29:48
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_GATTMANAGER_H 0010 #define BLUEZQT_GATTMANAGER_H 0011 0012 #include <QObject> 0013 0014 #include "bluezqt_export.h" 0015 0016 namespace BluezQt 0017 { 0018 class GattApplication; 0019 class PendingCall; 0020 0021 /** 0022 * @class BluezQt::GattManager GattManager.h <BluezQt/GattManager> 0023 * 0024 * Bluetooth GattManager. 0025 * 0026 * GATT Manager allows external applications to register GATT services and 0027 * profiles. 0028 * 0029 * Registering a profile allows applications to subscribe to *remote* services. 0030 * These must implement the GattProfile1 interface defined above. 0031 * 0032 * Registering a service allows applications to publish a *local* GATT service, 0033 * which then becomes available to remote devices. A GATT service is represented by 0034 * a D-Bus object hierarchy where the root node corresponds to a service and the 0035 * child nodes represent characteristics and descriptors that belong to that 0036 * service. Each node must implement one of GattService1, GattCharacteristic1, 0037 * or GattDescriptor1 interfaces described above, based on the attribute it 0038 * represents. Each node must also implement the standard D-Bus Properties 0039 * interface to expose their properties. These objects collectively represent a 0040 * GATT service definition. 0041 * 0042 * @see GattApplication 0043 */ 0044 class BLUEZQT_EXPORT GattManager : public QObject 0045 { 0046 Q_OBJECT 0047 0048 public: 0049 /** 0050 * Destroys a GattManager object. 0051 */ 0052 ~GattManager() override; 0053 0054 /** 0055 * Registers a local GATT services hierarchy as described 0056 * above (GATT Server) and/or GATT profiles (GATT Client). 0057 * 0058 * The application object path together with the D-Bus 0059 * system bus connection ID define the identification of 0060 * the application registering a GATT based 0061 * service or profile. 0062 * 0063 * Possible errors: org.bluez.Error.InvalidArguments 0064 * org.bluez.Error.AlreadyExists 0065 * 0066 * @param application application to be registered 0067 * @return void pending call 0068 */ 0069 PendingCall *registerApplication(GattApplication *application); 0070 0071 /** 0072 * This unregisters the services that has been 0073 * previously registered. The object path parameter 0074 * must match the same value that has been used 0075 * on registration. 0076 * 0077 * Possible errors: org.bluez.Error.InvalidArguments 0078 * org.bluez.Error.DoesNotExist 0079 * 0080 * @param application application to be unregistered 0081 * @return void pending call 0082 */ 0083 PendingCall *unregisterApplication(GattApplication *application); 0084 0085 private: 0086 BLUEZQT_NO_EXPORT explicit GattManager(const QString &path, QObject *parent = nullptr); 0087 0088 class GattManagerPrivate *const d; 0089 0090 friend class AdapterPrivate; 0091 }; 0092 0093 } // namespace BluezQt 0094 0095 #endif