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:
warpzone 2019-11-21 00:54:25 +09:00 committed by Otto Winter
parent 072cd5b83e
commit ad76709d00

View File

@ -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