diff options
author | Frederic Marec <frederic.marec@iot.bzh> | 2019-05-10 10:54:58 +0200 |
---|---|---|
committer | Frederic Marec <frederic.marec@iot.bzh> | 2019-05-14 09:51:57 +0200 |
commit | 88211e8b9cb19ecec8c28c1de19e0d42dadcb916 (patch) | |
tree | 2c06a6f5db06211dc2894efc01f249c8aa247dd0 /plugin/unicens-output/wrap_unicens.c | |
parent | 9228c9da5b85f0fdd6b01f0309e57b846618be63 (diff) |
Git submodule migration to separated librariesicefish_8.99.5icefish_8.99.4icefish_8.99.3icefish_8.99.2icefish_8.99.1icefish/8.99.5icefish/8.99.4icefish/8.99.3icefish/8.99.2icefish/8.99.1halibut_8.0.6halibut_8.0.5halibut_8.0.4halibut_8.0.3halibut_8.0.2halibut_8.0.1halibut_8.0.0halibut_7.99.3halibut_7.99.2halibut_7.99.1halibut/8.0.6halibut/8.0.5halibut/8.0.4halibut/8.0.3halibut/8.0.2halibut/8.0.1halibut/8.0.0halibut/7.99.3halibut/7.99.2halibut/7.99.18.99.58.99.48.99.38.99.28.99.18.0.68.0.58.0.48.0.38.0.28.0.18.0.07.99.37.99.27.99.1halibut
Bug-AGL: SPEC-2139
Change-Id: I6f1227f7b293b6a3dc8d527e18cd482955783021
Signed-off-by: Frederic Marec <frederic.marec@iot.bzh>
Diffstat (limited to 'plugin/unicens-output/wrap_unicens.c')
-rw-r--r-- | plugin/unicens-output/wrap_unicens.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/plugin/unicens-output/wrap_unicens.c b/plugin/unicens-output/wrap_unicens.c index 382eea7..1c16a08 100644 --- a/plugin/unicens-output/wrap_unicens.c +++ b/plugin/unicens-output/wrap_unicens.c @@ -44,7 +44,7 @@ typedef struct parse_result_ { * Subscribes to unicens2-binding events. * \return Returns 0 if successful, otherwise != 0". */ -extern int wrap_ucs_subscribe_sync(AFB_ApiT apiHandle) +extern int wrap_ucs_subscribe_sync(afb_api_t apiHandle) { int err; @@ -52,16 +52,16 @@ extern int wrap_ucs_subscribe_sync(AFB_ApiT apiHandle) /* Build an empty JSON object */ if((err = wrap_json_pack(&j_query, "{}"))) { - AFB_ApiError(apiHandle, "Failed to create subscribe json object"); + AFB_API_ERROR(apiHandle, "Failed to create subscribe json object"); return err; } - if((err = AFB_ServiceSync(apiHandle, "UNICENS", "subscribe", j_query, &j_response))) { - AFB_ApiError(apiHandle, "Fail subscribing to UNICENS events"); + if((err = afb_api_call_sync_legacy(apiHandle, "UNICENS", "subscribe", j_query, &j_response))) { + AFB_API_ERROR(apiHandle, "Fail subscribing to UNICENS events"); return err; } else { - AFB_ApiNotice(apiHandle, "Subscribed to UNICENS events, res=%s", json_object_to_json_string(j_response)); + AFB_API_NOTICE(apiHandle, "Subscribed to UNICENS events, res=%s", json_object_to_json_string(j_response)); json_object_put(j_response); } @@ -75,7 +75,7 @@ extern int wrap_ucs_subscribe_sync(AFB_ApiT apiHandle) * \param data_sz Size of the command data. Valid values: 1..32. * \return Returns 0 if successful, otherwise != 0". */ -extern int wrap_ucs_i2cwrite_sync(AFB_ApiT apiHandle, uint16_t node, uint8_t *data_ptr, uint8_t data_sz) +extern int wrap_ucs_i2cwrite_sync(afb_api_t apiHandle, uint16_t node, uint8_t *data_ptr, uint8_t data_sz) { int err; uint8_t cnt; @@ -86,7 +86,7 @@ extern int wrap_ucs_i2cwrite_sync(AFB_ApiT apiHandle, uint16_t node, uint8_t *da j_array = json_object_new_array(); if(! j_query || ! j_array) { - AFB_ApiError(apiHandle, "Failed to create writei2c json objects"); + AFB_API_ERROR(apiHandle, "Failed to create writei2c json objects"); return -1; } @@ -96,12 +96,12 @@ extern int wrap_ucs_i2cwrite_sync(AFB_ApiT apiHandle, uint16_t node, uint8_t *da json_object_object_add(j_query, "node", json_object_new_int(node)); json_object_object_add(j_query, "data", j_array); - if((err = AFB_ServiceSync(apiHandle, "UNICENS", "writei2c", j_query, &j_response))) { - AFB_ApiError(apiHandle, "Failed to call writei2c_sync"); + if((err = afb_api_call_sync_legacy(apiHandle, "UNICENS", "writei2c", j_query, &j_response))) { + AFB_API_ERROR(apiHandle, "Failed to call writei2c_sync"); return err; } else { - AFB_ApiInfo(apiHandle, "Called writei2c_sync, res=%s", json_object_to_json_string(j_response)); + AFB_API_INFO(apiHandle, "Called writei2c_sync, res=%s", json_object_to_json_string(j_response)); json_object_put(j_response); } @@ -116,7 +116,7 @@ extern int wrap_ucs_sendmessage_sync(uint16_t src_addr, uint16_t msg_id, uint8_t int msgid = (int)msg_id; size_t data_size = (size_t)data_sz; - AFB_ApiNotice(unicensHalApiHandle, "--- HAL triggering send message ---"); + AFB_API_NOTICE(unicensHalApiHandle, "--- HAL triggering send message ---"); /* skip data attribute if possible, wrap_json_unpack may fail to deal with * an empty Base64 string */ @@ -125,19 +125,19 @@ extern int wrap_ucs_sendmessage_sync(uint16_t src_addr, uint16_t msg_id, uint8_t else wrap_json_pack(&j_query, "{s:i, s:i}", "node", node, "msgid", msgid); - AFB_ApiNotice(unicensHalApiHandle, "wrap_ucs_sendmessage: jquery=%s", json_object_to_json_string(j_query)); + AFB_API_NOTICE(unicensHalApiHandle, "wrap_ucs_sendmessage: jquery=%s", json_object_to_json_string(j_query)); - err = AFB_ServiceSync(unicensHalApiHandle, "UNICENS", "sendmessage", j_query, &j_response); + err = afb_api_call_sync_legacy(unicensHalApiHandle, "UNICENS", "sendmessage", j_query, &j_response); if (err != 0) { - AFB_ApiError(unicensHalApiHandle, "Failed to call wrap_ucs_sendmessage ret=%d", err); + AFB_API_ERROR(unicensHalApiHandle, "Failed to call wrap_ucs_sendmessage ret=%d", err); } else { - AFB_ApiNotice(unicensHalApiHandle, "Called wrap_ucs_sendmessage, successful"); + AFB_API_NOTICE(unicensHalApiHandle, "Called wrap_ucs_sendmessage, successful"); } if (j_response != NULL) { - AFB_ApiNotice(unicensHalApiHandle, "wrap_ucs_sendmessage, response=%s", json_object_to_json_string(j_response)); + AFB_API_NOTICE(unicensHalApiHandle, "wrap_ucs_sendmessage, response=%s", json_object_to_json_string(j_response)); json_object_put(j_response); } @@ -145,11 +145,11 @@ extern int wrap_ucs_sendmessage_sync(uint16_t src_addr, uint16_t msg_id, uint8_t } /* ---------------------------- ASYNCHRONOUS API ---------------------------- */ -static void wrap_ucs_i2cwrite_cb(void *closure, int status, struct json_object *j_result, AFB_ApiT apiHandle) +static void wrap_ucs_i2cwrite_cb(void *closure, int status, struct json_object *j_result, afb_api_t apiHandle) { async_job_t *job_ptr; - AFB_ApiInfo(apiHandle, "%s: closure=%p status=%d, res=%s", __func__, closure, status, json_object_to_json_string(j_result)); + AFB_API_INFO(apiHandle, "%s: closure=%p status=%d, res=%s", __func__, closure, status, json_object_to_json_string(j_result)); if(closure) { job_ptr = (async_job_t *) closure; @@ -183,7 +183,7 @@ extern int wrap_ucs_i2cwrite(uint16_t node, j_array = json_object_new_array(); if(! j_query || ! j_array) { - AFB_ApiError(unicensHalApiHandle, "Failed to create writei2c json objects"); + AFB_API_ERROR(unicensHalApiHandle, "Failed to create writei2c json objects"); return -1; } @@ -196,7 +196,7 @@ extern int wrap_ucs_i2cwrite(uint16_t node, job_ptr = malloc(sizeof(async_job_t)); if(! job_ptr) { - AFB_ApiError(unicensHalApiHandle, "Failed to create async job object"); + AFB_API_ERROR(unicensHalApiHandle, "Failed to create async job object"); json_object_put(j_query); return -2; } @@ -204,7 +204,7 @@ extern int wrap_ucs_i2cwrite(uint16_t node, job_ptr->result_fptr = result_fptr; job_ptr->result_user_ptr = result_user_ptr; - AFB_ServiceCall(unicensHalApiHandle, "UNICENS", "writei2c", j_query, wrap_ucs_i2cwrite_cb, job_ptr); + afb_api_call_legacy(unicensHalApiHandle, "UNICENS", "writei2c", j_query, wrap_ucs_i2cwrite_cb, job_ptr); return 0; } |