mirror of
https://github.com/esphome/esphome.git
synced 2024-12-23 14:04:53 +01:00
fix the problem of missing part of advertising packet when activ… (#868)
* fix the problem of missing part of advertising packet when active scan is enabled. * fix for ci-suggest-changes
This commit is contained in:
parent
d355543ac9
commit
8421570b18
1 changed files with 4 additions and 2 deletions
|
@ -324,13 +324,15 @@ void ESPBTDevice::parse_scan_rst(const esp_ble_gap_cb_param_t::ble_scan_result_e
|
||||||
}
|
}
|
||||||
|
|
||||||
ESP_LOGVV(TAG, "Adv data: %s",
|
ESP_LOGVV(TAG, "Adv data: %s",
|
||||||
hexencode_string(std::string(reinterpret_cast<const char *>(param.ble_adv), param.adv_data_len)).c_str());
|
hexencode_string(
|
||||||
|
std::string(reinterpret_cast<const char *>(param.ble_adv), param.adv_data_len + param.scan_rsp_len))
|
||||||
|
.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
void ESPBTDevice::parse_adv_(const esp_ble_gap_cb_param_t::ble_scan_result_evt_param ¶m) {
|
void ESPBTDevice::parse_adv_(const esp_ble_gap_cb_param_t::ble_scan_result_evt_param ¶m) {
|
||||||
size_t offset = 0;
|
size_t offset = 0;
|
||||||
const uint8_t *payload = param.ble_adv;
|
const uint8_t *payload = param.ble_adv;
|
||||||
uint8_t len = param.adv_data_len;
|
uint8_t len = param.adv_data_len + param.scan_rsp_len;
|
||||||
|
|
||||||
while (offset + 2 < len) {
|
while (offset + 2 < len) {
|
||||||
const uint8_t field_length = payload[offset++]; // First byte is length of adv record
|
const uint8_t field_length = payload[offset++]; // First byte is length of adv record
|
||||||
|
|
Loading…
Reference in a new issue