QKnxNetIpEndpointConnection Class
The QKnxNetIpEndpointConnection class serves as base class for derived classes to enable the opening and handling of a client connection to a KNXnet/IP server. More...
Header: | #include <QKnxNetIpEndpointConnection> |
qmake: | QT += knx |
Inherits: | QObject |
Inherited By: |
Public Types
enum class | EndpointType { Data, Control } |
enum class | Error { None, State, Network, NotIPv4, Acknowledge, …, Unknown } |
enum | SequenceType { Send, Receive } |
enum | State { Disconnected, Starting, Bound, Connecting, Connected, Disconnecting } |
Public Functions
virtual | ~QKnxNetIpEndpointConnection() = 0 |
void | connectToHost(const QKnxNetIpHpai &controlEndpoint) |
void | connectToHost(const QHostAddress &address, quint16 port) |
void | connectToHost(const QHostAddress &address, quint16 port, QKnxNetIp::HostProtocol protocol) |
void | connectToHostEncrypted(const QKnxNetIpHpai &controlEndpoint) |
void | connectToHostEncrypted(const QHostAddress &address, quint16 port) |
void | disconnectFromHost() |
QKnxNetIpEndpointConnection::Error | error() const |
QString | errorString() const |
quint32 | heartbeatTimeout() const |
QHostAddress | localAddress() const |
quint16 | localPort() const |
bool | natAware() const |
quint8 | netIpHeaderVersion(QKnxNetIpEndpointConnection::EndpointType endpoint) const |
QKnxNetIpSecureConfiguration | secureConfiguration() const |
int | sequenceCount(QKnxNetIpEndpointConnection::SequenceType type) const |
QKnxByteArray | serialNumber() const |
void | setHeartbeatTimeout(quint32 msec) |
void | setLocalAddress(const QHostAddress &address) |
void | setLocalPort(quint16 port) |
void | setNatAware(bool isAware) |
void | setSecureConfiguration(const QKnxNetIpSecureConfiguration &config) |
void | setSerialNumber(const QKnxByteArray &serialNumber) |
void | setSupportedProtocolVersions(const QKnxByteArray &versions) |
QKnxNetIpEndpointConnection::State | state() const |
QKnxByteArray | supportedProtocolVersions() const |
Signals
void | connected() |
void | disconnected() |
void | errorOccurred(QKnxNetIpEndpointConnection::Error error, QString errorString) |
void | stateChanged(QKnxNetIpEndpointConnection::State state) |
Detailed Description
The QKnxNetIpEndpointConnection establishes a communication channel between a client and a KNXnet/IP server endpoint. This is used by the client side to monitor the state of the communication channel. The IP address of the client must be set together with a local port. It is then possible to connect to a chosen KNXnet/IP server on a given port. To detect the failure of the channel, the class provides a heartbeat monitor timeout that can be modified according to the client needs. If the KNXnet/IP communication has to traverse across a network using network address translation (NAT), the client can also make the class aware of this.
See also Qt KNXnet/IP Connection Classes.
Member Type Documentation
enum class QKnxNetIpEndpointConnection::EndpointType
This enum holds the endpoint type.
Constant | Value |
---|---|
QKnxNetIpEndpointConnection::EndpointType::Data | 0 |
QKnxNetIpEndpointConnection::EndpointType::Control | 1 |
enum class QKnxNetIpEndpointConnection::Error
This enum holds the errors that can occur establishing a KNXnet/IP connection.
Constant | Value | Description |
---|---|---|
QKnxNetIpEndpointConnection::Error::None | 0 | No errors so far. |
QKnxNetIpEndpointConnection::Error::State | 1 | |
QKnxNetIpEndpointConnection::Error::Network | 2 | Detected errors in the internal UDP socket connection. |
QKnxNetIpEndpointConnection::Error::NotIPv4 | 3 | Host or remote IPs not version 4. |
QKnxNetIpEndpointConnection::Error::Acknowledge | 4 | No response to connect/disconnect request. |
QKnxNetIpEndpointConnection::Error::Heartbeat | 5 | State request timeout. |
QKnxNetIpEndpointConnection::Error::Cemi | 6 | No cEMI frame acknowledge in time. |
QKnxNetIpEndpointConnection::Error::SecureConfig | 7 | An invalid secure configuration was used to establish the connection. |
QKnxNetIpEndpointConnection::Error::SerialNumber | 8 | An invalid serial number was set for the device. |
QKnxNetIpEndpointConnection::Error::AuthFailed | 9 | The secure client was not successfully authenticated. |
QKnxNetIpEndpointConnection::Error::Timeout | 10 | A timeout occurred during secure session handshake. |
QKnxNetIpEndpointConnection::Error::Close | 11 | The server requested to close the secure session. |
QKnxNetIpEndpointConnection::Error::Unknown | 0x80 | An unknown error occurred. |
enum QKnxNetIpEndpointConnection::SequenceType
This enum holds the sequence type.
Constant | Value |
---|---|
QKnxNetIpEndpointConnection::Send | 0 |
QKnxNetIpEndpointConnection::Receive | 1 |
enum QKnxNetIpEndpointConnection::State
This enum holds the state of the KNXnet/IP connection.
Constant | Value | Description |
---|---|---|
QKnxNetIpEndpointConnection::Disconnected | 0 | Error found establishing the connection, or disconnect response received. |
QKnxNetIpEndpointConnection::Starting | 1 | Preparing internal parameters for establishing the connection. |
QKnxNetIpEndpointConnection::Bound | 2 | Internal UDP socket is ready for receiving packets, but the connection is not yet established. |
QKnxNetIpEndpointConnection::Connecting | 3 | Connection request sent but no answer from the server. |
QKnxNetIpEndpointConnection::Connected | 4 | Connection response received and connection is established. |
QKnxNetIpEndpointConnection::Disconnecting | 5 | Disconnect request sent. |
Member Function Documentation
[signal]
void QKnxNetIpEndpointConnection::connected()
This signal is emitted after the client connects to a host and the KNXnet/IP connection is established.
[signal]
void QKnxNetIpEndpointConnection::disconnected()
This signal is emitted when the KNXnet/IP connection is lost or client closes the connection.
[signal]
void QKnxNetIpEndpointConnection::errorOccurred(QKnxNetIpEndpointConnection::Error error, QString errorString)
This signal is emitted when there is an error in the KNXnet/IP connection. The errorString describes the error that occurred.
[signal]
void QKnxNetIpEndpointConnection::stateChanged(QKnxNetIpEndpointConnection::State state)
This signal is emitted when the KNXnet/IP connection state state changed.
[pure virtual]
QKnxNetIpEndpointConnection::~QKnxNetIpEndpointConnection()
Destroys a connection and disconnects from the server.
void QKnxNetIpEndpointConnection::connectToHost(const QKnxNetIpHpai &controlEndpoint)
Establishes a connection to the KNXnet/IP control endpoint controlEndpoint.
void QKnxNetIpEndpointConnection::connectToHost(const QHostAddress &address, quint16 port)
Establishes a connection to the host with address and port via UDP.
void QKnxNetIpEndpointConnection::connectToHost(const QHostAddress &address, quint16 port, QKnxNetIp::HostProtocol protocol)
Establishes a connection to the host with address, port and protocol.
This function was introduced in Qt 5.12.
void QKnxNetIpEndpointConnection::connectToHostEncrypted(const QKnxNetIpHpai &controlEndpoint)
Establishes a connection to the KNXnet/IP control endpoint controlEndpoint.
This function was introduced in Qt 5.13.
See also setSerialNumber() and setSecureConfiguration().
void QKnxNetIpEndpointConnection::connectToHostEncrypted(const QHostAddress &address, quint16 port)
Establishes a secure session to the host with address and port.
This function was introduced in Qt 5.13.
See also setSerialNumber() and setSecureConfiguration().
void QKnxNetIpEndpointConnection::disconnectFromHost()
Closes an established connection.
QKnxNetIpEndpointConnection::Error QKnxNetIpEndpointConnection::error() const
Returns the last error code detected in the connection.
QString QKnxNetIpEndpointConnection::errorString() const
Returns an error string describing the last error detected in the connection.
quint32 QKnxNetIpEndpointConnection::heartbeatTimeout() const
Returns the value of the heartbeat timeout.
See also setHeartbeatTimeout().
QHostAddress QKnxNetIpEndpointConnection::localAddress() const
Returns the local address associated with the connection.
See also setLocalAddress().
quint16 QKnxNetIpEndpointConnection::localPort() const
Returns the local port associated with the connection.
See also setLocalPort().
bool QKnxNetIpEndpointConnection::natAware() const
Returns true
if the connection uses NAT; false
otherwise.
See also setNatAware().
quint8 QKnxNetIpEndpointConnection::netIpHeaderVersion(QKnxNetIpEndpointConnection::EndpointType endpoint) const
Returns the KNXnet/IP header version of the data or control connection depending on endpoint.
QKnxNetIpSecureConfiguration QKnxNetIpEndpointConnection::secureConfiguration() const
Returns the secure configuration used to establish the secure session.
This function was introduced in Qt 5.13.
See also setSecureConfiguration().
int QKnxNetIpEndpointConnection::sequenceCount(QKnxNetIpEndpointConnection::SequenceType type) const
Returns the received or sent sequence count based on type.
QKnxByteArray QKnxNetIpEndpointConnection::serialNumber() const
Returns the serial number of the device using this connection. The default value is set to 0x000000000000
.
This function was introduced in Qt 5.13.
See also setSerialNumber().
void QKnxNetIpEndpointConnection::setHeartbeatTimeout(quint32 msec)
Sets the value of the heartbeat timeout. Every msec a state request is sent over the connection to keep it alive.
See also heartbeatTimeout().
void QKnxNetIpEndpointConnection::setLocalAddress(const QHostAddress &address)
Sets the local address address associated with the connection.
See also localAddress().
void QKnxNetIpEndpointConnection::setLocalPort(quint16 port)
Sets the local port port associated with the connection.
See also localPort().
void QKnxNetIpEndpointConnection::setNatAware(bool isAware)
Sets the connection to use NAT based on the isAware parameter.
See also natAware().
void QKnxNetIpEndpointConnection::setSecureConfiguration(const QKnxNetIpSecureConfiguration &config)
Sets a secure configuration to be used to establish secure session to config. The configuration cannot be changed while the secure connection is established.
This function was introduced in Qt 5.13.
See also secureConfiguration().
void QKnxNetIpEndpointConnection::setSerialNumber(const QKnxByteArray &serialNumber)
Sets the serial number to serialNumber of the device using this connection.
Note: The serial number must contain exactly 6 bytes and cannot be changed while the secure session is established.
This function was introduced in Qt 5.13.
See also serialNumber().
void QKnxNetIpEndpointConnection::setSupportedProtocolVersions(const QKnxByteArray &versions)
Sets the connection supported KNXnet/IP versions indicated in versions.
See also supportedProtocolVersions().
QKnxNetIpEndpointConnection::State QKnxNetIpEndpointConnection::state() const
Returns the state of the connection.
QKnxByteArray QKnxNetIpEndpointConnection::supportedProtocolVersions() const
Returns a byte array with the supported KNXnet/IP versions.
See also setSupportedProtocolVersions().
© 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.