W3cubDocs

/Qt

QtCoap Namespace

Contains miscellaneous identifiers used throughout the Qt CoAP module. More...

Header: #include <QtCoap>
qmake: QT += coap

Types

enum class Error { Ok, HostNotFound, AddressInUse, TimeOut, BadRequest, …, Unknown }
enum class Method { Invalid, Get, Post, Put, Delete, Other }
enum class MulticastGroup { AllCoapNodesIPv4, AllCoapNodesIPv6LinkLocal, AllCoapNodesIPv6SiteLocal }
enum Port { DefaultPort, DefaultSecurePort }
enum class ResponseCode { EmptyMessage, Created, Deleted, Valid, Changed, …, InvalidCode }
enum class SecurityMode { NoSecurity, PreSharedKey, RawPublicKey, Certificate }

Detailed Description

Type Documentation

enum class QtCoap::Error

Indicates the error condition found during processing of the request.

Constant Value Description
QtCoap::Error::Ok 0 No error condition.
QtCoap::Error::HostNotFound 1 The remote host name was not found.
QtCoap::Error::AddressInUse 2 The address is already in use.
QtCoap::Error::TimeOut 3 The response did not arrive in time.
QtCoap::Error::BadRequest 4 The request was not recognized.
QtCoap::Error::Unauthorized 5 The client is not authorized to perform the requested action.
QtCoap::Error::BadOption 6 The request could not be understood by the server due to one or more unrecognized or malformed options.
QtCoap::Error::Forbidden 7 Access to this resource is forbidden.
QtCoap::Error::NotFound 8 The resource requested was not found.
QtCoap::Error::MethodNotAllowed 9 The server does not allow the method used for the URL requested.
QtCoap::Error::NotAcceptable 10 No resource satisfying the request's acceptance criteria was found.
QtCoap::Error::RequestEntityIncomplete 11 The server has not received the blocks of the request body that it needs to proceed. The client has not sent all blocks, has not sent them in the order required by the server, or sent them long enough ago that the server has already discarded them.
QtCoap::Error::PreconditionFailed 12 One or more conditions given in the request header fields evaluated to false when tested on the server.
QtCoap::Error::RequestEntityTooLarge 13 The request payload is larger than the server is willing or able to process.
QtCoap::Error::UnsupportedContentFormat 14 The payload is in a format not supported by this method on the target resource.
QtCoap::Error::InternalServerFault 15 The server encountered an unexpected condition that prevented it from fulfilling the request.
QtCoap::Error::NotImplemented 16 The server does not support the functionality required to fulfill the request.
QtCoap::Error::BadGateway 17 An error occurred with an upstream server.
QtCoap::Error::ServiceUnavailable 18 The service is currently unavailable.
QtCoap::Error::GatewayTimeout 19 The server, while acting as a gateway or proxy, did not receive a timely response from an upstream server it needed to access in order to complete the request.
QtCoap::Error::ProxyingNotSupported 20 The server is unable or unwilling to act as a forward-proxy for the URI specified in the Proxy-Uri Option or using the scheme specified in Proxy-Scheme.
QtCoap::Error::Unknown 21 An unknown error occurred.

enum class QtCoap::Method

This enum specifies CoAP request methods.

Constant Value Description
QtCoap::Method::Invalid 0 The default request method for an empty request.
QtCoap::Method::Get 1 GET method.
QtCoap::Method::Post 2 POST method.
QtCoap::Method::Put 3 PUT method.
QtCoap::Method::Delete 4 DELETE method.
QtCoap::Method::Other 5 Other request method.

enum class QtCoap::MulticastGroup

This enum represents CoAP multicast group addresses defined in RFC 7252.

Constant Value Description
QtCoap::MulticastGroup::AllCoapNodesIPv4 0 IPv4 "All CoAP Nodes" address 224.0.1.187, from the "IPv4 Multicast Address Space Registry".
QtCoap::MulticastGroup::AllCoapNodesIPv6LinkLocal 1 IPv6 "All CoAP Nodes" link-local scoped address FF02::FD, from the "IPv6 Multicast Address Space Registry".
QtCoap::MulticastGroup::AllCoapNodesIPv6SiteLocal 2 IPv6 "All CoAP Nodes" site-local scoped address FF05::FD, from the "IPv6 Multicast Address Space Registry".

enum QtCoap::Port

This enum specifies the default CoAP port values.

Constant Value Description
QtCoap::DefaultPort 5683 The default port used for the non-secure transmission.
QtCoap::DefaultSecurePort 5684 The default port used for the secure transmission.

enum class QtCoap::ResponseCode

This enum represents the response code from the CoAP protocol, as defined in RFC 7252 and RFC 7959.

Constant Value Description
QtCoap::ResponseCode::EmptyMessage 0x00 The response code for an empty message.
QtCoap::ResponseCode::Created 0x41 The request was successful and has resulted in new resources being created. This response code corresponds to HTTP 201 "Created".
QtCoap::ResponseCode::Deleted 0x42 The resource has been successfully deleted. This response code corresponds to HTTP 204 "No Content" but is only used in response to requests that cause the resource to cease being available, such as DELETE and, in certain circumstances, POST.
QtCoap::ResponseCode::Valid 0x43 This response code is related to HTTP 304 "Not Modified" but is only used to indicate that the response identified by the entity-tag given in the ETag Option is valid.
QtCoap::ResponseCode::Changed 0x44 The resource has been successfully modified. This response code corresponds to HTTP 204 "No Content" but is only used in response to POST and PUT requests.
QtCoap::ResponseCode::Content 0x45 The request has succeeded. This response code corresponds to HTTP 200 "OK" but is only used in response to GET requests.
QtCoap::ResponseCode::Continue 0x5F Indicates that the transfer of the current block was successful, and the server will send more blocks.
QtCoap::ResponseCode::BadRequest 0x-80 The request was not recognized. This response code corresponds to HTTP 400 "Bad Request".
QtCoap::ResponseCode::Unauthorized 0x-7f The client is not authorized to perform the requested action. This response code corresponds to HTTP 401 "Unauthorized".
QtCoap::ResponseCode::BadOption 0x-7e The request could not be understood by the server due to unrecognized options.
QtCoap::ResponseCode::Forbidden 0x-7d Access to this resource is forbidden. This response code corresponds to HTTP 403 "Forbidden".
QtCoap::ResponseCode::NotFound 0x-7c The resource requested was not found. This response code corresponds to HTTP 404 "Not Found".
QtCoap::ResponseCode::MethodNotAllowed 0x-7b The server does not allow the method used for the URL requested. This response code corresponds to HTTP 405 "Method Not Allowed" but with no parallel to the "Allow" header field.
QtCoap::ResponseCode::NotAcceptable 0x-7a No resource satisfying the request's acceptance criteria was found. This response code corresponds to HTTP 406 "Not Acceptable", but with no response entity.
QtCoap::ResponseCode::RequestEntityIncomplete 0x-78 The server has not received all blocks, of the request body, that it needs to proceed.
QtCoap::ResponseCode::PreconditionFailed 0x-74 Preconditions given in the request header fields evaluated to false when tested on the server. This response code corresponds to HTTP 412 "Precondition Failed".
QtCoap::ResponseCode::RequestEntityTooLarge 0x-73 The request payload is larger than the server is willing or able to process. This response code corresponds to HTTP 413 "Request Entity Too Large".
QtCoap::ResponseCode::UnsupportedContentFormat 0x-72 The payload is in a format not supported by this method on the target resource. This response code corresponds to HTTP 415 "Unsupported Media Type".
QtCoap::ResponseCode::InternalServerFault 0x-60 The server encountered an unexpected condition that prevented it from fulfilling the request. This response code corresponds to HTTP 500 "Internal Server Error".
QtCoap::ResponseCode::NotImplemented 0x-5f The server does not support the functionality required to fulfill the request. This response code corresponds to HTTP 501 "Not Implemented".
QtCoap::ResponseCode::BadGateway 0x-5e An error occurred with an upstream server. This response code corresponds to HTTP 502 "Bad Gateway".
QtCoap::ResponseCode::ServiceUnavailable 0x-5d The service is currently unavailable. This response code corresponds to HTTP 503 "Service Unavailable".
QtCoap::ResponseCode::GatewayTimeout 0x-5c The server, while acting as a gateway or proxy, did not receive a timely response from an upstream server. This response code corresponds to HTTP 504 "Gateway Timeout".
QtCoap::ResponseCode::ProxyingNotSupported 0x-5b The server is unable or unwilling to act as a forward-proxy for the URI specified in the Proxy-Uri Option or using the scheme specified in Proxy-Scheme.
QtCoap::ResponseCode::InvalidCode 0xFF An invalid response code.

enum class QtCoap::SecurityMode

Specifies the security mode used for securing a CoAP connection, as defined in RFC 7252.

Constant Value Description
QtCoap::SecurityMode::NoSecurity 0 There is no protocol-level security (DTLS is disabled).
QtCoap::SecurityMode::PreSharedKey 1 DTLS is enabled. PSK authentication will be used for security.
QtCoap::SecurityMode::RawPublicKey 2 DTLS is enabled. An asymmetric key pair without a certificate (a raw public key) will be used for security. This mode is not supported yet.
QtCoap::SecurityMode::Certificate 3 DTLS is enabled. An asymmetric key pair with an X.509 certificate will be used for security.

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-6.2/qtcoap.html