@@ -31,13 +31,12 @@ void MyHomeIOT_BLEClient::loop() {
31
31
32
32
void MyHomeIOT_BLEClient::connect () {
33
33
ESP_LOGI (TAG, " [%s] Connecting" , to_string (this ->address ).c_str ());
34
+ this ->state_ = esp32_ble_tracker::ClientState::Connecting;
34
35
if (auto status = esp_ble_gattc_open (ble_host_->gattc_if , this ->remote_bda , BLE_ADDR_TYPE_PUBLIC, true ))
35
36
{
36
37
ESP_LOGW (TAG, " [%s] open error, status (%d)" , to_string (this ->address ).c_str (), status);
37
38
report_error (esp32_ble_tracker::ClientState::Idle);
38
39
}
39
- else
40
- this ->state_ = esp32_ble_tracker::ClientState::Connecting;
41
40
}
42
41
43
42
void MyHomeIOT_BLEClient::disconnect () {
@@ -108,7 +107,7 @@ void MyHomeIOT_BLEClient::gattc_event_handler(esp_gattc_cb_event_t event, esp_ga
108
107
break ;
109
108
}
110
109
ESP_LOGV (TAG, " [%s] CFG_MTU_EVT, MTU (%d)" , to_string (this ->address ).c_str (), param->cfg_mtu .mtu );
111
- if (auto status = esp_ble_gattc_search_service (esp_gattc_if, param->cfg_mtu .conn_id , NULL )) {
110
+ if (auto status = esp_ble_gattc_search_service (esp_gattc_if, param->cfg_mtu .conn_id , nullptr )) {
112
111
ESP_LOGW (TAG, " [%s] search_service failed, status (%d)" , to_string (this ->address ).c_str (), status);
113
112
report_error ();
114
113
}
@@ -173,7 +172,7 @@ void MyHomeIOT_BLEClient::gattc_event_handler(esp_gattc_cb_event_t event, esp_ga
173
172
this ->char_handle , ESP_GATT_AUTH_REQ_NONE) != ESP_GATT_OK) {
174
173
ESP_LOGW (TAG, " [%s] read_char error sending read request, status (%d)" ,
175
174
to_string (this ->address ).c_str (), status);
176
- this ->char_handle = 0 ;
175
+ this ->char_handle = ESP_GATT_ILLEGAL_HANDLE ;
177
176
}
178
177
break ;
179
178
}
0 commit comments