Repository: incubator-mynewt-core Updated Branches: refs/heads/develop 7d28f7b79 -> ff2d84e93
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/785d1e1d Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/785d1e1d Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/785d1e1d Branch: refs/heads/develop Commit: 785d1e1d62566c21575ff24df62ab0eaf5b2c293 Parents: 7d28f7b Author: Åukasz Rymanowski <[email protected]> Authored: Tue Mar 7 11:08:38 2017 +0100 Committer: Åukasz Rymanowski <[email protected]> Committed: Tue Mar 7 12:29:03 2017 +0100 ---------------------------------------------------------------------- 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/785d1e1d/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/785d1e1d/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,
