summaryrefslogtreecommitdiffstats
path: root/binding-bluetooth
diff options
context:
space:
mode:
Diffstat (limited to 'binding-bluetooth')
-rw-r--r--binding-bluetooth/bluetooth-api.c14
-rw-r--r--binding-bluetooth/bluetooth-manager.c19
-rw-r--r--binding-bluetooth/bluetooth-manager.h1
3 files changed, 34 insertions, 0 deletions
diff --git a/binding-bluetooth/bluetooth-api.c b/binding-bluetooth/bluetooth-api.c
index ed5fef8..3da59d9 100644
--- a/binding-bluetooth/bluetooth-api.c
+++ b/binding-bluetooth/bluetooth-api.c
@@ -567,6 +567,19 @@ static void bt_remove_device (struct afb_req request)
}
+static void bt_device_priorities_cb (json_object *array, gchar *str)
+{
+ json_object_array_add(array, json_object_new_string(str));
+}
+
+static void bt_device_priorities (struct afb_req request)
+{
+ json_object *jarray = json_object_new_array();
+
+ device_priority_list(&bt_device_priorities_cb, jarray);
+
+ afb_req_success(request, jarray, "Display paired device priority");
+}
/**/
static void bt_set_device_property (struct afb_req request)
@@ -836,6 +849,7 @@ static const struct afb_verb_v2 binding_verbs[]= {
{ .verb = "cancel_pair", .session = AFB_SESSION_NONE, .callback = bt_cancel_pairing, .info = "Cancel the pairing process" },
{ .verb = "connect", .session = AFB_SESSION_NONE, .callback = bt_connect, .info = "Connect to special device" },
{ .verb = "disconnect", .session = AFB_SESSION_NONE, .callback = bt_disconnect, .info = "Disconnect special device" },
+{ .verb = "device_priorities", .session = AFB_SESSION_NONE, .callback = bt_device_priorities, .info = "Get BT paired device priorites" },
{ .verb = "set_device_property", .session = AFB_SESSION_NONE, .callback = bt_set_device_property, .info = "Set special device property" },
{ .verb = "set_property", .session = AFB_SESSION_NONE, .callback = bt_set_property, .info = "Set Bluetooth property" },
{ .verb = "set_avrcp_controls", .session = AFB_SESSION_NONE, .callback = bt_set_avrcp_controls, .info = "Set Bluetooth AVRCP controls" },
diff --git a/binding-bluetooth/bluetooth-manager.c b/binding-bluetooth/bluetooth-manager.c
index 2ff8925..f1d7895 100644
--- a/binding-bluetooth/bluetooth-manager.c
+++ b/binding-bluetooth/bluetooth-manager.c
@@ -190,6 +190,25 @@ GSList *bt_priority_list()
return list;
}
+int device_priority_list(void *(object_cb)(void *, gchar *), void *ptr)
+{
+ GSList *tmp;
+
+ devices_list_lock();
+
+ tmp = BluetoothManage.priorities;
+
+ while (tmp)
+ {
+ object_cb(ptr, tmp->data);
+ tmp = tmp->next;
+ }
+
+ devices_list_unlock();
+
+ return 0;
+}
+
static int device_path_cmp(struct btd_device * device, const gchar* pPath )
{
return !g_str_has_prefix (pPath, device->path);
diff --git a/binding-bluetooth/bluetooth-manager.h b/binding-bluetooth/bluetooth-manager.h
index 36222df..b469f0b 100644
--- a/binding-bluetooth/bluetooth-manager.h
+++ b/binding-bluetooth/bluetooth-manager.h
@@ -198,6 +198,7 @@ int device_connect(const gchar *addr, const gchar *uuid);
int device_disconnect(const gchar *addr, const gchar *uuid);
int device_set_property(const gchar * bdaddr, const gchar *property, const gchar *value);
int device_call_avrcp_method(const gchar* device, const gchar* method);
+int device_priority_list(void *(object_cb)(void *, gchar *), void *ptr);
int adapter_set_property(const gchar* property, gboolean value) ;