diff options
author | Sebastian Chlad <sebastian.chlad@tieto.com> | 2013-11-20 21:21:52 +0100 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-11-25 15:22:44 +0200 |
commit | 57ad7765b0014bde67bc0281bf1a1ec797a05c65 (patch) | |
tree | 0f7441fae499c1d2d716e40811a3b2404cbb8eed /client | |
parent | 8ec698bf0995df45844991503d03aacac00b9246 (diff) |
client: Add paired-devices command to bluetoothctl
Paired-devices command lists only paired devices
Diffstat (limited to 'client')
-rw-r--r-- | client/main.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/client/main.c b/client/main.c index 0ec40c778..ebc85c681 100644 --- a/client/main.c +++ b/client/main.c @@ -538,6 +538,26 @@ static void cmd_devices(const char *arg) } } +static void cmd_paired_devices(const char *arg) +{ + GList *list; + + for (list = g_list_first(dev_list); list; list = g_list_next(list)) { + GDBusProxy *proxy = list->data; + DBusMessageIter iter; + dbus_bool_t paired; + + if (g_dbus_proxy_get_property(proxy, "Paired", &iter) == FALSE) + continue; + + dbus_message_iter_get_basic(&iter, &paired); + if (!paired) + continue; + + print_device(proxy, NULL); + } +} + static void generic_callback(const DBusError *error, void *user_data) { char *str = user_data; @@ -1047,6 +1067,8 @@ static const struct { { "select", "<ctrl>", cmd_select, "Select default controller", ctrl_generator }, { "devices", NULL, cmd_devices, "List available devices" }, + { "paired-devices", NULL, cmd_paired_devices, + "List paired devices"}, { "system-alias", "<name>", cmd_system_alias }, { "reset-alias", NULL, cmd_reset_alias }, { "power", "<on/off>", cmd_power, "Set controller power" }, |