QKnxNetIpTunnelingRequestProxy Class

The QKnxNetIpTunnelingRequestProxy class provides the means to read a tunneling request from the generic QKnxNetIpFrame class and to create a KNXnet/IP frame based on the information. More...

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

Public Types

class Builder

Public Functions

QKnxNetIpTunnelingRequestProxy(const QKnxNetIpFrame &frame)
QKnxLinkLayerFrame cemi() const
quint8 channelId() const
bool isValid() const
quint8 sequenceNumber() const

Static Public Members

QKnxNetIpTunnelingRequestProxy::Builder builder()

Detailed Description

Tunneling means that Engineering Tool Software (ETS) sends a single KNX frame in an KNXnet/IP frame and waits until the response arrives or a time-out is reached.

A tunneling request is sent by a KNXnet/IP client to establish a data connection to the endpoint of a KNXnet/IP server for sending a KNX frame. A tunneling request frame contains the ID of the communication channel between a KNXnet/IP client and server, the sequence number of the frame, and the KNX frame in the common external message interface (cEMI) format.

The KNXnet/IP server discards frames with sequence numbers that are not the expected sequence numbers or one less the expected sequence numbers and does not send a tunneling acknowledgment upon receiving them.

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.

Before sending a tunneling request, the KNXnet/IP client should use QKnxNetIpServerDescriptionAgent and QKnxNetIpServerInfo to check that the server supports the requested connection type and options.

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

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

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

 auto chanId = proxy.channelId();
 auto seqNum = proxy.sequenceNumber();
 auto knxLinkFrame = proxy.cemi();

See also builder(), QKnxNetIpTunnelingAcknowledgeProxy, Qt KNX Tunneling Classes, and Qt KNXnet/IP Connection Classes.

Member Function Documentation

QKnxNetIpTunnelingRequestProxy::QKnxNetIpTunnelingRequestProxy(const QKnxNetIpFrame &frame)

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

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

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

QKnxLinkLayerFrame QKnxNetIpTunnelingRequestProxy::cemi() const

Returns the KNX frame in the cEMI format.

quint8 QKnxNetIpTunnelingRequestProxy::channelId() const

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

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

quint8 QKnxNetIpTunnelingRequestProxy::sequenceNumber() const

Returns the sequence number of a tunneling request frame.