Hello folks,
I'm using an ESP 32 in BLE mode where I want to use it to fetch data from mobile and respond accordingly much like how we use Serial.available() in other controllers/mode.
The issue is like it has a class mentioned below which helps to receive the data/string/char from bluetooth app.
I want to call this class in my loop statement where I can compare the string in if statement and perform the respective function.
class MyCallbacks: public BLECharacteristicCallbacks {
void onWrite(BLECharacteristic *pCharacteristic) {
std::string rxValue = pCharacteristic->getValue();
if (rxValue.length() > 0) {
Serial.println("*********");
Serial.print("Received Value: ");
for (int i = 0; i < rxValue.length(); i++)
Serial.print(rxValue[i]);
Serial.println();
Serial.println("*********");
}
}