feat(nimble): Add support to allow connection during scanning

This commit is contained in:
Rahul Tank
2024-08-01 13:49:10 +05:30
parent 4af7646927
commit 92e4100df1
13 changed files with 65 additions and 31 deletions

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@@ -164,12 +164,14 @@ ble_spp_client_connect_if_interesting(const struct ble_gap_disc_desc *disc)
return;
}
#if !(MYNEWT_VAL(BLE_HOST_ALLOW_CONNECT_WITH_SCAN))
/* Scanning must be stopped before a connection can be initiated. */
rc = ble_gap_disc_cancel();
if (rc != 0) {
MODLOG_DFLT(DEBUG, "Failed to cancel scan; rc=%d\n", rc);
return;
}
#endif
/* Figure out address to use for connect (no privacy for now) */
rc = ble_hs_id_infer_auto(0, &own_addr_type);
@@ -221,7 +223,7 @@ ble_spp_client_gap_event(struct ble_gap_event *event, void *arg)
return 0;
}
/* An advertisment report was received during GAP discovery. */
/* An advertisement report was received during GAP discovery. */
print_adv_fields(&fields);
/* Try to connect to the advertiser if it looks interesting. */
@@ -347,7 +349,7 @@ void ble_client_uart_task(void *pvParameters)
//Waiting for UART event.
if (xQueueReceive(spp_common_uart_queue, (void * )&event, (TickType_t)portMAX_DELAY)) {
switch (event.type) {
//Event of UART receving data
//Event of UART receiving data
case UART_DATA:
if (event.size) {