QKnxNetIpFrame Class

The QKnxNetIpFrame class represents the base for all KNXnet/IP related communication. 更多...

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

公共函数

QKnxNetIpFrame (QKnxNetIpFrame && other )
QKnxNetIpFrame (const QKnxNetIpFrame & other )
QKnxNetIpFrame (const QKnxNetIpFrameHeader & header , const QKnxNetIpConnectionHeader & connectionHeader , const QKnxByteArray & data = {})
QKnxNetIpFrame (QKnxNetIp::ServiceType type , const QKnxNetIpConnectionHeader & connectionHeader , const QKnxByteArray & data = {})
QKnxNetIpFrame (QKnxNetIp::ServiceType type , const QKnxByteArray & data = {})
QKnxNetIpFrame ()
QKnxNetIpFrame & operator= (QKnxNetIpFrame && other )
QKnxNetIpFrame & operator= (const QKnxNetIpFrame & other )
~QKnxNetIpFrame ()
QKnxByteArray bytes () const
quint8 channelId () const
QKnxNetIpConnectionHeader connectionHeader () const
QKnxByteArray connectionTypeSpecificHeaderItems () const
const QKnxByteArray & constData () const
QKnxByteArray data () const
quint16 dataSize () const
QKnxNetIpFrameHeader header () const
bool isNull () const
bool isValid () const
quint8 protocolVersion () const
quint8 sequenceNumber () const
QKnxNetIp::ServiceType serviceType () const
quint8 serviceTypeSpecificValue () const
void setConnectionHeader (const QKnxNetIpConnectionHeader & header )
void setData (const QKnxByteArray & data )
void setHeader (const QKnxNetIpFrameHeader & header )
void setServiceType (QKnxNetIp::ServiceType type )
quint16 size () const
void swap (QKnxNetIpFrame & other )
bool operator!= (const QKnxNetIpFrame & other ) const
bool operator== (const QKnxNetIpFrame & other ) const

静态公共成员

QKnxNetIpFrame fromBytes (const QKnxByteArray & bytes , quint16 index = 0)
QDebug operator<< (QDebug debug , const QKnxNetIpFrame & frame )

详细描述

The communication between KNXnet/IP devices is based on KNXnet/IP frames. A KNXnet/IP frame is a data packet sent over the non-KNX network protocol that consists of a header, comparable to the IP header of an Internet protocol data packet, and optional data of variable length. The type of the KNXnet/IP frame is described by a KNXnet/IP service type identifier in the header.

另请参阅 Qt KNXnet/IP Connection Classes .

成员函数文档编制

QKnxNetIpFrame:: QKnxNetIpFrame ( QKnxNetIpFrame && other )

Move-constructs an object instance, making it point to the same object that other 所指向的。

QKnxNetIpFrame:: QKnxNetIpFrame (const QKnxNetIpFrame & other )

构造副本为 other .

QKnxNetIpFrame:: QKnxNetIpFrame (const QKnxNetIpFrameHeader & header , const QKnxNetIpConnectionHeader & connectionHeader , const QKnxByteArray & data = {})

Creates a new KNXnet/IP frame with the given frame header header , connection header set to connectionHeader , and data set to data .

QKnxNetIpFrame:: QKnxNetIpFrame ( QKnxNetIp::ServiceType type , const QKnxNetIpConnectionHeader & connectionHeader , const QKnxByteArray & data = {})

Creates a new KNXnet/IP frame with the given service type type , connection header set to connectionHeader , and data set to data .

QKnxNetIpFrame:: QKnxNetIpFrame ( QKnxNetIp::ServiceType type , const QKnxByteArray & data = {})

Creates a new KNXnet/IP frame with the given service type type and data set to data .

QKnxNetIpFrame:: QKnxNetIpFrame ()

Constructs an empty invalid KNXnet/IP frame object.

QKnxNetIpFrame &QKnxNetIpFrame:: operator= ( QKnxNetIpFrame && other )

移动赋值 other to this object instance.

QKnxNetIpFrame &QKnxNetIpFrame:: operator= (const QKnxNetIpFrame & other )

赋值指定 other 到此对象。

QKnxNetIpFrame:: ~QKnxNetIpFrame ()

Destroys the KNXnet/IP frame object and releases all allocated resources.

QKnxByteArray QKnxNetIpFrame:: bytes () const

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

quint8 QKnxNetIpFrame:: channelId () const

Returns the KNXnet/IP frame's channel ID if a connection header is set.

注意: By default the function returns null.

QKnxNetIpConnectionHeader QKnxNetIpFrame:: connectionHeader () const

Returns the KNXnet/IP frame's connection header.

另请参阅 setConnectionHeader ().

QKnxByteArray QKnxNetIpFrame:: connectionTypeSpecificHeaderItems () const

Returns a byte array with connection type specific header items of the KNXnet/IP frame if a connection header is set.

注意: The returned array can be empty.

const QKnxByteArray &QKnxNetIpFrame:: constData () const

Returns the data part of the KNXnet/IP frame as constant reference.

注意: If a connection header is set, it is not considered part of the returned data.

QKnxByteArray QKnxNetIpFrame:: data () const

Returns the data part of the KNXnet/IP frame.

注意: If a connection header is set, it is not considered part of the returned data.

另请参阅 setData ().

quint16 QKnxNetIpFrame:: dataSize () const

Returns the size of the KNXnet/IP frame data. The data size excludes the size of the KNXnet/IP frame header and the optional connection header.

[static] QKnxNetIpFrame QKnxNetIpFrame:: fromBytes (const QKnxByteArray & bytes , quint16 index = 0)

Constructs the KNXnet/IP frame from the byte array bytes 起始于位置 index inside the array.

Returns the KNXnet/IP frame header.

另请参阅 setHeader ().

bool QKnxNetIpFrame:: isNull () const

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

bool QKnxNetIpFrame:: isValid () const

返回 true if the frame contains initialized values and is in itself valid, otherwise returns false . A valid KNXnet/IP frame consists of at least a valid header and a size in bytes corresponding to the KNXnet/IP frame header QKnxNetIpFrameHeader::totalSize .

quint8 QKnxNetIpFrame:: protocolVersion () const

Returns the KNXnet/IP frame protocol version.

quint8 QKnxNetIpFrame:: sequenceNumber () const

Returns the KNXnet/IP frame's sequence number if a connection header is set.

注意: By default the function returns null.

QKnxNetIp::ServiceType QKnxNetIpFrame:: serviceType () const

Returns the KNXnet/IP frame's service type or QKnxNetIp::Unknown for a default generated frame.

另请参阅 setServiceType ().

quint8 QKnxNetIpFrame:: serviceTypeSpecificValue () const

Returns the service type specific value of the KNXnet/IP frame if a connection header is set.

注意: By default the function returns null.

void QKnxNetIpFrame:: setConnectionHeader (const QKnxNetIpConnectionHeader & header )

Sets the KNXnet/IP frame's connection header to header and updates the total size accordingly.

另请参阅 connectionHeader ().

void QKnxNetIpFrame:: setData (const QKnxByteArray & data )

Sets the data part of the KNXnet/IP frame to data and updates the total size accordingly.

注意: The data part passed may not contain the connection header.

另请参阅 data ().

void QKnxNetIpFrame:: setHeader (const QKnxNetIpFrameHeader & header )

Sets the KNXnet/IP frame header to header .

另请参阅 header ().

void QKnxNetIpFrame:: setServiceType ( QKnxNetIp::ServiceType type )

Sets the KNXnet/IP frame's service type to type .

另请参阅 serviceType ().

quint16 QKnxNetIpFrame:: size () const

Returns the size in bytes of the KNXnet/IP frame. The size includes the size of the KNXnet/IP frame header, the optional connection header, and the frame's data part.

void QKnxNetIpFrame:: swap ( QKnxNetIpFrame & other )

交换 other 与此对象。此操作非常快且从不失败。

bool QKnxNetIpFrame:: operator!= (const QKnxNetIpFrame & other ) const

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

bool QKnxNetIpFrame:: operator== (const QKnxNetIpFrame & other ) const

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

相关非成员

QDebug operator<< ( QDebug debug , const QKnxNetIpFrame & frame )

Writes the KNXnet/IP frame debug stream.