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
btperipheralmanager_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 BTPERIPHERALMANAGER_P_H
5#define BTPERIPHERALMANAGER_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 for the convenience
12// of internal files. This header file may change from version to version
13// without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "btutility_p.h"
19
21#include "qbluetooth.h"
22
23#include <QtCore/qsharedpointer.h>
24#include <QtCore/qbytearray.h>
25#include <QtCore/qglobal.h>
26#include <QtCore/qpair.h>
27#include <QtCore/qmap.h>
28
29#include <QtCore/private/qcore_mac_p.h>
30
31#include <vector>
32#include <deque>
33#include <map>
34
35#include <Foundation/Foundation.h>
36
37#include <CoreBluetooth/CoreBluetooth.h>
38
39QT_BEGIN_NAMESPACE
40
41class QLowEnergyAdvertisingParameters;
42class QLowEnergyAdvertisingData;
43class QLowEnergyServiceData;
44
45namespace DarwinBluetooth
46{
47
49
50} // namespace DarwinBluetooth
51
52using namespace DarwinBluetooth;
53
54
55template<class Type>
56using GenericLEMap = QMap<QLowEnergyHandle, Type>;
57
65
67{
68 UpdateRequest() = default;
69 UpdateRequest(QLowEnergyHandle handle, const ObjCStrongReference<NSData> &val)
70 : charHandle(handle),
71 value(val)
72 {
73 }
74
77};
78
79QT_END_NAMESPACE
80
81// Exposing names in a header is ugly, but constant QT_PREPEND_NAMESPACE is even worse ...
82// After all, this header is to be included only in its own and controller's *.mm files.
83
84QT_USE_NAMESPACE
85
86using ValueRange = QPair<NSUInteger, NSUInteger>;
87
88@interface QT_MANGLE_NAMESPACE(DarwinBTPeripheralManager) : NSObject<CBPeripheralManagerDelegate>
89
90- (id)initWith:(LECBManagerNotifier *)notifier;
91- (void)dealloc;
92
93- (QSharedPointer<QLowEnergyServicePrivate>)addService:(const QLowEnergyServiceData &)data;
94- (void) setParameters:(const QLowEnergyAdvertisingParameters &)parameters
95 data:(const QLowEnergyAdvertisingData &)data
96 scanResponse:(const QLowEnergyAdvertisingData &)scanResponse;
97
98// To be executed on the Qt's special BTLE dispatch queue.
99- (void)startAdvertising;
100- (void)stopAdvertising;
101- (void)detach;
102
103- (void)write:(const QByteArray &)value
104 charHandle:(QLowEnergyHandle)charHandle;
105
106
107// CBPeripheralManagerDelegate's callbacks (BTLE queue).
108- (void)peripheralManagerDidUpdateState:(CBPeripheralManager *)peripheral;
109- (void)peripheralManagerDidStartAdvertising:(CBPeripheralManager *)peripheral
110 error:(NSError *)error;
111- (void)peripheralManager:(CBPeripheralManager *)peripheral
112 didAddService:(CBService *)service error:(NSError *)error;
113- (void)peripheralManager:(CBPeripheralManager *)peripheral central:(CBCentral *)central
114 didSubscribeToCharacteristic:(CBCharacteristic *)characteristic;
115- (void)peripheralManager:(CBPeripheralManager *)peripheral central:(CBCentral *)central
116 didUnsubscribeFromCharacteristic:(CBCharacteristic *)characteristic;
117- (void)peripheralManager:(CBPeripheralManager *)peripheral
118 didReceiveReadRequest:(CBATTRequest *)request;
119- (void)peripheralManager:(CBPeripheralManager *)peripheral
120 didReceiveWriteRequests:(NSArray *)requests;
121- (void)peripheralManagerIsReadyToUpdateSubscribers:(CBPeripheralManager *)peripheral;
122
123@end
124
125QT_NAMESPACE_ALIAS_OBJC_CLASS(DarwinBTPeripheralManager);
126
127#endif
#define QT_BT_MAC_AUTORELEASEPOOL
Definition btutility_p.h:78
The QLowEnergyAdvertisingParameters class represents the parameters used for Bluetooth Low Energy adv...
The QLowEnergyCharacteristicData class is used to set up GATT service data. \inmodule QtBluetooth.
The QLowEnergyDescriptorData class is used to create GATT service data. \inmodule QtBluetooth.
quint16 QLowEnergyHandle
Definition qbluetooth.h:42
UpdateRequest()=default
QLowEnergyHandle charHandle
UpdateRequest(QLowEnergyHandle handle, const ObjCStrongReference< NSData > &val)
ObjCStrongReference< NSData > value