am getting an exception com.zebra.rfid.api3.OperationFailureException on last line
override fun writeTagID(tagId: String, newId: HexString, password: HexString) {
// конфигурация взята из офф. документации https://techdocs.zebra.com/dcs/rfid/android/2-15/guide/tagwrite/
reader.Config.setAccessOperationWaitTimeout(3000)
reader.Actions.Inventory.stop()
reader.Config.dpoState = DYNAMIC_POWER_OPTIMIZATION.DISABLE
val tagData: TagData? = null
val tagAccess = TagAccess()
val writeAccessParams = tagAccess.WriteAccessParams()
val writeData: String = newId.value
writeAccessParams.accessPassword = password.value.toLong(16)
writeAccessParams.memoryBank = MEMORY_BANK_EPC
writeAccessParams.offset = 2 // offset is two for EPC ID
writeAccessParams.setWriteData(writeData)
// set retries in case of partial write happens
writeAccessParams.writeRetries = 3
// data length in words
writeAccessParams.writeDataLength = 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
reader.Actions.TagAccess.writeWait(tagId, writeAccessParams, null, tagData, true, true)
}
I read the documentation. Tried increasing the timeout but still getting an exception.
2021-07-30 14:26:09.978 13780-13998/ru.app.rfid_android W/System.err: com.zebra.rfid.api3.OperationFailureException
2021-07-30 14:26:09.979 13780-13998/ru.app.rfid_android W/System.err: at com.zebra.rfid.api3.j1.a(SourceFile:4)
2021-07-30 14:26:09.979 13780-13998/ru.app.rfid_android W/System.err: at com.zebra.rfid.api3.TagAccess.writeWait(SourceFile:34)
2021-07-30 14:26:09.980 13780-13998/ru.app.rfid_android W/System.err: at ru.app.rfid_android.core.reader.zebra.ZebraReaderAndroid.writeTagID-e7Vaky0(ZebraReaderAndroid.kt:218)
2021-07-30 14:26:09.980 13780-13998/ru.app.rfid_android W/System.err: at ru.app.rfid_android.core.model.ReaderRec.writeAndReadTag-ToYnHGU(ReaderRec.kt:269)
2021-07-30 14:26:09.980 13780-13998/ru.app.rfid_android W/System.err: at ru.app.rfid_android.core.model.ReaderRec$writeBank$1.invoke(ReaderRec.kt:246)
2021-07-30 14:26:09.981 13780-13998/ru.app.rfid_android W/System.err: at ru.app.rfid_android.core.model.ReaderRec$writeBank$1.invoke(ReaderRec.kt:30)
2021-07-30 14:26:09.982 13780-13998/ru.app.rfid_android W/System.err: at ru.app.rfid_android.core.model.ReaderRec$runCatchingAndTimeout$1.invoke(ReaderRec.kt:371)
2021-07-30 14:26:09.982 13780-13998/ru.app.rfid_android W/System.err: at ru.app.rfid_android.core.model.ReaderRec$runCatchingAndTimeout$1.invoke(ReaderRec.kt:30)
2021-07-30 14:26:09.983 13780-13998/ru.app.rfid_android W/System.err: at ru.app.rfid_android.core.UtilsKt$runWithTimeout$stuffToDo$1.run(Utils.kt:82)
2021-07-30 14:26:09.983 13780-13998/ru.app.rfid_android W/System.err: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
2021-07-30 14:26:09.984 13780-13998/ru.app.rfid_android W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2021-07-30 14:26:09.984 13780-13998/ru.app.rfid_android W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
2021-07-30 14:26:09.984 13780-13998/ru.app.rfid_android W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
2021-07-30 14:26:09.984 13780-13998/ru.app.rfid_android W/System.err: at java.lang.Thread.run(Thread.java:764)
0 Replies