summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2012-12-22 20:13:46 -0800
committerMarcel Holtmann <marcel@holtmann.org>2012-12-22 20:13:46 -0800
commitaf49b62cccbb6a780641d9e7fb44e3544a7a0604 (patch)
tree832afbe77594fef764e68467c9340096b7cf5363 /client
parent85730891d93f0fa7831db74c4f00902fecc45b7c (diff)
client: Add support for setting a device trusted
Diffstat (limited to 'client')
-rw-r--r--client/main.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/client/main.c b/client/main.c
index b716d95f9..100b226a2 100644
--- a/client/main.c
+++ b/client/main.c
@@ -732,6 +732,35 @@ static void cmd_pair(const char *arg)
rl_printf("Attempting to pair with %s\n", arg);
}
+static void cmd_trust(const char *arg)
+{
+ GDBusProxy *proxy;
+ dbus_bool_t trusted;
+ char *str;
+
+ if (!arg || !strlen(arg)) {
+ rl_printf("Missing device address argument\n");
+ return;
+ }
+
+ proxy = find_proxy_by_address(dev_list, arg);
+ if (!proxy) {
+ rl_printf("Device %s not available\n", arg);
+ return;
+ }
+
+ trusted = TRUE;
+
+ str = g_strdup_printf("%s trust", arg);
+
+ if (g_dbus_proxy_set_property_basic(proxy, "Trusted",
+ DBUS_TYPE_BOOLEAN, &trusted,
+ generic_callback, str, g_free) == TRUE)
+ return;
+
+ g_free(str);
+}
+
static void remove_device_reply(DBusMessage *message, void *user_data)
{
DBusError error;
@@ -941,6 +970,8 @@ static const struct {
dev_generator },
{ "pair", "<dev>", cmd_pair, "Pair with device",
dev_generator },
+ { "trust", "<dev>", cmd_trust, "Trust device",
+ dev_generator },
{ "remove", "<dev>", cmd_remove, "Remove device",
dev_generator },
{ "connect", "<dev>", cmd_connect, "Connect device",