1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-14 22:05:54 +00:00

Fix clang-tidy header filter (#2385)

* Fix clang-tidy header filter

* Allow private members

* Fix clang-tidy detections

* Run clang-format

* Fix remaining detections

* Fix graph

* Run clang-format
This commit is contained in:
Otto Winter
2021-09-24 18:02:28 +02:00
committed by GitHub
parent 52dd79691b
commit aec02afcdc
76 changed files with 404 additions and 367 deletions

View File

@@ -50,29 +50,29 @@ void ESP32BLETracker::setup() {
return;
}
global_esp32_ble_tracker->start_scan(true);
global_esp32_ble_tracker->start_scan_(true);
}
void ESP32BLETracker::loop() {
BLEEvent *ble_event = this->ble_events_.pop();
while (ble_event != nullptr) {
if (ble_event->type_)
this->real_gattc_event_handler(ble_event->event_.gattc.gattc_event, ble_event->event_.gattc.gattc_if,
&ble_event->event_.gattc.gattc_param);
this->real_gattc_event_handler_(ble_event->event_.gattc.gattc_event, ble_event->event_.gattc.gattc_if,
&ble_event->event_.gattc.gattc_param);
else
this->real_gap_event_handler(ble_event->event_.gap.gap_event, &ble_event->event_.gap.gap_param);
this->real_gap_event_handler_(ble_event->event_.gap.gap_event, &ble_event->event_.gap.gap_param);
delete ble_event; // NOLINT(cppcoreguidelines-owning-memory)
ble_event = this->ble_events_.pop();
}
bool connecting = false;
for (auto *client : this->clients_) {
if (client->state() == ClientState::Connecting || client->state() == ClientState::Discovered)
if (client->state() == ClientState::CONNECTING || client->state() == ClientState::DISCOVERED)
connecting = true;
}
if (!connecting && xSemaphoreTake(this->scan_end_lock_, 0L)) {
xSemaphoreGive(this->scan_end_lock_);
global_esp32_ble_tracker->start_scan(false);
global_esp32_ble_tracker->start_scan_(false);
}
if (xSemaphoreTake(this->scan_result_lock_, 5L / portTICK_PERIOD_MS)) {
@@ -94,7 +94,7 @@ void ESP32BLETracker::loop() {
for (auto *client : this->clients_)
if (client->parse_device(device)) {
found = true;
if (client->state() == ClientState::Discovered) {
if (client->state() == ClientState::DISCOVERED) {
esp_ble_gap_stop_scanning();
if (xSemaphoreTake(this->scan_end_lock_, 10L / portTICK_PERIOD_MS)) {
xSemaphoreGive(this->scan_end_lock_);
@@ -196,7 +196,7 @@ bool ESP32BLETracker::ble_setup() {
return true;
}
void ESP32BLETracker::start_scan(bool first) {
void ESP32BLETracker::start_scan_(bool first) {
if (!xSemaphoreTake(this->scan_end_lock_, 0L)) {
ESP_LOGW(TAG, "Cannot start scan!");
return;
@@ -233,38 +233,38 @@ void ESP32BLETracker::gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_ga
global_esp32_ble_tracker->ble_events_.push(gap_event);
} // NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks)
void ESP32BLETracker::real_gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param) {
void ESP32BLETracker::real_gap_event_handler_(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param) {
switch (event) {
case ESP_GAP_BLE_SCAN_RESULT_EVT:
global_esp32_ble_tracker->gap_scan_result(param->scan_rst);
global_esp32_ble_tracker->gap_scan_result_(param->scan_rst);
break;
case ESP_GAP_BLE_SCAN_PARAM_SET_COMPLETE_EVT:
global_esp32_ble_tracker->gap_scan_set_param_complete(param->scan_param_cmpl);
global_esp32_ble_tracker->gap_scan_set_param_complete_(param->scan_param_cmpl);
break;
case ESP_GAP_BLE_SCAN_START_COMPLETE_EVT:
global_esp32_ble_tracker->gap_scan_start_complete(param->scan_start_cmpl);
global_esp32_ble_tracker->gap_scan_start_complete_(param->scan_start_cmpl);
break;
case ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT:
global_esp32_ble_tracker->gap_scan_stop_complete(param->scan_stop_cmpl);
global_esp32_ble_tracker->gap_scan_stop_complete_(param->scan_stop_cmpl);
break;
default:
break;
}
}
void ESP32BLETracker::gap_scan_set_param_complete(const esp_ble_gap_cb_param_t::ble_scan_param_cmpl_evt_param &param) {
void ESP32BLETracker::gap_scan_set_param_complete_(const esp_ble_gap_cb_param_t::ble_scan_param_cmpl_evt_param &param) {
this->scan_set_param_failed_ = param.status;
}
void ESP32BLETracker::gap_scan_start_complete(const esp_ble_gap_cb_param_t::ble_scan_start_cmpl_evt_param &param) {
void ESP32BLETracker::gap_scan_start_complete_(const esp_ble_gap_cb_param_t::ble_scan_start_cmpl_evt_param &param) {
this->scan_start_failed_ = param.status;
}
void ESP32BLETracker::gap_scan_stop_complete(const esp_ble_gap_cb_param_t::ble_scan_stop_cmpl_evt_param &param) {
void ESP32BLETracker::gap_scan_stop_complete_(const esp_ble_gap_cb_param_t::ble_scan_stop_cmpl_evt_param &param) {
xSemaphoreGive(this->scan_end_lock_);
}
void ESP32BLETracker::gap_scan_result(const esp_ble_gap_cb_param_t::ble_scan_result_evt_param &param) {
void ESP32BLETracker::gap_scan_result_(const esp_ble_gap_cb_param_t::ble_scan_result_evt_param &param) {
if (param.search_evt == ESP_GAP_SEARCH_INQ_RES_EVT) {
if (xSemaphoreTake(this->scan_result_lock_, 0L)) {
if (this->scan_result_index_ < 16) {
@@ -283,8 +283,8 @@ void ESP32BLETracker::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_i
global_esp32_ble_tracker->ble_events_.push(gattc_event);
} // NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks)
void ESP32BLETracker::real_gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
esp_ble_gattc_cb_param_t *param) {
void ESP32BLETracker::real_gattc_event_handler_(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
esp_ble_gattc_cb_param_t *param) {
for (auto *client : global_esp32_ble_tracker->clients_) {
client->gattc_event_handler(event, gattc_if, param);
}