Operation Access Sequence Does Not Work

R Robert Migliori 6 months 1 week ago
38 0 0

I'm trying to get an operation access sequence to work, e.g. as described in this tutorial, and am unable to do so. The main problem is that the sequence seems to only perform the first operation (for example, read a tag's EPC bank), but not subsequent ones (e.g. reading a tag's TID bank). 

Here is my implementation of an operation sequence, meant to read a tag's EPC bank, followed immediately by a read to its TID bank. The following block occurs after connecting the reader and adding an event handler to it. 

//////// Configure RFIDReader 
// EPC Access Params val epcAccessParams = TagAccess().ReadAccessParams() epcAccessParams.accessPassword = 0 epcAccessParams.memoryBank = MEMORY_BANK.MEMORY_BANK_EPC epcAccessParams.offset = 0
// TID Access Params val tidAccessParams = TagAccess().ReadAccessParams() tidAccessParams.accessPassword = 0 tidAccessParams.memoryBank = MEMORY_BANK.MEMORY_BANK_TID tidAccessParams.offset = 0
// Trigger Settings val triggerInfo = TriggerInfo() triggerInfo.StartTrigger.triggerType = START_TRIGGER_TYPE.START_TRIGGER_TYPE_HANDHELD triggerInfo.StartTrigger.Handheld.handheldTriggerEvent = HANDHELD_TRIGGER_EVENT_TYPE.HANDHELD_TRIGGER_PRESSED
triggerInfo.StopTrigger.triggerType = STOP_TRIGGER_TYPE.STOP_TRIGGER_TYPE_HANDHELD_WITH_TIMEOUT triggerInfo.StopTrigger.Handheld.handheldTriggerEvent = HANDHELD_TRIGGER_EVENT_TYPE.HANDHELD_TRIGGER_RELEASED triggerInfo.StopTrigger.Handheld.handheldTriggerTimeout = 5000
// Set Configuration readerDevice.rfidReader.Config.startTrigger = triggerInfo.StartTrigger readerDevice.rfidReader.Config.stopTrigger = triggerInfo.StopTrigger readerDevice.rfidReader.Config.setTriggerMode(ENUM_TRIGGER_MODE.RFID_MODE, true) readerDevice.rfidReader.Events.setHandheldEvent(true) readerDevice.rfidReader.Events.setTagReadEvent(true)
readerDevice.rfidReader.Events.setAttachTagDataWithReadEvent(false) // Use getReadTagsEx API readerDevice.rfidReader.Events.setOperationEndSummaryEvent(true);
// Define Operations // Read EPC Bank Operation val op0 = readerDevice.rfidReader.Actions.TagAccess.OperationSequence.Operation() op0.accessOperationCode = ACCESS_OPERATION_CODE.ACCESS_OPERATION_READ op0.ReadAccessParams.memoryBank = MEMORY_BANK.MEMORY_BANK_EPC
// Read TID Bank Operation val op1 = readerDevice.rfidReader.Actions.TagAccess.OperationSequence.Operation() op1.accessOperationCode = ACCESS_OPERATION_CODE.ACCESS_OPERATION_READ op1.ReadAccessParams.memoryBank = MEMORY_BANK.MEMORY_BANK_TID
// Add Operations readerDevice.rfidReader.Actions.TagAccess.OperationSequence.deleteAll() readerDevice.rfidReader.Actions.TagAccess.OperationSequence.add(op0) readerDevice.rfidReader.Actions.TagAccess.OperationSequence.add(op1)
// Init Sequence (?) readerDevice.rfidReader.Actions.TagAccess.OperationSequence.performSequence( null, triggerInfo, null )

The event handler is defined as follows:

// EventHandler 
// Status Event Handler (Just logs when the trigger was pulled and released)
override fun eventStatusNotify(statusEvent : RfidStatusEvents) {
        val eventData = statusEvent.StatusEventData
        val eventType = eventData.statusEventType

        when (eventType) {
            STATUS_EVENT_TYPE.HANDHELD_TRIGGER_EVENT -> {
                when (eventData.HandheldTriggerEventData.handheldEvent) {
                    HANDHELD_TRIGGER_EVENT_TYPE.HANDHELD_TRIGGER_PRESSED -> {
                        Log.d(TAG, "HANDHELD_TRIGGER_PRESSED")
                    }

                    HANDHELD_TRIGGER_EVENT_TYPE.HANDHELD_TRIGGER_RELEASED -> {
                        Log.d(TAG, "HANDHELD_TRIGGER_RELEASED")
                    }
                }
             } 
          }
          
// Read Event Handler
// Call getReadTagsEx for 100 tags when a read event is triggered, print data 
override fun readStatusNotify(readEvent : RfidReadEvents) {
    	Log.d(TAG, "$readEvent")
    	

        val tags = rfidReader.Actions.getReadTagsEx(100)
        Log.d(TAG, "tags $tags")
        Log.d(TAG, "tags.tags ${tags.tags}")
        Log.d(TAG, "tags.tags.size ${tags.tags.size}")

        tags.tags.filter { it.tagID != null }.forEach { tagData ->
            Log.d(TAG, "tagID ${tagData.tagID}")
            Log.d(TAG, "memoryBank: ${tagData.memoryBank}")
            Log.d(TAG, "memoryBankData: ${tagData.memoryBankData}")
            Log.d(TAG, "opCode: ${tagData.opCode}")
            Log.d(TAG, "opStatus: ${tagData.opStatus}")
        }
    }     

 This yields only EPC reads, without any TID reads: 

TAG                 com.example.app        D  com.zebra.rfid.api3.RfidReadEvents[source=com.zebra.rfid.api3.Events@e6f9adf]
TAG                 com.example.app        D  tags com.zebra.rfid.api3.TagDataArray@e2f132c
TAG                 com.example.app        D  tags.tags [Lcom.zebra.rfid.api3.TagData;@1eac1f5
TAG                 com.example.app        D  tags.tags.size 100
TAG                 com.example.app        D  tagID XXXXXXXXXXXXXXXXXXXXXXXX 
TAG                 com.example.app        D  memoryBank: MEMORY_BANK_EPC
TAG                 com.example.app        D  memoryBankData: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
TAG                 com.example.app        D  opCode: ACCESS_OPERATION_READ
TAG                 com.example.app        D  opStatus: ACCESS_SUCCESS

None of my attempts to solve this problem have been successful. Does anyone have ideas or suggestions? 

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