summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nci/jni/JavaClassConstants.h36
-rw-r--r--nci/jni/Mutex.cpp4
-rw-r--r--nci/jni/NativeLlcpConnectionlessSocket.cpp4
-rw-r--r--nci/jni/NativeLlcpServiceSocket.cpp5
-rw-r--r--nci/jni/NativeLlcpSocket.cpp4
-rwxr-xr-xnci/jni/NativeNfcManager.cpp45
-rwxr-xr-xnci/jni/NativeNfcTag.cpp66
-rw-r--r--nci/jni/NativeP2pDevice.cpp4
-rwxr-xr-xnci/jni/NativeSecureElement.cpp2
-rwxr-xr-xnci/jni/NfcTag.cpp7
-rw-r--r--nci/jni/PeerToPeer.cpp91
-rwxr-xr-xnci/jni/SecureElement.cpp15
-rw-r--r--nci/jni/SyncEvent.h4
13 files changed, 158 insertions, 129 deletions
diff --git a/nci/jni/JavaClassConstants.h b/nci/jni/JavaClassConstants.h
new file mode 100644
index 0000000..fb71757
--- /dev/null
+++ b/nci/jni/JavaClassConstants.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ * Copyright (C) 2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+
+namespace android
+{
+ extern jmethodID gCachedNfcManagerNotifyNdefMessageListeners;
+ extern jmethodID gCachedNfcManagerNotifyTransactionListeners;
+ extern jmethodID gCachedNfcManagerNotifyLlcpLinkActivation;
+ extern jmethodID gCachedNfcManagerNotifyLlcpLinkDeactivated;
+ extern jmethodID gCachedNfcManagerNotifySeFieldActivated;
+ extern jmethodID gCachedNfcManagerNotifySeFieldDeactivated;
+
+ extern const char* gNativeP2pDeviceClassName;
+ extern const char* gNativeLlcpServiceSocketClassName;
+ extern const char* gNativeLlcpConnectionlessSocketClassName;
+ extern const char* gNativeLlcpSocketClassName;
+ extern const char* gNativeNfcTagClassName;
+ extern const char* gNativeNfcManagerClassName;
+ extern const char* gNativeNfcSecureElementClassName;
+}
diff --git a/nci/jni/Mutex.cpp b/nci/jni/Mutex.cpp
index a6b1397..6ccb87b 100644
--- a/nci/jni/Mutex.cpp
+++ b/nci/jni/Mutex.cpp
@@ -85,7 +85,7 @@ void Mutex::unlock ()
int res = pthread_mutex_unlock (&mMutex);
if (res != 0)
{
- ALOGE ("Mutex::lock: fail unlock; error=0x%X", res);
+ ALOGE ("Mutex::unlock: fail unlock; error=0x%X", res);
}
}
@@ -104,7 +104,7 @@ bool Mutex::tryLock ()
int res = pthread_mutex_trylock (&mMutex);
if ((res != 0) && (res != EBUSY))
{
- ALOGE ("Mutex::lock: fail try-lock; error=0x%X", res);
+ ALOGE ("Mutex::tryLock: error=0x%X", res);
}
return res == 0;
}
diff --git a/nci/jni/NativeLlcpConnectionlessSocket.cpp b/nci/jni/NativeLlcpConnectionlessSocket.cpp
index 2c4618f..a278844 100644
--- a/nci/jni/NativeLlcpConnectionlessSocket.cpp
+++ b/nci/jni/NativeLlcpConnectionlessSocket.cpp
@@ -19,6 +19,7 @@
#include <errno.h>
#include "OverrideLog.h"
#include "NfcJniUtil.h"
+#include "JavaClassConstants.h"
extern "C"
{
#include "nfa_api.h"
@@ -30,9 +31,6 @@ namespace android
{
-extern char* gNativeLlcpConnectionlessSocketClassName;
-
-
/*****************************************************************************
**
** private variables and functions
diff --git a/nci/jni/NativeLlcpServiceSocket.cpp b/nci/jni/NativeLlcpServiceSocket.cpp
index 7572690..ac00f61 100644
--- a/nci/jni/NativeLlcpServiceSocket.cpp
+++ b/nci/jni/NativeLlcpServiceSocket.cpp
@@ -19,6 +19,7 @@
#include "NfcJniUtil.h"
#include "NfcAdaptation.h"
#include "PeerToPeer.h"
+#include "JavaClassConstants.h"
extern "C"
{
#include "nfa_api.h"
@@ -30,10 +31,6 @@ namespace android
{
-extern char* gNativeLlcpServiceSocketClassName;
-extern char* gNativeLlcpSocketClassName;
-
-
/*******************************************************************************
**
** Function: nativeLlcpServiceSocket_doAccept
diff --git a/nci/jni/NativeLlcpSocket.cpp b/nci/jni/NativeLlcpSocket.cpp
index f0f0d3d..55a4a76 100644
--- a/nci/jni/NativeLlcpSocket.cpp
+++ b/nci/jni/NativeLlcpSocket.cpp
@@ -16,15 +16,13 @@
*/
#include "OverrideLog.h"
#include "PeerToPeer.h"
+#include "JavaClassConstants.h"
namespace android
{
-extern char* gNativeLlcpSocketClassName;
-
-
/*******************************************************************************
**
** Function: nativeLlcpSocket_doConnect
diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp
index 9adeed3..20bdd96 100755
--- a/nci/jni/NativeNfcManager.cpp
+++ b/nci/jni/NativeNfcManager.cpp
@@ -26,6 +26,7 @@
#include "NfcTag.h"
#include "config.h"
#include "PowerSwitch.h"
+#include "JavaClassConstants.h"
extern "C"
{
@@ -625,6 +626,7 @@ void nfaDeviceManagementCallback (UINT8 dmEvent, tNFA_DM_CBACK_DATA* eventData)
ALOGE("BCM2079x NFC FW version %d.%d", bldInfo->patch.major_ver,
bldInfo->patch.minor_ver);
}
+ SyncEventGuard versionGuard (sNfaBuildInfoEvent);
sNfaBuildInfoEvent.notifyOne();
}
break;
@@ -666,26 +668,30 @@ static jboolean nfcManager_doInitialize (JNIEnv* e, jobject o)
NfcAdaptation& theInstance = NfcAdaptation::GetInstance();
theInstance.Initialize(); //start GKI, NCI task, NFC task
- SyncEventGuard guard (sNfaEnableEvent);
+ {
+ SyncEventGuard guard (sNfaEnableEvent);
+ NFA_Init();
+ NFA_BrcmInit (&devInitConfig, nfaBrcmInitCallback);
- NFA_Init();
- NFA_BrcmInit (&devInitConfig, nfaBrcmInitCallback);
+ stat = NFA_Enable (nfaDeviceManagementCallback, nfaConnectionCallback);
+ if (stat == NFA_STATUS_OK)
+ {
+ num = initializeGlobalAppLogLevel ();
+ CE_SetTraceLevel (num);
+ LLCP_SetTraceLevel (num);
+ NFC_SetTraceLevel (num);
+ NCI_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
+ }
+ }
- stat = NFA_Enable (nfaDeviceManagementCallback, nfaConnectionCallback);
if (stat == NFA_STATUS_OK)
{
- num = initializeGlobalAppLogLevel ();
- CE_SetTraceLevel (num);
- LLCP_SetTraceLevel (num);
- NFC_SetTraceLevel (num);
- NCI_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
-
//sIsNfaEnabled indicates whether stack started successfully
if (sIsNfaEnabled)
{
@@ -790,10 +796,10 @@ static void nfcManager_enableDiscovery (JNIEnv* e, jobject o)
stat = NFA_EnablePolling (tech_mask);
if (stat == NFA_STATUS_OK)
{
- ALOGD ("%s: Waiting for sNfaEnableDisablePollingEvent", __FUNCTION__);
+ ALOGD ("%s: wait for enable event", __FUNCTION__);
sDiscoveryEnabled = true;
sNfaEnableDisablePollingEvent.wait (); //wait for NFA_POLL_START_EVT
- ALOGD ("%s: Finished Waiting for sNfaEnableDisablePollingEvent", __FUNCTION__);
+ ALOGD ("%s: got enabled event", __FUNCTION__);
}
else
{
@@ -1592,11 +1598,10 @@ int register_com_android_nfc_NativeNfcManager (JNIEnv *e)
*******************************************************************************/
void startRfDiscovery(bool isStart)
{
- SyncEventGuard guard (sNfaEnableDisablePollingEvent);
tNFA_STATUS status = NFA_STATUS_FAILED;
ALOGD ("%s: is start=%d", __FUNCTION__, isStart);
-
+ SyncEventGuard guard (sNfaEnableDisablePollingEvent);
status = isStart ? NFA_StartRfDiscovery () : NFA_StopRfDiscovery ();
if (status == NFA_STATUS_OK)
{
diff --git a/nci/jni/NativeNfcTag.cpp b/nci/jni/NativeNfcTag.cpp
index 25b9826..a4d2ec7 100755
--- a/nci/jni/NativeNfcTag.cpp
+++ b/nci/jni/NativeNfcTag.cpp
@@ -25,6 +25,7 @@
#include "config.h"
#include "Mutex.h"
#include "IntervalTimer.h"
+#include "JavaClassConstants.h"
extern "C"
{
@@ -36,7 +37,6 @@ extern "C"
namespace android
{
extern nfc_jni_native_data* getNative(JNIEnv *e, jobject o);
- extern char* gNativeNfcTagClassName;
extern bool nfcManager_isNfcActive();
extern int gGeneralTransceiveTimeout;
}
@@ -173,7 +173,6 @@ static void switchBackTimerProc (union sigval)
** Returns: None
**
*******************************************************************************/
-//called by NFA_READ_CPLT_EVT when NDEF message has been completely read
void nativeNfcTag_doReadCompleted (tNFA_STATUS status)
{
ALOGD ("%s: status=0x%X; is reading=%u", __FUNCTION__, status, sIsReadingNdefMessage);
@@ -260,10 +259,12 @@ static jbyteArray nativeNfcTag_doRead (JNIEnv *e, jobject o)
if (sCheckNdefCurrentSize > 0)
{
- SyncEventGuard g (sReadEvent);
- sIsReadingNdefMessage = true;
- status = NFA_RwReadNDef ();
- sReadEvent.wait (); //wait for NFA_READ_CPLT_EVT
+ {
+ SyncEventGuard g (sReadEvent);
+ sIsReadingNdefMessage = true;
+ status = NFA_RwReadNDef ();
+ sReadEvent.wait (); //wait for NFA_READ_CPLT_EVT
+ }
sIsReadingNdefMessage = false;
if (sReadDataLen > 0) //if stack actually read data from the tag
@@ -539,18 +540,20 @@ static int reSelect (tNFA_INTF_TYPE rfInterface)
do
{
- SyncEventGuard g (sReconnectEvent);
- gIsTagDeactivating = true;
- sGotDeactivate = false;
- if (NFA_STATUS_OK != (status = NFA_Deactivate (TRUE)))
{
- ALOGE ("%s: NFA_Deactivate failed, status = %d", __FUNCTION__, status);
- break;
- }
+ SyncEventGuard g (sReconnectEvent);
+ gIsTagDeactivating = true;
+ sGotDeactivate = false;
+ if (NFA_STATUS_OK != (status = NFA_Deactivate (TRUE)))
+ {
+ ALOGE ("%s: NFA_Deactivate failed, status = %d", __FUNCTION__, status);
+ break;
+ }
- if (sReconnectEvent.wait (1000) == false) //if timeout occured
- {
- ALOGE ("%s: timeout waiting for deactivate", __FUNCTION__);
+ if (sReconnectEvent.wait (1000) == false) //if timeout occurred
+ {
+ ALOGE ("%s: timeout waiting for deactivate", __FUNCTION__);
+ }
}
if (! NfcTag::getInstance ().isActivated ())
@@ -561,23 +564,26 @@ static int reSelect (tNFA_INTF_TYPE rfInterface)
gIsTagDeactivating = false;
- SyncEventGuard g2 (sReconnectEvent);
-
- sConnectWaitingForComplete = JNI_TRUE;
- ALOGD ("%s: NFA_Select()", __FUNCTION__);
- gIsSelectingRfInterface = true;
- if (NFA_STATUS_OK != (status = NFA_Select (natTag.mTechHandles[0], natTag.mTechLibNfcTypes[0], rfInterface)))
{
- ALOGE ("%s: NFA_Select failed, status = %d", __FUNCTION__, status);
- break;
- }
+ SyncEventGuard g2 (sReconnectEvent);
- sConnectOk = false;
- if (sReconnectEvent.wait (1000) == false) //if timeout occured
- {
- ALOGE ("%s: wait response timeout", __FUNCTION__);
- break;
+ sConnectWaitingForComplete = JNI_TRUE;
+ ALOGD ("%s: NFA_Select()", __FUNCTION__);
+ gIsSelectingRfInterface = true;
+ if (NFA_STATUS_OK != (status = NFA_Select (natTag.mTechHandles[0], natTag.mTechLibNfcTypes[0], rfInterface)))
+ {
+ ALOGE ("%s: NFA_Select failed, status = %d", __FUNCTION__, status);
+ break;
+ }
+
+ sConnectOk = false;
+ if (sReconnectEvent.wait (1000) == false) //if timeout occured
+ {
+ ALOGE ("%s: wait response timeout", __FUNCTION__);
+ break;
+ }
}
+
ALOGD("%s: done waiting on NFA_Select() sConnectOk=%d", __FUNCTION__, sConnectOk);
if (! NfcTag::getInstance ().isActivated ())
{
diff --git a/nci/jni/NativeP2pDevice.cpp b/nci/jni/NativeP2pDevice.cpp
index 2f06b96..216edb1 100644
--- a/nci/jni/NativeP2pDevice.cpp
+++ b/nci/jni/NativeP2pDevice.cpp
@@ -17,15 +17,13 @@
#include "OverrideLog.h"
#include "NfcJniUtil.h"
+#include "JavaClassConstants.h"
namespace android
{
-extern char* gNativeP2pDeviceClassName;
-
-
static jboolean nativeP2pDeviceDoConnect (JNIEnv* e, jobject o)
{
ALOGD ("%s", __FUNCTION__);
diff --git a/nci/jni/NativeSecureElement.cpp b/nci/jni/NativeSecureElement.cpp
index 55bece8..7054b26 100755
--- a/nci/jni/NativeSecureElement.cpp
+++ b/nci/jni/NativeSecureElement.cpp
@@ -16,6 +16,7 @@
*/
#include "OverrideLog.h"
#include "SecureElement.h"
+#include "JavaClassConstants.h"
#include "nfa_brcm_api.h"
@@ -25,7 +26,6 @@ namespace android
extern void com_android_nfc_NfcManager_disableDiscovery (JNIEnv* e, jobject o);
extern void com_android_nfc_NfcManager_enableDiscovery (JNIEnv* e, jobject o, jint mode);
-extern char* gNativeNfcSecureElementClassName;
extern int gGeneralTransceiveTimeout;
diff --git a/nci/jni/NfcTag.cpp b/nci/jni/NfcTag.cpp
index 9d629a2..35df2f0 100755
--- a/nci/jni/NfcTag.cpp
+++ b/nci/jni/NfcTag.cpp
@@ -10,18 +10,13 @@
*****************************************************************************/
#include "OverrideLog.h"
#include "NfcTag.h"
+#include "JavaClassConstants.h"
extern "C"
{
#include "rw_int.h"
}
-namespace android
-{
- extern jmethodID gCachedNfcManagerNotifyNdefMessageListeners;
-}
-
-
/*******************************************************************************
**
** Function: NfcTag
diff --git a/nci/jni/PeerToPeer.cpp b/nci/jni/PeerToPeer.cpp
index 3c46a02..56174d5 100644
--- a/nci/jni/PeerToPeer.cpp
+++ b/nci/jni/PeerToPeer.cpp
@@ -13,11 +13,10 @@
#include "NfcJniUtil.h"
#include "llcp_defs.h"
#include "config.h"
+#include "JavaClassConstants.h"
namespace android
{
- extern jmethodID gCachedNfcManagerNotifyLlcpLinkActivation;
- extern jmethodID gCachedNfcManagerNotifyLlcpLinkDeactivated;
extern void nativeNfcTag_registerNdefTypeHandler ();
extern void nativeNfcTag_deregisterNdefTypeHandler ();
}
@@ -257,17 +256,19 @@ bool PeerToPeer::registerServer (tBRCM_JNI_HANDLE jniHandle, const char *service
if (sSnepServiceName.compare(serviceName) == 0)
serverSap = LLCP_SAP_SNEP; //LLCP_SAP_SNEP == 4
- SyncEventGuard guard (pSrv->mRegServerEvent);
- stat = NFA_P2pRegisterServer (serverSap, NFA_P2P_DLINK_TYPE, const_cast<char*>(serviceName), nfaServerCallback);
- if (stat != NFA_STATUS_OK)
{
- ALOGE ("%s: fail register p2p server; error=0x%X", fn, stat);
- removeServer (jniHandle);
- return (false);
+ SyncEventGuard guard (pSrv->mRegServerEvent);
+ stat = NFA_P2pRegisterServer (serverSap, NFA_P2P_DLINK_TYPE, const_cast<char*>(serviceName), nfaServerCallback);
+ if (stat != NFA_STATUS_OK)
+ {
+ ALOGE ("%s: fail register p2p server; error=0x%X", fn, stat);
+ removeServer (jniHandle);
+ return (false);
+ }
+ ALOGD ("%s: wait for listen-completion event", fn);
+ // Wait for NFA_P2P_REG_SERVER_EVT
+ pSrv->mRegServerEvent.wait ();
}
- ALOGD ("%s: wait for listen-completion event", fn);
- // Wait for NFA_P2P_REG_SERVER_EVT
- pSrv->mRegServerEvent.wait ();
if (pSrv->mNfaP2pServerHandle == NFA_HANDLE_INVALID)
{
@@ -567,9 +568,11 @@ bool PeerToPeer::deregisterServer (tBRCM_JNI_HANDLE jniHandle)
return (false);
}
- // Server does not call NFA_P2pDisconnect(), so unblock the accept()
- SyncEventGuard guard (pSrv->mConnRequestEvent);
- pSrv->mConnRequestEvent.notifyOne();
+ {
+ // Server does not call NFA_P2pDisconnect(), so unblock the accept()
+ SyncEventGuard guard (pSrv->mConnRequestEvent);
+ pSrv->mConnRequestEvent.notifyOne();
+ }
nfaStat = NFA_P2pDeregister (pSrv->mNfaP2pServerHandle);
if (nfaStat != NFA_STATUS_OK)
@@ -741,19 +744,20 @@ bool PeerToPeer::connectConnOriented (tBRCM_JNI_HANDLE jniHandle, const char* se
// Save JNI Handle and try to connect to SNEP
mJniHandleSendingNppViaSnep = jniHandle;
-
- if (NFA_SnepConnect (mSnepRegHandle, const_cast<char*>("urn:nfc:sn:snep")) == NFA_STATUS_OK)
{
SyncEventGuard guard (pClient->mSnepEvent);
- pClient->mSnepEvent.wait();
-
- // If the connect attempt failed, connection handle is invalid
- if (pClient->mSnepConnHandle != NFA_HANDLE_INVALID)
+ if (NFA_SnepConnect (mSnepRegHandle, const_cast<char*>("urn:nfc:sn:snep")) == NFA_STATUS_OK)
{
- // return true, as if we were connected.
- pClient->mClientConn.mRemoteMaxInfoUnit = 248;
- pClient->mClientConn.mRemoteRecvWindow = 1;
- return (true);
+ pClient->mSnepEvent.wait();
+
+ // If the connect attempt failed, connection handle is invalid
+ if (pClient->mSnepConnHandle != NFA_HANDLE_INVALID)
+ {
+ // return true, as if we were connected.
+ pClient->mClientConn.mRemoteMaxInfoUnit = 248;
+ pClient->mClientConn.mRemoteRecvWindow = 1;
+ return (true);
+ }
}
}
mJniHandleSendingNppViaSnep = 0;
@@ -812,22 +816,26 @@ bool PeerToPeer::createDataLinkConn (tBRCM_JNI_HANDLE jniHandle, const char* ser
return (false);
}
- SyncEventGuard guard (pClient->mConnectingEvent);
- pClient->mIsConnecting = true;
-
- if (serviceName)
- nfaStat = NFA_P2pConnectByName (pClient->mNfaP2pClientHandle,
- const_cast<char*>(serviceName), pClient->mClientConn.mMaxInfoUnit,
- pClient->mClientConn.mRecvWindow);
- else if (destinationSap)
- nfaStat = NFA_P2pConnectBySap (pClient->mNfaP2pClientHandle, destinationSap,
- pClient->mClientConn.mMaxInfoUnit, pClient->mClientConn.mRecvWindow);
+ {
+ SyncEventGuard guard (pClient->mConnectingEvent);
+ pClient->mIsConnecting = true;
+
+ if (serviceName)
+ nfaStat = NFA_P2pConnectByName (pClient->mNfaP2pClientHandle,
+ const_cast<char*>(serviceName), pClient->mClientConn.mMaxInfoUnit,
+ pClient->mClientConn.mRecvWindow);
+ else if (destinationSap)
+ nfaStat = NFA_P2pConnectBySap (pClient->mNfaP2pClientHandle, destinationSap,
+ pClient->mClientConn.mMaxInfoUnit, pClient->mClientConn.mRecvWindow);
+ if (nfaStat == NFA_STATUS_OK)
+ {
+ ALOGD ("%s: wait for connected event mConnectingEvent: 0x%p", fn, pClient);
+ pClient->mConnectingEvent.wait();
+ }
+ }
if (nfaStat == NFA_STATUS_OK)
{
- ALOGD ("%s: wait for connected event mConnectingEvent: 0x%p", fn, pClient);
- pClient->mConnectingEvent.wait();
-
if (pClient->mClientConn.mNfaConnHandle == NFA_HANDLE_INVALID)
{
removeConn (jniHandle);
@@ -1109,6 +1117,7 @@ bool PeerToPeer::sendViaSnep (tBRCM_JNI_HANDLE jniHandle, UINT8 *buffer, UINT16
{
ALOGD ("%s GKI_poolcount(2): %u GKI_poolfreecount(2): %u", fn, GKI_poolcount(2), GKI_poolfreecount(2));
+ SyncEventGuard guard (pClient->mSnepEvent);
nfaStat = NFA_SnepPut (pClient->mSnepConnHandle, pClient->mSnepNdefBufLen, pClient->mSnepNdefBuf);
if (nfaStat != NFA_STATUS_OK)
@@ -1119,8 +1128,6 @@ bool PeerToPeer::sendViaSnep (tBRCM_JNI_HANDLE jniHandle, UINT8 *buffer, UINT16
pClient->mSnepNdefBuf = NULL;
return (false);
}
-
- SyncEventGuard guard (pClient->mSnepEvent);
pClient->mSnepEvent.wait ();
free (pClient->mSnepNdefBuf);
@@ -1168,6 +1175,7 @@ bool PeerToPeer::receive (tBRCM_JNI_HANDLE jniHandle, UINT8* buffer, UINT16 buff
while (pConn->mNfaConnHandle != NFA_HANDLE_INVALID)
{
+ //NFA_P2pReadData() is synchronous
stat = NFA_P2pReadData (pConn->mNfaConnHandle, bufferLen, &actualDataLen2, buffer, &isMoreData);
if ((stat == NFA_STATUS_OK) && (actualDataLen2 > 0)) //received some data
{
@@ -1831,8 +1839,8 @@ void PeerToPeer::snepClientCallback (tNFA_SNEP_EVT snepEvent, tNFA_SNEP_EVT_DATA
{
ALOGD ("%s NFA_SNEP_CONNECTED_EVT mJniHandleSendingNppViaSnep: %u ConnHandle: 0x%04x", fn, sP2p.mJniHandleSendingNppViaSnep, eventData->connect.conn_handle);
- pClient->mSnepConnHandle = eventData->connect.conn_handle;
SyncEventGuard guard (pClient->mSnepEvent);
+ pClient->mSnepConnHandle = eventData->connect.conn_handle;
pClient->mSnepEvent.notifyOne();
}
break;
@@ -1863,9 +1871,8 @@ void PeerToPeer::snepClientCallback (tNFA_SNEP_EVT snepEvent, tNFA_SNEP_EVT_DATA
else
{
ALOGD ("%s NFA_SNEP_DISC_EVT mJniHandleSendingNppViaSnep: %u", fn, sP2p.mJniHandleSendingNppViaSnep);
- pClient->mSnepConnHandle = NFA_HANDLE_INVALID;
-
SyncEventGuard guard (pClient->mSnepEvent);
+ pClient->mSnepConnHandle = NFA_HANDLE_INVALID;
pClient->mSnepEvent.notifyOne();
}
break;
diff --git a/nci/jni/SecureElement.cpp b/nci/jni/SecureElement.cpp
index 76955f8..8847db7 100755
--- a/nci/jni/SecureElement.cpp
+++ b/nci/jni/SecureElement.cpp
@@ -17,14 +17,7 @@
#include "PowerSwitch.h"
#include "HostAidRouter.h"
#include "nfa_vs_brcm_api.h"
-
-
-namespace android
-{
- extern jmethodID gCachedNfcManagerNotifyTransactionListeners;
- extern jmethodID gCachedNfcManagerNotifySeFieldActivated;
- extern jmethodID gCachedNfcManagerNotifySeFieldDeactivated;
-}
+#include "JavaClassConstants.h"
/*****************************************************************************
@@ -190,7 +183,7 @@ bool SecureElement::initialize (nfc_jni_native_data* native)
SyncEventGuard guard (mHciRegisterEvent);
- nfaStat = NFA_HciRegister ("brcm_jni", nfaHciCallback, TRUE);
+ nfaStat = NFA_HciRegister (const_cast<char*>("brcm_jni"), nfaHciCallback, TRUE);
if (nfaStat != NFA_STATUS_OK)
{
ALOGE ("%s: fail hci register; error=0x%X", fn, nfaStat);
@@ -229,7 +222,7 @@ void SecureElement::finalize ()
NFA_EeDeregister (nfaEeCallback);
if (mNfaHciHandle != NFA_HANDLE_INVALID)
- NFA_HciDeregister ("brcm_jni");
+ NFA_HciDeregister (const_cast<char*>("brcm_jni"));
mNfaHciHandle = NFA_HANDLE_INVALID;
mNativeData = NULL;
@@ -1681,11 +1674,11 @@ void SecureElement::nfaHciCallback (tNFA_HCI_EVT event, tNFA_HCI_EVT_DATA* event
eventData->registry.status, eventData->registry.pipe, eventData->registry.data_len);
if (eventData->registry.data_len >= 19 && ((eventData->registry.pipe == STATIC_PIPE_0x70) || (eventData->registry.pipe == STATIC_PIPE_0x71)))
{
+ SyncEventGuard guard (sSecElem.mVerInfoEvent);
// Oberthur OS version is in bytes 16,17, and 18
sSecElem.mVerInfo[0] = eventData->registry.reg_data[16];
sSecElem.mVerInfo[1] = eventData->registry.reg_data[17];
sSecElem.mVerInfo[2] = eventData->registry.reg_data[18];
- SyncEventGuard guard (sSecElem.mVerInfoEvent);
sSecElem.mVerInfoEvent.notifyOne ();
}
break;
diff --git a/nci/jni/SyncEvent.h b/nci/jni/SyncEvent.h
index 5ab5d43..146b3ce 100644
--- a/nci/jni/SyncEvent.h
+++ b/nci/jni/SyncEvent.h
@@ -28,7 +28,6 @@ public:
*******************************************************************************/
~SyncEvent ()
{
- mMutex.unlock ();
}
@@ -59,7 +58,6 @@ public:
void wait ()
{
mCondVar.wait (mMutex);
- end ();
}
@@ -76,7 +74,6 @@ public:
bool wait (long millisec)
{
bool retVal = mCondVar.wait (mMutex, millisec);
- end ();
return retVal;
}
@@ -93,7 +90,6 @@ public:
void notifyOne ()
{
mCondVar.notifyOne ();
- end ();
}