Identify by Tag
Type
In this example the RFID reader perform an identify by tag type. The program does as explained below:

This example assumes that the RFID reader supports and has configured the "TAGIT_HF_TYPE1" tag type. Supported tag types vary depending on RFID make and model.
...
1. Gets the RFID parameters from the first driver and opens a connection to it.
2. Checks if the driver supports the "identify by tag type" attribute and checks if the "TAGIT_HF_TYPE1" tag type is supported.
3. If the tag type is supported, it performs an identify for this tag type and displays how many tags were found in the reader's range.
4. Displays the RFID tags found, their ID, and their type.
import com.sap.ip.me.api.pios.PIOSException;
import com.sap.ip.me.api.pios.connection.*;
import com.sap.ip.me.api.pios.rfid.*;
public class ExampleIdentifyTagType {
public static void main(String[] args) {
RfidConnection rfidConnection = null;
try {
//----------------------(1)--------------------
Connector connector = Connector.getInstance();
DriverInfo[] rfidDrivers =
connector.listDrivers(ConnectionType.RFID);
if (rfidDrivers.length > 0) {
RfidParameters rfidParams = new RfidParameters(rfidDrivers[0]);
rfidConnection = (RfidConnection) connector.open(rfidParams);
//----------------------(2)--------------------
if (rfidDrivers[0]
.isAttributeSupported(
RfidConnection.Attributes.IDENTIFY_BY_TAG_TYPE)) {
RfidTagType[] supportedTags = rfidConnection.listTagTypes();
RfidTagType particularTagType = null;
for (int i = 0; i < supportedTags.length; i++) {
if ("TAGIT_HF_TYPE1".equals(supportedTags[i].getName())) {
particularTagType = supportedTags[i];
}
}
//----------------------(3)--------------------
if (particularTagType != null) {
RfidTag[] tagList =
rfidConnection.identify(particularTagType);
if (tagList.length <= 0) {
System.out.println("There are no tags in range.");
} else {
System.out.println(
"Total tags: " + tagList.length + ".");
}
//----------------------(4)--------------------
for (int j = 0; j < tagList.length; j++) {
System.out.print("TagID: ");
for (int k = 0;
k < tagList[j].getTagID().length;
k++) {
System.out.print(
tagList[j].getTagID()[k] + " ");
}
System.out.println(
"\t tag type: "
+ tagList[j].getTagType().getName());
}
} else {
System.out.println(
"The tag type \"TAGIT_HF_TYPE1\" is not supported.");
}
} else {
System.out.println(
"Required driver attribute is not supported.");
}
} else {
System.out.println("There are no RFID drivers.");
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
rfidConnection.close();
} catch (PIOSException pex) {
pex.printStackTrace();
}
}
}
}