QKnxNetIpConnectionStateResponseProxy Class

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

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

Public Types

class Builder

Public Functions

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

Static Public Members

QKnxNetIpConnectionStateResponseProxy::Builder builder()

Detailed Description

The QKnxNetIpConnectionStateResponseProxy class provides the means to read a KNXnet/IP connection state response from the generic QKnxNetIpFrame class and to create a connection state response frame based on the information.

A KNXnet/IP client reqularly sends a connection state request frame, QKnxNetIpConnectionStateRequestProxy, 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.

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

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

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

auto chanId = proxy.channelId();
auto status = proxy.status();

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

Member Function Documentation

QKnxNetIpConnectionStateResponseProxy::QKnxNetIpConnectionStateResponseProxy(const QKnxNetIpFrame &frame)

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

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

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

quint8 QKnxNetIpConnectionStateResponseProxy::channelId() const

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

bool QKnxNetIpConnectionStateResponseProxy::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 QKnxNetIpConnectionStateResponseProxy::status() const

Returns the state of the connection channel established to a KNXnet/IP server.

© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.