Getting TID value from tag using SDK 2.0.4.177 for TC53E-RFID device

c chetan patel 3 days 17 hours ago
27 0 0

Hello Team,

I created plugin for my cordova application using SDK 2.0.4.177.
I used TC53E-RFID device for my cordova application 

I need to get TID value from Tag using this plugin.

I initialized plugin after app started

private void ConfigureZebraReader() {
Log.d(TAG, "ConfigureReader2 " + reader.getHostName());
if (reader.isConnected()) {
TriggerInfo triggerInfo = new TriggerInfo();
triggerInfo.StartTrigger.setTriggerType(START_TRIGGER_TYPE.START_TRIGGER_TYPE_IMMEDIATE);
triggerInfo.StopTrigger.setTriggerType(STOP_TRIGGER_TYPE.STOP_TRIGGER_TYPE_IMMEDIATE);
try {
// receive events from reader
if (eventHandler == null)
eventHandler = new EventHandler();
reader.Events.addEventsListener(eventHandler);
// HH event
reader.Events.setHandheldEvent(true);
// tag event with tag data
reader.Events.setTagReadEvent(true);
reader.Events.setAttachTagDataWithReadEvent(true);

// power levels are index based so maximum power supported get the last one
MAX_POWER = reader.ReaderCapabilities.getTransmitPowerLevelValues().length - 1;
// set antenna configurations
Antennas.AntennaRfConfig config = reader.Config.Antennas.getAntennaRfConfig(1);
config.setTransmitPowerIndex(200); //270
//config.setrfModeTableIndex(0);
config.setTari(18800);
reader.Config.Antennas.setAntennaRfConfig(1, config);
// Set the singulation control
Antennas.SingulationControl s1_singulationControl = reader.Config.Antennas.getSingulationControl(1);
s1_singulationControl.setSession(SESSION.SESSION_S0);
s1_singulationControl.Action.setInventoryState(INVENTORY_STATE.INVENTORY_STATE_AB_FLIP);
s1_singulationControl.Action.setSLFlag(SL_FLAG.SL_ALL);
reader.Config.Antennas.setSingulationControl(1, s1_singulationControl);

// delete any prefilters
reader.Actions.PreFilters.deleteAll();
} catch (InvalidUsageException | OperationFailureException e) {
e.printStackTrace();
}
}
}

After initialized plugin, Reader start for get TID value using below function

readerCapabilities = rfidHandler.reader.ReaderCapabilities;

short[] allAntennas = new short[readerCapabilities.getNumAntennaSupported()];
for(short i = 1; i<= readerCapabilities.getNumAntennaSupported(); i++) {
allAntennas[i-1] = i;
}

TagAccess tagAccess = new TagAccess();
TagAccess.ReadAccessParams readAccessParams = tagAccess.new ReadAccessParams();
//Set the param values
readAccessParams.setCount(12);
readAccessParams.setOffset(0);
readAccessParams.setMemoryBank(MEMORY_BANK.MEMORY_BANK_TID);

AntennaInfo antennaInfo = new AntennaInfo(allAntennas);
try {
rfidHandler.reader.Actions.purgeTags();
rfidHandler.reader.Actions.TagAccess.readEvent(readAccessParams, null, antennaInfo);
} catch (InvalidUsageException e) {
if( e!= null && e.getStackTrace().length>0){ Log.e("wyt", e.getStackTrace()[0].toString()); }
} catch (OperationFailureException e) {
if( e!= null && e.getStackTrace().length>0){ Log.e("wyt", e.getStackTrace()[0].toString()); }
//rfidListeners.onFailure(e);
}

 

Using below Handler function to catch tag value ,
"eventReadNotify" funcation call every sec and green light blinking with beep sound, but not value fill in "MyTags" variable 

// TID is stored in MemoryBankData
String tid = tag.getMemoryBankData();

public class EventHandler implements RfidEventsListener {
// Read Event Notification
public void eventReadNotify(RfidReadEvents e) {
TagData[] myTags = reader.Actions.getReadTags(100);
if (myTags != null) {
for (TagData tag : myTags) {
// Extract EPC data
String epc = tag.getTagID();
// Check if TID data is available (check for null or empty value)
if (tag.getOpCode() == ACCESS_OPERATION_CODE.ACCESS_OPERATION_READ &&
tag.getOpStatus() == ACCESS_OPERATION_STATUS.ACCESS_SUCCESS &&
tag.getMemoryBankData() != null) {

// TID is stored in MemoryBankData
String tid = tag.getMemoryBankData();

Message msg = new Message();
msg.what = 1;
msg.obj = tid;
stopInventory();
if(TC53e.isLoop == true)
{
TC53e.isLoop = false;
mHandler.sendMessage(msg);
}
} else {
Log.d(TAG, "TID not available for this tag");
}
}
new AsyncDataUpdate().execute(myTags);
}
}

 

it is working fine but sometime not read tag value, and some time read tag value but it take 5-10 sec.
i checked in "123RFID Mobile", it is read tag value < 1 sec.

can you please suggest, is there any missing in initialize plugin function.

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