QKnxNetIpStructHeader Class

template <typename CodeType> class QKnxNetIpStructHeader

The QKnxNetIpStructHeader class is a KNXnet/IP structure header. 更多...

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

公共函数

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

静态公共成员

QKnxNetIpStructHeader<CodeType> fromBytes (const QKnxByteArray & bytes , quint16 index = 0)
QDebug operator<< (QDebug debug , const QKnxNetIpStructHeader<CodeType> & 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 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.

另请参阅 Qt KNXnet/IP Connection Classes .

成员函数文档编制

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.

另请参阅 isValid (), code (), setCode (), dataSize (), setDataSize (),和 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.

另请参阅 isValid (), code (), setCode (), dataSize (),和 setDataSize ().

QKnxNetIpStructHeader:: QKnxNetIpStructHeader ( CodeType codeType )

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

另请参阅 isValid (), code (),和 setCode ().

QKnxNetIpStructHeader:: QKnxNetIpStructHeader ()

Constructs an empty invalid header object.

另请参阅 isNull () 和 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.

另请参阅 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.

另请参阅 setDataSize (), isNull (), isValid (), size (),和 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.

另请参阅 isNull () 和 isValid ().

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

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

该函数在 Qt 5.12 引入。

bool QKnxNetIpStructHeader:: isNull () const

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

另请参阅 isValid ().

bool QKnxNetIpStructHeader:: isValid () const

返回 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 标识符。

另请参阅 isNull ().

void QKnxNetIpStructHeader:: setCode ( CodeType codeType )

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

另请参阅 code ().

void QKnxNetIpStructHeader:: setDataSize ( quint16 dataFieldSize )

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

另请参阅 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 .

该函数在 Qt 5.12 引入。

另请参阅 isMandatory ().

quint8 QKnxNetIpStructHeader:: size () const

Returns the size of the KNXnet/IP structure header.

另请参阅 isNull () 和 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.

另请参阅 isNull (), isValid (), size (),和 dataSize ().

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

返回 true if this object and the given other 不相等;则返回 false .

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

返回 true if this object and the given other 相等;否则返回 false .

相关非成员

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

Writes the KNXnet/IP structure header header debug stream.