You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by we...@apache.org on 2016/03/29 23:34:56 UTC

incubator-mynewt-core git commit: MYNEWT-271: fix nimble stack set advertising data HCI command bugs.

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop bcbcee105 -> 2686299d0


MYNEWT-271: fix nimble stack set advertising data HCI command bugs.


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

Branch: refs/heads/develop
Commit: 2686299d02ada35c5070fd4d7822480b98cd6408
Parents: bcbcee1
Author: wes3 <wi...@micosa.io>
Authored: Tue Mar 29 14:34:45 2016 -0700
Committer: wes3 <wi...@micosa.io>
Committed: Tue Mar 29 14:34:45 2016 -0700

----------------------------------------------------------------------
 net/nimble/controller/src/ble_ll_adv.c |  2 +-
 net/nimble/host/src/host_hci_cmd.c     | 16 ++++++++++++++--
 net/nimble/include/nimble/hci_common.h |  1 +
 net/nimble/src/hci_common.c            |  2 +-
 4 files changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2686299d/net/nimble/controller/src/ble_ll_adv.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_adv.c b/net/nimble/controller/src/ble_ll_adv.c
index 59d3eb1..2cb2b67 100644
--- a/net/nimble/controller/src/ble_ll_adv.c
+++ b/net/nimble/controller/src/ble_ll_adv.c
@@ -795,7 +795,7 @@ ble_ll_adv_set_adv_data(uint8_t *cmd, uint8_t len)
 
     /* Check for valid advertising data length */
     datalen = cmd[0];
-    if ((datalen > BLE_ADV_DATA_MAX_LEN) || (datalen != len)) {
+    if (datalen > BLE_ADV_DATA_MAX_LEN) {
         return BLE_ERR_INV_HCI_CMD_PARMS;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2686299d/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 e0c2e89..efa93bb 100644
--- a/net/nimble/host/src/host_hci_cmd.c
+++ b/net/nimble/host/src/host_hci_cmd.c
@@ -166,11 +166,22 @@ host_hci_cmd_le_set_adv_params(struct hci_adv_params *adv)
     return rc;
 }
 
+/**
+ * Set advertising data
+ *  
+ * OGF = 0x08 (LE) 
+ * OCF = 0x0008
+ * 
+ * @param data 
+ * @param len 
+ * 
+ * @return int 
+ */
 int
 host_hci_cmd_le_set_adv_data(uint8_t *data, uint8_t len)
 {
     int rc;
-    uint8_t cmd[BLE_HCI_MAX_ADV_DATA_LEN + 1];
+    uint8_t cmd[BLE_HCI_SET_ADV_DATA_LEN];
 
     /* Check for valid parameters */
     if (((data == NULL) && (len != 0)) || (len > BLE_HCI_MAX_ADV_DATA_LEN)) {
@@ -179,7 +190,8 @@ host_hci_cmd_le_set_adv_data(uint8_t *data, uint8_t len)
 
     cmd[0] = len;
     memcpy(cmd + 1, data, len);
-    rc = host_hci_le_cmd_send(BLE_HCI_OCF_LE_SET_ADV_DATA, len + 1, cmd);
+    rc = host_hci_le_cmd_send(BLE_HCI_OCF_LE_SET_ADV_DATA, 
+                              BLE_HCI_SET_ADV_DATA_LEN, cmd);
 
     return rc;
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2686299d/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 ef43a11..82df0d8 100644
--- a/net/nimble/include/nimble/hci_common.h
+++ b/net/nimble/include/nimble/hci_common.h
@@ -177,6 +177,7 @@
 
 /* --- LE set advertising data (OCF 0x0008) */
 #define BLE_HCI_MAX_ADV_DATA_LEN            (31)
+#define BLE_HCI_SET_ADV_DATA_LEN            (32)
 
 /* --- LE set scan response data (OCF 0x0009) */
 #define BLE_HCI_MAX_SCAN_RSP_DATA_LEN       (31)

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2686299d/net/nimble/src/hci_common.c
----------------------------------------------------------------------
diff --git a/net/nimble/src/hci_common.c b/net/nimble/src/hci_common.c
index 6a3f947..c411b72 100644
--- a/net/nimble/src/hci_common.c
+++ b/net/nimble/src/hci_common.c
@@ -36,7 +36,7 @@ const uint8_t g_ble_hci_le_cmd_len[BLE_HCI_NUM_LE_CMDS] =
     BLE_DEV_ADDR_LEN,                   /* 0x0005: set random address */
     BLE_HCI_SET_ADV_PARAM_LEN,          /* 0x0006: set advertising parameters */
     0,                                  /* 0x0007: read adv chan tx power */
-    0xFF,                               /* 0x0008: set advertising data */
+    BLE_HCI_SET_ADV_DATA_LEN,           /* 0x0008: set advertising data */
     0xFF,                               /* 0x0009: set scan rsp data */
     BLE_HCI_SET_ADV_ENABLE_LEN,         /* 0x000A: set advertising enable */
     BLE_HCI_SET_SCAN_PARAM_LEN,         /* 0x000B: set scan parameters */