I am developing a sample application based on:
* Ubuntu 16.04 host SDK with Java
I am successfully reading from inventory using:
reader.Actions.getReadTags(100)
I dont get any tag read events from:
reader.Events.setTagReadEvent(true); // this does not work!
reader.Events.setAttachTagDataWithReadEvent(true);
reader.Events.setBufferFullEvent(true); // this works!
reader.Events.addEventsListener(event_listener);
Any tips on what might be missing?
I am following "Programmer guide" in the SDK - Linux64_SDK/docs/Java/ProgrammersGuide/Generic Reader Interface/Managing Tags.htm
I have attached the full example ...
import com.mot.rfid.api3.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
class EventHandler implements RfidEventsListener {
// Read Event Notification
public void eventReadNotify(RfidReadEvents e){
TagData tag = e.getReadEventData().tagData;
System.out.println("Event: Tag ID " + tag.getTagID());
if (tag.getOpCode() == ACCESS_OPERATION_CODE.ACCESS_OPERATION_READ &&
tag.getOpStatus() == ACCESS_OPERATION_STATUS.ACCESS_SUCCESS) {
if (tag.getMemoryBankData().length() > 0) {
System.out.println(" Mem Bank Data " + tag.getMemoryBankData());
}
}
}
// Status Event Notification
public void eventStatusNotify(RfidStatusEvents e) {
System.out.println("Event: Status Notification " + e.StatusEventData.getStatusEventType());
}
}
public class ZebraTest {
public static void main(String[] args) {
System.out.format("Connect to reader");
String hostname = "10.128.43.134"; // http://fx7500f0ddc7
RFIDReader reader = new RFIDReader(hostname, 0, 0);
EventHandler event_listener = new EventHandler();
Scanner scanner = new Scanner(System.in);
int scan_time = 5;
// Trigger configuration
TriggerInfo triggerInfo;
triggerInfo = new TriggerInfo();
triggerInfo.setEnableTagEventReport(true);
triggerInfo.TagEventReportInfo.setReportNewTagEvent(TAG_EVENT_REPORT_TRIGGER.IMMEDIATE);
triggerInfo.TagEventReportInfo.setReportTagBackToVisibilityEvent(TAG_EVENT_REPORT_TRIGGER.IMMEDIATE);
triggerInfo.TagEventReportInfo.setReportTagInvisibleEvent(TAG_EVENT_REPORT_TRIGGER.IMMEDIATE);
try {
reader.connect();
ZebraTest.printReaderCapabilities(reader);
ZebraTest.tagStorageSettings(reader);
// Set antenna configuration
System.out.println("Set antenna configuration.");
Antennas antennas = reader.Config.Antennas;
short[] antennas_ixs = antennas.getAvailableAntennas();
for (int i = 0; i antennas_ixs.length; i++) {
int antennaID = antennas_ixs[i];
System.out.println("antennaID = "+antennaID);
Antennas.SingulationControl singulationControl = reader.Config.Antennas.getSingulationControl(antennaID);
singulationControl.setSession(SESSION.SESSION_S1);
singulationControl.setTagPopulation((short)10);
reader.Config.Antennas.setSingulationControl(antennaID, singulationControl);
}
// Set reader events configuration
System.out.println("Set reader events configuration.");
reader.Events.setTagReadEvent(true);
reader.Events.setAttachTagDataWithReadEvent(true);
reader.Events.setGPIEvent(true);
reader.Events.setReaderDisconnectEvent(true);
reader.Events.setBufferFullEvent(true); // this works!
reader.Events.addEventsListener(event_listener);
for (int j = 0; j 1000; j++) {
reader.Actions.Inventory.perform(null,triggerInfo,null);
Thread.sleep(scan_time*1000);
System.err.println("Inventory.stop()");
reader.Actions.Inventory.stop();
TagData[] remainingTags = reader.Actions.getReadTags(100);
if (remainingTags != null) {
for(int i = 0; i remainingTags.length; i++) {
System.out.println(remainingTags[i].getTagID()+","+
remainingTags[i].getPeakRSSI()+","+
remainingTags[i].getTagSeenCount()+","+
remainingTags[i].getPhase()+","+
remainingTags[i].isContainsLocationInfo());
}
}
System.err.println("Actions.purgeTags()");
reader.Actions.purgeTags();
}
reader.Events.removeEventsListener(event_listener);
if (reader.isConnected()) {
reader.Events.removeEventsListener(event_listener);
reader.disconnect();
}
} catch (InvalidUsageException e) {
System.err.println("InvalidUsageException: " + e.getMessage());
} catch (OperationFailureException e) {
System.err.println("OperationFailureException: " + e.getMessage());
} catch (InterruptedException e) {
System.err.println("InterruptedException: " + e.getMessage());
} finally {
try {
if (reader.isConnected()) {
reader.Events.removeEventsListener(event_listener);
reader.disconnect();
}
} catch (Exception e) {
System.err.println("reader.disconnect() Exception: " + e.getMessage());
}
}
}
}
1 Replies
Hi,
I am having the same problem when using the RFD2000 with TC20 Reader.
I am using the latest version available on the RFD2000 support page, which is Zebra_RFID_Mobile_API-2.2.7.0
The problem is that even enabling the RFID Tag Events while reading does not execute the RfidReadEvents handler.
I read through the Sled, the led lights green showing that it is reading, but it does not enter this Event:
@Override
public void eventReadNotify (RfidReadEvents e) {
end TagData [] myTags = Application.mConnectedReader.Actions.getReadTags (100);
if (myTags! = null) {
//Log.d("RFID_EVENT","l: "+ myTags.length);
final Fragment fragment = getSupportFragmentManager (). findFragmentByTag (TAG_CONTENT_FRAGMENT);
for (int index = 0; index 0) {
startlocatebeepingTimer (Application.TagProximityPercent);
}
if (fragment instanceof LocationingFragment)
((LocationingFragment) fragment) .handleLocateTagResponse ();
} else {
if (Application.isAccessCriteriaRead &&! Application.mIsInventoryRunning) {
accessTagCount ++;
} else {
if (myTags [index]! = null && (myTags [index] .getOpStatus () == null || myTags [index] .getOpStatus () == ACCESS_OPERATION_STATUS.ACCESS_SUCCESS)
final int tag = index;
runOnUiThread (new Runnable () {
@Override
public void run () {
if (Application.TAG_LIST_MATCH_MODE == true && Application.tagListFileExist == true)
new MatchingTagsResponseHandlerTask (myTags [tag], fragment) .execute ();
else
new ResponseHandlerTask (myTags [tag], fragment) .execute ();
}
});
}
}
}
}
}
}
And with that I can not redeem the tags read to perform a later action.
This is occurring in Zebra_RFID_Mobile_API-2.2.7.0 demo application.
OBS: I updated the version of firmeware for the latest available on the site too, it being:
RFD2000-SAADXS00-001-R05D1
can anybody help me? Does anyone know if there is any other update to be made or if it is in fact an API problem available on the Site?