我是 Xamarin 以及 Android 开发的新手。我有一个 NFC 标签,特别是 ST M24LR64E,上面有数据。我可以使用 Google Play 上的 ST 应用程序查看数据块。在我的 Xamarin 应用程序中,我无法在没有收到 TagLostException 的情况下向标签发送消息。我可以毫无问题地查询标签 ID,但尝试读取单个数据块时,我得到了异常。任何方向将不胜感激。
byte[] response = new byte[] { 0x0A };
byte[] cmd = new byte[]
{
(byte) 0x26,
(byte) 0x01,
0x00
};
response = nfcv.Transceive(cmd);
byte[] single = new byte[]
{
(byte) 0x40, // FLAGS
(byte) 0x20, // READ_SINGLE_BLOCK
0, 0, 0, 0, 0, 0, 0, 0,
(byte) (0 & 0x0ff)
};
Array.Copy(id, 0, single, 2, 8);
response = nfcv.Transceive(single);
第一个Transceive()
没问题,我看到 10 个字节回来了。一旦我尝试读取数据块,就会得到 TagLostException。