QKnxNetIpSearchResponseProxy Class

The QKnxNetIpSearchResponseProxy class provides the means to read a search response from the generic QKnxNetIpFrame class and to create a KNXnet/IP frame based on the information. 更多...

头: #include <QKnxNetIpSearchResponseProxy>
qmake: QT += knx

公共类型

class Builder
class ExtendedBuilder

公共函数

QKnxNetIpSearchResponseProxy (const QKnxNetIpFrame & frame )
QKnxNetIpHpai controlEndpoint () const
QKnxNetIpDib deviceHardware () const
bool isExtended () const
bool isValid () const
QVector<QKnxNetIpDib> optionalDibs () const
QKnxNetIpDib supportedFamilies () const
QVector<QKnxNetIpDib> variableDibs () const

静态公共成员

QKnxNetIpSearchResponseProxy::Builder builder ()
QKnxNetIpSearchResponseProxy::ExtendedBuilder extendedBuilder ()

详细描述

In networks where IP addresses are assigned at runtime, via BootP or DHCP, for example, it is important to be able to discover KNXnet/IP servers within a subnetwork and to establish connections to them without manual input.

A KNXnet/IP client sends a search request frame, via multicast using its discovery endpoint. All KNXnet/IP servers that receive the request immediately send a search response using the host address protocol information (HPAI) of the client's discovery endpoint. The search response frame contains the HPAI of the server's control endpoint for all further communication.

In addition, a search response can contain information about the server hardware and the supported service families.

In most programs, this class will not be used directly. Instead, the QKnxNetIpServerDiscoveryAgent and QKnxNetIpServerInfo are provided to discover KNXnet/IP servers on the network.

注意: When using QKnxNetIpSearchResponseProxy, 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 search response information sent by a KNXnet/IP server:

auto netIpFrame = QKnxNetIpFrame::fromBytes(...);
const QKnxNetIpSearchResponseProxy proxy(netIpFrame);
if (!proxy.isValid())
    return
auto netIpHpai = proxy.controlEndpoint();
auto hardwareNetIpDib = proxy.deviceHardware();
auto supportedFamillies = proxy.supportedFamilies();
// ...
					

另请参阅 builder (), QKnxNetIpSearchRequestProxy ,和 Qt KNXnet/IP Connection Classes .

成员函数文档编制

QKnxNetIpSearchResponseProxy:: QKnxNetIpSearchResponseProxy (const QKnxNetIpFrame & frame )

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

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

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

QKnxNetIpHpai QKnxNetIpSearchResponseProxy:: controlEndpoint () const

Returns the control endpoint of the KNXnet/IP server.

QKnxNetIpDib QKnxNetIpSearchResponseProxy:: deviceHardware () const

Returns information about the KNXnet/IP server hardware.

[static] QKnxNetIpSearchResponseProxy::ExtendedBuilder QKnxNetIpSearchResponseProxy:: extendedBuilder ()

Returns a builder object to create a KNXnet/IP extended search response frame.

该函数在 Qt 5.12 引入。

bool QKnxNetIpSearchResponseProxy:: isExtended () const

返回 true if the frame service type is an extended search response, otherwise returns false .

该函数在 Qt 5.12 引入。

bool QKnxNetIpSearchResponseProxy:: isValid () const

返回 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.

另请参阅 QKnxNetIpFrameHeader::totalSize ().

QVector < QKnxNetIpDib > QKnxNetIpSearchResponseProxy:: optionalDibs () const

Returns the vector of optional KNXnet/IP server device information block (DIB) structures of the extended search response frame. The function therefor will remove the mandatory device hardware and service family DIB.

The vector can be empty if no optional structures are present or in case of an error while extracting the optional DIBs.

注意: The function does not perform validity checks on the QKnxNetIpFrame used to create the description response proxy object.

该函数在 Qt 5.12 引入。

QKnxNetIpDib QKnxNetIpSearchResponseProxy:: supportedFamilies () const

Returns information about the service families that the KNXnet/IP server supports.

注意: The returned service families must be allowed in a search response. A service family higher than or equal to the security family is not allowed in the case of a search response. In an extended search response there is no such restriction.

QVector < QKnxNetIpDib > QKnxNetIpSearchResponseProxy:: variableDibs () const

Returns the vector of KNXnet/IP server device information blocks (DIBs) structure of the extended search response frame. The vector can be empty if no such structures are present or in case of an error while extracting the optional DIBs.

注意: The function does not perform validity checks on the QKnxNetIpFrame used to create the description response proxy object.

该函数在 Qt 5.12 引入。