'How to fix "GetStatus Write RFID_API_UNKNOWN_ERROR data(x)- Field can Only Take Word values" Android RFID 8500 Zebra

I am trying to develop and application to read and write to RF tags. Reading is flawless, but I'm having issues with writing. Specifically the error "GetStatus Write RFID_API_UNKNOWN_ERROR data(x)- Field can Only Take Word values"

I have tried reverse-engineering the Zebra RFID API Mobile by obtaining the .apk and decoding it, but the code is obfuscated and I am not able to decypher why that application's Write works and mine doesn't.

I see the error in the https://www.ptsmobile.com/rfd8500/rfd8500-rfid-developer-guide.pdf at page 185, but I have no idea what's causing it.

I've tried forcefully changing the writeData to Hex, before I realized that the API does that on its own, I've tried changing the Length of the writeData as well, but it just gets a null value. I'm so lost.

public boolean WriteTag(String sourceEPC, long Password, MEMORY_BANK memory_bank, String targetData, int offset) {
    Log.d(TAG, "WriteTag " + targetData);
    try {
        TagData tagData = null;
        String tagId = sourceEPC;
        TagAccess tagAccess = new TagAccess();
        tagAccess.getClass();
        TagAccess.WriteAccessParams writeAccessParams = tagAccess.new WriteAccessParams();
        String writeData = targetData; //write data in string
        writeAccessParams.setAccessPassword(Password);
        writeAccessParams.setMemoryBank(MEMORY_BANK.MEMORY_BANK_USER);

        writeAccessParams.setOffset(offset); // start writing from word offset 0
        writeAccessParams.setWriteData(writeData);
        // set retries in case of partial write happens
        writeAccessParams.setWriteRetries(3);
        // data length in words
        System.out.println("length: " + writeData.length()/4);
        System.out.println("length: " + writeData.length());
        writeAccessParams.setWriteDataLength(writeData.length()/4);
        // 5th parameter bPrefilter flag is true which means API will apply pre filter internally
        // 6th parameter should be true in case of changing EPC ID it self i.e. source and target both is EPC
        boolean useTIDfilter = memory_bank == MEMORY_BANK.MEMORY_BANK_EPC;
        reader.Actions.TagAccess.writeWait(tagId, writeAccessParams, null, tagData, true, useTIDfilter);
    } catch (InvalidUsageException e) {
        System.out.println("INVALID USAGE EXCEPTION: " + e.getInfo());
        e.printStackTrace();
        return false;
    } catch (OperationFailureException e) {
        //System.out.println("OPERATION FAILURE EXCEPTION");
        System.out.println("OPERATION FAILURE EXCEPTION: " + e.getResults().toString());
        e.printStackTrace();
        return false;
    }
    return true;
}

With

  • Password being 00
  • sourceEPC being the Tag ID obtained after reading
  • Memory Bank being MEMORY_BANK.MEMORY_BANK_USER
  • target data being "8426017056458"
  • offset being 0

It just keeps giving me "GetStatus Write RFID_API_UNKNOWN_ERROR data(x)- Field can Only Take Word values" and I have no idea why this is the case, nor I know what a "Word value" is, and i've searched for it. This is all under the "OperationFailureException", as well. Any help would be appreciated, as there's almost no resources online for this kind of thing.



Solution 1:[1]

Even this question is a bit older, I had the same problem so as far as I know this should be the answer.

Your target data "8426017056458" length is 13 and at writeAccessParams.setWriteDataLength(writeData.length()/4)
you are devide it with four. Now if you are trying to write the target data it is longer than the determined WriteDataLength. And this throws the Error.

One 'word' is 4 Hex => 16 Bits long. So your Data have to be filled up first and convert it to Hex.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vardowin