From 77c18856ec7d893948d08a7e218ecbcde5f65245 Mon Sep 17 00:00:00 2001 From: Rahul Tank Date: Wed, 18 Oct 2023 18:17:05 +0530 Subject: [PATCH] Add support for VSC to clear legacy adv memory --- nimble/host/include/host/ble_esp_gap.h | 8 +++++++- nimble/host/src/ble_gap.c | 6 ++++++ nimble/include/nimble/hci_common.h | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/nimble/host/include/host/ble_esp_gap.h b/nimble/host/include/host/ble_esp_gap.h index 196283e99..2ac380ba5 100644 --- a/nimble/host/include/host/ble_esp_gap.h +++ b/nimble/host/include/host/ble_esp_gap.h @@ -179,8 +179,14 @@ int ble_gap_set_auto_pcl_param(struct ble_gap_set_auto_pcl_params *params); * * @return 0 on success; nonzero on failure. */ - int ble_gap_duplicate_exception_list(uint8_t subcode, uint8_t type, uint8_t *value, void *cb); + +/** + * This API is used to clean up residue memory in controller for legacy advertisement + * + * @return 0 on success; nonzero on failure. + */ +int ble_gap_clear_legacy_adv(void); #endif #ifdef __cplusplus diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c index 677a52fbf..32f50abbf 100644 --- a/nimble/host/src/ble_gap.c +++ b/nimble/host/src/ble_gap.c @@ -7480,6 +7480,12 @@ ble_gap_duplicate_exception_list(uint8_t subcode, uint8_t type, uint8_t *value, return ble_hs_hci_send_vs_cmd(BLE_HCI_OCF_VS_DUPLICATE_EXCEPTION_LIST, &device_info_array, sizeof(device_info_array), NULL, 0); } + +int ble_gap_clear_legacy_adv(void) +{ + return ble_hs_hci_send_vs_cmd(BLE_HCI_OCF_VS_LEGACY_ADV_CLEAR, + NULL, 0, NULL, 0); +} #endif int diff --git a/nimble/include/nimble/hci_common.h b/nimble/include/nimble/hci_common.h index fa85deda9..a64b48046 100644 --- a/nimble/include/nimble/hci_common.h +++ b/nimble/include/nimble/hci_common.h @@ -1223,6 +1223,8 @@ struct ble_hci_vs_duplicate_exception_list_cp { uint8_t device_info[6]; } __attribute__((packed)); +#define BLE_HCI_OCF_VS_LEGACY_ADV_CLEAR (MYNEWT_VAL(BLE_HCI_VS_OCF_OFFSET) + (0x010C)) + /* Command Specific Definitions */ /* --- Set controller to host flow control (OGF 0x03, OCF 0x0031) --- */ #define BLE_HCI_CTLR_TO_HOST_FC_OFF (0)