X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-api-so-v1.c;h=4ec378e1b896a027d3d907d9abd2ff3dd0683114;hb=43d031e1833c5d373600cf44c05d760ade9a150d;hp=f9c1ef38b4e0086cad0a1547dbfc3a8aaf6deb89;hpb=e62227977bbc161d2d0ae49951f9a4fbf02a354e;p=src%2Fapp-framework-binder.git diff --git a/src/afb-api-so-v1.c b/src/afb-api-so-v1.c index f9c1ef38..4ec378e1 100644 --- a/src/afb-api-so-v1.c +++ b/src/afb-api-so-v1.c @@ -115,10 +115,37 @@ static int service_start_cb(void *closure, int share_session, int onneed) return 0; } +static void update_hooks_cb(void *closure) +{ + struct api_so_v1 *desc = closure; + afb_ditf_update_hook(&desc->ditf); +} + +static int get_verbosity_cb(void *closure) +{ + struct api_so_v1 *desc = closure; + return desc->ditf.interface.verbosity; +} + +static void set_verbosity_cb(void *closure, int level) +{ + struct api_so_v1 *desc = closure; + desc->ditf.interface.verbosity = level; +} + +static struct afb_api_itf so_v1_api_itf = { + .call = call_cb, + .service_start = service_start_cb, + .update_hooks = update_hooks_cb, + .get_verbosity = get_verbosity_cb, + .set_verbosity = set_verbosity_cb +}; + int afb_api_so_v1_add(const char *path, void *handle) { struct api_so_v1 *desc; struct afb_binding *(*register_function) (const struct afb_binding_interface *interface); + struct afb_api afb_api; /* retrieves the register function */ register_function = dlsym(handle, afb_api_so_v1_register); @@ -169,10 +196,9 @@ int afb_api_so_v1_add(const char *path, void *handle) /* records the binding */ afb_ditf_rename(&desc->ditf, desc->binding->v1.prefix); - if (afb_apis_add(desc->binding->v1.prefix, (struct afb_api){ - .closure = desc, - .call = call_cb, - .service_start = service_start_cb }) < 0) { + afb_api.closure = desc; + afb_api.itf = &so_v1_api_itf; + if (afb_apis_add(desc->binding->v1.prefix, afb_api) < 0) { ERROR("binding [%s] can't be registered...", path); goto error2; }