QKnxNetIpDisconnectResponseProxy Class

The QKnxNetIpDisconnectResponseProxy class provides the means to read a KNXnet/IP disconnection response from the generic QKnxNetIpFrame class and to create a disconnection response frame based on the information. More...

Header: #include <QKnxNetIpDisconnectResponseProxy>
qmake: QT += knx

Public Types

class Builder

Public Functions

QKnxNetIpDisconnectResponseProxy(const QKnxNetIpFrame &frame)
quint8 channelId() const
bool isValid() const
QKnxNetIp::Error status() const

Static Public Members

QKnxNetIpDisconnectResponseProxy::Builder builder()

Detailed Description

A KNXnet/IP device terminates a data channel connection by sending a disconnection request to its communication partner's control endpoint. The KNXnet/IP device receiving the disconnection request acknowledges the operation with a KNXnet/IP disconnection response frame, 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.

Note: When using QKnxNetIpDisconnectResponseProxy, 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 response information sent by a KNXnet/IP client:

 auto netIpFrame = QKnxNetIpFrame::fromBytes(...);

 const QKnxNetIpDisconnectResponseProxy proxy(netIpFrame);
 if (!proxy.isValid())
     return;

 quint8 chanId = proxy.channelId();
 QKnx::NetIp::Error state = proxy.status();

See also builder(), QKnxNetIpDisconnectRequestProxy, and Qt KNXnet/IP Connection Classes.

Member Function Documentation

QKnxNetIpDisconnectResponseProxy::QKnxNetIpDisconnectResponseProxy(const QKnxNetIpFrame &frame)

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

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

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

quint8 QKnxNetIpDisconnectResponseProxy::channelId() const

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

bool QKnxNetIpDisconnectResponseProxy::isValid() const

Returns 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.

See also QKnxNetIpFrameHeader::totalSize().

QKnxNetIp::Error QKnxNetIpDisconnectResponseProxy::status() const

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