Skip to content

Commit b1747a9

Browse files
committed
gateway: fixup after synchronous API removal
There is no 'is_synchronous' argument after removal of synchronous API. Allow to pass callbacks to golioth_gateway_server_cert_get() to expose asynchronous API. Fixes: 2db5b60 ("treewide: Remove synchronous API") Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
1 parent 83d97b6 commit b1747a9

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

include/golioth/gateway.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,15 @@ enum golioth_status golioth_gateway_server_cert_get(struct golioth_client *clien
8686
/// @param client The client handle from @ref golioth_client_create
8787
/// @param buf Pointer to buffer where certificate is stored
8888
/// @param len Certificate length
89+
/// @param set_cb A callback that will be called after certificate is set (can be NULL)
90+
/// @param callback_arg An optional user provided argument that will be passed to \p set_cb (can
91+
/// be NULL)
8992
/// @param timeout_s Timeout in seconds for API call
9093
enum golioth_status golioth_gateway_device_cert_set(struct golioth_client *client,
9194
const void *buf,
9295
size_t len,
96+
golioth_set_cb_fn set_cb,
97+
void *callback_arg,
9398
int32_t timeout_s);
9499

95100
#ifdef __cplusplus

src/gateway.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ enum golioth_status golioth_gateway_uplink_block(struct gateway_uplink *uplink,
133133
end_block_cb,
134134
callback_arg,
135135
uplink->downlink,
136-
false,
137136
GOLIOTH_SYS_WAIT_FOREVER);
138137
}
139138

@@ -218,6 +217,8 @@ enum golioth_status golioth_gateway_server_cert_get(struct golioth_client *clien
218217
enum golioth_status golioth_gateway_device_cert_set(struct golioth_client *client,
219218
const void *buf,
220219
size_t len,
220+
golioth_set_cb_fn set_cb,
221+
void *callback_arg,
221222
int32_t timeout_s)
222223
{
223224
uint8_t token[GOLIOTH_COAP_TOKEN_LEN];
@@ -230,9 +231,8 @@ enum golioth_status golioth_gateway_device_cert_set(struct golioth_client *clien
230231
GOLIOTH_CONTENT_TYPE_OCTET_STREAM,
231232
buf,
232233
len,
233-
NULL,
234-
NULL,
235-
true,
234+
set_cb,
235+
callback_arg,
236236
timeout_s);
237237
}
238238

0 commit comments

Comments
 (0)