diff options
author | Ganesh Deva <ganesh.deva_1@nxp.com> | 2018-11-27 20:29:40 +0530 |
---|---|---|
committer | nx35421f <sangeetha.agarwal@nxp.com> | 2018-11-30 15:22:23 +0530 |
commit | ee0da3ac5cb9fd9e6f2e4e3018d911145ea51994 (patch) | |
tree | cc47d4e741a56b2f795fe16db894a700a383c3f7 /src | |
parent | c7451962c0302acd7d58be405c4edfe14c048b98 (diff) | |
download | android_vendor_nxp_opensource_packages_apps_Nfc-ee0da3ac5cb9fd9e6f2e4e3018d911145ea51994.tar.gz android_vendor_nxp_opensource_packages_apps_Nfc-ee0da3ac5cb9fd9e6f2e4e3018d911145ea51994.tar.bz2 android_vendor_nxp_opensource_packages_apps_Nfc-ee0da3ac5cb9fd9e6f2e4e3018d911145ea51994.zip |
MifareDesfireRouteSet and MifareCLTRouteSet api added.
Diffstat (limited to 'src')
-rwxr-xr-x | src/com/android/nfc/NfcService.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java index 8505015d..2a376679 100755 --- a/src/com/android/nfc/NfcService.java +++ b/src/com/android/nfc/NfcService.java @@ -2262,6 +2262,39 @@ public class NfcService implements DeviceHostListener { } @Override + public void MifareDesfireRouteSet(int routeLoc, boolean fullPower, boolean lowPower, boolean noPower) + throws RemoteException + { + if((mChipVer < PN553_ID) && (routeLoc == UICC2_ID_TYPE)) { + throw new RemoteException("UICC2 is not supported"); + } + int protoRouteEntry = 0; + /*UICC2 ID-4(fromApp) mapped to 3 (JNI)*/ + protoRouteEntry=((routeLoc & 0x07) == 0x04) ? (0x03 << ROUTE_LOC_MASK) : /*UICC2*/ + ((routeLoc & 0x07) == 0x02) ? (0x02 << ROUTE_LOC_MASK) : /*UICC1*/ + ((routeLoc & 0x07) == 0x01) ? (0x01 << ROUTE_LOC_MASK) : /*eSE*/ + 0x00; + protoRouteEntry |= ((fullPower ? (mDeviceHost.getDefaultDesfirePowerState() & 0x1F) | 0x01 : 0) | (lowPower ? 0x01 << 1 :0 ) | (noPower ? 0x01 << 2 :0)); + + if(routeLoc == 0x00) + { + /* + bit pos 1 = Power Off + bit pos 2 = Battery Off + bit pos 4 = Screen Off + Set these bits to 0 because in case routeLoc = HOST it can not work on POWER_OFF, BATTERY_OFF and SCREEN_OFF*/ + protoRouteEntry &= 0xE9; + } + + Log.i(TAG,"MifareDesfireRouteSet : " + protoRouteEntry); + mNxpPrefsEditor = mNxpPrefs.edit(); + mNxpPrefsEditor.putInt("PREF_MIFARE_DESFIRE_PROTO_ROUTE_ID", protoRouteEntry); + mNxpPrefsEditor.commit(); + Log.i(TAG,"MifareDesfireRouteSet function in"); + commitRouting(); + } + + @Override public void DefaultRouteSet(int routeLoc, boolean fullPower, boolean lowPower, boolean noPower) throws RemoteException { @@ -2305,6 +2338,29 @@ public class NfcService implements DeviceHostListener { } @Override + public void MifareCLTRouteSet(int routeLoc, boolean fullPower, boolean lowPower, boolean noPower) + throws RemoteException + { + if((mChipVer < PN553_ID) && (routeLoc == UICC2_ID_TYPE)) { + throw new RemoteException("UICC2 is not supported"); + } + + int techRouteEntry=0; + techRouteEntry=((routeLoc & 0x07) == 0x04) ? (0x03 << ROUTE_LOC_MASK) : /*UICC2*/ + ((routeLoc & 0x07) == 0x02) ? (0x02 << ROUTE_LOC_MASK) : /*UICC1*/ + ((routeLoc & 0x07) == 0x01) ? (0x01 << ROUTE_LOC_MASK) : /*eSE*/ + 0x00; + techRouteEntry |= ((fullPower ? (mDeviceHost.getDefaultMifareCLTPowerState() & 0x1F) | 0x01 : 0) | (lowPower ? 0x01 << 1 :0 ) | (noPower ? 0x01 << 2 :0)); + techRouteEntry |= (TECH_TYPE_A << TECH_TYPE_MASK); + + Log.i(TAG,"MifareCLTRouteSet : " + techRouteEntry); + mNxpPrefsEditor = mNxpPrefs.edit(); + mNxpPrefsEditor.putInt("PREF_MIFARE_CLT_ROUTE_ID", techRouteEntry); + mNxpPrefsEditor.commit(); + commitRouting(); + } + + @Override public byte[] getFWVersion() { byte[] buf = new byte[3]; |