Update JNI to work with latest stack drop.
Also improved support for Kovio.
Change-Id: If3c7a7a638f9af30b21fd86e4d7609cfb2c35558
diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp
index 14134e5..38aca67 100755
--- a/nci/jni/NativeNfcManager.cpp
+++ b/nci/jni/NativeNfcManager.cpp
@@ -37,7 +37,6 @@
#include "rw_api.h"
#include "nfa_ee_api.h"
#include "nfc_brcm_defs.h"
- #include "nfa_cho_api.h"
#include "ce_api.h"
}
@@ -730,9 +729,7 @@
NFC_SetTraceLevel (num);
RW_SetTraceLevel (num);
NFA_SetTraceLevel (num);
- NFA_ChoSetTraceLevel (num);
NFA_P2pSetTraceLevel (num);
- NFA_SnepSetTraceLevel (num);
sNfaEnableEvent.wait(); //wait for NFA command to finish
}
}
@@ -1698,23 +1695,6 @@
struct nfc_jni_native_data *nat = getNative(0, 0);
tNFA_STATUS stat = NFA_STATUS_FAILED;
- // Enable the "RC workaround" to allow our stack/firmware to work with a retail
- // Nexus S that causes IOP issues. Only enable if value exists and set to 1.
- if (GetNumValue(NAME_USE_NXP_P2P_RC_WORKAROUND, &num, sizeof(num)) && (num == 1))
- {
-#if (NCI_VERSION > NCI_VERSION_20791B0)
- UINT8 nfa_dm_rc_workaround[] = { 0x03, 0x0f, 0xab };
-#else
- UINT8 nfa_dm_rc_workaround[] = { 0x01, 0x0f, 0xab, 0x01 };
-#endif
-
- ALOGD ("%s: Configure RC work-around", __FUNCTION__);
- SyncEventGuard guard (sNfaSetConfigEvent);
- stat = NFA_SetConfig(NCI_PARAM_ID_FW_WORKAROUND, sizeof(nfa_dm_rc_workaround), &nfa_dm_rc_workaround[0]);
- if (stat == NFA_STATUS_OK)
- sNfaSetConfigEvent.wait ();
- }
-
// If polling for Active mode, set the ordering so that we choose Active over Passive mode first.
if (nat && (nat->tech_mask & (NFA_TECHNOLOGY_MASK_A_ACTIVE | NFA_TECHNOLOGY_MASK_F_ACTIVE)))
{
@@ -1724,18 +1704,6 @@
if (stat == NFA_STATUS_OK)
sNfaSetConfigEvent.wait ();
}
-
- // Set antenna tuning configuration if configured.
-#define PREINIT_DSP_CFG_SIZE 30
- UINT8 preinit_dsp_param[PREINIT_DSP_CFG_SIZE];
-
- if (GetStrValue(NAME_PREINIT_DSP_CFG, (char*)&preinit_dsp_param[0], sizeof(preinit_dsp_param)))
- {
- SyncEventGuard guard (sNfaSetConfigEvent);
- stat = NFA_SetConfig(NCI_PARAM_ID_PREINIT_DSP_CFG, sizeof(preinit_dsp_param), &preinit_dsp_param[0]);
- if (stat == NFA_STATUS_OK)
- sNfaSetConfigEvent.wait ();
- }
}
diff --git a/nci/jni/NativeNfcTag.cpp b/nci/jni/NativeNfcTag.cpp
index 3633330..8666668 100755
--- a/nci/jni/NativeNfcTag.cpp
+++ b/nci/jni/NativeNfcTag.cpp
@@ -683,6 +683,13 @@
goto TheEnd;
}
+ // special case for Kovio
+ if (NfcTag::getInstance ().mTechList [0] == TARGET_TYPE_KOVIO_BARCODE)
+ {
+ ALOGD ("%s: fake out reconnect for Kovio", __FUNCTION__);
+ goto TheEnd;
+ }
+
// this is only supported for type 2 or 4 (ISO_DEP) tags
if (natTag.mTechLibNfcTypes[0] == NFA_PROTOCOL_ISO_DEP)
retCode = reSelect(NFA_INTERFACE_ISO_DEP);
@@ -853,7 +860,7 @@
sTransceiveDataLen = 0;
{
SyncEventGuard g (sTransceiveEvent);
- tNFA_STATUS status = NFA_SendRawFrame (buf, bufLen);
+ tNFA_STATUS status = NFA_SendRawFrame (buf, bufLen, NFA_DM_DEFAULT_PRESENCE_CHECK_START_DELAY);
if (status != NFA_STATUS_OK)
{
ALOGE ("%s: fail send; error=%d", __FUNCTION__, status);
@@ -1078,6 +1085,17 @@
return NFA_STATUS_FAILED;
}
+ // special case for Kovio
+ if (NfcTag::getInstance ().mTechList [0] == TARGET_TYPE_KOVIO_BARCODE)
+ {
+ ALOGD ("%s: Kovio tag, no NDEF", __FUNCTION__);
+ ndef = e->GetIntArrayElements (ndefInfo, 0);
+ ndef[0] = 0;
+ ndef[1] = NDEF_MODE_READ_ONLY;
+ e->ReleaseIntArrayElements (ndefInfo, ndef, 0);
+ return NFA_STATUS_FAILED;
+ }
+
/* Create the write semaphore */
if (sem_init (&sCheckNdefSem, 0, 0) == -1)
{
@@ -1215,6 +1233,23 @@
tNFA_STATUS status = NFA_STATUS_OK;
jboolean isPresent = JNI_FALSE;
+ // Special case for Kovio. The deactivation would have already occurred
+ // but was ignored so that normal tag opertions could complete. Now we
+ // want to process as if the deactivate just happened.
+ if (NfcTag::getInstance ().mTechList [0] == TARGET_TYPE_KOVIO_BARCODE)
+ {
+ ALOGD ("%s: Kovio, force deactivate handling", __FUNCTION__);
+ tNFA_DEACTIVATED deactivated = {NFA_DEACTIVATE_TYPE_IDLE};
+
+ NfcTag::getInstance().setDeactivationState (deactivated);
+ nativeNfcTag_resetPresenceCheck();
+ NfcTag::getInstance().connectionEventHandler (NFA_DEACTIVATED_EVT, NULL);
+ nativeNfcTag_abortWaits();
+ NfcTag::getInstance().abort ();
+
+ return JNI_FALSE;
+ }
+
if (nfcManager_isNfcActive() == false)
{
ALOGD ("%s: NFC is no longer active.", __FUNCTION__);
diff --git a/nci/jni/PeerToPeer.h b/nci/jni/PeerToPeer.h
index 3e8ffec..f9c6235 100644
--- a/nci/jni/PeerToPeer.h
+++ b/nci/jni/PeerToPeer.h
@@ -26,7 +26,6 @@
extern "C"
{
#include "nfa_p2p_api.h"
- #include "nfa_snep_api.h"
}
class P2pServer;
@@ -393,19 +392,6 @@
Mutex mDisconnectMutex; // synchronize the disconnect operation
Mutex mNewJniHandleMutex; // synchronize the creation of a new JNI handle
- /*******************************************************************************
- **
- ** Function: snepClientCallback
- **
- ** Description: Receive SNEP-related events from the stack.
- ** snepEvent: Event code.
- ** eventData: Event data.
- **
- ** Returns: None
- **
- *******************************************************************************/
- static void snepClientCallback (tNFA_SNEP_EVT snepEvent, tNFA_SNEP_EVT_DATA *eventData);
-
/*******************************************************************************
**