I'm trying to come up with a solution to send sensor beacons via Bluetooth each ms. Let's say, I'm sending iBeacons with the UUID payload represented as sensor data, although any other beacon type is OK.
- Is it physically possible? What's the minimum rate I can send Bluetooth beacons in ESP32?
- If yes, which ESP-IDF function should I use to send one beacon at a time?
Code: Select all
esp_err_t esp_ble_gap_config_adv_data_raw(uint8_t *raw_data, uint32_t raw_data_len);
esp_err_t esp_ble_gap_start_advertising(esp_ble_adv_params_t *adv_params);
Code: Select all
static esp_ble_ibeacon_t ibeacon_adv_data;
// register the callback with esp_ble_gap_register_callback(esp_gap_callback));
static void esp_gap_callback(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param)
{
esp_err_t err;
switch (event) {
case ESP_GAP_BLE_ADV_DATA_RAW_SET_COMPLETE_EVT:
esp_ble_gap_start_advertising(&ble_adv_params);
break;
case ESP_GAP_BLE_ADV_START_COMPLETE_EVT:
if ((err = param->adv_start_cmpl.status) == ESP_BT_STATUS_SUCCESS) {
// modify the beacon data here
ibeacon_adv_data.ibeacon_vendor.proximity_uuid[0]++;
esp_ble_gap_config_adv_data_raw((uint8_t*)&ibeacon_adv_data, sizeof(ibeacon_adv_data));
}
break;
}
}
Thank you.