QKnxNetIpConnectionStateRequestProxy Class

The QKnxNetIpConnectionStateRequestProxy class provides the means to read a KNXnet/IP connection state request from the generic QKnxNetIpFrame class and to create a connection state request frame based on the information. 更多...

頭: #include <QKnxNetIpConnectionStateRequestProxy>
qmake: QT += knx

公共類型

class Builder

公共函數

QKnxNetIpConnectionStateRequestProxy (const QKnxNetIpFrame & frame )
quint8 channelId () const
QKnxNetIpHpai controlEndpoint () const
bool isValid () const

靜態公共成員

QKnxNetIpConnectionStateRequestProxy::Builder builder ()

詳細描述

Host protocols like UDP/IP that do not provide mechanisms for checking the lifetime of a connection need a way to tell when communication fails. To detect failures on the KNX or in the tunneling network, heartbeat monitoring is implemented by both KNXnet/IP clients and servers, as follows. A KNXnet/IP client sends a connection state request frame regularly to the KNXnet/IP server's control endpoint to check the state of a connection established to the server. The server responds immediately with a connection state response frame.

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 QKnxNetIpConnectionStateRequestProxy, 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 state request information sent by a KNXnet/IP client:

auto frame = QKnxNetIpFrame::fromBytes(...);
const QKnxNetIpConnectionStateRequestProxy proxy(netIpFrame);
if (!proxy.isValid())
    return;
quint8 chanId = proxy.channelId();
auto hpai = proxy.controlEndpoint();
					

另請參閱 builder (), QKnxNetIpConnectionStateResponseProxy ,和 Qt KNXnet/IP Connection Classes .

成員函數文檔編製

QKnxNetIpConnectionStateRequestProxy:: QKnxNetIpConnectionStateRequestProxy (const QKnxNetIpFrame & frame )

Constructs a wrapper object to read the connection state request information carried by the specified KNXnet/IP frame frame .

[static] QKnxNetIpConnectionStateRequestProxy::Builder QKnxNetIpConnectionStateRequestProxy:: builder ()

Returns a builder object to create a KNXnet/IP connection state request frame.

quint8 QKnxNetIpConnectionStateRequestProxy:: channelId () const

Returns the ID of the communication channel prepared by the KNXnet/IP server.

QKnxNetIpHpai QKnxNetIpConnectionStateRequestProxy:: controlEndpoint () const

Returns the control endpoint of the KNXnet/IP client sending the connection state request.

bool QKnxNetIpConnectionStateRequestProxy:: isValid () const

返迴 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 ().