forked from h2zero/esp-nimble-cpp
Adds the reason code as a parameter to the client onDisconnect callback. * Update examples/docs.
This commit is contained in:
@@ -29,8 +29,9 @@ class ClientCallbacks : public NimBLEClientCallbacks {
|
||||
printf("Connected\n");
|
||||
};
|
||||
|
||||
void onDisconnect(NimBLEClient* pClient) {
|
||||
printf("%s Disconnected - Starting scan\n", pClient->getPeerAddress().toString().c_str());
|
||||
void onDisconnect(NimBLEClient* pClient, int reason) {
|
||||
printf("%s Disconnected, reason = %d - Starting scan\n",
|
||||
pClient->getPeerAddress().toString().c_str(), reason);
|
||||
NimBLEDevice::getScan()->start(scanTime, scanEndedCB);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -43,7 +43,9 @@ class MyClientCallback : public BLEClientCallbacks {
|
||||
void onConnect(BLEClient* pclient) {
|
||||
}
|
||||
|
||||
void onDisconnect(BLEClient* pclient) {
|
||||
/** onDisconnect now takes a reason parameter to indicate the reason for disconnection
|
||||
void onDisconnect(BLEClient* pclient) { */
|
||||
void onDisconnect(BLEClient* pclient, int reason) {
|
||||
connected = false;
|
||||
printf("onDisconnect");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user