pyacaia
pyacaia copied to clipboard
GATT question
Hi, I'm looking at this code to try and port similar functionality (interacting with a Pearl scale) to an ESP32 microcontroller.
I see your code doesn't involve any service uuids, but only characteristic uuids. I also notice that the scale does not advertise service uuids, and I am not sure how to subscribe to a characteristic without the corresponding service uuid.
Example arduino code for connecting to a BLE device looks like this:
BLERemoteService* pRemoteService = pClient->getService(serviceUUID);
if (pRemoteService == nullptr) {
Serial.print("Failed to find our service UUID: ");
Serial.println(serviceUUID.toString().c_str());
pClient->disconnect();
return false;
}
Serial.println(" - Found our service");
// Obtain a reference to the characteristic in the service of the remote BLE server.
pRemoteCharacteristic = pRemoteService->getCharacteristic(charUUID);
if (pRemoteCharacteristic == nullptr) {
Serial.print("Failed to find our characteristic UUID: ");
Serial.println(charUUID.toString().c_str());
pClient->disconnect();
return false;
}
Serial.println(" - Found our characteristic");
// Read the value of the characteristic.
if(pRemoteCharacteristic->canRead()) {
std::string value = pRemoteCharacteristic->readValue();
Serial.print("The characteristic value was: ");
Serial.println(value.c_str());
}
if(pRemoteCharacteristic->canNotify())
pRemoteCharacteristic->registerForNotify(notifyCallback);
Do you have any pointers for how to connect without the service uuid here?
thanks for the project