QKnxNetIpHpaiProxy Class

The QKnxNetIpHpaiProxy class provides the means to read the KNXnet/IP host address protocol information (HPAI) from the generic QKnxNetIpHpai class and to create such a structure. More...

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

Public Types

class Builder

Public Functions

QKnxNetIpHpaiProxy(const QKnxNetIpHpai &hpai)
QHostAddress hostAddress() const
QKnxNetIp::HostProtocol hostProtocol() const
bool isValid() const
quint16 port() const

Static Public Members

QKnxNetIpHpaiProxy::Builder builder()

Detailed Description

A KNXnet/IP HPAI structure contains the information that is necessary to uniquely identify an KNXnet/IP transport connection endpoint.

The information needed to identify an KNXnet/IP transport connection endpoint includes the protocol, IP address, and port number.

Note: When using QKnxNetIpHpaiProxy care must be taken to ensure that the referenced KNXnet/IP HPAI structure outlives the QKnxNetIpHpaiProxy on all code paths, lest the proxy ends up referencing deleted data.

Reading the host address and port number can be achieved like this:

auto hpai = QKnxNetIpHpai::fromBytes(...);

QKnxNetIpHpaiProxy proxy(hpai);
if (!proxy.isValid())
    return;

if (proxy.hostProtocol() == QKnxNetIp::HostProtocol::TCP_IPv4)
    return; // TCP support not implemented yet

// read the host protocol address information
auto address = proxy.hostAddress();
auto port = proxy.port();

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

Member Function Documentation

QKnxNetIpHpaiProxy::QKnxNetIpHpaiProxy(const QKnxNetIpHpai &hpai)

Constructs a proxy object with the given a KNXnet/IP structure hpai to read the host protocol address information (HPAI).

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

Returns a builder object to create a KNXnet/IP host protocol address information structure.

QHostAddress QKnxNetIpHpaiProxy::hostAddress() const

Returns the host address from KNXnet/IP structure if the object passed during construction was valid, otherwise returns a default-constructed QHostAddress.

QKnxNetIp::HostProtocol QKnxNetIpHpaiProxy::hostProtocol() const

Return the host protocol from KNXnet/IP structure if the object passed during construction was valid, otherwise returns QKnxNetIp::Unknown.

bool QKnxNetIpHpaiProxy::isValid() const

Returns true if the KNXnet/IP structure to create the object is a valid KNXnet/IP HPAI structure, returns false otherwise.

quint16 QKnxNetIpHpaiProxy::port() const

Returns the port number carried inside the KNXnet/IP host protocol address information structure.

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