diff options
Diffstat (limited to 'binding-bluetooth')
-rw-r--r-- | binding-bluetooth/bluetooth-api.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/binding-bluetooth/bluetooth-api.c b/binding-bluetooth/bluetooth-api.c index 3c8d86f..79cebee 100644 --- a/binding-bluetooth/bluetooth-api.c +++ b/binding-bluetooth/bluetooth-api.c @@ -485,6 +485,7 @@ static void bt_connect (struct afb_req request) LOGD("\n"); const char *value = afb_req_value (request, "value"); + const char *uuid = afb_req_value (request, "uuid"); int ret = 0; if (NULL == value) @@ -493,7 +494,7 @@ static void bt_connect (struct afb_req request) return; } - ret = device_connect(value, NULL); + ret = device_connect(value, uuid); if (0 == ret) { @@ -506,6 +507,11 @@ static void bt_connect (struct afb_req request) jstring = json_object_new_string(value); json_object_object_add(jresp, "Address", jstring); + if (uuid) { + jstring = json_object_new_string(uuid); + json_object_object_add(jresp, "UUID", jstring); + } + event_push(jresp, "connection"); afb_req_success (request, NULL, NULL); } @@ -522,6 +528,7 @@ static void bt_disconnect (struct afb_req request) LOGD("\n"); const char *value = afb_req_value (request, "value"); + const char *uuid = afb_req_value (request, "uuid"); int ret = 0; if (NULL == value) @@ -542,6 +549,11 @@ static void bt_disconnect (struct afb_req request) jstring = json_object_new_string(value); json_object_object_add(jresp, "Address", jstring); + if (uuid) { + jstring = json_object_new_string(uuid); + json_object_object_add(jresp, "UUID", jstring); + } + event_push(jresp, "connection"); afb_req_success (request, NULL, NULL); } |