QKnxTpdu Class
The QKnxTpdu class represents a TPDU, which is the part of a link layer frame to be read by the network, transport, and application layers. More...
Header: | #include <QKnxTpdu> |
qmake: | QT += knx |
Public Types
enum class | ApplicationControlField { GroupValueRead, GroupValueResponse, GroupValueWrite, IndividualAddressWrite, IndividualAddressRead, …, Invalid } |
enum class | EraseCode { Reserved, ConfirmedRestart, FactoryReset, ResetIa, ResetAp, …, Invalid } |
enum class | ErrorCode { NoError, Error } |
enum class | LinkWriteFlags { AddGroupAddress, AddSendingGroupAddress, AddNotSendingGroupAddress, DeleteGroupAddress } |
enum class | ResetType { BasicRestart, MasterRestart } |
enum class | TransportControlField { DataGroup, DataBroadcast, DataSystemBroadcast, DataTagGroup, DataIndividual, …, Invalid } |
Public Functions
QKnxTpdu(QKnxTpdu &&other) | |
QKnxTpdu(const QKnxTpdu &other) | |
QKnxTpdu(QKnxTpdu::TransportControlField tpci, quint8 seqNumber, QKnxTpdu::ApplicationControlField apci, const QKnxByteArray &data = {}) | |
QKnxTpdu(QKnxTpdu::TransportControlField tpci, quint8 seqNumber) | |
QKnxTpdu(QKnxTpdu::TransportControlField tpci, QKnxTpdu::ApplicationControlField apci, const QKnxByteArray &data = {}) | |
QKnxTpdu(QKnxTpdu::TransportControlField tpci) | |
QKnxTpdu() | |
QKnxTpdu & | operator=(QKnxTpdu &&other) |
QKnxTpdu & | operator=(const QKnxTpdu &other) |
~QKnxTpdu() | |
QKnxTpdu::ApplicationControlField | applicationControlField() const |
QKnxByteArray | bytes() const |
QKnxByteArray | data() const |
quint16 | dataSize() const |
bool | isValid() const |
QKnx::MediumType | mediumType() const |
quint8 | sequenceNumber() const |
void | setApplicationControlField(QKnxTpdu::ApplicationControlField apci) |
void | setData(const QKnxByteArray &data) |
void | setMediumType(QKnx::MediumType mediumType) |
void | setSequenceNumber(quint8 seqNumber) |
void | setTransportControlField(QKnxTpdu::TransportControlField tpci) |
quint16 | size() const |
void | swap(QKnxTpdu &other) |
QKnxTpdu::TransportControlField | transportControlField() const |
bool | operator!=(const QKnxTpdu &other) const |
bool | operator==(const QKnxTpdu &other) const |
Static Public Members
QKnxTpdu::ApplicationControlField | apci(const QKnxByteArray &data, quint8 index) |
QKnxTpdu | fromBytes(const QKnxByteArray &data, quint16 index, quint16 size, QKnx::MediumType mediumType = QKnx::MediumType::NetIP) |
quint8 | sequenceNumber(const QKnxByteArray &data, quint8 index, bool *ok = nullptr) |
QKnxTpdu::TransportControlField | tpci(const QKnxByteArray &data, quint8 index) |
Related Non-Members
QDebug | operator<<(QDebug debug, const QKnxTpdu &tpdu) |
Detailed Description
Reading the bytes from left to right, a transport protocol data unit (TPDU) contains the following information:
- The transport layer code indication (TPCI), TransportControlField
- The application layer code indication (APCI), ApplicationControlField
The other fields contained by the TPDU depend on the selected service. For example, the T_CONNECT
TPDU holds no application layer service.
The sequence number of the TPDU is used when transmitting frames between KNXNet/IP clients and servers to make sure the all packages are received and that they arrive in the correct order.
See also QKnxLinkLayerFrame and Qt KNX Tunneling Classes.
Member Type Documentation
enum class QKnxTpdu::ApplicationControlField
This enum describes the message codes dedicated to the application and representing an application service.
Constant | Value |
---|---|
QKnxTpdu::ApplicationControlField::GroupValueRead | 0x0000 |
QKnxTpdu::ApplicationControlField::GroupValueResponse | 0x0040 |
QKnxTpdu::ApplicationControlField::GroupValueWrite | 0x0080 |
QKnxTpdu::ApplicationControlField::IndividualAddressWrite | 0x00c0 |
QKnxTpdu::ApplicationControlField::IndividualAddressRead | 0x0100 |
QKnxTpdu::ApplicationControlField::IndividualAddressResponse | 0x0140 |
QKnxTpdu::ApplicationControlField::AdcRead | 0x0180 |
QKnxTpdu::ApplicationControlField::AdcResponse | 0x01c0 |
QKnxTpdu::ApplicationControlField::SystemNetworkParameterRead | 0x01c8 |
QKnxTpdu::ApplicationControlField::SystemNetworkParameterResponse | 0x01c9 |
QKnxTpdu::ApplicationControlField::SystemNetworkParameterWrite | 0x01ca |
QKnxTpdu::ApplicationControlField::MemoryRead | 0x0200 |
QKnxTpdu::ApplicationControlField::MemoryResponse | 0x0240 |
QKnxTpdu::ApplicationControlField::MemoryWrite | 0x0280 |
QKnxTpdu::ApplicationControlField::UserMemoryRead | 0x02c0 |
QKnxTpdu::ApplicationControlField::UserMemoryResponse | 0x02c1 |
QKnxTpdu::ApplicationControlField::UserMemoryWrite | 0x02c2 |
QKnxTpdu::ApplicationControlField::UserManufacturerInfoRead | 0x02c5 |
QKnxTpdu::ApplicationControlField::UserManufacturerInfoResponse | 0x02c6 |
QKnxTpdu::ApplicationControlField::FunctionPropertyCommand | 0x02c7 |
QKnxTpdu::ApplicationControlField::FunctionPropertyStateRead | 0x02c8 |
QKnxTpdu::ApplicationControlField::FunctionPropertyStateResponse | 0x02c9 |
QKnxTpdu::ApplicationControlField::DeviceDescriptorRead | 0x0300 |
QKnxTpdu::ApplicationControlField::DeviceDescriptorResponse | 0x0340 |
QKnxTpdu::ApplicationControlField::Restart | 0x0380 |
QKnxTpdu::ApplicationControlField::AuthorizeRequest | 0x03d1 |
QKnxTpdu::ApplicationControlField::AuthorizeResponse | 0x03d2 |
QKnxTpdu::ApplicationControlField::KeyWrite | 0x03d3 |
QKnxTpdu::ApplicationControlField::KeyResponse | 0x03d4 |
QKnxTpdu::ApplicationControlField::PropertyValueRead | 0x03d5 |
QKnxTpdu::ApplicationControlField::PropertyValueResponse | 0x03d6 |
QKnxTpdu::ApplicationControlField::PropertyValueWrite | 0x03d7 |
QKnxTpdu::ApplicationControlField::PropertyDescriptionRead | 0x03d8 |
QKnxTpdu::ApplicationControlField::PropertyDescriptionResponse | 0x03d9 |
QKnxTpdu::ApplicationControlField::NetworkParameterRead | 0x03da |
QKnxTpdu::ApplicationControlField::NetworkParameterResponse | 0x03db |
QKnxTpdu::ApplicationControlField::IndividualAddressSerialNumberRead | 0x03dc |
QKnxTpdu::ApplicationControlField::IndividualAddressSerialNumberResponse | 0x03dd |
QKnxTpdu::ApplicationControlField::IndividualAddressSerialNumberWrite | 0x03de |
QKnxTpdu::ApplicationControlField::DomainAddressWrite | 0x03e0 |
QKnxTpdu::ApplicationControlField::DomainAddressRead | 0x03e1 |
QKnxTpdu::ApplicationControlField::DomainAddressResponse | 0x03e2 |
QKnxTpdu::ApplicationControlField::DomainAddressSelectiveRead | 0x03e3 |
QKnxTpdu::ApplicationControlField::NetworkParameterWrite | 0x03e4 |
QKnxTpdu::ApplicationControlField::NetworkParameterInfoReport | 0x03db |
QKnxTpdu::ApplicationControlField::LinkRead | 0x03e5 |
QKnxTpdu::ApplicationControlField::LinkResponse | 0x03e6 |
QKnxTpdu::ApplicationControlField::LinkWrite | 0x03e7 |
QKnxTpdu::ApplicationControlField::GroupPropValueRead | 0x03e8 |
QKnxTpdu::ApplicationControlField::GroupPropValueResponse | 0x03e9 |
QKnxTpdu::ApplicationControlField::GroupPropValueWrite | 0x03ea |
QKnxTpdu::ApplicationControlField::GroupPropValueInfoReport | 0x03eb |
QKnxTpdu::ApplicationControlField::DomainAddressSerialNumberRead | 0x03ec |
QKnxTpdu::ApplicationControlField::DomainAddressSerialNumberResponse | 0x03ed |
QKnxTpdu::ApplicationControlField::DomainAddressSerialNumberWrite | 0x03ee |
QKnxTpdu::ApplicationControlField::FileStreamInfoReport | 0x03f0 |
QKnxTpdu::ApplicationControlField::Invalid | 0x00ff |
enum class QKnxTpdu::EraseCode
This enum describes the erase codes needed when building a TPDU with the Restart service.
Constant | Value |
---|---|
QKnxTpdu::EraseCode::Reserved | 0 |
QKnxTpdu::EraseCode::ConfirmedRestart | 1 |
QKnxTpdu::EraseCode::FactoryReset | 2 |
QKnxTpdu::EraseCode::ResetIa | 3 |
QKnxTpdu::EraseCode::ResetAp | 4 |
QKnxTpdu::EraseCode::ResetParam | 5 |
QKnxTpdu::EraseCode::ResetLinks | 6 |
QKnxTpdu::EraseCode::ResetWithoutIa | 7 |
QKnxTpdu::EraseCode::Invalid | 8 |
enum class QKnxTpdu::ErrorCode
This enum describes the error codes needed when building a TPDU with the FunctionPropertyStateResponse or Restart service.
Constant | Value |
---|---|
QKnxTpdu::ErrorCode::NoError | 0x00 |
QKnxTpdu::ErrorCode::Error | 0x01 |
enum class QKnxTpdu::LinkWriteFlags
This enum describes the link write flags needed when building a TPDU with the LinkWrite service.
Constant | Value |
---|---|
QKnxTpdu::LinkWriteFlags::AddGroupAddress | 0x00 |
QKnxTpdu::LinkWriteFlags::AddSendingGroupAddress | 0x01 |
QKnxTpdu::LinkWriteFlags::AddNotSendingGroupAddress | 0x00 |
QKnxTpdu::LinkWriteFlags::DeleteGroupAddress | 0x02 |
enum class QKnxTpdu::ResetType
This enum describes the reset types needed when building a TPDU with the Restart service.
Constant | Value |
---|---|
QKnxTpdu::ResetType::BasicRestart | 0x00 |
QKnxTpdu::ResetType::MasterRestart | 0x01 |
enum class QKnxTpdu::TransportControlField
This enum describes the message codes dedicated to the transport layer.
Constant | Value |
---|---|
QKnxTpdu::TransportControlField::DataGroup | 0x00 |
QKnxTpdu::TransportControlField::DataBroadcast | 0x00 |
QKnxTpdu::TransportControlField::DataSystemBroadcast | 0x00 |
QKnxTpdu::TransportControlField::DataTagGroup | 0x04 |
QKnxTpdu::TransportControlField::DataIndividual | 0x00 |
QKnxTpdu::TransportControlField::DataConnected | 0x40 |
QKnxTpdu::TransportControlField::Connect | 0x80 |
QKnxTpdu::TransportControlField::Disconnect | 0x81 |
QKnxTpdu::TransportControlField::Acknowledge | 0xc2 |
QKnxTpdu::TransportControlField::NoAcknowledge | 0xc3 |
QKnxTpdu::TransportControlField::Invalid | 0xfc |
Member Function Documentation
QKnxTpdu::QKnxTpdu(QKnxTpdu &&other)
Move-constructs an object instance, making it point to the same object that other was pointing to.
QKnxTpdu::QKnxTpdu(const QKnxTpdu &other)
Constructs a copy of other.
QKnxTpdu::QKnxTpdu(QKnxTpdu::TransportControlField tpci, quint8 seqNumber, QKnxTpdu::ApplicationControlField apci, const QKnxByteArray &data = {})
Creates a TPDU with the transport layer code indication set to tpci, sequence number set to seqNumber, application layer code indication set to apci, and the data set to data.
QKnxTpdu::QKnxTpdu(QKnxTpdu::TransportControlField tpci, quint8 seqNumber)
Creates a TPDU with the transport layer code indication set to tpci and the sequence number set to seqNumber.
QKnxTpdu::QKnxTpdu(QKnxTpdu::TransportControlField tpci, QKnxTpdu::ApplicationControlField apci, const QKnxByteArray &data = {})
Creates a TPDU with the transport layer code indication set to tpci, the application layer code indication set to apci, and the data set to data.
QKnxTpdu::QKnxTpdu(QKnxTpdu::TransportControlField tpci)
Creates a TPDU with the transport layer code indication set to tpci.
QKnxTpdu::QKnxTpdu()
Creates a TPDU.
QKnxTpdu &QKnxTpdu::operator=(QKnxTpdu &&other)
Move-assigns other to this object instance.
QKnxTpdu &QKnxTpdu::operator=(const QKnxTpdu &other)
Assigns the specified other to this object.
QKnxTpdu::~QKnxTpdu()
Deletes a TPDU.
[static]
QKnxTpdu::ApplicationControlField QKnxTpdu::apci(const QKnxByteArray &data, quint8 index)
Returns the APCI field extracted out of the data byte array at the position index; otherwise returns Invalid.
Note: The given byte array is not further validated, so you need to be sure to pass data that is a TPDU.
QKnxTpdu::ApplicationControlField QKnxTpdu::applicationControlField() const
Returns the application layer control indication field of the TPDU.
See also setApplicationControlField().
QKnxByteArray QKnxTpdu::bytes() const
Returns the TPDU as an array of bytes.
QKnxByteArray QKnxTpdu::data() const
Returns the data part of the TPDU as an array of bytes.
Note: TPCI and APCI are not part of the returned byte array.
See also setData().
quint16 QKnxTpdu::dataSize() const
Returns the number of bytes of the TPDU data.
Note: The data part of a TPDU may contain the low byte of the application layer control indication (APCI), but excludes the byte for the transport layer control indication (TPCI) field.
[static]
QKnxTpdu QKnxTpdu::fromBytes(const QKnxByteArray &data, quint16 index, quint16 size, QKnx::MediumType mediumType = QKnx::MediumType::NetIP)
Creates a TPDU with the medium type mediumType from the byte array data starting at the position index inside the array with the size size.
bool QKnxTpdu::isValid() const
Returns true
if the TPDU is valid.
Note: This function is not implemented for all services and medium types. At the time of this writing, only KNXnet/IP is supported.
QKnx::MediumType QKnxTpdu::mediumType() const
Returns the medium type of the TPDU.
See also setMediumType().
quint8 QKnxTpdu::sequenceNumber() const
Returns the sequence number if the frame is connection oriented; otherwise returns 0
.
See also setSequenceNumber().
[static]
quint8 QKnxTpdu::sequenceNumber(const QKnxByteArray &data, quint8 index, bool *ok = nullptr)
Returns the sequence number extracted from the data byte array if the byte at position index can be verified as a valid TPCI field.
If an error occurs, ok is set to false
and this function returns a negative value.
Note: The given byte array is not further validated, so you need to be sure to pass data that is a TPDU.
void QKnxTpdu::setApplicationControlField(QKnxTpdu::ApplicationControlField apci)
Sets the application layer control indication field to apci.
See also applicationControlField().
void QKnxTpdu::setData(const QKnxByteArray &data)
Sets the data part of the TPDU to data.
Note: The TPCI and APCI may not be a part of the passed argument.
See also data().
void QKnxTpdu::setMediumType(QKnx::MediumType mediumType)
Sets the medium type of the TPDU to mediumType.
See also mediumType().
void QKnxTpdu::setSequenceNumber(quint8 seqNumber)
Sets the sequence number to seqNumber if the frame is connection oriented; otherwise does nothing.
See also sequenceNumber().
void QKnxTpdu::setTransportControlField(QKnxTpdu::TransportControlField tpci)
Sets the transport layer control indication field to tpci.
See also transportControlField().
quint16 QKnxTpdu::size() const
Returns the number of bytes of the TPDU.
void QKnxTpdu::swap(QKnxTpdu &other)
Swaps other with this object. This operation is very fast and never fails.
[static]
QKnxTpdu::TransportControlField QKnxTpdu::tpci(const QKnxByteArray &data, quint8 index)
Returns the TPCI field extracted from the data byte array at the position index; otherwise returns Invalid.
Note: If the TPCI field carries a sequence number, the value is removed from the return value.
Note: The given byte array is not further validated, so you need to be sure to pass data that is a TPDU.
QKnxTpdu::TransportControlField QKnxTpdu::transportControlField() const
Returns the transport layer code indication field of the TPDU.
See also setTransportControlField().
bool QKnxTpdu::operator!=(const QKnxTpdu &other) const
Returns true
if this object and the given other are not equal; otherwise returns false
.
bool QKnxTpdu::operator==(const QKnxTpdu &other) const
Returns true
if this object and the given other are equal; otherwise returns false
.
© 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.