Lando.LowLevel.LowLevelCardReader.GetCardId C# (CSharp) Method

GetCardId() public method

Returns a card's UID.
public GetCardId ( Lando.LowLevel.Card cardToRead ) : Lando.LowLevel.ResultsTypes.ReceiveCardIdResult
cardToRead Lando.LowLevel.Card
return Lando.LowLevel.ResultsTypes.ReceiveCardIdResult
        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;
        }