summaryrefslogtreecommitdiffstats
path: root/binding
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2018-09-21 17:33:21 +0800
committerMatt Ranostay <matt.ranostay@konsulko.com>2018-11-12 03:58:47 -0800
commit8e9fed1ef996277bc192bddbeb07747a2b9981fa (patch)
tree4f92c0f6b6c29f8b75d506eb3868d2f9cdcf6c11 /binding
parentbd62c29616c02f0e629ffa4d3ae6e6cc7506f992 (diff)
binding: bluetooth: don't send empty PropertiesChanged messages
Possible to have an PropertiesChanged events that produces no changes that are useful to report. Bug-AGL: SPEC-1630 Change-Id: I09b25943e3676abd5dd0f1c8caa2c0a2414f409f Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding')
-rw-r--r--binding/bluetooth-api.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/binding/bluetooth-api.c b/binding/bluetooth-api.c
index 762a8c0..28ac6fb 100644
--- a/binding/bluetooth-api.c
+++ b/binding/bluetooth-api.c
@@ -317,6 +317,7 @@ static void bluez_devices_signal_callback(
g_variant_get(parameters, "(&sa{sv}as)", &path, &array, &array1);
if (!g_strcmp0(path, BLUEZ_DEVICE_INTERFACE)) {
+ int cnt = 0;
jresp = json_object_new_object();
@@ -336,10 +337,19 @@ static void bluez_devices_signal_callback(
"devices",
key, error->message);
g_clear_error(&error);
+ continue;
}
+ cnt++;
}
- json_object_object_add(jresp, "properties", jobj);
+ // NOTE: Possible to get a changed property for something we don't care about
+ if (cnt > 0) {
+ json_object_object_add(jresp, "properties", jobj);
+ } else {
+ json_object_put(jobj);
+ json_object_put(jresp);
+ jresp = NULL;
+ }
}
g_variant_iter_free(array);