Server versus Client Connect and Disconnect Callbacks
Posted: Fri Sep 06, 2019 12:16 am
I have an Adafruit Huzzah32 device. I am writing an app that both acts as a peripheral to allow a mobile app to connect to it and at the same time is able to connect to a device to get data from it.
I have the code all working. It includes setting up server callbacks by creating my own class derived from BLEServerCallbacks that is then passed to pServer->setCallbacks(new BTServerCallbacks());
I also have a class derived from BLEClientCallbacks that is passed to pClient->setClientCallbacks(new MyClientCallback());
I am testing just having my device connect to the sensor device to gather data.
The problem I am having is that the onConnected and onDisconnected callbacks is BOTH classes gets called when I connect to and disconnect from the sensor device.
Can anyone explain how to fix this? I do certain things based on whether I am connecting/disconnecting with the sensor versus connecting/disconnecting with a mobile app to me.
I have the code all working. It includes setting up server callbacks by creating my own class derived from BLEServerCallbacks that is then passed to pServer->setCallbacks(new BTServerCallbacks());
I also have a class derived from BLEClientCallbacks that is passed to pClient->setClientCallbacks(new MyClientCallback());
I am testing just having my device connect to the sensor device to gather data.
The problem I am having is that the onConnected and onDisconnected callbacks is BOTH classes gets called when I connect to and disconnect from the sensor device.
Can anyone explain how to fix this? I do certain things based on whether I am connecting/disconnecting with the sensor versus connecting/disconnecting with a mobile app to me.