From: Bruna Moreira <bruna.moreira@openbossa.org>
To: linux-bluetooth@vger.kernel.org
Cc: Bruna Moreira <bruna.moreira@openbossa.org>
Subject: [RFC BlueZ 08/33] btmgmt: Add unset controller data support
Date: Mon, 27 Aug 2012 13:03:00 -0400 [thread overview]
Message-ID: <1346087005-24693-9-git-send-email-bruna.moreira@openbossa.org> (raw)
In-Reply-To: <1346087005-24693-1-git-send-email-bruna.moreira@openbossa.org>
Add new command unset-data for running the Unset Controller Data
operation from MGMT API.
---
tools/btmgmt.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index 628d21b..44c4db8 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -1896,6 +1896,45 @@ static void cmd_set_data(int mgmt_sk, uint16_t index, int argc, char **argv)
free(cp);
}
+static void unset_data_rsp(int mgmt_sk, uint16_t op, uint16_t id,
+ uint8_t status, void *rsp, uint16_t len, void *user_data)
+{
+ if (status != 0) {
+ fprintf(stderr, "Unable to unset controller data. status 0x%02x"
+ " (%s)\n", status, mgmt_errstr(status));
+ exit(EXIT_FAILURE);
+ }
+
+ exit(EXIT_SUCCESS);
+}
+
+static void cmd_unset_data(int mgmt_sk, uint16_t index, int argc, char **argv)
+{
+ struct mgmt_cp_unset_controller_data cp;
+
+ if (argc < 2) {
+ printf("Usage: btmgmt %s <data type>\n", argv[0]);
+ printf("\nexample: btmgmt %s 0xff\n", argv[0]);
+ printf("\nparameters:\n");
+ printf("\t<data type>: 0x16 (service data) or 0xff\n"
+ "\t(manufacturer specific data).\n");
+
+ exit(EXIT_FAILURE);
+ }
+
+ memset(&cp, 0, sizeof(cp));
+ sscanf(argv[1], "%hhx", &cp.data_type);
+
+ if (index == MGMT_INDEX_NONE)
+ index = 0;
+
+ if (mgmt_send_cmd(mgmt_sk, MGMT_OP_UNSET_CONTROLLER_DATA, index,
+ &cp, sizeof(cp), unset_data_rsp, NULL) < 0) {
+ fprintf(stderr, "Unable to send unset controller data cmd\n");
+ exit(EXIT_FAILURE);
+ }
+}
+
static struct {
char *cmd;
void (*func)(int mgmt_sk, uint16_t index, int argc, char **argv);
@@ -1930,6 +1969,7 @@ static struct {
{ "broadcaster",cmd_broadcaster,"Toggle Broadcaster Mode", },
{ "observer", cmd_observer, "Toggle Observer Mode", },
{ "set-data", cmd_set_data, "Set Controller Data", },
+ { "unset-data", cmd_unset_data, "Unset Controller Data", },
{ NULL, NULL, 0 }
};
--
1.7.9.5
next prev parent reply other threads:[~2012-08-27 17:03 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-27 17:02 [RFC BlueZ 00/33] Broadcaster/Observer implementation Bruna Moreira
2012-08-27 17:02 ` [RFC BlueZ 01/33] lib: Add set controller data operation Bruna Moreira
2012-08-27 17:02 ` [RFC BlueZ 02/33] lib: Add unset " Bruna Moreira
2012-08-27 17:02 ` [RFC BlueZ 03/33] lib: Add set broadcaster operation Bruna Moreira
2012-08-27 17:02 ` [RFC BlueZ 04/33] lib: Add set observer operation Bruna Moreira
2012-08-27 17:02 ` [RFC BlueZ 05/33] btmgmt: Add set broadcaster support Bruna Moreira
2012-08-27 17:02 ` [RFC BlueZ 06/33] btmgmt: Add set observer command Bruna Moreira
2012-08-27 17:02 ` [RFC BlueZ 07/33] btmgmt: Add set controller data support Bruna Moreira
2012-08-27 17:03 ` Bruna Moreira [this message]
2012-08-27 17:03 ` [RFC BlueZ 09/33] mgmt-api: Broadcaster/Observer management API Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 10/33] mgmt: Add set observer command Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 11/33] mgmt: Add set broadcaster command Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 12/33] mgmt: Add set controller data command Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 13/33] mgmt: Add unset " Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 14/33] doc: Add Observer D-Bus API documentation Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 15/33] adapter: Add D-Bus API for Observer GAP Role Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 16/33] observer: Add RegisterServiceObserver() D-Bus method Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 17/33] observer: Add UnregisterServiceObserver() " Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 18/33] observer: Add RegisterManufacturerObserver() " Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 19/33] observer: Add UnregisterManufacturerObserver() " Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 20/33] observer: Add watchers and filters for observers Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 21/33] eir: Add manufacturer and service data fields Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 22/33] observer: Add ServiceReceived() and ManufacturerReceived() D-Bus method Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 23/33] observer: Add python test script Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 24/33] doc: Add Broadcaster D-Bus API documentation Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 25/33] adapter: Add D-Bus API for Broadcaster GAP Role Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 26/33] lib: Maximum value to advertising and scan response Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 27/33] broadcaster: Add SetServiceData() D-Bus method Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 28/33] broadcaster: Add SetManufacturerData() " Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 29/33] broadcaster: Add list of broadcasters session Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 30/33] broadcaster: Build and send ADV/EIR data blob to kernel Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 31/33] broadcaster: Add ClearBroadcastData() D-Bus method Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 32/33] broadcaster: Update some data of already broadcast value Bruna Moreira
2012-08-27 17:03 ` [RFC BlueZ 33/33] broadcaster: Add python test script Bruna Moreira
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=1346087005-24693-9-git-send-email-bruna.moreira@openbossa.org \
--to=bruna.moreira@openbossa.org \
--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