Builder Class

class QKnxNetIpConnectRequestProxy ::Builder

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

公共函数

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

详细描述

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.

成员函数文档编制

QKnxNetIpFrame Builder:: create () const

Creates and returns a KNXnet/IP connection request frame.

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

另请参阅 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.