summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-31 17:01:12 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-06-01 18:26:18 +0200
commit84f7395a94048df10fe88a41d6a43fdbc8f5785c (patch)
tree29fb1a4f3c67be7201788eb28c160f06d79f39ff
parenta3ea0574a55751d4df1d784d89bccca5ac76cfd6 (diff)
Fix: Don't processing filter argument
Filter is a separate json object to get, so using request arguments to retrieve it. Change-Id: I0e672a747c95ef5e7ed17dd184697265a18add9c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--CAN-binder/low-can-binding/binding/low-can-cb.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/CAN-binder/low-can-binding/binding/low-can-cb.cpp b/CAN-binder/low-can-binding/binding/low-can-cb.cpp
index dad1438f..2e3a10fb 100644
--- a/CAN-binder/low-can-binding/binding/low-can-cb.cpp
+++ b/CAN-binder/low-can-binding/binding/low-can-cb.cpp
@@ -383,7 +383,7 @@ static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe,
return rets;
}
-static int one_subscribe_unsubscribe(struct afb_req request, bool subscribe, const std::string& tag, struct json_object *event)
+static int one_subscribe_unsubscribe(struct afb_req request, bool subscribe, const std::string& tag, json_object* args)
{
int ret = 0;
struct event_filter_t event_filter;
@@ -391,7 +391,7 @@ static int one_subscribe_unsubscribe(struct afb_req request, bool subscribe, con
struct utils::signals_found sf;
// computes the filter
- if (json_object_object_get_ex(event, "filter", &filter))
+ if (json_object_object_get_ex(args, "filter", &filter))
{
if (json_object_object_get_ex(filter, "frequency", &obj)
&& (json_object_is_type(obj, json_type_double) || json_object_is_type(obj, json_type_int)))
@@ -432,11 +432,11 @@ static void do_subscribe_unsubscribe(struct afb_req request, bool subscribe)
args = afb_req_json(request);
if (args == NULL || !json_object_object_get_ex(args, "event", &event))
{
- rc = one_subscribe_unsubscribe(request, subscribe, "*", NULL);
+ rc = one_subscribe_unsubscribe(request, subscribe, "*", args);
}
else if (json_object_get_type(event) != json_type_array)
{
- rc = one_subscribe_unsubscribe(request, subscribe, json_object_get_string(event), event);
+ rc = one_subscribe_unsubscribe(request, subscribe, json_object_get_string(event), args);
}
else
{
@@ -445,7 +445,7 @@ static void do_subscribe_unsubscribe(struct afb_req request, bool subscribe)
for (i = 0 ; i < n ; i++)
{
x = json_object_array_get_idx(event, i);
- rc2 = one_subscribe_unsubscribe(request, subscribe, json_object_get_string(x), x);
+ rc2 = one_subscribe_unsubscribe(request, subscribe, json_object_get_string(x), args);
if (rc >= 0)
rc = rc2 >= 0 ? rc + rc2 : rc2;
}