QtCoap Namespace

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

Header: #include <QtCoap>
CMake: find_package(Qt6 REQUIRED COMPONENTS Coap)
target_link_libraries(mytarget PRIVATE Qt6::Coap)
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.

ConstantValueDescription
QtCoap::Error::Ok0No error condition.
QtCoap::Error::HostNotFound1The remote host name was not found.
QtCoap::Error::AddressInUse2The address is already in use.
QtCoap::Error::TimeOut3The response did not arrive in time.
QtCoap::Error::BadRequest4The request was not recognized.
QtCoap::Error::Unauthorized5The client is not authorized to perform the requested action.
QtCoap::Error::BadOption6The request could not be understood by the server due to one or more unrecognized or malformed options.
QtCoap::Error::Forbidden7Access to this resource is forbidden.
QtCoap::Error::NotFound8The resource requested was not found.
QtCoap::Error::MethodNotAllowed9The server does not allow the method used for the URL requested.
QtCoap::Error::NotAcceptable10No resource satisfying the request's acceptance criteria was found.
QtCoap::Error::RequestEntityIncomplete11The 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::PreconditionFailed12One or more conditions given in the request header fields evaluated to false when tested on the server.
QtCoap::Error::RequestEntityTooLarge13The request payload is larger than the server is willing or able to process.
QtCoap::Error::UnsupportedContentFormat14The payload is in a format not supported by this method on the target resource.
QtCoap::Error::InternalServerFault15The server encountered an unexpected condition that prevented it from fulfilling the request.
QtCoap::Error::NotImplemented16The server does not support the functionality required to fulfill the request.
QtCoap::Error::BadGateway17An error occurred with an upstream server.
QtCoap::Error::ServiceUnavailable18The service is currently unavailable.
QtCoap::Error::GatewayTimeout19The 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::ProxyingNotSupported20The 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::Unknown21An unknown error occurred.

enum class QtCoap::Method

This enum specifies CoAP request methods.

ConstantValueDescription
QtCoap::Method::Invalid0The default request method for an empty request.
QtCoap::Method::Get1GET method.
QtCoap::Method::Post2POST method.
QtCoap::Method::Put3PUT method.
QtCoap::Method::Delete4DELETE method.
QtCoap::Method::Other5Other request method.

enum class QtCoap::MulticastGroup

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

ConstantValueDescription
QtCoap::MulticastGroup::AllCoapNodesIPv40IPv4 "All CoAP Nodes" address 224.0.1.187, from the "IPv4 Multicast Address Space Registry".
QtCoap::MulticastGroup::AllCoapNodesIPv6LinkLocal1IPv6 "All CoAP Nodes" link-local scoped address FF02::FD, from the "IPv6 Multicast Address Space Registry".
QtCoap::MulticastGroup::AllCoapNodesIPv6SiteLocal2IPv6 "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.

ConstantValueDescription
QtCoap::DefaultPort5683The default port used for the non-secure transmission.
QtCoap::DefaultSecurePort5684The 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.

ConstantValueDescription
QtCoap::ResponseCode::EmptyMessage0x00The response code for an empty message.
QtCoap::ResponseCode::Created0x41The request was successful and has resulted in new resources being created. This response code corresponds to HTTP 201 "Created".
QtCoap::ResponseCode::Deleted0x42The 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::Valid0x43This 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::Changed0x44The 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::Content0x45The request has succeeded. This response code corresponds to HTTP 200 "OK" but is only used in response to GET requests.
QtCoap::ResponseCode::Continue0x5FIndicates that the transfer of the current block was successful, and the server will send more blocks.
QtCoap::ResponseCode::BadRequest0x-80The request was not recognized. This response code corresponds to HTTP 400 "Bad Request".
QtCoap::ResponseCode::Unauthorized0x-7fThe client is not authorized to perform the requested action. This response code corresponds to HTTP 401 "Unauthorized".
QtCoap::ResponseCode::BadOption0x-7eThe request could not be understood by the server due to unrecognized options.
QtCoap::ResponseCode::Forbidden0x-7dAccess to this resource is forbidden. This response code corresponds to HTTP 403 "Forbidden".
QtCoap::ResponseCode::NotFound0x-7cThe resource requested was not found. This response code corresponds to HTTP 404 "Not Found".
QtCoap::ResponseCode::MethodNotAllowed0x-7bThe 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::NotAcceptable0x-7aNo 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::RequestEntityIncomplete0x-78The server has not received all blocks, of the request body, that it needs to proceed.
QtCoap::ResponseCode::PreconditionFailed0x-74Preconditions 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::RequestEntityTooLarge0x-73The 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::UnsupportedContentFormat0x-72The 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::InternalServerFault0x-60The server encountered an unexpected condition that prevented it from fulfilling the request. This response code corresponds to HTTP 500 "Internal Server Error".
QtCoap::ResponseCode::NotImplemented0x-5fThe server does not support the functionality required to fulfill the request. This response code corresponds to HTTP 501 "Not Implemented".
QtCoap::ResponseCode::BadGateway0x-5eAn error occurred with an upstream server. This response code corresponds to HTTP 502 "Bad Gateway".
QtCoap::ResponseCode::ServiceUnavailable0x-5dThe service is currently unavailable. This response code corresponds to HTTP 503 "Service Unavailable".
QtCoap::ResponseCode::GatewayTimeout0x-5cThe 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::ProxyingNotSupported0x-5bThe 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::InvalidCode0xFFAn invalid response code.

enum class QtCoap::SecurityMode

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

ConstantValueDescription
QtCoap::SecurityMode::NoSecurity0There is no protocol-level security (DTLS is disabled).
QtCoap::SecurityMode::PreSharedKey1DTLS is enabled. PSK authentication will be used for security.
QtCoap::SecurityMode::RawPublicKey2DTLS 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::Certificate3DTLS is enabled. An asymmetric key pair with an X.509 certificate will be used for security.

© 2023 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.