MI32 legacy: use disconnect reason as error code (#20676)

This commit is contained in:
Christian Baars 2024-02-07 10:30:30 +01:00 committed by GitHub
parent 5e4a1d7b32
commit 0bc6f82a81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 4 deletions

View File

@ -95,11 +95,12 @@ class MI32SensorCallback : public NimBLEClientCallbacks {
MI32.mode.connected = 1; MI32.mode.connected = 1;
pclient->updateConnParams(8,11,0,1000); pclient->updateConnParams(8,11,0,1000);
} }
void onDisconnect(NimBLEClient* pclient) { void onDisconnect(NimBLEClient* pclient, int reason) {
MI32.mode.connected = 0; MI32.mode.connected = 0;
MI32.infoMsg = MI32_DID_DISCONNECT; MI32.infoMsg = MI32_DID_DISCONNECT;
MI32.conCtx->error = MI32_CONN_DID_DISCCONNECT; MI32.conCtx->error = reason;
MI32.mode.triggerBerryConnCB = 1; //mainly for unexpected or requested disconnects MI32.conCtx->operation = 5; //set for all disconnects that come from the remote device or connection loss
MI32.mode.triggerBerryConnCB = 1;
//AddLog(LOG_LEVEL_DEBUG,PSTR("disconnected")); //AddLog(LOG_LEVEL_DEBUG,PSTR("disconnected"));
} }
}; };
@ -2738,4 +2739,4 @@ bool Xsns62(uint32_t function)
#endif // USE_MI_ESP32 #endif // USE_MI_ESP32
#endif // CONFIG_IDF_TARGET_ESP32 or CONFIG_IDF_TARGET_ESP32C3 #endif // CONFIG_IDF_TARGET_ESP32 or CONFIG_IDF_TARGET_ESP32C3
#endif // ESP32 #endif // ESP32
#endif // USE_BLE_ESP32 #endif // USE_BLE_ESP32