summaryrefslogtreecommitdiffstats
path: root/binding
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2018-11-04 15:10:54 -0800
committerMatt Ranostay <matt.ranostay@konsulko.com>2018-11-12 03:58:47 -0800
commit672d403da4fec2455c583b541e7dc10093889b48 (patch)
treefab3b60733f3fd7ae7817d792e719f6fa0b5be89 /binding
parentb379d641c4d1862baa47c7d2522773925aa4dd43 (diff)
binding: bluetooth: add power adapter change events
Bug-AGL: SPEC-1630 Change-Id: I615cbf19d180556b0650dbf6b5ba48848be49f97 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding')
-rw-r--r--binding/bluetooth-api.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/binding/bluetooth-api.c b/binding/bluetooth-api.c
index 022ac28..58ed636 100644
--- a/binding/bluetooth-api.c
+++ b/binding/bluetooth-api.c
@@ -656,6 +656,8 @@ static void bluetooth_adapter(afb_req_t request)
int ret = adapter_set_property(ns, adapter, FALSE, "Powered",
json_object_new_boolean(str2boolean(powered)),
&error);
+ json_object *jresp = NULL;
+
if (!ret) {
afb_req_fail_f(request, "failed",
"adapter %s set_property %s error %s",
@@ -663,6 +665,16 @@ static void bluetooth_adapter(afb_req_t request)
g_error_free(error);
return;
}
+
+ jresp = json_object_new_object();
+
+ json_process_path(jresp, adapter);
+ json_object_object_add(jresp, "action",
+ json_object_new_string("changed"));
+ json_object_object_add(jresp, "powered",
+ json_object_new_boolean(str2boolean(powered)));
+
+ afb_event_push(ns->device_changes_event, jresp);
}
filter = afb_req_value(request, "filter");