summaryrefslogtreecommitdiffstats
path: root/src/knx/netip/qknxnetipstructheader.cpp
blob: 3d977f53b309a2386c53d2dbbe6fbd8a7445f030 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
/******************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtKnx module.
**
** $QT_BEGIN_LICENSE:GPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) any later version
** approved by the KDE Free Qt Foundation. The licenses are as published by
** the Free Software Foundation and appearing in the file LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
******************************************************************************/

#include "qknxnetipstructheader.h"

QT_BEGIN_NAMESPACE

/*!
    \class QKnxNetIpStructHeader

    \inmodule QtKnx
    \ingroup qtknx-netip

    \brief The QKnxNetIpStructHeader class is a KNXnet/IP structure header.

    The first octet of the structure is the length of the structure and the
    second octet is an identifier that specifies the type of the structure.

    If the structure's amount of data exceeds 252 octets, the first octet is
    \c 0xff and the next two octets contain the length as a 16 bit value. The
    fourth octet is then the identifier specifying the type of the structure.

    \sa {Qt KNXnet/IP Connection Classes}
*/

/*!
    \fn template <typename CodeType> QKnxNetIpStructHeader<CodeType>::QKnxNetIpStructHeader()

    Constructs an empty invalid header object.

    \sa isNull(), isValid()
*/

/*!
    \fn template <typename CodeType> QKnxNetIpStructHeader<CodeType>::~QKnxNetIpStructHeader()

    Destroys the header object and releases all allocated resources.
*/

/*!
    \fn template <typename CodeType> QKnxNetIpStructHeader<CodeType>::QKnxNetIpStructHeader(CodeType code)

    Constructs a valid header object and sets the KNXnet/IP structure identifier
    to \a code.

    \sa isValid(), code(), setCode()
*/

/*!
    \fn template <typename CodeType> QKnxNetIpStructHeader<CodeType>::QKnxNetIpStructHeader(CodeType code, quint16 dataSize)

    Constructs a valid header object and sets the KNXnet/IP structure identifier
    to \a code and the data size to \a dataSize and updates the header size and
    total size accordingly.

    \sa isValid(), code(), setCode(), dataSize(), setDataSize()
*/

/*!
    \fn template <typename CodeType> QKnxNetIpStructHeader<CodeType>::QKnxNetIpStructHeader(CodeType code, quint16 dataSize, bool mandatory)

    Constructs a valid header object and sets the KNXnet/IP structure
    identifier to \a code, the data size to \a dataSize, and the mandatory
    flag to \a mandatory.
    Additionally it updates the header and total size of the structure.

    \sa isValid(), code(), setCode(), dataSize(), setDataSize(), setMandatory()
*/

/*!
    \fn template <typename CodeType> bool QKnxNetIpStructHeader<CodeType>::isNull() const

    Returns \c true if this is a default constructed header, otherwise returns
    \c false. A header is considered null if it contains no initialized values.

    \sa isValid()
*/

/*!
    \fn template <typename CodeType> bool QKnxNetIpStructHeader<CodeType>::isValid() const

    Returns \c true if the KNXnet/IP structure header contains initialized
    values and is in itself valid, otherwise returns \c false. A valid KNXnet/IP
    structure header consist of a given total size and a known \l code
    identifier.

    \sa isNull()
*/

/*!
    \fn template <typename CodeType> quint8 QKnxNetIpStructHeader<CodeType>::size() const

    Returns the size of the KNXnet/IP structure header.

    \sa isNull(), isValid()
*/

/*!
    \fn template <typename CodeType> quint16 QKnxNetIpStructHeader<CodeType>::totalSize() const

    Returns the total size of the KNXnet/IP structure if the header is valid,
    otherwise returns \c null. The total size includes the size of the header
    and the size of the KNXnet/IP structure data.

    \sa isNull(), isValid(), size(), dataSize()
*/

/*!
    \fn template <typename CodeType> quint16 QKnxNetIpStructHeader<CodeType>::dataSize() const

    Returns the size of the KNXnet/IP structure data if the header is valid,
    otherwise returns \c null.

    The data size excludes the size of the KNXnet/IP structure header.

    \sa isNull(), isValid(), size(), totalSize()
*/

/*!
    \fn template <typename CodeType> void QKnxNetIpStructHeader<CodeType>::setDataSize(quint16 dataSize)

    Sets the KNXnet/IP structure data size to \a dataSize and updates the
    header and total size accordingly.
*/

/*!
    \fn template <typename CodeType> CodeType QKnxNetIpStructHeader<CodeType>::code() const

    Returns the KNXnet/IP structure's \l code identifier.
*/

/*!
    \fn template <typename CodeType> void QKnxNetIpStructHeader<CodeType>::setCode(CodeType code)

    Sets the KNXnet/IP structure's code identifier to \a code.
*/

/*!
    \fn template <typename CodeType> quint8 QKnxNetIpStructHeader<CodeType>::byte(quint8 index) const

    Returns the byte at position \a index in the header.
*/

/*!
    \fn template <typename CodeType> QKnxNetIpStructHeader<CodeType>::bytes() const

    Returns an array of bytes that represent the KNXnet/IP structure header.
*/

/*!
    \fn template <typename CodeType> static QKnxNetIpStructHeader<CodeType>::fromBytes(const QKnxByteArray &bytes, quint16 index = 0)

    Constructs the KNXnet/IP structure header from the byte array \a bytes
    starting at the position \a index inside the array.

    \sa isNull(), isValid()
*/

/*!
    \fn template <typename CodeType> bool QKnxNetIpStructHeader<CodeType>::operator==(const QKnxNetIpStructHeader &other) const

    Returns \c true if this object and the given \a other are equal; otherwise
    returns \c false.
*/

/*!
    \fn template <typename CodeType> bool QKnxNetIpStructHeader<CodeType>::operator!=(const QKnxNetIpStructHeader &other) const

    Returns \c true if this object and the given \a other are not equal;
    otherwise returns \c false.
*/

/*!
    \since 5.12
    \fn template <typename CodeType> bool QKnxNetIpStructHeader<CodeType>::isMandatory() const

    Returns \c true if the mandatory bit is set; otherwise returns \c false.
*/

/*!
    \since 5.12
    \fn template <typename CodeType> void QKnxNetIpStructHeader<CodeType>::setMandatory(bool value)

    Sets the KNXnet/IP structure's mandatory bit to \a value.
*/

/*!
    \relates QKnxNetIpStructHeader
    \fn template<typename CodeType> QDebug operator<<(QDebug debug, const QKnxNetIpStructHeader<CodeType> &header)

    Writes the KNXnet/IP structure header \a header to the \a debug stream.
*/

QT_END_NAMESPACE