{ }
};
+static const char *path_to_address(const char *path)
+{
+ GDBusProxy *proxy;
+ DBusMessageIter iter;
+ const char *address = path;
+
+ proxy = bt_shell_get_env(path);
+
+ if (g_dbus_proxy_get_property(proxy, "Address", &iter))
+ dbus_message_iter_get_basic(&iter, &address);
+
+ return address;
+}
+
static int parse_options(DBusMessageIter *iter, uint16_t *offset, uint16_t *mtu,
char **device, char **link)
{
"org.bluez.Error.InvalidArguments",
NULL);
- bt_shell_printf("ReadValue: %s offset %u link %s\n", device, offset,
- link);
+ bt_shell_printf("ReadValue: %s offset %u link %s\n",
+ path_to_address(device), offset, link);
if (chrc->authorization_req && offset == 0)
chrc->authorized = false;
"org.bluez.Error.InvalidArguments",
NULL);
- bt_shell_printf("AcquireWrite: %s link %s\n", device, link);
+ bt_shell_printf("AcquireWrite: %s link %s\n", path_to_address(device),
+ link);
reply = chrc_create_pipe(chrc, msg);
"org.bluez.Error.InvalidArguments",
NULL);
- bt_shell_printf("AcquireNotify: %s link %s\n", device, link);
+ bt_shell_printf("AcquireNotify: %s link %s\n", path_to_address(device),
+ link);
reply = chrc_create_pipe(chrc, msg);
"org.bluez.Error.InvalidArguments",
NULL);
- bt_shell_printf("ReadValue: %s offset %u link %s\n", device, offset,
- link);
+ bt_shell_printf("ReadValue: %s offset %u link %s\n",
+ path_to_address(device), offset, link);
if (offset > desc->value_len)
return g_dbus_create_error(msg, "org.bluez.Error.InvalidOffset",
"org.bluez.Error.InvalidArguments",
NULL);
- bt_shell_printf("WriteValue: %s offset %u link %s\n", device, offset,
- link);
+ bt_shell_printf("WriteValue: %s offset %u link %s\n",
+ path_to_address(device), offset, link);
bt_shell_printf("[" COLORED_CHG "] Attribute %s written" , desc->path);