mirror of
https://github.com/espressif/openthread.git
synced 2026-08-15 15:17:46 +00:00
[coap] misc enhancements (#5482)
This commit contains a group of smaller changes/renames in `Coap`
modules:
- Add enumeration (c++ style) constants for CoAP `Type` and `Code`
and `OptionType`.
- Add helpers `Message::Is{Method}Request()` e.g., `IsPostRequest()`
- Define Thread URI Paths (in `uri_paths.hpp/cpp`) as char array.
- Add helper method in `Coap::Message` for common initializations
e.g., `InitAsConfirmablePost()`.
- Add helper methods for common `Coap:Message` type and code checks
e.g., `IsConfirmablePost()`.
- Re-define `OT_COAP_TYPE` values to use 2-bit unsigned int values
(per RFC-7252).
This commit is contained in:
@@ -58,6 +58,8 @@ extern "C" {
|
||||
|
||||
#define OT_DEFAULT_COAP_PORT 5683 ///< Default CoAP port, as specified in RFC 7252
|
||||
|
||||
#define OT_COAP_DEFAULT_TOKEN_LENGTH 2 ///< Default token length.
|
||||
|
||||
#define OT_COAP_MAX_TOKEN_LENGTH 8 ///< Max token length as specified (RFC 7252).
|
||||
|
||||
#define OT_COAP_MAX_RETRANSMIT 20 ///< Max retransmit supported by OpenThread.
|
||||
@@ -65,15 +67,15 @@ extern "C" {
|
||||
#define OT_COAP_MIN_ACK_TIMEOUT 1000 ///< Minimal ACK timeout in milliseconds supported by OpenThread.
|
||||
|
||||
/**
|
||||
* CoAP Type values.
|
||||
* CoAP Type values (2 bit unsigned integer).
|
||||
*
|
||||
*/
|
||||
typedef enum otCoapType
|
||||
{
|
||||
OT_COAP_TYPE_CONFIRMABLE = 0x00, ///< Confirmable
|
||||
OT_COAP_TYPE_NON_CONFIRMABLE = 0x10, ///< Non-confirmable
|
||||
OT_COAP_TYPE_ACKNOWLEDGMENT = 0x20, ///< Acknowledgment
|
||||
OT_COAP_TYPE_RESET = 0x30, ///< Reset
|
||||
OT_COAP_TYPE_CONFIRMABLE = 0, ///< Confirmable
|
||||
OT_COAP_TYPE_NON_CONFIRMABLE = 1, ///< Non-confirmable
|
||||
OT_COAP_TYPE_ACKNOWLEDGMENT = 2, ///< Acknowledgment
|
||||
OT_COAP_TYPE_RESET = 3, ///< Reset
|
||||
} otCoapType;
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ extern "C" {
|
||||
* @note This number versions both OpenThread platform and user APIs.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_API_VERSION (26)
|
||||
#define OPENTHREAD_API_VERSION (27)
|
||||
|
||||
/**
|
||||
* @addtogroup api-instance
|
||||
|
||||
Reference in New Issue
Block a user