diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2018-09-21 17:33:21 +0800 |
---|---|---|
committer | Matt Ranostay <matt.ranostay@konsulko.com> | 2018-11-23 08:49:14 -0800 |
commit | dfff48e48f646e021e6d2b8326cd7fdc3d706d9c (patch) | |
tree | ad5c5e971d6148f1233cc2100c1e59f0f619f742 /binding | |
parent | 2bde7e36883e79e2e31ae3e35bb77d2f075b7671 (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.c | 12 |
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); |