Infuse COAP API .
More...
|
typedef int(* | infuse_coap_data_cb) (uint32_t offset, const uint8_t *data, uint16_t data_len, void *user_context) |
| COAP data download callback.
|
|
|
int | infuse_coap_download (int socket, const char *resource, infuse_coap_data_cb data_cb, void *user_context, uint8_t *working_mem, size_t working_size, int timeout_ms) |
| Download a file over COAP from an existing socket.
|
|
Infuse COAP API .
◆ infuse_coap_data_cb
typedef int(* infuse_coap_data_cb) (uint32_t offset, const uint8_t *data, uint16_t data_len, void *user_context) |
#include <infuse/net/coap.h>
COAP data download callback.
- Parameters
-
offset | Offset of data payload from start of data |
data | Data payload |
data_len | Length of payload |
user_context | Arbitrary pointer from user |
- Return values
-
0 | Continue downloading more data |
-errno | Terminate download process |
◆ infuse_coap_download()
int infuse_coap_download |
( |
int | socket, |
|
|
const char * | resource, |
|
|
infuse_coap_data_cb | data_cb, |
|
|
void * | user_context, |
|
|
uint8_t * | working_mem, |
|
|
size_t | working_size, |
|
|
int | timeout_ms ) |
#include <infuse/net/coap.h>
Download a file over COAP from an existing socket.
- Parameters
-
socket | Socket already connected to remote server |
resource | Resource path URI, for example "path/to/resource" |
data_cb | Callback run on each data chunk received |
user_context | Arbitrary user context for data_cb |
working_mem | Memory buffer for sending/receiving packets with |
working_size | Size of working_mem in bytes |
timeout_ms | Timeout waiting for each response from server |
- Return values
-
>=0 | bytes downloaded on success |
<0 | error code on failure |