Overview
This Tutorial provides a walk-through of the steps to perform access Lock 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
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
The Following are the steps to login the reader
- Create RFIDReader Object with appropriate params
- Set Reader password.
- Set secure connection type.
Creating a RFIDReader Object
// create and initialize the Reader Management object.
mReader = new RFIDReader(hostName,ZIOTCport, timeoutMilliSeconds, "ZIOTC", "ZIOTC");
Performing operation
try {
TagAccess.LockAccessParams lockAccessParams = tagAccess.new LockAccessParams();
lockAccessParams.setAccessPassword(Long.parseLong(“1234”, 16));
lockAccessParams.setLockPrivilege(LOCK_DATA_FIELD.LOCK_EPC_MEMORY, LOCK_PRIVILEGE.LOCK_PRIVILEGE_READ_WRITE);
mReader.Actions.TagAccess.lockWait(tagId, lockAccessParams, antennaInfo)
} catch (InvalidUsageException e) {
e.printStackTrace();
} catch (OperationFailureException e) {
e.printStackTrace();
}