diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2019-06-24 22:02:48 -0700 |
---|---|---|
committer | Matt Ranostay <matt.ranostay@konsulko.com> | 2019-06-24 22:08:38 -0700 |
commit | 8bbb9a61ac02acd0fb723009a78dbdc810d5e20a (patch) | |
tree | 652a20f03e36d1b301d95d99a2c06e31f73d7469 /binding/bluetooth-map-api.c | |
parent | 12c52e56038b7cdb9c1f64b227136f1f0ed3247e (diff) |
binding: bluetooth-map: make list_messages response more consistent
To be more consistent with other verb responses from other bindings
put all the messages in a similiar named parameter. This allows parsing
to be easier from consumers, and allows future field additions.
Bug-AGL: SPEC-2512
Change-Id: I76131747f950e052de9ba206c0b2bf1274509e33
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding/bluetooth-map-api.c')
-rw-r--r-- | binding/bluetooth-map-api.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/binding/bluetooth-map-api.c b/binding/bluetooth-map-api.c index e09b120..98cd360 100644 --- a/binding/bluetooth-map-api.c +++ b/binding/bluetooth-map-api.c @@ -467,7 +467,7 @@ static void list_msgs(afb_req_t request) GVariantIter *iter = NULL, *iter2 = NULL; const char *folder; const gchar *path = NULL; - json_object *jresp; + json_object *jresp, *jmessage; gchar *session; folder = afb_req_value(request, "folder"); @@ -496,6 +496,8 @@ static void list_msgs(afb_req_t request) } jresp = json_object_new_object(); + jmessage = json_object_new_object(); + json_object_object_add(jresp, "messages", jmessage); g_variant_get(reply, "(a{oa{sv}})", &iter); while (g_variant_iter_loop(iter, "{oa{sv}}", &path, &iter2)) { @@ -517,7 +519,7 @@ static void list_msgs(afb_req_t request) g_clear_error(&error); } } - json_object_object_add(jresp, path + strlen(session) + 1, msg); + json_object_object_add(jmessage, path + strlen(session) + 1, msg); } afb_req_success_f(request, jresp, "Bluetooth MAP folder listing"); |