Rtos API example
sn_coap_protocol.h File Reference
CoAP C-library User protocol interface header file. More...
Go to the source code of this file.
Functions | |
int16_t | sn_coap_protocol_build (struct coap_s *handle, sn_nsdl_addr_s *dst_addr_ptr, uint8_t *dst_packet_data_ptr, sn_coap_hdr_s *src_coap_msg_ptr, void *param) |
Builds Packet data from given CoAP header structure to be sent. | |
int8_t | sn_coap_protocol_exec (struct coap_s *handle, uint32_t current_time) |
Sends CoAP messages from re-sending queue, if there is any. | |
void | sn_coap_protocol_clear_retransmission_buffer (struct coap_s *handle) |
If re-transmissions are enabled, this function removes all messages from the retransmission queue. |
Detailed Description
CoAP C-library User protocol interface header file.
Definition in file sn_coap_protocol.h.
Function Documentation
int16_t sn_coap_protocol_build | ( | struct coap_s * | handle, |
sn_nsdl_addr_s * | dst_addr_ptr, | ||
uint8_t * | dst_packet_data_ptr, | ||
sn_coap_hdr_s * | src_coap_msg_ptr, | ||
void * | param | ||
) |
Builds Packet data from given CoAP header structure to be sent.
- Parameters:
-
*dst_addr_ptr is pointer to destination address where CoAP message will be sent (CoAP builder needs that information for message resending purposes) *dst_packet_data_ptr is pointer to destination of built Packet data *src_coap_msg_ptr is pointer to source of built Packet data param void pointer that will be passed to tx/rx function callback when those are called.
- Returns:
- Return value is byte count of built Packet data.
Note: If message is blockwised, all payload is not sent at the same time
In failure cases:
-1 = Failure in CoAP header structure
-2 = Failure in given pointer (= NULL)
-3 = Failure in Reset message
-4 = Failure in Resending message store
If there is not enough memory (or User given limit exceeded) for storing resending messages, situation is ignored.
Definition at line 380 of file sn_coap_protocol.c.
void sn_coap_protocol_clear_retransmission_buffer | ( | struct coap_s * | handle ) |
If re-transmissions are enabled, this function removes all messages from the retransmission queue.
- Parameters:
-
*handle Pointer to CoAP library handle
Definition at line 307 of file sn_coap_protocol.c.
int8_t sn_coap_protocol_exec | ( | struct coap_s * | handle, |
uint32_t | current_time | ||
) |
Sends CoAP messages from re-sending queue, if there is any.
Cleans also old messages from the duplication list and from block receiving list
This function can be called e.g. once in a second but also more frequently.
- Parameters:
-
*handle Pointer to CoAP library handle current_time is System time in seconds. This time is used for message re-sending timing and to identify old saved data.
- Returns:
- 0 if success -1 if failed
Definition at line 756 of file sn_coap_protocol.c.
Generated on Sun Jul 17 2022 08:25:36 by 1.7.2