Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ACR122U - Read NFC data sent from android phone

I am required to transfer a simple string via NFC to the PC through an android phone. To enable NFC capabilities in the PC I have plugged in an ACR122U to read the transmitted data from the android phone through my C# program in the PC.

I have tried many android implementations online such as

  • https://code.google.com/p/ismb-npp-java/wiki/NppFromPhoneToACR122

  • https://code.google.com/p/ismb-snep-java/

and for C#,

  • https://github.com/tijins/FakeFelica/tree/master/FakeFelica

But non of these worked properly. As in the simple text did not get transmitted. I tried to used the ACR122U SDK's sample code to receive data from the above mentioned android implementations, but that failed too.

I would be really grateful if any of you experts would offer any references/ examples/ tutorials/ sample codes in transmitting a simple text from an android NFC enabled device to a C# program via the ACR122u.

Thank you very much :) I have been stuck at this for a few months and finally turned to you experts for help.

P.S. I tried my best to refer to the ACR122U's documents but it lead me no where

like image 201
Hasitha Shan Avatar asked Nov 11 '22 07:11

Hasitha Shan


1 Answers

You are trying to combine two completely unrelated communication concepts.

The PC-side application that you are using emulates a FeliCa smartcard (with NDEF abstraction layer on top). Thus, on the Android-side you would need to access that emulated smartcard in reader/writer mode:

  1. Register your Android app to receive NFC intents (either through the manifest or through the foreground dispatch system). For your card, I would suggest that you either register for the NDEF_DISCOVERED intent or for TECH_DISCOVERED intent with technologies NfcF + Ndef/NdfFormatable.

  2. Once you receive such an intent, get the tag handle from the received open an Ndef/NdefFormatable connection to the emulated tag and read/write NDEF messages.

However, what you currently try to do on the Android-side is using peer-to-peer mode (more specifically Android Beam). Beam exchanges messages between two NFC devices in peer-to-peer mode and not between an NFC and an (emulated) NFC tag. In this case, you would need to put the ACR122U in peer-to-peer mode (the ISMB-SNEP project contains Java code for this).

like image 176
Michael Roland Avatar answered Nov 15 '22 06:11

Michael Roland