Merge branch 'bugfix/fix_ble_issues_5.1' into 'release/v5.1'

fix(nimble): Bugfix/fix ble issues 5.1

See merge request espressif/esp-idf!30246
This commit is contained in:
Rahul Tank 2024-05-13 13:55:15 +08:00
commit 7ad7f84f0f
5 changed files with 43 additions and 4 deletions

View File

@ -632,8 +632,9 @@ config BT_NIMBLE_PERIODIC_ADV_ENH
menuconfig BT_NIMBLE_GATT_CACHING menuconfig BT_NIMBLE_GATT_CACHING
bool "Enable GATT caching" bool "Enable GATT caching"
depends on BT_NIMBLE_ENABLED && BT_NIMBLE_50_FEATURE_SUPPORT depends on BT_NIMBLE_ENABLED && BT_NIMBLE_50_FEATURE_SUPPORT
select BT_NIMBLE_DYNAMIC_SERVICE
help help
Enable GATT caching Enable GATT caching
config BT_NIMBLE_GATT_CACHING_MAX_CONNS config BT_NIMBLE_GATT_CACHING_MAX_CONNS
int "Maximum connections to be cached" int "Maximum connections to be cached"
depends on BT_NIMBLE_GATT_CACHING depends on BT_NIMBLE_GATT_CACHING

@ -1 +1 @@
Subproject commit 299279a46795a6de44c2683cae6f85e0c68cb551 Subproject commit a2acac3e14bb7810783ac5089ccf8229a2dd2f70

View File

@ -133,10 +133,31 @@
#define MYNEWT_VAL_BLE_GATT_CACHING (0) #define MYNEWT_VAL_BLE_GATT_CACHING (0)
#else #else
#define MYNEWT_VAL_BLE_GATT_CACHING (CONFIG_BT_NIMBLE_GATT_CACHING) #define MYNEWT_VAL_BLE_GATT_CACHING (CONFIG_BT_NIMBLE_GATT_CACHING)
#ifdef CONFIG_BT_NIMBLE_GATT_CACHING_MAX_CONNS
#define MYNEWT_VAL_BLE_GATT_CACHING_MAX_CONNS (CONFIG_BT_NIMBLE_GATT_CACHING_MAX_CONNS) #define MYNEWT_VAL_BLE_GATT_CACHING_MAX_CONNS (CONFIG_BT_NIMBLE_GATT_CACHING_MAX_CONNS)
#else
#define MYNEWT_VAL_BLE_GATT_CACHING_MAX_CONNS (0)
#endif
#ifdef CONFIG_BT_NIMBLE_GATT_CACHING_MAX_SVCS
#define MYNEWT_VAL_BLE_GATT_CACHING_MAX_SVCS (CONFIG_BT_NIMBLE_GATT_CACHING_MAX_SVCS) #define MYNEWT_VAL_BLE_GATT_CACHING_MAX_SVCS (CONFIG_BT_NIMBLE_GATT_CACHING_MAX_SVCS)
#else
#define MYNEWT_VAL_BLE_GATT_CACHING_MAX_SVCS (0)
#endif
#ifdef CONFIG_BT_NIMBLE_GATT_CACHING_MAX_CHRS
#define MYNEWT_VAL_BLE_GATT_CACHING_MAX_CHRS (CONFIG_BT_NIMBLE_GATT_CACHING_MAX_CHRS) #define MYNEWT_VAL_BLE_GATT_CACHING_MAX_CHRS (CONFIG_BT_NIMBLE_GATT_CACHING_MAX_CHRS)
#else
#define MYNEWT_VAL_BLE_GATT_CACHING_MAX_CHRS (0)
#endif
#ifdef CONFIG_BT_NIMBLE_GATT_CACHING_MAX_DSCS
#define MYNEWT_VAL_BLE_GATT_CACHING_MAX_DSCS (CONFIG_BT_NIMBLE_GATT_CACHING_MAX_DSCS) #define MYNEWT_VAL_BLE_GATT_CACHING_MAX_DSCS (CONFIG_BT_NIMBLE_GATT_CACHING_MAX_DSCS)
#else
#define MYNEWT_VAL_BLE_GATT_CACHING_MAX_DSCS (0)
#endif
#endif #endif
#ifndef CONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES #ifndef CONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES
@ -487,7 +508,11 @@
/*** @apache-mynewt-nimble/nimble/host */ /*** @apache-mynewt-nimble/nimble/host */
#ifndef MYNEWT_VAL_BLE_DYNAMIC_SERVICE #ifndef MYNEWT_VAL_BLE_DYNAMIC_SERVICE
#ifdef CONFIG_BT_NIMBLE_DYNAMIC_SERVICE
#define MYNEWT_VAL_BLE_DYNAMIC_SERVICE CONFIG_BT_NIMBLE_DYNAMIC_SERVICE #define MYNEWT_VAL_BLE_DYNAMIC_SERVICE CONFIG_BT_NIMBLE_DYNAMIC_SERVICE
#else
#define MYNEWT_VAL_BLE_DYNAMIC_SERVICE (0)
#endif
#endif #endif
#ifndef MYNEWT_VAL_BLE_ATT_PREFERRED_MTU #ifndef MYNEWT_VAL_BLE_ATT_PREFERRED_MTU
@ -848,7 +873,11 @@
#ifndef MYNEWT_VAL_BLE_SM_SC_LVL #ifndef MYNEWT_VAL_BLE_SM_SC_LVL
#ifdef CONFIG_BT_NIMBLE_SM_SC_LVL
#define MYNEWT_VAL_BLE_SM_SC_LVL CONFIG_BT_NIMBLE_SM_SC_LVL #define MYNEWT_VAL_BLE_SM_SC_LVL CONFIG_BT_NIMBLE_SM_SC_LVL
#else
#define MYNEWT_VAL_BLE_SM_SC_LVL (0)
#endif
#endif #endif
#ifndef MYNEWT_VAL_BLE_SM_SC_ONLY #ifndef MYNEWT_VAL_BLE_SM_SC_ONLY

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 * SPDX-License-Identifier: Unlicense OR CC0-1.0
*/ */
@ -22,6 +22,8 @@
#include "host/ble_hs_adv.h" #include "host/ble_hs_adv.h"
#include "nimble/ble.h" #include "nimble/ble.h"
#include "host/ble_sm.h" #include "host/ble_sm.h"
#else
#include "esp_bt_device.h"
#endif #endif
static const char *TAG = "ESP_HID_GAP"; static const char *TAG = "ESP_HID_GAP";
@ -697,9 +699,13 @@ esp_err_t esp_hid_ble_gap_adv_start(void)
return esp_ble_gap_start_advertising(&hidd_adv_params); return esp_ble_gap_start_advertising(&hidd_adv_params);
} }
#endif /* CONFIG_BT_BLE_ENABLED */ #endif /* CONFIG_BT_BLE_ENABLED */
#if CONFIG_BT_NIMBLE_ENABLED #if CONFIG_BT_NIMBLE_ENABLED
static struct ble_hs_adv_fields fields;
#define GATT_SVR_SVC_HID_UUID 0x1812 #define GATT_SVR_SVC_HID_UUID 0x1812
extern void ble_hid_task_start_up(void);
static struct ble_hs_adv_fields fields;
esp_err_t esp_hid_ble_gap_adv_init(uint16_t appearance, const char *device_name) esp_err_t esp_hid_ble_gap_adv_init(uint16_t appearance, const char *device_name)
{ {
ble_uuid16_t *uuid16, *uuid16_1; ble_uuid16_t *uuid16, *uuid16_1;
@ -806,6 +812,7 @@ nimble_hid_gap_event(struct ble_gap_event *event, void *arg)
event->enc_change.status); event->enc_change.status);
rc = ble_gap_conn_find(event->enc_change.conn_handle, &desc); rc = ble_gap_conn_find(event->enc_change.conn_handle, &desc);
assert(rc == 0); assert(rc == 0);
ble_hid_task_start_up();
return 0; return 0;
case BLE_GAP_EVENT_NOTIFY_TX: case BLE_GAP_EVENT_NOTIFY_TX:

View File

@ -22,6 +22,8 @@
#include "nimble/ble.h" #include "nimble/ble.h"
#include "host/ble_sm.h" #include "host/ble_sm.h"
#define BLE_HID_SVC_UUID 0x1812 /* HID Service*/ #define BLE_HID_SVC_UUID 0x1812 /* HID Service*/
#else
#include "esp_bt_device.h"
#endif #endif
static const char *TAG = "ESP_HID_GAP"; static const char *TAG = "ESP_HID_GAP";