CoAP constants that can be overridden. More...
Macros | |
| #define | COAP_MAX_MESSAGE_SIZE 128U |
| Maximum size of a CoAP message in bytes. | |
| #define | COAP_MAX_CALLBACKS 10U |
| Maximum number of callbacks that can be registered at runtime. | |
| #define | COAP_MAX_OBSERVERS 4U |
| Maximum number of observers that can be registered at runtime. | |
| #define | COAP_OBSERVER_LEASE_MS 60000UL |
| #define | COAP_ACK_MIN_TIMEOUT_MS 2000UL |
| Minimum ACK timeout in milliseconds. See RFC 7252, Section 4.8. Default to 2 seconds (2000 ms). | |
| #define | COAP_ACK_RANDOM_FACTOR 1.5f |
| ACK timeout random factor as per RFC 7252, Section 4.8. Default to 1.5. This value can be overridden. | |
| #define | COAP_ACK_MAX_TIMEOUT_MS (unsigned long)(COAP_ACK_MIN_TIMEOUT_MS * COAP_ACK_RANDOM_FACTOR) |
| The precomputed maximum ACK timeout derived from the minimum timeout and the random factor. | |
| #define | COAP_MAX_RETRANSMIT 4U |
| The maximum number of retransmission attempts for confirmable messages. Default to 4 as per RFC 7252, Section 4.8. This value can be overridden. | |
| #define | COAP_CONFIRMABLE_MESSAGE_QUEUE_SIZE 2U |
| The maximum number of confirmable messages that are stored for retransmission. | |
CoAP constants that can be overridden.
These constants can be overridden by defining them before including this header. Example:
Refer to each constant's documentation for details.
| #define COAP_ACK_MAX_TIMEOUT_MS (unsigned long)(COAP_ACK_MIN_TIMEOUT_MS * COAP_ACK_RANDOM_FACTOR) |
The precomputed maximum ACK timeout derived from the minimum timeout and the random factor.
| #define COAP_ACK_MIN_TIMEOUT_MS 2000UL |
Minimum ACK timeout in milliseconds. See RFC 7252, Section 4.8. Default to 2 seconds (2000 ms).
This value can be overridden.
| #define COAP_ACK_RANDOM_FACTOR 1.5f |
ACK timeout random factor as per RFC 7252, Section 4.8. Default to 1.5. This value can be overridden.
| #define COAP_CONFIRMABLE_MESSAGE_QUEUE_SIZE 2U |
The maximum number of confirmable messages that are stored for retransmission.
The total memory used by the queue will be about: COAP_CONFIRMABLE_MESSAGE_QUEUE_SIZE * COAP_MAX_MESSAGE_SIZE bytes. The actual memory usage may be slightly higher due to the Message representation.
Reduce this value to save memory.
| #define COAP_MAX_CALLBACKS 10U |
Maximum number of callbacks that can be registered at runtime.
This limits the number of endpoints that can be served.
| #define COAP_MAX_MESSAGE_SIZE 128U |
Maximum size of a CoAP message in bytes.
As per CoAP specification, the recommended message size should fit within a single IP packet to avoid fragmentation. The recommended maximum size is therefore 1152 bytes. The absolute minimum size for a UDP payload (and thus, of a message) is 40 bytes.
This value applies to both incoming and outgoing messages. Keep this value small enough to reduce memory usage. Exceeding it will lead to errors when building outgoing messages.
See https://datatracker.ietf.org/doc/html/rfc7252#section-4.6
The message structure is:
| HEADER | TOKEN | OPTIONS | PAYLOAD |
|---|---|---|---|
| 4 bytes | 0-8b | variable | variable |
| #define COAP_MAX_OBSERVERS 4U |
Maximum number of observers that can be registered at runtime.
| #define COAP_MAX_RETRANSMIT 4U |
The maximum number of retransmission attempts for confirmable messages. Default to 4 as per RFC 7252, Section 4.8. This value can be overridden.
| #define COAP_OBSERVER_LEASE_MS 60000UL |