NimBLE: Misc changes in host flow control, ble_gap_unpair, ble_hs_hci_rx_evt & example

- Add menuconfig option for NimBLE host flow control
- Include changes in `blecent` example from upstream PR!702
- add ble_hs_lock in ble_gap_unpair Upstream PR!584
- ble_hs_hci_rx_evt, upstream PR!738

Closes https://github.com/espressif/esp-idf/issues/4243
This commit is contained in:
Prasad Alatkar 2019-12-18 10:50:57 +05:30
parent ac1834e288
commit 4047f7e180
4 changed files with 50 additions and 7 deletions

View file

@ -216,6 +216,37 @@ config BT_NIMBLE_HCI_EVT_LO_BUF_COUNT
low-priority event buffers, then an incoming advertising report will
get dropped
config BT_NIMBLE_HS_FLOW_CTRL
bool "Enable Host Flow control"
depends on BT_NIMBLE_ENABLED
default y
help
Enable Host Flow control
config BT_NIMBLE_HS_FLOW_CTRL_ITVL
int "Host Flow control interval"
depends on BT_NIMBLE_HS_FLOW_CTRL
default 1000
help
Host flow control interval in msecs
config BT_NIMBLE_HS_FLOW_CTRL_THRESH
int "Host Flow control threshold"
depends on BT_NIMBLE_HS_FLOW_CTRL
default 2
help
Host flow control threshold, if the number of free buffers are at or
below this threshold, send an immediate number-of-completed-packets
event
config BT_NIMBLE_HS_FLOW_CTRL_TX_ON_DISCONNECT
bool "Host Flow control on disconnect"
depends on BT_NIMBLE_HS_FLOW_CTRL
default y
help
Enable this option to send number-of-completed-packets event to
controller after disconnection
menuconfig BT_NIMBLE_MESH
bool "Enable BLE mesh functionality"
select BT_NIMBLE_SM_SC

@ -1 +1 @@
Subproject commit f7a993a441d713e5cc52006659c8b8d23f4343ed
Subproject commit c6fa32fcc6e73f91e4637be98fc5c1785bdc1b2d

View file

@ -452,19 +452,23 @@
#endif
#ifndef MYNEWT_VAL_BLE_HS_FLOW_CTRL
#ifdef CONFIG_BT_NIMBLE_HS_FLOW_CTRL
#define MYNEWT_VAL_BLE_HS_FLOW_CTRL (1)
#else
#define MYNEWT_VAL_BLE_HS_FLOW_CTRL (0)
#endif
#endif
#ifndef MYNEWT_VAL_BLE_HS_FLOW_CTRL_ITVL
#define MYNEWT_VAL_BLE_HS_FLOW_CTRL_ITVL (1000)
#define MYNEWT_VAL_BLE_HS_FLOW_CTRL_ITVL CONFIG_BT_NIMBLE_HS_FLOW_CTRL_ITVL
#endif
#ifndef MYNEWT_VAL_BLE_HS_FLOW_CTRL_THRESH
#define MYNEWT_VAL_BLE_HS_FLOW_CTRL_THRESH (2)
#define MYNEWT_VAL_BLE_HS_FLOW_CTRL_THRESH CONFIG_BT_NIMBLE_HS_FLOW_CTRL_THRESH
#endif
#ifndef MYNEWT_VAL_BLE_HS_FLOW_CTRL_TX_ON_DISCONNECT
#define MYNEWT_VAL_BLE_HS_FLOW_CTRL_TX_ON_DISCONNECT (0)
#define MYNEWT_VAL_BLE_HS_FLOW_CTRL_TX_ON_DISCONNECT CONFIG_BT_NIMBLE_FLOW_CTRL_TX_ON_DISCONNECT
#endif
#ifndef MYNEWT_VAL_BLE_HS_PHONY_HCI_ACKS

View file

@ -319,6 +319,7 @@ blecent_should_connect(const struct ble_gap_disc_desc *disc)
static void
blecent_connect_if_interesting(const struct ble_gap_disc_desc *disc)
{
uint8_t own_addr_type;
int rc;
/* Don't do anything if we don't care about this advertiser. */
@ -333,16 +334,23 @@ blecent_connect_if_interesting(const struct ble_gap_disc_desc *disc)
return;
}
/* Figure out address to use for connect (no privacy for now) */
rc = ble_hs_id_infer_auto(0, &own_addr_type);
if (rc != 0) {
MODLOG_DFLT(ERROR, "error determining address type; rc=%d\n", rc);
return;
}
/* Try to connect the the advertiser. Allow 30 seconds (30000 ms) for
* timeout.
*/
rc = ble_gap_connect(BLE_OWN_ADDR_PUBLIC, &disc->addr, 30000, NULL,
rc = ble_gap_connect(own_addr_type, &disc->addr, 30000, NULL,
blecent_gap_event, NULL);
if (rc != 0) {
MODLOG_DFLT(ERROR, "Error: Failed to connect to device; addr_type=%d "
"addr=%s\n",
disc->addr.type, addr_str(disc->addr.val));
"addr=%s; rc=%d\n",
disc->addr.type, addr_str(disc->addr.val), rc);
return;
}
}