|
Anjay Lite
|
Public API for composing and queuing LwM2M Send messages. More...
Go to the source code of this file.
Data Structures | |
| struct | anj_send_request_t |
Macros | |
| #define | ANJ_SEND_ID_ALL UINT16_MAX |
| #define | ANJ_SEND_SUCCESS 0 |
| #define | ANJ_SEND_ERR_TIMEOUT -1 |
| #define | ANJ_SEND_ERR_ABORT -2 |
| #define | ANJ_SEND_ERR_REJECTED -3 |
| #define | ANJ_SEND_ERR_NETWORK -4 |
| #define | ANJ_SEND_ERR_INTERNAL -5 |
| #define | ANJ_SEND_ERR_NO_REQUEST_FOUND -6 |
| #define | ANJ_SEND_ERR_NO_SPACE -7 |
| #define | ANJ_SEND_ERR_NOT_ALLOWED -8 |
| #define | ANJ_SEND_ERR_DATA_NOT_VALID -9 |
Typedefs | |
| typedef void | anj_send_finished_handler_t(anj_t *anjay, uint16_t send_id, int result, void *data) |
Enumerations | |
| enum | anj_send_content_format_t { ANJ_SEND_CONTENT_FORMAT_SENML_CBOR , ANJ_SEND_CONTENT_FORMAT_LWM2M_CBOR } |
Functions | |
| int | anj_send_new_request (anj_t *anj, const anj_send_request_t *send_request, uint16_t *out_send_id) |
| int | anj_send_abort (anj_t *anj, uint16_t send_id) |
Public API for composing and queuing LwM2M Send messages.
The Send operation allows a client to proactively transmit Resource values to the LwM2M Server (without a preceding request). Requests are queued and sent when a registration session is active and no higher-priority CoAP exchange is in progress.
| #define ANJ_SEND_ID_ALL UINT16_MAX |
Special ID that matches all queued/active Send requests.
| typedef void anj_send_finished_handler_t(anj_t *anjay, uint16_t send_id, int result, void *data) |
Completion handler for a Send request.
| anjay | Anjay object. |
| send_id | ID of the Send request. |
| result | One of LwM2M Send error codes. |
| data | User pointer from anj_send_request_t::data. |
Content format of the Send payload.
Requires the corresponding build-time support to be enabled.
| Enumerator | |
|---|---|
| ANJ_SEND_CONTENT_FORMAT_SENML_CBOR | |
| ANJ_SEND_CONTENT_FORMAT_LWM2M_CBOR | |
| int anj_send_abort | ( | anj_t * | anj, |
| uint16_t | send_id | ||
| ) |
Abort a queued or in-flight Send request.
In both cases, ANJ_SEND_ERR_ABORT is reported to the completion handler.
| anj | Anjay object. |
| send_id | ID of the Send request to abort. Use ANJ_SEND_ID_ALL to abort all pending requests. |
| int anj_send_new_request | ( | anj_t * | anj, |
| const anj_send_request_t * | send_request, | ||
| uint16_t * | out_send_id | ||
| ) |
Queue a new LwM2M Send request.
If this function returns 0, the request is queued and the finish handler will be called with the final result. The request is processed when:
When multiple requests are queued, they are processed FIFO; only one Send request is processed at a time.
send_request object is not copied. All referenced memory (including the anj_send_request_t::records array) must remain valid and unchanged until the operation completes and the finish handler returns.| anj | Anjay object. | |
| send_request | Description of the message to send (must remain valid until completion). | |
| [out] | out_send_id | If non-NULL, receives the assigned Send request ID (valid until the finish handler is invoked). |