Skip to content

Commit

Permalink
coap: observations: remove token_len and normalize param order
Browse files Browse the repository at this point in the history
Remove the token_len parameter as the compile-time define is now used
throughout the SDK.

Change the appearance and type of the token param to match what is used
with other functions that create coap requests.

Signed-off-by: Mike Szczys <[email protected]>
  • Loading branch information
szczys committed Nov 8, 2024
1 parent 184aa50 commit 8794984
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/coap_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,11 +696,10 @@ enum golioth_status golioth_coap_client_observe(struct golioth_client *client,
}

enum golioth_status golioth_coap_client_observe_release(struct golioth_client *client,
const uint8_t token[GOLIOTH_COAP_TOKEN_LEN],
const char *path_prefix,
const char *path,
enum golioth_content_type content_type,
uint8_t *token,
size_t token_len,
void *arg)
{
if (!client || !path)
Expand Down
3 changes: 1 addition & 2 deletions src/coap_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,10 @@ enum golioth_status golioth_coap_client_observe(struct golioth_client *client,
void *callback_arg);

enum golioth_status golioth_coap_client_observe_release(struct golioth_client *client,
const uint8_t token[GOLIOTH_COAP_TOKEN_LEN],
const char *path_prefix,
const char *path,
enum golioth_content_type content_type,
uint8_t *token,
size_t token_len,
void *arg);

void golioth_coap_client_cancel_all_observations(struct golioth_client *client);
Expand Down
3 changes: 1 addition & 2 deletions src/coap_client_libcoap.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,11 +648,10 @@ void golioth_cancel_all_observations_by_prefix(struct golioth_client *client, co

obs_info->in_use = false;
golioth_coap_client_observe_release(client,
obs_info->req.token,
obs_info->req.path_prefix,
obs_info->req.path,
obs_info->req.observe.content_type,
obs_info->req.token,
GOLIOTH_COAP_TOKEN_LEN,
NULL);
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/zephyr_coap_req.c
Original file line number Diff line number Diff line change
Expand Up @@ -839,11 +839,10 @@ static int __golioth_coap_req_find_and_cancel_observation(

/* Enqueue an "eager release" request for this observation */
err = golioth_coap_client_observe_release(client,
coap_token,
req_msg->path_prefix,
req_msg->path,
coap_content_format,
coap_token,
GOLIOTH_COAP_TOKEN_LEN,
NULL);
if (err)
{
Expand Down

0 comments on commit 8794984

Please sign in to comment.