Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
bluezperipheralapplication_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef BLUEZ_PERIPHERAL_APPLICATION_P_H
5#define BLUEZ_PERIPHERAL_APPLICATION_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtBluetooth/private/qlowenergycontroller_bluezdbus_p.h>
19#include "bluez5_helper_p.h"
20
21#include <QtBluetooth/QBluetoothAddress>
22#include <QtCore/QCoreApplication>
23
26
28
34
36{
38
39public:
40 QtBluezPeripheralApplication(const QString& localAdapterPath, QObject* parent = nullptr);
42
43 // Register the application and its services to DBus & Bluez
45 // Unregister the application and its services from DBus & Bluez.
46 // Calling this doesn't invalidate the services
48 // Unregister and release all resources, invalidates services
49 void reset();
50
51 void addService(const QLowEnergyServiceData &serviceData,
52 QSharedPointer<QLowEnergyServicePrivate> servicePrivate,
53 QLowEnergyHandle serviceHandle);
54
55 // Call these when the user application has updated the attribute value
56 // Returns whether the new value was accepted
59
60 // Returns true if application has services and is not registered
61 bool registrationNeeded();
62
63 // org.freedesktop.DBus.ObjectManager
65
68 void registered();
69
70 // Emitted when remote device reads a characteristic
71 void remoteDeviceAccessEvent(const QString& remoteDeviceObjectPath, quint16 mtu);
72
73 // These are emitted when remote has written a new value
76 QLowEnergyHandle descriptorHandle,
77 const QByteArray& value);
78private:
79 void registerServices();
80 void unregisterServices();
81
82 QLowEnergyHandle handleForCharacteristic(QBluetoothUuid uuid,
83 QSharedPointer<QLowEnergyServicePrivate> service);
84 QLowEnergyHandle handleForDescriptor(QBluetoothUuid uuid,
85 QSharedPointer<QLowEnergyServicePrivate> service,
86 QLowEnergyHandle characteristicHandle);
87
88 QMap<QLowEnergyHandle, QtBluezPeripheralService*> m_services;
89 QMap<QLowEnergyHandle, QtBluezPeripheralCharacteristic*> m_characteristics;
90 QMap<QLowEnergyHandle, QtBluezPeripheralDescriptor*> m_descriptors;
91
92 QString m_objectPath;
94 OrgBluezGattManager1Interface* m_gattManager{};
95 bool m_applicationRegistered{false};
96};
97
99
100#endif
QMap< QDBusObjectPath, InterfaceList > ManagedObjectList
\inmodule QtBluetooth
\inmodule QtCore
Definition qbytearray.h:57
The QLowEnergyServiceData class is used to set up GATT service data. \inmodule QtBluetooth.
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Q_INVOKABLE ManagedObjectList GetManagedObjects()
bool localDescriptorWrite(QLowEnergyHandle handle, const QByteArray &value)
void remoteDeviceAccessEvent(const QString &remoteDeviceObjectPath, quint16 mtu)
QtBluezPeripheralApplication(const QString &localAdapterPath, QObject *parent=nullptr)
void addService(const QLowEnergyServiceData &serviceData, QSharedPointer< QLowEnergyServicePrivate > servicePrivate, QLowEnergyHandle serviceHandle)
void characteristicValueUpdatedByRemote(QLowEnergyHandle handle, const QByteArray &value)
bool localCharacteristicWrite(QLowEnergyHandle handle, const QByteArray &value)
void descriptorValueUpdatedByRemote(QLowEnergyHandle characteristicHandle, QLowEnergyHandle descriptorHandle, const QByteArray &value)
Combined button and popup list for selecting options.
quint16 QLowEnergyHandle
Definition qbluetooth.h:42
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLuint64 GLenum void * handle
#define Q_OBJECT
#define Q_INVOKABLE
#define signals
unsigned short quint16
Definition qtypes.h:48