From: Francois Beaufort <beaufort.francois@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ] Add device set-alias bluetoothctl command
Date: Tue, 20 Sep 2016 15:13:36 +0200 [thread overview]
Message-ID: <20160920131337.19494-2-beaufort.francois@gmail.com> (raw)
In-Reply-To: <20160920131337.19494-1-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
next prev parent reply other threads:[~2016-09-20 13:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-20 13:13 [PATCH BlueZ] client: Show UUIDs when listing services, characteristics and descriptors Francois Beaufort
2016-09-20 13:13 ` Francois Beaufort [this message]
2016-09-20 13:13 ` Francois Beaufort
-- strict thread matches above, loose matches on Subject: below --
2016-09-20 13:12 Francois Beaufort
2016-09-20 13:12 ` [PATCH BlueZ] Add device set-alias bluetoothctl command Francois Beaufort
2016-09-02 9:08 Francois Beaufort
2016-09-02 9:08 ` Francois Beaufort
2016-09-02 14:14 ` Luiz Augusto von Dentz
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=20160920131337.19494-2-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).