diff --git a/components/bt/host/nimble/Kconfig.in b/components/bt/host/nimble/Kconfig.in index 442c485d53..06ec1dca11 100644 --- a/components/bt/host/nimble/Kconfig.in +++ b/components/bt/host/nimble/Kconfig.in @@ -632,8 +632,9 @@ config BT_NIMBLE_PERIODIC_ADV_ENH menuconfig BT_NIMBLE_GATT_CACHING bool "Enable GATT caching" depends on BT_NIMBLE_ENABLED && BT_NIMBLE_50_FEATURE_SUPPORT + select BT_NIMBLE_DYNAMIC_SERVICE help - Enable GATT caching + Enable GATT caching config BT_NIMBLE_GATT_CACHING_MAX_CONNS int "Maximum connections to be cached" depends on BT_NIMBLE_GATT_CACHING diff --git a/components/bt/host/nimble/nimble b/components/bt/host/nimble/nimble index 299279a467..a2acac3e14 160000 --- a/components/bt/host/nimble/nimble +++ b/components/bt/host/nimble/nimble @@ -1 +1 @@ -Subproject commit 299279a46795a6de44c2683cae6f85e0c68cb551 +Subproject commit a2acac3e14bb7810783ac5089ccf8229a2dd2f70 diff --git a/components/bt/host/nimble/port/include/esp_nimble_cfg.h b/components/bt/host/nimble/port/include/esp_nimble_cfg.h index 6d2a9cf8aa..6a47d90f1d 100644 --- a/components/bt/host/nimble/port/include/esp_nimble_cfg.h +++ b/components/bt/host/nimble/port/include/esp_nimble_cfg.h @@ -133,10 +133,31 @@ #define MYNEWT_VAL_BLE_GATT_CACHING (0) #else #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) +#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) +#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) +#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) +#else +#define MYNEWT_VAL_BLE_GATT_CACHING_MAX_DSCS (0) +#endif + #endif #ifndef CONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES @@ -487,7 +508,11 @@ /*** @apache-mynewt-nimble/nimble/host */ #ifndef MYNEWT_VAL_BLE_DYNAMIC_SERVICE +#ifdef 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 #ifndef MYNEWT_VAL_BLE_ATT_PREFERRED_MTU @@ -848,7 +873,11 @@ #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 +#else +#define MYNEWT_VAL_BLE_SM_SC_LVL (0) +#endif #endif #ifndef MYNEWT_VAL_BLE_SM_SC_ONLY diff --git a/examples/bluetooth/esp_hid_device/main/esp_hid_gap.c b/examples/bluetooth/esp_hid_device/main/esp_hid_gap.c index af763f3b39..6b2c78b954 100644 --- a/examples/bluetooth/esp_hid_device/main/esp_hid_gap.c +++ b/examples/bluetooth/esp_hid_device/main/esp_hid_gap.c @@ -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 */ @@ -22,6 +22,8 @@ #include "host/ble_hs_adv.h" #include "nimble/ble.h" #include "host/ble_sm.h" +#else +#include "esp_bt_device.h" #endif 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); } #endif /* CONFIG_BT_BLE_ENABLED */ + #if CONFIG_BT_NIMBLE_ENABLED -static struct ble_hs_adv_fields fields; #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) { 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); rc = ble_gap_conn_find(event->enc_change.conn_handle, &desc); assert(rc == 0); + ble_hid_task_start_up(); return 0; case BLE_GAP_EVENT_NOTIFY_TX: diff --git a/examples/bluetooth/esp_hid_host/main/esp_hid_gap.c b/examples/bluetooth/esp_hid_host/main/esp_hid_gap.c index 249d1f0fda..94fab0775c 100644 --- a/examples/bluetooth/esp_hid_host/main/esp_hid_gap.c +++ b/examples/bluetooth/esp_hid_host/main/esp_hid_gap.c @@ -22,6 +22,8 @@ #include "nimble/ble.h" #include "host/ble_sm.h" #define BLE_HID_SVC_UUID 0x1812 /* HID Service*/ +#else +#include "esp_bt_device.h" #endif static const char *TAG = "ESP_HID_GAP";