Rice University logo
 
Top blue bar image
Just another weblog
 

Overview of NFC Code on Android

From Investigating the patch and the and android source code, we were able to figure out a little bit more about the details concerning NFC on the android.

These files are provided by nxp semiconductors to access the PN544 chip on the Android device. This represents the low level C NFC APIs.

root:
external/libnfc-nxp/src

phHal4Nfc.h
– general API header

phHal4Nfc_Internal.h
– internal structs used in nxp libs to pass around NFC context

phLibNfc_initiator.h
– initate nfc connection
– handle initial authentication protocol

phOsalNfc.h
– operatin system abstraction layer
– abstract away hardware specific components of NFC

phLibNfc_SE.h
– functions to access secure element on phone

phNfcConfig.h
– configure NFC chip

The below line is changed in the patch to enable card emulation

106 /**< Macro to Enable the Card Emulation Feature */
107 -/* #define HOST_EMULATION */
108 +#define HOST_EMULATION

phHal4Nfc_Emulation.c
– emulation libs in android

 

The following files provide the Java Native Interface that bridges the low level C API to the java interface exposed by Android.

Root:
packages/apps/Nfc/jni/

com_android_nfc_NativeNfcManager.cpp
– translate java to c library

Root:
packages/apps/Nfc/jni/src

NativeNfcManager.java
– high level nfc manager that broadcasts intents once an NFC event has been detected

NFCService:
– bridge between the NativeNfcManager and NFC events

Comments are closed.