I successfully built a simple dualRole BLEuart simple sketch allowing me to connect as Client to a server and simultaneously be connected from a Client to my esp32-s3 as server as the one from Nordic on the nrf52 devices.
There is but a little glitch.
I use these callbacks for connection state:'
//BLE Peripheral Class
class MyServerCallbacks : public BLEServerCallbacks {
void onConnect(BLEServer* pServer) {
Serial.println("Server connected to device!");
deviceConnected = true;
};
//BLE Central Class
class MyClientCallback : public BLEClientCallbacks {
void onConnect(BLEClient* pclient) {
}
void onDisconnect(BLEClient* pclient) {
connected = false;
Serial.println("onDisconnect");
}
};
But the code don't take any difference between both. which means, if the Client connect/disconnect, the server is "seen" as connected/disconnected too and start/stop its tasks.
in short onConnect() doesn't differentiate which server is targeted.
Is it "normal"? I was in the expectation that they would be both differently handled. well.. If anyone has a workaround, I would be glad to hear from :)
I successfully built a simple dualRole BLEuart simple sketch allowing me to connect as Client to a server and simultaneously be connected from a Client to my esp32-s3 as server as the one from Nordic on the nrf52 devices. There is but a little glitch. I use these callbacks for connection state:'
//BLE Peripheral Class class MyServerCallbacks : public BLEServerCallbacks { void onConnect(BLEServer* pServer) { Serial.println("Server connected to device!"); deviceConnected = true; };
//BLE Central Class class MyClientCallback : public BLEClientCallbacks { void onConnect(BLEClient* pclient) { }
void onDisconnect(BLEClient* pclient) { connected = false; Serial.println("onDisconnect"); } }; But the code don't take any difference between both. which means, if the Client connect/disconnect, the server is "seen" as connected/disconnected too and start/stop its tasks. in short onConnect() doesn't differentiate which server is targeted. Is it "normal"? I was in the expectation that they would be both differently handled. well.. If anyone has a workaround, I would be glad to hear from :)