QCoapConnection Class
The QCoapConnection class defines an interface for handling transfers of frames to a server. More...
| Header: | #include <QCoapConnection> |
| Inherits: | QObject |
| Inherited By: |
Public Types
| enum class | ConnectionState { Unconnected, Bound } |
Public Functions
| QCoapConnection(QtCoap::SecurityMode securityMode = QtCoap::SecurityMode::NoSecurity, QObject *parent = nullptr) | |
| virtual | ~QCoapConnection() |
| void | disconnect() |
| bool | isSecure() const |
| QCoapSecurityConfiguration | securityConfiguration() const |
| QtCoap::SecurityMode | securityMode() const |
| void | setSecurityConfiguration(const QCoapSecurityConfiguration &configuration) |
| ConnectionState | state() const |
Protected Functions
| QCoapConnection(QObjectPrivate &dd, QObject *parent = nullptr) |
Detailed Description
\internal
\inmoduleQtCoap
It isolates CoAP clients from the transport in use, so that any client can be used with any supported transport.
Member Type Documentation
enum class QCoapConnection::ConnectionState
\internal
This enum specifies the state of the underlying transport.
| Constant | Value | Description |
|---|---|---|
QCoapConnection::ConnectionState::Unconnected | 0 | The underlying transport is not yet ready for data transmission. |
QCoapConnection::ConnectionState::Bound | 1 | The underlying transport is ready for data transmission. For example, if QUdpSocket is used for the transport, this corresponds to QAbstractSocket::BoundState. |
See also state() and bound().
Member Function Documentation
[explicit] QCoapConnection::QCoapConnection(QtCoap::SecurityMode securityMode = QtCoap::SecurityMode::NoSecurity, QObject *parent = nullptr)
Constructs a new CoAP connection for the given securityMode and sets parent as its parent.
[protected] QCoapConnection::QCoapConnection(QObjectPrivate &dd, QObject *parent = nullptr)
\internal
Constructs a new new CoAP connection as a child of parent, with dd as its d_ptr. This constructor must be used when internally subclassing the QCoapConnection class.
[virtual noexcept] QCoapConnection::~QCoapConnection()
\internal
Releases any resources held by QCoapConnection.
[invokable] void QCoapConnection::disconnect()
\internal
Closes the open sockets and connections to free the transport and clears the connection state.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
bool QCoapConnection::isSecure() const
\internal
Returns true if security is used, returns false otherwise.
QCoapSecurityConfiguration QCoapConnection::securityConfiguration() const
\internal
Returns the security configuration.
See also setSecurityConfiguration().
QtCoap::SecurityMode QCoapConnection::securityMode() const
\internal
Returns the security mode.
[invokable] void QCoapConnection::setSecurityConfiguration(const QCoapSecurityConfiguration &configuration)
Sets the security configuration parameters from the configuration. The security configuration will be ignored if the QtCoap::NoSecurity mode is used for connection.
Note: This method must be called before the handshake starts.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
See also securityConfiguration().
ConnectionState QCoapConnection::state() const
\internal
Returns the connection state.