Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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
27class QLowEnergyConnectionParameters;
28
29class HciManager : public QObject
30{
32public:
33 enum class HciEvent {
96 EVT_VENDOR = 0xFF,
98 };
100
101 enum class HciError {
102 HCI_SUCCESS = 0x00, // added for convenience, not in bluez code
156 };
158
159 explicit HciManager(const QBluetoothAddress &deviceAdapter);
160 ~HciManager();
161
162 bool isValid() const;
163 bool monitorEvent(HciManager::HciEvent event);
164 bool monitorAclPackets();
165 bool sendCommand(QBluezConst::OpCodeGroupField ogf, QBluezConst::OpCodeCommandField ocf, const QByteArray &parameters);
166
167 void stopEvents();
168 QBluetoothAddress addressForConnectionHandle(quint16 handle) const;
169
170 // active connections
172
173 bool sendConnectionUpdateCommand(quint16 handle, const QLowEnergyConnectionParameters &params);
174 bool sendConnectionParameterUpdateRequest(quint16 handle,
175 const QLowEnergyConnectionParameters &params);
176
177signals:
179 void commandCompleted(quint16 opCode, quint8 status, const QByteArray &data);
180 void connectionComplete(quint16 handle);
181 void connectionUpdate(quint16 handle, const QLowEnergyConnectionParameters &parameters);
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, int size);
192
193 int hciSocket;
194 int hciDev;
195 quint8 sigPacketIdentifier = 0;
196 QSocketNotifier *notifier = nullptr;
197 QSet<HciManager::HciEvent> runningEvents;
198};
199
200QT_END_NAMESPACE
201
202#endif // HCIMANAGER_P_H
#define HCI_EVENT_PKT
static void hci_filter_all_events(struct hci_filter *f)
#define HCIGETDEVLIST
#define SIGNALING_CHANNEL_ID
#define SOL_HCI
static void hci_filter_set_ptype(int t, struct hci_filter *f)
#define HCI_FILTER
#define LE_LINK
#define ACL_LINK
QUuid::Id128Bytes BluezUint128
#define HCIGETCONNLIST
#define HCI_MAX_DEV
#define BTPROTO_HCI
#define HCI_EVENT_HDR_SIZE
#define ESCO_LINK
static void hci_filter_clear(struct hci_filter *f)
#define HCI_COMMAND_PKT
#define HCI_ACL_PKT
#define SCO_LINK
#define HCIGETDEVINFO
#define SECURITY_CHANNEL_ID
#define opCodePack(ogf, ocf)
#define HCI_MAX_EVENT_SIZE
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)
QBluetoothAddress addressForConnectionHandle(quint16 handle) const
bool monitorAclPackets()
void connectionUpdate(quint16 handle, const QLowEnergyConnectionParameters &parameters)
void connectionComplete(quint16 handle)
void signatureResolvingKeyReceived(quint16 connHandle, bool remoteKey, BluezUint128 csrk)
quint16 forceIntervalIntoRange(double connectionInterval)
ConnectionUpdateData connectionUpdateData(const QLowEnergyConnectionParameters &params)
QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(lcEventDispatcher)