Warning: That file was not part of the compilation database. It may have many parsing errors.

1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Copyright (C) 2016 Javier S. Pedro <maemo@javispedro.com>
5** Contact: https://www.qt.io/licensing/
6**
7** This file is part of the QtBluetooth module of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial License Usage
11** Licensees holding valid commercial Qt licenses may use this file in
12** accordance with the commercial license agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and The Qt Company. For licensing terms
15** and conditions see https://www.qt.io/terms-conditions. For further
16** information use the contact form at https://www.qt.io/contact-us.
17**
18** GNU Lesser General Public License Usage
19** Alternatively, this file may be used under the terms of the GNU Lesser
20** General Public License version 3 as published by the Free Software
21** Foundation and appearing in the file LICENSE.LGPL3 included in the
22** packaging of this file. Please review the following information to
23** ensure the GNU Lesser General Public License version 3 requirements
24** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
25**
26** GNU General Public License Usage
27** Alternatively, this file may be used under the terms of the GNU
28** General Public License version 2.0 or (at your option) the GNU General
29** Public license version 3 or any later version approved by the KDE Free
30** Qt Foundation. The licenses are as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
32** included in the packaging of this file. Please review the following
33** information to ensure the GNU General Public License requirements will
34** be met: https://www.gnu.org/licenses/gpl-2.0.html and
35** https://www.gnu.org/licenses/gpl-3.0.html.
36**
37** $QT_END_LICENSE$
38**
39****************************************************************************/
40#ifndef QLOWENERGYCONTROLLER_DARWIN_P_H
41#define QLOWENERGYCONTROLLER_DARWIN_P_H
42
43//
44// W A R N I N G
45// -------------
46//
47// This file is not part of the Qt API. It exists purely as an
48// implementation detail. This header file may change from version to
49// version without notice, or even be removed.
50//
51// We mean it.
52//
53
54#include "qlowenergyserviceprivate_p.h"
55#include "qlowenergycontrollerbase_p.h"
56#include "qlowenergycontroller.h"
57#include "osx/osxbtnotifier_p.h"
58#include "qbluetoothaddress.h"
59#include "qbluetoothuuid.h"
60#include "osx/btraii_p.h"
61
62#include <QtCore/qsharedpointer.h>
63#include <QtCore/qglobal.h>
64#include <QtCore/qstring.h>
65#include <QtCore/qmap.h>
66
67QT_BEGIN_NAMESPACE
68
69class QByteArray;
70
71class QLowEnergyControllerPrivateDarwin : public QLowEnergyControllerPrivate
72{
73 friend class QLowEnergyController;
74 friend class QLowEnergyService;
75
76 Q_OBJECT
77public:
78 QLowEnergyControllerPrivateDarwin();
79 ~QLowEnergyControllerPrivateDarwin();
80
81 void init() override;
82 void connectToDevice() override;
83 void disconnectFromDevice() override;
84 void discoverServices() override;
85 void discoverServiceDetails(const QBluetoothUuid &serviceUuid) override;
86
87 void readCharacteristic(const QSharedPointer<QLowEnergyServicePrivate> service,
88 const QLowEnergyHandle charHandle) override;
89 void readDescriptor(const QSharedPointer<QLowEnergyServicePrivate> service,
90 const QLowEnergyHandle charHandle,
91 const QLowEnergyHandle descriptorHandle) override;
92
93 void writeCharacteristic(const QSharedPointer<QLowEnergyServicePrivate> service,
94 const QLowEnergyHandle charHandle, const QByteArray &newValue,
95 QLowEnergyService::WriteMode mode) override;
96 void writeDescriptor(const QSharedPointer<QLowEnergyServicePrivate> service,
97 const QLowEnergyHandle charHandle,
98 const QLowEnergyHandle descriptorHandle,
99 const QByteArray &newValue) override;
100
101
102 void requestConnectionUpdate(const QLowEnergyConnectionParameters &params) override;
103 void addToGenericAttributeList(const QLowEnergyServiceData &service,
104 QLowEnergyHandle startHandle) override;
105
106 void startAdvertising(const QLowEnergyAdvertisingParameters &params,
107 const QLowEnergyAdvertisingData &advertisingData,
108 const QLowEnergyAdvertisingData &scanResponseData) override;
109 void stopAdvertising()override;
110 QLowEnergyService *addServiceHelper(const QLowEnergyServiceData &service) override;
111 bool isValid() const; // QT6 - delete this logic.
112
113private Q_SLOTS:
114 void _q_connected();
115 void _q_disconnected();
116
117 void _q_serviceDiscoveryFinished();
118 void _q_serviceDetailsDiscoveryFinished(QSharedPointer<QLowEnergyServicePrivate> service);
119 void _q_servicesWereModified();
120
121 void _q_characteristicRead(QLowEnergyHandle charHandle, const QByteArray &value);
122 void _q_characteristicWritten(QLowEnergyHandle charHandle, const QByteArray &value);
123 void _q_characteristicUpdated(QLowEnergyHandle charHandle, const QByteArray &value);
124 void _q_descriptorRead(QLowEnergyHandle descHandle, const QByteArray &value);
125 void _q_descriptorWritten(QLowEnergyHandle charHandle, const QByteArray &value);
126 void _q_notificationEnabled(QLowEnergyHandle charHandle, bool enabled);
127
128 void _q_LEnotSupported();
129 void _q_CBManagerError(QLowEnergyController::Error error);
130 void _q_CBManagerError(const QBluetoothUuid &serviceUuid, QLowEnergyController::Error error);
131 void _q_CBManagerError(const QBluetoothUuid &serviceUuid, QLowEnergyService::ServiceError error);
132
133private:
134 void setNotifyValue(QSharedPointer<QLowEnergyServicePrivate> service,
135 QLowEnergyHandle charHandle, const QByteArray &newValue);
136
137 quint16 updateValueOfCharacteristic(QLowEnergyHandle charHandle,
138 const QByteArray &value,
139 bool appendValue);
140
141 quint16 updateValueOfDescriptor(QLowEnergyHandle charHandle,
142 QLowEnergyHandle descHandle,
143 const QByteArray &value,
144 bool appendValue);
145
146 void setErrorDescription(QLowEnergyController::Error errorCode);
147 bool connectSlots(OSXBluetooth::LECBManagerNotifier *notifier);
148
149 DarwinBluetooth::ScopedPointer centralManager;
150
151#ifndef Q_OS_TVOS
152 DarwinBluetooth::ScopedPointer peripheralManager;
153#endif
154
155 using ServiceMap = QMap<QBluetoothUuid, QSharedPointer<QLowEnergyServicePrivate>>;
156};
157
158QT_END_NAMESPACE
159
160#endif // QLOWENERGYCONTROLLER_DARWIN_P_H
161

Warning: That file was not part of the compilation database. It may have many parsing errors.