使用NFCF高科技Android的NFC收发()(索尼的Felica) [英] Android NFC transceive() using NFCF tech (Sony Felica)

查看:718
本文介绍了使用NFCF高科技Android的NFC收发()(索尼的Felica)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图Android平板电脑使用NFC从设备连接到设备和检索数据。

I am attempting to connect my Android tablet to a device using NFC and retrieve data from the device.

我已经试过

发送命令,因为它在 nfc_device_detection_1 .01.pdf (第4章)

Sending commands as it explains in the nfc_device_detection_1.01.pdf (Chapter 4)

有关收发(在Android的Java DOC)提及

应用程序超氧化物歧化酶(长度)或EOD(CRC)不得追加到有效载荷,它会自动计算

因此​​,我已尝试使用和不使用CRC,有和没有数据包长度,但文档不上,如果我要让它空白清楚,或者我应该只是不包含它。

I have therefore tried with and without the CRC, with and without the packet data length but the documentation is not clear on if I should leave it blank or if i should just not include it.

我已采取另一种方法是在<2.2章如下图href=\"http://www.sony.net/Products/felica/business/tech-support/data/format_sequence_guidelines_1.1.pdf\"相对=nofollow> format_sequence_guidelines_1.1.pdf (同步code后跟请求),但相同的结果。

Another approach I have taken is following the diagram in chapter 2.2 of format_sequence_guidelines_1.1.pdf (Sync Code followed by Request) but same results.

问题

我不知道是什么命令(字节)作为参数发送到收发()方法。**

I do not know what command (bytes) to send as an argument into the transceive() method.**

问题

有谁:


  • 有NFCF沟通的例子吗?

  • 已就协议/命令的详细信息,应使用?

  • 知道,如果NFC标签包含我需要的命令字节?

code

收发()抛出一个IO异常标签丢失了。

transceive() throws an IO Exception "Tag was lost".

我相信这是因为我的命令字节是不正确的(我已经使用了一系列不同的命令)。

I believe this is because my command bytes are not correct (I have used a range of different commands).

最后一个音符(我也厌倦了把收发()在循环和关闭,每次连接的通信)

Last Note (I have also tired putting the transceive() in a while loop and closed and connected the communication each time)

    String action = intent.getAction();

    if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)) {

        Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);

        NfcF nfcf = NfcF.get(tag);

        nfcf.connect();

        byte[] command = new byte[] { (byte) 0x00, (byte) 0x00};

        byte[] response =  nfcf.transceive(command);

     }

如果需要对你的答案的其他信息,请发表评论。谢谢你。

Please comment if any additional information is required for your answers. Thank you.

推荐答案

下面是给定目标设备(标记)IDM,FeliCa的命令字节和有效载荷的如何发送原始命令的示例功能,:

Here is an example function of how to send a "raw" command, given the target device (tag) IDm, the FeliCa command byte and the payload:

byte[] rawCmd(NfcF nfcF, byte[] IDm, byte felicaCmd, byte[] payload) throws IOException {
    final int len = payload != null ? payload.length : 0;

    final byte[] cmd = new byte[10 + len];
    cmd[0] = (byte) (10 + len);
    cmd[1] = felicaCmd;
    System.arraycopy(IDm, 0, cmd, 2, IDm.length);

    if (payload != null) {
        System.arraycopy(payload, 0, cmd, 10, payload.length);
    }

    nfcF.transceive(cmd);
}

这篇关于使用NFCF高科技Android的NFC收发()(索尼的Felica)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆