Skip to content

Commit

Permalink
fix the problem of missing part of advertising packet when activ… (es…
Browse files Browse the repository at this point in the history
…phome#868)

* fix the problem of missing part of advertising packet when active scan is enabled.

* fix for ci-suggest-changes
  • Loading branch information
warpzone authored and OttoWinter committed Nov 20, 2019
1 parent 072cd5b commit ad76709
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,15 @@ void ESPBTDevice::parse_scan_rst(const esp_ble_gap_cb_param_t::ble_scan_result_e
}

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
}
void ESPBTDevice::parse_adv_(const esp_ble_gap_cb_param_t::ble_scan_result_evt_param &param) {
size_t offset = 0;
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) {
const uint8_t field_length = payload[offset++]; // First byte is length of adv record
Expand Down

0 comments on commit ad76709

Please sign in to comment.