Blufi: use blufi_env.conn_id instead of local variable

This commit is contained in:
Rahul Tank 2023-05-31 19:29:25 +05:30
parent dd7e8b7955
commit 4377ba639b

View File

@ -33,7 +33,6 @@
#if (BLUFI_INCLUDED == TRUE)
static uint8_t own_addr_type;
static uint16_t conn_handle;
struct gatt_value gatt_values[SERVER_MAX_VALUES];
const static char *TAG = "BLUFI_EXAMPLE";
@ -265,7 +264,7 @@ esp_blufi_gap_event(struct ble_gap_event *event, void *arg)
param.connect.conn_id = event->connect.conn_handle;
/* save connection handle */
conn_handle = event->connect.conn_handle;
blufi_env.conn_id = event->connect.conn_handle;
btc_transfer_context(&msg, &param, sizeof(esp_blufi_cb_param_t), NULL, NULL);
}
if (event->connect.status != 0) {
@ -445,7 +444,7 @@ void esp_blufi_send_notify(void *arg)
void esp_blufi_disconnect(void)
{
ble_gap_terminate(conn_handle, BLE_ERR_REM_USER_CONN_TERM);
ble_gap_terminate(blufi_env.conn_id, BLE_ERR_REM_USER_CONN_TERM);
}
void esp_blufi_adv_stop(void) {}