You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by vi...@apache.org on 2017/02/23 22:33:26 UTC

[32/50] incubator-mynewt-core git commit: nimble/gap: Fix validation of conn parameters

nimble/gap: Fix validation of conn parameters

This fix obvious incorrect check for parameter validation.

Note, with this patch we finaly start check for requirements on
supervision timeout, that's why test script update was needed.


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

Branch: refs/heads/sensors_branch
Commit: a246f526267bc81199e57a22535b5d3f0173a660
Parents: 47166e2
Author: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Authored: Tue Feb 14 05:58:42 2017 +0100
Committer: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Committed: Mon Feb 20 23:27:31 2017 +0100

----------------------------------------------------------------------
 net/nimble/host/src/ble_gap.c             |  2 +-
 net/nimble/host/test/src/ble_gap_test.c   | 52 +++++++++++++-------------
 net/nimble/host/test/src/ble_l2cap_test.c |  4 +-
 3 files changed, 29 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a246f526/net/nimble/host/src/ble_gap.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gap.c b/net/nimble/host/src/ble_gap.c
index c85ff62..22462b4 100644
--- a/net/nimble/host/src/ble_gap.c
+++ b/net/nimble/host/src/ble_gap.c
@@ -2868,7 +2868,7 @@ ble_gap_update_params(uint16_t conn_handle,
     int rc;
 
     /* Validate parameters with a spec */
-    if (ble_gap_validate_conn_params(params)) {
+    if (!ble_gap_validate_conn_params(params)) {
             return BLE_HS_EINVAL;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a246f526/net/nimble/host/test/src/ble_gap_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_gap_test.c b/net/nimble/host/test/src/ble_gap_test.c
index a13255e..8cdbc11 100644
--- a/net/nimble/host/test/src/ble_gap_test.c
+++ b/net/nimble/host/test/src/ble_gap_test.c
@@ -2263,7 +2263,7 @@ TEST_CASE(ble_gap_test_case_update_conn_good)
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 10,
             .itvl_max = 100,
-            .supervision_timeout = 0,
+            .supervision_timeout = 200,
             .min_ce_len = 123,
             .max_ce_len = 456,
         }}),
@@ -2273,7 +2273,7 @@ TEST_CASE(ble_gap_test_case_update_conn_good)
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 100,
             .itvl_max = 100,
-            .supervision_timeout = 100,
+            .supervision_timeout = 200,
             .min_ce_len = 554,
             .max_ce_len = 554,
         }}),
@@ -2286,7 +2286,7 @@ TEST_CASE(ble_gap_test_case_update_conn_bad)
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 10,
             .itvl_max = 100,
-            .supervision_timeout = 0,
+            .supervision_timeout = 200,
             .min_ce_len = 123,
             .max_ce_len = 456,
         }}),
@@ -2299,7 +2299,7 @@ TEST_CASE(ble_gap_test_case_update_conn_hci_fail)
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 10,
             .itvl_max = 100,
-            .supervision_timeout = 0,
+            .supervision_timeout = 200,
             .min_ce_len = 123,
             .max_ce_len = 456,
         }}),
@@ -2311,7 +2311,7 @@ TEST_CASE(ble_gap_test_case_update_conn_l2cap)
     struct ble_gap_upd_params params = {
         .itvl_min = 10,
         .itvl_max = 100,
-        .supervision_timeout = 0,
+        .supervision_timeout = 200,
         .min_ce_len = 123,
         .max_ce_len = 456,
     };
@@ -2365,14 +2365,14 @@ TEST_CASE(ble_gap_test_case_update_req_good)
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 50,
             .itvl_max = 500,
-            .supervision_timeout = 20,
+            .supervision_timeout = 800,
             .min_ce_len = 555,
             .max_ce_len = 888,
         }}),
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 10,
             .itvl_max = 100,
-            .supervision_timeout = 0,
+            .supervision_timeout = 200,
             .min_ce_len = 123,
             .max_ce_len = 456,
         }}),
@@ -2382,14 +2382,14 @@ TEST_CASE(ble_gap_test_case_update_req_good)
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 50,
             .itvl_max = 500,
-            .supervision_timeout = 20,
+            .supervision_timeout = 800,
             .min_ce_len = 555,
             .max_ce_len = 888,
         }}),
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 100,
             .itvl_max = 100,
-            .supervision_timeout = 100,
+            .supervision_timeout = 200,
             .min_ce_len = 554,
             .max_ce_len = 554,
         }}),
@@ -2402,14 +2402,14 @@ TEST_CASE(ble_gap_test_case_update_req_hci_fail)
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 50,
             .itvl_max = 500,
-            .supervision_timeout = 20,
+            .supervision_timeout = 800,
             .min_ce_len = 555,
             .max_ce_len = 888,
         }}),
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 10,
             .itvl_max = 100,
-            .supervision_timeout = 0,
+            .supervision_timeout = 200,
             .min_ce_len = 123,
             .max_ce_len = 456,
         }}),
@@ -2422,7 +2422,7 @@ TEST_CASE(ble_gap_test_case_update_req_reject)
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 50,
             .itvl_max = 500,
-            .supervision_timeout = 20,
+            .supervision_timeout = 800,
             .min_ce_len = 555,
             .max_ce_len = 888,
         }}),
@@ -2432,7 +2432,7 @@ TEST_CASE(ble_gap_test_case_update_req_reject)
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 50,
             .itvl_max = 500,
-            .supervision_timeout = 20,
+            .supervision_timeout = 800,
             .min_ce_len = 555,
             .max_ce_len = 888,
         }}),
@@ -2445,21 +2445,21 @@ TEST_CASE(ble_gap_test_case_update_concurrent_good)
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 10,
             .itvl_max = 100,
-            .supervision_timeout = 0,
+            .supervision_timeout = 200,
             .min_ce_len = 123,
             .max_ce_len = 456,
         }}),
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 50,
             .itvl_max = 500,
-            .supervision_timeout = 20,
+            .supervision_timeout = 800,
             .min_ce_len = 555,
             .max_ce_len = 888,
         }}),
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 10,
             .itvl_max = 100,
-            .supervision_timeout = 0,
+            .supervision_timeout = 200,
             .min_ce_len = 123,
             .max_ce_len = 456,
         }}),
@@ -2469,21 +2469,21 @@ TEST_CASE(ble_gap_test_case_update_concurrent_good)
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 10,
             .itvl_max = 100,
-            .supervision_timeout = 0,
+            .supervision_timeout = 200,
             .min_ce_len = 123,
             .max_ce_len = 456,
         }}),
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 50,
             .itvl_max = 500,
-            .supervision_timeout = 20,
+            .supervision_timeout = 800,
             .min_ce_len = 555,
             .max_ce_len = 888,
         }}),
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 20,
             .itvl_max = 200,
-            .supervision_timeout = 2,
+            .supervision_timeout = 350,
             .min_ce_len = 111,
             .max_ce_len = 222,
         }}),
@@ -2496,21 +2496,21 @@ TEST_CASE(ble_gap_test_case_update_concurrent_hci_fail)
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 10,
             .itvl_max = 100,
-            .supervision_timeout = 0,
+            .supervision_timeout = 200,
             .min_ce_len = 123,
             .max_ce_len = 456,
         }}),
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 50,
             .itvl_max = 500,
-            .supervision_timeout = 20,
+            .supervision_timeout = 800,
             .min_ce_len = 555,
             .max_ce_len = 888,
         }}),
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 20,
             .itvl_max = 200,
-            .supervision_timeout = 2,
+            .supervision_timeout = 350,
             .min_ce_len = 111,
             .max_ce_len = 222,
         }}),
@@ -2520,21 +2520,21 @@ TEST_CASE(ble_gap_test_case_update_concurrent_hci_fail)
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 10,
             .itvl_max = 100,
-            .supervision_timeout = 0,
+            .supervision_timeout = 200,
             .min_ce_len = 123,
             .max_ce_len = 456,
         }}),
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 50,
             .itvl_max = 500,
-            .supervision_timeout = 20,
+            .supervision_timeout = 800,
             .min_ce_len = 555,
             .max_ce_len = 888,
         }}),
         ((struct ble_gap_upd_params[]) { {
             .itvl_min = 20,
             .itvl_max = 200,
-            .supervision_timeout = 2,
+            .supervision_timeout = 350,
             .min_ce_len = 111,
             .max_ce_len = 222,
         }}),
@@ -2711,7 +2711,7 @@ TEST_CASE(ble_gap_test_case_update_timeout)
     struct ble_gap_upd_params params = {
         .itvl_min = 10,
         .itvl_max = 100,
-        .supervision_timeout = 0,
+        .supervision_timeout = 200,
         .min_ce_len = 123,
         .max_ce_len = 456,
     };

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a246f526/net/nimble/host/test/src/ble_l2cap_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_l2cap_test.c b/net/nimble/host/test/src/ble_l2cap_test.c
index dc1c373..7c60aa9 100644
--- a/net/nimble/host/test/src/ble_l2cap_test.c
+++ b/net/nimble/host/test/src/ble_l2cap_test.c
@@ -474,7 +474,7 @@ ble_l2cap_test_util_peer_updates(int accept)
     l2cap_params.itvl_min = 0x200;
     l2cap_params.itvl_max = 0x300;
     l2cap_params.slave_latency = 0;
-    l2cap_params.timeout_multiplier = 0x100;
+    l2cap_params.timeout_multiplier = 0x500;
     ble_l2cap_test_util_rx_update_req(2, 1, &l2cap_params);
 
     /* Ensure an update response command got sent. */
@@ -485,7 +485,7 @@ ble_l2cap_test_util_peer_updates(int accept)
         params.itvl_min = 0x200;
         params.itvl_max = 0x300;
         params.latency = 0;
-        params.supervision_timeout = 0x100;
+        params.supervision_timeout = 0x500;
         params.min_ce_len = BLE_GAP_INITIAL_CONN_MIN_CE_LEN;
         params.max_ce_len = BLE_GAP_INITIAL_CONN_MAX_CE_LEN;
         ble_l2cap_test_util_verify_tx_update_conn(&params);