@@ -56,6 +56,7 @@ static GDBusProxy *default_dev;
static GDBusProxy *default_attr;
static GList *ctrl_list;
static GList *battery_proxies;
+static GList *admin_devices_proxies;
static const char *agent_arguments[] = {
"on",
@@ -542,8 +543,11 @@ static void admin_policy_status_added(GDBusProxy *proxy)
adapter = find_ctrl(ctrl_list, g_dbus_proxy_get_path(proxy));
- if (!adapter)
+ if (!adapter) {
+ admin_devices_proxies = g_list_append(admin_devices_proxies,
+ proxy);
return;
+ }
admin_policy_set_status_proxy(proxy);
}
@@ -654,8 +658,11 @@ static void admin_policy_status_removed(GDBusProxy *proxy)
adapter = find_ctrl(ctrl_list, g_dbus_proxy_get_path(proxy));
- if (!adapter)
+ if (!adapter) {
+ admin_devices_proxies = g_list_remove(admin_devices_proxies,
+ proxy);
return;
+ }
admin_policy_set_status_proxy(NULL);
}
@@ -837,7 +844,7 @@ static struct adapter *find_ctrl_by_address(GList *source, const char *address)
return NULL;
}
-static GDBusProxy *find_battery_by_path(GList *source, const char *path)
+static GDBusProxy *find_proxies_by_path(GList *source, const char *path)
{
GList *list;
@@ -1704,6 +1711,7 @@ static struct GDBusProxy *find_device(int argc, char *argv[])
static void cmd_info(int argc, char *argv[])
{
GDBusProxy *proxy;
+ GDBusProxy *admin_proxy;
GDBusProxy *battery_proxy;
DBusMessageIter iter;
const char *address;
@@ -1747,10 +1755,14 @@ static void cmd_info(int argc, char *argv[])
print_property(proxy, "AdvertisingFlags");
print_property(proxy, "AdvertisingData");
- battery_proxy = find_battery_by_path(battery_proxies,
+ battery_proxy = find_proxies_by_path(battery_proxies,
+ g_dbus_proxy_get_path(proxy));
+ admin_proxy = find_proxies_by_path(admin_devices_proxies,
g_dbus_proxy_get_path(proxy));
print_property_with_label(battery_proxy, "Percentage",
"Battery Percentage");
+ print_property_with_label(admin_proxy, "AffectedByPolicy",
+ "Affected by Policy");
return bt_shell_noninteractive_quit(EXIT_SUCCESS);
}