From f12dc48511204eb0c7f1366fdb1421a39339ef9c Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 13 Feb 2019 16:25:05 +0200 Subject: [PATCH] client: Forward notifications from cloned attributes Notifications come in a form of 'Value' property changes thus this copies the values to the local attribute so they are in sync. --- client/gatt.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/client/gatt.c b/client/gatt.c index b24ebdc61..288aa0895 100644 --- a/client/gatt.c +++ b/client/gatt.c @@ -2915,6 +2915,23 @@ static void proxy_property_changed(GDBusProxy *proxy, const char *name, DBusConnection *conn = bt_shell_get_env("DBUS_CONNECTION"); struct chrc *chrc = user_data; + bt_shell_printf("[" COLORED_CHG "] Attribute %s (%s) %s:\n", + chrc->path, bt_uuidstr_to_str(chrc->uuid), name); + + if (!strcmp(name, "Value")) { + DBusMessageIter array; + uint8_t *value; + int len; + + if (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_ARRAY) { + dbus_message_iter_recurse(iter, &array); + dbus_message_iter_get_fixed_array(&array, &value, &len); + write_value(&chrc->value_len, &chrc->value, value, len, + 0, chrc->max_val_len); + bt_shell_hexdump(value, len); + } + } + g_dbus_emit_property_changed(conn, chrc->path, CHRC_INTERFACE, name); } -- 2.47.3