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. More...

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

Public Types

class Builder
class ExtendedBuilder

Public Functions

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

Static Public Members

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

Detailed Description

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.

Note: 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();
// ...

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

Member Function Documentation

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.

This function was introduced in Qt 5.12.

bool QKnxNetIpSearchResponseProxy::isExtended() const

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

This function was introduced in Qt 5.12.

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

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.

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

This function was introduced in Qt 5.12.

QKnxNetIpDib QKnxNetIpSearchResponseProxy::supportedFamilies() const

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

Note: 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.

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

This function was introduced in Qt 5.12.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.