X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fappfwk.c;h=a8ae6c82af7271314d672acc4b58ce70d784f8e3;hb=5f53ea07c7ebe72b36abd41a297ffa49e79adbc0;hp=6a625ca8a17eae2eb24689c5820ca7f99de0ad50;hpb=41e3ea4dbae634ca13941d134e990d953b741c4b;p=src%2Fapp-framework-main.git diff --git a/src/appfwk.c b/src/appfwk.c index 6a625ca..a8ae6c8 100644 --- a/src/appfwk.c +++ b/src/appfwk.c @@ -38,7 +38,6 @@ struct appfwk { int nrroots; char **roots; struct afapps applications; - struct json_object *runners; }; struct appfwk *appfwk_create() @@ -47,19 +46,12 @@ struct appfwk *appfwk_create() if (appfwk == NULL) errno = ENOMEM; else { - appfwk->runners = json_object_new_object(); - if (appfwk->runners == NULL) { - free(appfwk); - appfwk = NULL; - errno = ENOMEM; - } else { - appfwk->refcount = 1; - appfwk->nrroots = 0; - appfwk->roots = NULL; - appfwk->applications.pubarr = NULL; - appfwk->applications.direct = NULL; - appfwk->applications.byapp = NULL; - } + appfwk->refcount = 1; + appfwk->nrroots = 0; + appfwk->roots = NULL; + appfwk->applications.pubarr = NULL; + appfwk->applications.direct = NULL; + appfwk->applications.byapp = NULL; } return appfwk; } @@ -77,7 +69,6 @@ void appfwk_unref(struct appfwk *appfwk) json_object_put(appfwk->applications.pubarr); json_object_put(appfwk->applications.direct); json_object_put(appfwk->applications.byapp); - json_object_put(appfwk->runners); while (appfwk->nrroots) free(appfwk->roots[--appfwk->nrroots]); free(appfwk->roots); @@ -345,9 +336,8 @@ struct json_object *appfwk_application_list(struct appfwk *af) struct json_object *appfwk_get_application(struct appfwk *af, const char *id) { struct json_object *result; - if (!appfwk_ensure_applications(af) && json_object_object_get_ex(obj, id, &result)) + if (!appfwk_ensure_applications(af) && json_object_object_get_ex(af->applications.direct, id, &result)) return result; - } return NULL; } @@ -357,86 +347,6 @@ struct json_object *appfwk_get_application_public(struct appfwk *af, const char return result && json_object_object_get_ex(result, "public", &result) ? result : NULL; } -static struct json_object *mkrunner(const char *appid, const char *runid) -{ - struct json_object *result = json_object_new_object(); - if (result) { - if(json_add_str(result, "id", appid) - || json_add_str(result, "runid", runid) - || json_add_str(result, "state", NULL)) { - json_object_put(result); - result = NULL; - } - } - return result; -} - -const char *appfwk_start(struct appfwk *af, const char *appid) -{ - struct json_object *appli; - struct json_object *runner; - char buffer[250]; - - /* get the application description */ - appli = appfwk_get_application(af, appid); - if (appli == NULL) { - errno = ENOENT; - return -1; - } - - /* prepare the execution */ - snprintf(buffer, sizeof buffer, "{\"id\":\"%s\",\"runid\":\"%s\" -} - -int appfwk_stop(struct appfwk *af, const char *runid) -{ - struct json_object *runner; - runner = appfwk_state(af, runid); - if (runner == NULL) { - errno = ENOENT; - return -1; - } - json_object_get(runner); - json_object_object_del(af->runners, runid); - - - - - - -.......... - - - - - - - json_object_put(runner); -} - -int appfwk_suspend(struct appfwk *af, const char *runid) -{ -} - -int appfwk_resume(struct appfwk *af, const char *runid) -{ -} - -struct json_object *appfwk_running_list(struct appfwk *af) -{ - return af->runners; -} - -struct json_object *appfwk_state(struct appfwk *af, const char *runid) -{ - struct json_object *result; - int status = json_object_object_get_ex(af->runners, runid, &result); - return status ? result : NULL; -} - - - -