Repository: incubator-mynewt-core Updated Branches: refs/heads/1_0_0_dev d035d3f3d -> 7e35a9928
nimble/gap: Fix bad calculation on connection parameters validation 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/7e35a992 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/7e35a992 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/7e35a992 Branch: refs/heads/1_0_0_dev Commit: 7e35a99288f50626f341099621ef541bcac1ebe0 Parents: d035d3f Author: Åukasz Rymanowski <[email protected]> Authored: Tue Mar 7 11:08:38 2017 +0100 Committer: Christopher Collins <[email protected]> Committed: Tue Mar 7 10:44:53 2017 -0800 ---------------------------------------------------------------------- net/nimble/host/src/ble_gap.c | 7 ++++++- net/nimble/host/test/src/ble_gap_test.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/7e35a992/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 0a09d4c..d14c55c 100644 --- a/net/nimble/host/src/ble_gap.c +++ b/net/nimble/host/src/ble_gap.c @@ -2828,8 +2828,13 @@ ble_gap_validate_conn_params(const struct ble_gap_upd_params *params) return false; } + /* According to specification mentioned above we should make sure that: + * supervision_timeout_ms > (1 + latency) * 2 * max_interval_ms + * => + * supervision_timeout * 10 ms > (1 + latency) * 2 * itvl_max * 1.25ms + */ if (params->supervision_timeout <= - (((1 + params->latency) * params->itvl_max) * 6 / 4)) { + (((1 + params->latency) * params->itvl_max) / 4)) { return false; } http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/7e35a992/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 9dd9dec..ac02343 100644 --- a/net/nimble/host/test/src/ble_gap_test.c +++ b/net/nimble/host/test/src/ble_gap_test.c @@ -2355,7 +2355,7 @@ TEST_CASE(ble_gap_test_case_update_conn_verify_params) ble_gap_test_util_update_verify_params( ((struct ble_gap_upd_params[]) { { .itvl_min = 100, - .itvl_max = 100, + .itvl_max = 600, .supervision_timeout = 300, .latency = 1, .min_ce_len = 554,
