#include <golioth/golioth_status.h>
#include <golioth/client.h>
#include <stdlib.h>
Go to the source code of this file.
|
struct gateway_uplink * | golioth_gateway_uplink_start (struct golioth_client *client, gateway_downlink_block_cb dnlk_block_cb, gateway_downlink_end_cb dnlk_end_cb, void *downlink_arg) |
|
enum golioth_status | golioth_gateway_uplink_block (struct gateway_uplink *uplink, uint32_t block_idx, const uint8_t *buf, size_t buf_len, bool is_last, golioth_set_block_cb_fn set_cb, void *callback_arg) |
|
void | golioth_gateway_uplink_finish (struct gateway_uplink *uplink) |
|
enum golioth_status | golioth_gateway_server_cert_get (struct golioth_client *client, void *buf, size_t *len) |
|
enum golioth_status | golioth_gateway_device_cert_set (struct golioth_client *client, const void *buf, size_t len, int32_t timeout_s) |
|
◆ gateway_downlink_block_cb
typedef enum golioth_status(* gateway_downlink_block_cb) (const uint8_t *data, size_t len, bool is_last, void *arg) |
◆ gateway_downlink_end_cb
◆ golioth_gateway_device_cert_set()
enum golioth_status golioth_gateway_device_cert_set |
( |
struct golioth_client * | client, |
|
|
const void * | buf, |
|
|
size_t | len, |
|
|
int32_t | timeout_s ) |
Set device certificate.
- Parameters
-
client | The client handle from golioth_client_create |
buf | Pointer to buffer where certificate is stored |
len | Certificate length |
timeout_s | Timeout in seconds for API call |
◆ golioth_gateway_server_cert_get()
enum golioth_status golioth_gateway_server_cert_get |
( |
struct golioth_client * | client, |
|
|
void * | buf, |
|
|
size_t * | len ) |
Get server certificate.
- Parameters
-
client | The client handle from golioth_client_create |
buf | Pointer to buffer where certificate will be written |
len | Pointer to length. On input it is buffer length. On output it is certificate length. |
◆ golioth_gateway_uplink_block()
enum golioth_status golioth_gateway_uplink_block |
( |
struct gateway_uplink * | uplink, |
|
|
uint32_t | block_idx, |
|
|
const uint8_t * | buf, |
|
|
size_t | buf_len, |
|
|
bool | is_last, |
|
|
golioth_set_block_cb_fn | set_cb, |
|
|
void * | callback_arg ) |
Send a single uplink block
Call this function for each block. For each call you must increment the block_idx
, On the final block, set is_last
to true. Block size is determined by the value of CONFIG_GOLIOTH_BLOCKWISE_DOWNLOAD_MAX_BLOCK_SIZE.
An optional callback and callback argument may be supplied. The callback will be called after the block is uploaded to provide access to status and CoAP response codes.
- Parameters
-
uplink | The context used for all blocks in an uplink / downlink operation, returned from golioth_gateway_uplink_start |
block_idx | The index of the block being sent |
buf | The buffer where the data for this block is located |
buf_len | The actual length of data (in bytes) for this block. This should be equal to CONFIG_GOLIOTH_BLOCKWISE_DOWNLOAD_MAX_BLOCK_SIZE for all blocks except for the final block, which may be shorter |
is_last | Set this to true if this is the last block in the upload |
set_cb | A callback that will be called after each block is sent (can be NULL) |
callback_arg | An optional user provided argument that will be passed to set_cb (can be NULL) |
◆ golioth_gateway_uplink_finish()
void golioth_gateway_uplink_finish |
( |
struct gateway_uplink * | uplink | ) |
|
Finish a gateway uplink.
- Parameters
-
◆ golioth_gateway_uplink_start()
Start a gateway uplink. The pointer returned from this function can be used with golioth_gateway_uplink_block and golioth_gateway_uplink_finish
- Parameters
-
client | The client handle from golioth_client_create |
dnlk_block_cb | A callback that will be called after each block in downlink is received |
dnlk_end_cb | A callback that will be called after downlink completes |
downlink_arg | An optional user provided argument that will be passed to callbacks (can be NULL) |