The QKnxNetIpConnectResponseProxy class provides the means to read a connection response from the generic QKnxNetIpFrame class and to create a KNXnet/IP frame based on the information. 更多...
头: | #include <QKnxNetIpConnectResponseProxy> |
qmake: | QT += knx |
class | Builder |
QKnxNetIpConnectResponseProxy (const QKnxNetIpFrame & frame ) | |
quint8 | channelId () const |
QKnxNetIpHpai | dataEndpoint () const |
bool | isValid () const |
QKnxNetIpCrd | responseData () const |
QKnxNetIp::Error | status () const |
QKnxNetIpConnectResponseProxy::Builder | builder () |
A connection response frame is sent by a KNXnet/IP server in response to a connection request received from a KNXnet/IP client. The connection response provides the status of the request. If the server accepted the request, the frame also contains the identifier and host address protocol information (HPAI) of the data endpoint that the server prepared for the communication channel.
In most programs, this class will not be used directly. Instead, the QKnxNetIpTunnel or QKnxNetIpDeviceManagement class is used to establish a functional connection to a KNXnet/IP server.
注意: When using QKnxNetIpConnectResponseProxy, care must be taken to ensure that the referenced KNXnet/IP frame outlives the proxy on all code paths, lest the proxy ends up referencing deleted data.
The following code sample illustrates how to read the connection response information sent by a KNXnet/IP server:
auto netIpFrame = QKnxNetIpFrame::fromBytes(...); const QKnxNetIpConnectResponseProxy proxy(netIpFrame); if (!proxy.isValid()) return; auto chanId = proxy.channelId(); auto data = proxy.responseData(); auto endPoint = proxy.dataEndpoint(); auto netIpError = proxy.status();
另请参阅 builder () 和 Qt KNXnet/IP Connection Classes .
Constructs a proxy object to read the connection response information carried by the specified KNXnet/IP frame frame .
[static]
QKnxNetIpConnectResponseProxy::Builder
QKnxNetIpConnectResponseProxy::
builder
()
Returns a builder object to create a KNXnet/IP connection response frame.
Returns the ID of the communication channel prepared by the KNXnet/IP server.
Returns the data endpoint of the KNXnet/IP server.
返回
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 total size of the KNXnet/IP frame header.
另请参阅 QKnxNetIpFrameHeader::totalSize ().
Returns a connection response data (CRD) structure from the KNXnet/IP connection request frame.
Returns the status of the connection request received from a KNXnet/IP client.
另请参阅 QKnxNetIpConnectRequestProxy .