diff --git a/client/advertising.c b/client/advertising.c
index f0fd359..5174417 100644
--- a/client/advertising.c
+++ b/client/advertising.c
#include <string.h>
#include "gdbus/gdbus.h"
+#include "src/shared/util.h"
#include "src/shared/shell.h"
#include "advertising.h"
}
}
+static void print_uuid(const char *uuid)
+{
+ const char *text;
+
+ text = bt_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(%s)\n", str, uuid);
+ } else
+ bt_shell_printf("\tUUID: (%s)\n", uuid);
+}
+
void ad_advertise_uuids(DBusConnection *conn, int argc, char *argv[])
{
+ if (argc < 2 || !strlen(argv[1])) {
+ char **uuid;
+
+ for (uuid = ad.uuids; uuid && *uuid; uuid++)
+ print_uuid(*uuid);
+
+ return;
+ }
+
g_strfreev(ad.uuids);
ad.uuids = NULL;
ad.uuids_len = 0;
- if (argc < 2 || !strlen(argv[1]))
- return;
-
ad.uuids = g_strdupv(&argv[1]);
if (!ad.uuids) {
bt_shell_printf("Failed to parse input\n");
diff --git a/client/main.c b/client/main.c
index a52599d..d13dabd 100644
--- a/client/main.c
+++ b/client/main.c
return argument_generator(text, state, ad_arguments);
}
-static void cmd_set_advertise_uuids(int argc, char *argv[])
+static void cmd_advertise_uuids(int argc, char *argv[])
{
ad_advertise_uuids(dbus_conn, argc, argv);
}
.name = "advertise",
.desc = "Advertise Options Submenu",
.entries = {
- { "set-uuids", "[uuid1 uuid2 ...]",
- cmd_set_advertise_uuids, "Set advertise uuids" },
+ { "uuids", "[uuid1 uuid2 ...]", cmd_advertise_uuids,
+ "Set advertise uuids" },
{ "set-service", "[uuid] [data=xx xx ...]", cmd_set_advertise_service,
"Set advertise service data" },
{ "set-manufacturer", "[id] [data=xx xx ...]",