aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-04-11 19:59:32 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2019-04-11 20:39:06 +0200
commit6503346aced4baada6ea7dec88fe9bbbb03f9b57 (patch)
tree91c838368af4724ac4542c7594d97c1c99660834
parent8ef54e0215c06241c3487f78dd2ea50fbe6af903 (diff)
Fix to fit apiv3 only new controller version
This fix a problem in plugins since the migration of the controller to use only apiV3. Now, the plugins does not get back the binding api root and so you can not use the binder's verbosity macro that use implicitly the api root. Bug-AGL: SPEC-2312 Change-Id: I0b29354087f5ec93a081ad11b2cbccf28e423d60 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--plugins/low-can.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/plugins/low-can.cpp b/plugins/low-can.cpp
index 8eec886..f6ff98e 100644
--- a/plugins/low-can.cpp
+++ b/plugins/low-can.cpp
@@ -52,7 +52,6 @@ void setDoor(doorT* aDoor, const char* eventName, json_object* eventStatus)
if(json_object_is_type(eventStatus, json_type_boolean)) {
if(strcasestr(eventName, "door")) aDoor->door = eventStatus;
else if(strcasestr(eventName, "window")) aDoor->window = eventStatus;
- else AFB_WARNING("Unexpected behavior, this '%s' is not a door ! ", eventName);
}
}
@@ -92,7 +91,7 @@ CTLP_CAPI (subscribeToLow, source, argsJ, eventJ) {
"getSignalsArgs", &filterJ);
if(err)
{
- AFB_ERROR("Problem to unpack JSON object eventJ: %s",
+ AFB_API_ERROR(source->api, "Problem to unpack JSON object eventJ: %s",
json_object_to_json_string(eventJ));
return err;
}
@@ -112,7 +111,7 @@ CTLP_CAPI (subscribeToLow, source, argsJ, eventJ) {
"filter", subscribeFilterJ);
if(err)
{
- AFB_ERROR("Error building subscription query object");
+ AFB_API_ERROR(source->api, "Error building subscription query object");
return err;
}
json_object_array_add(pluginCtx->subscriptionBatch, subscribeArgsJ);
@@ -120,10 +119,10 @@ CTLP_CAPI (subscribeToLow, source, argsJ, eventJ) {
else
{
json_object_get(pluginCtx->subscriptionBatch);
- AFB_DEBUG("Calling subscribe with %s", json_object_to_json_string(pluginCtx->subscriptionBatch));
+ AFB_API_DEBUG(source->api, "Calling subscribe with %s", json_object_to_json_string(pluginCtx->subscriptionBatch));
err = afb_api_call_sync_legacy(source->api, "low-can", "subscribe", pluginCtx->subscriptionBatch, &responseJ);
if(err)
- {AFB_ERROR("Subscribe to '%s' responseJ:%s", json_object_to_json_string(pluginCtx->subscriptionBatch), json_object_to_json_string(responseJ));}
+ {AFB_API_ERROR(source->api, "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);
@@ -146,7 +145,7 @@ CTLP_CAPI (isOpen, source, argsJ, eventJ) {
"timestamp", &timestamp);
if(err)
{
- AFB_ERROR("Error parsing event %s", json_object_to_json_string(eventJ));
+ AFB_API_ERROR(source->api, "Error parsing event %s", json_object_to_json_string(eventJ));
return -1;
}
@@ -172,11 +171,11 @@ CTLP_CAPI (isOpen, source, argsJ, eventJ) {
}
else
{
- AFB_WARNING("Unexpected behavior, this '%s' is it really a door ! ", json_object_to_json_string(eventJ));
+ AFB_API_WARNING(source->api, "Unexpected behavior, this '%s' is it really a door ! ", json_object_to_json_string(eventJ));
return -1;
}
- AFB_DEBUG("This is the situation: source:%s, args:%s, event:%s,\n fld: %s, flw: %s, frd: %s, frw: %s, rld: %s, rlw: %s, rrd: %s, rrw: %s",
+ AFB_API_DEBUG(source->api, "This is the situation: source:%s, args:%s, event:%s,\n fld: %s, flw: %s, frd: %s, frw: %s, rld: %s, rlw: %s, rrd: %s, rrw: %s",
source->uid,
argsJ ? json_object_to_json_string(argsJ):"",
eventJ ? json_object_to_json_string(eventJ):"",