AnsweredAssumed Answered

Open the RF security session on Android device

Question asked by Don S on Nov 15, 2017
Latest reply on Nov 21, 2017 by Olivier Lorente

Hi,

we are trying to using the ST25DV64K to implement the reading and writing data via RF between the ST25DV64K and Android device.

The area 3 is protected by RF password 3 with default password .

Tried to use the below code to open the RF security session but always return “(byte)0x01”. Could you advise ?

It would be appreciated if the sample code of reading and writing the data on the protected Area is also provided.

Thanks.

 

public static byte[] SendPresentPasswordCommand (Tag myTag, byte PasswordNumber, byte[] PasswordData, DataDevice ma)
{
    byte[] response = new byte[] {(byte) 0xFF};
    byte[] PresentPasswordFrame;

    PresentPasswordFrame = new byte[]{(byte) 0x02, (byte) 0xB3, (byte) 0x02, PasswordNumber, PasswordData[0], PasswordData[1], PasswordData[2], PasswordData[3]};
    PresentPasswordFrame = new byte[]{(byte) 0x02, (byte) 0xB3, (byte) 0x02, (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00};

    int errorOccured = 1;
    while(errorOccured != 0)
    {
        try
        {
            NfcV nfcvTag = NfcV.get(myTag);

            nfcvTag.close();
            nfcvTag.connect();

            response = nfcvTag.transceive(PresentPasswordFrame);
            if(response[0] == (byte) 0x00 || response[0] == (byte) 0x01) //response 01 = error sent back by tag (new Android 4.2.2) or BC
            {
                errorOccured = 0;
                //Used for DEBUG :
            }
        }
        catch(Exception e)
        {
            errorOccured++;
            //Used for DEBUG :
            if(errorOccured == 2)
            {
                //Used for DEBUG :
                //Used for DEBUG :
                return response;
            }
        }
    }
    return response;
}

Outcomes