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
qlowenergycontroller_darwin_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// Copyright (C) 2016 Javier S. Pedro <maemo@javispedro.com>
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4#ifndef QLOWENERGYCONTROLLER_DARWIN_P_H
5#define QLOWENERGYCONTROLLER_DARWIN_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
21#include "darwin/btnotifier_p.h"
22#include "qbluetoothaddress.h"
23#include "darwin/btraii_p.h"
24#include "qbluetoothuuid.h"
25
26#include <QtCore/qsharedpointer.h>
27#include <QtCore/qglobal.h>
28#include <QtCore/qstring.h>
29#include <QtCore/qmap.h>
30
32
33class QByteArray;
34
36{
38 friend class QLowEnergyService;
39
41public:
44
45 void init() override;
46 bool lazyInit();
47 void connectToDevice() override;
48 void disconnectFromDevice() override;
49 void discoverServices() override;
50 void discoverServiceDetails(const QBluetoothUuid &serviceUuid,
52
53 void readCharacteristic(const QSharedPointer<QLowEnergyServicePrivate> service,
54 const QLowEnergyHandle charHandle) override;
55 void readDescriptor(const QSharedPointer<QLowEnergyServicePrivate> service,
56 const QLowEnergyHandle charHandle,
57 const QLowEnergyHandle descriptorHandle) override;
58
59 void writeCharacteristic(const QSharedPointer<QLowEnergyServicePrivate> service,
60 const QLowEnergyHandle charHandle, const QByteArray &newValue,
62 void writeDescriptor(const QSharedPointer<QLowEnergyServicePrivate> service,
63 const QLowEnergyHandle charHandle,
64 const QLowEnergyHandle descriptorHandle,
65 const QByteArray &newValue) override;
66
67
70 QLowEnergyHandle startHandle) override;
71
72 int mtu() const override;
73 void readRssi() override;
74
76 const QLowEnergyAdvertisingData &advertisingData,
77 const QLowEnergyAdvertisingData &scanResponseData) override;
78 void stopAdvertising()override;
80
81 // Valid - a central or peripheral instance was allocated, and this may also
82 // mean a proper usage description was provided/found:
83 bool isValid() const;
84
85private Q_SLOTS:
86 void _q_connected();
87 void _q_disconnected();
88
89 void _q_mtuChanged(int newValue);
90 void _q_serviceDiscoveryFinished();
91 void _q_serviceDetailsDiscoveryFinished(QSharedPointer<QLowEnergyServicePrivate> service);
92 void _q_servicesWereModified();
93
94 void _q_characteristicRead(QLowEnergyHandle charHandle, const QByteArray &value);
95 void _q_characteristicWritten(QLowEnergyHandle charHandle, const QByteArray &value);
96 void _q_characteristicUpdated(QLowEnergyHandle charHandle, const QByteArray &value);
97 void _q_descriptorRead(QLowEnergyHandle descHandle, const QByteArray &value);
98 void _q_descriptorWritten(QLowEnergyHandle charHandle, const QByteArray &value);
99 void _q_notificationEnabled(QLowEnergyHandle charHandle, bool enabled);
100
101 void _q_LEnotSupported();
102 void _q_CBManagerError(QLowEnergyController::Error error);
103 void _q_CBManagerError(const QBluetoothUuid &serviceUuid, QLowEnergyController::Error error);
104 void _q_CBManagerError(const QBluetoothUuid &serviceUuid, QLowEnergyService::ServiceError error);
105
106private:
107 void setNotifyValue(QSharedPointer<QLowEnergyServicePrivate> service,
108 QLowEnergyHandle charHandle, const QByteArray &newValue);
109
110 quint16 updateValueOfCharacteristic(QLowEnergyHandle charHandle,
111 const QByteArray &value,
112 bool appendValue);
113
114 quint16 updateValueOfDescriptor(QLowEnergyHandle charHandle,
115 QLowEnergyHandle descHandle,
116 const QByteArray &value,
117 bool appendValue);
118
120
121 DarwinBluetooth::ScopedPointer centralManager;
122 DarwinBluetooth::ScopedPointer peripheralManager;
123
124 using ServiceMap = QMap<QBluetoothUuid, QSharedPointer<QLowEnergyServicePrivate>>;
125};
126
128
129#endif // QLOWENERGYCONTROLLER_DARWIN_P_H
DarwinBluetooth::LECBManagerNotifier * notifier
\inmodule QtBluetooth
\inmodule QtCore
Definition qbytearray.h:57
The QLowEnergyAdvertisingData class represents the data to be broadcast during Bluetooth Low Energy a...
The QLowEnergyAdvertisingParameters class represents the parameters used for Bluetooth Low Energy adv...
The QLowEnergyConnectionParameters class is used when requesting or reporting an update of the parame...
void writeDescriptor(const QSharedPointer< QLowEnergyServicePrivate > service, const QLowEnergyHandle charHandle, const QLowEnergyHandle descriptorHandle, const QByteArray &newValue) override
void readDescriptor(const QSharedPointer< QLowEnergyServicePrivate > service, const QLowEnergyHandle charHandle, const QLowEnergyHandle descriptorHandle) override
void startAdvertising(const QLowEnergyAdvertisingParameters &params, const QLowEnergyAdvertisingData &advertisingData, const QLowEnergyAdvertisingData &scanResponseData) override
void writeCharacteristic(const QSharedPointer< QLowEnergyServicePrivate > service, const QLowEnergyHandle charHandle, const QByteArray &newValue, QLowEnergyService::WriteMode mode) override
void discoverServiceDetails(const QBluetoothUuid &serviceUuid, QLowEnergyService::DiscoveryMode mode) override
QLowEnergyService * addServiceHelper(const QLowEnergyServiceData &service) override
void addToGenericAttributeList(const QLowEnergyServiceData &service, QLowEnergyHandle startHandle) override
void requestConnectionUpdate(const QLowEnergyConnectionParameters &params) override
void readCharacteristic(const QSharedPointer< QLowEnergyServicePrivate > service, const QLowEnergyHandle charHandle) override
QLowEnergyController::Error error
\inmodule QtBluetooth
Error
Indicates all possible error conditions found during the controller's existence.
The QLowEnergyServiceData class is used to set up GATT service data. \inmodule QtBluetooth.
\inmodule QtBluetooth
DiscoveryMode
This enum lists service discovery modes.
ServiceError
This enum describes all possible error conditions during the service's existence.
WriteMode
This enum describes the mode to be used when writing a characteristic value.
Combined button and popup list for selecting options.
quint16 QLowEnergyHandle
Definition qbluetooth.h:42
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum mode
GLenum GLenum GLsizei const GLuint GLboolean enabled
void ** params
#define Q_OBJECT
#define Q_SLOTS
unsigned short quint16
Definition qtypes.h:48