Lock Access Operation Tutorial

RFID SDK for Android 2.0.4.192

Applicable Devices : ALL

Overview

This Tutorial provides a walk-through of the steps to perform Lock Access 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.

Access Lock API provides user to apply password protected read or write access restrictions to tag memory bank. For a non-zero access password configured tags following lock operations are valid based on the memory bank selected

  EPIC TID User Access Kill
LOCK_PRIVILEGE_READ_WRITE writable only with valid password writable only wth valid password writable only with valid password Readable and writeable only with valid password Readable and writeable only with valid password
LOCK_PRIVILEGE_PERMA_LOCK Not writable Not writable Not Writeable Not readable or writeable Not readable or writable
LOCK_PRIVILEGE_PERMA_UNLOCK Tag can never be configured for restricted read or write access and is always readable and writable Tag can never be configured for restricted read or write access and is always readable and writeable Tag can never be configured for restricted read or write access and is always readable and writeable Tag can never be configured for restricted read or write access and is always readable and writeable Tag can never be configured for restricted read or write access and is always readable and writeable
LOCK_PRIVILEGE_UNLOCK Associate memory bank is writable with both non zero and zero pass word configured Associate memory bank is writable with both non zero and zero pass word configured Associate memory bank is writable with both non zero and zero pass word configured Associate memory bank is writable with both non zero and zero pass word configured Associate memory bank is writable with both non zero and zero pass word configured

Setting it up

Create necessary fields like EPC ID as String tagId and access parameters TagAccess.LockAccessParams


// Read user memory bank for the given tag ID 
String tagId = "1234ABCD00000000000025B1"; 
TagAccess tagAccess = new TagAccess(); 
TagAccess.LockAccessParams lockAccessParams  = tagAccess.new LockAccessParams();

Performing operation

Prepare LockAccessParams as per requirement and pass it to lockWait API

The application calls method reader.Actions.TagAccess.lockWait to perform a lock operation on one or more memory banks with specific privileges


try {
    // Lock the tag
    String tagId = "1234ABCD00000000000025B1";
    TagAccess tagAccess = new TagAccess();
    TagAccess.LockAccessParams lockAccessParams = tagAccess.new LockAccessParams();
    /* lock now */
    lockAccessParams.setLockPrivilege(LOCK_DATA_FIELD.LOCK_USER_MEMORY, LOCK_PRIVILEGE.LOCK_PRIVILEGE_READ_WRITE);
    lockAccessParams.setAccessPassword(0);
    reader.Actions.TagAccess.lockWait(tagId, lockAccessParams, null);
} catch (InvalidUsageException e) {
    e.printStackTrace();
} catch (OperationFailureException e) {
   e.printStackTrace();
}