mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(protocomm): Remove the configuration check of wifi_provisioning for protocomm component
This commit is contained in:
parent
6b1f40b9bf
commit
7bfd475528
@ -26,4 +26,17 @@ menu "Protocomm"
|
||||
Disabling this option saves some code size.
|
||||
Consult the Enabling protocomm security version section of the
|
||||
Protocomm documentation in ESP-IDF Programming guide for more details.
|
||||
|
||||
config ESP_PROTOCOMM_KEEP_BLE_ON_AFTER_BLE_STOP
|
||||
bool
|
||||
depends on BT_ENABLED
|
||||
help
|
||||
Keep BT on after calling protocomm_ble_stop
|
||||
|
||||
config ESP_PROTOCOMM_DISCONNECT_AFTER_BLE_STOP
|
||||
bool
|
||||
depends on ESP_PROTOCOMM_KEEP_BLE_ON_AFTER_BLE_STOP
|
||||
help
|
||||
Terminate connection after calling protocomm_ble_stop
|
||||
|
||||
endmenu
|
||||
|
@ -325,9 +325,7 @@ esp_err_t simple_ble_stop(void)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_WIFI_PROV_DISCONNECT_AFTER_PROV
|
||||
esp_err_t simple_ble_disconnect(void)
|
||||
{
|
||||
return esp_ble_gap_disconnect(s_cached_remote_bda);
|
||||
}
|
||||
#endif
|
||||
|
@ -104,7 +104,6 @@ esp_err_t simple_ble_stop(void);
|
||||
*/
|
||||
const uint8_t *simple_ble_get_uuid128(uint16_t handle);
|
||||
|
||||
#ifdef CONFIG_WIFI_PROV_DISCONNECT_AFTER_PROV
|
||||
/** Terminates connection
|
||||
*
|
||||
* This API is called to initiate disconnection
|
||||
@ -112,5 +111,4 @@ const uint8_t *simple_ble_get_uuid128(uint16_t handle);
|
||||
* @return ESP_OK on success, and appropriate error code for failure
|
||||
*/
|
||||
esp_err_t simple_ble_disconnect(void);
|
||||
#endif
|
||||
#endif /* _SIMPLE_BLE_ */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2018-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -332,13 +332,11 @@ static void transport_simple_ble_disconnect(esp_gatts_cb_event_t event, esp_gatt
|
||||
esp_err_t ret;
|
||||
ESP_LOGD(TAG, "Inside disconnect w/ session - %d", param->disconnect.conn_id);
|
||||
|
||||
#ifdef CONFIG_WIFI_PROV_KEEP_BLE_ON_AFTER_PROV
|
||||
/* Ignore BLE events received after protocomm layer is stopped */
|
||||
if (protoble_internal == NULL) {
|
||||
ESP_LOGI(TAG,"Protocomm layer has already stopped");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (protoble_internal->pc_ble->sec &&
|
||||
protoble_internal->pc_ble->sec->close_transport_session) {
|
||||
@ -360,13 +358,11 @@ static void transport_simple_ble_connect(esp_gatts_cb_event_t event, esp_gatt_if
|
||||
esp_err_t ret;
|
||||
ESP_LOGD(TAG, "Inside BLE connect w/ conn_id - %d", param->connect.conn_id);
|
||||
|
||||
#ifdef CONFIG_WIFI_PROV_KEEP_BLE_ON_AFTER_PROV
|
||||
/* Ignore BLE events received after protocomm layer is stopped */
|
||||
if (protoble_internal == NULL) {
|
||||
ESP_LOGI(TAG,"Protocomm layer has already stopped");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (protoble_internal->pc_ble->sec &&
|
||||
protoble_internal->pc_ble->sec->new_transport_session) {
|
||||
@ -613,23 +609,23 @@ esp_err_t protocomm_ble_stop(protocomm_t *pc)
|
||||
(pc == protoble_internal->pc_ble)) {
|
||||
esp_err_t ret = ESP_OK;
|
||||
|
||||
#ifndef CONFIG_WIFI_PROV_KEEP_BLE_ON_AFTER_PROV
|
||||
/* If flag is not enabled, stop the stack. */
|
||||
ret = simple_ble_stop();
|
||||
if (ret) {
|
||||
ESP_LOGE(TAG, "BLE stop failed");
|
||||
}
|
||||
simple_ble_deinit();
|
||||
#else
|
||||
#ifdef CONFIG_WIFI_PROV_DISCONNECT_AFTER_PROV
|
||||
#ifdef CONFIG_ESP_PROTOCOMM_KEEP_BLE_ON_AFTER_BLE_STOP
|
||||
#ifdef CONFIG_ESP_PROTOCOMM_DISCONNECT_AFTER_BLE_STOP
|
||||
/* Keep BT stack on, but terminate the connection after provisioning */
|
||||
ret = simple_ble_disconnect();
|
||||
if (ret) {
|
||||
ESP_LOGE(TAG, "BLE disconnect failed");
|
||||
}
|
||||
simple_ble_deinit();
|
||||
#endif // CONFIG_WIFI_PROV_DISCONNECT_AFTER_PROV
|
||||
#endif // CONFIG_WIFI_PROV_KEEP_BLE_ON_AFTER_PROV
|
||||
#endif // CONFIG_ESP_PROTOCOMM_DISCONNECT_AFTER_BLE_STOP
|
||||
#else
|
||||
/* If flag is not enabled, stop the stack. */
|
||||
ret = simple_ble_stop();
|
||||
if (ret) {
|
||||
ESP_LOGE(TAG, "BLE stop failed");
|
||||
}
|
||||
simple_ble_deinit();
|
||||
#endif // CONFIG_ESP_PROTOCOMM_KEEP_BLE_ON_AFTER_BLE_STOP
|
||||
|
||||
protocomm_ble_cleanup();
|
||||
return ret;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -556,13 +556,12 @@ static void transport_simple_ble_disconnect(struct ble_gap_event *event, void *a
|
||||
ESP_LOGD(TAG, "Inside disconnect w/ session - %d",
|
||||
event->disconnect.conn.conn_handle);
|
||||
|
||||
#ifdef CONFIG_WIFI_PROV_KEEP_BLE_ON_AFTER_PROV
|
||||
/* Ignore BLE events received after protocomm layer is stopped */
|
||||
if (protoble_internal == NULL) {
|
||||
ESP_LOGI(TAG,"Protocomm layer has already stopped");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (protoble_internal->pc_ble->sec &&
|
||||
protoble_internal->pc_ble->sec->close_transport_session) {
|
||||
ret =
|
||||
@ -583,13 +582,11 @@ static void transport_simple_ble_connect(struct ble_gap_event *event, void *arg)
|
||||
esp_err_t ret;
|
||||
ESP_LOGD(TAG, "Inside BLE connect w/ conn_id - %d", event->connect.conn_handle);
|
||||
|
||||
#ifdef CONFIG_WIFI_PROV_KEEP_BLE_ON_AFTER_PROV
|
||||
/* Ignore BLE events received after protocomm layer is stopped */
|
||||
if (protoble_internal == NULL) {
|
||||
ESP_LOGI(TAG,"Protocomm layer has already stopped");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (protoble_internal->pc_ble->sec &&
|
||||
protoble_internal->pc_ble->sec->new_transport_session) {
|
||||
@ -993,23 +990,23 @@ esp_err_t protocomm_ble_stop(protocomm_t *pc)
|
||||
rc);
|
||||
}
|
||||
|
||||
#ifndef CONFIG_WIFI_PROV_KEEP_BLE_ON_AFTER_PROV
|
||||
/* If flag is enabled, don't stop the stack. User application can start a new advertising to perform its BT activities */
|
||||
ret = nimble_port_stop();
|
||||
if (ret == 0) {
|
||||
nimble_port_deinit();
|
||||
}
|
||||
free_gatt_ble_misc_memory(ble_cfg_p);
|
||||
#else
|
||||
#ifdef CONFIG_WIFI_PROV_DISCONNECT_AFTER_PROV
|
||||
#ifdef CONFIG_ESP_PROTOCOMM_KEEP_BLE_ON_AFTER_BLE_STOP
|
||||
#ifdef CONFIG_ESP_PROTOCOMM_DISCONNECT_AFTER_BLE_STOP
|
||||
/* Keep BT stack on, but terminate the connection after provisioning */
|
||||
rc = ble_gap_terminate(s_cached_conn_handle, BLE_ERR_REM_USER_CONN_TERM);
|
||||
if (rc) {
|
||||
ESP_LOGI(TAG, "Error in terminating connection rc = %d",rc);
|
||||
}
|
||||
free_gatt_ble_misc_memory(ble_cfg_p);
|
||||
#endif // CONFIG_WIFI_PROV_DISCONNECT_AFTER_PROV
|
||||
#endif // CONFIG_WIFI_PROV_KEEP_BLE_ON_AFTER_PROV
|
||||
#endif // CONFIG_ESP_PROTOCOMM_DISCONNECT_AFTER_BLE_STOP
|
||||
#else
|
||||
/* If flag is enabled, don't stop the stack. User application can start a new advertising to perform its BT activities */
|
||||
ret = nimble_port_stop();
|
||||
if (ret == 0) {
|
||||
nimble_port_deinit();
|
||||
}
|
||||
free_gatt_ble_misc_memory(ble_cfg_p);
|
||||
#endif // CONFIG_ESP_PROTOCOMM_KEEP_BLE_ON_AFTER_BLE_STOP
|
||||
|
||||
protocomm_ble_cleanup();
|
||||
return ret;
|
||||
|
@ -39,11 +39,13 @@ menu "Wi-Fi Provisioning Manager"
|
||||
config WIFI_PROV_KEEP_BLE_ON_AFTER_PROV
|
||||
bool "Keep BT on after provisioning is done"
|
||||
depends on BT_ENABLED
|
||||
select ESP_PROTOCOMM_KEEP_BLE_ON_AFTER_BLE_STOP
|
||||
|
||||
config WIFI_PROV_DISCONNECT_AFTER_PROV
|
||||
bool "Terminate connection after provisioning is done"
|
||||
depends on WIFI_PROV_KEEP_BLE_ON_AFTER_PROV
|
||||
default y
|
||||
select ESP_PROTOCOMM_DISCONNECT_AFTER_BLE_STOP
|
||||
|
||||
choice WIFI_PROV_STA_SCAN_METHOD
|
||||
bool "Wifi Provisioning Scan Method"
|
||||
|
Loading…
Reference in New Issue
Block a user