summaryrefslogtreecommitdiffstats
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-23 08:49:14 -0800
commit446fe8dcecf8fcdd3e559611ea67af6acb723974 (patch)
treecf7d6cbfd241b786fbafa5f4a32da81a067a8ddb
parenta62b8f77807c73ad7ed64757f8f877d3651bb2c8 (diff)
binding: bluetooth: add power adapter change events
Bug-AGL: SPEC-1630 Change-Id: I615cbf19d180556b0650dbf6b5ba48848be49f97 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-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");