receive method
Implementation
Iterable<ZModemEvent> receive(Uint8List data) sync* {
_parser.addData(data);
// print('data: ${data.map((e) => e.toRadixString(16)).toList()}');
while (_parser.moveNext()) {
final packet = _parser.current;
onTrace?.call('<- $packet');
if (packet is ZModemHeader) {
final event = _state.handleHeader(packet);
if (event != null) {
yield event;
}
} else if (packet is ZModemDataPacket) {
final event = _state.handleDataSubpacket(packet);
if (event != null) {
yield event;
}
}
}
}