From: Jefferson Delfes <jefferson.delfes@openbossa.org>
To: linux-bluetooth@vger.kernel.org
Cc: Jefferson Delfes <jefferson.delfes@openbossa.org>
Subject: [PATCH BlueZ 2/6] emulator: Implement basic LE set adv enable command
Date: Wed, 3 Jul 2013 16:54:52 -0400 [thread overview]
Message-ID: <1372884896-11419-3-git-send-email-jefferson.delfes@openbossa.org> (raw)
In-Reply-To: <1372884896-11419-1-git-send-email-jefferson.delfes@openbossa.org>
Store advertising state of virtual controller in btdev struct.
---
emulator/btdev.c | 15 +++++++++++++++
monitor/bt.h | 1 +
2 files changed, 16 insertions(+)
diff --git a/emulator/btdev.c b/emulator/btdev.c
index 73174a5..060347d 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -91,6 +91,7 @@ struct btdev {
uint8_t le_event_mask[8];
uint8_t le_adv_data[31];
uint8_t le_adv_data_len;
+ uint8_t le_adv_enable;
uint16_t sync_train_interval;
uint32_t sync_train_timeout;
@@ -841,6 +842,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
const struct bt_hci_cmd_set_event_mask_page2 *semp2;
const struct bt_hci_cmd_le_set_event_mask *lsem;
const struct bt_hci_cmd_le_set_adv_data *lsad;
+ const struct bt_hci_cmd_le_set_adv_enable *lsae;
struct bt_hci_rsp_read_default_link_policy rdlp;
struct bt_hci_rsp_read_stored_link_key rslk;
struct bt_hci_rsp_write_stored_link_key wslk;
@@ -1454,6 +1456,19 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode,
cmd_complete(btdev, opcode, &lratp, sizeof(lratp));
break;
+ case BT_HCI_CMD_LE_SET_ADV_ENABLE:
+ if (btdev->type == BTDEV_TYPE_BREDR)
+ goto unsupported;
+ lsae = data;
+ if (btdev->le_adv_enable == lsae->enable)
+ status = BT_HCI_ERR_COMMAND_DISALLOWED;
+ else {
+ btdev->le_adv_enable = lsae->enable;
+ status = BT_HCI_ERR_SUCCESS;
+ }
+ cmd_complete(btdev, opcode, &status, sizeof(status));
+ break;
+
case BT_HCI_CMD_LE_SET_SCAN_PARAMETERS:
if (btdev->type == BTDEV_TYPE_BREDR)
goto unsupported;
diff --git a/monitor/bt.h b/monitor/bt.h
index f8759c7..da62a3d 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -1479,6 +1479,7 @@ struct bt_hci_evt_le_long_term_key_request {
#define BT_HCI_ERR_UNKNOWN_CONN_ID 0x02
#define BT_HCI_ERR_HARDWARE_FAILURE 0x03
#define BT_HCI_ERR_PAGE_TIMEOUT 0x04
+#define BT_HCI_ERR_COMMAND_DISALLOWED 0x0c
#define BT_HCI_ERR_INVALID_PARAMETERS 0x12
struct bt_l2cap_hdr {
--
1.8.3.2
next prev parent reply other threads:[~2013-07-03 20:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-03 20:54 [PATCH BlueZ 0/6] emulator: add LE advertising and scanning support Jefferson Delfes
2013-07-03 20:54 ` [PATCH BlueZ 1/6] emulator: Store LE advertising data length in btdev Jefferson Delfes
2013-07-03 20:54 ` Jefferson Delfes [this message]
2013-07-03 20:54 ` [PATCH BlueZ 3/6] emulator: Store LE scan state of virtual controller Jefferson Delfes
2013-07-03 20:54 ` [PATCH BlueZ 4/6] emulator: Disallow LE set scan params command when scan is enabled Jefferson Delfes
2013-07-03 20:54 ` [PATCH BlueZ 5/6] emulator: Dummy LE set advertising parameters Jefferson Delfes
2013-07-03 20:54 ` [PATCH BlueZ 6/6] emulator: Implement LE advertising report Jefferson Delfes
[not found] ` <51d54149.42a5420a.2de5.6abcSMTPIN_ADDED_BROKEN@mx.google.com>
2013-07-04 17:15 ` [PATCH BlueZ 0/6] emulator: add LE advertising and scanning support Jefferson Delfes
2013-07-05 9:00 ` Johan Hedberg
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=1372884896-11419-3-git-send-email-jefferson.delfes@openbossa.org \
--to=jefferson.delfes@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;
as well as URLs for NNTP newsgroup(s).