Good day. My task is to interrogate several BLE devices. Do you have a working solution? My sketch, which I am using, drives the board into a stupor at different times. esp hangs after the end. Sometimes a sketch works properly for 10 minutes, and sometimes 3-4 iterations. Can you help me figure it out? Or maybe you have a ready-made solution with some kind of sensors, thanks for earlier.
bool connectToDevice(BLEAdvertisedDevice* device) {
Busy=true;
Serial.println(“Stablishing communications with device:”);
pClient = BLEDevice::createClient();
Serial.println(” BLE client created”);
// Connect to the remove BLE Server.
pClient->connect(device);
pClient->setClientCallbacks(new ClientCB());
Serial.println(” Connected to device”);
// Obtain a reference to the service we are after in the remote BLE server.
pRemoteService = pClient->getService(srvUUID);
if (pRemoteService == nullptr) {
Serial.println(” Error: Failed to find service”);
pClient->disconnect();
return false;
}
Serial.println(” Service found”);
remoteChr = pRemoteService->getCharacteristic(chrUUID);
if (remoteChr == nullptr) {
Serial.print(” Failed to find characteristic”);
pClient->disconnect();
return false;
}
Serial.println(” Characteristic found”);
Serial.println(” Setting callback for notify / indicate”);
remoteChr->registerForNotify(chrCB);
return true;
}
Hi.
Unfortunately, we don’t have any working solution for what you want to do.
I recommend that you post your question in our Facebook group, maybe it will reach more people and someone has some recommendations. Here’s the link to the group: https://www.facebook.com/groups/RandomNerdTutorials
I’m sorry that I can’t help much with this subject.
Regards,
Sara