Golioth Firmware SDK
Loading...
Searching...
No Matches
gateway.h File Reference
#include <golioth/golioth_status.h>
#include <golioth/client.h>
#include <stdlib.h>

Go to the source code of this file.

Functions

struct blockwise_transfer * golioth_gateway_uplink_start (struct golioth_client *client)
 
enum golioth_status golioth_gateway_uplink_block (struct blockwise_transfer *ctx, 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 blockwise_transfer *ctx)
 

Function Documentation

◆ golioth_gateway_uplink_block()

enum golioth_status golioth_gateway_uplink_block ( struct blockwise_transfer * ctx,
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
ctxBlock upload context used for all blocks in a related upload operation
block_idxThe index of the block being sent
bufThe buffer where the data for this block is located
buf_lenThe 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_lastSet this to true if this is the last block in the upload
set_cbA callback that will be called after each block is sent (can be NULL)
callback_argAn optional user provided argument that will be passed to callback (can be NULL)

◆ golioth_gateway_uplink_finish()

void golioth_gateway_uplink_finish ( struct blockwise_transfer * ctx)

Finish a gateway uplink.

Parameters
ctxThe uplink context to finish, returned from golioth_gateway_uplink_block

◆ golioth_gateway_uplink_start()

struct blockwise_transfer * golioth_gateway_uplink_start ( struct golioth_client * client)

Start a gateway uplink. The pointer returned from this function can be used with golioth_gateway_uplink_block.

Parameters
clientThe client handle from golioth_client_create