summaryrefslogtreecommitdiffstats
path: root/binding
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2019-04-02 19:49:30 -0700
committerMatt Ranostay <matt.ranostay@konsulko.com>2019-04-02 20:35:22 -0700
commitcb2514f3253fb842aa7973001cc1a394afbdd5e6 (patch)
treecc751f02e0860b8363db4b6ab328fba5e6c38738 /binding
parent6e9217d3372b8d4fa737e485d361d09a85be64f0 (diff)
binding: bluetooth: add changed action for adapter_changes event
Report back property changes in the adapter_changes event, which is required for detecting when an adapter is truly powered on. Bug-AGL: SPEC-2295 Change-Id: I58441369277d2e778f2bb077e7b1be4aa3a3b1b4 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding')
-rw-r--r--binding/bluetooth-api.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/binding/bluetooth-api.c b/binding/bluetooth-api.c
index f849301..8905c6a 100644
--- a/binding/bluetooth-api.c
+++ b/binding/bluetooth-api.c
@@ -417,7 +417,8 @@ static void bluez_devices_signal_callback(
g_variant_get(parameters, "(&sa{sv}as)", &path, &array, &array1);
- if (!g_strcmp0(path, BLUEZ_DEVICE_INTERFACE)) {
+ if (!g_strcmp0(path, BLUEZ_DEVICE_INTERFACE) ||
+ !g_strcmp0(path, BLUEZ_ADAPTER_INTERFACE)) {
int cnt = 0;
jresp = json_object_new_object();
@@ -429,8 +430,15 @@ static void bluez_devices_signal_callback(
jobj = json_object_new_object();
while (g_variant_iter_next(array, "{&sv}", &key, &var)) {
- ret = device_property_dbus2json(jobj,
+ if (!g_strcmp0(path, BLUEZ_DEVICE_INTERFACE)) {
+ ret = device_property_dbus2json(jobj,
key, var, &is_config, &error);
+ event = ns->device_changes_event;
+ } else {
+ ret = adapter_property_dbus2json(jobj,
+ key, var, &is_config, &error);
+ event = ns->adapter_changes_event;
+ }
g_variant_unref(var);
if (!ret) {
AFB_DEBUG("%s property %s - %s",
@@ -852,7 +860,6 @@ 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",
@@ -861,16 +868,6 @@ 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");