Reset a Tag ID
In this example the RFID reader resets the tag ID of each tag inside its range, using the password used to lock the tags (see Program and Lock a Tag ID). The program does the following:

For this example, it is assumed that tag ID is 12-bytes long and the password has a length of one character.
...
1. Gets the RFID parameters from the first driver and, using them, opens the connection to the RFID reader.
2. Checks if the driver supports the "identify all" and the "reset tag ID with password" attributes.
3. Identifies all the tags within the reader's range and tries to reset each of them.
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 ExampleResetTagID {
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_ALL)
&& rfidDrivers[0].isAttributeSupported(
RfidConnection.Attributes.RESET_TAG_ID_WITH_PSWD)) {
RfidTag[] tagList = rfidConnection.identify();
if (tagList.length > 0) {
byte[] pwd = "z".getBytes();
//----------------------(3)--------------------
for (int i = 0; i < tagList.length; i++) {
try {
rfidConnection.resetTagID(tagList[i], pwd);
} catch (Exception exReset) {
System.out.println(
"There was an error resetting tag #"
+ i + " (tag type: "
+ tagList[i].getTagType().getName()
+ ").");
}
}
}
} else {
System.out.println(
"The required attributes are not supported by this driver.");
}
} else {
System.out.println("There are no RFID drivers.");
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
rfidConnection.close();
} catch (PIOSException pex) {
pex.printStackTrace();
}
}
}
}