Skip to content

Commit ebdcd8f

Browse files
committed
fix: set address flag for NFC-V
The address flag was missing in NFC-V read operations. This should allow the tags to be read.
1 parent c507736 commit ebdcd8f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

app/src/main/java/org/vcoprinttag/NfcHelper.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ class NfcHelper(private val tag: Tag) {
137137
if (blockOffset > 0) {
138138
// Read current block
139139
val readCmd = ByteArray(2 + uid.size + 1)
140-
readCmd[0] = 0x02
141-
readCmd[1] = 0x20.toByte()
140+
readCmd[0] = 0x22 // Address flag (0x20) + high data rate (0x02)
141+
readCmd[1] = 0x20.toByte() // READ_SINGLE_BLOCK command
142142
System.arraycopy(uid, 0, readCmd, 2, uid.size)
143143
readCmd[2 + uid.size] = currentBlock.toByte()
144144
val resp = nfcV.transceive(readCmd)
@@ -238,10 +238,10 @@ class NfcHelper(private val tag: Tag) {
238238
val blocks = mutableListOf<Byte>()
239239
for (blockNum in 0 until 129) {
240240
try {
241-
val flags: Byte = 0x02
241+
val flags: Byte = 0x22 // Address flag (0x20) + high data rate (0x02)
242242
val cmd = ByteArray(2 + uid.size + 1)
243243
cmd[0] = flags
244-
cmd[1] = 0x20.toByte()
244+
cmd[1] = 0x20.toByte() // READ_SINGLE_BLOCK command
245245
System.arraycopy(uid, 0, cmd, 2, uid.size)
246246
cmd[2 + uid.size] = blockNum.toByte()
247247
val resp = nfcV.transceive(cmd)

0 commit comments

Comments
 (0)