Read Access Operation Tutorial

RFID SDK for MAUI

Overview

This Tutorial provides a walk-through of the steps to perform Read Access operation using MAUI RFID SDK

Create the Project

  • Start by creating a new project in Visual Studio. For help, see the Create Project.
  • 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

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


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

Performing operation

Prepare ReadAccesParams as per requirement and pass it to readWait API


// Read user memory bank for the given tag ID 
String tagId = "1234ABCD00000000000025B1";
TagAccess tagAccess = new TagAccess();
TagAccess.ReadAccessParams readAccessParams = new TagAccess.ReadAccessParams(tagAccess);
readAccessParams.AccessPassword = 0;
// read 4 words 
readAccessParams.Count = 4;
// user memory bank
readAccessParams.MemoryBank = MEMORY_BANK.MemoryBankUser;
// start reading from word offset 0
readAccessParams.Offset = 0;
// read operation
TagData tagData = Reader.Actions.TagAccess.ReadWait(tagId, readAccessParams, null);

Grab the results

readWait returns result as TagData


try
{
    // read operation
    TagData tagData = Reader.Actions.TagAccess.ReadWait(tagId, readAccessParams, null);
    if (tagData != null)
    {
        ACCESS_OPERATION_CODE readAccessOperation = tagData.OpCode;
        if (readAccessOperation != null)
        {
            if (tagData.OpStatus != null && tagData.OpStatus != ACCESS_OPERATION_STATUS.AccessSuccess)
            {
                String strErr = tagData.OpStatus.ToString().Replace("_", "");
                Console.WriteLine("READ ACCESS OPERATION Failed :" + strErr);
            }
            else
            {
                if (tagData.OpCode == ACCESS_OPERATION_CODE.AccessOperationRead)
                {
                    Console.WriteLine("READ ACCESS OPERATION Success:" + tagData.MemoryBankData);
                }
            }
        }
        else
        {
            Console.WriteLine("ACCESS READ memoryBankData is null");
        }
    }
}
catch (OperationFailureException ex)
{
    Console.WriteLine("ACCESS READ" + ex.VendorMessage + " " + ex.StatusDescription);
}

Closer look

  • Configure required memory bank using readAccessParams.setMemoryBank
  • tagData.OpStatus returns sucess or error code as ACCESS_OPERATION_STATUS
  • tagData.OpCode provides type of access operation performed

What's Next

  • Change the Count and Offset as per requirement
  • Use access password AccessPassword to perform operation on protected memorybank