BLE GATT advertising raw data vs normal data
Posted: Wed Aug 18, 2021 6:30 am
Hello. I am learning about the BLE and have the example code running:
https://github.com/espressif/esp-idf/bl ... through.md
I am analysing the code line by line trying to understand it better so I can use it efficiently. Could someone help me understand what is up with the raw data advertising and scan response. When do I want to use raw data versus the normal structure?
When selecting RAW data adv mode, I only advertise the following data is that right?
But when raw data is disabled, I can control many parameters such as min/max interval and others..
Can someone explain me when raw data should be used and how it should be used efficiently? How can I determine whether I need raw data adv for my project or not
https://github.com/espressif/esp-idf/bl ... through.md
I am analysing the code line by line trying to understand it better so I can use it efficiently. Could someone help me understand what is up with the raw data advertising and scan response. When do I want to use raw data versus the normal structure?
Code: Select all
//DISABLE RAW DATA ADV
//#define CONFIG_SET_RAW_ADV_DATA
#ifdef CONFIG_SET_RAW_ADV_DATA
static uint8_t raw_adv_data[] = {
// flags
0x02, 0x01, 0x06,
// tx power
0x02, 0x0a, 0xeb,
// service uuid
0x03, 0x03, 0xFF, 0x00,
// device name
0x0f, 0x09, 'E', 'S', 'P', '_', 'G', 'A', 'T', 'T', 'S', '_', 'D','E', 'M', 'O'
};
static uint8_t raw_scan_rsp_data[] = {
// flags
0x02, 0x01, 0x06,
// tx power
0x02, 0x0a, 0xeb,
// service uuid
0x03, 0x03, 0xFF,0x00
};
#else
static uint8_t service_uuid[16] = {
/* LSB <--------------------------------------------------------------------------------> MSB */
//first uuid, 16bit, [12],[13] is the value
0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
};
/* The length of adv data must be less than 31 bytes */
static esp_ble_adv_data_t adv_data = {
.set_scan_rsp = false,
.include_name = true,
.include_txpower = true,
.min_interval = 0x0006, //slave connection min interval, Time = min_interval * 1.25 msec
.max_interval = 0x0010, //slave connection max interval, Time = max_interval * 1.25 msec
.appearance = 0x00,
.manufacturer_len = 0, //TEST_MANUFACTURER_DATA_LEN,
.p_manufacturer_data = NULL, //test_manufacturer,
.service_data_len = 0,
.p_service_data = NULL,
.service_uuid_len = sizeof(service_uuid),
.p_service_uuid = service_uuid,
.flag = (ESP_BLE_ADV_FLAG_GEN_DISC | ESP_BLE_ADV_FLAG_BREDR_NOT_SPT),
};
// scan response data
static esp_ble_adv_data_t scan_rsp_data = {
.set_scan_rsp = true,
.include_name = true,
.include_txpower = true,
.min_interval = 0x0006,
.max_interval = 0x0010,
.appearance = 0x00,
.manufacturer_len = 0, //TEST_MANUFACTURER_DATA_LEN,
.p_manufacturer_data = NULL, //&test_manufacturer[0],
.service_data_len = 0,
.p_service_data = NULL,
.service_uuid_len = sizeof(service_uuid),
.p_service_uuid = service_uuid,
.flag = (ESP_BLE_ADV_FLAG_GEN_DISC | ESP_BLE_ADV_FLAG_BREDR_NOT_SPT),
};
When selecting RAW data adv mode, I only advertise the following data is that right?
Code: Select all
static uint8_t raw_adv_data[] = {
// flags
0x02, 0x01, 0x06,
// tx power
0x02, 0x0a, 0xeb,
// service uuid
0x03, 0x03, 0xFF, 0x00,
// device name
0x0f, 0x09, 'E', 'S', 'P', '_', 'G', 'A', 'T', 'T', 'S', '_', 'D','E', 'M', 'O'
};
Can someone explain me when raw data should be used and how it should be used efficiently? How can I determine whether I need raw data adv for my project or not