|
|
@ -371,7 +371,8 @@ auto Scanner::HandleDeviceDiscovery(const esp_bt_gap_cb_param_t& param) |
|
|
|
static_cast<size_t>(length)}; |
|
|
|
static_cast<size_t>(length)}; |
|
|
|
|
|
|
|
|
|
|
|
// Trim trailing whitespace (spaces, tabs, \r, \n)
|
|
|
|
// Trim trailing whitespace (spaces, tabs, \r, \n)
|
|
|
|
const std::string::size_type lastChar = deviceName.find_last_not_of(" \n\r\t"); |
|
|
|
const std::string::size_type lastChar = |
|
|
|
|
|
|
|
deviceName.find_last_not_of(" \n\r\t"); |
|
|
|
if (lastChar != std::string::npos) { |
|
|
|
if (lastChar != std::string::npos) { |
|
|
|
deviceName.erase(lastChar + 1); |
|
|
|
deviceName.erase(lastChar + 1); |
|
|
|
} |
|
|
|
} |
|
|
@ -536,6 +537,12 @@ void Disabled::react(const events::Enable&) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((err = |
|
|
|
|
|
|
|
esp_bredr_tx_power_set(ESP_PWR_LVL_N0, ESP_PWR_LVL_P9) != ESP_OK)) { |
|
|
|
|
|
|
|
ESP_LOGE(kTag, "set tx power failed %s", esp_err_to_name(err)); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
esp_bluedroid_config_t cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT(); |
|
|
|
esp_bluedroid_config_t cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT(); |
|
|
|
if ((err = esp_bluedroid_init_with_cfg(&cfg) != ESP_OK)) { |
|
|
|
if ((err = esp_bluedroid_init_with_cfg(&cfg) != ESP_OK)) { |
|
|
|
ESP_LOGE(kTag, "initialize bluedroid failed %s", esp_err_to_name(err)); |
|
|
|
ESP_LOGE(kTag, "initialize bluedroid failed %s", esp_err_to_name(err)); |
|
|
|