BlockErase Operations Tutorial

RFID SDK for Android 2.0.2.124

Applicable Devices : ALL

Overview

This Tutorial provides a walk-through of the steps to perform BlockErase operation using RFID3 API

Create The Project

  • Start by creating a new project in Android Studio. For help, see the Android Studio tutorial.
  • Refer Hello RFID to prepare basic setup to work with RFID Reader and then follow this guide

Details

Tag Access operations are performed on a specific tag or applied on tags that match a specific Access-Filter. If no Access-Filter is specified, the Access Operation is performed on all tags in the field of view of chosen antennas. This section covers the Simple Tag Access operation on a specific tag which is in the field of view of any of the antennas of the connected RFID reader.

Setting it up

BlockErase Access operation is to erase a block(word/bytes) form specified memory bank.

Performing BlockErase operation

BlockErase Access operation is to erase a block(word/bytes) form specified memory bank.


String tagId = "111100002222000033330000";
TagAccess tagAccess1 = new TagAccess();
TagAccess.BlockEraseAccessParams blockEraseAccessParams = tagAccess1.new BlockEraseAccessParams();
blockEraseAccessParams.setAccessPassword(0);
blockEraseAccessParams.setMemoryBank(MEMORY_BANK.MEMORY_BANK_USER); // user memory bank
blockEraseAccessParams.setOffset(0);  // start erasing from offset 0
blockEraseAccessParams.setCount(16); // number of bytes to erase
reader.Actions.TagAccess.blockEraseWait(tagId, blockEraseAccessParams, null,null);


                                                        

Grab the results

blockEraseWait returns result in TagData


Log.d(TAG, " Data Masked " + tagData.getMemoryBankData());

Closer look

  • tagData.getOpStatus() returns success or error code as ACCESS_OPERATION_STATUS
  • tagData.getOpCode() provides type of access operation performed

What's Next

  • Change the setCount and setOffset as per requirement
  • Use access password setAccessPassword to perform operation on protected memorybank