Topic: Tag Emulation Response

Hi,
what i am trying to accomplish is some communication between a Nexus S and a Arygon APPB USB. I am particulary interested in a Message from the phone to the reader.
So after utterly failing at P2P with libnfc-llcp and nfcpy, i found the nfc-emulate-forum-tag4 example. I sends the libnfc url correctly to the phone. So now the description states, that i could share information with the target, e.g. the reader. I suppose that means to write a NDEF message to the found Tag in Android.
Unfortunately, in Android i cannot write to the Tag, since the write command after i opened it as NDEF Tag (android.nfc.tech.Ndef) it crashes with an IOException "tag is not ndef".
The techlist of the found Tag states it supports Ndef, reported as type4, ISO DEP and NfcA. The isWritable flag s true, and i am able to connect and close the tag.
So i am asking:
- is this the right way of understanding this example ?
- what is supported as a response from the phone ?
- how do actually provide a file for the response from the phone ?
- are there known Timing iusses that make it impossible for the phone to write to the emulated Tag ?

thanks a lot
Tim

Re: Tag Emulation Response

Hello mrtj,

mrtj wrote:

I am particulary interested in a Message from the phone to the reader.

By "Message" did you mean NDEF message from phone to the reader ?

mrtj wrote:

So after utterly failing at P2P with libnfc-llcp and nfcpy

libnfc-llcp is nearly done but you will need to create a LLC's service to handle Android NDEF Push protocol.
BTW, nfcpy should work.

mrtj wrote:

i found the nfc-emulate-forum-tag4 example. I sends the libnfc url correctly to the phone. So now the description states, that i could share information with the target, e.g. the reader. I suppose that means to write a NDEF message to the found Tag in Android.

Yes, if you want to use an emulated tag you should write on it to "send" a data from phone to tag.

mrtj wrote:

Unfortunately, in Android i cannot write to the Tag, since the write command after i opened it as NDEF Tag (android.nfc.tech.Ndef) it crashes with an IOException "tag is not ndef".

Are you sure your Android OS is up to date ?
Could you paste on pastebin (or something like) the debug output trace of nfc-emulate-forum-tag4 example ?

mrtj wrote:

- is this the right way of understanding this example ?

It seems so.

mrtj wrote:

- what is supported as a response from the phone ?

The nfc-emulate-forum-tag4 intents to be a NFC Forum Tag Type 4 emulation implementation.
If the phone is a NFC Forum Tag Type 4 compliant reader, it should work!

mrtj wrote:

- how do actually provide a file for the response from the phone ?

Please read the manpages.

mrtj wrote:

- are there known Timing iusses that make it impossible for the phone to write to the emulated Tag ?

If your device is PN532-based you should not have timing issue.

Romuald Conty

Re: Tag Emulation Response

Hi rconty,

rconty wrote:

By "Message" did you mean NDEF message from phone to the reader ?.

Yes, that would be great.

rconty wrote:

libnfc-llcp is nearly done but you will need to create a LLC's service to handle Android NDEF Push protocol.
BTW, nfcpy should work.

Documentation for usage for libnfc-llcp is as far as i can see quite scarce, i couldnt get Cutter Testing tool and log4c (again both with very little help for usage) for the log messages to work. And i am clueless what you mean by creating that service. I tried to run the llcp-test-server, and it hang somewhere in the initialisation, tracked it down with my own printfs to nfc_target_init.
And in nfcpy i had a strange error regarding an unexpected return value (an array instead of a string ..) in a python library. I suppose i resulted from the missing driver i was not able to install for various other reasons.

I have posted my debug trace on pastebin
nfc-emulate-forum-tag4-debug-trace

rconty wrote:

If the phone is a NFC Forum Tag Type 4 compliant reader, it should work!

I hope the Nexus is good for all NFC Forum Tags. My Android is 2.3.3 ... not sure if the manual update to 2.3.4 is any good.

I had an idea in the meantime, please give me your opion:
Is it maybe that the nfc-emulate-forum-tag4 emulates a tag, but not indefinitely ? Is it tearing the emulation down too fast for my application to connect and write to the tag ? The idea came me when in android i read the cached NDEF Message, and it was the one supposed to be, but when i tried to read the current message, a command actually causing RC activity, it was empty. Or was it cleared by the initial reading ?

P.S: rconty, thanks for all the kindness here, we all appreciate it a lot

Re: Tag Emulation Response

Hello

mrtj wrote:

Documentation for usage for libnfc-llcp is as far as i can see quite scarce

Yes it is.  But keep in mind that the code is under development and that the "public" API is not yet in place (well we have low level functions for transmitting LLC PDUs, but nothing "high-level").  This public API will hopefully has it's sibling man pages at the end. ATM, I am trying to fix LLC disconnections before working on this user-level public API.  Stay tuned!

mrtj wrote:

i couldnt get Cutter Testing tool and log4c (again both with very little help for usage) for the log messages to work.

ATM the log messages are really a plus, so you will definitively need them for hacking.  Note that cutter only provide unit tests so it is not required to have cutter to use the logging feature.  For log4c, once you have the headers / lib available (if your system has different packages for header files double-check they are installed) the autotools should automatically detect and use it (don't forget to run autoreconf again if you where missing the log4c developpment files).  Check the ./configure output to see if the script has been looking for log4c and evetually found it.

And i am clueless what you mean by creating that service. I tried to run the llcp-test-server, and it hang somewhere in the initialisation, tracked it down with my own printfs to nfc_target_init.

Right now there is no convenient API to do so.  I am planning to "port" pynfc's client test application in C in the tools/llcp-test-client directory but for now, the disconnection is not robust enough so I am focussing on this point.  When the client will provide some real tests, you will probably easierly figure-out how to proceed for chatting with another LLC device.

And in nfcpy i had a strange error regarding an unexpected return value (an array instead of a string ..) in a python library.

I got dozens of errors of this kind when testing the libnfc-llcp with the test-client of pynfc.  It seems that error checking is sparce, so instead of reporting the problems as soon as they occured, python fails a few lines later with some unrelated error message.

So to sum-up, for the moment, if you want to see the libnfc-llcp in action, you can try to compile it against log4c and use the test-server with a NFC device and pynfc's test-client with aonther device.  FYI, I work with a SCL3711 and microbuilder's PN532 NFC Breakout Board.  I pluged-in an arygon in place of the microbuilder board and it seems to be okay too.  All the rest is untested :-)