summaryrefslogtreecommitdiffstats
path: root/jni/com_android_nfc_NativeNfcSecureElement.cpp
diff options
context:
space:
mode:
authorMartijn Coenen <martijn.coenen@nxp.com>2010-11-24 17:12:51 +0100
committerMartijn Coenen <martijn.coenen@nxp.com>2010-11-25 10:47:00 +0100
commit6d11530887a3e6f30fa21d01bc0de5cdbd0218ea (patch)
treec544abccb3f9c610f0e60a2bc07a62234de604ba /jni/com_android_nfc_NativeNfcSecureElement.cpp
parent20a7a37f5e021d576342365151a1b221a39565ae (diff)
downloadpackages_apps_nfc-6d11530887a3e6f30fa21d01bc0de5cdbd0218ea.zip
packages_apps_nfc-6d11530887a3e6f30fa21d01bc0de5cdbd0218ea.tar.gz
packages_apps_nfc-6d11530887a3e6f30fa21d01bc0de5cdbd0218ea.tar.bz2
Initial support for technology tree based on libnfc return type.
Based on the tag return type from libnfc, we return a proper technology tree. Also fixed transceive to depend properly on the tech tree. Change-Id: I946577692c3a71602d88c2b6416c94154d2d434f
Diffstat (limited to 'jni/com_android_nfc_NativeNfcSecureElement.cpp')
-rwxr-xr-xjni/com_android_nfc_NativeNfcSecureElement.cpp41
1 files changed, 29 insertions, 12 deletions
diff --git a/jni/com_android_nfc_NativeNfcSecureElement.cpp b/jni/com_android_nfc_NativeNfcSecureElement.cpp
index ca000c2..345c402 100755
--- a/jni/com_android_nfc_NativeNfcSecureElement.cpp
+++ b/jni/com_android_nfc_NativeNfcSecureElement.cpp
@@ -106,7 +106,7 @@ static void com_android_nfc_jni_open_secure_element_notification_callback(void *
uint8_t uNofRemoteDev,
NFCSTATUS status)
{
- JNIEnv *e;
+ JNIEnv *e = (JNIEnv *)pContext;
NFCSTATUS ret;
int i;
@@ -127,13 +127,22 @@ static void com_android_nfc_jni_open_secure_element_notification_callback(void *
secureElementHandle = psRemoteDevList[1].hTargetDev;
/* Set type name */
- SecureElementTech = get_technology_type(psRemoteDevList[1].psRemoteDevInfo->RemDevType,
+ jintArray techTree = nfc_jni_get_technology_tree(e, psRemoteDevList[1].psRemoteDevInfo->RemDevType,
psRemoteDevList[1].psRemoteDevInfo->RemoteDevInfo.Iso14443A_Info.Sak);
+ // TODO: Should use the "connected" technology, for now use the first
+ if (e->GetArrayLength(techTree) > 0) {
+ jint* technologies = e->GetIntArrayElements(techTree, 0);
+ SecureElementTech = technologies[0];
+ LOGD("Store Secure Element Info\n");
+ SecureElementInfo = psRemoteDevList->psRemoteDevInfo;
+
+ LOGD("Discovered secure element: tech=%d", SecureElementTech);
+ }
+ else {
+ LOGE("Discovered secure element, but could not resolve tech");
+ status = NFCSTATUS_FAILED;
+ }
- LOGD("Store Secure Element Info\n");
- SecureElementInfo = psRemoteDevList->psRemoteDevInfo;
-
- LOGD("Discovered secure element: tech=%d", SecureElementTech);
}
else
{
@@ -141,13 +150,21 @@ static void com_android_nfc_jni_open_secure_element_notification_callback(void *
secureElementHandle = psRemoteDevList->hTargetDev;
/* Set type name */
- SecureElementTech = get_technology_type(psRemoteDevList->psRemoteDevInfo->RemDevType,
+ jintArray techTree = nfc_jni_get_technology_tree(e, psRemoteDevList->psRemoteDevInfo->RemDevType,
psRemoteDevList->psRemoteDevInfo->RemoteDevInfo.Iso14443A_Info.Sak);
-
- LOGD("Store Secure Element Info\n");
- SecureElementInfo = psRemoteDevList->psRemoteDevInfo;
-
- LOGD("Discovered secure element: tech=%d", SecureElementTech);
+ // TODO: Should use the "connected" technology, for now use the first
+ if ((techTree != NULL) && e->GetArrayLength(techTree) > 0) {
+ jint* technologies = e->GetIntArrayElements(techTree, 0);
+ SecureElementTech = technologies[0];
+ LOGD("Store Secure Element Info\n");
+ SecureElementInfo = psRemoteDevList->psRemoteDevInfo;
+
+ LOGD("Discovered secure element: tech=%d", SecureElementTech);
+ }
+ else {
+ LOGE("Discovered secure element, but could not resolve tech");
+ status = NFCSTATUS_FAILED;
+ }
}
}