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. 更多...
头: | #include <QKnxNetIpSearchRequestProxy> |
qmake: | QT += knx |
class | Builder |
class | ExtendedBuilder |
QKnxNetIpSearchRequestProxy (const QKnxNetIpFrame & frame ) | |
QKnxNetIpHpai | discoveryEndpoint () const |
QVector<QKnxNetIpSrp> | extendedSearchParameters () const |
bool | isExtended () const |
bool | isValid () const |
QKnxNetIpSearchRequestProxy::Builder | builder () |
QKnxNetIpSearchRequestProxy::ExtendedBuilder | extendedBuilder () |
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.
注意: 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(); // ...
另请参阅 builder () 和 Qt KNXnet/IP Connection Classes .
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.
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.
该函数在 Qt 5.12 引入。
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.
注意: The function does not perform validity checks on the QKnxNetIpFrame used to create the search request proxy object.
该函数在 Qt 5.12 引入。
返回
true
if the frame service type is search request extended, otherwise returns
false
.
该函数在 Qt 5.12 引入。
返回
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.
注意: 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.
另请参阅 QKnxNetIpFrameHeader::totalSize ().