Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
24
namespace
QtBluetoothPrivate
{
25
26
class
OrgFreedesktopDBusObjectManagerAdaptor
;
27
class
OrgBluezGattManager1Interface
;
28
29
}
// namespace QtBluetoothPrivate
30
31
QT_BEGIN_NAMESPACE
32
33
class
QLowEnergyControllerPrivateBluezDBus;
34
class
QtBluezPeripheralService
;
35
class
QtBluezPeripheralCharacteristic
;
36
class
QtBluezPeripheralDescriptor
;
37
class
QtBluezPeripheralConnectionManager
;
38
39
class
QtBluezPeripheralApplication
:
public
QObject
40
{
41
Q_OBJECT
42
43
public
:
44
QtBluezPeripheralApplication
(
const
QString
&
localAdapterPath
,
QObject
*
parent
=
nullptr
);
45
~
QtBluezPeripheralApplication
();
46
47
// Register the application and its services to DBus & Bluez
48
void
registerApplication
();
49
// Unregister the application and its services from DBus & Bluez.
50
// Calling this doesn't invalidate the services
51
void
unregisterApplication
();
52
// Unregister and release all resources, invalidates services
53
void
reset
();
54
55
void
addService
(
const
QLowEnergyServiceData &serviceData,
56
QSharedPointer<QLowEnergyServicePrivate> servicePrivate,
57
QLowEnergyHandle serviceHandle);
58
59
// Call these when the user application has updated the attribute value
60
// Returns whether the new value was accepted
61
bool
localCharacteristicWrite
(QLowEnergyHandle handle,
const
QByteArray& value);
62
bool
localDescriptorWrite
(QLowEnergyHandle handle,
const
QByteArray& value);
63
64
// Returns true if application has services and is not registered
65
bool
registrationNeeded
();
66
67
// org.freedesktop.DBus.ObjectManager
68
Q_INVOKABLE ManagedObjectList
GetManagedObjects
();
69
70
signals
:
71
void
errorOccurred
();
72
void
registered
();
73
74
// Emitted when remote device reads a characteristic
75
void
remoteDeviceAccessEvent
(
const
QString& remoteDeviceObjectPath, quint16 mtu);
76
77
// These are emitted when remote has written a new value
78
void
characteristicValueUpdatedByRemote
(QLowEnergyHandle handle,
const
QByteArray& value);
79
void
descriptorValueUpdatedByRemote
(QLowEnergyHandle characteristicHandle,
80
QLowEnergyHandle descriptorHandle,
81
const
QByteArray& value);
82
private
:
83
void
registerServices();
84
void
unregisterServices();
85
86
QLowEnergyHandle handleForCharacteristic(QBluetoothUuid uuid,
87
QSharedPointer<QLowEnergyServicePrivate> service);
88
QLowEnergyHandle handleForDescriptor(QBluetoothUuid uuid,
89
QSharedPointer<QLowEnergyServicePrivate> service,
90
QLowEnergyHandle characteristicHandle);
91
92
QMap<QLowEnergyHandle, QtBluezPeripheralService*> m_services;
93
QMap<QLowEnergyHandle, QtBluezPeripheralCharacteristic*> m_characteristics;
94
QMap<QLowEnergyHandle, QtBluezPeripheralDescriptor*> m_descriptors;
95
96
QString m_objectPath;
97
QtBluetoothPrivate
::
OrgFreedesktopDBusObjectManagerAdaptor
* m_objectManager{};
98
QtBluetoothPrivate
::
OrgBluezGattManager1Interface
* m_gattManager{};
99
bool
m_applicationRegistered{
false
};
100
};
101
102
QT_END_NAMESPACE
103
104
#
endif
ManagedObjectList
QMap< QDBusObjectPath, InterfaceList > ManagedObjectList
Definition
bluez5_helper_p.h:25
appObjectPathTemplate
static constexpr QLatin1String appObjectPathTemplate
Definition
bluezperipheralapplication.cpp:16
QtBluetoothPrivate::OrgBluezGattManager1Interface
Definition
gattmanager1_p.h:41
QtBluetoothPrivate::OrgFreedesktopDBusObjectManagerAdaptor
Definition
objectmanageradaptor_p.h:37
QtBluezPeripheralApplication
Definition
bluezperipheralapplication_p.h:40
QtBluezPeripheralApplication::~QtBluezPeripheralApplication
~QtBluezPeripheralApplication()
Definition
bluezperipheralapplication.cpp:31
QtBluezPeripheralApplication::localDescriptorWrite
bool localDescriptorWrite(QLowEnergyHandle handle, const QByteArray &value)
Definition
bluezperipheralapplication.cpp:225
QtBluezPeripheralApplication::unregisterApplication
void unregisterApplication()
Definition
bluezperipheralapplication.cpp:84
QtBluezPeripheralApplication::remoteDeviceAccessEvent
void remoteDeviceAccessEvent(const QString &remoteDeviceObjectPath, quint16 mtu)
QtBluezPeripheralApplication::registerApplication
void registerApplication()
Definition
bluezperipheralapplication.cpp:36
QtBluezPeripheralApplication::addService
void addService(const QLowEnergyServiceData &serviceData, QSharedPointer< QLowEnergyServicePrivate > servicePrivate, QLowEnergyHandle serviceHandle)
Definition
bluezperipheralapplication.cpp:135
QtBluezPeripheralApplication::reset
void reset()
Definition
bluezperipheralapplication.cpp:123
QtBluezPeripheralApplication::characteristicValueUpdatedByRemote
void characteristicValueUpdatedByRemote(QLowEnergyHandle handle, const QByteArray &value)
QtBluezPeripheralApplication::registered
void registered()
QtBluezPeripheralApplication::registrationNeeded
bool registrationNeeded()
Definition
bluezperipheralapplication.cpp:236
QtBluezPeripheralApplication::localCharacteristicWrite
bool localCharacteristicWrite(QLowEnergyHandle handle, const QByteArray &value)
Definition
bluezperipheralapplication.cpp:213
QtBluezPeripheralApplication::descriptorValueUpdatedByRemote
void descriptorValueUpdatedByRemote(QLowEnergyHandle characteristicHandle, QLowEnergyHandle descriptorHandle, const QByteArray &value)
QtBluezPeripheralCharacteristic
Definition
bluezperipheralobjects_p.h:113
QtBluezPeripheralConnectionManager
Definition
bluezperipheralconnectionmanager_p.h:36
QtBluezPeripheralDescriptor
Definition
bluezperipheralobjects_p.h:75
QtBluezPeripheralService
Definition
bluezperipheralobjects_p.h:156
QtBluetoothPrivate
Definition
adapter1_bluez5.cpp:14
qtconnectivity
src
bluetooth
bluez
bluezperipheralapplication_p.h
Generated on
for Qt by
1.18.0