Have you tried it? VS Code IntelliSense is not always understanding the code correctly and hence may flag syntax that's otherwise perfectly fine
But in this case you cannot just call a method without its contining object. getCharacteristicByUUID
belongs to a BlePeerDevice
object and hence you have to call it like
Log.trace(peer.getCharacteristicByUUID(yourCharacteristicsObjectVariable, yourDesiredCharacteristicsUuidObjectVariable))
(this will only print the bool
return value of the function call tho')
Without a connected peer that "owns" that charactersitic and is "willing" to grant you access to it, you won't get to it.
e.g. look at the linked header file (lines #446 - owning class - and #469 - method definition).
a quick breakdown
BleUuid foundServiceUuid; // this can only hold *one* service UUID
// scan for one and only one service UUID (for devices which expose more an array and its extent want to be passed in
size_t svcCount = scanResults[ii].advertisingData.serviceUUID(&foundServiceUuid, 1);
// svcCount can be 0 (no services found) or 1 (since we only scanned for one)
Log.trace("Found %d services", svcCount);
for (int i = 0; i < svcCount; i++)
Log.trace("Service %d, UUID: %s", i, (const char*)foundServiceUuid.toString());