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
qlowenergycontrollerbase_p.h
Go to the documentation of this file.
1// Copyright (C) 2017 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 QLOWENERGYCONTROLLERPRIVATEBASE_P_H
5#define QLOWENERGYCONTROLLERPRIVATEBASE_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 <qglobal.h>
19#include <QtCore/qobject.h>
20
21#include <QtBluetooth/qlowenergycontroller.h>
22
24
26
27typedef QMap<QBluetoothUuid, QSharedPointer<QLowEnergyServicePrivate> > ServiceDataMap;
28
30{
32public:
33 // This class is required to enable selection of multiple
34 // alternative QLowEnergyControllerPrivate implementations on BlueZ.
35 // Bluez has a low level ATT protocol stack implementation and a DBus
36 // implementation.
37
40
41 // interface definition
42 virtual void init() = 0;
43 virtual void connectToDevice() = 0;
44 virtual void disconnectFromDevice() = 0;
45
46 virtual void discoverServices() = 0;
47 virtual void discoverServiceDetails(const QBluetoothUuid &service,
49
50 virtual void readCharacteristic(
51 const QSharedPointer<QLowEnergyServicePrivate> service,
52 const QLowEnergyHandle charHandle) = 0;
53 virtual void readDescriptor(
54 const QSharedPointer<QLowEnergyServicePrivate> service,
55 const QLowEnergyHandle charHandle,
56 const QLowEnergyHandle descriptorHandle) = 0;
57
58 virtual void writeCharacteristic(
59 const QSharedPointer<QLowEnergyServicePrivate> service,
60 const QLowEnergyHandle charHandle,
61 const QByteArray &newValue,
62 QLowEnergyService::WriteMode writeMode) = 0;
63 virtual void writeDescriptor(
64 const QSharedPointer<QLowEnergyServicePrivate> service,
65 const QLowEnergyHandle charHandle,
66 const QLowEnergyHandle descriptorHandle,
67 const QByteArray &newValue) = 0;
68
69 virtual void startAdvertising(
71 const QLowEnergyAdvertisingData &advertisingData,
72 const QLowEnergyAdvertisingData &scanResponseData) = 0;
73 virtual void stopAdvertising() = 0;
74
78 const QLowEnergyServiceData &service,
79 QLowEnergyHandle startHandle) = 0;
80
81 virtual int mtu() const = 0;
82 virtual void readRssi();
83
85 const QLowEnergyServiceData &service);
86
87 // common backend methods
91
92 // public variables
95
96 // list of all found service uuids on remote device
98 // list of all found service uuids on local peripheral device
100
101 //common helper functions
102 QSharedPointer<QLowEnergyServicePrivate> serviceForHandle(QLowEnergyHandle handle);
106 const QByteArray &value,
107 bool appendValue);
109 QLowEnergyHandle descriptorHandle,
110 const QByteArray &value,
111 bool appendValue);
112 void invalidateServices();
113
114protected:
118
121
123
124 QString remoteName; // device name of the remote
125 QBluetoothUuid deviceUuid; // quite useless anywhere but Darwin (CoreBluetooth).
126
127 Q_DECLARE_PUBLIC(QLowEnergyController)
129};
130
132
133#endif // QLOWENERGYCONTROLLERPRIVATEBASE_P_H
\inmodule QtBluetooth
\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...
QLowEnergyCharacteristic characteristicForHandle(QLowEnergyHandle handle)
Returns a valid characteristic if the given handle is the handle of the characteristic itself or one ...
QSharedPointer< QLowEnergyServicePrivate > serviceForHandle(QLowEnergyHandle handle)
QLowEnergyController::RemoteAddressType addressType
virtual int mtu() const =0
virtual void readDescriptor(const QSharedPointer< QLowEnergyServicePrivate > service, const QLowEnergyHandle charHandle, const QLowEnergyHandle descriptorHandle)=0
virtual void writeDescriptor(const QSharedPointer< QLowEnergyServicePrivate > service, const QLowEnergyHandle charHandle, const QLowEnergyHandle descriptorHandle, const QByteArray &newValue)=0
quint16 updateValueOfDescriptor(QLowEnergyHandle charHandle, QLowEnergyHandle descriptorHandle, const QByteArray &value, bool appendValue)
Returns the length of the updated descriptor value.
QLowEnergyDescriptor descriptorForHandle(QLowEnergyHandle handle)
Returns a valid descriptor if handle belongs to a descriptor; otherwise an invalid one.
virtual void readCharacteristic(const QSharedPointer< QLowEnergyServicePrivate > service, const QLowEnergyHandle charHandle)=0
virtual void disconnectFromDevice()=0
virtual void connectToDevice()=0
QLowEnergyController::Error error
virtual void writeCharacteristic(const QSharedPointer< QLowEnergyServicePrivate > service, const QLowEnergyHandle charHandle, const QByteArray &newValue, QLowEnergyService::WriteMode writeMode)=0
virtual void stopAdvertising()=0
void setError(QLowEnergyController::Error newError)
virtual void discoverServiceDetails(const QBluetoothUuid &service, QLowEnergyService::DiscoveryMode mode)=0
quint16 updateValueOfCharacteristic(QLowEnergyHandle charHandle, const QByteArray &value, bool appendValue)
Returns the length of the updated characteristic value.
virtual void requestConnectionUpdate(const QLowEnergyConnectionParameters &params)=0
virtual void addToGenericAttributeList(const QLowEnergyServiceData &service, QLowEnergyHandle startHandle)=0
virtual QLowEnergyService * addServiceHelper(const QLowEnergyServiceData &service)
QLowEnergyController::ControllerState state
void setState(QLowEnergyController::ControllerState newState)
virtual void discoverServices()=0
virtual void startAdvertising(const QLowEnergyAdvertisingParameters &params, const QLowEnergyAdvertisingData &advertisingData, const QLowEnergyAdvertisingData &scanResponseData)=0
\inmodule QtBluetooth
RemoteAddressType
Indicates what type of Bluetooth address the remote device uses.
ControllerState
Indicates the state of the controller object.
Role
Indicates the role of the controller object.
Error
Indicates all possible error conditions found during the controller's existence.
\inmodule QtBluetooth
The QLowEnergyServiceData class is used to set up GATT service data. \inmodule QtBluetooth.
\inmodule QtBluetooth
DiscoveryMode
This enum lists service discovery modes.
WriteMode
This enum describes the mode to be used when writing a characteristic value.
\inmodule QtCore
Definition qobject.h:103
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
Combined button and popup list for selecting options.
quint16 QLowEnergyHandle
Definition qbluetooth.h:42
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
QT_BEGIN_NAMESPACE typedef QMap< QBluetoothUuid, QSharedPointer< QLowEnergyServicePrivate > > ServiceDataMap
GLuint64 GLenum void * handle
GLenum mode
void ** params
#define Q_OBJECT
unsigned short quint16
Definition qtypes.h:48