static struct jbus *jbus;
static struct appfwk *appfwk;
const char error_nothing[] = "[]";
static struct jbus *jbus;
static struct appfwk *appfwk;
const char error_nothing[] = "[]";
const char error_not_found[] = "{\"status\":\"error: not found\"}";
static const char *getappid(struct json_object *obj)
const char error_not_found[] = "{\"status\":\"error: not found\"}";
static const char *getappid(struct json_object *obj)
static void on_start(struct jreq *jreq, struct json_object *obj)
{
const char *appid = getappid(obj);
static void on_start(struct jreq *jreq, struct json_object *obj)
{
const char *appid = getappid(obj);
- const char *runid = getrunid(obj);
- int status = appfwk_stop(appfwk, runid);
+ int runid = getrunid(obj);
+ int status = appfwk_run_stop(runid);
jbus_replyj(jreq, status ? error_not_found : "true");
json_object_put(obj);
}
static void on_suspend(struct jreq *jreq, struct json_object *obj)
{
jbus_replyj(jreq, status ? error_not_found : "true");
json_object_put(obj);
}
static void on_suspend(struct jreq *jreq, struct json_object *obj)
{
- const char *runid = getrunid(obj);
- int status = appfwk_suspend(appfwk, runid);
+ int runid = getrunid(obj);
+ int status = appfwk_run_suspend(runid);
jbus_replyj(jreq, status ? error_not_found : "true");
json_object_put(obj);
}
static void on_resume(struct jreq *jreq, struct json_object *obj)
{
jbus_replyj(jreq, status ? error_not_found : "true");
json_object_put(obj);
}
static void on_resume(struct jreq *jreq, struct json_object *obj)
{
- const char *runid = getrunid(obj);
- int status = appfwk_resume(appfwk, runid);
+ int runid = getrunid(obj);
+ int status = appfwk_run_resume(runid);
jbus_replyj(jreq, status ? error_not_found : "true");
json_object_put(obj);
}
static void on_runners(struct jreq *jreq, struct json_object *obj)
{
jbus_replyj(jreq, status ? error_not_found : "true");
json_object_put(obj);
}
static void on_runners(struct jreq *jreq, struct json_object *obj)
{
- const char *runid = getrunid(obj);
- int status = appfwk_state(appfwk, runid);
- jbus_replyj(jreq, status ? error_not_found : "true");
+ int runid = getrunid(obj);
+ struct json_object *resp = appfwk_run_state(runid);
+ reply(jreq, resp, error_not_found);
}
if(jbus_add_service(jbus, "runnables", on_runnables)
|| jbus_add_service(jbus, "detail", on_detail)
}
if(jbus_add_service(jbus, "runnables", on_runnables)
|| jbus_add_service(jbus, "detail", on_detail)
|| jbus_add_service(jbus, "stop", on_stop)
|| jbus_add_service(jbus, "suspend", on_suspend)
|| jbus_add_service(jbus, "resume", on_resume)
|| jbus_add_service(jbus, "stop", on_stop)
|| jbus_add_service(jbus, "suspend", on_suspend)
|| jbus_add_service(jbus, "resume", on_resume)