NFC
by Spiral Code Studio
View and activate on the Corona Store
The NFC plugin enables your application to read NFC tags. NFC stands for Near Field Communication. At the moment the plugin only supports reading NDEF tags.
NFC
by Spiral Code Studio
View and activate on the Corona Store
The NFC plugin enables your application to read NFC tags. NFC stands for Near Field Communication. At the moment the plugin only supports reading NDEF tags.
Hi there!
How to get byte array of tag.id?
If i convert string to bytes by string:byte, i get wrong results.
example:
original tag.id: 194 24 120 63
from plugin, after convertation: 239 191 189 24 120 63
alexey.beljakov, hi. Can you see what’s in event.id and event.tag.toString?
event.id is string with special symbols, part of them are not display on device.
json.encode(event.id)
result: \ufffd\u0018x?
original id is: C7:18:78:3F (hex)
event.tag.toString: TAG: Tech [android.nfc.tech.NfcA]
it will be nice, if event.tag.id returns hexstring
Can you print out event.id using the same string:byte() approach?
In the plugin code I am converting a byte array (tag id) directly into a Lua string, so that really should be working.
Are you sure the ID you are providing as “correct” is truly correct? Can you try a few other NFC readers?
string.byte(event.id,1,10)
result: 239 191 189 24 120 63
original: 199 24 120 63
another card:
result: 4 108 232 146 170 65 239 191 189
original: 4 108 232 146 170 65 128
wrong part is 239 191 189 in both cases
i read it by android app “NFC Tools” and by windows pcsc cardreader(ACR1251) original id is the same in both cases
Thanks, I think I know what’s going on. Will try fixing it soon.
very nice! thank you very much
спасибо большое!)
Just pushed a fix. Please try again when the repo updates.
i pull update, result is other, but still wrong(
plugin: 4 108 195 168 194 146 194 170 65 194 128
original: 4 108 232 146 170 65 128
plugin: 195 135 24 120 63
original: 199 24 120 63
Pushed another fix. Try again soon.
bingo! works good!
thank you for quick fixes!
I feel a bit stupid, but how do you stop the app receiving NCS events?
Can you call setListener with nil like this?
nfc.setListener(nil)
Hah, never thought about that. Will add nfc.removeListener() soon.
setListener(nil) won’t work.
runewinse, added.
Thanks a bunch!
A heads up. The plugin will become paid on Wednesday (Oct. 12).
Launch sale for $14.99 for a week and $19.99 after that. Subscription.
I"m looking to read/write raw data for ISO 15693 chips like a M24LR04E-R, which is a NFC/EE
My understanding is I’d need access to NfcV transceive()
https://developer.android.com/reference/android/nfc/tech/NfcV.html#transceive(byte[])
Is this supported or any thoughts of adding support for this?
I’ve got the same problem with reading event.tag.id string.
The original tag id is 0bfa3930 , but incoming value is \u000bú90.
Seems like \u000b string is the utf line break.
The whole json is:
{ "id":"\u000bú90", "name":"nfc", "tag":{ "id":"\u000bú90", "techs":["android.nfc.tech.NfcA","android.nfc.tech.MifareClassic","android.nfc.tech.NdefFormatable"], "toString":"TAG: Tech [android.nfc.tech.NfcA, android.nfc.tech.MifareClassic, android.nfc.tech.NdefFormatable]" }, "type":"tag", "isError":false }
Can you please look.