Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/1] emulator: Periodic Advertising Command
@ 2021-03-11 18:35 cdwhite13
  2021-03-11 18:35 ` cdwhite13
  0 siblings, 1 reply; 4+ messages in thread
From: cdwhite13 @ 2021-03-11 18:35 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: chris.white

From: Chris White <chris.white@dolby.com>

This adds emulator support for Periodic Advertising HCI commands for
https://github.com/bluez/bluez-sig/issues/2. These changes are intended
as the first step in making the emulator useful for testing the LE
Audio Broadcast feature.

kpare (1):
  emulator: Periodic Advertising Command

 emulator/btdev.c | 50 ++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 44 insertions(+), 6 deletions(-)

-- 
2.21.0 (Apple Git-122.2)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH BlueZ 1/1] emulator: Periodic Advertising Command
  2021-03-11 18:35 [PATCH BlueZ 1/1] emulator: Periodic Advertising Command cdwhite13
@ 2021-03-11 18:35 ` cdwhite13
  2021-03-11 19:05   ` [BlueZ,1/1] " bluez.test.bot
  0 siblings, 1 reply; 4+ messages in thread
From: cdwhite13 @ 2021-03-11 18:35 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: chris.white, Keyur Parekh

From: Keyur Parekh <kpare@dolby.com>

This adds support for Periodic Advertising HCI
command in the emulator. These changes are the
first step in making the emulator useful for
testing the LE Audio Broadcast feature
---
 emulator/btdev.c | 50 ++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 44 insertions(+), 6 deletions(-)

diff --git a/emulator/btdev.c b/emulator/btdev.c
index c824f48ff..749fbafa7 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -141,6 +141,12 @@ struct btdev {
 	uint8_t  le_scan_own_addr_type;
 	uint8_t  le_filter_dup;
 	uint8_t  le_adv_enable;
+	uint8_t  le_periodic_adv_enable;
+	uint16_t le_periodic_adv_properties;
+	uint16_t le_periodic_min_interval;
+	uint16_t le_periodic_max_interval;
+	uint8_t  le_periodic_data_len;
+	uint8_t  le_periodic_data[31];
 	uint8_t  le_ltk[16];
 	struct {
 		struct bt_hci_cmd_le_set_cig_params params;
@@ -3934,22 +3940,54 @@ static int cmd_clear_adv_sets(struct btdev *dev, const void *data,
 static int cmd_set_per_adv_params(struct btdev *dev, const void *data,
 							uint8_t len)
 {
-	/* TODO */
-	return -ENOTSUP;
+	const struct bt_hci_cmd_le_set_periodic_adv_params *cmd = data;
+	uint8_t status;
+
+	if (dev->le_periodic_adv_enable) {
+		status = BT_HCI_ERR_COMMAND_DISALLOWED;
+	} else {
+		status = BT_HCI_ERR_SUCCESS;
+		dev->le_periodic_adv_properties = le16_to_cpu(cmd->properties);
+		dev->le_periodic_min_interval = cmd->min_interval;
+		dev->le_periodic_max_interval = cmd->max_interval;
+	}
+
+	cmd_complete(dev, BT_HCI_CMD_LE_SET_PERIODIC_ADV_PARAMS, &status,
+							sizeof(status));
+	return 0;
 }
 
 static int cmd_set_per_adv_data(struct btdev *dev, const void *data,
 							uint8_t len)
 {
-	/* TODO */
-	return -ENOTSUP;
+	const struct bt_hci_cmd_le_set_periodic_adv_data *cmd = data;
+	uint8_t status = BT_HCI_ERR_SUCCESS;
+
+	dev->le_periodic_data_len = cmd->data_len;
+	memcpy(dev->le_periodic_data, cmd->data, 31);
+	cmd_complete(dev, BT_HCI_CMD_LE_SET_PERIODIC_ADV_DATA, &status,
+							sizeof(status));
+
+	return 0;
 }
 
 static int cmd_set_per_adv_enable(struct btdev *dev, const void *data,
 							uint8_t len)
 {
-	/* TODO */
-	return -ENOTSUP;
+	const struct bt_hci_cmd_le_set_periodic_adv_enable *cmd = data;
+	uint8_t status;
+
+	if (dev->le_periodic_adv_enable == cmd->enable) {
+		status = BT_HCI_ERR_COMMAND_DISALLOWED;
+	} else {
+		dev->le_periodic_adv_enable = cmd->enable;
+		status = BT_HCI_ERR_SUCCESS;
+	}
+
+	cmd_complete(dev, BT_HCI_CMD_LE_SET_PERIODIC_ADV_ENABLE, &status,
+							sizeof(status));
+
+	return 0;
 }
 
 static int cmd_set_ext_scan_params(struct btdev *dev, const void *data,
-- 
2.21.0 (Apple Git-122.2)


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [BlueZ,1/1] emulator: Periodic Advertising Command
  2021-03-11 18:35 ` cdwhite13
@ 2021-03-11 19:05   ` bluez.test.bot
  2021-03-15 21:46     ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 4+ messages in thread
From: bluez.test.bot @ 2021-03-11 19:05 UTC (permalink / raw)
  To: linux-bluetooth, cdwhite13

[-- Attachment #1: Type: text/plain, Size: 557 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=446503

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild - PASS

##############################
Test: MakeCheck - PASS



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BlueZ,1/1] emulator: Periodic Advertising Command
  2021-03-11 19:05   ` [BlueZ,1/1] " bluez.test.bot
@ 2021-03-15 21:46     ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2021-03-15 21:46 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org; +Cc: cdwhite13

Hi Chris,

On Thu, Mar 11, 2021 at 11:09 AM <bluez.test.bot@gmail.com> wrote:
>
> This is automated email and please do not reply to this email!
>
> Dear submitter,
>
> Thank you for submitting the patches to the linux bluetooth mailing list.
> This is a CI test results with your patch series:
> PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=446503
>
> ---Test result---
>
> ##############################
> Test: CheckPatch - PASS
>
> ##############################
> Test: CheckGitLint - PASS
>
> ##############################
> Test: CheckBuild - PASS
>
> ##############################
> Test: MakeCheck - PASS
>
>
>
> ---
> Regards,
> Linux Bluetooth

Applied, thanks.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-15 21:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-11 18:35 [PATCH BlueZ 1/1] emulator: Periodic Advertising Command cdwhite13
2021-03-11 18:35 ` cdwhite13
2021-03-11 19:05   ` [BlueZ,1/1] " bluez.test.bot
2021-03-15 21:46     ` Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox