linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Francois Beaufort <beaufort.francois@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ] Add device set-alias bluetoothctl command
Date: Fri,  2 Sep 2016 11:08:55 +0200	[thread overview]
Message-ID: <1472807335-14958-2-git-send-email-beaufort.francois@gmail.com> (raw)
In-Reply-To: <1472807335-14958-1-git-send-email-beaufort.francois@gmail.com>

---
 client/main.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/client/main.c b/client/main.c
index 9ba5a40..e1198a8 100644
--- a/client/main.c
+++ b/client/main.c
@@ -1666,6 +1666,30 @@ static void cmd_list_attributes(const char *arg)
 	gatt_list_attributes(g_dbus_proxy_get_path(proxy));
 }
 
+static void cmd_set_alias(const char *arg)
+{
+	char *name;
+
+	if (!arg || !strlen(arg)) {
+		rl_printf("Missing name argument\n");
+		return;
+	}
+
+	if (!default_dev) {
+		rl_printf("No device connected\n");
+		return;
+	}
+
+	name = g_strdup(arg);
+
+	if (g_dbus_proxy_set_property_basic(default_dev, "Alias",
+					DBUS_TYPE_STRING, &name,
+					generic_callback, name, g_free) == TRUE)
+		return;
+
+	g_free(name);
+}
+
 static void cmd_select_attribute(const char *arg)
 {
 	GDBusProxy *proxy;
@@ -2105,6 +2129,7 @@ static const struct {
 							dev_generator },
 	{ "list-attributes", "[dev]", cmd_list_attributes, "List attributes",
 							dev_generator },
+	{ "set-alias",    "<alias>",  cmd_set_alias, "Set device alias" },
 	{ "select-attribute", "<attribute>",  cmd_select_attribute,
 				"Select attribute", attribute_generator },
 	{ "attribute-info", "[attribute]",  cmd_attribute_info,
-- 
2.7.0


  reply	other threads:[~2016-09-02  9:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-02  9:08 [PATCH BlueZ] Add device set-alias bluetoothctl command Francois Beaufort
2016-09-02  9:08 ` Francois Beaufort [this message]
2016-09-02 14:14   ` Luiz Augusto von Dentz
  -- strict thread matches above, loose matches on Subject: below --
2016-09-20 13:12 [PATCH BlueZ] client: Show UUIDs when listing services, characteristics and descriptors Francois Beaufort
2016-09-20 13:12 ` [PATCH BlueZ] Add device set-alias bluetoothctl command Francois Beaufort
2016-09-20 13:13 [PATCH BlueZ] client: Show UUIDs when listing services, characteristics and descriptors Francois Beaufort
2016-09-20 13:13 ` [PATCH BlueZ] Add device set-alias bluetoothctl command Francois Beaufort

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1472807335-14958-2-git-send-email-beaufort.francois@gmail.com \
    --to=beaufort.francois@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).