Diff between 04c32f3d312905bf7bece70735e6b2ca4bf3ca05 and f09f33199858d103489c7064b7488209d02b9ce8

Changed Files

File Additions Deletions Status
client/assistant.c +60 -3 modified
client/bluetoothctl-assistant.rst +7 -0 modified

Full Patch

diff --git a/client/assistant.c b/client/assistant.c
index ffefa25..88795cd 100644
--- a/client/assistant.c
+++ b/client/assistant.c
@@ -395,15 +395,72 @@ static void cmd_list_assistant(int argc, char *argv[])
 	return bt_shell_noninteractive_quit(EXIT_SUCCESS);
 }
 
+static void print_assistant_properties(GDBusProxy *proxy)
+{
+	bt_shell_printf("Transport %s\n", g_dbus_proxy_get_path(proxy));
+
+	print_property(proxy, "State");
+	print_property(proxy, "Metadata");
+	print_property(proxy, "QoS");
+}
+
+static void print_assistants(void *data, void *user_data)
+{
+	print_assistant_properties(data);
+}
+
+static char *generic_generator(const char *text, int state, GList *source)
+{
+	static int index = 0;
+
+	if (!source)
+		return NULL;
+
+	if (!state)
+		index = 0;
+
+	return g_dbus_proxy_path_lookup(source, &index, text);
+}
+
+static char *assistant_generator(const char *text, int state)
+{
+	return generic_generator(text, state, assistants);
+}
+
+static void cmd_show_assistant(int argc, char *argv[])
+{
+	GDBusProxy *proxy;
+
+	/* Show all transports if no argument is given */
+	if (argc != 2) {
+		g_list_foreach(assistants, print_assistants, NULL);
+		return bt_shell_noninteractive_quit(EXIT_SUCCESS);
+	}
+
+	proxy = g_dbus_proxy_lookup(assistants, NULL, argv[1],
+					MEDIA_ASSISTANT_INTERFACE);
+	if (!proxy) {
+		bt_shell_printf("Assistant %s not found\n", argv[1]);
+		return bt_shell_noninteractive_quit(EXIT_FAILURE);
+	}
+
+	print_assistant_properties(proxy);
+
+	return bt_shell_noninteractive_quit(EXIT_SUCCESS);
+}
+
 static const struct bt_shell_menu assistant_menu = {
 	.name = "assistant",
 	.desc = "Media Assistant Submenu",
 	.pre_run = assistant_menu_pre_run,
 	.entries = {
-	{ "list",         NULL,    cmd_list_assistant,
-						"List available assistants" },
+	{ "list", NULL, cmd_list_assistant, "List available assistants" },
+	{ "show", "[assistant]", cmd_show_assistant,
+					"Assistant information",
+					assistant_generator },
 	{ "push", "<assistant>", cmd_push_assistant,
-					"Send stream information to peer" },
+					"Send stream information to peer",
+					assistant_generator },
 	{} },
 };
 
diff --git a/client/bluetoothctl-assistant.rst b/client/bluetoothctl-assistant.rst
index 75166a6..33fbcbc 100644
--- a/client/bluetoothctl-assistant.rst
+++ b/client/bluetoothctl-assistant.rst
@@ -28,6 +28,13 @@ List available assistants.
 
 :Usage: **> list**
 
+show
+----
+
+Show assistant information.
+
+:Usage: **> show [assistant]**
+
 push
 ----