QKnxNetIpCriProxy Class

The QKnxNetIpCriProxy class provides the means to read the connection request information (CRI) from the generic QKnxNetIpCri class and to create a KNXnet/IP CRI structure based on the information. More...

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

Public Types

class Builder

Public Functions

QKnxNetIpCriProxy(const QKnxNetIpCri &cri)
QKnxByteArray additionalData() const
QKnxNetIp::ConnectionType connectionType() const
QKnxAddress individualAddress() const
bool isExtended() const
bool isValid() const
QKnxNetIp::TunnelLayer tunnelLayer() const

Static Public Members

QKnxNetIpCriProxy::Builder builder()

Detailed Description

A KNXnet/IP CRI structure contains additional information needed for different types of communication channels to fulfill a connection request.

The structure may contain host protocol dependent and independent data, but the current KNX specification foresees additional data only in the case of tunneling.

Note: When using QKnxNetIpCriProxy, care must be taken to ensure that the referenced KNXnet/IP CRI structure outlives the proxy on all code paths, lest the proxy ends up referencing deleted data.

Reading the connection type and tunneling layer can be achieved like this:

 auto cri = QKnxNetIpCri::fromBytes(...);

 QKnxNetIpCriProxy proxy(cri);
 if (!proxy.isValid())
     return;

 if (proxy.connectionType() != QKnxNetIp::ConnectionType::Tunnel)
     return;
 auto layer = proxy.tunnelLayer(); // read the requested tunneling layer

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

Member Function Documentation

QKnxNetIpCriProxy::QKnxNetIpCriProxy(const QKnxNetIpCri &cri)

Constructs a proxy object with the specified a KNXnet/IP structure cri to read the connection request information (CRI).

QKnxByteArray QKnxNetIpCriProxy::additionalData() const

Returns the additional data of this KNXnet/IP structure.

The current KNX specification foresees additional data only in the case of tunneling.

See also tunnelLayer() and individualAddress().

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

Returns a builder object to create a KNXnet/IP connection request information structure.

QKnxNetIp::ConnectionType QKnxNetIpCriProxy::connectionType() const

Returns the connection type of this KNXnet/IP structure if the object that was passed during construction was valid; otherwise returns QKnx::NetIp::Unknown.

QKnxAddress QKnxNetIpCriProxy::individualAddress() const

Returns the individual address of the extended connection request information structure if the object that was passed during construction was valid and an extended structure; otherwise returns QKnx::NetIp::Unknown.

This function was introduced in Qt 5.12.

See also isExtended(), tunnelLayer(), and additionalData().

bool QKnxNetIpCriProxy::isExtended() const

Returns true if this is an extended connection request information (CRI) frame; otherwise returns false.

Note: No validation checks are performed on the given KNXnet/IP frame that was passed during construction.

This function was introduced in Qt 5.12.

See also isValid().

bool QKnxNetIpCriProxy::isValid() const

Returns true if the KNXnet/IP structure to create the object is a valid KNXnet/IP CRI structure; otherwise returns false.

QKnxNetIp::TunnelLayer QKnxNetIpCriProxy::tunnelLayer() const

Returns the tunneling layer of this KNXnet/IP structure if the object that was passed during construction was valid and the connection type is QKnx::NetIp::Tunnel, otherwise returns QKnx::NetIp::Unknown.

See also additionalData() and individualAddress().