summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md16
-rw-r--r--binding/bluetooth-api.c23
2 files changed, 25 insertions, 14 deletions
diff --git a/README.md b/README.md
index fa77efc..fcfd0a1 100644
--- a/README.md
+++ b/README.md
@@ -209,7 +209,21 @@ Sample of adding new adapter event:
}
</pre>
-Sample of adapter being remove:
+Sample of adapter property changes:
+
+<pre>
+{
+ "adapter": "hci0",
+ "action": "changed",
+ "properties": {
+ "powered": false,
+ "discovering": false,
+ "discoverable": false
+ }
+}
+</pre>
+
+Sample of adapter being removed:
<pre>
{
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");