Golioth Firmware SDK
Loading...
Searching...
No Matches
stream.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Golioth, Inc.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifdef __cplusplus
8extern "C"
9{
10#endif
11
12#pragma once
13
15#include <golioth/client.h>
16
22
44enum golioth_status golioth_stream_set_async(struct golioth_client *client,
45 const char *path,
46 enum golioth_content_type content_type,
47 const uint8_t *buf,
48 size_t buf_len,
49 golioth_set_cb_fn callback,
50 void *callback_arg);
51
66enum golioth_status golioth_stream_set_sync(struct golioth_client *client,
67 const char *path,
68 enum golioth_content_type content_type,
69 const uint8_t *buf,
70 size_t buf_len,
71 int32_t timeout_s);
72
93typedef enum golioth_status (*stream_read_block_cb)(uint32_t block_idx,
94 uint8_t *block_buffer,
95 size_t *block_size,
96 bool *is_last,
97 void *arg);
98
109enum golioth_status golioth_stream_set_blockwise_sync(struct golioth_client *client,
110 const char *path,
111 enum golioth_content_type content_type,
113 void *arg);
114
124struct blockwise_transfer *golioth_stream_blockwise_start(struct golioth_client *client,
125 const char *path,
126 enum golioth_content_type content_type);
127
133void golioth_stream_blockwise_finish(struct blockwise_transfer *ctx);
134
159 uint32_t block_idx,
160 const uint8_t *block_buffer,
161 size_t data_len,
162 bool is_last,
164 void *callback_arg);
165
167
168#ifdef __cplusplus
169}
170#endif
golioth_status
void(* golioth_set_block_cb_fn)(struct golioth_client *client, enum golioth_status status, const struct golioth_coap_rsp_code *coap_rsp_code, const char *path, size_t block_size, void *arg)
Definition client.h:174
void(* golioth_set_cb_fn)(struct golioth_client *client, enum golioth_status status, const struct golioth_coap_rsp_code *coap_rsp_code, const char *path, void *arg)
Definition client.h:233
golioth_content_type
Golioth Content Type.
Definition client.h:45
void golioth_stream_blockwise_finish(struct blockwise_transfer *ctx)
enum golioth_status(* stream_read_block_cb)(uint32_t block_idx, uint8_t *block_buffer, size_t *block_size, bool *is_last, void *arg)
Definition stream.h:93
enum golioth_status golioth_stream_set_async(struct golioth_client *client, const char *path, enum golioth_content_type content_type, const uint8_t *buf, size_t buf_len, golioth_set_cb_fn callback, void *callback_arg)
enum golioth_status golioth_stream_set_blockwise_sync(struct golioth_client *client, const char *path, enum golioth_content_type content_type, stream_read_block_cb cb, void *arg)
enum golioth_status golioth_stream_set_sync(struct golioth_client *client, const char *path, enum golioth_content_type content_type, const uint8_t *buf, size_t buf_len, int32_t timeout_s)
enum golioth_status golioth_stream_blockwise_set_block_async(struct blockwise_transfer *ctx, uint32_t block_idx, const uint8_t *block_buffer, size_t data_len, bool is_last, golioth_set_block_cb_fn callback, void *callback_arg)
struct blockwise_transfer * golioth_stream_blockwise_start(struct golioth_client *client, const char *path, enum golioth_content_type content_type)