client: Forward notifications from cloned attributes
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 13 Feb 2019 14:25:05 +0000 (16:25 +0200)
committerhimanshu <h.himanshu@samsung.com>
Tue, 11 Feb 2020 08:57:47 +0000 (14:27 +0530)
Notifications come in a form of 'Value' property changes thus this
copies the values to the local attribute so they are in sync.

Change-Id: I76b8d58a4518c8059eb84cd3d0cdfebc0fd7daa3
Signed-off-by: himanshu <h.himanshu@samsung.com>
client/gatt.c

index afe8e2e..dee7c99 100755 (executable)
@@ -2934,6 +2934,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);
 }