component/bt : use real adv data to set raw adv data

This commit is contained in:
Tian Hao 2017-02-10 11:02:10 +08:00
parent 02460ff864
commit cf917567e9
2 changed files with 19 additions and 13 deletions

View File

@ -1,10 +1,12 @@
menu "Example 'GATT SERVER' Config"
config SET_RAW_ADV_DATA
bool "adv data or scan_rsp data use raw data or structure"
default "y"
bool "Use raw data for advertising packets and scan response data"
help
Set raw advertising data/scan response data by self or use adv_data/scan_rsp_data structure to
set advertising data/scan response data. If use structure, lower layer will encapsulate the packets.
If this config item is set, raw binary data will be used to generate advertising & scan response data.
This option uses the esp_ble_gap_config_adv_data_raw() and esp_ble_gap_config_scan_rsp_data_raw() functions.
If this config item is unset, advertising & scan response data is provided via a higher-level esp_ble_adv_data_t structure.
The lower layer will generate the BLE packets. This option has higher overhead at runtime.
endmenu

View File

@ -62,10 +62,14 @@ esp_attr_value_t gatts_demo_char1_val =
};
#ifdef CONFIG_SET_RAW_ADV_DATA
static uint8_t raw_adv_data[] = {0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf,
0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe};
static uint8_t raw_scan_rsp_data[] = {0x7, 0x7, 0x7, 0x7, 0x8, 0x8, 0x8, 0x8, 0x9, 0x9, 0x9, 0x9, 0xa, 0xa, 0xa, 0xa,
0xb, 0xb, 0xb, 0xb, 0xc, 0xc, 0xc, 0xc, 0xd, 0xd, 0xd, 0xd, 0xe, 0xe, 0xe};
static uint8_t raw_adv_data[] = {
0x02, 0x01, 0x06, 0x0f, 0x09, 0x45, 0x53, 0x50, 0x5f, 0x47, 0x41, 0x54, 0x54, 0x53, 0x5f, 0x44,
0x45, 0x4d, 0x4f, 0x02, 0x0a, 0xeb, 0x03, 0x03, 0xab, 0xcd
};
static uint8_t raw_scan_rsp_data[] = {
0x02, 0x01, 0x06, 0x0f, 0x09, 0x45, 0x53, 0x50, 0x5f, 0x47, 0x41, 0x54, 0x54, 0x53, 0x5f, 0x44,
0x45, 0x4d, 0x4f, 0x02, 0x0a, 0xeb, 0x03, 0x03, 0xab, 0xcd
};
#else
static uint8_t test_service_uuid128[32] = {
/* LSB <--------------------------------------------------------------------------------> MSB */