diff options
author | José Bollo <jose.bollo@iot.bzh> | 2017-05-22 16:37:28 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2017-05-22 17:01:05 +0200 |
commit | 95c29ef579d6320a721f96d7146efd10f74a201b (patch) | |
tree | 2460427281fe724014033774a7786c857332cfb4 /src/afb-monitor.c | |
parent | e9040472b72ff699964d89dda03ef07ce72b487b (diff) |
Bindings V2: Remove explicit references to daemon/service
Usage shown that managing daemon interface and service
interface wasn't obvious. This evolution hides the complexity
by setting up an internal hidden variable.
Change-Id: I667b1ee4e3a7b5ad29d712ee20ad5dd1878b97f3
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-monitor.c')
-rw-r--r-- | src/afb-monitor.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/afb-monitor.c b/src/afb-monitor.c index a0618113..35d0e150 100644 --- a/src/afb-monitor.c +++ b/src/afb-monitor.c @@ -21,7 +21,7 @@ #include <string.h> #include <json-c/json.h> -#include <afb/afb-binding.h> +#include <afb/afb-binding-v2.h> #include "afb-api.h" #include "afb-apiset.h" @@ -34,10 +34,11 @@ extern struct afb_apiset *main_apiset; +static struct afb_binding_data_v2 datav2; + int afb_monitor_init() { - static int v; - return afb_api_so_v2_add_binding(&_afb_binding_v2_monitor, NULL, main_apiset, &v); + return afb_api_so_v2_add_binding(&_afb_binding_v2_monitor, NULL, main_apiset, &datav2); } /****************************************************************************** @@ -213,6 +214,8 @@ static void get_verbosity(struct json_object *resu, struct json_object *spec) n = json_object_array_length(spec); for (i = 0 ; i < n ; i++) get_verbosity_of(resu, json_object_get_string(json_object_array_get_idx(spec, i))); + } else if (json_object_is_type(spec, json_type_string)) { + get_verbosity_of(resu, json_object_get_string(spec)); } else if (json_object_get_boolean(spec)) { get_verbosity_of(resu, ""); get_verbosity_of(resu, "*"); @@ -274,6 +277,8 @@ static void get_apis(struct json_object *resu, struct json_object *spec) n = json_object_array_length(spec); for (i = 0 ; i < n ; i++) get_one_api(resu, json_object_get_string(json_object_array_get_idx(spec, i)), NULL); + } else if (json_object_is_type(spec, json_type_string)) { + get_one_api(resu, json_object_get_string(spec), NULL); } else if (json_object_get_boolean(spec)) { afb_apiset_enum(main_apiset, get_apis_of_all_cb, resu); } |