summaryrefslogtreecommitdiffstats
path: root/bluetooth-api.c
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2017-06-15 19:44:41 -0700
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2017-06-20 09:49:26 +0000
commit087d927a058437a3f6379024705534365a403768 (patch)
tree37afacb4127efc35a1c7eb303e669b66b29523a3 /bluetooth-api.c
parent7cd7217604c72a5558a837a2246b008a379650ae (diff)
binding: bluetooth: allow connection to specified profile UUID
Allow connect/disconnect to a single BT UUID profile that is specified for a device. Change-Id: Ia3c67fd5f0e9b6467aa7eaae2e75dddfe80251ae Bug-AGL: SPEC-669 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'bluetooth-api.c')
-rw-r--r--bluetooth-api.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/bluetooth-api.c b/bluetooth-api.c
index 3c8d86f..79cebee 100644
--- a/bluetooth-api.c
+++ b/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);
}