| 1 |
/* |
| 2 |
* BluezQt - Asynchronous BlueZ wrapper library |
| 3 |
* |
| 4 |
* SPDX-FileCopyrightText: 2019 Manuel Weichselbaumer <[email protected]> |
| 5 |
* |
| 6 |
* SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 7 |
*/ |
| 8 |
|
| 9 |
#ifndef BLUEZQT_GATTMANAGER_H |
| 10 |
#define BLUEZQT_GATTMANAGER_H |
| 11 |
|
| 12 |
#include <QObject> |
| 13 |
|
| 14 |
#include "bluezqt_export.h" |
| 15 |
|
| 16 |
#include <memory> |
| 17 |
|
| 18 |
namespace BluezQt |
| 19 |
{ |
| 20 |
class GattApplication; |
| 21 |
class PendingCall; |
| 22 |
|
| 23 |
/*! |
| 24 |
* \inmodule BluezQt |
| 25 |
* \class BluezQt::GattManager |
| 26 |
* \inheaderfile BluezQt/GattManager |
| 27 |
* \brief Bluetooth GattManager. |
| 28 |
* |
| 29 |
* GATT Manager allows external applications to register GATT services and |
| 30 |
* profiles. |
| 31 |
* |
| 32 |
* Registering a profile allows applications to subscribe to *remote* services. |
| 33 |
* These must implement the GattProfile1 interface defined above. |
| 34 |
* |
| 35 |
* Registering a service allows applications to publish a *local* GATT service, |
| 36 |
* which then becomes available to remote devices. A GATT service is represented by |
| 37 |
* a D-Bus object hierarchy where the root node corresponds to a service and the |
| 38 |
* child nodes represent characteristics and descriptors that belong to that |
| 39 |
* service. Each node must implement one of GattService1, GattCharacteristic1, |
| 40 |
* or GattDescriptor1 interfaces described above, based on the attribute it |
| 41 |
* represents. Each node must also implement the standard D-Bus Properties |
| 42 |
* interface to expose their properties. These objects collectively represent a |
| 43 |
* GATT service definition. |
| 44 |
* |
| 45 |
* \sa GattApplication |
| 46 |
*/ |
| 47 |
class BLUEZQT_EXPORT GattManager : public QObject |
| 48 |
{ |
| 49 |
Q_OBJECT |
| 50 |
|
| 51 |
public: |
| 52 |
~GattManager() override; |
| 53 |
|
| 54 |
/*! |
| 55 |
* Registers a local GATT services hierarchy as described |
| 56 |
* above (GATT Server) and/or GATT profiles (GATT Client) |
| 57 |
* for a given \a application. |
| 58 |
* |
| 59 |
* The application object path together with the D-Bus |
| 60 |
* system bus connection ID define the identification of |
| 61 |
* the application registering a GATT based |
| 62 |
* service or profile. |
| 63 |
* |
| 64 |
* Possible errors: |
| 65 |
* |
| 66 |
* \list |
| 67 |
* \li org.bluez.Error.InvalidArguments |
| 68 |
* \li org.bluez.Error.AlreadyExists |
| 69 |
* \endlist |
| 70 |
* |
| 71 |
* Returns void pending call. |
| 72 |
*/ |
| 73 |
PendingCall *registerApplication(GattApplication *application); |
| 74 |
|
| 75 |
/*! |
| 76 |
* Unregisters the services that have been |
| 77 |
* previously registered for the given \a application. |
| 78 |
* |
| 79 |
* The object path parameter must match the same value |
| 80 |
* that has been used upon registration. |
| 81 |
* |
| 82 |
* Possible errors: |
| 83 |
* |
| 84 |
* \list |
| 85 |
* \li org.bluez.Error.InvalidArguments |
| 86 |
* \li org.bluez.Error.DoesNotExist |
| 87 |
* \endlist |
| 88 |
* |
| 89 |
* Returns void pending call. |
| 90 |
*/ |
| 91 |
PendingCall *unregisterApplication(GattApplication *application); |
| 92 |
|
| 93 |
private: |
| 94 |
BLUEZQT_NO_EXPORT explicit GattManager(const QString &path, QObject *parent = nullptr); |
| 95 |
|
| 96 |
std::unique_ptr<class GattManagerPrivate> const d; |
| 97 |
|
| 98 |
friend class AdapterPrivate; |
| 99 |
}; |
| 100 |
|
| 101 |
} // namespace BluezQt |
| 102 |
|
| 103 |
#endif |