transmit method
Sends command and returns the response, data then status bytes.
Throws a CardTransportException when the card cannot be reached.
Implementation
@override
Future<Uint8List> transmit(Uint8List command) async {
if (latency > Duration.zero) await Future<void>.delayed(latency);
if (!_inserted) {
throw const CardTransportException('No card in the simulated reader');
}
if (command.length < 4) return _status(0x6700);
_loaded = await _files;
if (!_inserted) {
throw const CardTransportException('No card in the simulated reader');
}
final cla = command[0];
final ins = command[1];
final p2 = command[3];
final data = command.length > 5
? Uint8List.sublistView(command, 5, 5 + command[4])
: Uint8List(0);
if (cla == 0x80 && ins == 0xE4) return _cardData(command, p2);
if (cla != 0x00) return _status(0x6E00);
return switch (ins) {
0xA4 => _select(command[2], data),
0xB0 => _readBinary(command),
0x20 => _verify(data),
0x24 => _changePin(command[2], command[3], data),
0x88 => _internalAuthenticate(command[2], command[3], data),
_ => _status(0x6D00),
};
}