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 2017/04/25 17:54:18 UTC

[3/7] incubator-mynewt-core git commit: nimble/hci: Add LE read PHY command

nimble/hci: Add LE read PHY command

With this command we can read used PHY on given connection


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/7744296b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/7744296b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/7744296b

Branch: refs/heads/bluetooth5
Commit: 7744296bc2b9783678c64f632ed7668c3f76ad6d
Parents: 1caef7a
Author: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Authored: Tue Apr 11 09:16:39 2017 +0200
Committer: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Committed: Wed Apr 19 11:04:09 2017 +0200

----------------------------------------------------------------------
 net/nimble/host/src/ble_hs_hci_cmd.c  | 17 +++++++++++++++++
 net/nimble/host/src/ble_hs_hci_priv.h |  3 +++
 2 files changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/7744296b/net/nimble/host/src/ble_hs_hci_cmd.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_hci_cmd.c b/net/nimble/host/src/ble_hs_hci_cmd.c
index e4e0a02..a51df5d 100644
--- a/net/nimble/host/src/ble_hs_hci_cmd.c
+++ b/net/nimble/host/src/ble_hs_hci_cmd.c
@@ -1222,6 +1222,23 @@ ble_hs_hci_cmd_build_set_resolv_priv_addr_timeout(
         timeout, dst + BLE_HCI_CMD_HDR_LEN);
 }
 
+/*
+ * OGF=0x08 OCF=0x0030
+ */
+int
+ble_hs_hci_build_le_read_phy(uint16_t conn_handle, uint8_t *dst, int dst_len)
+{
+    BLE_HS_DBG_ASSERT(
+        dst_len >= BLE_HCI_CMD_HDR_LEN + BLE_HCI_LE_RD_PHY_LEN);
+
+    ble_hs_hci_cmd_write_hdr(BLE_HCI_OGF_LE, BLE_HCI_OCF_LE_RD_PHY,
+                             BLE_HCI_LE_RD_PHY_LEN, dst);
+    dst += BLE_HCI_CMD_HDR_LEN;
+
+    put_le16(dst, conn_handle);
+
+    return 0;
+}
 
 static int
 ble_hs_hci_cmd_body_le_set_priv_mode(const uint8_t *addr, uint8_t addr_type,

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/7744296b/net/nimble/host/src/ble_hs_hci_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_hci_priv.h b/net/nimble/host/src/ble_hs_hci_priv.h
index b3be0bc..b536ccf 100644
--- a/net/nimble/host/src/ble_hs_hci_priv.h
+++ b/net/nimble/host/src/ble_hs_hci_priv.h
@@ -162,6 +162,9 @@ int ble_hs_hci_cmd_build_set_random_addr(const uint8_t *addr,
 int ble_hs_hci_build_le_set_priv_mode(const uint8_t *addr, uint8_t addr_type,
                                       uint8_t priv_mode, uint8_t *dst,
                                       uint16_t dst_len);
+
+int ble_hs_hci_build_le_read_phy(uint16_t conn_handle, uint8_t *dst,
+                                 int dst_len);
 #ifdef __cplusplus
 }
 #endif