client: Add support for printing ExperimentalFeatures property
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 17 Aug 2021 00:56:34 +0000 (17:56 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:36 +0000 (19:08 +0530)
Thid adds support to show command to print ExperimentalFeatures property:

[bluetooth]# show
Controller ...
Experimental: BlueZ Experimental LL p.. (15c0a148-c273-11ea-b3de-0242ac130004)

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
client/main.c

index 0fd9c12..4ad914d 100644 (file)
@@ -318,7 +318,7 @@ static void print_property(GDBusProxy *proxy, const char *name)
        print_property_with_label(proxy, name, NULL);
 }
 
-static void print_uuid(const char *uuid)
+static void print_uuid(const char *label, const char *uuid)
 {
        const char *text;
 
@@ -339,9 +339,10 @@ static void print_uuid(const char *uuid)
                        n = sizeof(str) - 1;
                }
 
-               bt_shell_printf("\tUUID: %s%*c(%s)\n", str, 26 - n, ' ', uuid);
+               bt_shell_printf("\t%s: %s%*c(%s)\n", label, str, 26 - n, ' ',
+                                                                       uuid);
        } else
-               bt_shell_printf("\tUUID: %*c(%s)\n", 26, ' ', uuid);
+               bt_shell_printf("\t%s: %*c(%s)\n", label, 26, ' ', uuid);
 }
 
 static void print_uuids(GDBusProxy *proxy)
@@ -358,7 +359,28 @@ static void print_uuids(GDBusProxy *proxy)
 
                dbus_message_iter_get_basic(&value, &uuid);
 
-               print_uuid(uuid);
+               print_uuid("UUID", uuid);
+
+               dbus_message_iter_next(&value);
+       }
+}
+
+static void print_experimental(GDBusProxy *proxy)
+{
+       DBusMessageIter iter, value;
+
+       if (g_dbus_proxy_get_property(proxy, "ExperimentalFeatures",
+                                               &iter) == FALSE)
+               return;
+
+       dbus_message_iter_recurse(&iter, &value);
+
+       while (dbus_message_iter_get_arg_type(&value) == DBUS_TYPE_STRING) {
+               const char *uuid;
+
+               dbus_message_iter_get_basic(&value, &uuid);
+
+               print_uuid("ExperimentalFeatures", uuid);
 
                dbus_message_iter_next(&value);
        }
@@ -983,6 +1005,7 @@ static void cmd_show(int argc, char *argv[])
        print_property(adapter->proxy, "Modalias");
        print_property(adapter->proxy, "Discovering");
        print_property(adapter->proxy, "Roles");
+       print_experimental(adapter->proxy);
 
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
        print_property(adapter->proxy, "Advertising");
@@ -1427,7 +1450,7 @@ static void cmd_scan_filter_uuids(int argc, char *argv[])
                char **uuid;
 
                for (uuid = filter.uuids; uuid && *uuid; uuid++)
-                       print_uuid(*uuid);
+                       print_uuid("UUID", *uuid);
 
                return bt_shell_noninteractive_quit(EXIT_SUCCESS);
        }