readCharacteristic method
Reads the value of the specified characteristic.
The returned future completes with an error in case of a failure during reading.
Be aware that a read request could be satisfied by a notification delivered for the same characteristic via characteristicValueStream before the actual read response arrives (due to the design of iOS BLE API).
This method assumes there is a single characteristic with the ids specified in characteristic
. If there are
multiple characteristics with the same id on a device, use resolve to find them all. Or use
getDiscoveredServices to select the Services and Characteristics you're interested in.
Implementation
Future<List<int>> readCharacteristic(QualifiedCharacteristic characteristic) async {
await initialize();
return (await resolveSingle(characteristic)).read();
}