feat(ble/bluedroid): Support BLE50 instance in related event

This commit is contained in:
zhanghaipeng 2024-07-06 18:31:08 +08:00
parent 44f58ecb51
commit 095a0dd85f
6 changed files with 125 additions and 56 deletions

View File

@ -846,6 +846,10 @@ typedef uint8_t esp_ble_gap_adv_type_t;
/// Extend advertising tx power, range: [-127, +126] dBm
#define EXT_ADV_TX_PWR_NO_PREFERENCE (127) /*!< host has no preference for tx power */
/// max number of advertising sets to enable or disable
#define EXT_ADV_NUM_SETS_MAX (10) /*!< max evt instance num */
/**
* @brief ext adv parameters
*/
@ -1256,72 +1260,86 @@ typedef union {
*/
struct ble_ext_adv_set_rand_addr_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate extend advertising random address set status */
uint8_t instance; /*!< extend advertising handle */
} ext_adv_set_rand_addr; /*!< Event parameter of ESP_GAP_BLE_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_EXT_ADV_SET_PARAMS_COMPLETE_EVT
*/
struct ble_ext_adv_set_params_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate extend advertising parameters set status */
uint8_t instance; /*!< extend advertising handle */
} ext_adv_set_params; /*!< Event parameter of ESP_GAP_BLE_EXT_ADV_SET_PARAMS_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_EXT_ADV_DATA_SET_COMPLETE_EVT
*/
struct ble_ext_adv_data_set_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate extend advertising data set status */
uint8_t instance; /*!< extend advertising handle */
} ext_adv_data_set; /*!< Event parameter of ESP_GAP_BLE_EXT_ADV_DATA_SET_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_EXT_SCAN_RSP_DATA_SET_COMPLETE_EVT
*/
struct ble_ext_adv_scan_rsp_set_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate extend advertising scan response data set status */
uint8_t instance; /*!< extend advertising handle */
} scan_rsp_set; /*!< Event parameter of ESP_GAP_BLE_EXT_SCAN_RSP_DATA_SET_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_EXT_ADV_START_COMPLETE_EVT
*/
struct ble_ext_adv_start_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate advertising start operation success status */
uint8_t instance_num; /*!< extend advertising handle numble*/
uint8_t instance[EXT_ADV_NUM_SETS_MAX]; /*!< extend advertising handle list*/
} ext_adv_start; /*!< Event parameter of ESP_GAP_BLE_EXT_ADV_START_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_EXT_ADV_STOP_COMPLETE_EVT
*/
struct ble_ext_adv_stop_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate advertising stop operation success status */
uint8_t instance_num; /*!< extend advertising handle numble*/
uint8_t instance[EXT_ADV_NUM_SETS_MAX]; /*!< extend advertising handle list*/
} ext_adv_stop; /*!< Event parameter of ESP_GAP_BLE_EXT_ADV_STOP_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_EXT_ADV_SET_REMOVE_COMPLETE_EVT
*/
struct ble_ext_adv_set_remove_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate advertising stop operation success status */
uint8_t instance; /*!< extend advertising handle */
} ext_adv_remove; /*!< Event parameter of ESP_GAP_BLE_EXT_ADV_SET_REMOVE_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_EXT_ADV_SET_CLEAR_COMPLETE_EVT
*/
struct ble_ext_adv_set_clear_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate advertising stop operation success status */
uint8_t instance; /*!< extend advertising handle */
} ext_adv_clear; /*!< Event parameter of ESP_GAP_BLE_EXT_ADV_SET_CLEAR_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT
*/
struct ble_periodic_adv_set_params_cmpl_param {
esp_bt_status_t status; /*!< Indicate periodic advertisingparameters set status */
uint8_t instance; /*!< extend advertising handle */
} peroid_adv_set_params; /*!< Event parameter of ESP_GAP_BLE_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_PERIODIC_ADV_DATA_SET_COMPLETE_EVT
*/
struct ble_periodic_adv_data_set_cmpl_param {
esp_bt_status_t status; /*!< Indicate periodic advertising data set status */
uint8_t instance; /*!< extend advertising handle */
} period_adv_data_set; /*!< Event parameter of ESP_GAP_BLE_PERIODIC_ADV_DATA_SET_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_PERIODIC_ADV_START_COMPLETE_EVT
*/
struct ble_periodic_adv_start_cmpl_param {
esp_bt_status_t status; /*!< Indicate periodic advertising start status */
uint8_t instance; /*!< extend advertising handle */
} period_adv_start; /*!< Event parameter of ESP_GAP_BLE_PERIODIC_ADV_START_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_PERIODIC_ADV_STOP_COMPLETE_EVT
*/
struct ble_periodic_adv_stop_cmpl_param {
esp_bt_status_t status; /*!< Indicate periodic advertising stop status */
uint8_t instance; /*!< extend advertising handle */
} period_adv_stop; /*!< Event parameter of ESP_GAP_BLE_PERIODIC_ADV_STOP_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT

View File

@ -989,34 +989,48 @@ static void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
case BTA_DM_BLE_5_GAP_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT:
msg.act = ESP_GAP_BLE_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT;
param.ext_adv_set_rand_addr.status = btc_btm_status_to_esp_status(params->set_ext_rand_addr.status);
param.ext_adv_set_rand_addr.instance = params->set_ext_rand_addr.instance;
break;
case BTA_DM_BLE_5_GAP_EXT_ADV_SET_PARAMS_COMPLETE_EVT: {
msg.act = ESP_GAP_BLE_EXT_ADV_SET_PARAMS_COMPLETE_EVT;
param.ext_adv_set_rand_addr.status = btc_btm_status_to_esp_status(params->set_params.status);
param.ext_adv_set_params.status = btc_btm_status_to_esp_status(params->set_params.status);
param.ext_adv_set_params.instance = params->set_params.instance;
break;
}
case BTA_DM_BLE_5_GAP_EXT_ADV_DATA_SET_COMPLETE_EVT: {
msg.act = ESP_GAP_BLE_EXT_ADV_DATA_SET_COMPLETE_EVT;
param.ext_adv_data_set.status = btc_btm_status_to_esp_status(params->adv_data_set.status);
param.ext_adv_data_set.instance = params->adv_data_set.instance;
break;
}
case BTA_DM_BLE_5_GAP_EXT_SCAN_RSP_DATA_SET_COMPLETE_EVT: {
msg.act = ESP_GAP_BLE_EXT_SCAN_RSP_DATA_SET_COMPLETE_EVT;
param.scan_rsp_set.status = btc_btm_status_to_esp_status(params->scan_rsp_data_set.status);
param.scan_rsp_set.instance = params->scan_rsp_data_set.instance;
break;
}
case BTA_DM_BLE_5_GAP_EXT_ADV_START_COMPLETE_EVT: {
msg.act = ESP_GAP_BLE_EXT_ADV_START_COMPLETE_EVT;
param.ext_adv_start.status = btc_btm_status_to_esp_status(params->adv_start.status);
for (UINT8 i = 0; i < params->adv_start.instance_num; i++) {
param.ext_adv_start.instance[i] = params->adv_start.instance[i];
}
param.ext_adv_start.instance_num = params->adv_start.instance_num;
break;
}
case BTA_DM_BLE_5_GAP_EXT_ADV_STOP_COMPLETE_EVT:
msg.act = ESP_GAP_BLE_EXT_ADV_STOP_COMPLETE_EVT;
param.ext_adv_stop.status = btc_btm_status_to_esp_status(params->adv_start.status);
for (UINT8 i = 0; i < params->adv_start.instance_num; i++) {
param.ext_adv_stop.instance[i] = params->adv_start.instance[i];
}
param.ext_adv_stop.instance_num = params->adv_start.instance_num;
break;
case BTA_DM_BLE_5_GAP_EXT_ADV_SET_REMOVE_COMPLETE_EVT:
msg.act = ESP_GAP_BLE_EXT_ADV_SET_REMOVE_COMPLETE_EVT;
param.ext_adv_remove.status = btc_btm_status_to_esp_status(params->adv_start.status);
param.ext_adv_remove.instance = params->adv_start.instance[0];
break;
case BTA_DM_BLE_5_GAP_EXT_ADV_SET_CLEAR_COMPLETE_EVT:
msg.act = ESP_GAP_BLE_EXT_ADV_SET_CLEAR_COMPLETE_EVT;
@ -1025,21 +1039,25 @@ static void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
case BTA_DM_BLE_5_GAP_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT: {
msg.act = ESP_GAP_BLE_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT;
param.peroid_adv_set_params.status = btc_btm_status_to_esp_status(params->per_adv_set_params.status);
param.peroid_adv_set_params.instance = params->per_adv_set_params.instance;
break;
}
case BTA_DM_BLE_5_GAP_PERIODIC_ADV_DATA_SET_COMPLETE_EVT: {
msg.act = ESP_GAP_BLE_PERIODIC_ADV_DATA_SET_COMPLETE_EVT;
param.period_adv_data_set.status = btc_btm_status_to_esp_status(params->per_adv_data_set.status);
param.period_adv_data_set.instance = params->per_adv_data_set.instance;
break;
}
case BTA_DM_BLE_5_GAP_PERIODIC_ADV_START_COMPLETE_EVT: {
msg.act = ESP_GAP_BLE_PERIODIC_ADV_START_COMPLETE_EVT;
param.period_adv_start.status = btc_btm_status_to_esp_status(params->per_adv_start.status);
param.period_adv_start.instance = params->per_adv_start.instance;
break;
}
case BTA_DM_BLE_5_GAP_PERIODIC_ADV_STOP_COMPLETE_EVT: {
msg.act = ESP_GAP_BLE_PERIODIC_ADV_STOP_COMPLETE_EVT;
param.period_adv_stop.status = btc_btm_status_to_esp_status(params->per_adv_stop.status);
param.period_adv_stop.instance = params->per_adv_stop.instance;
break;
}
case BTA_DM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT: {

View File

@ -340,8 +340,8 @@ tBTM_STATUS BTM_BleSetExtendedAdvRandaddr(UINT8 instance, BD_ADDR rand_addr)
}
end:
cb_params.status = status;
cb_params.set_ext_rand_addr.status = status;
cb_params.set_ext_rand_addr.instance = instance;
BTM_ExtBleCallbackTrigger(BTM_BLE_5_GAP_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT, &cb_params);
return status;
@ -420,7 +420,8 @@ end:
BTM_UpdateAddrInfor(BLE_ADDR_RANDOM, rand_addr);
}
}
cb_params.status = status;
cb_params.set_params.status = status;
cb_params.set_params.instance = instance;
BTM_ExtBleCallbackTrigger(BTM_BLE_5_GAP_EXT_ADV_SET_PARAMS_COMPLETE_EVT, &cb_params);
return status;
@ -471,7 +472,14 @@ tBTM_STATUS BTM_BleConfigExtendedAdvDataRaw(BOOLEAN is_scan_rsp, UINT8 instance,
} while (rem_len);
end:
cb_params.status = status;
if (is_scan_rsp) {
cb_params.scan_rsp_data_set.status = status;
cb_params.scan_rsp_data_set.instance = instance;
} else {
cb_params.adv_data_set.status = status;
cb_params.adv_data_set.instance = instance;
}
BTM_ExtBleCallbackTrigger(is_scan_rsp ? BTM_BLE_5_GAP_EXT_SCAN_RSP_DATA_SET_COMPLETE_EVT : BTM_BLE_5_GAP_EXT_ADV_DATA_SET_COMPLETE_EVT, &cb_params);
return status;
@ -574,7 +582,12 @@ end:
}
}
cb_params.status = status;
cb_params.adv_start.status = status;
cb_params.adv_start.instance_num = num;
for (uint8_t i = 0; i < num; i++) {
cb_params.adv_start.instance[i] = ext_adv[i].instance;
}
BTM_ExtBleCallbackTrigger(enable ? BTM_BLE_5_GAP_EXT_ADV_START_COMPLETE_EVT : BTM_BLE_5_GAP_EXT_ADV_STOP_COMPLETE_EVT, &cb_params);
return status;
@ -629,7 +642,9 @@ tBTM_STATUS BTM_BleExtAdvSetRemove(UINT8 instance)
end:
cb_params.status = status;
cb_params.adv_start.status = status;
cb_params.adv_start.instance_num = 1;
cb_params.adv_start.instance[0] = instance;
BTM_ExtBleCallbackTrigger(BTM_BLE_5_GAP_EXT_ADV_SET_REMOVE_COMPLETE_EVT, &cb_params);
@ -655,7 +670,7 @@ tBTM_STATUS BTM_BleExtAdvSetClear(void)
}
}
cb_params.status = status;
cb_params.adv_start.status = status;
BTM_ExtBleCallbackTrigger(BTM_BLE_5_GAP_EXT_ADV_SET_CLEAR_COMPLETE_EVT, &cb_params);
@ -693,7 +708,8 @@ tBTM_STATUS BTM_BlePeriodicAdvSetParams(UINT8 instance, tBTM_BLE_Periodic_Adv_Pa
end:
cb_params.status = status;
cb_params.per_adv_set_params.status = status;
cb_params.per_adv_set_params.instance = instance;
BTM_ExtBleCallbackTrigger(BTM_BLE_5_GAP_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT, &cb_params);
@ -747,7 +763,9 @@ tBTM_STATUS BTM_BlePeriodicAdvCfgDataRaw(UINT8 instance, UINT16 len, UINT8 *data
} while(rem_len);
end:
cb_params.status = status;
cb_params.per_adv_data_set.status = status;
cb_params.per_adv_data_set.instance = instance;
BTM_ExtBleCallbackTrigger(BTM_BLE_5_GAP_PERIODIC_ADV_DATA_SET_COMPLETE_EVT, &cb_params);
return status;
@ -771,8 +789,13 @@ tBTM_STATUS BTM_BlePeriodicAdvEnable(UINT8 instance, UINT8 enable)
}
end:
cb_params.status = status;
if (enable) {
cb_params.per_adv_start.status = status;
cb_params.per_adv_start.instance = instance;
} else {
cb_params.per_adv_stop.status = status;
cb_params.per_adv_stop.instance = instance;
}
BTM_ExtBleCallbackTrigger(enable ? BTM_BLE_5_GAP_PERIODIC_ADV_START_COMPLETE_EVT : BTM_BLE_5_GAP_PERIODIC_ADV_STOP_COMPLETE_EVT, &cb_params);

View File

@ -1100,46 +1100,58 @@ typedef struct {
typedef struct {
UINT8 status;
UINT8 instance;
} tBTM_BLE_SET_PERF_PHY_CMPL;
typedef struct {
UINT8 status;
UINT8 instance;
} tBTM_BLE_EXT_ADV_SET_RAND_ADDR_CMPL;
typedef struct {
UINT8 status;
UINT8 instance;
} tBTM_BLE_EXT_ADV_SET_PARAMS_CMPL;
typedef struct {
UINT8 status;
UINT8 instance;
} tBTM_BLE_EXT_ADV_DATA_SET_CMPL;
typedef struct {
UINT8 status;
UINT8 instance;
} tBTM_BLE_EXT_ADV_SCAN_RSP_DATA_SET_CMPL;
typedef struct {
UINT8 status;
UINT8 instance_num;
UINT8 instance[10];
} tBTM_BLE_EXT_ADV_START_CMPL;
typedef struct {
UINT8 status;
UINT8 instance;
} tBTM_BLE_EXT_ADV_STOP_CMPL;
typedef struct {
UINT8 status;
UINT8 instance;
} tBTM_BLE_PERIOD_ADV_SET_PARAMS_CMPL;
typedef struct {
UINT8 status;
UINT8 instance;
} tBTM_BLE_PERIOD_ADV_DATA_SET_CMPL;
typedef struct {
UINT8 status;
UINT8 instance;
} tBTM_BLE_PERIOD_ADV_START_CMPL;
typedef struct {
UINT8 status;
UINT8 instance;
} tBTM_BLE_PERIOD_ADV_STOP_CMPL;
typedef struct {

View File

@ -35,7 +35,7 @@
#include "freertos/semphr.h"
#define LOG_TAG "MULTI_ADV_DEMO"
#define LOG_TAG "PERIODIC_ADV_DEMO"
#define FUNC_SEND_WAIT_SEM(func, sem) do {\
esp_err_t __err_rc = (func);\
@ -99,39 +99,39 @@ static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param
switch (event) {
case ESP_GAP_BLE_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT, status %d", param->ext_adv_set_rand_addr.status);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT, status %d, instance %d", param->ext_adv_set_rand_addr.status, param->ext_adv_set_rand_addr.instance);
break;
case ESP_GAP_BLE_EXT_ADV_SET_PARAMS_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_ADV_SET_PARAMS_COMPLETE_EVT, status %d", param->ext_adv_set_params.status);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_ADV_SET_PARAMS_COMPLETE_EVT, status %d, instance %d", param->ext_adv_set_params.status, param->ext_adv_set_params.instance);
break;
case ESP_GAP_BLE_EXT_ADV_DATA_SET_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_ADV_DATA_SET_COMPLETE_EVT, status %d", param->ext_adv_data_set.status);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_ADV_DATA_SET_COMPLETE_EVT, status %d, instance %d", param->ext_adv_data_set.status, param->ext_adv_data_set.instance);
break;
case ESP_GAP_BLE_EXT_SCAN_RSP_DATA_SET_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_SCAN_RSP_DATA_SET_COMPLETE_EVT, status %d", param->scan_rsp_set.status);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_SCAN_RSP_DATA_SET_COMPLETE_EVT, status %d, instance %d", param->scan_rsp_set.status, param->scan_rsp_set.instance);
break;
case ESP_GAP_BLE_EXT_ADV_START_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_ADV_START_COMPLETE_EVT, status %d", param->ext_adv_start.status);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_ADV_START_COMPLETE_EVT, status %d, instance numble %d", param->ext_adv_start.status, param->ext_adv_start.instance_num);
break;
case ESP_GAP_BLE_EXT_ADV_STOP_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_ADV_STOP_COMPLETE_EVT, status %d", param->ext_adv_stop.status);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_ADV_STOP_COMPLETE_EVT, status %d, instance numble %d", param->ext_adv_stop.status, param->ext_adv_stop.instance_num);
break;
case ESP_GAP_BLE_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT, status %d", param->peroid_adv_set_params.status);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT, status %d, instance %d", param->peroid_adv_set_params.status, param->peroid_adv_set_params.instance);
break;
case ESP_GAP_BLE_PERIODIC_ADV_DATA_SET_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_PERIODIC_ADV_DATA_SET_COMPLETE_EVT, status %d", param->period_adv_data_set.status);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_PERIODIC_ADV_DATA_SET_COMPLETE_EVT, status %d, instance %d", param->period_adv_data_set.status, param->period_adv_data_set.instance);
break;
case ESP_GAP_BLE_PERIODIC_ADV_START_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_PERIODIC_ADV_START_COMPLETE_EVT, status %d", param->period_adv_start.status);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_PERIODIC_ADV_START_COMPLETE_EVT, status %d, instance %d", param->period_adv_start.status, param->period_adv_start.instance);
break;
default:
break;

View File

@ -257,46 +257,44 @@ Once the Extended advertising data have been set, the GAP event `ESP_GAP_BLE_EXT
```c
static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param){
switch (event) {
case ESP_GAP_BLE_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT, status %d", param->ext _adv_set_rand_addr.status);
break;
case ESP_GAP_BLE_EXT_ADV_SET_PARAMS_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_ADV_SET_PARAMS_COMPLETE_EVT, status %d", param->ext_adv_set_params.status);
break;
case ESP_GAP_BLE_EXT_ADV_DATA_SET_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_ADV_DATA_SET_COMPLETE_EVT, status %d", param->ext_adv_data_set.status);
break;
case ESP_GAP_BLE_EXT_SCAN_RSP_DATA_SET_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_SCAN_RSP_DATA_SET_COMPLETE_EVT, status %d", param->scan_rsp_set.status);
break;
case ESP_GAP_BLE_EXT_ADV_START_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_ADV_START_COMPLETE_EVT, status %d", param->ext_adv_start.status);
break;
case ESP_GAP_BLE_EXT_ADV_STOP_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_ADV_STOP_COMPLETE_EVT, status %d", param->ext_adv_stop.status);
break;
case ESP_GAP_BLE_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT, status %d", param->p
eroid_adv_set_params.status);
static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param)
{
switch (event) {
case ESP_GAP_BLE_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT, status %d, instance %d", param->ext_adv_set_rand_addr.status, param->ext_adv_set_rand_addr.instance);
break;
case ESP_GAP_BLE_EXT_ADV_SET_PARAMS_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_ADV_SET_PARAMS_COMPLETE_EVT, status %d, instance %d", param->ext_adv_set_params.status, param->ext_adv_set_params.instance);
break;
case ESP_GAP_BLE_EXT_ADV_DATA_SET_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_ADV_DATA_SET_COMPLETE_EVT, status %d, instance %d", param->ext_adv_data_set.status, param->ext_adv_data_set.instance);
break;
case ESP_GAP_BLE_EXT_SCAN_RSP_DATA_SET_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_SCAN_RSP_DATA_SET_COMPLETE_EVT, status %d, instance %d", param->scan_rsp_set.status, param->scan_rsp_set.instance);
break;
case ESP_GAP_BLE_EXT_ADV_START_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_ADV_START_COMPLETE_EVT, status %d, instance numble %d", param->ext_adv_start.status, param->ext_adv_start.instance_num);
break;
case ESP_GAP_BLE_EXT_ADV_STOP_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_EXT_ADV_STOP_COMPLETE_EVT, status %d, instance numble %d", param->ext_adv_stop.status, param->ext_adv_stop.instance_num);
break;
case ESP_GAP_BLE_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT, status %d, instance %d", param->peroid_adv_set_params.status, param->peroid_adv_set_params.instance);
break;
case ESP_GAP_BLE_PERIODIC_ADV_DATA_SET_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_PERIODIC_ADV_DATA_SET_COMPLETE_EVT, status %d", param->per
iod_adv_data_set.status);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_PERIODIC_ADV_DATA_SET_COMPLETE_EVT, status %d, instance %d", param->period_adv_data_set.status, param->period_adv_data_set.instance);
break;
case ESP_GAP_BLE_PERIODIC_ADV_START_COMPLETE_EVT:
xSemaphoreGive(test_sem);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_PERIODIC_ADV_START_COMPLETE_EVT, status %d", param->period
_adv_start.status);
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_PERIODIC_ADV_START_COMPLETE_EVT, status %d, instance %d", param->period_adv_start.status, param->period_adv_start.instance);
break;
default:
break;