diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-12-07 18:49:09 +0100 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-12-14 11:00:49 +0100 |
commit | e599b4ba129df475a9c8bb8290c3803f9dda664a (patch) | |
tree | 98ed8edbd2bb1bcc481fadc5ac0037c87b0608d2 /plugins | |
parent | fb487caec38c0da7a43bab850af6aa79b07befde (diff) |
Load additionnals object at runtime
Later integrated in controller submodule
Change-Id: I7d5c7431e60fc16cc2053747674fe4f14efd6a14
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/low-can.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/low-can.cpp b/plugins/low-can.cpp index 57c389e..011b9a9 100644 --- a/plugins/low-can.cpp +++ b/plugins/low-can.cpp @@ -65,7 +65,7 @@ CTLP_ONLOAD(plugin, composerHandle) memset(&pluginCtx->allDoorsCtx, 0, sizeof(allDoorsCtxT)); struct signalCBT* handle = (struct signalCBT*)composerHandle; - handle->pluginCtx = pluginCtx; + handle->pluginCtx = (void*)pluginCtx; return (void*)handle; } @@ -117,10 +117,15 @@ CTLP_CAPI (subscribeToLow, source, argsJ, eventJ) { } else { - AFB_DEBUG("Calling subscribe with %s", json_object_to_json_string_ext(pluginCtx->subscriptionBatch, JSON_C_TO_STRING_PRETTY)); + json_object_get(pluginCtx->subscriptionBatch); + AFB_DEBUG("Calling subscribe with %s", json_object_to_json_string(pluginCtx->subscriptionBatch)); err = afb_service_call_sync("low-can", "subscribe", pluginCtx->subscriptionBatch, &responseJ); if(err) - {AFB_ERROR("Subscribe to '%s' responseJ:%s", json_object_to_json_string_ext(pluginCtx->subscriptionBatch, JSON_C_TO_STRING_PRETTY), json_object_to_json_string(responseJ));} + {AFB_ERROR("Subscribe to '%s' responseJ:%s", json_object_to_json_string(pluginCtx->subscriptionBatch), json_object_to_json_string(responseJ));} + + // Renew subscription json object for the next time we need it + json_object_put(pluginCtx->subscriptionBatch); + pluginCtx->subscriptionBatch = json_object_new_array(); } return err; |