From 2b12954793adb2666f3f1a73da6cc3d927fc436a Mon Sep 17 00:00:00 2001 From: Mike Szczys Date: Tue, 12 Nov 2024 11:52:29 -0600 Subject: [PATCH] change async callback syntax to indicate new error reporting behavior Make a breaking change in the order of params for async callbacks to make it clear that something fundamental has changed in the callback. This, along with documentation in Doxygen and CHANGELOG is meant to raise user attention to new behavior in the golioth_response status usage. Signed-off-by: Mike Szczys --- CHANGELOG.md | 4 +++- examples/common/golioth_basics.c | 4 ++-- .../esp_idf/lightdb/delete/main/app_main.c | 2 +- examples/esp_idf/lightdb/get/main/app_main.c | 4 ++-- .../esp_idf/lightdb/observe/main/app_main.c | 2 +- examples/esp_idf/lightdb/set/main/app_main.c | 2 +- examples/esp_idf/stream/main/app_main.c | 2 +- examples/zephyr/lightdb/delete/src/main.c | 2 +- examples/zephyr/lightdb/get/src/main.c | 4 ++-- examples/zephyr/lightdb/observe/src/main.c | 2 +- examples/zephyr/lightdb/set/src/main.c | 2 +- examples/zephyr/stream/src/main.c | 2 +- include/golioth/client.h | 12 +++++----- src/coap_blockwise.c | 6 ++--- src/coap_client.h | 4 ++-- src/coap_client_libcoap.c | 22 ++++++++--------- src/coap_client_zephyr.c | 12 +++++----- src/fw_update.c | 2 +- src/lightdb_state.c | 2 +- src/ota.c | 2 +- src/rpc.c | 2 +- src/settings.c | 2 +- tests/hil/tests/lightdb/test.c | 8 +++---- tests/hil/tests/ota/test.c | 2 +- tests/unit_tests/test_rpc.c | 24 +++++++++---------- 25 files changed, 67 insertions(+), 65 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3599ab709..327d79933 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 is GOLIOTH_OK or GOLIOTH_ERR_COAP_REPONSE_CODE, read the response->status_class and response->status_code for the CoAP response code. All other response->status codes indicate an SDK error and the - CoAP response codes are invalid/undefined. + CoAP response codes are invalid/undefined. The order of the path and + response has been reversed in all async callbacks to differentiate the + new error reporting behavior. ### Fixed: diff --git a/examples/common/golioth_basics.c b/examples/common/golioth_basics.c index 63d2cb539..42a2139f7 100644 --- a/examples/common/golioth_basics.c +++ b/examples/common/golioth_basics.c @@ -85,8 +85,8 @@ static enum golioth_rpc_status on_multiply(zcbor_state_t *request_params_array, // Callback function for asynchronous get request of LightDB path "my_int" static void on_get_my_int(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, const uint8_t *payload, size_t payload_size, void *arg) @@ -105,8 +105,8 @@ static void on_get_my_int(struct golioth_client *client, // Callback function for asynchronous observation of LightDB path "desired/my_config" static void on_my_config(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, const uint8_t *payload, size_t payload_size, void *arg) diff --git a/examples/esp_idf/lightdb/delete/main/app_main.c b/examples/esp_idf/lightdb/delete/main/app_main.c index d228a582c..01774d9f6 100644 --- a/examples/esp_idf/lightdb/delete/main/app_main.c +++ b/examples/esp_idf/lightdb/delete/main/app_main.c @@ -33,8 +33,8 @@ static void on_client_event(struct golioth_client *client, } static void counter_handler(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, void *arg) { if (response->status != GOLIOTH_OK) diff --git a/examples/esp_idf/lightdb/get/main/app_main.c b/examples/esp_idf/lightdb/get/main/app_main.c index 47253d3af..8adaae5ed 100644 --- a/examples/esp_idf/lightdb/get/main/app_main.c +++ b/examples/esp_idf/lightdb/get/main/app_main.c @@ -36,8 +36,8 @@ static void on_client_event(struct golioth_client *client, } static void counter_get_handler(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, const uint8_t *payload, size_t payload_size, void *arg) @@ -103,8 +103,8 @@ static void counter_get_json_sync(struct golioth_client *client) } static void counter_get_cbor_handler(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, const uint8_t *payload, size_t payload_size, void *arg) diff --git a/examples/esp_idf/lightdb/observe/main/app_main.c b/examples/esp_idf/lightdb/observe/main/app_main.c index 03b6c1cca..472d301b2 100644 --- a/examples/esp_idf/lightdb/observe/main/app_main.c +++ b/examples/esp_idf/lightdb/observe/main/app_main.c @@ -31,8 +31,8 @@ static void on_client_event(struct golioth_client *client, } static void counter_observe_handler(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, const uint8_t *payload, size_t payload_size, void *arg) diff --git a/examples/esp_idf/lightdb/set/main/app_main.c b/examples/esp_idf/lightdb/set/main/app_main.c index cc9c8f1c6..a6fbba59f 100644 --- a/examples/esp_idf/lightdb/set/main/app_main.c +++ b/examples/esp_idf/lightdb/set/main/app_main.c @@ -34,8 +34,8 @@ static void on_client_event(struct golioth_client *client, } static void counter_set_handler(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, void *arg) { if (response->status != GOLIOTH_OK) diff --git a/examples/esp_idf/stream/main/app_main.c b/examples/esp_idf/stream/main/app_main.c index 3742b83db..bd514ddaa 100644 --- a/examples/esp_idf/stream/main/app_main.c +++ b/examples/esp_idf/stream/main/app_main.c @@ -50,8 +50,8 @@ static float get_temperature() } static void temperature_push_handler(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, void *arg) { if (response->status != GOLIOTH_OK) diff --git a/examples/zephyr/lightdb/delete/src/main.c b/examples/zephyr/lightdb/delete/src/main.c index c4925fe85..d7227749a 100644 --- a/examples/zephyr/lightdb/delete/src/main.c +++ b/examples/zephyr/lightdb/delete/src/main.c @@ -33,8 +33,8 @@ static void on_client_event(struct golioth_client *client, } static void counter_handler(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, void *arg) { if (response->status != GOLIOTH_OK) diff --git a/examples/zephyr/lightdb/get/src/main.c b/examples/zephyr/lightdb/get/src/main.c index 3b91b3ba8..65a46e20c 100644 --- a/examples/zephyr/lightdb/get/src/main.c +++ b/examples/zephyr/lightdb/get/src/main.c @@ -36,8 +36,8 @@ static void on_client_event(struct golioth_client *client, } static void counter_get_handler(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, const uint8_t *payload, size_t payload_size, void *arg) @@ -103,8 +103,8 @@ static void counter_get_json_sync(struct golioth_client *client) } static void counter_get_cbor_handler(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, const uint8_t *payload, size_t payload_size, void *arg) diff --git a/examples/zephyr/lightdb/observe/src/main.c b/examples/zephyr/lightdb/observe/src/main.c index b6ec3aead..305444f61 100644 --- a/examples/zephyr/lightdb/observe/src/main.c +++ b/examples/zephyr/lightdb/observe/src/main.c @@ -31,8 +31,8 @@ static void on_client_event(struct golioth_client *client, } static void counter_observe_handler(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, const uint8_t *payload, size_t payload_size, void *arg) diff --git a/examples/zephyr/lightdb/set/src/main.c b/examples/zephyr/lightdb/set/src/main.c index 2cdc73af4..f26464675 100644 --- a/examples/zephyr/lightdb/set/src/main.c +++ b/examples/zephyr/lightdb/set/src/main.c @@ -34,8 +34,8 @@ static void on_client_event(struct golioth_client *client, } static void counter_set_handler(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, void *arg) { if (response->status != GOLIOTH_OK) diff --git a/examples/zephyr/stream/src/main.c b/examples/zephyr/stream/src/main.c index 8235cdfb7..7a9bdae38 100644 --- a/examples/zephyr/stream/src/main.c +++ b/examples/zephyr/stream/src/main.c @@ -91,8 +91,8 @@ static int get_temperature(struct sensor_value *val) #endif static void temperature_async_push_handler(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, void *arg) { if (response->status != GOLIOTH_OK) diff --git a/include/golioth/client.h b/include/golioth/client.h index 5ebcb92a3..a8f51483c 100644 --- a/include/golioth/client.h +++ b/include/golioth/client.h @@ -152,14 +152,14 @@ typedef void (*golioth_client_event_cb_fn)(struct golioth_client *client, /// members are invalid/undefined. /// /// @param client The client handle from the original request. -/// @param response Response status and class/code /// @param path The path from the original request +/// @param response Response status and class/code /// @param payload The application layer payload in the response packet. Can be NULL. /// @param payload_size The size of payload, in bytes /// @param arg User argument, copied from the original request. Can be NULL. typedef void (*golioth_get_cb_fn)(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, const uint8_t *payload, size_t payload_size, void *arg); @@ -176,15 +176,15 @@ typedef void (*golioth_get_cb_fn)(struct golioth_client *client, /// members are invalid/undefined. /// /// @param client The client handle from the original request. -/// @param response Response status and class/code /// @param path The path from the original request +/// @param response Response status and class/code /// @param payload The application layer payload in the response packet. Can be NULL. /// @param payload_size The size of payload, in bytes /// @param is_last True if this is the final block of the get request /// @param arg User argument, copied from the original request. Can be NULL. typedef void (*golioth_get_block_cb_fn)(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, const uint8_t *payload, size_t payload_size, bool is_last, @@ -204,12 +204,12 @@ typedef void (*golioth_get_block_cb_fn)(struct golioth_client *client, /// members are invalid/undefined. /// /// @param client The client handle from the original request. -/// @param response Response status and class/code /// @param path The path from the original request +/// @param response Response status and class/code /// @param arg User argument, copied from the original request. Can be NULL. typedef void (*golioth_set_cb_fn)(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, void *arg); /// Create a Golioth client diff --git a/src/coap_blockwise.c b/src/coap_blockwise.c index 82ba5e845..e5c32a4e4 100644 --- a/src/coap_blockwise.c +++ b/src/coap_blockwise.c @@ -77,8 +77,8 @@ static void blockwise_upload_init(struct blockwise_transfer *ctx, // Blockwise upload's internal callback function that the COAP client calls static void on_block_sent(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, size_t block_szx, void *arg) { @@ -251,7 +251,7 @@ enum golioth_status golioth_blockwise_post(struct golioth_client *client, ctx->response.status = status; } - set_cb(client, &ctx->response, path, callback_arg); + set_cb(client, path, &ctx->response, callback_arg); } /* Upload complete, clean up allocated resources */ @@ -314,8 +314,8 @@ static enum golioth_status call_write_block_callback(struct blockwise_transfer * // Blockwise download's internal callback function that the COAP client calls static void on_block_rcvd(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, const uint8_t *payload, size_t payload_size, bool is_last, diff --git a/src/coap_client.h b/src/coap_client.h index 7818108a7..67674e558 100644 --- a/src/coap_client.h +++ b/src/coap_client.h @@ -29,13 +29,13 @@ /// Callback function type for blockwise uploads that also returns the blocksize in szx format /// /// @param client The client handle from the original request. -/// @param response Response status and class/code /// @param path The path from the original request +/// @param response Response status and class/code /// @param block_szx The block size from the server in coap SZX format /// @param arg User argument, copied from the original request. Can be NULL. typedef void (*golioth_set_block_cb_fn)(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, size_t block_szx, void *arg); diff --git a/src/coap_client_libcoap.c b/src/coap_client_libcoap.c index 6ca1a2968..470fb69d5 100644 --- a/src/coap_client_libcoap.c +++ b/src/coap_client_libcoap.c @@ -50,8 +50,8 @@ static void notify_observers(const coap_pdu_t *received, && (0 == memcmp(rcvd_token.s, obs_info->req.token, obs_info->req.token_len))) { callback(client, - response, obs_info->req.path, + response, data, data_len, obs_info->req.observe.arg); @@ -158,7 +158,7 @@ static coap_response_t coap_response_handler(coap_session_t *session, { if (req->get.callback) { - req->get.callback(client, &response, req->path, data, data_len, req->get.arg); + req->get.callback(client, req->path, &response, data, data_len, req->get.arg); } } else if (req->type == GOLIOTH_COAP_REQUEST_GET_BLOCK) @@ -186,8 +186,8 @@ static coap_response_t coap_response_handler(coap_session_t *session, if (req->get_block.callback) { req->get_block.callback(client, - &response, req->path, + &response, data, data_len, is_last, @@ -198,7 +198,7 @@ static coap_response_t coap_response_handler(coap_session_t *session, { if (req->post.callback) { - req->post.callback(client, &response, req->path, req->post.arg); + req->post.callback(client, req->path, &response, req->post.arg); } } else if (req->type == GOLIOTH_COAP_REQUEST_POST_BLOCK) @@ -213,8 +213,8 @@ static coap_response_t coap_response_handler(coap_session_t *session, if (req->post_block.callback) { req->post_block.callback(client, - &response, req->path, + &response, server_requested_szx, req->post_block.arg); } @@ -223,7 +223,7 @@ static coap_response_t coap_response_handler(coap_session_t *session, { if (req->delete.callback) { - req->delete.callback(client, &response, req->path, req->delete.arg); + req->delete.callback(client, req->path, &response, req->delete.arg); } } } @@ -1085,14 +1085,14 @@ static enum golioth_status coap_io_loop_once(struct golioth_client *client, if (request_msg.type == GOLIOTH_COAP_REQUEST_GET && request_msg.get.callback) { request_msg.get - .callback(client, &response, request_msg.path, NULL, 0, request_msg.get.arg); + .callback(client, request_msg.path, &response, NULL, 0, request_msg.get.arg); } else if (request_msg.type == GOLIOTH_COAP_REQUEST_GET_BLOCK && request_msg.get_block.callback) { request_msg.get_block.callback(client, - &response, request_msg.path, + &response, NULL, 0, false, @@ -1100,22 +1100,22 @@ static enum golioth_status coap_io_loop_once(struct golioth_client *client, } else if (request_msg.type == GOLIOTH_COAP_REQUEST_POST && request_msg.post.callback) { - request_msg.post.callback(client, &response, request_msg.path, request_msg.post.arg); + request_msg.post.callback(client, request_msg.path, &response, request_msg.post.arg); } else if (request_msg.type == GOLIOTH_COAP_REQUEST_POST_BLOCK && request_msg.post_block.callback) { request_msg.post_block.callback(client, - &response, request_msg.path, + &response, request_msg.post_block.block_szx, request_msg.post_block.arg); } else if (request_msg.type == GOLIOTH_COAP_REQUEST_DELETE && request_msg.delete.callback) { request_msg.delete.callback(client, - &response, request_msg.path, + &response, request_msg.delete.arg); } diff --git a/src/coap_client_zephyr.c b/src/coap_client_zephyr.c index d07cbdb14..f2d274ff7 100644 --- a/src/coap_client_zephyr.c +++ b/src/coap_client_zephyr.c @@ -267,15 +267,15 @@ static int golioth_coap_cb(struct golioth_req_rsp *rsp) if (req->get.callback) { req->get - .callback(client, &rsp->codes, req->path, rsp->data, rsp->len, req->get.arg); + .callback(client, req->path, &rsp->codes, rsp->data, rsp->len, req->get.arg); } break; case GOLIOTH_COAP_REQUEST_GET_BLOCK: if (req->get_block.callback) { req->get_block.callback(client, - &rsp->codes, req->path, + &rsp->codes, rsp->data, rsp->len, rsp->is_last, @@ -285,15 +285,15 @@ static int golioth_coap_cb(struct golioth_req_rsp *rsp) case GOLIOTH_COAP_REQUEST_POST: if (req->post.callback) { - req->post.callback(client, &rsp->codes, req->path, req->post.arg); + req->post.callback(client, req->path, &rsp->codes, req->post.arg); } break; case GOLIOTH_COAP_REQUEST_POST_BLOCK: if (req->post_block.callback) { req->post_block.callback(client, - &rsp->codes, req->path, + &rsp->codes, req->post_block.block_szx, req->post_block.arg); } @@ -301,15 +301,15 @@ static int golioth_coap_cb(struct golioth_req_rsp *rsp) case GOLIOTH_COAP_REQUEST_DELETE: if (req->delete.callback) { - req->delete.callback(client, &rsp->codes, req->path, req->delete.arg); + req->delete.callback(client, req->path, &rsp->codes, req->delete.arg); } break; case GOLIOTH_COAP_REQUEST_OBSERVE: if (req->observe.callback) { req->observe.callback(client, - &rsp->codes, req->path, + &rsp->codes, rsp->data, rsp->len, req->observe.arg); diff --git a/src/fw_update.c b/src/fw_update.c index 09cd39119..100d353df 100644 --- a/src/fw_update.c +++ b/src/fw_update.c @@ -79,8 +79,8 @@ static enum golioth_status golioth_fw_update_report_state_sync(struct golioth_cl } static void on_ota_manifest(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, const uint8_t *payload, size_t payload_size, void *arg) diff --git a/src/lightdb_state.c b/src/lightdb_state.c index 413ecc99e..cbea39b02 100644 --- a/src/lightdb_state.c +++ b/src/lightdb_state.c @@ -312,8 +312,8 @@ enum golioth_status golioth_lightdb_set_sync(struct golioth_client *client, } static void on_payload(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, const uint8_t *payload, size_t payload_size, void *arg) diff --git a/src/ota.c b/src/ota.c index 65f7a80ed..e5f2b572b 100644 --- a/src/ota.c +++ b/src/ota.c @@ -299,8 +299,8 @@ enum golioth_status golioth_ota_payload_as_manifest(const uint8_t *payload, } static void on_block_rcvd(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, const uint8_t *payload, size_t payload_size, bool is_last, diff --git a/src/rpc.c b/src/rpc.c index 478bc415b..4c97579af 100644 --- a/src/rpc.c +++ b/src/rpc.c @@ -87,8 +87,8 @@ static int params_decode(zcbor_state_t *zsd, void *value) } static void on_rpc(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, const uint8_t *payload, size_t payload_size, void *arg) diff --git a/src/settings.c b/src/settings.c index 435278c67..31edd2673 100644 --- a/src/settings.c +++ b/src/settings.c @@ -364,8 +364,8 @@ static int settings_decode(zcbor_state_t *zsd, void *value) } static void on_settings(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, const uint8_t *payload, size_t payload_size, void *arg) diff --git a/tests/hil/tests/lightdb/test.c b/tests/hil/tests/lightdb/test.c index 3d982a175..91480ff68 100644 --- a/tests/hil/tests/lightdb/test.c +++ b/tests/hil/tests/lightdb/test.c @@ -29,8 +29,8 @@ struct obs_data static struct obs_data observed_data[MAX_OBSERVED_EVENTS]; static void int_cb(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, const uint8_t *payload, size_t payload_size, void *arg) @@ -52,8 +52,8 @@ static void int_cb(struct golioth_client *client, } static void int_cbor_cb(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, const uint8_t *payload, size_t payload_size, void *arg) @@ -185,8 +185,8 @@ struct lightdb_get_rsp }; static void get_cb(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, const uint8_t *payload, size_t payload_size, void *arg) @@ -221,8 +221,8 @@ static void get_cb(struct golioth_client *client, } static void set_cb(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, void *arg) { golioth_sys_sem_t sem = arg; diff --git a/tests/hil/tests/ota/test.c b/tests/hil/tests/ota/test.c index c4b02eb31..0042b2afc 100644 --- a/tests/hil/tests/ota/test.c +++ b/tests/hil/tests/ota/test.c @@ -169,8 +169,8 @@ static void test_block_ops(void) } static void on_manifest(struct golioth_client *client, - const struct golioth_response *response, const char *path, + const struct golioth_response *response, const uint8_t *payload, size_t payload_size, void *arg) diff --git a/tests/unit_tests/test_rpc.c b/tests/unit_tests/test_rpc.c index 7c4ee4934..a4fda2da2 100644 --- a/tests/unit_tests/test_rpc.c +++ b/tests/unit_tests/test_rpc.c @@ -112,7 +112,7 @@ void test_rpc_fail(void) 'O', 'K', }; - on_rpc(NULL, &response, NULL, payload, sizeof(payload), &grpc); + on_rpc(NULL, NULL, &response, payload, sizeof(payload), &grpc); TEST_ASSERT_EQUAL(0, test_rpc_method_fn_fake.call_count); } @@ -125,7 +125,7 @@ void test_rpc_call_not_json(void) .status_class = 2, .status_code = 0, }; - on_rpc(NULL, &response, NULL, (const uint8_t *) payload, strlen(payload), &grpc); + on_rpc(NULL, NULL, &response, (const uint8_t *) payload, strlen(payload), &grpc); TEST_ASSERT_EQUAL(0, golioth_coap_client_set_fake.call_count); } @@ -153,7 +153,7 @@ void test_rpc_call_malformed(void) .status_class = 2, .status_code = 0, }; - on_rpc(NULL, &response, NULL, payload, sizeof(payload), &grpc); + on_rpc(NULL, NULL, &response, payload, sizeof(payload), &grpc); TEST_ASSERT_EQUAL_STRING("Failed to parse tstr map", last_err_msg); TEST_ASSERT_EQUAL(0, golioth_coap_client_set_fake.call_count); @@ -176,7 +176,7 @@ void test_rpc_call_no_id(void) .status_class = 2, .status_code = 0, }; - on_rpc(NULL, &response, NULL, payload, sizeof(payload), &grpc); + on_rpc(NULL, NULL, &response, payload, sizeof(payload), &grpc); TEST_ASSERT_EQUAL_STRING("Failed to parse tstr map", last_err_msg); TEST_ASSERT_EQUAL(0, golioth_coap_client_set_fake.call_count); @@ -207,7 +207,7 @@ void test_rpc_call_no_method(void) .status_class = 2, .status_code = 0, }; - on_rpc(NULL, &response, NULL, payload, sizeof(payload), &grpc); + on_rpc(NULL, NULL, &response, payload, sizeof(payload), &grpc); TEST_ASSERT_EQUAL_STRING("Failed to parse tstr map", last_err_msg); TEST_ASSERT_EQUAL(0, golioth_coap_client_set_fake.call_count); @@ -231,7 +231,7 @@ void test_rpc_call_no_params(void) 0x63, /* text(3) */ 0x31, 0x32, 0x33, /* "123" */ }; - on_rpc(NULL, &response, NULL, payload, sizeof(payload), &grpc); + on_rpc(NULL, NULL, &response, payload, sizeof(payload), &grpc); TEST_ASSERT_EQUAL_STRING("Failed to parse tstr map", last_err_msg); TEST_ASSERT_EQUAL(0, golioth_coap_client_set_fake.call_count); @@ -258,7 +258,7 @@ void test_rpc_call_not_registered(void) 0x70, 0x61, 0x72, 0x61, 0x6D, 0x73, /* "params" */ 0x80, /* array(0) */ }; - on_rpc(NULL, &response, NULL, payload, sizeof(payload), &grpc); + on_rpc(NULL, NULL, &response, payload, sizeof(payload), &grpc); TEST_ASSERT_EQUAL_STRING("Method %.*s not registered", last_wrn_msg); TEST_ASSERT_EQUAL(1, golioth_coap_client_set_fake.call_count); @@ -301,7 +301,7 @@ void test_rpc_call_one(void) 0x70, 0x61, 0x72, 0x61, 0x6D, 0x73, /* "params" */ 0x80, /* array(0) */ }; - on_rpc(NULL, &response, NULL, payload, sizeof(payload), &grpc); + on_rpc(NULL, NULL, &response, payload, sizeof(payload), &grpc); TEST_ASSERT_EQUAL(1, test_rpc_method_fn_fake.call_count); } @@ -357,7 +357,7 @@ void test_rpc_call_with_return(void) 0x70, 0x61, 0x72, 0x61, 0x6D, 0x73, /* "params" */ 0x80, /* array(0) */ }; - on_rpc(NULL, &response, NULL, payload, sizeof(payload), &grpc); + on_rpc(NULL, NULL, &response, payload, sizeof(payload), &grpc); TEST_ASSERT_EQUAL(1, test_rpc_method_fn_fake.call_count); @@ -414,7 +414,7 @@ void test_rpc_call_one_with_params(void) 0x61, /* "a" */ 0x18, 0xF8, /* unsigned(248) */ }; - on_rpc(NULL, &response, NULL, payload, sizeof(payload), &grpc); + on_rpc(NULL, NULL, &response, payload, sizeof(payload), &grpc); TEST_ASSERT_EQUAL(1, test_rpc_method_fn_fake.call_count); } @@ -446,7 +446,7 @@ void test_rpc_call_same_multiple(void) for (int i = 0; i < 100; i++) { - on_rpc(NULL, &response, NULL, payload, sizeof(payload), &grpc); + on_rpc(NULL, NULL, &response, payload, sizeof(payload), &grpc); } TEST_ASSERT_EQUAL(100, test_rpc_method_fn_fake.call_count); @@ -501,7 +501,7 @@ void test_rpc_register_many_call_all(void) 0x73, /* "params" */ 0x80, /* array(0) */ }; - on_rpc(NULL, &response, NULL, payload, sizeof(payload), &grpc); + on_rpc(NULL, NULL, &response, payload, sizeof(payload), &grpc); TEST_ASSERT_EQUAL(i + 1, test_rpc_method_fn_fake.call_count); free(method_names[i]);