aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-06-29 09:46:01 +0900
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-06-29 09:58:48 +0900
commit8bec06d41035de5cba0c846693f6c08c686f849b (patch)
tree145460d766182e34dbbd35fb00c3288f7825cdcb
parenta5da9bcbc5b3eb9a23cb97c8d3ef711c713e6c83 (diff)
Fix json format error
Fix the followings * The response format of getListMainConnections is strange * Fix typo of getListMainSources Change-Id: I2a42f7feb6a9e33f293f74a9a7770428608e2767 Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
-rw-r--r--src/soundmanager.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/soundmanager.c b/src/soundmanager.c
index cb2815d..9d72547 100644
--- a/src/soundmanager.c
+++ b/src/soundmanager.c
@@ -257,17 +257,16 @@ void getListMainConnections(struct afb_req request)
if(!SEND_RESULT(ec, request)) return;
/* create response */
- struct json_object *array_res = json_object_new_array();
+ struct json_object *response = json_object_new_object();
gsize size = g_variant_n_children(mainConnectionList);
AFB_DEBUG("mainConnectionList size is %u",(uint16_t)size);
- struct json_object *verb_obj = json_object_new_object();
- sm_add_object_to_json_object_func(verb_obj, __FUNCTION__, 0);
- json_object_array_add(array_res, verb_obj);
+ sm_add_object_to_json_object_func(response, __FUNCTION__, 0);
if(size <= 0)
{
AFB_NOTICE( "mainConnectionList size is 0");
}
else{
+ struct json_object *array_res = json_object_new_array();
for(int i = 0; i < size; ++i)
{
guint16 mcid, srcid, sinkid;
@@ -287,9 +286,10 @@ void getListMainConnections(struct afb_req request)
);
json_object_array_add(array_res,res_obj);
}
+ json_object_object_add(response, "connections", array_res);
}
- AFB_DEBUG("json object :%s:",json_object_to_json_string(array_res));
- afb_req_success(request, array_res, "Success to get main connection list");
+ AFB_DEBUG("json object :%s:",json_object_to_json_string(response));
+ afb_req_success(request, response, "Success to get main connection list");
}
void getListMainSources(struct afb_req request)
@@ -337,7 +337,7 @@ void getListMainSources(struct afb_req request)
json_object_array_add(array_res,res_obj);
g_variant_unref(child);
}
- json_object_object_add(response, "sinks", array_res);
+ json_object_object_add(response, "sources", array_res);
}
afb_req_success(request, response, "Success to get main source list");
g_variant_unref(mainSourceList);
@@ -1222,4 +1222,4 @@ int sm_init()
void onevent(const char *event, struct json_object *object)
{
AFB_NOTICE("on_event %s", event);
-} \ No newline at end of file
+}