QKnxNetIpFrame Class

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

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

Public Functions

QKnxNetIpFrame()
QKnxNetIpFrame(QKnxNetIp::ServiceType type, const QKnxByteArray &data = {})
QKnxNetIpFrame(QKnxNetIp::ServiceType type, const QKnxNetIpConnectionHeader &connectionHeader, const QKnxByteArray &data = {})
QKnxNetIpFrame(const QKnxNetIpFrameHeader &header, const QKnxNetIpConnectionHeader &connectionHeader, const QKnxByteArray &data = {})
QKnxNetIpFrame(const QKnxNetIpFrame &other)
QKnxNetIpFrame(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
QKnxNetIpFrame &operator=(const QKnxNetIpFrame &other)
QKnxNetIpFrame &operator=(QKnxNetIpFrame &&other)
bool operator==(const QKnxNetIpFrame &other) const

Static Public Members

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

Detailed Description

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

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.

See also Qt KNXnet/IP Connection Classes.

Member Function Documentation

QKnxNetIpFrame::QKnxNetIpFrame()

Constructs an empty invalid KNXnet/IP frame object.

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(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(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(const QKnxNetIpFrame &other)

Constructs a copy of other.

QKnxNetIpFrame::QKnxNetIpFrame(QKnxNetIpFrame &&other)

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

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.

Note: By default the function returns null.

QKnxNetIpConnectionHeader QKnxNetIpFrame::connectionHeader() const

Returns the KNXnet/IP frame's connection header.

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

Note: The returned array can be empty.

const QKnxByteArray &QKnxNetIpFrame::constData() const

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

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

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

See also 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 starting at position index inside the array.

Returns the KNXnet/IP frame header.

See also setHeader().

bool QKnxNetIpFrame::isNull() const

Returns 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

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

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

See also setServiceType().

quint8 QKnxNetIpFrame::serviceTypeSpecificValue() const

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

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

See also connectionHeader().

void QKnxNetIpFrame::setData(const QKnxByteArray &data)

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

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

See also data().

void QKnxNetIpFrame::setHeader(const QKnxNetIpFrameHeader &header)

Sets the KNXnet/IP frame header to header.

See also header().

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

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

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

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

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

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

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

Assigns the specified other to this object.

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

Move-assigns other to this object instance.

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

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

Related Non-Members

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

Writes the KNXnet/IP frame to the debug stream.

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