QKnxNetIpSearchRequestProxy Class

The QKnxNetIpSearchRequestProxy class provides the means to read a search request from the generic QKnxNetIpFrame class and to create a KNXnet/IP frame based on the information. More...

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

Public Types

class Builder
class ExtendedBuilder

Public Functions

QKnxNetIpSearchRequestProxy(const QKnxNetIpFrame &frame)
QKnxNetIpHpai discoveryEndpoint() const
QVector<QKnxNetIpSrp> extendedSearchParameters() const
bool isExtended() const
bool isValid() const

Static Public Members

QKnxNetIpSearchRequestProxy::Builder builder()
QKnxNetIpSearchRequestProxy::ExtendedBuilder extendedBuilder()

Detailed Description

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

To discover servers, a client sends a search request data packet via multicast using its discovery endpoint. The search request contains the host address protocol information (HPAI) of the discovery endpoint. The HPAI may also contain a unicast IP address to receive the answers from the different servers directly in a point-to-point manner. Typically, it should contain the KNXnet/IP system setup multicast address to ensure reception from KNXnet/IP servers that are on a different subnetwork.

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 QKnxNetIpSearchRequestProxy, 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 request information sent by a KNXnet/IP client:

auto netIpFrame = QKnxNetIpFrame::fromBytes(...);

QKnxNetIpSearchRequestProxy proxy(netIpFrame);
if (!proxy.isValid())
    return;

QKnxNetIpHpai hpai = proxy.discoveryEndpoint();
// ...

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

Member Function Documentation

QKnxNetIpSearchRequestProxy::QKnxNetIpSearchRequestProxy(const QKnxNetIpFrame &frame)

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

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

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

QKnxNetIpHpai QKnxNetIpSearchRequestProxy::discoveryEndpoint() const

Returns the discovery endpoint of the KNXnet/IP client.

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

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

This function was introduced in Qt 5.12.

QVector<QKnxNetIpSrp> QKnxNetIpSearchRequestProxy::extendedSearchParameters() const

Returns a vector of extended search request parameter (SRP) structures. The vector can be empty if no such structures are present or in case of an error while extracting the SRPs.

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

This function was introduced in Qt 5.12.

bool QKnxNetIpSearchRequestProxy::isExtended() const

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

This function was introduced in Qt 5.12.

bool QKnxNetIpSearchRequestProxy::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 a search request with at least a valid header and a size in bytes corresponding to the total size of the KNXnet/IP frame header or a extended search request containing a valid header.

Note: The extended search parameter's validity check is not done by this function. It is up to the programmer to do the appropriate validity checks on that field.

See also QKnxNetIpFrameHeader::totalSize().

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