Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1fdfcba

Browse filesBrowse files
committed
A BLEClient should not take action on events not for it
1 parent b92c58d commit 1fdfcba
Copy full SHA for 1fdfcba

File tree

1 file changed

+5
-0
lines changed
Filter options

1 file changed

+5
-0
lines changed

‎libraries/BLE/src/BLEClient.cpp

Copy file name to clipboardExpand all lines: libraries/BLE/src/BLEClient.cpp
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ void BLEClient::gattClientEventHandler(
165165
break;
166166

167167
case ESP_GATTC_CLOSE_EVT: {
168+
if (evtParam->close.conn_id != getConnId()) break;
168169
// esp_ble_gattc_app_unregister(m_appId);
169170
// BLEDevice::removePeerDevice(m_gattc_if, true);
170171
break;
@@ -178,6 +179,7 @@ void BLEClient::gattClientEventHandler(
178179
// - uint16_t conn_id
179180
// - esp_bd_addr_t remote_bda
180181
case ESP_GATTC_DISCONNECT_EVT: {
182+
if (evtParam->disconnect.conn_id != getConnId()) break;
181183
// If we receive a disconnect event, set the class flag that indicates that we are
182184
// no longer connected.
183185
m_isConnected = false;
@@ -227,6 +229,7 @@ void BLEClient::gattClientEventHandler(
227229
} // ESP_GATTC_REG_EVT
228230

229231
case ESP_GATTC_CFG_MTU_EVT:
232+
if (evtParam->cfg_mtu.conn_id != getConnId()) break;
230233
if(evtParam->cfg_mtu.status != ESP_GATT_OK) {
231234
log_e("Config mtu failed");
232235
}
@@ -255,6 +258,7 @@ void BLEClient::gattClientEventHandler(
255258
// - uint16_t conn_id
256259
//
257260
case ESP_GATTC_SEARCH_CMPL_EVT: {
261+
if (evtParam->search_cmpl.conn_id != getConnId()) break;
258262
esp_ble_gattc_cb_param_t* p_data = (esp_ble_gattc_cb_param_t*)evtParam;
259263
if (p_data->search_cmpl.status != ESP_GATT_OK){
260264
log_e("search service failed, error status = %x", p_data->search_cmpl.status);
@@ -285,6 +289,7 @@ void BLEClient::gattClientEventHandler(
285289
// - esp_gatt_id_t srvc_id
286290
//
287291
case ESP_GATTC_SEARCH_RES_EVT: {
292+
if (evtParam->search_res.conn_id != getConnId()) break;
288293
BLEUUID uuid = BLEUUID(evtParam->search_res.srvc_id);
289294
BLERemoteService* pRemoteService = new BLERemoteService(
290295
evtParam->search_res.srvc_id,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.