summaryrefslogtreecommitdiffstats
path: root/binding/bluetooth-util.c
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2018-10-25 13:06:27 +0100
committerMatt Ranostay <matt.ranostay@konsulko.com>2018-11-12 03:58:47 -0800
commit3d2a18623f663ddf201f60ef93405b2f03b5f979 (patch)
treec039b73f61d8ba744a28ee9870de0da41cc8c4f7 /binding/bluetooth-util.c
parent7cae41916496cd56bad7eebc3dac3f4c159d7734 (diff)
binding: bluetooth: add return_bluez_path function
Concatenate adapter and device parameters to return a bluez path for usage within the binding's dbus calls. Bug-AGL: SPEC-1630 Change-Id: I4c96fa48baaf12b23aac98ba35f1ca82f7005bcb Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding/bluetooth-util.c')
-rw-r--r--binding/bluetooth-util.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/binding/bluetooth-util.c b/binding/bluetooth-util.c
index e826aaf..3e0303f 100644
--- a/binding/bluetooth-util.c
+++ b/binding/bluetooth-util.c
@@ -1036,3 +1036,21 @@ void json_process_path(json_object *jresp, const char *path) {
json_object_object_add(jresp, "device", json_object_new_string(tmp));
g_free(tmp);
}
+
+gchar *return_bluez_path(afb_req_t request) {
+ const char *adapter, *device;
+
+ adapter = afb_req_value(request, "adapter");
+ if (!adapter) {
+ afb_req_fail(request, "failed", "No adapter parameter");
+ return NULL;
+ }
+
+ device = afb_req_value(request, "device");
+ if (!device) {
+ afb_req_fail(request, "failed", "No device parameter");
+ return NULL;
+ }
+
+ return g_strconcat("/org/bluez/", adapter, "/", device, NULL);
+}