mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-09-14 21:20:06 +00:00
nimble/ll: Use common helper for conn params check
Turns out we already have one, so let's use it in new code.
This commit is contained in:
@@ -435,23 +435,13 @@ ble_ll_conn_hci_create_check_scan(struct ble_ll_conn_create_scan *p)
|
|||||||
static int
|
static int
|
||||||
ble_ll_conn_hci_create_check_params(struct ble_ll_conn_create_params *cc_params)
|
ble_ll_conn_hci_create_check_params(struct ble_ll_conn_create_params *cc_params)
|
||||||
{
|
{
|
||||||
uint32_t supervision_tmo_us;
|
int rc;
|
||||||
uint32_t conn_itvl_us;
|
|
||||||
|
|
||||||
if ((cc_params->conn_itvl < BLE_HCI_CONN_ITVL_MIN) ||
|
rc = ble_ll_conn_hci_chk_conn_params(cc_params->conn_itvl,
|
||||||
(cc_params->conn_itvl > BLE_HCI_CONN_ITVL_MAX) ||
|
cc_params->conn_itvl,
|
||||||
(cc_params->conn_latency > BLE_HCI_CONN_LATENCY_MAX) ||
|
cc_params->conn_latency,
|
||||||
(cc_params->supervision_timeout < BLE_HCI_CONN_SPVN_TIMEOUT_MIN) ||
|
cc_params->supervision_timeout);
|
||||||
(cc_params->supervision_timeout > BLE_HCI_CONN_SPVN_TIMEOUT_MAX)) {
|
if (rc) {
|
||||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Supervision timeout must be longer than (1 + latency) * interval * 2 */
|
|
||||||
supervision_tmo_us = cc_params->supervision_timeout *
|
|
||||||
BLE_HCI_CONN_SPVN_TMO_UNITS * 1000;
|
|
||||||
conn_itvl_us = cc_params->conn_itvl * BLE_LL_CONN_ITVL_USECS;
|
|
||||||
|
|
||||||
if (supervision_tmo_us <= (1 + cc_params->conn_latency) * conn_itvl_us * 2) {
|
|
||||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user