From f20d1e390f25dd9f566c69968286b2ff4406ca87 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Thu, 9 May 2019 19:06:11 -0700 Subject: binding: bluetooth-map: add parser for bMessage output Parser to output more user-readable JSON of incoming messages Bug-AGL: SPEC-2351 SPEC-2392 Change-Id: Ib758f8901ff01579899112c75119596c4a0726be Signed-off-by: Matt Ranostay --- binding/bluetooth-map-api.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'binding/bluetooth-map-api.c') diff --git a/binding/bluetooth-map-api.c b/binding/bluetooth-map-api.c index c897838..df90ae5 100644 --- a/binding/bluetooth-map-api.c +++ b/binding/bluetooth-map-api.c @@ -402,10 +402,9 @@ static void map_notification_event(struct map_state *ns, gchar *filename) if (!g_file_get_contents(filename, &buf, NULL, NULL)) return; - jresp = json_object_new_object(); - json_object_object_add(jresp, "bmessage", json_object_new_string(buf)); - - afb_event_push(ns->notification_event, jresp); + jresp = bmessage_parse(buf); + if (jresp) + afb_event_push(ns->notification_event, jresp); g_free(buf); } -- cgit 1.2.3-korg