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** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtBluetooth module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QLOWENERGYADVERTISINGPARAMETERS_H
41#define QLOWENERGYADVERTISINGPARAMETERS_H
42
43#include <QtBluetooth/qtbluetoothglobal.h>
44#include <QtBluetooth/qbluetoothaddress.h>
45#include <QtBluetooth/qlowenergycontroller.h>
46#include <QtCore/qlist.h>
47#include <QtCore/qshareddata.h>
48
49QT_BEGIN_NAMESPACE
50
51class QLowEnergyAdvertisingParametersPrivate;
52
53class Q_BLUETOOTH_EXPORT QLowEnergyAdvertisingParameters
54{
55 friend Q_BLUETOOTH_EXPORT bool operator==(const QLowEnergyAdvertisingParameters &p1,
56 const QLowEnergyAdvertisingParameters &p2);
57public:
58 QLowEnergyAdvertisingParameters();
59 QLowEnergyAdvertisingParameters(const QLowEnergyAdvertisingParameters &other);
60 ~QLowEnergyAdvertisingParameters();
61
62 QLowEnergyAdvertisingParameters &operator=(const QLowEnergyAdvertisingParameters &other);
63
64 enum Mode { AdvInd = 0x0, AdvScanInd = 0x2, AdvNonConnInd = 0x3 };
65 void setMode(Mode mode);
66 Mode mode() const;
67
68 struct AddressInfo {
69 AddressInfo(const QBluetoothAddress &addr, QLowEnergyController::RemoteAddressType t)
70 : address(addr), type(t) {}
71 AddressInfo() : type(QLowEnergyController::PublicAddress) {}
72
73 QBluetoothAddress address;
74 QLowEnergyController::RemoteAddressType type;
75 };
76 enum FilterPolicy {
77 IgnoreWhiteList = 0x00,
78 UseWhiteListForScanning = 0x01,
79 UseWhiteListForConnecting = 0x02,
80 UseWhiteListForScanningAndConnecting = 0x03,
81 };
82 void setWhiteList(const QList<AddressInfo> &whiteList, FilterPolicy policy);
83 QList<AddressInfo> whiteList() const;
84 FilterPolicy filterPolicy() const;
85
86 void setInterval(quint16 minimum, quint16 maximum);
87 int minimumInterval() const;
88 int maximumInterval() const;
89
90 // TODO: own address type
91 // TODO: For ADV_DIRECT_IND: peer address + peer address type
92
93 void swap(QLowEnergyAdvertisingParameters &other) Q_DECL_NOTHROW { qSwap(value1&: d, value2&: other.d); }
94
95private:
96 QSharedDataPointer<QLowEnergyAdvertisingParametersPrivate> d;
97};
98
99inline bool operator==(const QLowEnergyAdvertisingParameters::AddressInfo &ai1,
100 const QLowEnergyAdvertisingParameters::AddressInfo &ai2)
101{
102 return ai1.address == ai2.address && ai1.type == ai2.type;
103}
104
105Q_BLUETOOTH_EXPORT bool operator==(const QLowEnergyAdvertisingParameters &p1,
106 const QLowEnergyAdvertisingParameters &p2);
107inline bool operator!=(const QLowEnergyAdvertisingParameters &p1,
108 const QLowEnergyAdvertisingParameters &p2)
109{
110 return !(p1 == p2);
111}
112
113Q_DECLARE_SHARED(QLowEnergyAdvertisingParameters)
114
115QT_END_NAMESPACE
116
117#endif // Include guard
118

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

Provided by KDAB

Privacy Policy
Learn to use CMake with our Intro Training
Find out more

source code of qtconnectivity/src/bluetooth/qlowenergyadvertisingparameters.h