Android NFC- Mifare Classic Restore and Transfore无法正常工作
根据文件;
还原:将块的内容移至内部传输中 缓冲区
转移:将内部传输缓冲区的内容写入 值块
因此希望将一些数据从X块移动到Y块。

根据访问条件, sector 3 支持传输
和还原
。
也块12 有一个数据QuickAppDemotest
。我想通过使用Restore
和传输
方法,将其从 Block 12 移动到块13 。工作。
MifareClassic mfc = MifareClassic.get(tag);
try {
mfc.connect();
boolean authA = mfc.authenticateSectorWithKeyA(3, MifareClassic.KEY_NFC_FORUM);
if (authA) {
mfc.restore(12);
mfc.transfer(13);
}
mfc.close();
} catch (Exception e) {
Log.d(TAG, "Error: " + e.getMessage());
}
它不会引发任何异常,但是在方法完成后,当我从应用程序中检查 block 12 QuickAppTestDemo
数据时。
谁能给我线索?
According to documentation;
Restore: Moves the contents of a block into the internal Transfer
BufferTransfer: Writes the contents of the internal Transfer Buffer to a
value block
So want to move some data from x block to y block.
According to access conditions, Sector 3 supports transfer
and restore
.
Also Block 12 have a data quickappdemotest
. I want to move it from Block 12 to Block 13 by using restore
and transfer
methods but somehow it did not work.
MifareClassic mfc = MifareClassic.get(tag);
try {
mfc.connect();
boolean authA = mfc.authenticateSectorWithKeyA(3, MifareClassic.KEY_NFC_FORUM);
if (authA) {
mfc.restore(12);
mfc.transfer(13);
}
mfc.close();
} catch (Exception e) {
Log.d(TAG, "Error: " + e.getMessage());
}
It does not throw any exception but after method completes, when I checked from the app only Block 12 have quickapptestdemo
data.
Can anyone give me clue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
还原命令需要格式为值块
块12的示例:
ff000000000000000000000000000cf30cf3
restore command needs block formatted as value block
example for block 12:
FF00000000FFFFFFFF0000000CF30CF3
转移操作仅适用于价值块,必须填补两个条件:
值块格式看起来像这样:

例如,390的值看起来像这样(请注意,数字是小endian,lsb首先),
地址的值并不重要,只要格式化是可以
的更多信息,查看第8.6.2.1章在这里
The transfer operation only works on value blocks, two conditions must be filled:
The value block format looks like this:

For example, a value of 390 would look like this (mind that numbers are stored as little endian, LSB first)
The value of the address does not really matter, as long as the formatting is OK
For more info, check out chapter 8.6.2.1 here