diff --git a/client/main.c b/client/main.c
index b8454ab..461eb84 100644
--- a/client/main.c
+++ b/client/main.c
print_iter("\t", name, &iter);
}
+static void print_uuid(const char *uuid)
+{
+ const char *text;
+
+ text = uuidstr_to_str(uuid);
+ if (text) {
+ char str[26];
+ unsigned int n;
+
+ str[sizeof(str) - 1] = '\0';
+
+ n = snprintf(str, sizeof(str), "%s", text);
+ if (n > sizeof(str) - 1) {
+ str[sizeof(str) - 2] = '.';
+ str[sizeof(str) - 3] = '.';
+ if (str[sizeof(str) - 4] == ' ')
+ str[sizeof(str) - 4] = '.';
+
+ n = sizeof(str) - 1;
+ }
+
+ bt_shell_printf("\tUUID: %s%*c(%s)\n", str, 26 - n, ' ', uuid);
+ } else
+ bt_shell_printf("\tUUID: %*c(%s)\n", 26, ' ', uuid);
+}
+
static void print_uuids(GDBusProxy *proxy)
{
DBusMessageIter iter, value;
dbus_message_iter_recurse(&iter, &value);
while (dbus_message_iter_get_arg_type(&value) == DBUS_TYPE_STRING) {
- const char *uuid, *text;
+ const char *uuid;
dbus_message_iter_get_basic(&value, &uuid);
- text = uuidstr_to_str(uuid);
- if (text) {
- char str[26];
- unsigned int n;
-
- str[sizeof(str) - 1] = '\0';
-
- n = snprintf(str, sizeof(str), "%s", text);
- if (n > sizeof(str) - 1) {
- str[sizeof(str) - 2] = '.';
- str[sizeof(str) - 3] = '.';
- if (str[sizeof(str) - 4] == ' ')
- str[sizeof(str) - 4] = '.';
-
- n = sizeof(str) - 1;
- }
-
- bt_shell_printf("\tUUID: %s%*c(%s)\n",
- str, 26 - n, ' ', uuid);
- } else
- bt_shell_printf("\tUUID: %*c(%s)\n", 26, ' ', uuid);
+ print_uuid(uuid);
dbus_message_iter_next(&value);
}
}
}
-static void cmd_set_scan_filter_uuids(int argc, char *argv[])
+static void cmd_scan_filter_uuids(int argc, char *argv[])
{
+ if (argc < 2 || !strlen(argv[1])) {
+ char **uuid;
+
+ for (uuid = filtered_scan_uuids; uuid && *uuid; uuid++)
+ print_uuid(*uuid);
+
+ return;
+ }
+
g_strfreev(filtered_scan_uuids);
filtered_scan_uuids = NULL;
filtered_scan_uuids_len = 0;
- if (argc < 2 || !strlen(argv[1]))
+ if (!strcmp(argv[1], "all"))
goto commit;
filtered_scan_uuids = g_strdupv(&argv[1]);
.name = "scan",
.desc = "Scan Options Submenu",
.entries = {
- { "set-filter-uuids", "[uuid1 uuid2 ...]", cmd_set_scan_filter_uuids,
- "Set scan filter uuids" },
+ { "uuids", "[all/uuid1 uuid2 ...]", cmd_scan_filter_uuids,
+ "Set/Get UUIDs filter" },
{ "set-filter-rssi", "[rssi]", cmd_set_scan_filter_rssi,
"Set scan filter rssi, and clears pathloss" },
{ "set-filter-pathloss", "[pathloss]", cmd_set_scan_filter_pathloss,