当我尝试收发 NFC-V Tag-it HF-I Plus Inlay 标签的命令时,大多数命令都会出现 TagLostException。
从我经历过的链接来看,这个异常可能是由不正确的命令引起的。
如何为 Nfc V Tag-it HF-I Plus Inlay 创建正确的 ISO15693 命令字节 []?
数据表显示了支持的命令,但如何创建正确的命令来读取 NFC-V 标签?
文档中的命令是:
我要阅读的标签是:
代码:
Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
Log.i(TAG, " tag "+tag );
if (tag != null) {
NfcV tech = NfcV.get(tag);
Log.i(TAG, " tech "+tech );
if (tech != null) {
try {
tech.connect();
Log.i(TAG, " on connect" );
byte[] data = tech.transceive(Nfcv.InventoryRequest());
Log.i(TAG, "resp data " + data);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < data.length; i++) {
byte b = data[i];
System.out.println(b);
sb.append(String.format("%02X ", b));
}
System.out.println("response: " + sb.toString());
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
tech.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
我经历了以下几点:
- NfcV Transceive 命令在 android 中使用 TI HF-I plus tag(ISO15693) 引发标签丢失异常
- ISO15693/Tag-it HF-I 上的收发失败
- Android NfcV 保持安静命令
- Android NfcV (ISO 15693) 标签
- 读取 Android NfcV 标签时出现连接错误
编辑
我尝试过的命令:
public class Nfcv {
// texas get system info -> tag lost exception
public static byte[] GET_SYSTEM_INFO = ReadNfcActivity.hexStringToByteArray("010A00030418002B0000");
//read multiple blocks -> not working
byte[] read_multiple_blocks= ReadNfcActivity.hexStringToByteArray("010C00030418002301020000");
byte[] readSingleBlock = ReadNfcActivity.hexStringToByteArray("010B000304180020050000");
// readUID generic command -> not working
public static byte[] readUID = ReadNfcActivity.hexStringToByteArray("FFCA000000");
public static byte[] InventoryRequest(){
//working response: 00 00 3A E5 00 04 00 00 07 E0
// R/0 UID is E0 07 00 00 04 00 E5 3A 00 00 (reverse)
return new byte[] { (byte) 0x24, (byte) 0x01, (byte) 0x00};
}
//-> not working
private byte[] ReadSingleBlockUnadressed(byte blocknumber) {
return new byte[] {(byte) 0x00, (byte) 0x20, blocknumber};
}
//-> response 03
public static byte[] get_system_info = {0x00,(byte)0x2B};
}