You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/04/28 02:14:01 UTC

[02/50] [abbrv] incubator-mynewt-core git commit: Modify write suggested default data length command in controller

Modify write suggested default data length command in controller

The prior implementation of this command allowed the host to set
the initial max tx octets/time for a device to a value that it
did not support. The controller will now ignore the host request
if it is not in the supported range.


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

Branch: refs/heads/master
Commit: 73ee5e8b0b0913280637af866d41c54a633aef25
Parents: b0a8c8e
Author: William San Filippo <wi...@runtime.io>
Authored: Mon Apr 18 23:12:10 2016 -0700
Committer: William San Filippo <wi...@runtime.io>
Committed: Mon Apr 18 23:30:06 2016 -0700

----------------------------------------------------------------------
 net/nimble/controller/src/ble_ll_hci.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/73ee5e8b/net/nimble/controller/src/ble_ll_hci.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_hci.c b/net/nimble/controller/src/ble_ll_hci.c
index 14a6b52..8149bf4 100644
--- a/net/nimble/controller/src/ble_ll_hci.c
+++ b/net/nimble/controller/src/ble_ll_hci.c
@@ -281,8 +281,14 @@ ble_ll_hci_le_read_bufsize(uint8_t *rspbuf, uint8_t *rsplen)
 
 #ifdef BLE_LL_CFG_FEAT_DATA_LEN_EXT
 /**
- * HCI write suggested default data length command. Returns the controllers
- * initial max tx octet/time.
+ * HCI write suggested default data length command.
+ *
+ * This command is used by the host to change the initial max tx octets/time
+ * for all connections. Note that if the controller does not support the
+ * requested times no error is returned; the controller simply ignores the
+ * request (but remembers what the host requested for the read suggested
+ * default data length command). The spec allows for the controller to
+ * disregard the host.
  *
  * @param rspbuf Pointer to response buffer
  * @param rsplen Length of response buffer
@@ -304,8 +310,12 @@ ble_ll_hci_le_wr_sugg_data_len(uint8_t *cmdbuf)
     if (ble_ll_chk_txrx_octets(tx_oct) && ble_ll_chk_txrx_time(tx_time)) {
         g_ble_ll_conn_params.sugg_tx_octets = (uint8_t)tx_oct;
         g_ble_ll_conn_params.sugg_tx_time = tx_time;
-        g_ble_ll_conn_params.conn_init_max_tx_octets = tx_oct;
-        g_ble_ll_conn_params.conn_init_max_tx_time = tx_time;
+
+        if ((tx_time < g_ble_ll_conn_params.supp_max_tx_time) &&
+            (tx_oct < g_ble_ll_conn_params.supp_max_tx_octets)) {
+            g_ble_ll_conn_params.conn_init_max_tx_octets = tx_oct;
+            g_ble_ll_conn_params.conn_init_max_tx_time = tx_time;
+        }
         rc = BLE_ERR_SUCCESS;
     } else {
         rc = BLE_ERR_INV_HCI_CMD_PARMS;