QKnxNetIpStructHeader Class

template <typename CodeType> class QKnxNetIpStructHeader

The QKnxNetIpStructHeader class is a KNXnet/IP structure header. More...

Header: #include <QKnxNetIpStructHeader>
qmake: QT += knx

Public Functions

QKnxNetIpStructHeader(CodeType code, quint16 dataSize, bool mandatory)
QKnxNetIpStructHeader(CodeType codeType, quint16 dataFieldSize)
QKnxNetIpStructHeader(CodeType codeType)
QKnxNetIpStructHeader()
~QKnxNetIpStructHeader()
quint8 byte(quint8 index) const
QKnxByteArray bytes() const
CodeType code() const
quint16 dataSize() const
typename std::enable_if<is_type<T, QKnxNetIp::SearchParameterType>::value, bool>::type isMandatory() const
bool isNull() const
bool isValid() const
void setCode(CodeType codeType)
void setDataSize(quint16 dataFieldSize)
typename std::enable_if<is_type<T, QKnxNetIp::SearchParameterType>::value, void>::type setMandatory(bool value)
quint8 size() const
quint16 totalSize() const
bool operator!=(const QKnxNetIpStructHeader<CodeType> &other) const
bool operator==(const QKnxNetIpStructHeader<CodeType> &other) const

Static Public Members

QKnxNetIpStructHeader<CodeType> fromBytes(const QKnxByteArray &bytes, quint16 index = 0)
QDebug operator<<(QDebug debug, const QKnxNetIpStructHeader<CodeType> &header)

Detailed Description

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 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.

See also Qt KNXnet/IP Connection Classes.

Member Function Documentation

template <typename T, typename> QKnxNetIpStructHeader::QKnxNetIpStructHeader(CodeType code, quint16 dataSize, bool mandatory)

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

See also isValid(), code(), setCode(), dataSize(), setDataSize(), and setMandatory().

QKnxNetIpStructHeader::QKnxNetIpStructHeader(CodeType codeType, quint16 dataFieldSize)

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

See also isValid(), code(), setCode(), dataSize(), and setDataSize().

QKnxNetIpStructHeader::QKnxNetIpStructHeader(CodeType codeType)

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

See also isValid(), code(), and setCode().

QKnxNetIpStructHeader::QKnxNetIpStructHeader()

Constructs an empty invalid header object.

See also isNull() and isValid().

QKnxNetIpStructHeader::~QKnxNetIpStructHeader()

Destroys the header object and releases all allocated resources.

quint8 QKnxNetIpStructHeader::byte(quint8 index) const

Returns the byte at position index in the header.

QKnxByteArray QKnxNetIpStructHeader::bytes() const

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

CodeType QKnxNetIpStructHeader::code() const

Returns the KNXnet/IP structure's code identifier.

See also setCode().

quint16 QKnxNetIpStructHeader::dataSize() const

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

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

See also setDataSize(), isNull(), isValid(), size(), and totalSize().

[static] QKnxNetIpStructHeader<CodeType> QKnxNetIpStructHeader::fromBytes(const QKnxByteArray &bytes, quint16 index = 0)

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

See also isNull() and isValid().

template <typename T> typename std::enable_if<is_type<T, QKnxNetIp::SearchParameterType>::value, bool>::type QKnxNetIpStructHeader::isMandatory() const

Returns true if the mandatory bit is set; otherwise returns false.

This function was introduced in Qt 5.12.

bool QKnxNetIpStructHeader::isNull() const

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

See also isValid().

bool QKnxNetIpStructHeader::isValid() const

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

See also isNull().

void QKnxNetIpStructHeader::setCode(CodeType codeType)

Sets the KNXnet/IP structure's code identifier to codeType.

See also code().

void QKnxNetIpStructHeader::setDataSize(quint16 dataFieldSize)

Sets the KNXnet/IP structure data size to dataFieldSize and updates the header and total size accordingly.

See also dataSize().

template <typename T> typename std::enable_if<is_type<T, QKnxNetIp::SearchParameterType>::value, void>::type QKnxNetIpStructHeader::setMandatory(bool value)

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

This function was introduced in Qt 5.12.

See also isMandatory().

quint8 QKnxNetIpStructHeader::size() const

Returns the size of the KNXnet/IP structure header.

See also isNull() and isValid().

quint16 QKnxNetIpStructHeader::totalSize() const

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

See also isNull(), isValid(), size(), and dataSize().

bool QKnxNetIpStructHeader::operator!=(const QKnxNetIpStructHeader<CodeType> &other) const

Returns true if this object and the given other are not equal; otherwise returns false.

bool QKnxNetIpStructHeader::operator==(const QKnxNetIpStructHeader<CodeType> &other) const

Returns true if this object and the given other are equal; otherwise returns false.

Related Non-Members

template <typename CodeType> QDebug operator<<(QDebug debug, const QKnxNetIpStructHeader<CodeType> &header)

Writes the KNXnet/IP structure header header to the debug stream.

© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.