1/*
2 * BluezQt - Asynchronous BlueZ wrapper library
3 *
4 * SPDX-FileCopyrightText: 2019 Manuel Weichselbaumer <mincequi@web.de>
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
18namespace BluezQt
19{
20class GattApplication;
21class PendingCall;
22
23/**
24 * @class BluezQt::GattManager GattManager.h <BluezQt/GattManager>
25 *
26 * Bluetooth GattManager.
27 *
28 * GATT Manager allows external applications to register GATT services and
29 * profiles.
30 *
31 * Registering a profile allows applications to subscribe to *remote* services.
32 * These must implement the GattProfile1 interface defined above.
33 *
34 * Registering a service allows applications to publish a *local* GATT service,
35 * which then becomes available to remote devices. A GATT service is represented by
36 * a D-Bus object hierarchy where the root node corresponds to a service and the
37 * child nodes represent characteristics and descriptors that belong to that
38 * service. Each node must implement one of GattService1, GattCharacteristic1,
39 * or GattDescriptor1 interfaces described above, based on the attribute it
40 * represents. Each node must also implement the standard D-Bus Properties
41 * interface to expose their properties. These objects collectively represent a
42 * GATT service definition.
43 *
44 * @see GattApplication
45 */
46class BLUEZQT_EXPORT GattManager : public QObject
47{
48 Q_OBJECT
49
50public:
51 /**
52 * Destroys a GattManager object.
53 */
54 ~GattManager() override;
55
56 /**
57 * Registers a local GATT services hierarchy as described
58 * above (GATT Server) and/or GATT profiles (GATT Client).
59 *
60 * The application object path together with the D-Bus
61 * system bus connection ID define the identification of
62 * the application registering a GATT based
63 * service or profile.
64 *
65 * Possible errors: org.bluez.Error.InvalidArguments
66 * org.bluez.Error.AlreadyExists
67 *
68 * @param application application to be registered
69 * @return void pending call
70 */
71 PendingCall *registerApplication(GattApplication *application);
72
73 /**
74 * This unregisters the services that has been
75 * previously registered. The object path parameter
76 * must match the same value that has been used
77 * on registration.
78 *
79 * Possible errors: org.bluez.Error.InvalidArguments
80 * org.bluez.Error.DoesNotExist
81 *
82 * @param application application to be unregistered
83 * @return void pending call
84 */
85 PendingCall *unregisterApplication(GattApplication *application);
86
87private:
88 BLUEZQT_NO_EXPORT explicit GattManager(const QString &path, QObject *parent = nullptr);
89
90 std::unique_ptr<class GattManagerPrivate> const d;
91
92 friend class AdapterPrivate;
93};
94
95} // namespace BluezQt
96
97#endif
98

source code of bluez-qt/src/gattmanager.h