X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=bindings%2Fsamples%2Fhello3.c;h=f49b3365cb070936464d1e38f955a9400a3fc95f;hb=refs%2Ftags%2Fflounder_5.99.2;hp=0136d223f802dcfd292ae3c29fd63c87e950fceb;hpb=525e9eaa644ca92fad23adfbb7c3119ae8b57a30;p=src%2Fapp-framework-binder.git diff --git a/bindings/samples/hello3.c b/bindings/samples/hello3.c index 0136d223..f49b3365 100644 --- a/bindings/samples/hello3.c +++ b/bindings/samples/hello3.c @@ -175,7 +175,6 @@ static void subcallcb (void *prequest, int status, json_object *object, afb_req_ afb_req_fail(request, "failed", json_object_to_json_string(object)); else afb_req_success(request, json_object_get(object), NULL); - afb_req_unref(request); } static void subcall (afb_req_t request) @@ -421,6 +420,37 @@ static void uid (afb_req_t request) afb_req_success_f(request, json_object_new_int(uid), "uid is %d", uid); } +static void closess (afb_req_t request) +{ + afb_req_session_close(request); + afb_req_reply(request, NULL, NULL, "session closed"); +} + +static void setloa (afb_req_t request) +{ + int loa = json_object_get_int(afb_req_json(request)); + afb_req_session_set_LOA(request, loa); + afb_req_reply_f(request, NULL, NULL, "LOA set to %d", loa); +} + +static void setctx (afb_req_t request) +{ + struct json_object *x = afb_req_json(request); + afb_req_context(request, (int)(intptr_t)afb_req_get_vcbdata(request), (void*)json_object_get, (void*)json_object_put, x); + afb_req_reply(request, json_object_get(x), NULL, "context set"); +} + +static void getctx (afb_req_t request) +{ + struct json_object *x = afb_req_context(request, 0, 0, 0, 0); + afb_req_reply(request, json_object_get(x), NULL, "returning the context"); +} + +static void info (afb_req_t request) +{ + afb_req_reply(request, afb_req_get_client_info(request), NULL, NULL); +} + static int preinit(afb_api_t api) { AFB_NOTICE("hello binding comes to live"); @@ -463,6 +493,12 @@ static const struct afb_verb_v3 verbs[]= { { .verb="appid", .callback=appid }, { .verb="uid", .callback=uid }, { .verb="exit", .callback=exitnow }, + { .verb="close", .callback=closess }, + { .verb="set-loa", .callback=setloa }, + { .verb="setctx", .callback=setctx, .vcbdata = (void*)(intptr_t)1 }, + { .verb="setctxif", .callback=setctx, .vcbdata = (void*)(intptr_t)0 }, + { .verb="getctx", .callback=getctx }, + { .verb="info", .callback=info }, { .verb=NULL} };