Write Access Operations Tutorial

RFID SDK for MAUI

Overview

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

The application can call method Reader.Actions.TagAccess.WriteWait or reader.Actions.TagAccess.blockWriteWait to write data to a specific memory bank. The response is returned as a TagData from where number of words can be retrieved.

Performing Write operation

The application can call method Reader.Actions.TagAccess.WriteWait or Reader.Actions.TagAccess.BlockWriteWait to write data to a specific memory bank. The response is returned as a TagData from where number of words can be retrieved.


// Write user memory bank data
TagData tagData = null;
String tagId = "1234ABCD00000000000025B1";
TagAccess tagAccess = new TagAccess();
TagAccess.WriteAccessParams writeAccessParams = new TagAccess.WriteAccessParams(tagAccess);
String writeData = "11223344"; //write data in string
writeAccessParams.AccessPassword = 0;
writeAccessParams.MemoryBank = MEMORY_BANK.MemoryBankUser;
writeAccessParams.Offset = 0; // start writing from word offset 0
writeAccessParams.SetWriteData(writeData);
// data length in words
writeAccessParams.WriteDataLength = writeData.Length / 4;
// synchronous write
Reader.Actions.TagAccess.WriteWait(tagId, writeAccessParams, null, tagData);

Block Write

Following shows usage of block write, note that same write access parameters are passed as used above So it becomes easy to switch between two APIs


Reader.Actions.TagAccess.BlockWriteWait(tagId, writeAccessParams, null, tagData);

Grab the results

writeWait returns result in parameter passed as TagData


Console.WriteLine(" Number of words written " + tagData.NumberOfWords);

Closer look

  • tagData.NumberOfWords provides number of words written. This can be useful in case of partial writes
  • 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