public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michał Narajowski" <michal.narajowski@codecoup.pl>
To: linux-bluetooth@vger.kernel.org
Cc: "Michał Narajowski" <michal.narajowski@codecoup.pl>
Subject: [PATCH BlueZ 07/31] monitor: Add LE Set Extended Advertising Enable decoding
Date: Tue,  6 Jun 2017 11:40:56 +0200	[thread overview]
Message-ID: <20170606094120.14541-10-michal.narajowski@codecoup.pl> (raw)
In-Reply-To: <20170606094120.14541-1-michal.narajowski@codecoup.pl>

< HCI Command: LE Set Extended Advertising Enable (0x08|0x0039) plen 24
        Ext adv: Enabled
        Number of sets: 2
        Entry 0
          Handle: 0xff
          Duration: 0 ms (0x00)
          Max ext adv events: 0
        Entry 1
          Handle: 0x00
          Duration: 0 ms (0x00)
          Max ext adv events: 1
---
 monitor/bt.h     | 11 +++++++++++
 monitor/packet.c | 42 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/monitor/bt.h b/monitor/bt.h
index b3a8816..8dd0d57 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2223,6 +2223,17 @@ struct bt_hci_cmd_le_set_ext_scan_rsp_data {
 	uint8_t  data[0];
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_SET_EXT_ADV_ENABLE			0x2039
+struct bt_hci_cmd_le_set_ext_adv_enable {
+	uint8_t  enable;
+	uint8_t  num_of_sets;
+} __attribute__ ((packed));
+struct bt_hci_cmd_ext_adv_set {
+	uint8_t  handle;
+	uint16_t  duration;
+	uint8_t  max_events;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
 struct bt_hci_evt_inquiry_complete {
 	uint8_t  status;
diff --git a/monitor/packet.c b/monitor/packet.c
index 30b50c3..f109b4f 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -7183,6 +7183,44 @@ static void le_set_ext_scan_rsp_data_cmd(const void *data, uint8_t size)
 	packet_print_ad(cmd->data, size - sizeof(*cmd));
 }
 
+static void le_set_ext_adv_enable_cmd(const void *data, uint8_t size)
+{
+	const struct bt_hci_cmd_le_set_ext_adv_enable *cmd = data;
+	const struct bt_hci_cmd_ext_adv_set *adv_set;
+	const char *str;
+	int i;
+
+	switch (cmd->enable) {
+	case 0x00:
+		str = "Disable";
+		break;
+	case 0x01:
+		str = "Enabled";
+		break;
+	default:
+		str = "Reserved";
+		break;
+	}
+
+	print_field("Ext adv: %s", str);
+
+	if (cmd->num_of_sets == 0) {
+		print_field("Number of sets: Disable all advertising sets");
+	} else if (cmd->num_of_sets > 0x3f) {
+		print_field("Number of sets: Reserved");
+	} else {
+		print_field("Number of sets: %u", cmd->num_of_sets);
+	}
+
+	for (i = 0; i < cmd->num_of_sets; ++i) {
+		adv_set = data + 2 + i * sizeof(struct bt_hci_cmd_ext_adv_set);
+		print_field("Entry %d", i);
+		print_field("  Handle: 0x%2.2x", adv_set->handle);
+		print_field("  Duration: %d ms (0x%2.2x)", adv_set->duration * 10, adv_set->duration);
+		print_field("  Max ext adv events: %d", adv_set->max_events);
+	}
+}
+
 struct opcode_data {
 	uint16_t opcode;
 	int bit;
@@ -7904,7 +7942,9 @@ static const struct opcode_data opcode_table[] = {
 	{ 0x2038, 292, "LE Set Extended Scan Response Data",
 				le_set_ext_scan_rsp_data_cmd, 4, false,
 				status_rsp, 1, true },
-	{ 0x2039, 293, "LE Set Extended Advertising Enable" },
+	{ 0x2039, 293, "LE Set Extended Advertising Enable",
+				le_set_ext_adv_enable_cmd, 2, false,
+				status_rsp, 1, true },
 	{ 0x203a, 294, "LE Read Maximum Advertising Data Length" },
 	{ 0x203b, 295, "LE Read Number of Supported Advertising Sets" },
 	{ 0x203c, 296, "LE Remove Advertising Set" },
-- 
2.9.3


  parent reply	other threads:[~2017-06-06  9:40 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 01/31] monitor: Add LE Enhanced Receiver Test decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 1/2] monitor: Add LE Set Extended Scan Parameters decoding Michał Narajowski
2017-06-08  8:38   ` Marcel Holtmann
2017-06-06  9:40 ` [PATCH BlueZ 02/31] monitor: Add LE Enhanced Transmitter Test decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 2/2] monitor: Add LE Set Extended Scan Enable decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 03/31] monitor: Add LE Set Advertising Set Random Address decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 04/31] monitor: Add LE Set Extended Advertising Parameters decoding Michał Narajowski
2017-06-08  8:44   ` Marcel Holtmann
2017-06-08 13:00   ` Szymon Janc
2017-06-06  9:40 ` [PATCH BlueZ 05/31] monitor: Add LE Set Extended Advertising Data decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 06/31] monitor: Add LE Set Extended Scan Response " Michał Narajowski
2017-06-06  9:40 ` Michał Narajowski [this message]
2017-06-06  9:40 ` [PATCH BlueZ 08/31] monitor: Add LE Read Maximum Advertising Data Length decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 09/31] monitor: Add LE Read Number of Supported Advertising Sets decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 10/31] monitor: Add LE Remove Advertising Set decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 11/31] monitor: Add LE Clear Advertising Sets decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 12/31] monitor: Add LE Set Periodic Advertising Parameters decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 13/31] monitor: Add LE Set Periodic Advertising Data decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 14/31] monitor: Add LE Set Periodic Advertising Enable decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 15/31] monitor: Add LE Set Extended Scan Parameters decoding Michał Narajowski
2017-06-06  9:46   ` Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 16/31] monitor: Add LE Set Extended Scan Enable decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 17/31] monitor: Add LE Extended Create Connection decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 18/31] monitor: Add LE Periodic Advertising Create Sync decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 19/31] monitor: Add LE Periodic Advertising Create Sync Cancel decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 20/31] monitor: Add LE Periodic Advertising Terminate Sync decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 21/31] monitor: Add LE Add Device To Periodic Advertiser List decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 22/31] monitor: Add LE Remove Device From " Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 23/31] monitor: Add LE Clear " Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 24/31] monitor: Add LE Read Periodic Advertiser List Size decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 25/31] monitor: Add LE Read Transmit Power decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 26/31] monitor: Add LE Read RF Path Compensation decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 27/31] monitor: Add LE Write " Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 28/31] monitor: Add LE Set Privacy Mode decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 29/31] monitor: Add LE Extended Advertising Report Event decoding Michał Narajowski
2017-06-06 14:10   ` Łukasz Rymanowski
2017-06-06  9:41 ` [PATCH BlueZ 30/31] monitor: Add LE Advertising Set Terminated " Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 31/31] monitor: Add LE Scan Request Received " Michał Narajowski
2017-06-08  8:47 ` [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Marcel Holtmann

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=20170606094120.14541-10-michal.narajowski@codecoup.pl \
    --to=michal.narajowski@codecoup.pl \
    --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