The QKnxNetIpCrdProxy class provides the means to read the KNXnet/IP connection response data (CRD) from the generic QKnxNetIpCrd class and to create a KNXnet/IP CRD structure based on the information. 更多...
头: | #include <QKnxNetIpCrdProxy> |
qmake: | QT += knx |
class | Builder |
QKnxNetIpCrdProxy (const QKnxNetIpCrd & crd ) | |
QKnxByteArray | additionalData () const |
QKnxNetIp::ConnectionType | connectionType () const |
QKnxAddress | individualAddress () const |
bool | isValid () const |
QKnxNetIpCrdProxy::Builder | builder () |
A KNXnet/IP CRD structure contains the data block returned with the connect response QKnxNetIpFrame . The content of such a frame can be viewed by using the QKnxNetIpConnectResponseProxy proxy class.
The structure may contain host protocol dependent and independent data, but the current KNX specification foresees additional data only in the case of tunneling.
注意: When using QKnxNetIpCrdProxy, care must be taken to ensure that the referenced KNXnet/IP CRD structure outlives the proxy on all code paths, lest the proxy ends up referencing deleted data.
Reading the connection type and assigned individual address can be achieved like this:
auto crd = QKnxNetIpCrd::fromBytes(...); QKnxNetIpCrdProxy proxy(crd); if (!proxy.isValid()) return; if (proxy.connectionType() != QKnxNetIp::ConnectionType::Tunnel) return; auto address = proxy.individualAddress(); // read the individual address
另请参阅 builder () 和 Qt KNXnet/IP Connection Classes .
Constructs a proxy object with the specified a KNXnet/IP structure crd to read the connection response data block (CRD).
Returns the additional data of this KNXnet/IP structure.
The current KNX specification foresees additional data only in the case of tunneling.
另请参阅 individualAddress ().
[static]
QKnxNetIpCrdProxy::Builder
QKnxNetIpCrdProxy::
builder
()
Returns a builder object to create a KNXnet/IP connection response data block structure.
Returns the connection type of this KNXnet/IP structure if the object that was passed during construction was valid; otherwise returns QKnx::NetIp::Unknown .
Returns the individual address of this KNXnet/IP structure if the object that was passed during construction was valid and the connection type is QKnx::NetIp::Tunnel ;否则返回 QKnx::NetIp::Unknown .
另请参阅 additionalData ().
返回
true
if the KNXnet/IP structure to create the object is a valid KNXnet/IP CRD structure; otherwise returns
false
.