summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2018-09-13 13:05:50 -0700
committerMatt Ranostay <matt.ranostay@konsulko.com>2018-09-14 11:34:40 -0700
commitdd2d10a4c2d58f64c2eb7631e7429c255a89ae96 (patch)
tree55268b1a7bf66dbae49c63832e7e0576e39828be
parent5e56a1cc5a9ecd5a99aa1bcf7cd44ccf5e415a7f (diff)
binding: bluetooth: add adapter parameter to JSON outputguppy_6.90.0guppy/6.90.06.90.0
Allow subscribers to get the respective devices adapter from a BlueZ path Bug-AGL: SPEC-1720 Change-Id: Ie7fc43558d386bb010f34e64e967c0bf0f054b45 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r--binding-bluetooth/bluetooth-api.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/binding-bluetooth/bluetooth-api.c b/binding-bluetooth/bluetooth-api.c
index 8823b23..dfe946c 100644
--- a/binding-bluetooth/bluetooth-api.c
+++ b/binding-bluetooth/bluetooth-api.c
@@ -160,13 +160,17 @@ static json_object *new_json_object_from_device(struct btd_device *BDdevice, uns
{
if (BDdevice->path)
{
+ gchar **str;
+
jstring = json_object_new_string(BDdevice->path);
+ json_object_object_add(jresp, "Path", jstring);
+
+ str = g_strsplit(BDdevice->path, "/", 0);
+ jstring = json_object_new_string(str[3]);
+ g_strfreev(str);
+
+ json_object_object_add(jresp, "Adapter", jstring);
}
- else
- {
- jstring = json_object_new_string("");
- }
- json_object_object_add(jresp, "Path", jstring);
}
if (BD_ADDER & filter)