Gen2V2

RFID SDK for Android 2.0.1.15

Overview

This guide provides a details to perform Gen2V2 operations using RFID API3

Details

This section covers the Gen2V2 operations that an application needs to performed on a RFID Reader which supports Gen2v2 commands such as authenticate, untraceable, and readbuffer

Authenticate

Authenticate operation takes in the message data and message length with few of the options such as decision on including the response length, sending the response, etc. The AuthenticateParams contain the message data, message length and other settings to be sent to the reader. The accessfilter parameter contains the tag pattern on which the operation occurs.


// authenticate
// Tag Pattern A
accessFilter.TagPatternA.setMemoryBank(MEMORY_BANK.MEMORY_BANK_EPC);
accessFilter.TagPatternA.setTagPattern(new byte[]{(byte)0xe2, (byte)0xc0 });
accessFilter.TagPatternA.setTagPatternBitCount(16);
accessFilter.TagPatternA.setBitOffset(32);
accessFilter.TagPatternA.setTagMask(tagMask);
accessFilter.TagPatternA.setTagMaskBitCount(tagMask.length*8);
accessFilter.setAccessFilterMatchPattern(FILTER_MATCH_PATTERN.A);

// G2V2 authenticate
// Gen2V2 gen2V2 - new Gen2v2 ();
Gen2v2.AuthenticateParams AuthenticateParams = gen2V2.new AuthenticateParams();
AuthenticateParams.setMsgData("2001FD5D8048F48DD09AAD22000111");
AuthenticateParams.setMsgLen(120);
AuthenticateParams.setIncrespLen(true);
AuthenticateParams.setStoreResp(false);
AuthenticateParams.setSentResp(true);

try {
    reader.Actions.gen2v2Access.authenticate(AuthenticateParams, accessFilter, null);
} catch (InvalidUsageException e) {
    e.printStackTrace();
} catch (OperationFailureException e) {
    e.printStackTrace();
}

Grab the results

Keep getting response in the eventReadNotify event if registered The response and result in the Tagdata will contain the information obtained from the operation


public class EventHandler implements RfidEventsListener {
    // Read Event Notification
    public void eventReadNotify(RfidReadEvents e) {
        TagData[] myTags = reader.Actions.getReadTags(100);
        if (myTags != null) {
            for (int index = 0; index < myTags.length; index++) {
                System.out.println("Tag ID " + myTags[index].getTagID());
                if ((myTags[index].getG2v2OpStatus()!= null) && (myTags[index].getG2v2OpStatus() == GEN2V2_OPERATION_STATUS.ACCESS_SUCCESS)) {
                    if(!myTags[index].getG2v2Response().isEmpty()){
                        System.out.println("Gen2v2 authenticate response " +
                        myTags[index].getG2v2Response());
                    }
                }
            }
        }
    }

    // Status Event Notification
    public void eventStatusNotify(RfidStatusEvents e) {
        System.out.println("Status Notification: " + e.StatusEventData.getStatusEventType());
        if (e.StatusEventData.getStatusEventType() == STATUS_EVENT_TYPE.INVENTORY_START_EVENT) {
            // Access operation started
        } 
        else if(e.StatusEventData.getStatusEventType() == STATUS_EVENT_TYPE.INVENTORY_STOP_EVENT) {
            // Access operation stopped - Can be used to signal waiting thread
        }
    }
}

Untraceable

Untraceable operation lets the user decide which memory bank to show and what length of the memory bank to show. Here the UntraceableParams contain the settings and password. The accessfilter parameter contains the tag pattern on which the operation occurs


// untraceable
AccessFilter accessFilter = new AccessFilter();
byte[] tagMask = new byte[]{(byte) 0xff, (byte) 0xff, };
// Tag Pattern A
accessFilter.TagPatternA.setMemoryBank(MEMORY_BANK.MEMORY_BANK_EPC);
accessFilter.TagPatternA.setTagPattern("2f22");
accessFilter.TagPatternA.setTagPatternBitCount(32);
accessFilter.TagPatternA.setBitOffset(32);
accessFilter.TagPatternA.setTagMask(tagMask);
accessFilter.TagPatternA.setTagMaskBitCount(tagMask.length*8);
accessFilter.setAccessFilterMatchPattern(FILTER_MATCH_PATTERN.A);

Gen2v2 gen2V2 = new Gen2v2();
Gen2v2.UntraceableParams UntraceableParams = gen2V2.new
UntraceableParams();
UntraceableParams.setPassword(0);
UntraceableParams.setShowEpc(true);
UntraceableParams.setHideEpc(false);
UntraceableParams.setShowUser(false);
UntraceableParams.setEpcLen(6);
UntraceableParams.setTid(UNTRACEABLE_TID.HIDE_ALL_TID);

try{
    reader.Actions.gen2v2Access.untraceable(UntraceableParams, accessFilter,null);
} catch (InvalidUsageException e) {
    e.printStackTrace();
} catch (OperationFailureException e) {
    e.printStackTrace(); 
}    

After this, when inventory is run, the effects of the settings sent are seen in untraceable operation