Overview
This Tutorial provides a walk-through of the steps to perform BlockPermalock 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
The application can call method Reader.Actions.TagAccess.blockPermalockWait to block permalock a tag. Tags reported as part of Block-Permalock access operation will have TagData.getOpCode as ACCESS_OPERATION_BLOCK_PERMALOCK, and TagData.getOpStatus indicating the result of the operation. If TagData.OpStatus is ACCESS_SUCCESS, TagData.getPermaLockData will contain the Block-Permalock Mask Data.
Performing BlockPermalock operation
The application can call method Reader.Actions.TagAccess.blockPermalockWait to block permalock a tag. Tags reported as part of Block-Permalock access operation will have TagData.getOpCode as ACCESS_OPERATION_BLOCK_PERMALOCK, and TagData.getOpStatus indicating the result of the operation. If TagData.OpStatus is ACCESS_SUCCESS, TagData.getPermaLockData will contain the Block-Permalock Mask Data.
//Blockpermalock access operation
TagAccess.BlockPermalockAccessParams bpParams = tagAccess.new BlockPermalockAccessParams();
String tagId = "beddbeddbeddbeddbeddbedd";
bpParams.setOffset(0);
bpParams.setCount(1);
bpParams.setAccessPassword(Long.parseLong("00000002",16));
//data to be masked
byte[] blkMask = new byte[]{(byte) 0x80, 0x00};
bpParams.setMask(blkMask);
bpParams.setMaskLength(2);
bpParams.setReadLock(false);
bpParams.setMemoryBank(MEMORY_BANK.MEMORY_BANK_USER);
// antenna Info is null – performs on all antenna
TagData td = reader.Actions.TagAccess.blockPermalockWait(tagId, bpParams, null);
Write Operation for Fixed Readers
Grab the results
blockPermalockWait
returns result in TagData
Log.d(TAG, " Data Masked " + tagData.getPermaLockData());
Closer look
tagData.getPermaLockData()
provides data masked.tagData.getOpStatus()
returns success or error code asACCESS_OPERATION_STATUS
tagData.getOpCode()
provides type of access operation performed
What's Next
- Change the
setCount
andsetOffset
as per requirement - Use access password
setAccessPassword
to perform operation on protected memorybank