X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-api-so-v2.c;h=714bcd0fdda8c898bd73902b58b09c30f72356f4;hb=a05138e6bf1257b0e7b1ad90c974fb9e12f1d040;hp=7df83dd8fc05a37f81959fc2dd086da848bff5b0;hpb=e62227977bbc161d2d0ae49951f9a4fbf02a354e;p=src%2Fapp-framework-binder.git diff --git a/src/afb-api-so-v2.c b/src/afb-api-so-v2.c index 7df83dd8..714bcd0f 100644 --- a/src/afb-api-so-v2.c +++ b/src/afb-api-so-v2.c @@ -113,11 +113,38 @@ static int service_start_cb(void *closure, int share_session, int onneed) return 0; } +static void update_hooks_cb(void *closure) +{ + struct api_so_v2 *desc = closure; + afb_ditf_update_hook(&desc->ditf); +} + +static int get_verbosity_cb(void *closure) +{ + struct api_so_v2 *desc = closure; + return desc->ditf.interface.verbosity; +} + +static void set_verbosity_cb(void *closure, int level) +{ + struct api_so_v2 *desc = closure; + desc->ditf.interface.verbosity = level; +} + +static struct afb_api_itf so_v2_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_v2_add(const char *path, void *handle) { int rc; struct api_so_v2 *desc; struct afb_binding_v2 *binding; + struct afb_api afb_api; /* retrieves the register function */ binding = dlsym(handle, afb_api_so_v2_descriptor); @@ -169,10 +196,9 @@ int afb_api_so_v2_add(const char *path, void *handle) } /* records the binding */ - if (afb_apis_add(binding->api, (struct afb_api){ - .closure = desc, - .call = call_cb, - .service_start = service_start_cb }) < 0) { + afb_api.closure = desc; + afb_api.itf = &so_v2_api_itf; + if (afb_apis_add(binding->api, afb_api) < 0) { ERROR("binding [%s] can't be registered...", path); goto error2; }