refactor(examples/bluedroid): Replace hardcoded ADV type values with macros

This commit is contained in:
zhanghaipeng
2025-12-28 11:25:21 +08:00
parent 8630040602
commit fdeb5ad87a
4 changed files with 30 additions and 30 deletions

View File

@@ -52,11 +52,11 @@ static const uint16_t spp_service_uuid = 0xABF0;
static const uint8_t spp_adv_data[23] = {
/* Flags */
0x02,0x01,0x06,
0x02, ESP_BLE_AD_TYPE_FLAG, 0x06,
/* Complete List of 16-bit Service Class UUIDs */
0x03,0x03,0xF0,0xAB,
0x03, ESP_BLE_AD_TYPE_16SRV_CMPL, 0xF0, 0xAB,
/* Complete Local Name in advertising */
0x0F,0x09, 'E', 'S', 'P', '_', 'S', 'P', 'P', '_', 'S', 'E', 'R','V', 'E', 'R'
0x0F, ESP_BLE_AD_TYPE_NAME_CMPL, 'E', 'S', 'P', '_', 'S', 'P', 'P', '_', 'S', 'E', 'R','V', 'E', 'R'
};
static uint16_t spp_mtu_size = SPP_GATT_MTU_SIZE;

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@@ -41,9 +41,9 @@
static uint16_t profile_handle_table[HRS_IDX_NB];
static uint8_t ext_adv_raw_data[] = {
0x02, 0x01, 0x06,
0x02, 0x0a, 0xeb, 0x03, 0x03, 0xab, 0xcd,
0x11, 0X09, 'E', 'S', 'P', '_', 'B', 'L', 'E', '5', '0', '_', 'S', 'E', 'R', 'V', 'E', 'R',
0x02, ESP_BLE_AD_TYPE_FLAG, 0x06,
0x02, ESP_BLE_AD_TYPE_TX_PWR, 0xeb, 0x03, ESP_BLE_AD_TYPE_16SRV_CMPL, 0xab, 0xcd,
0x11, ESP_BLE_AD_TYPE_NAME_CMPL, 'E', 'S', 'P', '_', 'B', 'L', 'E', '5', '0', '_', 'S', 'E', 'R', 'V', 'E', 'R',
};
static esp_ble_gap_ext_adv_t ext_adv[1] = {

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@@ -98,12 +98,12 @@ static esp_attr_value_t gatts_demo_char1_val =
};
static uint8_t ext_adv_raw_data[] = {
0x02, 0x01, 0x06,
0x02, 0x0a, 0xeb,
0x03, 0x03, 0xab, 0xcd,
0x11, 0x07, 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0xEE, 0x00, 0x00, 0x00,
0x11, 0x07, 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
0x14, 0X09, 'T', 'H', 'R', 'O', 'U', 'G', 'H', 'P', 'U', 'T', '_', 'P', 'H', 'Y', '_', 'D', 'E', 'M', 'O',
0x02, ESP_BLE_AD_TYPE_FLAG, 0x06,
0x02, ESP_BLE_AD_TYPE_TX_PWR, 0xeb,
0x03, ESP_BLE_AD_TYPE_16SRV_CMPL, 0xab, 0xcd,
0x11, ESP_BLE_AD_TYPE_128SRV_CMPL, 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0xEE, 0x00, 0x00, 0x00,
0x11, ESP_BLE_AD_TYPE_128SRV_CMPL, 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
0x14, ESP_BLE_AD_TYPE_NAME_CMPL, 'T', 'H', 'R', 'O', 'U', 'G', 'H', 'P', 'U', 'T', '_', 'P', 'H', 'Y', '_', 'D', 'E', 'M', 'O',
};
static esp_ble_gap_ext_adv_t ext_adv[1] = {

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@@ -108,37 +108,37 @@ esp_ble_gap_ext_adv_params_t ext_adv_params_coded = {
};
static uint8_t raw_adv_data_1m[] = {
0x02, 0x01, 0x06,
0x02, 0x0a, 0xeb,
0x11, 0x09, 'E', 'S', 'P', '_', 'M', 'U', 'L', 'T', 'I', '_', 'A',
0x02, ESP_BLE_AD_TYPE_FLAG, 0x06,
0x02, ESP_BLE_AD_TYPE_TX_PWR, 0xeb,
0x11, ESP_BLE_AD_TYPE_NAME_CMPL, 'E', 'S', 'P', '_', 'M', 'U', 'L', 'T', 'I', '_', 'A',
'D', 'V', '_', '1', 'M'
};
static uint8_t raw_scan_rsp_data_2m[] = {
0x02, 0x01, 0x06,
0x02, 0x0a, 0xeb,
0x11, 0x09, 'E', 'S', 'P', '_', 'M', 'U', 'L', 'T', 'I', '_', 'A',
0x02, ESP_BLE_AD_TYPE_FLAG, 0x06,
0x02, ESP_BLE_AD_TYPE_TX_PWR, 0xeb,
0x11, ESP_BLE_AD_TYPE_NAME_CMPL, 'E', 'S', 'P', '_', 'M', 'U', 'L', 'T', 'I', '_', 'A',
'D', 'V', '_', '2', 'M'
};
static uint8_t legacy_adv_data[] = {
0x02, 0x01, 0x06,
0x02, 0x0a, 0xeb,
0x14, 0x09, 'E', 'S', 'P', '_', 'M', 'U', 'L', 'T', 'I', '_', 'A',
0x02, ESP_BLE_AD_TYPE_FLAG, 0x06,
0x02, ESP_BLE_AD_TYPE_TX_PWR, 0xeb,
0x14, ESP_BLE_AD_TYPE_NAME_CMPL, 'E', 'S', 'P', '_', 'M', 'U', 'L', 'T', 'I', '_', 'A',
'D', 'V', '_', 'C', 'O', 'D', 'E', 'D'
};
static uint8_t legacy_scan_rsp_data[] = {
0x02, 0x01, 0x06,
0x02, 0x0a, 0xeb,
0x15, 0x09, 'E', 'S', 'P', '_', 'M', 'U', 'L', 'T', 'I', '_', 'A',
0x02, ESP_BLE_AD_TYPE_FLAG, 0x06,
0x02, ESP_BLE_AD_TYPE_TX_PWR, 0xeb,
0x15, ESP_BLE_AD_TYPE_NAME_CMPL, 'E', 'S', 'P', '_', 'M', 'U', 'L', 'T', 'I', '_', 'A',
'D', 'V', '_', 'L', 'E', 'G', 'A', 'C', 'Y'
};
static uint8_t raw_scan_rsp_data_coded[] = {
0x02, 0x01, 0x06,
0x02, 0x0a, 0xeb,
0x14, 0x09, 'E', 'S', 'P', '_', 'M', 'U', 'L', 'T', 'I', '_', 'A',
0x02, ESP_BLE_AD_TYPE_FLAG, 0x06,
0x02, ESP_BLE_AD_TYPE_TX_PWR, 0xeb,
0x14, ESP_BLE_AD_TYPE_NAME_CMPL, 'E', 'S', 'P', '_', 'M', 'U', 'L', 'T', 'I', '_', 'A',
'D', 'V', '_', 'C', 'O', 'D', 'E', 'D'
};