I have a device that uses a PN7150 on a system running Linux to emulate an NDEF card. It needs to be written to and read from a custom Android app.
Using the SWA4325 with "CARDEMU_SUPPORT" defined, the device successfully sends an NDEF record to the phone. However, when the phone comes to write data back to the PN7150, Android raises an exception saying that the tag is not NDEF. See here for the exception:
java.io.IOException: Tag is not ndef
at android.nfc.tech.Ndef.writeNdefMessage(Ndef.java:329)
at uk.co.mitrefinch.dev.nfctest01.MainActivity.write(MainActivity.java:140)
at uk.co.mitrefinch.dev.nfctest01.MainActivity.onNewIntent(MainActivity.java:81)
at android.app.Activity.performNewIntent(Activity.java:7161)
at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1388)
at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1400)
at android.app.ActivityThread.deliverNewIntents(ActivityThread.java:3325)
at android.app.ActivityThread.performNewIntents(ActivityThread.java:3341)
at android.app.ActivityThread.handleNewIntent(ActivityThread.java:3358)
at android.app.servertransaction.NewIntentItem.execute(NewIntentItem.java:49)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1977)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6923)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
So it appears the NDEF emulation isn't working correctly, though Android recognises the tag as being "ndef.type4". I have attached my nfc_task.c and CMake files from the modified SWA4325 files. The snipped from the android app looks like this:
NdefRecord[] records = { NdefRecord.createTextRecord("en", text) };
NdefMessage message = new NdefMessage(records);
// Get an instance of Ndef for the tag.
Ndef ndef = Ndef.get(tag);
// Perform the write
ndef.connect();
ndef.writeNdefMessage(message);
ndef.close();