diff options
author | Tobias Jahnke <tobias.jahnke@microchip.com> | 2018-10-15 15:02:58 +0200 |
---|---|---|
committer | Tobias Jahnke <tobias.jahnke@microchip.com> | 2018-12-18 13:01:13 +0100 |
commit | 17aecba553cd2aa114e35f80589ef5d5372d4ea0 (patch) | |
tree | 01b001780ed2d7d9196036ccfbba748b132cf7bf /plugin/wrap_unicens.c | |
parent | 2fac61e232dbdc5135345a07b19a66a5ebb2a015 (diff) |
4a-hal-unicens: Support Fiberdyne Amp
Bug-AGL: SPEC-1758
Enables transmission of control messages to agl-service-unicens.
Signed-off-by: Tobias Jahnke <tobias.jahnke@microchip.com>
Diffstat (limited to 'plugin/wrap_unicens.c')
-rw-r--r-- | plugin/wrap_unicens.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/plugin/wrap_unicens.c b/plugin/wrap_unicens.c index 82d4cb4..382eea7 100644 --- a/plugin/wrap_unicens.c +++ b/plugin/wrap_unicens.c @@ -116,33 +116,31 @@ 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 ---"); - goto OnErrorExit; - - + AFB_ApiNotice(unicensHalApiHandle, "--- HAL triggering send message ---"); + /* skip data attribute if possible, wrap_json_unpack may fail to deal with * an empty Base64 string */ if (data_size > 0) wrap_json_pack(&j_query, "{s:i, s:i, s:Y}", "node", node, "msgid", msgid, "data", data_ptr, data_size); 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)); - /* err = AFB_ServiceSync(unicensHalApiHandle, "UNICENS", "sendmessage", j_query, &j_response); */ + err = AFB_ServiceSync(unicensHalApiHandle, "UNICENS", "sendmessage", j_query, &j_response); - if (err) { - AFB_ERROR("Failed to call wrap_ucs_sendmessage"); - goto OnErrorExit; + if (err != 0) { + AFB_ApiError(unicensHalApiHandle, "Failed to call wrap_ucs_sendmessage ret=%d", err); } else { - AFB_INFO("Called wrap_ucs_sendmessage, res=%s", json_object_to_json_string(j_response)); - json_object_put(j_response); + AFB_ApiNotice(unicensHalApiHandle, "Called wrap_ucs_sendmessage, successful"); } - //j_query = NULL; + if (j_response != NULL) { + AFB_ApiNotice(unicensHalApiHandle, "wrap_ucs_sendmessage, response=%s", json_object_to_json_string(j_response)); + json_object_put(j_response); + } -OnErrorExit: return err; } |