gpt4 book ai didi

android - 读取 block 经典 NFC

转载 作者:行者123 更新时间:2023-11-29 00:34:54 24 4
gpt4 key购买 nike

如何从扇区 1 读取数据?验证为真,我得到 IOException("transceive failed") 异常。

private String readSector() {   
byte [] array={(byte)0xD3,(byte)0xF7,(byte)0xD3,(byte)0xF7,(byte)0xD3,(byte)0xF7};
byte[] data = null;
final ByteArrayBuffer b = new ByteArrayBuffer(mMaxSize);
String sb=new String();
boolean succes = false;
try {
mClassic.connect();
succes = mClassic.authenticateSectorWithKeyA(1, array);
if (succes) {
b.append(mClassic.readBlock(3), 1, 16);
data = b.toByteArray();
}
else
sb+="Authentication failed";
mClassic.close();
catch (final TagLostException tag) {
tag.printStackTrace();
sb+="Tag Lost";
}
catch (final IOException e) {
e.printStackTrace();
sb+="IOEception";
}
}

最佳答案

在sector 1 block 4 to 6上找到数据,并使用这段代码读取数据,

private String readMadSector() {
byte [] array={(byte)0xD3,(byte)0xF7,(byte)0xD3,(byte)0xF7,(byte)0xD3,(byte)0xF7};
byte[] data = null;
byte [] b;
String sb=new String();
boolean succes = false;
try {
mClassic.connect();
succes = mClassic.authenticateSectorWithKeyA(1, array);
b=mClassic.readBlock(4);

sb+=convertHex(b);


b=mClassic.readBlock(5);

sb+=convertHex(b);

b=mClassic.readBlock(6);

sb+=convertHex(b);
else
sb+="Authentication failed";

mClassic.close();

}

catch (final TagLostException tag) {
tag.printStackTrace();
sb+="Tag Lost";
}

catch (final IOException e) {
e.printStackTrace();
sb+="IOEception";
}





return (sb.toString());
}

关于android - 读取 block 经典 NFC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13157293/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com