NFC读卡器读取BlackBerry手机数据

时间:2022-04-11 17:14:49

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;
}