Locate Tutorial

RFID SDK for Xamarin 2.0.1.15

Overview

This Tutorial provides a walk-through of the steps to perform Locate operation using Xamarin 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

The Tag locationing (reffered as Locate) feature is supported only on hand-held readers and is useful to locate a specific tag in the field of view of the reader’s antenna.

Setting it up

No specific setup is required. Only Tag ID is enough to perform locate operation

Performing Operation

reader.Actions.TagLocationing.Perform can be used to start locating a tag, and reader.Actions.TagLocationing.Stop to stop the locationing operation.


// Performing Tag Locationing on a particular tag ID.
try
{
    // perform simple inventory 
    Reader.Actions.TagLocationing.Perform("E2002849491502421020B330",null,null);

    // Sleep or wait
    Thread.Sleep(5000);

    // stop the inventory 
    Reader.Actions.TagLocationing.Stop();

}
catch (InvalidUsageException e)
{
    e.PrintStackTrace();
}
catch (OperationFailureException e)
{
    e.PrintStackTrace();
}

Grab the results

The result of locationing of a tag is reported as LocationInfo in TagData and is present in TagData if tagData isContainsLocationInfo is true. tagData.LocationInfo.getRelativeDistance gives the relative distance of the tag from the reader antenna.


//The response of the tag locationing comes through eventReadNotify in the following Event Handler.
public void EventReadNotify(RfidReadEvents e)
{
    TagData[] myTags = Reader.Actions.GetReadTags(100);
    if (myTags != null)
    {
        for (int index = 0; index < myTags.Length; index++)
        {
            Console.Out.WriteLine("Tag ID " + myTags[index].TagID);

            if (myTags[index].IsContainsLocationInfo)
            {
                int tag = index;
                Console.Out.WriteLine("Tag locationing distance " + myTags[tag].LocationInfo.RelativeDistance);
            }
        }
    }
}

Closer look

  • LocationInfo.RelativeDistance gives relative distance i.e. from 0% to 100% where tag being tag very far to very close respectively

What's Next

  • Reader.Actions.TagLocationing.Perform API's third parameter is EPC mask. When looking for non-specific item from group, use EPC mask to filter matching tags