aboutsummaryrefslogtreecommitdiffstats
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-04 12:07:33 -0700
commitdb49d1d1bf5454fb371fc8c2731a0c5b1ed255d9 (patch)
tree20e2c03be4fda3966fbee1378c86a66861c796d0 /binding
parent17c4b3a74117d16315fc40eac7fb8d50007ad40e (diff)
binding: bluetooth: add changed action for adapter_changes eventguppy_7.0.1guppy/7.0.17.0.1
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 SPEC-2290 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 4c1165c..8fdb0f8 100644
--- a/binding/bluetooth-api.c
+++ b/binding/bluetooth-api.c
@@ -413,7 +413,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();
@@ -425,8 +426,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",
@@ -848,7 +856,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",
@@ -857,16 +864,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");