Question

I am trying to get UID from NFC tag using Android 4.4 using phonegap and phonegap-nfc-master plugin. That return me an hexadecimal string. But when I read the same tag with an Usb Nfc keyboard emulator (like this: http://www.shopnfc.it/gb/nfc-readers-writers/40-usb-nfc-loginer-keyboard-emulator.html) the results is a decimal number. Ok. Now I'am trying to convert dec to hex but the codes do not match. Can you help me please? Thanks

EDIT: For example, Android returns ID 04a9dba2853280 and Keyboard Emulator returns 3685287048 for the same tag. I tried to convert hexadecimal by removing some character but doesn't. I don't understand the logic of this conversion. That Id is unique and I think there is only a conversion problem.

Was it helpful?

Solution

The decimal number you receive (3685287048) is DBA90488 in hexadecimal representation. Thus, the keyboard-emulation reader gives you the first cascade-level part of the tag UID (see ISO/IEC 14443-3 for reference).

For a tag with a 7-byte UID zzyyxxwwvvuutt (in your case 04A9DBA2853280), the ISO 14443-3 anti-collision has to cascade levels. The UID in cascase-level 1 is 88zzyyxx (in your case 8804A9DB). 88 is the cascade tag which is used to distinguish (i.e. produce collissions between) 4-byte UIDs (which use only a single cascade-level) and tags with longer UIDs (7/10-byte). The UID part in cascade-level 2 is then wwvvuutt (in your case A2853280).

As your reader stops the enumeration procedure after cascade-level 1, it detects only the first part of the UID (including the cascade tag): 88zzyyxx. This translates to the decimal number:

xx_h * 2^24 + yy_h * 2^16 + zz_h * 2^8 + 88_h

In your case:

DB_h * 2^24 + A9_h * 2^16 + 04_h * 2^8 + 88_h = 
 219 * 2^24 +  169 * 2^16 +    4 * 2^8 +  136 = 
 3674210304 +    11075584 +       1024 +  136 = 
                                   3685287048

OTHER TIPS

The reader that you had bought is designed for Mifare chips, now there is a loginer for all tags, with hexadecimal

http://www.shopnfc.it/en/nfc-readers-writers/61-nfc-loginer.html

It can easily read the NFC Tag's Unique ID (UID) and automatically writes it where the cursor is positioned on the display, and "press" enter, too. For this reason, it can be used to make a quick and safe access to PC/mobile/tablet.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top