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. 更多...
头: | #include <QKnxTpdu> |
qmake: | QT += knx |
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 } |
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 |
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 ) |
QDebug | operator<< (QDebug debug , const QKnxTpdu & tpdu ) |
Reading the bytes from left to right, a transport protocol data unit (TPDU) contains the following information:
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.
另请参阅 QKnxLinkLayerFrame and Qt KNX Tunneling Classes .
This enum describes the message codes dedicated to the application and representing an application service.
常量 | 值 |
---|---|
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
|
This enum describes the erase codes needed when building a TPDU with the Restart service.
常量 | 值 |
---|---|
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
|
This enum describes the error codes needed when building a TPDU with the FunctionPropertyStateResponse or Restart service.
常量 | 值 |
---|---|
QKnxTpdu::ErrorCode::NoError
|
0x00
|
QKnxTpdu::ErrorCode::Error
|
0x01
|
This enum describes the link write flags needed when building a TPDU with the LinkWrite service.
常量 | 值 |
---|---|
QKnxTpdu::LinkWriteFlags::AddGroupAddress
|
0x00
|
QKnxTpdu::LinkWriteFlags::AddSendingGroupAddress
|
0x01
|
QKnxTpdu::LinkWriteFlags::AddNotSendingGroupAddress
|
0x00
|
QKnxTpdu::LinkWriteFlags::DeleteGroupAddress
|
0x02
|
This enum describes the reset types needed when building a TPDU with the Restart service.
常量 | 值 |
---|---|
QKnxTpdu::ResetType::BasicRestart
|
0x00
|
QKnxTpdu::ResetType::MasterRestart
|
0x01
|
This enum describes the message codes dedicated to the transport layer.
常量 | 值 |
---|---|
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
|
Move-constructs an object instance, making it point to the same object that other 所指向的。
构造副本为 other .
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 .
Creates a TPDU with the transport layer code indication set to tpci and the sequence number set to seqNumber .
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 .
Creates a TPDU with the transport layer code indication set to tpci .
Creates a TPDU.
移动赋值 other to this object instance.
赋值指定 other 到此对象。
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 ;否则返回 Invalid .
注意: The given byte array is not further validated, so you need to be sure to pass data that is a TPDU.
Returns the application layer control indication field of the TPDU.
另请参阅 setApplicationControlField ().
Returns the TPDU as an array of bytes.
Returns the data part of the TPDU as an array of bytes.
注意: TPCI and APCI are not part of the returned byte array.
另请参阅 setData ().
Returns the number of bytes of the TPDU data.
注意: 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 .
返回
true
if the TPDU is valid.
注意: This function is not implemented for all services and medium types. At the time of this writing, only KNXnet/IP is supported.
Returns the medium type of the TPDU.
另请参阅 setMediumType ().
Returns the sequence number if the frame is connection oriented; otherwise returns
0
.
另请参阅 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.
若出现错误,
ok
被设为
false
and this function returns a negative value.
注意: The given byte array is not further validated, so you need to be sure to pass data that is a TPDU.
Sets the application layer control indication field to apci .
另请参阅 applicationControlField ().
Sets the data part of the TPDU to data .
注意: The TPCI and APCI may not be a part of the passed argument.
另请参阅 data ().
Sets the medium type of the TPDU to mediumType .
另请参阅 mediumType ().
Sets the sequence number to seqNumber if the frame is connection oriented; otherwise does nothing.
另请参阅 sequenceNumber ().
Sets the transport layer control indication field to tpci .
另请参阅 transportControlField ().
Returns the number of bytes of the TPDU.
交换 other 与此对象。此操作非常快且从不失败。
[static]
QKnxTpdu::TransportControlField
QKnxTpdu::
tpci
(const
QKnxByteArray
&
data
,
quint8
index
)
Returns the TPCI field extracted from the data byte array at the position index ;否则返回 Invalid .
注意: If the TPCI field carries a sequence number, the value is removed from the return value.
注意: The given byte array is not further validated, so you need to be sure to pass data that is a TPDU.
Returns the transport layer code indication field of the TPDU.
另请参阅 setTransportControlField ().
返回
true
if this object and the given
other
不相等;则返回
false
.
返回
true
if this object and the given
other
相等;否则返回
false
.
Writes the KNX TPDU tpdu 到 debug stream.