X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafm-binding.c;h=6dcac334694c0d3638055aa04f89794ca1d735cf;hb=7553044c59814c33763bb4b1c34664dceed68735;hp=f4bba8a9b485ace6fa8b1e3183416f46fab6f8c5;hpb=da4db4facb319522df538327fdad866a0f149e15;p=src%2Fapp-framework-main.git diff --git a/src/afm-binding.c b/src/afm-binding.c index f4bba8a..6dcac33 100644 --- a/src/afm-binding.c +++ b/src/afm-binding.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2018 "IoT.bzh" + * Copyright (C) 2015-2019 "IoT.bzh" * Author José Bollo * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -41,6 +41,7 @@ * constant strings */ static const char _added_[] = "added"; +static const char _all_[] = "all"; static const char _a_l_c_[] = "application-list-changed"; static const char _bad_request_[] = "bad-request"; static const char _cannot_start_[] = "cannot-start"; @@ -68,43 +69,43 @@ static const char _update_[] = "update"; static const struct afb_auth auth_perm_widget = { .type = afb_auth_Permission, - .text = "urn:AGL:permission:afm:system:widget" + .text = FWK_PREFIX"permission:afm:system:widget" }, auth_perm_widget_install = { .type = afb_auth_Permission, - .text = "urn:AGL:permission:afm:system:widget:install" + .text = FWK_PREFIX"permission:afm:system:widget:install" }, auth_perm_widget_uninstall = { .type = afb_auth_Permission, - .text = "urn:AGL:permission:afm:system:widget:uninstall" + .text = FWK_PREFIX"permission:afm:system:widget:uninstall" }, auth_perm_widget_preinstall = { .type = afb_auth_Permission, - .text = "urn:AGL:permission:afm:system:widget:preinstall" + .text = FWK_PREFIX"permission:afm:system:widget:preinstall" }, auth_perm_widget_detail = { .type = afb_auth_Permission, - .text = "urn:AGL:permission:afm:system:widget:detail" + .text = FWK_PREFIX"permission:afm:system:widget:detail" }, auth_perm_widget_start = { .type = afb_auth_Permission, - .text = "urn:AGL:permission:afm:system:widget:start" + .text = FWK_PREFIX"permission:afm:system:widget:start" }, auth_perm_widget_view_all = { .type = afb_auth_Permission, - .text = "urn:AGL:permission:afm:system:widget:view-all" + .text = FWK_PREFIX"permission:afm:system:widget:view-all" }, auth_perm_runner = { .type = afb_auth_Permission, - .text = "urn:AGL:permission:afm:system:runner" + .text = FWK_PREFIX"permission:afm:system:runner" }, auth_perm_runner_state = { .type = afb_auth_Permission, - .text = "urn:AGL:permission:afm:system:runner:state" + .text = FWK_PREFIX"permission:afm:system:runner:state" }, auth_perm_runner_kill = { .type = afb_auth_Permission, - .text = "urn:AGL:permission:afm:system:runner:kill" + .text = FWK_PREFIX"permission:afm:system:runner:kill" }, auth_install = { @@ -226,6 +227,18 @@ static const char *get_lang(afb_req_t req) return lang; } +/* + * Retrieve whether all is required from 'req'. + */ +static int get_all(afb_req_t req) +{ + struct json_object *val; + + /* get the optional language */ + return json_object_object_get_ex(afb_req_json(req), _all_, &val) + && json_object_get_boolean(val); +} + /* * retrieves the 'appid' in parameters received with the @@ -328,14 +341,18 @@ static void reply_status(afb_req_t req, int status) */ static void runnables(afb_req_t req) { + int all; const char *lang; struct json_object *resp; /* get the language */ lang = get_lang(req); + /* get the all */ + all = get_all(req); + /* get the details */ - resp = afm_udb_applications_public(afudb, afb_req_get_uid(req), lang); + resp = afm_udb_applications_public(afudb, all, afb_req_get_uid(req), lang); afb_req_success(req, resp, NULL); } @@ -473,8 +490,10 @@ static void terminate(afb_req_t req) */ static void runners(afb_req_t req) { + int all; struct json_object *resp; - resp = afm_urun_list(afudb, afb_req_get_uid(req)); + all = get_all(req); + resp = afm_urun_list(afudb, all, afb_req_get_uid(req)); afb_req_success(req, resp, NULL); } @@ -585,7 +604,7 @@ static int init(afb_api_t api) json_true = json_object_new_boolean(1); /* init database */ - afudb = afm_udb_create(1, 0, "afm-appli-"); + afudb = afm_udb_create(1, 0, "afm-"); if (!afudb) { ERROR("afm_udb_create failed"); return -1;