Hi,
following the example from ArduinoBLE library called "PeripheralExplorer"
I should be able to call discoverAttibutes after successful connecting:
...
if (peripheral.connect()) {
Serial.println("Connected");
} else {
Serial.println("Failed to connect!");
return;
}
// discover peripheral attributes
Serial.println("Discovering attributes ...");
if (peripheral.discoverAttributes()) {
Serial.println("Attributes discovered");
} else {
Serial.println("Attribute discovery failed!");
peripheral.disconnect();
return;
}
...
But when I flash this code to the board it does actually connect and the scan process and so on works as expected.
However, as soon as I call discoverAttributes, the library seems to hang there leading to a crash ob the mbed os after a few seconds.
Another strange thing:
I can discover a service with BLEDevice.discoverService (it returns true).
But if I check BLEDevice.serviceCount() it actually returns 0.
Really strange behavior of the library.
Do I miss anything apart from the normal BLE.begin() stuff as done in the examples?
To me it seems like the connection setup might miss some security process? Can this be the case? Is there any alternative library for that?
Thanks
Alex