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. 更多...

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

公共類型

class Builder

公共函數

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

靜態公共成員

QKnxNetIpHpaiProxy::Builder builder ()

詳細描述

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 地址 ,和 port 編號。

注意: 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();
					

另請參閱 builder () 和 Qt KNXnet/IP Connection Classes .

成員函數文檔編製

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

返迴 true if the KNXnet/IP structure to create the object is a valid KNXnet/IP HPAI structure, returns false 否則。

quint16 QKnxNetIpHpaiProxy:: port () const

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