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
hcimanager_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 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 HCIMANAGER_P_H
5#define HCIMANAGER_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 <QtCore/QObject>
19#include <QtCore/QList>
20#include <QtCore/QSet>
21#include <QtCore/QSocketNotifier>
22#include <QtBluetooth/QBluetoothAddress>
23#include "bluez/bluez_data_p.h"
24
26
28
29class HciManager : public QObject
30{
32public:
33 enum class HciEvent {
35 EVT_INQUIRY_RESULT = 0x02,
36 EVT_CONN_COMPLETE = 0x03,
37 EVT_CONN_REQUEST = 0x04,
39 EVT_AUTH_COMPLETE = 0x06,
41 EVT_ENCRYPT_CHANGE = 0x08,
47 EVT_CMD_COMPLETE = 0x0E,
48 EVT_CMD_STATUS = 0x0F,
49 EVT_HARDWARE_ERROR = 0x10,
50 EVT_FLUSH_OCCURRED = 0x11,
51 EVT_ROLE_CHANGE = 0x12,
52 EVT_NUM_COMP_PKTS = 0x13,
53 EVT_MODE_CHANGE = 0x14,
55 EVT_PIN_CODE_REQ = 0x16,
56 EVT_LINK_KEY_REQ = 0x17,
63 EVT_QOS_VIOLATION = 0x1E,
84 EVT_LE_META_EVENT = 0x3E,
95 EVT_TESTING = 0xFE,
96 EVT_VENDOR = 0xFF,
98 };
100
101 enum class HciError {
102 HCI_SUCCESS = 0x00, // added for convenience, not in bluez code
103 HCI_UNKNOWN_COMMAND = 0x01,
104 HCI_NO_CONNECTION = 0x02,
106 HCI_PAGE_TIMEOUT = 0x04,
109 HCI_MEMORY_FULL = 0x07,
118 HCI_HOST_TIMEOUT = 0x10,
123 HCI_OE_POWER_OFF = 0x15,
127 HCI_UNKNOWN_LMP_PDU = 0x19,
142 HCI_INSTANT_PASSED = 0x28,
146 HCI_QOS_REJECTED = 0x2d,
151 HCI_SLOT_VIOLATION = 0x34,
153 HCI_EIR_TOO_LARGE = 0x36,
156 };
158
159 explicit HciManager(const QBluetoothAddress &deviceAdapter);
160 ~HciManager();
161
162 bool isValid() const;
164 bool monitorAclPackets();
166
167 void stopEvents();
169
170 // active connections
171 QList<quint16> activeLowEnergyConnections() const;
172
176
177signals:
178 void encryptionChangedEvent(const QBluetoothAddress &address, bool wasSuccess);
179 void commandCompleted(quint16 opCode, quint8 status, const QByteArray &data);
182 void signatureResolvingKeyReceived(quint16 connHandle, bool remoteKey, BluezUint128 csrk);
183
184private slots:
185 void _q_readNotify();
186
187private:
188 int hciForAddress(const QBluetoothAddress &deviceAdapter);
189 void handleHciEventPacket(const quint8 *data, int size);
190 void handleHciAclPacket(const quint8 *data, int size);
191 void handleLeMetaEvent(const quint8 *data);
192
193 int hciSocket;
194 int hciDev;
195 quint8 sigPacketIdentifier = 0;
196 QSocketNotifier *notifier = nullptr;
197 QSet<HciManager::HciEvent> runningEvents;
198};
199
201
202#endif // HCIMANAGER_P_H
bool sendConnectionUpdateCommand(quint16 handle, const QLowEnergyConnectionParameters &params)
bool sendCommand(QBluezConst::OpCodeGroupField ogf, QBluezConst::OpCodeCommandField ocf, const QByteArray &parameters)
void stopEvents()
Q_ENUM(HciEvent)
QList< quint16 > activeLowEnergyConnections() const
bool isValid() const
HciManager(const QBluetoothAddress &deviceAdapter)
bool sendConnectionParameterUpdateRequest(quint16 handle, const QLowEnergyConnectionParameters &params)
bool monitorEvent(HciManager::HciEvent event)
void commandCompleted(quint16 opCode, quint8 status, const QByteArray &data)
Q_ENUM(HciError)
QBluetoothAddress addressForConnectionHandle(quint16 handle) const
bool monitorAclPackets()
void connectionUpdate(quint16 handle, const QLowEnergyConnectionParameters &parameters)
void encryptionChangedEvent(const QBluetoothAddress &address, bool wasSuccess)
void connectionComplete(quint16 handle)
void signatureResolvingKeyReceived(quint16 connHandle, bool remoteKey, BluezUint128 csrk)
\inmodule QtBluetooth
\inmodule QtCore
Definition qbytearray.h:57
The QLowEnergyConnectionParameters class is used when requesting or reporting an update of the parame...
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore
Combined button and popup list for selecting options.
GLuint64 GLenum void * handle
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
void ** params
struct _cl_event * event
GLuint GLuint64EXT address
#define Q_OBJECT
#define slots
#define signals
unsigned short quint16
Definition qtypes.h:48
unsigned char quint8
Definition qtypes.h:46
\inmodule QtCore
Definition quuid.h:58