contents
int SCardTransmit(
int hCard,
Pointer<SCARD_IO_REQUEST> pioSendPci,
Pointer<Uint8> pbSendBuffer,
int cbSendLength,
Pointer<SCARD_IO_REQUEST> pioRecvPci,
Pointer<Uint8> pbRecvBuffer,
Pointer<Uint32> pcbRecvLength)
The code I wrote
int SCARD_PROTOCOL = 0;
switch (pdwActiveProtocol.value) {
case SCARD_PROTOCOL_T0:
SCARD_PROTOCOL = SCARD_PROTOCOL_T0;
break;
case SCARD_PROTOCOL_T1:
SCARD_PROTOCOL = SCARD_PROTOCOL_T1;
break;
default:
print("Unknown protocol");
break;
}
int hCard = phCard.value;
List<int> data = [0xff, 0xca, 0x00, 0x00, 0x00];
Uint8List bytes = Uint8List.fromList(data);
Pointer<Uint8> pbSendBuffer = bytes.allocatePointer();
Pointer<Uint8> pbRecvBuffer = calloc<Uint8>();
int cbSendLength = bytes.length;
Pointer<Uint32> pcbRecvLength = pbRecvBuffer.cast<Uint32>();
Pointer<SCARD_IO_REQUEST> pioSendPci = calloc<SCARD_IO_REQUEST>()
..ref.cbPciLength = sizeOf<SCARD_IO_REQUEST>()
..ref.dwProtocol = SCARD_PROTOCOL;
ret = SCardTransmit(hCard, pioSendPci, pbSendBuffer, cbSendLength, nullptr,
pbRecvBuffer, pcbRecvLength);
This was successful, but I cannot get the UID. What is the problem?
I know there is something missing or wrong, but I don't know what it is.
What we use :https://pub.dev/packages/win32
Card reader used: RC-380
add
Uint8List byte = pbRecvBuffer.asTypedList(pcbRecvLength.value);
1:[0, 0, 0, 0, 0, 0, 0, 0, 224, 159]
2:[0, 0, 0, 0, 0, 0, 0, 0, 204, 107]
Different from the first and second time.