public ReceiveCardIdResult GetCardId(Card cardToRead)
{
if (cardToRead == null) throw new ArgumentNullException("cardToRead");
var bytesToSend = new byte[5];
bytesToSend[0] = 0xFF; // Class
bytesToSend[1] = 0xCA; // INS
bytesToSend[2] = 0x00; // P1
bytesToSend[3] = 0x00; // P2
bytesToSend[4] = 0x00; // LE:Full Length
ApduResponse response = SendAPDU(cardToRead, bytesToSend, 10);
const int responseCodeLength = 2;
var responseLengthWithoutResponseCodes = response.ResponseLength - responseCodeLength;
var receiveCardIdResult = new ReceiveCardIdResult(ReturnCodeManager.IsApduSuccessful(response));
if (receiveCardIdResult.IsCompletelySuccessful)
{
//read UID bytes from apdu response
receiveCardIdResult.Bytes = response.RecvBuff.Take(responseLengthWithoutResponseCodes).ToArray();
}
return receiveCardIdResult;
}