Overview
This Tutorial provides a walk-through of the steps to perform Multi-tag locate 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
Multi-tag Tag locationing (referred as MultiTag Locate) feature is supported only on hand-held readers and is useful to locate Multiple Tags in the field of view of the reader’s antenna.
Setting it up
Need to initialize multiple tags that is interest to be located needs to be imported. In the sample below four multiple tags has been initialized to locate. Second parameter is the reference RSSI value for each tag from a reference distance. As TAGS RSSI value varies from a reference distance based on tag types and the environment this value helps to calibrate for accurate distance measurements
ArrayMap multiTagLocateTagMap = new ArrayMap();
multiTagLocateTagMap.clear();
multiTagLocateTagMap.put("000000000000000000000536", "-50");
multiTagLocateTagMap.put("000000000000000000000537", "-50");
multiTagLocateTagMap.put("000000000000000000000549", "-50");
multiTagLocateTagMap.put("000000000000000000000550", "-50");
try {
reeader.Actions.MultiTagLocate.purgeItemList();
reader.Actions.MultiTagLocate.importItemList(multiTagLocateTagMap);
} catch (InvalidUsageException e) {
e.printStackTrace();
} catch (OperationFailureException e) {
e.printStackTrace();
}
Performing operation
reader.Actions.MultiTagLocate.Perform
can be used to start locating a tag, and reader.Actions.MultiTagLocate.Stop
to stop the locationing operation.
// Performing Tag Locationing on imported TAG list
try {
reader.Actions.MultiTagLocate.perform();
} catch (InvalidUsageException e) {
e.printStackTrace();
} catch (OperationFailureException e) {
e.printStackTrace();
}
reader.Actions.MultiTagLocate.stop();
Grab the results
The result of locationing of tagList is reported with TagData. When data event callback is enabled multitag info can be fetched from event data
public void eventReadNotify(RfidReadEvents rfidReadEvents) {
final TagData[] myTags = mRfidReader.Actions.getMultiTagLocateTagInfo(100);
if (myTags != null) {
for (int index = 0; index < myTags.length; index++) {
TagData tagData = myTags[index];
if (tagData.isContainsMultiTagLocateInfo()) {
//Get correcponding Tag locate info
Log(tagData.getTagID() + " " + tagData.MultiTagLocateInfo.getRelativeDistance());
}
}
}
Closer look
tagData.MultiTagLocateInfo.getRelativeDistance()
gives relative distance i.e. from 0% to 100% where tag being tag very far to very close respectively
What's Next
reader.Actions.MultiTagLocate.addItem(String epc, String rssi)
Add Tag o the existing listreader.Actions.MultiTagLocate.deleteItem(String tid)
Delete tag from the inported list