QKnxLinkLayerFrame Class

The QKnxLinkLayerFrame class is a frame that is sent over a communication channel established between a KNXnet/IP client and a KNXnet/IP server. 更多...

頭: #include <QKnxLinkLayerFrame>
qmake: QT += knx

公共類型

class Builder
枚舉類 MessageCode { Unknown, BusmonitorIndication, DataRequest, DataConfirmation, DataIndication, …, ResetRequest }

公共函數

QKnxLinkLayerFrame (QKnxLinkLayerFrame && other )
QKnxLinkLayerFrame (const QKnxLinkLayerFrame & other )
QKnxLinkLayerFrame (QKnxLinkLayerFrame::MessageCode messageCode , const QKnxByteArray & serviceInfo )
QKnxLinkLayerFrame (QKnxLinkLayerFrame::MessageCode messageCode )
QKnxLinkLayerFrame ()
QKnxLinkLayerFrame & operator= (QKnxLinkLayerFrame && other )
QKnxLinkLayerFrame & operator= (const QKnxLinkLayerFrame & other )
~QKnxLinkLayerFrame ()
void addAdditionalInfo (const QKnxAdditionalInfo & info )
QVector<QKnxAdditionalInfo> additionalInfos () const
quint8 additionalInfosSize () const
QKnxByteArray bytes () const
void clearAdditionalInfos ()
QKnxControlField controlField () const
const QKnxAddress destinationAddress () const
QKnxExtendedControlField extendedControlField () const
bool isValid () const
QKnx::MediumType mediumType () const
QKnxLinkLayerFrame::MessageCode messageCode () const
void removeAdditionalInfo (QKnxAdditionalInfo::Type type )
void removeAdditionalInfo (const QKnxAdditionalInfo & info )
QKnxByteArray serviceInformation () const
void setControlField (const QKnxControlField & controlField )
void setDestinationAddress (const QKnxAddress & destination )
void setExtendedControlField (const QKnxExtendedControlField & controlFieldEx )
void setMediumType (QKnx::MediumType type )
void setMessageCode (QKnxLinkLayerFrame::MessageCode code )
void setServiceInformation (const QKnxByteArray & data )
void setSourceAddress (const QKnxAddress & source )
void setTpdu (const QKnxTpdu & tpdu )
quint16 size () const
const QKnxAddress sourceAddress () const
void swap (QKnxLinkLayerFrame & other )
QKnxTpdu tpdu () const
bool operator!= (const QKnxLinkLayerFrame & other ) const
bool operator== (const QKnxLinkLayerFrame & other ) const

靜態公共成員

QKnxLinkLayerFrame::Builder builder ()
QKnxLinkLayerFrame fromBytes (const QKnxByteArray & data , quint16 index , quint16 size , QKnx::MediumType mediumType = QKnx::MediumType::NetIP)
QDebug operator<< (QDebug debug , const QKnxLinkLayerFrame & frame )

詳細描述

Following the KNXnet/IP tunneling specifications, only the MessageCode values listed below are valid link layer frame message codes to be sent via a KNXnet/IP tunnel connection:

  • DataRequest ( L_Data.req )
  • DataConfirmation ( L_Data.con )
  • DataIndication ( L_Data.ind )
  • BusmonitorIndication ( L_Busmon.ind )
  • RawRequest ( L_Raw.req )
  • RawIndication ( L_Raw.ind )
  • RawConfirmation ( L_Raw.con )
  • ResetRequest ( M_Reset.req )

The Qt KNX module implements only KNXnet/IP tunnel connections, and therefore only the above message codes can be used.

The message code is also to be chosen depending on the application service (encoded with the QKnxTpdu::ApplicationControlField ) held in QKnxTpdu . The application services are split into categories according to the addressing method.

另請參閱 Qt KNX Tunneling Classes .

成員類型文檔編製

enum class QKnxLinkLayerFrame:: MessageCode

This enum holds the message code of the link layer frame sent via a KNXnet/IP tunnel connection.

常量 描述
QKnxLinkLayerFrame::MessageCode::Unknown 0x00 An unknown message code.
QKnxLinkLayerFrame::MessageCode::BusmonitorIndication 0x2b A L_Busmon.ind message code that is used in server-to-client communication on KNX bus monitor.
QKnxLinkLayerFrame::MessageCode::DataRequest 0x11 A L_Data.req message code that is used in client-to-server communication on KNX data link layer.
QKnxLinkLayerFrame::MessageCode::DataConfirmation 0x2e A l{L_Data.con} message code that is used in server-to-client communication on KNX data link layer.
QKnxLinkLayerFrame::MessageCode::DataIndication 0x29 A L_Data.ind message code that is used in server-to-client communication on KNX data link layer.
QKnxLinkLayerFrame::MessageCode::RawRequest 0x10 A L_Raw.req message code that is used in client-to-server communication in common external message interface (cEMI) raw mode.
QKnxLinkLayerFrame::MessageCode::RawIndication 0x2d A L_Raw.ind message code that is used in server-to-client communication in cEMI raw mode.
QKnxLinkLayerFrame::MessageCode::RawConfirmation 0x2f A L_Raw.con message code that is used in server-to-client communication in cEMI raw mode.
QKnxLinkLayerFrame::MessageCode::ResetRequest 0xf1 A M_Reset.req message code that is used in client-to-server communication on KNX data link layer and in cEMI raw mode.

成員函數文檔編製

QKnxLinkLayerFrame:: QKnxLinkLayerFrame ( QKnxLinkLayerFrame && other )

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

QKnxLinkLayerFrame:: QKnxLinkLayerFrame (const QKnxLinkLayerFrame & other )

構造副本為 other .

QKnxLinkLayerFrame:: QKnxLinkLayerFrame ( QKnxLinkLayerFrame::MessageCode messageCode , const QKnxByteArray & serviceInfo )

Constructs a link layer frame starting with messageCode and sets the service information to serviceInfo .

The medium type is set to QKnx::MediumType NetIP .

另請參閱 setMediumType ().

QKnxLinkLayerFrame:: QKnxLinkLayerFrame ( QKnxLinkLayerFrame::MessageCode messageCode )

Constructs a link layer frame starting with messageCode . The medium type is set to QKnx::MediumType NetIP .

注意: The link layer frame will be otherwise empty and needs to be set manually.

另請參閱 setMediumType ().

QKnxLinkLayerFrame:: QKnxLinkLayerFrame ()

Constructs an empty link layer frame with the medium type set to QKnx::MediumType NetIP .

另請參閱 setMediumType ().

QKnxLinkLayerFrame &QKnxLinkLayerFrame:: operator= ( QKnxLinkLayerFrame && other )

移動賦值 other to this object instance.

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

賦值指定 other 到此對象。

QKnxLinkLayerFrame:: ~QKnxLinkLayerFrame ()

Destroys the link layer management frame and frees all allocated resources.

void QKnxLinkLayerFrame:: addAdditionalInfo (const QKnxAdditionalInfo & info )

Adds the KNX additional info parameter info to the additional information field. The information is sorted in ascending order based on its type.

另請參閱 QKnxAdditionalInfo and QKnxAdditionalInfo::type ().

QVector < QKnxAdditionalInfo > QKnxLinkLayerFrame:: additionalInfos () const

Returns a vector of additional information contained in the frame.

另請參閱 QKnxAdditionalInfo .

quint8 QKnxLinkLayerFrame:: additionalInfosSize () const

Returns the size in bytes of the whole additional information field.

[static] QKnxLinkLayerFrame::Builder QKnxLinkLayerFrame:: builder ()

Returns an instance of a generic link layer frame builder.

QKnxByteArray QKnxLinkLayerFrame:: bytes () const

Returns an array of bytes that represent the link layer frame if it is valid; otherwise returns a default-constructed frame.

void QKnxLinkLayerFrame:: clearAdditionalInfos ()

Removes all additional information from the frame.

QKnxControlField QKnxLinkLayerFrame:: controlField () const

Returns the control field of the frame.

另請參閱 setControlField ().

const QKnxAddress QKnxLinkLayerFrame:: destinationAddress () const

Returns the destination address.

另請參閱 setDestinationAddress ().

QKnxExtendedControlField QKnxLinkLayerFrame:: extendedControlField () const

Returns the extended control field of the frame.

另請參閱 setExtendedControlField ().

[static] QKnxLinkLayerFrame QKnxLinkLayerFrame:: fromBytes (const QKnxByteArray & data , quint16 index , quint16 size , QKnx::MediumType mediumType = QKnx::MediumType::NetIP)

Constructs a link layer frame from the byte array data starting at the position index inside the array using the number of bytes specified by size . Sets the medium type of the frame to mediumType

bool QKnxLinkLayerFrame:: isValid () const

返迴 true if the link layer frame is valid, returns false 否則。

注意: Validation is only supported for QKnx::MediumType NetIP , for other medium types the function always returns false .

QKnx::MediumType QKnxLinkLayerFrame:: mediumType () const

Returns the medium type to be used to send the link layer frame.

另請參閱 setMediumType ().

QKnxLinkLayerFrame::MessageCode QKnxLinkLayerFrame:: messageCode () const

Returns the message code of the link layer frame.

另請參閱 setMessageCode ().

void QKnxLinkLayerFrame:: removeAdditionalInfo ( QKnxAdditionalInfo::Type type )

Removes all additional information of the type type .

另請參閱 QKnxAdditionalInfo and QKnxAdditionalInfo::Type .

void QKnxLinkLayerFrame:: removeAdditionalInfo (const QKnxAdditionalInfo & info )

Removes the first occurrence of the additional information info from the frame's additional information field.

另請參閱 QKnxAdditionalInfo .

QKnxByteArray QKnxLinkLayerFrame:: serviceInformation () const

Returns the service information the frame carries. This is the frame without the message code.

另請參閱 setServiceInformation ().

void QKnxLinkLayerFrame:: setControlField (const QKnxControlField & controlField )

Sets the control field of the frame to controlField .

另請參閱 controlField ().

void QKnxLinkLayerFrame:: setDestinationAddress (const QKnxAddress & destination )

Sets the destination address to destination .

另請參閱 destinationAddress ().

void QKnxLinkLayerFrame:: setExtendedControlField (const QKnxExtendedControlField & controlFieldEx )

Sets the extended control field of the frame to controlFieldEx .

另請參閱 extendedControlField ().

void QKnxLinkLayerFrame:: setMediumType ( QKnx::MediumType type )

Sets the medium type to be used to send the LinkLayer frame to type .

另請參閱 mediumType ().

void QKnxLinkLayerFrame:: setMessageCode ( QKnxLinkLayerFrame::MessageCode code )

Sets the message code of the link layer frame to code .

另請參閱 messageCode ().

void QKnxLinkLayerFrame:: setServiceInformation (const QKnxByteArray & data )

Sets the service information based on a byte array with all the fields encoded into it to data .

另請參閱 serviceInformation ().

void QKnxLinkLayerFrame:: setSourceAddress (const QKnxAddress & source )

Sets the source address to source .

另請參閱 sourceAddress ().

void QKnxLinkLayerFrame:: setTpdu (const QKnxTpdu & tpdu )

Sets the TPDU of the frame to tpdu . The TPDU is read by the network, transport, and application layer services.

另請參閱 tpdu ().

quint16 QKnxLinkLayerFrame:: size () const

Returns the number of bytes of the link layer frame.

const QKnxAddress QKnxLinkLayerFrame:: sourceAddress () const

Returns the source address.

另請參閱 setSourceAddress ().

void QKnxLinkLayerFrame:: swap ( QKnxLinkLayerFrame & other )

交換 other 與此對象。此操作很快且從不失敗。

QKnxTpdu QKnxLinkLayerFrame:: tpdu () const

Returns the TPDU of the frame. The TPDU is read by the network, transport, and application layer services.

另請參閱 setTpdu ().

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

返迴 true if this object and the given other 不相等;則返迴 false .

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

返迴 true if this object and the given other 相等;否則返迴 false .

相關非成員

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

Writes the link layer frame frame debug stream.