summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2017-06-15 16:41:09 -0700
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2017-06-20 09:49:02 +0000
commit7cd7217604c72a5558a837a2246b008a379650ae (patch)
tree6edb76627f0fedc16d9c1531fbd1abc16591fd65
parentd074104294bf19d9bda3ddd6ddb110d3563472a7 (diff)
binding: bluetooth: report connection events
Subscribers to the bluetooth binding need to get reports of connection and disconnections. Bug-AGL: SPEC-669 Change-Id: I061fd7088a3a198d8004feaf594abc44c3a43f4f Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r--bluetooth-api.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/bluetooth-api.c b/bluetooth-api.c
index 04fb259..3c8d86f 100644
--- a/bluetooth-api.c
+++ b/bluetooth-api.c
@@ -497,6 +497,16 @@ static void bt_connect (struct afb_req request)
if (0 == ret)
{
+ json_object *jresp = json_object_new_object();
+ json_object *jstring;
+
+ jstring = json_object_new_string("connected");
+ json_object_object_add(jresp, "Status", jstring);
+
+ jstring = json_object_new_string(value);
+ json_object_object_add(jresp, "Address", jstring);
+
+ event_push(jresp, "connection");
afb_req_success (request, NULL, NULL);
}
else
@@ -523,6 +533,16 @@ static void bt_disconnect (struct afb_req request)
ret = device_disconnect(value, NULL);
if (0 == ret)
{
+ json_object *jresp = json_object_new_object();
+ json_object *jstring;
+
+ jstring = json_object_new_string("disconnected");
+ json_object_object_add(jresp, "Status", jstring);
+
+ jstring = json_object_new_string(value);
+ json_object_object_add(jresp, "Address", jstring);
+
+ event_push(jresp, "connection");
afb_req_success (request, NULL, NULL);
}
else