aboutsummaryrefslogtreecommitdiffstats
path: root/binding/bluetooth-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'binding/bluetooth-util.c')
-rw-r--r--binding/bluetooth-util.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/binding/bluetooth-util.c b/binding/bluetooth-util.c
index f57b43e..21aae6c 100644
--- a/binding/bluetooth-util.c
+++ b/binding/bluetooth-util.c
@@ -1051,3 +1051,18 @@ gchar *return_bluez_path(afb_req_t request) {
return g_strconcat("/org/bluez/", adapter, "/", device, NULL);
}
+
+gchar **json_array_to_strv(json_object *jobj)
+{
+ int len = json_object_array_length(jobj);
+ gchar **val = g_malloc0(sizeof(gchar *) * (len + 1));
+ int i;
+
+ for (i = 0; i < len; i++) {
+ json_object *jstr = json_object_array_get_idx(jobj, i);
+ const char *str = json_object_get_string(jstr);
+ val[i] = g_strdup(str);
+ }
+
+ return val;
+}