From 8421570b18cea989bc750477f22b663a23cf85c0 Mon Sep 17 00:00:00 2001 From: warpzone <11829895+warpzone@users.noreply.github.com> Date: Thu, 21 Nov 2019 00:54:25 +0900 Subject: [PATCH] =?UTF-8?q?fix=20the=20problem=20of=20missing=20part=20of?= =?UTF-8?q?=20advertising=20packet=20when=20activ=E2=80=A6=20(#868)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix the problem of missing part of advertising packet when active scan is enabled. * fix for ci-suggest-changes --- esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp b/esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp index 21cd74774c..30a448d082 100644 --- a/esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +++ b/esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp @@ -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", - hexencode_string(std::string(reinterpret_cast(param.ble_adv), param.adv_data_len)).c_str()); + hexencode_string( + std::string(reinterpret_cast(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 ¶m) { 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