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

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

Public Types

class Builder
enum class MessageCode { Unknown, BusmonitorIndication, DataRequest, DataConfirmation, DataIndication, …, ResetRequest }

Public Functions

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

Static Public Members

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)

Detailed Description

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.

See also Qt KNX Tunneling Classes.

Member Type Documentation

enum class QKnxLinkLayerFrame::MessageCode

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

ConstantValueDescription
QKnxLinkLayerFrame::MessageCode::Unknown0x00An unknown message code.
QKnxLinkLayerFrame::MessageCode::BusmonitorIndication0x2bA L_Busmon.ind message code that is used in server-to-client communication on KNX bus monitor.
QKnxLinkLayerFrame::MessageCode::DataRequest0x11A L_Data.req message code that is used in client-to-server communication on KNX data link layer.
QKnxLinkLayerFrame::MessageCode::DataConfirmation0x2eA l{L_Data.con} message code that is used in server-to-client communication on KNX data link layer.
QKnxLinkLayerFrame::MessageCode::DataIndication0x29A L_Data.ind message code that is used in server-to-client communication on KNX data link layer.
QKnxLinkLayerFrame::MessageCode::RawRequest0x10A L_Raw.req message code that is used in client-to-server communication in common external message interface (cEMI) raw mode.
QKnxLinkLayerFrame::MessageCode::RawIndication0x2dA L_Raw.ind message code that is used in server-to-client communication in cEMI raw mode.
QKnxLinkLayerFrame::MessageCode::RawConfirmation0x2fA L_Raw.con message code that is used in server-to-client communication in cEMI raw mode.
QKnxLinkLayerFrame::MessageCode::ResetRequest0xf1A M_Reset.req message code that is used in client-to-server communication on KNX data link layer and in cEMI raw mode.

Member Function Documentation

QKnxLinkLayerFrame::QKnxLinkLayerFrame(QKnxLinkLayerFrame &&other)

Move-constructs an object instance, making it point to the same object that other was pointing to.

QKnxLinkLayerFrame::QKnxLinkLayerFrame(const QKnxLinkLayerFrame &other)

Constructs a copy of 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.

See also setMediumType().

QKnxLinkLayerFrame::QKnxLinkLayerFrame(QKnxLinkLayerFrame::MessageCode messageCode)

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

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

See also setMediumType().

QKnxLinkLayerFrame::QKnxLinkLayerFrame()

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

See also setMediumType().

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

Move-assigns other to this object instance.

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

Assigns the specified other to this object.

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.

See also QKnxAdditionalInfo and QKnxAdditionalInfo::type().

QVector<QKnxAdditionalInfo> QKnxLinkLayerFrame::additionalInfos() const

Returns a vector of additional information contained in the frame.

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

See also setControlField().

const QKnxAddress QKnxLinkLayerFrame::destinationAddress() const

Returns the destination address.

See also setDestinationAddress().

QKnxExtendedControlField QKnxLinkLayerFrame::extendedControlField() const

Returns the extended control field of the frame.

See also 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

Returns true if the link layer frame is valid, returns false otherwise.

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

See also setMediumType().

QKnxLinkLayerFrame::MessageCode QKnxLinkLayerFrame::messageCode() const

Returns the message code of the link layer frame.

See also setMessageCode().

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

Removes all additional information of the type type.

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

See also QKnxAdditionalInfo.

QKnxByteArray QKnxLinkLayerFrame::serviceInformation() const

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

See also setServiceInformation().

void QKnxLinkLayerFrame::setControlField(const QKnxControlField &controlField)

Sets the control field of the frame to controlField.

See also controlField().

void QKnxLinkLayerFrame::setDestinationAddress(const QKnxAddress &destination)

Sets the destination address to destination.

See also destinationAddress().

void QKnxLinkLayerFrame::setExtendedControlField(const QKnxExtendedControlField &controlFieldEx)

Sets the extended control field of the frame to controlFieldEx.

See also extendedControlField().

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

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

See also mediumType().

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

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

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

See also serviceInformation().

void QKnxLinkLayerFrame::setSourceAddress(const QKnxAddress &source)

Sets the source address to source.

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

See also tpdu().

quint16 QKnxLinkLayerFrame::size() const

Returns the number of bytes of the link layer frame.

const QKnxAddress QKnxLinkLayerFrame::sourceAddress() const

Returns the source address.

See also setSourceAddress().

void QKnxLinkLayerFrame::swap(QKnxLinkLayerFrame &other)

Swaps other with this object. This operation is very fast and never fails.

QKnxTpdu QKnxLinkLayerFrame::tpdu() const

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

See also setTpdu().

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

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

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

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

Related Non-Members

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

Writes the link layer frame frame to the debug stream.

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