You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/05/10 03:33:07 UTC
incubator-mynewt-core git commit: BLE host - Set random address HCI
command.
Repository: incubator-mynewt-core
Updated Branches:
refs/heads/develop b288e8b69 -> f4c734e39
BLE host - Set random address HCI command.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/f4c734e3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f4c734e3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f4c734e3
Branch: refs/heads/develop
Commit: f4c734e3924ef439a8554ff8d6f2bc0d5f10a2e3
Parents: b288e8b
Author: Christopher Collins <cc...@apache.org>
Authored: Mon May 9 18:46:51 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon May 9 20:33:03 2016 -0700
----------------------------------------------------------------------
net/nimble/host/include/host/host_hci.h | 2 ++
net/nimble/host/src/host_hci_cmd.c | 16 ++++++++++++++++
net/nimble/include/nimble/hci_common.h | 3 +++
3 files changed, 21 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f4c734e3/net/nimble/host/include/host/host_hci.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/include/host/host_hci.h b/net/nimble/host/include/host/host_hci.h
index 747f2c5..cd2463c 100644
--- a/net/nimble/host/include/host/host_hci.h
+++ b/net/nimble/host/include/host/host_hci.h
@@ -48,6 +48,8 @@ void host_hci_cmd_build_le_set_event_mask(uint64_t event_mask,
void host_hci_cmd_build_le_read_buffer_size(uint8_t *dst, int dst_len);
int host_hci_cmd_le_read_buffer_size(void);
void host_hci_cmd_build_le_read_loc_supp_feat(uint8_t *dst, uint8_t dst_len);
+void host_hci_cmd_build_le_set_rand_addr(uint8_t *addr, uint8_t *dst,
+ int dst_len);
void host_hci_cmd_build_le_set_adv_enable(uint8_t enable, uint8_t *dst,
int dst_len);
int host_hci_cmd_le_set_adv_enable(uint8_t enable);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f4c734e3/net/nimble/host/src/host_hci_cmd.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/host_hci_cmd.c b/net/nimble/host/src/host_hci_cmd.c
index 523cf35..e78e2dd 100644
--- a/net/nimble/host/src/host_hci_cmd.c
+++ b/net/nimble/host/src/host_hci_cmd.c
@@ -422,6 +422,22 @@ host_hci_cmd_build_le_read_loc_supp_feat(uint8_t *dst, uint8_t dst_len)
0, dst);
}
+/**
+ * OGF=LE, OCF=0x0005
+ */
+void
+host_hci_cmd_build_le_set_rand_addr(uint8_t *addr, uint8_t *dst, int dst_len)
+{
+ BLE_HS_DBG_ASSERT(dst_len >=
+ BLE_HCI_CMD_HDR_LEN + BLE_HCI_LE_SET_RAND_ADDR_LEN);
+
+ host_hci_write_hdr(BLE_HCI_OGF_LE, BLE_HCI_OCF_LE_SET_RAND_ADDR,
+ BLE_HCI_LE_SET_RAND_ADDR_LEN, dst);
+ dst += BLE_HCI_CMD_HDR_LEN;
+
+ memcpy(dst, addr, 6);
+}
+
static void
host_hci_cmd_body_le_set_adv_enable(uint8_t enable, uint8_t *dst)
{
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f4c734e3/net/nimble/include/nimble/hci_common.h
----------------------------------------------------------------------
diff --git a/net/nimble/include/nimble/hci_common.h b/net/nimble/include/nimble/hci_common.h
index a1ae509..2459d8a 100644
--- a/net/nimble/include/nimble/hci_common.h
+++ b/net/nimble/include/nimble/hci_common.h
@@ -148,6 +148,9 @@
/* --- LE read local supported features (OCF 0x0003) --- */
#define BLE_HCI_RD_LOC_SUPP_FEAT_RSPLEN (8)
+/* --- LE set random address (OCF 0x0005) --- */
+#define BLE_HCI_LE_SET_RAND_ADDR_LEN (6)
+
/* --- LE set advertising parameters (OCF 0x0006) */
#define BLE_HCI_SET_ADV_PARAM_LEN (15)