read method
Retrieves the value of a specified descriptor
Implementation
Future<List<int>> read() async {
var request = protos.ReadDescriptorRequest.create()
..remoteId = deviceId.toString()
..descriptorUuid = uuid.toString()
..characteristicUuid = characteristicUuid.toString()
..serviceUuid = serviceUuid.toString();
await FlutterBlue.instance._channel
.invokeMethod('readDescriptor', request.writeToBuffer());
return FlutterBlue.instance._methodStream
.where((m) => m.method == "ReadDescriptorResponse")
.map((m) => m.arguments)
.map((buffer) => new protos.ReadDescriptorResponse.fromBuffer(buffer))
.where((p) =>
(p.request.remoteId == request.remoteId) &&
(p.request.descriptorUuid == request.descriptorUuid) &&
(p.request.characteristicUuid == request.characteristicUuid) &&
(p.request.serviceUuid == request.serviceUuid))
.map((d) => d.value)
.first
.then((d) {
_value.add(d);
return d;
});
}