如何解决“ GetStatus写入RFID_API_UNKNOWN_ERROR数据(x)-字段只能获取Word值” Android RFID 8500 Zebra

时间:2019-07-02 07:07:32

标签: java android rfid zebra

我正在尝试开发和应用程序来读写RF标签。阅读是完美无缺的,但是我在写作方面遇到了问题。特别是错误“ GetStatus写入RFID_API_UNKNOWN_ERROR数据(x)-字段只能采用Word值”

我曾尝试通过获取.apk并将其解码来对Zebra RFID API Mobile进行逆向工程,但是代码被混淆了,我无法解释为什么该应用程序的Write有效而我的无效。

我在第185页的https://www.ptsmobile.com/rfd8500/rfd8500-rfid-developer-guide.pdf中看到了错误,但我不知道是什么原因造成的。

我已经尝试过将writeData强制更改为Hex,在意识到API自己执行此操作之前,我还尝试过更改writeData的Length,但是它只是获得一个空值。我很迷路。

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;
}

使用

  • 密码为00
  • sourceEPC是读取后获得的标签ID
  • 正在使用MEMORY_BANK.MEMORY_BANK_USER的存储库
  • 目标数据为“ 8426017056458”
  • 偏移量为0

它只是一直给我“ GetStatus写入RFID_API_UNKNOWN_ERROR数据(x)-字段只能获取Word值”,我也不知道为什么会这样,也不知道“ Word值”是什么,我已经搜索它。这也都在“ OperationFailureException”下。任何帮助将不胜感激,因为这种事情几乎没有在线资源。

0 个答案:

没有答案