findCharacteristic method
Finds a characteristic based on the peripheral identifier and characteristic UUID.
Implementation
FaketoothCharacteristic? findCharacteristic({required String peripheral, required String uuid}) {
if (_simulatedPeripherals?.isNotEmpty == false) {
return null;
}
for (FaketoothPeripheral p in _simulatedPeripherals!) {
if (p.identifier.toLowerCase() != peripheral.toLowerCase()) {
continue;
}
for (FaketoothService s in p.services!) {
for (FaketoothCharacteristic c in s.characteristics!) {
if (c.uuid.toLowerCase() == uuid.toLowerCase()) {
return c;
}
}
}
}
return null;
}