From 344df6b958f7a3ce1faf8f5fde8ad6a2f5fd5ce6 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowski Date: Fri, 18 Sep 2015 01:35:57 -0700 Subject: [PATCH] core/gatt-client: fix losing notifications When notifications are quickly send to BlueZ, it tries to signal that through dbus using g_dbus_emit_property_changed, which would merge all changes and schedule sending property changed in g_iddle_add. If the stream of notifications from device is fast enough, there might be no iddle moment to send properties changed before next notification arives, which would result in notifications being lost. This patch fixes that by using method that sends properties changed immediately, without waiting for iddle moment. --- src/gatt-client.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gatt-client.c b/src/gatt-client.c index 6c10a8257..86aef7976 100644 --- a/src/gatt-client.c +++ b/src/gatt-client.c @@ -778,8 +778,10 @@ static void write_characteristic_cb(struct gatt_db_attribute *attr, int err, if (err) return; - g_dbus_emit_property_changed(btd_get_dbus_connection(), chrc->path, - GATT_CHARACTERISTIC_IFACE, "Value"); + g_dbus_emit_property_changed_full(btd_get_dbus_connection(), + chrc->path, GATT_CHARACTERISTIC_IFACE, + "Value", G_DBUS_PROPERTY_CHANGED_FLAG_FLUSH); + } static void chrc_read_cb(bool success, uint8_t att_ecode, const uint8_t *value, -- 2.47.3