You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/11/30 20:07:02 UTC
[1/8] incubator-mynewt-core git commit: nimble/l2cap: Fix for l2cap
rx handles
Repository: incubator-mynewt-core
Updated Branches:
refs/heads/develop 5f7ad8cb0 -> 899270594
nimble/l2cap: Fix for l2cap rx handles
This patch makes sure that ble_l2cap_sig_dispatch_get always returns
valid data.
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/0850fcda
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/0850fcda
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/0850fcda
Branch: refs/heads/develop
Commit: 0850fcda110a44d61926cf7619a51f60b58d4e6f
Parents: 425e06f
Author: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Authored: Mon Nov 28 15:03:07 2016 +0100
Committer: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Committed: Tue Nov 29 21:27:30 2016 +0100
----------------------------------------------------------------------
net/nimble/host/src/ble_l2cap_sig.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0850fcda/net/nimble/host/src/ble_l2cap_sig.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_sig.c b/net/nimble/host/src/ble_l2cap_sig.c
index 3b548c0..5ba650e 100644
--- a/net/nimble/host/src/ble_l2cap_sig.c
+++ b/net/nimble/host/src/ble_l2cap_sig.c
@@ -98,6 +98,7 @@ static ble_l2cap_sig_rx_fn * const ble_l2cap_sig_dispatch[] = {
[BLE_L2CAP_SIG_OP_UPDATE_REQ] = ble_l2cap_sig_update_req_rx,
[BLE_L2CAP_SIG_OP_UPDATE_RSP] = ble_l2cap_sig_update_rsp_rx,
[BLE_L2CAP_SIG_OP_CREDIT_CONNECT_RSP] = ble_l2cap_sig_rx_noop,
+ [BLE_L2CAP_SIG_OP_FLOW_CTRL_CREDIT] = ble_l2cap_sig_rx_noop,
};
static uint8_t ble_l2cap_sig_cur_id;
@@ -144,7 +145,7 @@ ble_l2cap_sig_next_id(void)
static ble_l2cap_sig_rx_fn *
ble_l2cap_sig_dispatch_get(uint8_t op)
{
- if (op > BLE_L2CAP_SIG_OP_MAX) {
+ if (op >= BLE_L2CAP_SIG_OP_MAX) {
return NULL;
}
[3/8] incubator-mynewt-core git commit: nimble/l2cap: Fix for L2CAP
connection parameters update
Posted by cc...@apache.org.
nimble/l2cap: Fix for L2CAP connection parameters update
If GAP does not accept parameters (core spec requirements),
BLE_L2CAP_SIG_OP_UPDATE_RSP with a reason
BLE_L2CAP_SIG_UPDATE_RSP_RESULT_REJECT shell be sent back to the
remote device.
This patch fixes PTS test cases TC_LE_CPU_BI_01_C,TC_LE_CPU_BV_02_C.
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/6dc02929
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/6dc02929
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/6dc02929
Branch: refs/heads/develop
Commit: 6dc0292935290a95c4d1f37cf13c25e69a57478a
Parents: 3e8cbec
Author: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Authored: Mon Nov 28 23:43:03 2016 +0100
Committer: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Committed: Tue Nov 29 23:03:49 2016 +0100
----------------------------------------------------------------------
net/nimble/host/src/ble_l2cap_sig.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6dc02929/net/nimble/host/src/ble_l2cap_sig.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_sig.c b/net/nimble/host/src/ble_l2cap_sig.c
index 94dd69d..33cde78 100644
--- a/net/nimble/host/src/ble_l2cap_sig.c
+++ b/net/nimble/host/src/ble_l2cap_sig.c
@@ -353,9 +353,9 @@ ble_l2cap_sig_update_req_rx(uint16_t conn_handle,
if (rc == 0) {
/* Application agrees to accept parameters; schedule update. */
rc = ble_gap_update_params(conn_handle, ¶ms);
- if (rc != 0) {
- return rc;
- }
+ }
+
+ if (rc == 0) {
l2cap_result = BLE_L2CAP_SIG_UPDATE_RSP_RESULT_ACCEPT;
} else {
l2cap_result = BLE_L2CAP_SIG_UPDATE_RSP_RESULT_REJECT;
[2/8] incubator-mynewt-core git commit: nimble/l2cap: Fix for
handling unknown response
Posted by cc...@apache.org.
nimble/l2cap: Fix for handling unknown response
According to BT Spec.v4.2 [Vol 3, Part A], command response with
unknown identifier shall be silently ignored.
For this reason we return 0 as next patches will start to send
"command not understood" in case of error.
Unit test updated accordingly.
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/9db957a5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/9db957a5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/9db957a5
Branch: refs/heads/develop
Commit: 9db957a5e70b97418fe65803f344a640a6e18f93
Parents: 0850fcd
Author: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Authored: Tue Nov 29 22:54:15 2016 +0100
Committer: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Committed: Tue Nov 29 23:03:48 2016 +0100
----------------------------------------------------------------------
net/nimble/host/src/ble_l2cap_sig.c | 2 +-
net/nimble/host/test/src/ble_l2cap_test.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9db957a5/net/nimble/host/src/ble_l2cap_sig.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_sig.c b/net/nimble/host/src/ble_l2cap_sig.c
index 5ba650e..1223934 100644
--- a/net/nimble/host/src/ble_l2cap_sig.c
+++ b/net/nimble/host/src/ble_l2cap_sig.c
@@ -387,7 +387,7 @@ ble_l2cap_sig_update_rsp_rx(uint16_t conn_handle,
BLE_L2CAP_SIG_PROC_OP_UPDATE,
hdr->identifier);
if (proc == NULL) {
- return BLE_HS_ENOENT;
+ return 0;
}
rc = ble_hs_mbuf_pullup_base(om, BLE_L2CAP_SIG_UPDATE_RSP_SZ);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9db957a5/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 c25fe9a..7be148c 100644
--- a/net/nimble/host/test/src/ble_l2cap_test.c
+++ b/net/nimble/host/test/src/ble_l2cap_test.c
@@ -367,7 +367,7 @@ TEST_CASE(ble_l2cap_test_case_sig_unsol_rsp)
/* Receive an unsolicited response. */
rc = ble_hs_test_util_rx_l2cap_update_rsp(2, 100, 0);
- TEST_ASSERT(rc == BLE_HS_ENOENT);
+ TEST_ASSERT(rc == 0);
/* Ensure we did not send anything in return. */
ble_hs_test_util_tx_all();
@@ -547,7 +547,7 @@ TEST_CASE(ble_l2cap_test_case_sig_update_init_fail_bad_id)
/* Receive response from peer with incorrect ID. */
rc = ble_hs_test_util_rx_l2cap_update_rsp(2, id + 1, 0);
- TEST_ASSERT(rc == BLE_HS_ENOENT);
+ TEST_ASSERT(rc == 0);
/* Ensure callback did not get called. */
TEST_ASSERT(ble_l2cap_test_update_status == -1);
[8/8] incubator-mynewt-core git commit: This closes #129.
Posted by cc...@apache.org.
This closes #129.
Merge branch 'l2cap_fixes' into develop
* l2cap_fixes:
nimble/l2cap: Fix for L2CAP connection parameters update
nimble/gap: Add check for connection parameters
nimble/l2cap: Minor flow refactor of ble_l2cap_sig_update_req_rx
nimble/l2cap: Fix L2CAP command not understood handling
nimble/l2cap: Fix for handling unknown L2CAP signaling commands
nimble/l2cap: Fix for handling unknown response
nimble/l2cap: Fix for l2cap rx handles
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/89927059
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/89927059
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/89927059
Branch: refs/heads/develop
Commit: 899270594710f4acf8396d62480d935fad8cc80c
Parents: 5f7ad8c 6dc0292
Author: Christopher Collins <cc...@apache.org>
Authored: Wed Nov 30 12:05:49 2016 -0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Wed Nov 30 12:05:49 2016 -0800
----------------------------------------------------------------------
net/nimble/host/src/ble_gap.c | 31 +++++++++++
net/nimble/host/src/ble_l2cap_sig.c | 71 +++++++++++++-------------
net/nimble/host/test/src/ble_l2cap_test.c | 4 +-
3 files changed, 68 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
[6/8] incubator-mynewt-core git commit: nimble/l2cap: Fix L2CAP
command not understood handling
Posted by cc...@apache.org.
nimble/l2cap: Fix L2CAP command not understood handling
Since BLE_L2CAP_SIG_ERR_CMD_NOT_UNDERSTOOD is 0x0,
BLE_HS_L2C_ERR(BLE_L2CAP_SIG_ERR_CMD_NOT_UNDERSTOOD)
also gives 0x0 which makes this error not possible to distinguish from
a success case which has value 0x0. For this reason we start to use
BLE_HS_EREJECT instead BLE_HS_L2C_ERR(BLE_L2CAP_SIG_ERR_CMD_NOT_UNDERSTOOD).
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/8ddcb0b8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/8ddcb0b8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/8ddcb0b8
Branch: refs/heads/develop
Commit: 8ddcb0b846da853b2a09b0f39856f16254432ded
Parents: 63c2068
Author: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Authored: Mon Nov 28 16:12:10 2016 +0100
Committer: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Committed: Tue Nov 29 23:03:49 2016 +0100
----------------------------------------------------------------------
net/nimble/host/src/ble_l2cap_sig.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/8ddcb0b8/net/nimble/host/src/ble_l2cap_sig.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_sig.c b/net/nimble/host/src/ble_l2cap_sig.c
index 1e6548c..7e3c28d 100644
--- a/net/nimble/host/src/ble_l2cap_sig.c
+++ b/net/nimble/host/src/ble_l2cap_sig.c
@@ -364,7 +364,7 @@ ble_l2cap_sig_update_req_rx(uint16_t conn_handle,
rc = ble_l2cap_sig_update_rsp_tx(conn_handle, hdr->identifier,
l2cap_result);
} else {
- rc = BLE_HS_L2C_ERR(BLE_L2CAP_SIG_ERR_CMD_NOT_UNDERSTOOD);
+ rc = BLE_HS_EREJECT;
}
return rc;
@@ -501,7 +501,7 @@ ble_l2cap_sig_rx(uint16_t conn_handle, struct os_mbuf **om)
rx_cb = ble_l2cap_sig_dispatch_get(hdr.op);
if (rx_cb == NULL) {
- rc = BLE_HS_L2C_ERR(BLE_L2CAP_SIG_ERR_CMD_NOT_UNDERSTOOD);
+ rc = BLE_HS_EREJECT;
} else {
rc = rx_cb(conn_handle, &hdr, om);
}
[5/8] incubator-mynewt-core git commit: nimble/gap: Add check for
connection parameters
Posted by cc...@apache.org.
nimble/gap: Add check for connection parameters
With this patch GAP will make sure that requested connection parameters
are valid. If not BLE_HS_EINVAL will be returned
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/3e8cbec3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/3e8cbec3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/3e8cbec3
Branch: refs/heads/develop
Commit: 3e8cbec34ba02cfcce901a84069bcdf2d1fb2f12
Parents: 9cacc49
Author: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Authored: Mon Nov 28 23:41:40 2016 +0100
Committer: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Committed: Tue Nov 29 23:03:49 2016 +0100
----------------------------------------------------------------------
net/nimble/host/src/ble_gap.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/3e8cbec3/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 6d83a9b..863fc5d 100644
--- a/net/nimble/host/src/ble_gap.c
+++ b/net/nimble/host/src/ble_gap.c
@@ -2857,6 +2857,31 @@ ble_gap_update_tx(uint16_t conn_handle,
return 0;
}
+static bool
+ble_gap_validate_conn_params(const struct ble_gap_upd_params *params)
+{
+
+ /* Requirements from Bluetooth spec. v4.2 [Vol 2, Part E], 7.8.18 */
+ if (params->itvl_min > params->itvl_max) {
+ return false;
+ }
+
+ if (params->itvl_min < 0x0006 || params->itvl_max > 0x0C80) {
+ return false;
+ }
+
+ if (params->latency > 0x01F3) {
+ return false;
+ }
+
+ if (params->supervision_timeout <=
+ (((1 + params->latency) * params->itvl_max) * 6 / 4)) {
+ return false;
+ }
+
+ return true;
+}
+
/**
* Initiates a connection parameter update procedure.
*
@@ -2871,6 +2896,7 @@ ble_gap_update_tx(uint16_t conn_handle,
* BLE_HS_EALREADY if a connection update
* procedure for this connection is already in
* progress;
+ * BLE_HS_EINVAL if requested parameters are invalid;
* Other nonzero on error.
*/
int
@@ -2886,6 +2912,11 @@ ble_gap_update_params(uint16_t conn_handle,
struct ble_hs_conn *conn;
int rc;
+ /* Validate parameters with a spec */
+ if (ble_gap_validate_conn_params(params)) {
+ return BLE_HS_EINVAL;
+ }
+
STATS_INC(ble_gap_stats, update);
memset(&l2cap_params, 0, sizeof l2cap_params);
entry = NULL;
[4/8] incubator-mynewt-core git commit: nimble/l2cap: Fix for
handling unknown L2CAP signaling commands
Posted by cc...@apache.org.
nimble/l2cap: Fix for handling unknown L2CAP signaling commands
With this patch, all unsupported signaling commands are rejected with
a reason "command not understood".
Note that with this patch reject command goes from a single place for
signaling commands.
This patch is a fix for qualification test TC_LE_REJ_BI_02
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/63c20682
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/63c20682
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/63c20682
Branch: refs/heads/develop
Commit: 63c20682e5acb8fbd7ec6928364d30aa965e90c8
Parents: 9db957a
Author: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Authored: Mon Nov 28 15:07:01 2016 +0100
Committer: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Committed: Tue Nov 29 23:03:49 2016 +0100
----------------------------------------------------------------------
net/nimble/host/src/ble_l2cap_sig.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/63c20682/net/nimble/host/src/ble_l2cap_sig.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_sig.c b/net/nimble/host/src/ble_l2cap_sig.c
index 1223934..1e6548c 100644
--- a/net/nimble/host/src/ble_l2cap_sig.c
+++ b/net/nimble/host/src/ble_l2cap_sig.c
@@ -364,9 +364,6 @@ ble_l2cap_sig_update_req_rx(uint16_t conn_handle,
rc = ble_l2cap_sig_update_rsp_tx(conn_handle, hdr->identifier,
l2cap_result);
} else {
- ble_l2cap_sig_reject_tx(conn_handle, hdr->identifier,
- BLE_L2CAP_SIG_ERR_CMD_NOT_UNDERSTOOD,
- NULL, 0);
rc = BLE_HS_L2C_ERR(BLE_L2CAP_SIG_ERR_CMD_NOT_UNDERSTOOD);
}
@@ -504,14 +501,17 @@ ble_l2cap_sig_rx(uint16_t conn_handle, struct os_mbuf **om)
rx_cb = ble_l2cap_sig_dispatch_get(hdr.op);
if (rx_cb == NULL) {
- ble_l2cap_sig_reject_tx(conn_handle, hdr.identifier,
- BLE_L2CAP_SIG_ERR_CMD_NOT_UNDERSTOOD,
- NULL, 0);
rc = BLE_HS_L2C_ERR(BLE_L2CAP_SIG_ERR_CMD_NOT_UNDERSTOOD);
} else {
rc = rx_cb(conn_handle, &hdr, om);
}
+ if (rc) {
+ ble_l2cap_sig_reject_tx(conn_handle, hdr.identifier,
+ BLE_L2CAP_SIG_ERR_CMD_NOT_UNDERSTOOD,
+ NULL, 0);
+ }
+
return rc;
}
[7/8] incubator-mynewt-core git commit: nimble/l2cap: Minor flow
refactor of ble_l2cap_sig_update_req_rx
Posted by cc...@apache.org.
nimble/l2cap: Minor flow refactor of ble_l2cap_sig_update_req_rx
With this patch we exit this function immediately in case device
is not a master on the link.
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/9cacc49a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/9cacc49a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/9cacc49a
Branch: refs/heads/develop
Commit: 9cacc49af745404111697d13b857c1bd6b61cd2a
Parents: 8ddcb0b
Author: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Authored: Mon Nov 28 16:32:33 2016 +0100
Committer: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Committed: Tue Nov 29 23:03:49 2016 +0100
----------------------------------------------------------------------
net/nimble/host/src/ble_l2cap_sig.c | 50 +++++++++++++++-----------------
1 file changed, 24 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9cacc49a/net/nimble/host/src/ble_l2cap_sig.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_sig.c b/net/nimble/host/src/ble_l2cap_sig.c
index 7e3c28d..94dd69d 100644
--- a/net/nimble/host/src/ble_l2cap_sig.c
+++ b/net/nimble/host/src/ble_l2cap_sig.c
@@ -335,37 +335,35 @@ ble_l2cap_sig_update_req_rx(uint16_t conn_handle,
/* Only a master can process an update request. */
sig_err = !(conn_flags & BLE_HS_CONN_F_MASTER);
- if (!sig_err) {
- ble_l2cap_sig_update_req_parse((*om)->om_data, (*om)->om_len, &req);
-
- params.itvl_min = req.itvl_min;
- params.itvl_max = req.itvl_max;
- params.latency = req.slave_latency;
- params.supervision_timeout = req.timeout_multiplier;
- params.min_ce_len = BLE_GAP_INITIAL_CONN_MIN_CE_LEN;
- params.max_ce_len = BLE_GAP_INITIAL_CONN_MAX_CE_LEN;
-
- /* Ask application if slave's connection parameters are acceptable. */
- rc = ble_gap_rx_l2cap_update_req(conn_handle, ¶ms);
- if (rc == 0) {
- /* Application agrees to accept parameters; schedule update. */
- rc = ble_gap_update_params(conn_handle, ¶ms);
- if (rc != 0) {
- return rc;
- }
- l2cap_result = BLE_L2CAP_SIG_UPDATE_RSP_RESULT_ACCEPT;
- } else {
- l2cap_result = BLE_L2CAP_SIG_UPDATE_RSP_RESULT_REJECT;
+ if (sig_err) {
+ return BLE_HS_EREJECT;
+ }
+
+ ble_l2cap_sig_update_req_parse((*om)->om_data, (*om)->om_len, &req);
+
+ params.itvl_min = req.itvl_min;
+ params.itvl_max = req.itvl_max;
+ params.latency = req.slave_latency;
+ params.supervision_timeout = req.timeout_multiplier;
+ params.min_ce_len = BLE_GAP_INITIAL_CONN_MIN_CE_LEN;
+ params.max_ce_len = BLE_GAP_INITIAL_CONN_MAX_CE_LEN;
+
+ /* Ask application if slave's connection parameters are acceptable. */
+ rc = ble_gap_rx_l2cap_update_req(conn_handle, ¶ms);
+ if (rc == 0) {
+ /* Application agrees to accept parameters; schedule update. */
+ rc = ble_gap_update_params(conn_handle, ¶ms);
+ if (rc != 0) {
+ return rc;
}
+ l2cap_result = BLE_L2CAP_SIG_UPDATE_RSP_RESULT_ACCEPT;
+ } else {
+ l2cap_result = BLE_L2CAP_SIG_UPDATE_RSP_RESULT_REJECT;
}
/* Send L2CAP response. */
- if (!sig_err) {
- rc = ble_l2cap_sig_update_rsp_tx(conn_handle, hdr->identifier,
+ rc = ble_l2cap_sig_update_rsp_tx(conn_handle, hdr->identifier,
l2cap_result);
- } else {
- rc = BLE_HS_EREJECT;
- }
return rc;
}