QKnxNetIpRoutingBusyProxy Class

The QKnxNetIpRoutingBusyProxy class provides the means to read a router busy message from the generic QKnxNetIpFrame class and to create a KNXnet/IP frame based on the information. 更多...

头: #include <QKnxNetIpRoutingBusyProxy>
qmake: QT += knx

公共类型

class Builder

公共函数

QKnxNetIpRoutingBusyProxy (const QKnxNetIpFrame & frame )
QKnxNetIp::DeviceState deviceState () const
bool isValid () const
quint16 routingBusyControl () const
quint16 routingBusyWaitTime () const

静态公共成员

QKnxNetIpRoutingBusyProxy::Builder builder ()

详细描述

Depending on the configuration, a KNXnet/IP router or device can receive more datagrams than it can forward to the KNX subnetwork. This can lead to an overflow of the datagram queue and subsequent loss of one or more KNXnet/IP telegrams, because they could not be transferred from the network buffer to the queue to the underlying KNX subnetwork. Flow control is implemented by means of sending router busy messages to avoid the loss of datagrams due to overflowing queues in routers and devices.

A router busy message is sent by a KNXnet/IP router or device to notify all other devices that its incoming queue is filling up and it may loose datagrams if they do not stop sending. The message contains the state of the router or device ( QKnx::NetIp::DeviceState ), the timeout used to empty the incoming queue of the router or device, and the routing busy control field. The control field is set to 0000h , which requires all routers and devices to act upon receiving the router busy message.

注意: When using QKnxNetIpRoutingBusyProxy, 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 router busy message information sent by a KNXnet/IP router or device:

auto netIpFrame = QKnxNetIpFrame::fromBytes(...);
const QKnxNetIpRoutingBusyProxy proxy(netIpFrame);
if (!proxy.isValid())
    return;
auto busyTime = proxy.routingBusyWaitTime();
					

The sending device will wait for busyTime before sending the next frame.

另请参阅 builder (), QKnxNetIpRoutingIndicationProxy , QKnxNetIpRoutingLostMessageProxy ,和 Qt KNXnet/IP Connection Classes .

成员函数文档编制

QKnxNetIpRoutingBusyProxy:: QKnxNetIpRoutingBusyProxy (const QKnxNetIpFrame & frame )

Constructs a proxy object to read the router busy message information carried by the specified KNXnet/IP frame frame .

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

Returns a builder object to create a KNXnet/IP router busy frame.

QKnxNetIp::DeviceState QKnxNetIpRoutingBusyProxy:: deviceState () const

Returns the state of a KNXnet/IP router or device.

bool QKnxNetIpRoutingBusyProxy:: isValid () const

返回 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.

另请参阅 QKnxNetIpFrameHeader::totalSize ().

quint16 QKnxNetIpRoutingBusyProxy:: routingBusyControl () const

Returns the router busy control field.

quint16 QKnxNetIpRoutingBusyProxy:: routingBusyWaitTime () const

Returns the timeout after which a KNXnet/IP router or device empties its incoming datagram queue. The timeout can be from 20 to 100 milliseconds.