QKnxNetIpDisconnectRequestProxy Class

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

头: #include <QKnxNetIpDisconnectRequestProxy>
qmake: QT += knx

公共类型

class Builder

公共函数

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

静态公共成员

QKnxNetIpDisconnectRequestProxy::Builder builder ()

详细描述

A KNXnet/IP client terminates a data channel connection to a KNXnet/IP server by sending a disconnection request to the server's control endpoint. The client should try to disconnect gracefully, even under error conditions.

The server may disconnect from the client by sending a disconnection request due to internal problems or reception of invalid data packets. However, it is recommended to let the client terminate the connection.

The KNXnet/IP device receiving the disconnection request acknowledges the operation with a KNXnet/IP disconnection response frame, QKnxNetIpDisconnectResponseProxy , which signals the final termination of a 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 QKnxNetIpDisconnectRequestProxy, 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 disconnection request information sent by a KNXnet/IP client:

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

另请参阅 builder ().

成员函数文档编制

QKnxNetIpDisconnectRequestProxy:: QKnxNetIpDisconnectRequestProxy (const QKnxNetIpFrame & frame )

Constructs a proxy object to read the disconnection request information carried by the specified KNXnet/IP frame frame .

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

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

quint8 QKnxNetIpDisconnectRequestProxy:: channelId () const

Returns the ID of the communication channel between the KNXnet/IP client and server.

QKnxNetIpHpai QKnxNetIpDisconnectRequestProxy:: controlEndpoint () const

Returns the control endpoint of the KNXnet/IP device sending the disconnection request.

bool QKnxNetIpDisconnectRequestProxy:: 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 ().