-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;
-}
-
-
-
-