RFID Tag Listner (RfidEventsListener 's method are not called)

B Bhavin Bhavsar 3 years 7 months ago
14 0 0

I am trying to connect RFID reader and want to receive data of single tag(as and when its detected by reader). Which can be done by RfidEventsListner, but not getting any success.
When I do bulk read(getReadTags) then I am able to receive the data, but not single data as and when the reader receives it.
Yes I have done few things which are mandatory like.
1) Adding of "myReader.Events.setTagReadEvent(true);"
2) Adding of "myReader.Events.setAttachTagDataWithReadEvent(true);" //(This property works in C# but when tried in Java it fails)
3) Staring "myReader.Actions.Inventory.perform();" before performing scanning
Below is my code.
private EventsHandler eventsListener = new EventsHandler();
if(myReader.isConnected()){
myReader.Events.setInventoryStartEvent(true);
myReader.Events.setInventoryStopEvent(true);
myReader.Events.setAccessStartEvent(true);
myReader.Events.setAccessStopEvent(true);
myReader.Events.setAntennaEvent(true);
myReader.Events.setGPIEvent(true);
myReader.Events.setBufferFullEvent(true);
myReader.Events.setBufferFullWarningEvent(true);
myReader.Events.setReaderDisconnectEvent(true);
myReader.Events.setReaderExceptionEvent(true);
myReader.Events.setTagReadEvent(true);
myReader.Events.setAttachTagDataWithReadEvent(true);
myReader.Actions.Inventory.perform();
TagStorageSettings tagStorageSettings = myReader.Config.getTagStorageSettings();
tagStorageSettings.discardTagsOnInventoryStop(true);
myReader.Config.setTagStorageSettings(tagStorageSettings);
myReader.Events.addEventsListener(eventsListener);
retVal = true;
isConnected = true;
postInfoMessage("Connected to " + hostName);
postStatusNotification(API_SUCCESS, null);
//myReader.Config.setTraceLevel(TRACE_LEVEL.TRACE_LEVEL_ERROR);
}
public class EventsHandler implements RfidEventsListener
{
public EventsHandler(){}
@Override
public void eventReadNotify(RfidReadEvents rre) {
System.out.println("Event Read Notify");
}
@Override
public void eventStatusNotify(RfidStatusEvents rse)
{
System.out.println("Event Status Notify");
}
}

CONTACT
Can’t find what you’re looking for?