Builder Class

class QKnxNetIpConnectRequestProxy::Builder

The QKnxNetIpConnectRequestProxy::Builder class provides the means to create a KNXnet/IP connection request frame. More...

Public Functions

QKnxNetIpFrame create() const
Builder &setControlEndpoint(const QKnxNetIpHpai &hpai)
Builder &setDataEndpoint(const QKnxNetIpHpai &hpai)
Builder &setRequestInformation(const QKnxNetIpCri &cri)

Detailed Description

A KNXnet/IP connection request contains the information that is needed to establish a communication channel to a KNXnet/IP server. That is, the data and control endpoint host address protocol information (HPAI) that the client wants to use for this communication channel.

In most programs, the QKnxNetIpConnectRequestProxy::Builder class will not be used directly. Instead, the QKnxNetIpTunnel or QKnxNetIpDeviceManagement class are used to establish a functional connection to a KNXnet/IP server.

The common way to create a connection request is:

 // setup control (HPAI) and data endpoint (HPAI)
 auto crtlHpai = QKnxNetIpHpaiProxy::builder()
     ...
     .create();
 auto dataHpai = QKnxNetIpHpaiProxy::builder()
     ...
     .create()

 // setup connection request information (CRI)
 auto cri = QKnxNetIpCriProxy::builder()
     ....
     .create();

 auto connectRequest = QKnxNetIpConnectRequestProxy::builder
     .setControlEndpoint(crtlHpai)
     .setDataEndpoint(dataHpai)
     .setRequestInformation(cri)
     .create();

 controlSocket->writeDatagram(connectRequest.bytes().toByteArray(),
     remoteControlEndpointAddress, remoteControlEndpointPort);

After sending the connection request, the KNXnet/IP client waits for the host protocol dependent time for the response frame from the KNXnet/IP server, QKnxNetIpConnectResponseProxy. After the timeout, received response frames are ignored by the client until it sends another connection request.

Member Function Documentation

QKnxNetIpFrame Builder::create() const

Creates and returns a KNXnet/IP connection request frame.

Note: The returned frame may be invalid depending on the values used during setup.

See also isValid().

Builder &Builder::setControlEndpoint(const QKnxNetIpHpai &hpai)

Sets the control endpoint of the KNXnet/IP server to hpai and returns a reference to the builder.

Builder &Builder::setDataEndpoint(const QKnxNetIpHpai &hpai)

Sets the data endpoint of the KNXnet/IP server to hpai and returns a reference to the builder.

Builder &Builder::setRequestInformation(const QKnxNetIpCri &cri)

Sets the connection request information (CRI) to cri and returns a reference to the builder.