#define TTD_CMD_KEY_CONTENT "content"
#define TTD_CMD_KEY_CONTENT_ACTION "action"
#define TTD_CMD_KEY_CONTENT_INFO "info"
+#define TTD_CMD_KEY_CONTENT_JSON "json"
#define TTD_CMD_KEY_EXTRA "extra"
static int __parse_cmd_get_action(json_object *obj)
static int __parse_cmd_info(json_object *obj, ttd_cmd_data *cmd)
{
+ json_object *content_obj = NULL;
+ json_object *json_obj = NULL;
+ void *json_data = NULL;
int action = 0;
int ret = 0;
switch (action) {
case TTD_CMD_INFO_GET_SYSINFO:
case TTD_CMD_INFO_GET_TASKINFO:
+
+ content_obj = json_object_object_get(obj, TTD_CMD_KEY_CONTENT);
+ retvm_if(!content_obj, -1, "%s", "failed to get content");
+
+ json_obj = json_object_object_get(content_obj, TTD_CMD_KEY_CONTENT_JSON);
+ retvm_if(!json_obj, -1, "failed to get content json");
+ json_data = g_strdup(json_object_get_string(json_obj));
+ if (json_data)
+ ttd_cmd_set_data(cmd, json_data, strlen(json_data), g_free);
+ else {
+ _E("failed to get json from content");
+ return -1;
+ }
+
ret = ttd_cmd_set_command(cmd, action);
break;
case TTD_CMD_INFO_GET_MAX:
items_type = json_object_get_type(items_obj);
if (items_type != json_type_array) {
- _E("cmd items are not array type");
+ _E("cmd items are not array type (is %d)", items_type);
json_object_put(root_obj);
return -1;
}