QKnxNetIpTunnel Class

The QKnxNetIpTunnel class enables the opening and handling of a KNXnet/IP client connection to a KNXnet/IP server. 更多...

头: #include <QKnxNetIpTunnel>
qmake: QT += knx
继承: QKnxNetIpEndpointConnection

公共函数

QKnxNetIpTunnel (const QHostAddress & localAddress , quint16 localPort , QKnxNetIp::TunnelLayer layer , QObject * parent = nullptr)
QKnxNetIpTunnel (const QHostAddress & localAddress , quint16 localPort , QObject * parent = nullptr)
QKnxNetIpTunnel (const QHostAddress & localAddress , QObject * parent = nullptr)
QKnxNetIpTunnel (QObject * parent = nullptr)
QKnxAddress individualAddress () const
QKnxNetIp::TunnelLayer layer () const
bool sendFrame (const QKnxLinkLayerFrame & frame )
bool sendTunnelingFeatureGet (QKnx::InterfaceFeature feature )
bool sendTunnelingFeatureSet (QKnx::InterfaceFeature feature , const QKnxByteArray & value )
void setTunnelLayer (QKnxNetIp::TunnelLayer layer )

信号

void frameReceived (QKnxLinkLayerFrame frame )
void tunnelingFeatureInfoReceived (QKnx::InterfaceFeature feature , QKnxByteArray value )
void tunnelingFeatureResponseReceived (QKnx::InterfaceFeature feature , QKnx::ReturnCode code , QKnxByteArray value )

详细描述

A tunnel is a data connection that is established from a KNXnet/IP client to a KNXnet/IP server endpoint to access functionalities of devices on a KNX bus. The IP address of the client must be set. The client uses the connection to send link layer frames to the server.

The following code sample illustrates how to connect to the server, request a data connection, and use the connection:

QKnxNetIpTunnel tunnel;
QHostAddress clientLocalAddress = ...
tunnel.setLocalAddress(clientLocalAddress);
QHostAddress knxNetIpServerAddress = ...
quint16 knxNetIpServerDataEndPointPort = ...
tunnel.connectToHost(knxNetIpServerAddress, knxNetIpServerDataEndPointPort);
QKnxLinkLayerFrame frame = ...
tunnel.sendFrame(frame);
					

另请参阅 QKnxLinkLayerFrame , Qt KNX Tunneling Classes ,和 Qt KNXnet/IP Connection Classes .

成员函数文档编制

QKnxNetIpTunnel:: QKnxNetIpTunnel (const QHostAddress & localAddress , quint16 localPort , QKnxNetIp::TunnelLayer layer , QObject * parent = nullptr)

Creates a tunnel connection with the KNXnet/IP client address localAddress , port number localPort , layer layer , and parent parent .

QKnxNetIpTunnel:: QKnxNetIpTunnel (const QHostAddress & localAddress , quint16 localPort , QObject * parent = nullptr)

Creates a tunnel connection with the KNXnet/IP client address localAddress , port number localPort , and parent parent .

QKnxNetIpTunnel:: QKnxNetIpTunnel (const QHostAddress & localAddress , QObject * parent = nullptr)

Creates a tunnel connection with the KNXnet/IP client address localAddress 和父级 parent .

QKnxNetIpTunnel:: QKnxNetIpTunnel ( QObject * parent = nullptr)

Creates a tunnel connection with the parent parent .

[signal] void QKnxNetIpTunnel:: frameReceived ( QKnxLinkLayerFrame frame )

This signal is emitted when the KNXnet/IP client receives data (with the link layer frame frame as payload) from the KNXnet/IP server.

[signal] void QKnxNetIpTunnel:: tunnelingFeatureInfoReceived ( QKnx::InterfaceFeature feature , QKnxByteArray value )

This signal is emitted when the KNXnet/IP tunneling client receives data from the KNXnet/IP server consisting of a given interface feature and the corresponding feature value .

该函数在 Qt 5.12 引入。

[signal] void QKnxNetIpTunnel:: tunnelingFeatureResponseReceived ( QKnx::InterfaceFeature feature , QKnx::ReturnCode code , QKnxByteArray value )

This signal is emitted when the KNXnet/IP tunneling client receives data from the KNXnet/IP server consisting of a given interface feature , the corresponding feature value and a return code code .

The signal is emit after a successful tunneling feature get or tunneling feature set.

该函数在 Qt 5.12 引入。

QKnxAddress QKnxNetIpTunnel:: individualAddress () const

Returns the individual address of the KNXnet/IP client assigned by the KNXnet/IP server.

另请参阅 setIndividualAddress ().

QKnxNetIp::TunnelLayer QKnxNetIpTunnel:: layer () const

Returns the layer used for the tunnel connection.

bool QKnxNetIpTunnel:: sendFrame (const QKnxLinkLayerFrame & frame )

Inserts the link layer frame frame into a tunneling request that is sent to a KNXnet/IP server.

If the tunnel runs in bus monitor mode, no frames can be sent to the bus.

If no connection is currently established, returns false and does not send the frame.

另请参阅 QKnxNetIpEndpointConnection::State .

bool QKnxNetIpTunnel:: sendTunnelingFeatureGet ( QKnx::InterfaceFeature feature )

Creates a tunneling feature get frame and sets the requested feature identifier to feature .

If the tunnel runs in bus monitor mode, no frames can be sent to the bus.

If no connection is currently established, returns false and does not send the frame.

该函数在 Qt 5.12 引入。

bool QKnxNetIpTunnel:: sendTunnelingFeatureSet ( QKnx::InterfaceFeature feature , const QKnxByteArray & value )

Creates a tunneling feature set frame and sets the requested feature identifier to feature and the feature value to set to value .

If the tunnel runs in bus monitor mode, no frames can be sent to the bus.

If no connection is currently established, returns false and does not send the frame.

该函数在 Qt 5.12 引入。

void QKnxNetIpTunnel:: setTunnelLayer ( QKnxNetIp::TunnelLayer layer )

Sets the layer used for the tunnel connection to layer .

The layer is changed only if no connection is currently established. The new layer is set the next time a connection is created.

另请参阅 QKnxNetIpEndpointConnection::State .