NFC读卡器读取BlackBerry手机数据

47 篇文章 3 订阅

1. 读取手机NFC卡片的UID

       测试下来发现手机NFC卡片的UID总是在变,最后确定,黑莓手机上卡模拟设置UID的API,被黑莓因为安全原因关掉了。参考


2. 读取NDEF格式的smart tag

      目前我还不知道NFC读卡器如何读smart tag,但是可以用另外一台9900读取读取9900程序模拟的smart tag


3.手机程序模拟14443-4的NFC卡片,读卡器以APDU指令操作手机程序模拟的NFC卡片

   在eJDE 1.5中带的例子程序NFCEmulatorDemo中,如果读开启发出APDU指令 00A4000002E103,那么返回结果0900,否则返回结果0000

(byte) 0x00, (byte) 0xA4, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0xE1, (byte) 0x03


注:APDU指令00A4000002E103的说明见NFC Type 4 Tag Operation Technical Specification

5.4.3 Capability Container Select Procedure
Table 12: Capability Container Select Command



   具体见VirtualISOTargetListener.java类

    /**
     * @see net.rim.device.api.io.nfc.emulation.VirtualISO14443Part4TargetCallback#processCommand(byte[])
     */
    public byte[] processCommand(byte[] request)
    {        
        // Note: For the sake of this demo, this method will check to see 
        // if the request is the "Capability Container Select" command. 
        // The developer can add additional logic here to provide support
        // for a larger set of commands.
        
		Util.log("processCommand");
    	try {
    		Util.log(StringUtils.getHexString(request));
			
		} catch (UnsupportedEncodingException e) {
			Util.log("processCommand StringUtils.getHexString UnsupportedEncodingException");
			e.printStackTrace();
		}
        // Set up a "default" response to return if the request is not "valid"
        byte[] response = new byte[] {(byte) 0x00, (byte)0x00};

        // Set up the command to comapre against the request
        byte[] capabilityContainerSelect = new byte[] {(byte) 0x00, (byte) 0xA4, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0xE1, (byte) 0x03};
        
        // Make sure that the request is the same length as capabilityContainerSelect. 
        // If they aren't the same, its not worth parsing.
        if (request.length == capabilityContainerSelect.length)
        {
            // Go through the request command and compare it to capabilityContainerSelect
            for(int i = 0; i < request.length; i ++)
            {
                // If they are not the same, return (0x00, 0x00)
                if (request[i] != capabilityContainerSelect[i])
                {
                    return response;
                }
            }
            
            // Do work associated with the "Select Capability Container" command here
            // ...
            // ...
            // ...
            
            // The request has been completed, so send the "command completed" response
            _screen.setEmulationListenerStatus("\"Capability Container Select\" command sent! Sending response...");
            response = new byte[] {(byte)0x09, (byte)0x00};
            return response;
        }        



评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值