summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Chu <evanchu@broadcom.com>2012-08-13 16:52:44 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-08-13 16:52:44 -0700
commite4e35b706b37e67b3f15af13f19eae5c9aa1a41f (patch)
tree8547872ced21e56dc526775e1500df50da7ee7ab
parent38a306e1c5e5cbe7dfc896843bc9681c12e4d7f2 (diff)
parent5c7b8d9beeb46cba30bffaf94945ef6fc55e8a76 (diff)
downloadpackages_apps_nfc-e4e35b706b37e67b3f15af13f19eae5c9aa1a41f.zip
packages_apps_nfc-e4e35b706b37e67b3f15af13f19eae5c9aa1a41f.tar.gz
packages_apps_nfc-e4e35b706b37e67b3f15af13f19eae5c9aa1a41f.tar.bz2
am 5c7b8d9b: Remove whitespace from NFC NCI JNI.
* commit '5c7b8d9beeb46cba30bffaf94945ef6fc55e8a76': Remove whitespace from NFC NCI JNI.
-rw-r--r--nci/jni/Android.mk3
-rw-r--r--nci/jni/CondVar.cpp14
-rw-r--r--nci/jni/CondVar.h12
-rw-r--r--nci/jni/DataQueue.cpp32
-rw-r--r--nci/jni/DataQueue.h28
-rw-r--r--nci/jni/HostAidRouter.cpp1
-rw-r--r--nci/jni/IntervalTimer.cpp6
-rw-r--r--nci/jni/IntervalTimer.h2
-rw-r--r--nci/jni/Mutex.cpp22
-rw-r--r--nci/jni/Mutex.h42
-rw-r--r--nci/jni/NativeLlcpConnectionlessSocket.cpp21
-rw-r--r--nci/jni/NativeLlcpServiceSocket.cpp9
-rw-r--r--nci/jni/NativeLlcpSocket.cpp28
-rwxr-xr-xnci/jni/NativeNfcManager.cpp148
-rwxr-xr-xnci/jni/NativeNfcTag.cpp117
-rw-r--r--nci/jni/NativeP2pDevice.cpp5
-rwxr-xr-xnci/jni/NativeSecureElement.cpp20
-rwxr-xr-xnci/jni/NfcJniUtil.cpp18
-rwxr-xr-xnci/jni/NfcJniUtil.h14
-rwxr-xr-xnci/jni/NfcTag.cpp50
-rwxr-xr-xnci/jni/NfcTag.h36
-rw-r--r--nci/jni/PeerToPeer.cpp187
-rw-r--r--nci/jni/PeerToPeer.h177
-rwxr-xr-xnci/jni/PowerSwitch.cpp53
-rwxr-xr-xnci/jni/PowerSwitch.h64
-rw-r--r--nci/jni/RouteDataSet.cpp30
-rw-r--r--nci/jni/RouteDataSet.h36
-rwxr-xr-xnci/jni/SecureElement.cpp175
-rwxr-xr-xnci/jni/SecureElement.h102
-rw-r--r--nci/jni/SyncEvent.h66
30 files changed, 746 insertions, 772 deletions
diff --git a/nci/jni/Android.mk b/nci/jni/Android.mk
index cdcd34e..335e5f1 100644
--- a/nci/jni/Android.mk
+++ b/nci/jni/Android.mk
@@ -41,10 +41,11 @@ LOCAL_SHARED_LIBRARIES := \
libutils \
libnfc-nci \
libstlport
-
+
LOCAL_STATIC_LIBRARIES := libxml2
LOCAL_MODULE := libnfc_nci_jni
LOCAL_MODULE_TAGS := optional
include $(BUILD_SHARED_LIBRARY)
+
diff --git a/nci/jni/CondVar.cpp b/nci/jni/CondVar.cpp
index cb67825..1156344 100644
--- a/nci/jni/CondVar.cpp
+++ b/nci/jni/CondVar.cpp
@@ -19,7 +19,7 @@
** Function: CondVar
**
** Description: Initialize member variables.
-**
+**
** Returns: None.
**
*******************************************************************************/
@@ -39,7 +39,7 @@ CondVar::CondVar ()
** Function: ~CondVar
**
** Description: Cleanup all resources.
-**
+**
** Returns: None.
**
*******************************************************************************/
@@ -58,13 +58,13 @@ CondVar::~CondVar ()
** Function: wait
**
** Description: Block the caller and wait for a condition.
-**
+**
** Returns: None.
**
*******************************************************************************/
void CondVar::wait (Mutex& mutex)
{
- int const res = pthread_cond_wait (&mCondition, mutex.nativeHandle());
+ int const res = pthread_cond_wait (&mCondition, mutex.nativeHandle());
if (res)
{
ALOGE ("CondVar::wait: fail wait; error=0x%X", res);
@@ -78,7 +78,7 @@ void CondVar::wait (Mutex& mutex)
**
** Description: Block the caller and wait for a condition.
** millisec: Timeout in milliseconds.
-**
+**
** Returns: True if wait is successful; false if timeout occurs.
**
*******************************************************************************/
@@ -103,7 +103,7 @@ bool CondVar::wait (Mutex& mutex, long millisec)
else
absoluteTime.tv_nsec = ns;
}
-
+
//pthread_cond_timedwait_monotonic_np() is an Android-specific function
//declared in /development/ndk/platforms/android-9/include/pthread.h;
//it uses monotonic clock.
@@ -121,7 +121,7 @@ bool CondVar::wait (Mutex& mutex, long millisec)
** Function: notifyOne
**
** Description: Unblock the waiting thread.
-**
+**
** Returns: None.
**
*******************************************************************************/
diff --git a/nci/jni/CondVar.h b/nci/jni/CondVar.h
index bfe4dfb..eca17aa 100644
--- a/nci/jni/CondVar.h
+++ b/nci/jni/CondVar.h
@@ -22,7 +22,7 @@ public:
** Function: CondVar
**
** Description: Initialize member variables.
- **
+ **
** Returns: None.
**
*******************************************************************************/
@@ -34,7 +34,7 @@ public:
** Function: ~CondVar
**
** Description: Cleanup all resources.
- **
+ **
** Returns: None.
**
*******************************************************************************/
@@ -46,7 +46,7 @@ public:
** Function: wait
**
** Description: Block the caller and wait for a condition.
- **
+ **
** Returns: None.
**
*******************************************************************************/
@@ -59,7 +59,7 @@ public:
**
** Description: Block the caller and wait for a condition.
** millisec: Timeout in milliseconds.
- **
+ **
** Returns: True if wait is successful; false if timeout occurs.
**
*******************************************************************************/
@@ -71,12 +71,12 @@ public:
** Function: notifyOne
**
** Description: Unblock the waiting thread.
- **
+ **
** Returns: None.
**
*******************************************************************************/
void notifyOne ();
-
+
private:
pthread_cond_t mCondition;
}; \ No newline at end of file
diff --git a/nci/jni/DataQueue.cpp b/nci/jni/DataQueue.cpp
index 2b07c7e..ab94734 100644
--- a/nci/jni/DataQueue.cpp
+++ b/nci/jni/DataQueue.cpp
@@ -14,10 +14,10 @@
/*******************************************************************************
**
-** Function: DataQueue
+** Function: DataQueue
+**
+** Description: Initialize member variables.
**
-** Description: Initialize member variables.
-**
** Returns: None.
**
*******************************************************************************/
@@ -28,10 +28,10 @@ DataQueue::DataQueue ()
/*******************************************************************************
**
-** Function: ~DataQueue
+** Function: ~DataQueue
+**
+** Description: Release all resources.
**
-** Description: Release all resources.
-**
** Returns: None.
**
*******************************************************************************/
@@ -48,8 +48,8 @@ DataQueue::~DataQueue ()
}
-bool DataQueue::isEmpty()
-{
+bool DataQueue::isEmpty()
+{
mMutex.lock ();
bool retval = mQueue.empty();
mMutex.unlock ();
@@ -59,12 +59,12 @@ bool DataQueue::isEmpty()
/*******************************************************************************
**
-** Function: enqueue
+** Function: enqueue
**
** Description: Append data to the queue.
** data: array of bytes
** dataLen: length of the data.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -72,18 +72,18 @@ bool DataQueue::enqueue (UINT8* data, UINT16 dataLen)
{
if ((data == NULL) || (dataLen==0))
return false;
-
+
mMutex.lock ();
-
+
bool retval = false;
tHeader* header = (tHeader*) malloc (sizeof(tHeader) + dataLen);
-
+
if (header)
{
memset (header, 0, sizeof(tHeader));
header->mDataLen = dataLen;
memcpy (header+1, data, dataLen);
-
+
mQueue.push_back (header);
retval = true;
@@ -99,13 +99,13 @@ bool DataQueue::enqueue (UINT8* data, UINT16 dataLen)
/*******************************************************************************
**
-** Function: dequeue
+** Function: dequeue
**
** Description: Retrieve and remove data from the front of the queue.
** buffer: array to store the data.
** bufferMaxLen: maximum size of the buffer.
** actualLen: actual length of the data.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
diff --git a/nci/jni/DataQueue.h b/nci/jni/DataQueue.h
index 4c0c454..4bb6bda 100644
--- a/nci/jni/DataQueue.h
+++ b/nci/jni/DataQueue.h
@@ -8,7 +8,7 @@
** Proprietary and confidential.
**
*****************************************************************************/
-
+
#pragma once
#include "NfcJniUtil.h"
#include "gki.h"
@@ -21,10 +21,10 @@ class DataQueue
public:
/*******************************************************************************
**
- ** Function: DataQueue
+ ** Function: DataQueue
+ **
+ ** Description: Initialize member variables.
**
- ** Description: Initialize member variables.
- **
** Returns: None.
**
*******************************************************************************/
@@ -33,10 +33,10 @@ public:
/*******************************************************************************
**
- ** Function: ~DataQueue
+ ** Function: ~DataQueue
+ **
+ ** Description: Release all resources.
**
- ** Description: Release all resources.
- **
** Returns: None.
**
*******************************************************************************/
@@ -45,12 +45,12 @@ public:
/*******************************************************************************
**
- ** Function: enqueue
+ ** Function: enqueue
**
** Description: Append data to the queue.
** data: array of bytes
** dataLen: length of the data.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
@@ -59,13 +59,13 @@ public:
/*******************************************************************************
**
- ** Function: dequeue
+ ** Function: dequeue
**
** Description: Retrieve and remove data from the front of the queue.
** buffer: array to store the data.
** bufferMaxLen: maximum size of the buffer.
** actualLen: actual length of the data.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
@@ -74,15 +74,15 @@ public:
/*******************************************************************************
**
- ** Function: isEmpty
+ ** Function: isEmpty
**
** Description: Whether the queue is empty.
- **
+ **
** Returns: True if empty.
**
*******************************************************************************/
bool isEmpty();
-
+
private:
struct tHeader
{
diff --git a/nci/jni/HostAidRouter.cpp b/nci/jni/HostAidRouter.cpp
index dd54d19..5b32608 100644
--- a/nci/jni/HostAidRouter.cpp
+++ b/nci/jni/HostAidRouter.cpp
@@ -8,6 +8,7 @@
** Proprietary and confidential.
**
*****************************************************************************/
+#include "OverrideLog.h"
#include "HostAidRouter.h"
#include "config.h"
#include "SecureElement.h"
diff --git a/nci/jni/IntervalTimer.cpp b/nci/jni/IntervalTimer.cpp
index 4cca01a..304fa7e 100644
--- a/nci/jni/IntervalTimer.cpp
+++ b/nci/jni/IntervalTimer.cpp
@@ -10,9 +10,9 @@
*****************************************************************************/
#include "IntervalTimer.h"
-#include <cutils/log.h>
+#include "OverrideLog.h"
+
-
IntervalTimer::IntervalTimer()
{
mTimerId = NULL;
@@ -73,7 +73,7 @@ bool IntervalTimer::create(TIMER_FUNC cb)
{
struct sigevent se;
int stat = 0;
-
+
/*
* Set the sigevent structure to cause the signal to be
* delivered by creating a new thread.
diff --git a/nci/jni/IntervalTimer.h b/nci/jni/IntervalTimer.h
index 0f1095f..e3ec1c6 100644
--- a/nci/jni/IntervalTimer.h
+++ b/nci/jni/IntervalTimer.h
@@ -22,7 +22,7 @@ public:
bool set(int ms, TIMER_FUNC cb);
void kill();
bool create(TIMER_FUNC );
-
+
private:
timer_t mTimerId;
TIMER_FUNC mCb;
diff --git a/nci/jni/Mutex.cpp b/nci/jni/Mutex.cpp
index 4034a03..a6b1397 100644
--- a/nci/jni/Mutex.cpp
+++ b/nci/jni/Mutex.cpp
@@ -15,10 +15,10 @@
/*******************************************************************************
**
-** Function: Mutex
+** Function: Mutex
**
** Description: Initialize member variables.
-**
+**
** Returns: None.
**
*******************************************************************************/
@@ -35,10 +35,10 @@ Mutex::Mutex ()
/*******************************************************************************
**
-** Function: ~Mutex
+** Function: ~Mutex
**
** Description: Cleanup all resources.
-**
+**
** Returns: None.
**
*******************************************************************************/
@@ -54,10 +54,10 @@ Mutex::~Mutex ()
/*******************************************************************************
**
-** Function: lock
+** Function: lock
**
** Description: Block the thread and try lock the mutex.
-**
+**
** Returns: None.
**
*******************************************************************************/
@@ -73,10 +73,10 @@ void Mutex::lock ()
/*******************************************************************************
**
-** Function: unlock
+** Function: unlock
**
** Description: Unlock a mutex to unblock a thread.
-**
+**
** Returns: None.
**
*******************************************************************************/
@@ -92,10 +92,10 @@ void Mutex::unlock ()
/*******************************************************************************
**
-** Function: tryLock
+** Function: tryLock
**
** Description: Try to lock the mutex.
-**
+**
** Returns: True if the mutex is locked.
**
*******************************************************************************/
@@ -115,7 +115,7 @@ bool Mutex::tryLock ()
** Function: nativeHandle
**
** Description: Get the handle of the mutex.
-**
+**
** Returns: Handle of the mutex.
**
*******************************************************************************/
diff --git a/nci/jni/Mutex.h b/nci/jni/Mutex.h
index c858e8e..bd762c2 100644
--- a/nci/jni/Mutex.h
+++ b/nci/jni/Mutex.h
@@ -18,75 +18,75 @@ class Mutex
public:
/*******************************************************************************
**
- ** Function: Mutex
+ ** Function: Mutex
**
** Description: Initialize member variables.
- **
+ **
** Returns: None.
**
*******************************************************************************/
Mutex ();
-
-
+
+
/*******************************************************************************
**
- ** Function: ~Mutex
+ ** Function: ~Mutex
**
** Description: Cleanup all resources.
- **
+ **
** Returns: None.
**
*******************************************************************************/
~Mutex ();
-
-
+
+
/*******************************************************************************
**
- ** Function: lock
+ ** Function: lock
**
** Description: Block the thread and try lock the mutex.
- **
+ **
** Returns: None.
**
*******************************************************************************/
void lock ();
-
-
+
+
/*******************************************************************************
**
- ** Function: unlock
+ ** Function: unlock
**
** Description: Unlock a mutex to unblock a thread.
- **
+ **
** Returns: None.
**
*******************************************************************************/
void unlock ();
-
-
+
+
/*******************************************************************************
**
- ** Function: tryLock
+ ** Function: tryLock
**
** Description: Try to lock the mutex.
- **
+ **
** Returns: True if the mutex is locked.
**
*******************************************************************************/
bool tryLock ();
-
+
/*******************************************************************************
**
** Function: nativeHandle
**
** Description: Get the handle of the mutex.
- **
+ **
** Returns: Handle of the mutex.
**
*******************************************************************************/
pthread_mutex_t* nativeHandle ();
-
+
private:
pthread_mutex_t mMutex;
};
diff --git a/nci/jni/NativeLlcpConnectionlessSocket.cpp b/nci/jni/NativeLlcpConnectionlessSocket.cpp
index 88361a6..2c4618f 100644
--- a/nci/jni/NativeLlcpConnectionlessSocket.cpp
+++ b/nci/jni/NativeLlcpConnectionlessSocket.cpp
@@ -17,6 +17,7 @@
#include <semaphore.h>
#include <errno.h>
+#include "OverrideLog.h"
#include "NfcJniUtil.h"
extern "C"
{
@@ -25,7 +26,7 @@ extern "C"
}
-namespace android
+namespace android
{
@@ -43,7 +44,7 @@ static uint8_t* sConnlessRecvBuf = NULL;
static uint32_t sConnlessRecvLen = 0;
static uint32_t sConnlessRecvRemoteSap = 0;
-
+
/*******************************************************************************
**
** Function: nativeLlcpConnectionlessSocket_doSendTo
@@ -53,7 +54,7 @@ static uint32_t sConnlessRecvRemoteSap = 0;
** o: Java object.
** nsap: service access point.
** data: buffer for data.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -96,7 +97,7 @@ static jboolean nativeLlcpConnectionlessSocket_doSendTo (JNIEnv *e, jobject o, j
** data: buffer contains data.
** len: length of data.
** remoteSap: remote service access point.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -127,7 +128,7 @@ void nativeLlcpConnectionlessSocket_receiveData (uint8_t* data, uint32_t len, ui
** Function: connectionlessCleanup
**
** Description: Free resources.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -149,7 +150,7 @@ static jobject connectionlessCleanup ()
** Function: nativeLlcpConnectionlessSocket_abortWait
**
** Description: Abort current operation and unblock threads.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -167,7 +168,7 @@ void nativeLlcpConnectionlessSocket_abortWait ()
** e: JVM environment.
** o: Java object.
** linkMiu: max info unit
-**
+**
** Returns: LlcpPacket Java object.
**
*******************************************************************************/
@@ -237,7 +238,7 @@ static jobject nativeLlcpConnectionlessSocket_doReceiveFrom (JNIEnv *e, jobject
e->SetByteArrayRegion (receivedData, 0, sConnlessRecvLen, (jbyte*) sConnlessRecvBuf);
e->SetObjectField (llcpPacket, f, receivedData);
-TheEnd:
+TheEnd:
connectionlessCleanup ();
if (sem_destroy (&sConnlessRecvSem))
{
@@ -254,7 +255,7 @@ TheEnd:
** Description: Close socket.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -300,7 +301,7 @@ static JNINativeMethod gMethods[] =
**
** Description: Regisgter JNI functions with Java Virtual Machine.
** e: Environment of JVM.
-**
+**
** Returns: Status of registration.
**
*******************************************************************************/
diff --git a/nci/jni/NativeLlcpServiceSocket.cpp b/nci/jni/NativeLlcpServiceSocket.cpp
index 8b05b8e..ca57410 100644
--- a/nci/jni/NativeLlcpServiceSocket.cpp
+++ b/nci/jni/NativeLlcpServiceSocket.cpp
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+#include "OverrideLog.h"
#include "NfcJniUtil.h"
#include "NfcAdaptation.h"
#include "PeerToPeer.h"
@@ -29,7 +30,7 @@ extern tBRCM_JNI_HANDLE gNextJniHandle;
namespace android
{
-
+
extern char* gNativeLlcpServiceSocketClassName;
extern char* gNativeLlcpSocketClassName;
@@ -44,7 +45,7 @@ extern char* gNativeLlcpSocketClassName;
** miu: Maximum information unit.
** rw: Receive window.
** linearBufferLength: Not used.
-**
+**
** Returns: LlcpSocket Java object.
**
*******************************************************************************/
@@ -110,7 +111,7 @@ TheEnd:
** Description: Close a server socket.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -147,7 +148,7 @@ static JNINativeMethod gMethods[] =
**
** Description: Regisgter JNI functions with Java Virtual Machine.
** e: Environment of JVM.
-**
+**
** Returns: Status of registration.
**
*******************************************************************************/
diff --git a/nci/jni/NativeLlcpSocket.cpp b/nci/jni/NativeLlcpSocket.cpp
index cad6268..f0f0d3d 100644
--- a/nci/jni/NativeLlcpSocket.cpp
+++ b/nci/jni/NativeLlcpSocket.cpp
@@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include "NfcJniUtil.h"
+#include "OverrideLog.h"
#include "PeerToPeer.h"
namespace android
{
-
+
extern char* gNativeLlcpSocketClassName;
@@ -33,7 +33,7 @@ extern char* gNativeLlcpSocketClassName;
** e: JVM environment.
** o: Java object.
** nSap: Service access point.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -64,7 +64,7 @@ static jboolean nativeLlcpSocket_doConnect (JNIEnv* e, jobject o, jint nSap)
** e: JVM environment.
** o: Java object.
** sn: Service name.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -97,7 +97,7 @@ static jboolean nativeLlcpSocket_doConnectBy (JNIEnv* e, jobject o, jstring sn)
** Description: Close socket.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -125,13 +125,13 @@ static jboolean nativeLlcpSocket_doClose(JNIEnv *e, jobject o)
** e: JVM environment.
** o: Java object.
** data: Buffer of data.
-**
+**
** Returns: True if sent ok.
**
*******************************************************************************/
static jboolean nativeLlcpSocket_doSend (JNIEnv* e, jobject o, jbyteArray data)
{
- ALOGD_IF ((PeerToPeer::getInstance ().getLogLevel ()>=BT_TRACE_LEVEL_DEBUG), "%s: enter", __FUNCTION__);
+ ALOGD_IF ((appl_trace_level>=BT_TRACE_LEVEL_DEBUG), "%s: enter", __FUNCTION__);
uint8_t* dataBuffer = (uint8_t*) e->GetByteArrayElements (data, NULL);
uint32_t dataBufferLen = (uint32_t) e->GetArrayLength (data);
bool stat = false;
@@ -142,7 +142,7 @@ static jboolean nativeLlcpSocket_doSend (JNIEnv* e, jobject o, jbyteArray data)
e->ReleaseByteArrayElements (data, (jbyte*) dataBuffer, JNI_ABORT);
- ALOGD_IF ((PeerToPeer::getInstance ().getLogLevel ()>=BT_TRACE_LEVEL_DEBUG), "%s: exit", __FUNCTION__);
+ ALOGD_IF ((appl_trace_level>=BT_TRACE_LEVEL_DEBUG), "%s: exit", __FUNCTION__);
return stat ? JNI_TRUE : JNI_FALSE;
}
@@ -155,13 +155,13 @@ static jboolean nativeLlcpSocket_doSend (JNIEnv* e, jobject o, jbyteArray data)
** e: JVM environment.
** o: Java object.
** origBuffer: Buffer to put received data.
-**
+**
** Returns: Number of bytes received.
**
*******************************************************************************/
static jint nativeLlcpSocket_doReceive(JNIEnv *e, jobject o, jbyteArray origBuffer)
{
- ALOGD_IF ((PeerToPeer::getInstance ().getLogLevel ()>=BT_TRACE_LEVEL_DEBUG), "%s: enter", __FUNCTION__);
+ ALOGD_IF ((appl_trace_level>=BT_TRACE_LEVEL_DEBUG), "%s: enter", __FUNCTION__);
uint8_t* dataBuffer = (uint8_t*) e->GetByteArrayElements (origBuffer, NULL);
uint32_t dataBufferLen = (uint32_t) e->GetArrayLength (origBuffer);
uint16_t actualLen = 0;
@@ -180,7 +180,7 @@ static jint nativeLlcpSocket_doReceive(JNIEnv *e, jobject o, jbyteArray origBuff
retval = -1;
e->ReleaseByteArrayElements (origBuffer, (jbyte*) dataBuffer, 0);
- ALOGD_IF ((PeerToPeer::getInstance ().getLogLevel ()>=BT_TRACE_LEVEL_DEBUG), "%s: exit; actual len=%d", __FUNCTION__, retval);
+ ALOGD_IF ((appl_trace_level>=BT_TRACE_LEVEL_DEBUG), "%s: exit; actual len=%d", __FUNCTION__, retval);
return retval;
}
@@ -192,7 +192,7 @@ static jint nativeLlcpSocket_doReceive(JNIEnv *e, jobject o, jbyteArray origBuff
** Description: Get peer's maximum information unit.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: Peer's maximum information unit.
**
*******************************************************************************/
@@ -218,7 +218,7 @@ static jint nativeLlcpSocket_doGetRemoteSocketMIU (JNIEnv* e, jobject o)
** Description: Get peer's receive window size.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: Peer's receive window size.
**
*******************************************************************************/
@@ -260,7 +260,7 @@ static JNINativeMethod gMethods[] =
**
** Description: Regisgter JNI functions with Java Virtual Machine.
** e: Environment of JVM.
-**
+**
** Returns: Status of registration.
**
*******************************************************************************/
diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp
index 5baa842..0850f8a 100755
--- a/nci/jni/NativeNfcManager.cpp
+++ b/nci/jni/NativeNfcManager.cpp
@@ -17,6 +17,7 @@
#include <semaphore.h>
#include <errno.h>
+#include "OverrideLog.h"
#include "NfcJniUtil.h"
#include "NfcAdaptation.h"
#include "SyncEvent.h"
@@ -116,7 +117,6 @@ static int sConnlessLinkMiu = 0;
static bool sAbortConnlessWait = false;
static bool sIsSecElemSelected = false; //has NFC service selected a sec elem
static UINT8 * sOriginalLptdCfg = NULL;
-#define LPTD_PARAM_LEN (30)
static UINT8 sNewLptdCfg[LPTD_PARAM_LEN];
static UINT32 sConfigUpdated = 0;
#define CONFIG_UPDATE_LPTD (1 << 0)
@@ -145,7 +145,7 @@ static void nfaBrcmInitCallback (UINT32 brcm_hw_id);
** Function: getNative
**
** Description: Get native data
-**
+**
** Returns: Native data structure.
**
*******************************************************************************/
@@ -166,7 +166,7 @@ nfc_jni_native_data *getNative (JNIEnv* e, jobject o)
**
** Description: Handle RF-discovery events from the stack.
** discoveredDevice: Discovered device.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -199,7 +199,7 @@ static void handleRfDiscoveryEvent (tNFC_RESULT_DEVT* discoveredDevice)
** Description: Receive connection-related events from stack.
** connEvent: Event code.
** eventData: Event data.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -235,7 +235,7 @@ static void nfaConnectionCallback (UINT8 connEvent, tNFA_CONN_EVT_DATA* eventDat
sNfaEnableDisablePollingEvent.notifyOne ();
}
break;
-
+
case NFA_RF_DISCOVERY_STARTED_EVT: // RF Discovery started
{
ALOGD("%s: NFA_RF_DISCOVERY_STARTED_EVT: status = %u", __FUNCTION__, eventData->status);
@@ -244,7 +244,7 @@ static void nfaConnectionCallback (UINT8 connEvent, tNFA_CONN_EVT_DATA* eventDat
sNfaEnableDisablePollingEvent.notifyOne ();
}
break;
-
+
case NFA_RF_DISCOVERY_STOPPED_EVT: // RF Discovery stopped event
{
ALOGD("%s: NFA_RF_DISCOVERY_STOPPED_EVT: status = %u", __FUNCTION__, eventData->status);
@@ -253,7 +253,7 @@ static void nfaConnectionCallback (UINT8 connEvent, tNFA_CONN_EVT_DATA* eventDat
sNfaEnableDisablePollingEvent.notifyOne ();
}
break;
-
+
case NFA_DISC_RESULT_EVT: // NFC link/protocol discovery notificaiton
status = eventData->disc_result.status;
ALOGD("%s: NFA_DISC_RESULT_EVT: status = %d", __FUNCTION__, status);
@@ -419,12 +419,12 @@ static void nfaConnectionCallback (UINT8 connEvent, tNFA_CONN_EVT_DATA* eventDat
ALOGD("%s: NFA_CE_UICC_LISTEN_CONFIGURED_EVT : status=0x%X", __FUNCTION__, eventData->status);
SecureElement::getInstance().connectionEventHandler (connEvent, eventData);
break;
-
+
case NFA_SET_P2P_LISTEN_TECH_EVT:
ALOGD("%s: NFA_SET_P2P_LISTEN_TECH_EVT", __FUNCTION__);
PeerToPeer::getInstance().connectionEventHandler (connEvent, eventData);
break;
-
+
default:
ALOGE("%s: unknown event ????", __FUNCTION__);
break;
@@ -439,7 +439,7 @@ static void nfaConnectionCallback (UINT8 connEvent, tNFA_CONN_EVT_DATA* eventDat
** Description: Initialize variables.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -515,7 +515,7 @@ static jboolean nfcManager_initNativeStruc (JNIEnv* e, jobject o)
}
PowerSwitch::getInstance ().initialize (PowerSwitch::FULL_POWER);
-
+
ALOGD ("%s: exit", __FUNCTION__);
return JNI_TRUE;
}
@@ -528,7 +528,7 @@ static jboolean nfcManager_initNativeStruc (JNIEnv* e, jobject o)
** Description: Receive device management events from stack.
** dmEvent: Device-management event ID.
** eventData: Data associated with event ID.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -627,6 +627,7 @@ void nfaDeviceManagementCallback (UINT8 dmEvent, tNFA_DM_CBACK_DATA* eventData)
case NFA_DM_PWR_MODE_CHANGE_EVT:
PowerSwitch::getInstance ().deviceManagementCallback (dmEvent, eventData);
break;
+
case NFA_DM_FIRMWARE_BUILD_INFO_EVT:
{
tNFA_BRCM_FW_BUILD_INFO* bldInfo =
@@ -638,6 +639,7 @@ void nfaDeviceManagementCallback (UINT8 dmEvent, tNFA_DM_CBACK_DATA* eventData)
sNfaBuildInfoEvent.notifyOne();
}
break;
+
default:
ALOGD ("%s: unhandled event", __FUNCTION__);
break;
@@ -652,7 +654,7 @@ void nfaDeviceManagementCallback (UINT8 dmEvent, tNFA_DM_CBACK_DATA* eventData)
** Description: Turn on NFC.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -669,29 +671,29 @@ static jboolean nfcManager_doInitialize (JNIEnv* e, jobject o)
{
unsigned long num = 0;
+ tBRCM_DEV_INIT_CONFIG devInitConfig = {0};
NfcAdaptation& theInstance = NfcAdaptation::GetInstance();
theInstance.Initialize(); //start GKI, NCI task, NFC task
SyncEventGuard guard (sNfaEnableEvent);
-
+
NFA_Init();
- NFA_BrcmInit (nfaBrcmInitCallback);
+ NFA_BrcmInit (&devInitConfig, nfaBrcmInitCallback);
+
stat = NFA_Enable (nfaDeviceManagementCallback, nfaConnectionCallback);
if (stat == NFA_STATUS_OK)
{
- if (GetNumValue (NAME_APPL_TRACE_LEVEL, &num, sizeof (num)))
- {
- 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);
- }
+ 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
@@ -725,11 +727,11 @@ static jboolean nfcManager_doInitialize (JNIEnv* e, jobject o)
ALOGD ("%s: tag polling tech mask=0x%X", __FUNCTION__, nat->tech_mask);
}
-
+
// Always restore LPTD Configuration to the stack default.
if (sOriginalLptdCfg != NULL)
p_nfa_dm_lptd_cfg = sOriginalLptdCfg;
-
+
// if this value is not set or set and non-zero, enable multi-technology responses.
if (!GetNumValue(NAME_NFA_DM_MULTI_TECH_RESP, &num, sizeof(num)) || (num != 0))
@@ -767,7 +769,7 @@ TheEnd:
** e: JVM environment.
** o: Java object.
** mode: Not used.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -790,9 +792,9 @@ static void nfcManager_enableDiscovery (JNIEnv* e, jobject o)
tNFA_STATUS stat = NFA_STATUS_OK;
ALOGD ("%s: sIsSecElemSelected=%u", __FUNCTION__, sIsSecElemSelected);
-
+
PowerSwitch::getInstance ().setLevel (PowerSwitch::FULL_POWER);
-
+
{
SyncEventGuard guard (sNfaEnableDisablePollingEvent);
stat = NFA_EnablePolling (tech_mask);
@@ -819,7 +821,7 @@ static void nfcManager_enableDiscovery (JNIEnv* e, jobject o)
if (!sIsSecElemSelected)
stat = SecureElement::getInstance().routeToDefault ();
}
-
+
// Actually start discovery.
startRfDiscovery (true);
@@ -834,7 +836,7 @@ static void nfcManager_enableDiscovery (JNIEnv* e, jobject o)
** Description: Stop polling and listening for devices.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -851,7 +853,7 @@ void nfcManager_disableDiscovery (JNIEnv* e, jobject o)
// Stop RF Discovery.
startRfDiscovery (false);
-
+
if (sDiscoveryEnabled)
{
SyncEventGuard guard (sNfaEnableDisablePollingEvent);
@@ -874,7 +876,7 @@ TheEnd:
/*******************************************************************************
**
-** Function nfc_jni_cache_object_local
+** Function nfc_jni_cache_object_local
**
** Description Allocates a java object and calls it's constructor
**
@@ -886,14 +888,14 @@ int nfc_jni_cache_object_local (JNIEnv *e, const char *className, jobject *cache
jclass cls = NULL;
jobject obj = NULL;
jmethodID ctor = 0;
-
+
cls = e->FindClass (className);
if(cls == NULL)
{
ALOGE ("%s: find class error", __FUNCTION__);
return -1;
}
-
+
ctor = e->GetMethodID (cls, "<init>", "()V");
obj = e->NewObject (cls, ctor);
if (obj == NULL)
@@ -901,7 +903,7 @@ int nfc_jni_cache_object_local (JNIEnv *e, const char *className, jobject *cache
ALOGE ("%s: create object error", __FUNCTION__);
return -1;
}
-
+
*cachedObj = e->NewLocalRef (obj);
if (*cachedObj == NULL)
{
@@ -926,7 +928,7 @@ int nfc_jni_cache_object_local (JNIEnv *e, const char *className, jobject *cache
** miu: Maximum information unit.
** rw: Receive window size.
** linearBufferLength: Max buffer size.
-**
+**
** Returns: NativeLlcpServiceSocket Java object.
**
*******************************************************************************/
@@ -998,7 +1000,7 @@ static jobject nfcManager_doCreateLlcpServiceSocket (JNIEnv* e, jobject o, jint
** Description: Get the last error code.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: Last error code.
**
*******************************************************************************/
@@ -1016,7 +1018,7 @@ static jint nfcManager_doGetLastError(JNIEnv* e, jobject o)
** Description: Turn off NFC.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -1077,7 +1079,7 @@ static jboolean nfcManager_doDeinitialize (JNIEnv* e, jobject o)
** miu: Maximum information unit.
** rw: Receive window size.
** linearBufferLength: Max buffer size.
-**
+**
** Returns: NativeLlcpSocket Java object.
**
*******************************************************************************/
@@ -1139,7 +1141,7 @@ TheEnd:
** o: Java object.
** nSap: Service access point.
** sn: Service name.
-**
+**
** Returns: NativeLlcpConnectionlessSocket Java object.
**
*******************************************************************************/
@@ -1157,7 +1159,7 @@ static jobject nfcManager_doCreateLlcpConnectionlessSocket (JNIEnv *e, jobject o
** Description: Get a list of secure element handles.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: List of secure element handles.
**
*******************************************************************************/
@@ -1175,7 +1177,7 @@ static jintArray nfcManager_doGetSecureElementList(JNIEnv *e, jobject o)
** Description: NFC controller starts routing data in listen mode.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1215,7 +1217,7 @@ TheEnd:
** Description: NFC controller stops routing data in listen mode.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1237,10 +1239,10 @@ static void nfcManager_doDeselectSecureElement(JNIEnv *e, jobject o)
sIsSecElemSelected = false;
goto TheEnd;
}
-
+
stat = SecureElement::getInstance().routeToDefault ();
sIsSecElemSelected = false;
-
+
//if controller is not routing to sec elems AND there is no pipe connected,
//then turn off the sec elems
if (SecureElement::getInstance().isBusy() == false)
@@ -1261,7 +1263,7 @@ TheEnd:
**
** Description: Whether the activation data indicates the peer supports NFC-DEP.
** activated: Activation data.
-**
+**
** Returns: True if the peer supports NFC-DEP.
**
*******************************************************************************/
@@ -1276,7 +1278,7 @@ static bool isPeerToPeer (tNFA_ACTIVATED& activated)
** Function: nfcManager_doCheckLlcp
**
** Description: Not used.
-**
+**
** Returns: True
**
*******************************************************************************/
@@ -1292,7 +1294,7 @@ static jboolean nfcManager_doCheckLlcp(JNIEnv *e, jobject o)
** Function: nfcManager_doActivateLlcp
**
** Description: Not used.
-**
+**
** Returns: True
**
*******************************************************************************/
@@ -1308,7 +1310,7 @@ static jboolean nfcManager_doActivateLlcp(JNIEnv *e, jobject o)
** Function: nfcManager_doAbort
**
** Description: Not used.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1323,7 +1325,7 @@ static void nfcManager_doAbort(JNIEnv *e, jobject o)
** Function: nfcManager_doDownload
**
** Description: Not used.
-**
+**
** Returns: True
**
*******************************************************************************/
@@ -1339,11 +1341,11 @@ static jboolean nfcManager_doDownload(JNIEnv *e, jobject o)
** Function: nfcManager_doResetTimeouts
**
** Description: Not used.
-**
+**
** Returns: None
**
*******************************************************************************/
-static void nfcManager_doResetTimeouts(JNIEnv *e, jobject o)
+static void nfcManager_doResetTimeouts(JNIEnv *e, jobject o)
{
ALOGD ("%s: %d millisec", __FUNCTION__, DEFAULT_GENERAL_TRANS_TIMEOUT);
gGeneralTransceiveTimeout = DEFAULT_GENERAL_TRANS_TIMEOUT;
@@ -1358,13 +1360,13 @@ static void nfcManager_doResetTimeouts(JNIEnv *e, jobject o)
** e: JVM environment.
** o: Java object.
** timeout: Timeout value.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
-static bool nfcManager_doSetTimeout(JNIEnv *e, jobject o, jint tech, jint timeout)
+static bool nfcManager_doSetTimeout(JNIEnv *e, jobject o, jint tech, jint timeout)
{
- if (timeout <= 0)
+ if (timeout <= 0)
{
ALOGE("%s: Timeout must be positive.",__FUNCTION__);
return false;
@@ -1384,7 +1386,7 @@ static bool nfcManager_doSetTimeout(JNIEnv *e, jobject o, jint tech, jint timeou
** e: JVM environment.
** o: Java object.
** tech: Not used.
-**
+**
** Returns: Timeout value.
**
*******************************************************************************/
@@ -1402,7 +1404,7 @@ static jint nfcManager_doGetTimeout(JNIEnv *e, jobject o, jint tech)
** Description: Not used.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: Text dump.
**
*******************************************************************************/
@@ -1476,7 +1478,7 @@ static void nfcManager_doSetP2pTargetModes (JNIEnv *e, jobject o, jint modes)
**
** Function nfcManager_doSetScreenState
**
-** Description Forward the Screen On/Off state to native code for enhanced
+** Description Forward the Screen On/Off state to native code for enhanced
** power saving mode.
**
** Returns true
@@ -1573,7 +1575,7 @@ static JNINativeMethod gMethods[] =
**
** Description: Regisgter JNI functions with Java Virtual Machine.
** e: Environment of JVM.
-**
+**
** Returns: Status of registration.
**
*******************************************************************************/
@@ -1593,7 +1595,7 @@ int register_com_android_nfc_NativeNfcManager (JNIEnv *e)
**
** Description: Ask stack to start polling and listening for devices.
** isStart: Whether to start.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1601,7 +1603,7 @@ void startRfDiscovery(bool isStart)
{
SyncEventGuard guard (sNfaEnableDisablePollingEvent);
tNFA_STATUS status = NFA_STATUS_FAILED;
-
+
ALOGD ("%s: is start=%d", __FUNCTION__, isStart);
status = isStart ? NFA_StartRfDiscovery () : NFA_StopRfDiscovery ();
@@ -1621,7 +1623,7 @@ void startRfDiscovery(bool isStart)
** Function: doStartupConfig
**
** Description: Configure the NFC controller.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1629,7 +1631,7 @@ void doStartupConfig()
{
unsigned long num = 0;
struct nfc_jni_native_data *nat = getNative(0, 0);
-
+
// 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))
@@ -1643,7 +1645,7 @@ void doStartupConfig()
ALOGD ("%s: Configure RC work-around", __FUNCTION__);
NFA_SetConfig(NCI_PARAM_ID_FW_WORKAROUND, sizeof(nfa_dm_rc_workaround), &nfa_dm_rc_workaround[0]);
}
-
+
// 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)))
{
@@ -1667,14 +1669,14 @@ void doStartupConfig()
num *= 1000;
UINT8 * p = &swpcfg_param[12];
UINT32_TO_STREAM(p, num)
-
+
NFA_SetConfig(NCI_PARAM_ID_SWPCFG, sizeof(swpcfg_param), &swpcfg_param[0]);
}
-
+
// 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)))
{
NFA_SetConfig(NCI_PARAM_ID_PREINIT_DSP_CFG, sizeof(preinit_dsp_param), &preinit_dsp_param[0]);
@@ -1687,7 +1689,7 @@ void doStartupConfig()
** Function: nfcManager_isNfcActive
**
** Description: Used externaly to determine if NFC is active or not.
-**
+**
** Returns: 'true' if the NFC stack is running, else 'false'.
**
*******************************************************************************/
@@ -1710,7 +1712,7 @@ bool nfcManager_isNfcActive()
*******************************************************************************/
void nfaBrcmInitCallback (UINT32 brcm_hw_id)
{
- ALOGD ("%s: enter; brcm_hw_id=0x%X", __FUNCTION__, brcm_hw_id);
+ ALOGD ("%s: enter; brcm_hw_id=0x%lX", __FUNCTION__, brcm_hw_id);
nfa_app_post_nci_reset (brcm_hw_id);
}
diff --git a/nci/jni/NativeNfcTag.cpp b/nci/jni/NativeNfcTag.cpp
index 7a92b44..53c2384 100755
--- a/nci/jni/NativeNfcTag.cpp
+++ b/nci/jni/NativeNfcTag.cpp
@@ -19,6 +19,7 @@
#include <errno.h>
#include <time.h>
#include <signal.h>
+#include "OverrideLog.h"
#include "NfcJniUtil.h"
#include "NfcTag.h"
#include "config.h"
@@ -59,10 +60,10 @@ namespace android
** private variables and functions
**
*****************************************************************************/
-namespace android
+namespace android
{
-
+
// Pre-defined tag type values. These must match the values in
// framework Ndef.java for Google public NFC API.
#define NDEF_UNKNOWN_TYPE -1
@@ -78,7 +79,7 @@ static uint32_t sCheckNdefCurrentSize = 0;
static tNFA_STATUS sCheckNdefStatus = 0; //whether tag already contains a NDEF message
static bool sCheckNdefCapable = false; //whether tag has NDEF capability
static tNFA_HANDLE sNdefTypeHandlerHandle = NFA_HANDLE_INVALID;
-static tNFA_INTF_TYPE sCurrentRfInterface = NFA_INTERFACE_ISO_DEP;
+static tNFA_INTF_TYPE sCurrentRfInterface = NFA_INTERFACE_ISO_DEP;
static uint8_t* sTransceiveData = NULL;
static uint32_t sTransceiveDataLen = 0;
static bool sWaitingForTransceive = false;
@@ -118,7 +119,7 @@ static bool switchRfInterface(tNFA_INTF_TYPE rfInterface);
** Function: nativeNfcTag_abortWaits
**
** Description: Unblock all thread synchronization objects.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -151,7 +152,7 @@ void nativeNfcTag_abortWaits ()
** Function: switchBackTimerProc
**
** Description: Callback function for interval timer.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -169,7 +170,7 @@ static void switchBackTimerProc (union sigval)
** Description: Receive the completion status of read operation. Called by
** NFA_READ_CPLT_EVT.
** status: Status of operation.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -200,7 +201,7 @@ void nativeNfcTag_doReadCompleted (tNFA_STATUS status)
** Description: Receive NDEF-message related events from stack.
** event: Event code.
** p_data: Event data.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -241,7 +242,7 @@ static void ndefHandlerCallback (tNFA_NDEF_EVT event, tNFA_NDEF_EVT_DATA *eventD
** Description: Read the NDEF message on the tag.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: NDEF message.
**
*******************************************************************************/
@@ -302,7 +303,7 @@ static jbyteArray nativeNfcTag_doRead (JNIEnv *e, jobject o)
** Description: Receive the completion status of write operation. Called
** by NFA_WRITE_CPLT_EVT.
** isWriteOk: Status of operation.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -324,7 +325,7 @@ void nativeNfcTag_doWriteStatus (jboolean isWriteOk)
** Description: Receive the completion status of format operation. Called
** by NFA_FORMAT_CPLT_EVT.
** isOk: Status of operation.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -343,7 +344,7 @@ void nativeNfcTag_formatStatus (bool isOk)
** e: JVM environment.
** o: Java object.
** buf: Contains a NDEF message.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -436,7 +437,7 @@ TheEnd:
**
** Description: Receive the completion status of connect operation.
** isConnectOk: Status of the operation.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -457,7 +458,7 @@ void nativeNfcTag_doConnectStatus (jboolean isConnectOk)
** Function: nativeNfcTag_doDeactivateStatus
**
** Description: Receive the completion status of deactivate operation.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -478,7 +479,7 @@ void nativeNfcTag_doDeactivateStatus (int status)
** e: JVM environment.
** o: Java object.
** targetHandle: Handle of the tag.
-**
+**
** Returns: Must return NXP status code, which NFC service expects.
**
*******************************************************************************/
@@ -521,17 +522,17 @@ static jint nativeNfcTag_doConnect (JNIEnv *e, jobject o, jint targetHandle)
**
** Function: reSelect
**
-** Description: Deactivates the tag and re-selects it with the specified
-** rf interface.
-**
-** Returns: status code, 0 on success, 1 on failure,
+** Description: Deactivates the tag and re-selects it with the specified
+** rf interface.
+**
+** Returns: status code, 0 on success, 1 on failure,
** 146 (defined in service) on tag lost
**
*******************************************************************************/
static int reSelect (tNFA_INTF_TYPE rfInterface)
{
ALOGD ("%s: rf intf = %d", __FUNCTION__, rfInterface);
- NfcTag& natTag = NfcTag::getInstance ();
+ NfcTag& natTag = NfcTag::getInstance ();
ALOGD ("%s: NFA_Deactivate()", __FUNCTION__);
tNFA_STATUS status;
@@ -539,7 +540,7 @@ static int reSelect (tNFA_INTF_TYPE rfInterface)
do
{
- SyncEventGuard g (sReconnectEvent);
+ SyncEventGuard g (sReconnectEvent);
gIsTagDeactivating = true;
sGotDeactivate = false;
if (NFA_STATUS_OK != (status = NFA_Deactivate (TRUE)))
@@ -548,20 +549,20 @@ static int reSelect (tNFA_INTF_TYPE rfInterface)
break;
}
- if (sReconnectEvent.wait (1000) == false) //if timeout occured
+ if (sReconnectEvent.wait (1000) == false) //if timeout occured
{
- ALOGE ("%s: timeout waiting for deactivate", __FUNCTION__);
+ ALOGE ("%s: timeout waiting for deactivate", __FUNCTION__);
}
if (! NfcTag::getInstance ().isActivated ())
- {
+ {
rVal = STATUS_CODE_TARGET_LOST;
break;
}
gIsTagDeactivating = false;
- SyncEventGuard g2 (sReconnectEvent);
+ SyncEventGuard g2 (sReconnectEvent);
sConnectWaitingForComplete = JNI_TRUE;
ALOGD ("%s: NFA_Select()", __FUNCTION__);
@@ -573,14 +574,14 @@ static int reSelect (tNFA_INTF_TYPE rfInterface)
}
sConnectOk = false;
- if (sReconnectEvent.wait (1000) == false) //if timeout occured
+ 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 ())
- {
+ {
ALOGD("%s: Tag no longer active", __FUNCTION__);
rVal = STATUS_CODE_TARGET_LOST;
break;
@@ -600,7 +601,7 @@ static int reSelect (tNFA_INTF_TYPE rfInterface)
**
** Description: Switch controller's RF interface to frame, ISO-DEP, or NFC-DEP.
** rfInterface: Type of RF interface.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -639,7 +640,7 @@ static bool switchRfInterface (tNFA_INTF_TYPE rfInterface)
** e: JVM environment.
** o: Java object.
** targetHandle: Handle of the tag.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -657,17 +658,17 @@ static jboolean nativeNfcTag_doConnect_z (JNIEnv *e, jobject o, jint targetHandl
** Description: Re-connect to the tag in RF field.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: Status code.
**
*******************************************************************************/
static jint nativeNfcTag_doReconnect (JNIEnv *e, jobject o)
{
ALOGD ("%s", __FUNCTION__);
-
+
tNFA_INTF_TYPE intf = NFA_INTERFACE_FRAME;
- NfcTag& natTag = NfcTag::getInstance ();
-
+ NfcTag& natTag = NfcTag::getInstance ();
+
// this is only supported for type 2 or 4 (ISO_DEP) tags
if (natTag.mTechLibNfcTypes[0] == NFA_PROTOCOL_ISO_DEP)
intf = NFA_INTERFACE_ISO_DEP;
@@ -688,7 +689,7 @@ static jint nativeNfcTag_doReconnect (JNIEnv *e, jobject o)
** Description: Re-connect to the tag in RF field.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -708,7 +709,7 @@ static jboolean nativeNfcTag_doReconnect_z (JNIEnv *e, jobject o)
** e: JVM environment.
** o: Java object.
** targetHandle: Handle of the tag.
-**
+**
** Returns: Status code.
**
*******************************************************************************/
@@ -727,7 +728,7 @@ static jint nativeNfcTag_doHandleReconnect (JNIEnv *e, jobject o, jint targetHan
** e: JVM environment.
** o: Java object.
** targetHandle: Handle of the tag.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -745,7 +746,7 @@ static jboolean nativeNfcTag_doHandleReconnect_z (JNIEnv *e, jobject o, jint tar
** Description: Deactivate the RF field.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -780,7 +781,7 @@ TheEnd:
** Description: Receive the completion status of transceive operation.
** buf: Contains tag's response.
** bufLen: Length of buffer.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -819,7 +820,7 @@ void nativeNfcTag_doTranseiveStatus (uint8_t* buf, uint32_t bufLen)
** o: Java object.
** raw: Not used.
** statusTargetLost: Whether tag responds or times out.
-**
+**
** Returns: Response from tag.
**
*******************************************************************************/
@@ -828,7 +829,7 @@ static jbyteArray nativeNfcTag_doTransceive (JNIEnv *e, jobject o, jbyteArray da
ALOGD ("%s: enter; raw=%u; timeout = %d", __FUNCTION__, raw, gGeneralTransceiveTimeout);
bool fNeedToSwitchBack = false;
nfc_jni_native_data *nat = getNative (0, 0);
- bool waitOk = false;
+ bool waitOk = false;
uint8_t *buf = NULL;
uint32_t bufLen = 0;
jint *targetLost = NULL;
@@ -846,7 +847,7 @@ static jbyteArray nativeNfcTag_doTransceive (JNIEnv *e, jobject o, jbyteArray da
return NULL;
}
- NfcTag& natTag = NfcTag::getInstance ();
+ NfcTag& natTag = NfcTag::getInstance ();
if (natTag.mNumTechList >= 2 && natTag.mTechList[0] == TARGET_TYPE_ISO14443_3A)
{
if (natTag.mTechList[1] == TARGET_TYPE_MIFARE_CLASSIC)
@@ -902,7 +903,7 @@ static jbyteArray nativeNfcTag_doTransceive (JNIEnv *e, jobject o, jbyteArray da
waitOk = sTransceiveEvent.wait (gGeneralTransceiveTimeout);
}
- if (waitOk == false) //if timeout occured
+ if (waitOk == false) //if timeout occured
{
ALOGE ("%s: wait response timeout", __FUNCTION__);
if (targetLost)
@@ -917,7 +918,7 @@ static jbyteArray nativeNfcTag_doTransceive (JNIEnv *e, jobject o, jbyteArray da
*targetLost = 1; //causes NFC service to throw TagLostException
break;
}
-
+
ALOGD ("%s: response %d bytes", __FUNCTION__, sTransceiveDataLen);
if (sTransceiveDataLen)
{
@@ -946,7 +947,7 @@ static jbyteArray nativeNfcTag_doTransceive (JNIEnv *e, jobject o, jbyteArray da
// this timer proc will switch us back to ISO_DEP frame interface
sSwitchBackTimer.set (1500, switchBackTimerProc);
}
-
+
ALOGD ("%s: exit", __FUNCTION__);
return result;
}
@@ -961,7 +962,7 @@ static jbyteArray nativeNfcTag_doTransceive (JNIEnv *e, jobject o, jbyteArray da
** o: Java object.
** libnfcType: Type of tag represented by JNI.
** javaType: Not used.
-**
+**
** Returns: Type of tag represented by NFC Service.
**
*******************************************************************************/
@@ -1010,7 +1011,7 @@ static jint nativeNfcTag_doGetNdefType (JNIEnv *e, jobject o, jint libnfcType, j
** maxSize: Maximum size of NDEF message.
** currentSize: Current size of NDEF message.
** flags: Indicate various states.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1089,7 +1090,7 @@ void nativeNfcTag_doCheckNdefResult (tNFA_STATUS status, uint32_t maxSize, uint3
** e: JVM environment.
** o: Java object.
** ndefInfo: NDEF info.
-**
+**
** Returns: Status code.
**
*******************************************************************************/
@@ -1185,7 +1186,7 @@ TheEnd:
** e: JVM environment.
** o: Java object.
** ndefInfo: NDEF info.
-**
+**
** Returns: True if tag contains a NDEF message.
**
*******************************************************************************/
@@ -1204,7 +1205,7 @@ static bool nativeNfcTag_doCheckNdef_z (JNIEnv *e, jobject o, jintArray ndefInfo
** Function: nativeNfcTag_resetPresenceCheck
**
** Description: Reset variables related to presence-check.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1220,7 +1221,7 @@ void nativeNfcTag_resetPresenceCheck ()
**
** Description: Receive the result of presence-check.
** status: Result of presence-check.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1306,7 +1307,7 @@ static jboolean nativeNfcTag_doPresenceCheck (JNIEnv *e, jobject o)
** uidBytes: Tag's unique ID.
** pollBytes: Data from activation.
** actBytes: Data from activation.
-**
+**
** Returns: True if formattable.
**
*******************************************************************************/
@@ -1340,7 +1341,7 @@ static jboolean nativeNfcTag_doIsNdefFormatable (JNIEnv *e,
** o: Java object.
** pollBytes: Data from activation.
** actBytes: Data from activation.
-**
+**
** Returns: True if formattable.
**
*******************************************************************************/
@@ -1396,7 +1397,7 @@ static jboolean nativeNfcTag_doNdefFormat (JNIEnv *e, jobject o, jbyteArray key)
** Description: Receive the result of making a tag read-only. Called by the
** NFA_SET_TAG_RO_EVT.
** status: Status of the operation.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1420,7 +1421,7 @@ void nativeNfcTag_doMakeReadonlyResult (tNFA_STATUS status)
** e: JVM environment.
** o: Java object.
** key: Key to access the tag.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -1439,7 +1440,7 @@ static jboolean nativeNfcTag_doMakeReadonly (JNIEnv *e, jobject o, jbyteArray ke
}
sMakeReadonlyWaitingForComplete = JNI_TRUE;
-
+
// Hard-lock the tag (cannot be reverted)
status = NFA_RwSetTagReadOnly(TRUE);
@@ -1478,7 +1479,7 @@ TheEnd:
**
** Description: Register a callback to receive NDEF message from the tag
** from the NFA_NDEF_DATA_EVT.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1497,7 +1498,7 @@ void nativeNfcTag_registerNdefTypeHandler ()
** Function: nativeNfcTag_deregisterNdefTypeHandler
**
** Description: No longer need to receive NDEF message from the tag.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1511,7 +1512,7 @@ void nativeNfcTag_deregisterNdefTypeHandler ()
/*****************************************************************************
**
-** JNI functions for Android 4.0.3
+** JNI functions for Android 4.0.3
**
*****************************************************************************/
static JNINativeMethod gMethods[] =
@@ -1538,7 +1539,7 @@ static JNINativeMethod gMethods[] =
**
** Description: Regisgter JNI functions with Java Virtual Machine.
** e: Environment of JVM.
-**
+**
** Returns: Status of registration.
**
*******************************************************************************/
diff --git a/nci/jni/NativeP2pDevice.cpp b/nci/jni/NativeP2pDevice.cpp
index 16552a7..2f06b96 100644
--- a/nci/jni/NativeP2pDevice.cpp
+++ b/nci/jni/NativeP2pDevice.cpp
@@ -15,13 +15,14 @@
* limitations under the License.
*/
+#include "OverrideLog.h"
#include "NfcJniUtil.h"
namespace android
{
-
+
extern char* gNativeP2pDeviceClassName;
@@ -81,7 +82,7 @@ static JNINativeMethod gMethods[] =
**
** Description: Regisgter JNI functions with Java Virtual Machine.
** e: Environment of JVM.
-**
+**
** Returns: Status of registration.
**
*******************************************************************************/
diff --git a/nci/jni/NativeSecureElement.cpp b/nci/jni/NativeSecureElement.cpp
index 09091ed..55bece8 100755
--- a/nci/jni/NativeSecureElement.cpp
+++ b/nci/jni/NativeSecureElement.cpp
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include "NfcJniUtil.h"
+#include "OverrideLog.h"
#include "SecureElement.h"
#include "nfa_brcm_api.h"
@@ -22,7 +22,7 @@
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;
@@ -36,7 +36,7 @@ extern int gGeneralTransceiveTimeout;
** Description: Connect to the secure element.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: Handle of secure element. 0 is failure.
**
*******************************************************************************/
@@ -60,7 +60,7 @@ static jint nativeNfcSecureElement_doOpenSecureElementConnection (JNIEnv* e, job
else
SecureElement::getInstance().deactivate (0);
}
-
+
TheEnd:
ALOGD("%s: exit; return handle=0x%X", __FUNCTION__, secElemHandle);
return secElemHandle;
@@ -75,7 +75,7 @@ TheEnd:
** e: JVM environment.
** o: Java object.
** handle: Handle of secure element.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -85,7 +85,7 @@ static jboolean nativeNfcSecureElement_doDisconnectSecureElementConnection (JNIE
bool stat = false;
stat = SecureElement::getInstance().disconnectEE (handle);
-
+
//if controller is not routing AND there is no pipe connected,
//then turn off the sec elem
if (! SecureElement::getInstance().isBusy())
@@ -105,7 +105,7 @@ static jboolean nativeNfcSecureElement_doDisconnectSecureElementConnection (JNIE
** o: Java object.
** handle: Secure element's handle.
** data: Data to send.
-**
+**
** Returns: Buffer of received data.
**
*******************************************************************************/
@@ -145,7 +145,7 @@ static jbyteArray nativeNfcSecureElement_doTransceive (JNIEnv* e, jobject o, jin
** e: JVM environment.
** o: Java object.
** handle: Handle of secure element.
-**
+**
** Returns: Secure element's unique ID.
**
*******************************************************************************/
@@ -169,7 +169,7 @@ static jbyteArray nativeNfcSecureElement_doGetUid (JNIEnv* e, jobject o, jint ha
** e: JVM environment.
** o: Java object.
** handle: Handle of secure element.
-**
+**
** Returns: Array of technologies.
**
*******************************************************************************/
@@ -206,7 +206,7 @@ static JNINativeMethod gMethods[] =
**
** Description: Regisgter JNI functions with Java Virtual Machine.
** e: Environment of JVM.
-**
+**
** Returns: Status of registration.
**
*******************************************************************************/
diff --git a/nci/jni/NfcJniUtil.cpp b/nci/jni/NfcJniUtil.cpp
index d989188..7619f30 100755
--- a/nci/jni/NfcJniUtil.cpp
+++ b/nci/jni/NfcJniUtil.cpp
@@ -25,7 +25,7 @@
** Description: Register all JNI functions with Java Virtual Machine.
** jvm: Java Virtual Machine.
** reserved: Not used.
-**
+**
** Returns: JNI version.
**
*******************************************************************************/
@@ -65,8 +65,8 @@ namespace android
**
** Function: nfc_jni_cache_object
**
-** Description:
-**
+** Description:
+**
** Returns: Status code.
**
*******************************************************************************/
@@ -75,14 +75,14 @@ int nfc_jni_cache_object (JNIEnv *e, const char *className, jobject *cachedObj)
jclass cls = NULL;
jobject obj = NULL;
jmethodID ctor = 0;
-
+
cls = e->FindClass (className);
if(cls == NULL)
{
ALOGE ("%s: find class error", __FUNCTION__);
return -1;
}
-
+
ctor = e->GetMethodID (cls, "<init>", "()V");
obj = e->NewObject (cls, ctor);
if (obj == NULL)
@@ -90,7 +90,7 @@ int nfc_jni_cache_object (JNIEnv *e, const char *className, jobject *cachedObj)
ALOGE ("%s: create object error", __FUNCTION__);
return -1;
}
-
+
*cachedObj = e->NewGlobalRef (obj);
if (*cachedObj == NULL)
{
@@ -110,7 +110,7 @@ int nfc_jni_cache_object (JNIEnv *e, const char *className, jobject *cachedObj)
** Description: Get the value of "mHandle" member variable.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: Value of mHandle.
**
*******************************************************************************/
@@ -118,7 +118,7 @@ int nfc_jni_get_nfc_socket_handle (JNIEnv *e, jobject o)
{
jclass c = NULL;
jfieldID f = 0;
-
+
c = e->GetObjectClass (o);
f = e->GetFieldID (c, "mHandle", "I");
return e->GetIntField (o, f);
@@ -132,7 +132,7 @@ int nfc_jni_get_nfc_socket_handle (JNIEnv *e, jobject o)
** Description: Get the value of "mNative" member variable.
** e: JVM environment.
** o: Java object.
-**
+**
** Returns: Pointer to the value of mNative.
**
*******************************************************************************/
diff --git a/nci/jni/NfcJniUtil.h b/nci/jni/NfcJniUtil.h
index 18e75de..90f2cab 100755
--- a/nci/jni/NfcJniUtil.h
+++ b/nci/jni/NfcJniUtil.h
@@ -21,12 +21,7 @@
#include <jni.h>
#include <pthread.h>
#include <sys/queue.h>
-extern "C"
-{
- #include <cutils/log.h>
- #include <semaphore.h>
-}
-#include <cutils/properties.h> // for property_get
+#include <semaphore.h>
/* Discovery modes -- keep in sync with NFCManager.DISCOVERY_MODE_* */
@@ -48,10 +43,10 @@ extern "C"
#define PROPERTY_LLCP_WKS 2
#define PROPERTY_LLCP_OPT 3
#define PROPERTY_NFC_DISCOVERY_A 4
-#define PROPERTY_NFC_DISCOVERY_B 5
+#define PROPERTY_NFC_DISCOVERY_B 5
#define PROPERTY_NFC_DISCOVERY_F 6
#define PROPERTY_NFC_DISCOVERY_15693 7
-#define PROPERTY_NFC_DISCOVERY_NCFIP 8
+#define PROPERTY_NFC_DISCOVERY_NCFIP 8
/* Error codes */
@@ -119,7 +114,7 @@ struct nfc_jni_native_data
/* Secure Element selected */
int seId;
-
+
/* LLCP params */
int lto;
int miu;
@@ -156,4 +151,3 @@ namespace android
int register_com_android_nfc_NativeLlcpSocket (JNIEnv *e);
int register_com_android_nfc_NativeNfcSecureElement (JNIEnv *e);
} // namespace android
-
diff --git a/nci/jni/NfcTag.cpp b/nci/jni/NfcTag.cpp
index c135014..ebec941 100755
--- a/nci/jni/NfcTag.cpp
+++ b/nci/jni/NfcTag.cpp
@@ -8,7 +8,7 @@
** Proprietary and confidential.
**
*****************************************************************************/
-
+#include "OverrideLog.h"
#include "NfcTag.h"
extern "C"
{
@@ -28,7 +28,7 @@ namespace android
** Function: NfcTag
**
** Description: Initialize member variables.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -44,7 +44,7 @@ NfcTag::NfcTag ()
memset (mTechHandles, 0, sizeof(mTechHandles));
memset (mTechLibNfcTypes, 0, sizeof(mTechLibNfcTypes));
memset (mTechParams, 0, sizeof(mTechParams));
- mLastKovioUidLen = 0;
+ mLastKovioUidLen = 0;
memset(mLastKovioUid, 0, NFC_KOVIO_MAX_LEN);
}
@@ -54,7 +54,7 @@ NfcTag::NfcTag ()
** Function: getInstance
**
** Description: Get a reference to the singleton NfcTag object.
-**
+**
** Returns: Reference to NfcTag object.
**
*******************************************************************************/
@@ -71,7 +71,7 @@ NfcTag& NfcTag::getInstance ()
**
** Description: Reset member variables.
** native: Native data.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -89,10 +89,10 @@ void NfcTag::initialize (nfc_jni_native_data* native)
/*******************************************************************************
**
-** Function: abort
+** Function: abort
**
** Description: Unblock all operations.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -108,7 +108,7 @@ void NfcTag::abort ()
** Function: isActivated
**
** Description: Is tag activated?
-**
+**
** Returns: True if tag is activated.
**
*******************************************************************************/
@@ -123,7 +123,7 @@ bool NfcTag::isActivated ()
** Function: getProtocol
**
** Description: Get the protocol of the current tag.
-**
+**
** Returns: Protocol number.
**
*******************************************************************************/
@@ -249,8 +249,8 @@ void NfcTag::discoverTechnologies (tNFA_ACTIVATED& activationData)
{
// need to look at first byte of uid to find manuf.
tNFC_RF_TECH_PARAMS tech_params;
- memcpy (&tech_params, &(rfDetail.rf_tech_param), sizeof(rfDetail.rf_tech_param));
-
+ memcpy (&tech_params, &(rfDetail.rf_tech_param), sizeof(rfDetail.rf_tech_param));
+
if ((tech_params.param.pa.nfcid1[0] == 0x04 && rfDetail.rf_tech_param.param.pa.sel_rsp == 0) ||
rfDetail.rf_tech_param.param.pa.sel_rsp == 0x18 ||
rfDetail.rf_tech_param.param.pa.sel_rsp == 0x08)
@@ -260,10 +260,10 @@ void NfcTag::discoverTechnologies (tNFA_ACTIVATED& activationData)
mTechHandles [mNumTechList] = rfDetail.rf_disc_id;
mTechLibNfcTypes [mNumTechList] = rfDetail.protocol;
//save the stack's data structure for interpretation later
- memcpy (&(mTechParams[mNumTechList]), &(rfDetail.rf_tech_param), sizeof(rfDetail.rf_tech_param));
+ memcpy (&(mTechParams[mNumTechList]), &(rfDetail.rf_tech_param), sizeof(rfDetail.rf_tech_param));
if (rfDetail.rf_tech_param.param.pa.sel_rsp == 0)
mTechList [mNumTechList] = TARGET_TYPE_MIFARE_UL; //is TagTechnology.MIFARE_ULTRALIGHT by Java API
- else
+ else
mTechList [mNumTechList] = TARGET_TYPE_MIFARE_CLASSIC; //is TagTechnology.MIFARE_CLASSIC by Java API
}
}
@@ -436,11 +436,11 @@ TheEnd:
**
** Function: createNativeNfcTag
**
-** Description: Create a brand new Java NativeNfcTag object;
+** Description: Create a brand new Java NativeNfcTag object;
** fill the objects's member variables with data;
** notify NFC service;
** activationData: data from activation.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -936,7 +936,7 @@ void NfcTag::fillNativeNfcTagMembers5 (JNIEnv* e, jclass tag_cls, jobject tag, t
** Function: isP2pDiscovered
**
** Description: Does the peer support P2P?
-**
+**
** Returns: True if the peer supports P2P.
**
*******************************************************************************/
@@ -965,7 +965,7 @@ bool NfcTag::isP2pDiscovered ()
** Function: selectP2p
**
** Description: Select the preferred P2P technology if there is a choice.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -973,7 +973,7 @@ void NfcTag::selectP2p()
{
static const char fn [] = "NfcTag::selectP2p";
UINT8 rfDiscoveryId = 0;
-
+
for (int i = 0; i < mNumTechList; i++)
{
//if remote device does not support P2P, just skip it
@@ -1014,8 +1014,8 @@ void NfcTag::selectP2p()
**
** Function: resetTechnologies
**
-** Description: Clear all data related to the technology, protocol of the tag.
-**
+** Description: Clear all data related to the technology, protocol of the tag.
+**
** Returns: None
**
*******************************************************************************/
@@ -1036,7 +1036,7 @@ void NfcTag::resetTechnologies ()
** Function: selectFirstTag
**
** Description: When multiple tags are discovered, just select the first one to activate.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1067,7 +1067,7 @@ void NfcTag::selectFirstTag ()
** Function: getT1tMaxMessageSize
**
** Description: Get the maximum size (octet) that a T1T can store.
-**
+**
** Returns: Maximum size in octets.
**
*******************************************************************************/
@@ -1090,7 +1090,7 @@ int NfcTag::getT1tMaxMessageSize ()
**
** Description: Calculate type-1 tag's max message size based on header ROM bytes.
** activate: reference to activation data.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1127,7 +1127,7 @@ void NfcTag::calculateT1tMaxMessageSize (tNFA_ACTIVATED& activate)
** Function: isMifareUltralight
**
** Description: Whether the currently activated tag is Mifare Ultralight.
-**
+**
** Returns: True if tag is Mifare Ultralight.
**
*******************************************************************************/
@@ -1176,7 +1176,7 @@ bool NfcTag::isMifareUltralight ()
** Description: Handle connection-related events.
** event: event code.
** data: pointer to event data.
-**
+**
** Returns: None
**
*******************************************************************************/
diff --git a/nci/jni/NfcTag.h b/nci/jni/NfcTag.h
index 2b17553..a692ddd 100755
--- a/nci/jni/NfcTag.h
+++ b/nci/jni/NfcTag.h
@@ -32,7 +32,7 @@ public:
** Function: NfcTag
**
** Description: Initialize member variables.
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -44,7 +44,7 @@ public:
** Function: getInstance
**
** Description: Get a reference to the singleton NfcTag object.
- **
+ **
** Returns: Reference to NfcTag object.
**
*******************************************************************************/
@@ -65,10 +65,10 @@ public:
/*******************************************************************************
**
- ** Function: abort
+ ** Function: abort
**
** Description: Unblock all operations.
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -82,7 +82,7 @@ public:
** Description: Handle connection-related events.
** event: event code.
** data: pointer to event data.
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -94,7 +94,7 @@ public:
** Function: isActivated
**
** Description: Is tag activated?
- **
+ **
** Returns: True if tag is activated.
**
*******************************************************************************/
@@ -106,7 +106,7 @@ public:
** Function: getProtocol
**
** Description: Get the protocol of the current tag.
- **
+ **
** Returns: Protocol number.
**
*******************************************************************************/
@@ -118,7 +118,7 @@ public:
** Function: isP2pDiscovered
**
** Description: Does the peer support P2P?
- **
+ **
** Returns: True if the peer supports P2P.
**
*******************************************************************************/
@@ -130,7 +130,7 @@ public:
** Function: selectP2p
**
** Description: Select the preferred P2P technology if there is a choice.
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -142,7 +142,7 @@ public:
** Function: selectFirstTag
**
** Description: When multiple tags are discovered, just select the first one to activate.
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -154,7 +154,7 @@ public:
** Function: getT1tMaxMessageSize
**
** Description: Get the maximum size (octet) that a T1T can store.
- **
+ **
** Returns: Maximum size in octets.
**
*******************************************************************************/
@@ -166,7 +166,7 @@ public:
** Function: isMifareUltralight
**
** Description: Whether the currently activated tag is Mifare Ultralight.
- **
+ **
** Returns: True if tag is Mifare Ultralight.
**
*******************************************************************************/
@@ -174,7 +174,7 @@ public:
private:
nfc_jni_native_data* mNativeData;
- bool mIsActivated;
+ bool mIsActivated;
tNFC_PROTOCOL mProtocol;
int mtT1tMaxMessageSize; //T1T max NDEF message size
tNFA_STATUS mReadCompletedStatus;
@@ -232,11 +232,11 @@ private:
**
** Function: createNativeNfcTag
**
- ** Description: Create a brand new Java NativeNfcTag object;
+ ** Description: Create a brand new Java NativeNfcTag object;
** fill the objects's member variables with data;
** notify NFC service;
** activationData: data from activation.
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -334,8 +334,8 @@ private:
**
** Function: resetTechnologies
**
- ** Description: Clear all data related to the technology, protocol of the tag.
- **
+ ** Description: Clear all data related to the technology, protocol of the tag.
+ **
** Returns: None
**
*******************************************************************************/
@@ -348,7 +348,7 @@ private:
**
** Description: Calculate type-1 tag's max message size based on header ROM bytes.
** activate: reference to activation data.
- **
+ **
** Returns: None
**
*******************************************************************************/
diff --git a/nci/jni/PeerToPeer.cpp b/nci/jni/PeerToPeer.cpp
index da3dbad..1272bf9 100644
--- a/nci/jni/PeerToPeer.cpp
+++ b/nci/jni/PeerToPeer.cpp
@@ -8,6 +8,7 @@
** Proprietary and confidential.
**
*****************************************************************************/
+#include "OverrideLog.h"
#include "PeerToPeer.h"
#include "NfcJniUtil.h"
#include "llcp_defs.h"
@@ -32,16 +33,16 @@ const std::string PeerToPeer::sNppServiceName ("com.android.npp");
** Function: PeerToPeer
**
** Description: Initialize member variables.
-**
+**
** Returns: None
**
*******************************************************************************/
PeerToPeer::PeerToPeer ()
: mRemoteWKS (0),
mIsP2pListening (false),
- mP2pListenTechMask (NFA_TECHNOLOGY_MASK_A
- | NFA_TECHNOLOGY_MASK_F
- | NFA_TECHNOLOGY_MASK_A_ACTIVE
+ mP2pListenTechMask (NFA_TECHNOLOGY_MASK_A
+ | NFA_TECHNOLOGY_MASK_F
+ | NFA_TECHNOLOGY_MASK_A_ACTIVE
| NFA_TECHNOLOGY_MASK_F_ACTIVE),
mJniHandleSendingNppViaSnep (0),
mSnepRegHandle (NFA_HANDLE_INVALID),
@@ -50,14 +51,11 @@ PeerToPeer::PeerToPeer ()
mNppTotalLen (0),
mNppReadSoFar (0),
mNdefTypeHandlerHandle (NFA_HANDLE_INVALID),
- mAppLogLevel (1),
mJniVersion (403)
{
unsigned long num = 0;
memset (mServers, 0, sizeof(mServers));
memset (mClients, 0, sizeof(mClients));
- if (GetNumValue ("APPL_TRACE_LEVEL", &num, sizeof (num)))
- mAppLogLevel = num;
}
@@ -66,7 +64,7 @@ PeerToPeer::PeerToPeer ()
** Function: ~PeerToPeer
**
** Description: Free all resources.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -80,7 +78,7 @@ PeerToPeer::~PeerToPeer ()
** Function: getInstance
**
** Description: Get the singleton PeerToPeer object.
-**
+**
** Returns: Singleton PeerToPeer object.
**
*******************************************************************************/
@@ -96,7 +94,7 @@ PeerToPeer& PeerToPeer::getInstance ()
**
** Description: Initialize member variables.
** jniVersion: JNI version.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -118,7 +116,7 @@ void PeerToPeer::initialize (long jniVersion)
**
** Description: Find a PeerToPeer object by connection handle.
** nfaP2pServerHandle: Connectin handle.
-**
+**
** Returns: PeerToPeer object.
**
*******************************************************************************/
@@ -144,7 +142,7 @@ P2pServer *PeerToPeer::findServer (tNFA_HANDLE nfaP2pServerHandle)
**
** Description: Find a PeerToPeer object by connection handle.
** serviceName: service name.
-**
+**
** Returns: PeerToPeer object.
**
*******************************************************************************/
@@ -170,7 +168,7 @@ P2pServer *PeerToPeer::findServer (tBRCM_JNI_HANDLE jniHandle)
**
** Description: Find a PeerToPeer object by service name
** serviceName: service name.
-**
+**
** Returns: PeerToPeer object.
**
*******************************************************************************/
@@ -194,7 +192,7 @@ P2pServer *PeerToPeer::findServer (const char *serviceName)
** Description: Let a server start listening for peer's connection request.
** jniHandle: Connection handle.
** serviceName: Server's service name.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -206,7 +204,7 @@ bool PeerToPeer::registerServer (tBRCM_JNI_HANDLE jniHandle, const char *service
P2pServer *pSrv = NULL;
UINT8 serverSap = NFA_P2P_ANY_SAP;
- // Check if already registered
+ // Check if already registered
if ((pSrv = findServer(serviceName)) != NULL)
{
ALOGD ("%s: service name=%s already registered, handle: 0x%04x", fn, serviceName, pSrv->mNfaP2pServerHandle);
@@ -247,10 +245,10 @@ bool PeerToPeer::registerServer (tBRCM_JNI_HANDLE jniHandle, const char *service
- Data link connection timeout (LLCP_DATA_LINK_CONNECTION_TOUT)
- Delay timeout to send first PDU as initiator (LLCP_DELAY_TIME_TO_SEND_FIRST_PDU)
************************/
- stat = NFA_P2pSetLLCPConfig (LLCP_MIU,
+ stat = NFA_P2pSetLLCPConfig (LLCP_MIU,
LLCP_OPT_VALUE,
- LLCP_WAITING_TIME,
- LLCP_LTO_VALUE,
+ LLCP_WAITING_TIME,
+ LLCP_LTO_VALUE,
0, //use 0 for infinite timeout for symmetry procedure when acting as initiator
0, //use 0 for infinite timeout for symmetry procedure when acting as target
LLCP_DELAY_RESP_TIME,
@@ -294,7 +292,7 @@ bool PeerToPeer::registerServer (tBRCM_JNI_HANDLE jniHandle, const char *service
**
** Description: Free resources related to a server.
** jniHandle: Connection handle.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -325,7 +323,7 @@ void PeerToPeer::removeServer (tBRCM_JNI_HANDLE jniHandle)
** Description: Receive LLLCP-activated event from stack.
** nat: JVM-related data.
** activated: Event data.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -354,31 +352,31 @@ void PeerToPeer::llcpActivatedHandler (nfc_jni_native_data* nat, tNFA_LLCP_ACTIV
ALOGE ("%s: jni env is null", fn);
return;
}
-
+
ALOGD ("%s: get object class", fn);
tag_cls = e->GetObjectClass (nat->cached_P2pDevice);
if (e->ExceptionCheck())
{
e->ExceptionClear();
- ALOGE ("%s: fail get p2p device", fn);
+ ALOGE ("%s: fail get p2p device", fn);
goto TheEnd;
- }
+ }
ALOGD ("%s: instantiate", fn);
/* New target instance */
ctor = e->GetMethodID (tag_cls, "<init>", "()V");
tag = e->NewObject (tag_cls, ctor);
-
+
/* Set P2P Target mode */
- f = e->GetFieldID (tag_cls, "mMode", "I");
-
+ f = e->GetFieldID (tag_cls, "mMode", "I");
+
if (activated.is_initiator == TRUE)
{
ALOGD ("%s: p2p initiator", fn);
e->SetIntField (tag, f, (jint) MODE_P2P_INITIATOR);
}
else
- {
+ {
ALOGD ("%s: p2p target", fn);
e->SetIntField (tag, f, (jint) MODE_P2P_TARGET);
}
@@ -401,7 +399,7 @@ void PeerToPeer::llcpActivatedHandler (nfc_jni_native_data* nat, tNFA_LLCP_ACTIV
{
e->ExceptionClear();
ALOGE ("%s: fail notify", fn);
- }
+ }
e->DeleteLocalRef (tag);
@@ -418,7 +416,7 @@ TheEnd:
** Description: Receive LLLCP-deactivated event from stack.
** nat: JVM-related data.
** deactivated: Event data.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -442,14 +440,14 @@ void PeerToPeer::llcpDeactivatedHandler (nfc_jni_native_data* nat, tNFA_LLCP_DEA
{
e->ExceptionClear();
ALOGE ("%s: fail notify", fn);
- }
+ }
nat->vm->DetachCurrentThread ();
-
+
//PeerToPeer no longer needs to handle NDEF data event
NFA_DeregisterNDefTypeHandler (mNdefTypeHandlerHandle);
mNdefTypeHandlerHandle = NFA_HANDLE_INVALID;
-
+
//let the tag-reading code handle NDEF data event
android::nativeNfcTag_registerNdefTypeHandler ();
ALOGD ("%s: exit", fn);
@@ -465,7 +463,7 @@ void PeerToPeer::llcpDeactivatedHandler (nfc_jni_native_data* nat, tNFA_LLCP_DEA
** connJniHandle: Connection handle.
** maxInfoUnit: Maximum information unit.
** recvWindow: Receive window size.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -555,7 +553,7 @@ bool PeerToPeer::accept (tBRCM_JNI_HANDLE serverJniHandle, tBRCM_JNI_HANDLE conn
** Function: deregisterServer
**
** Description: Stop a P2pServer from listening for peer.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -597,7 +595,7 @@ bool PeerToPeer::deregisterServer (tBRCM_JNI_HANDLE jniHandle)
** jniHandle: Connection handle.
** miu: Maximum information unit.
** rw: Receive window size.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -652,7 +650,7 @@ bool PeerToPeer::createClient (tBRCM_JNI_HANDLE jniHandle, UINT16 miu, UINT8 rw)
**
** Description: Free resources related to a connection.
** jniHandle: Connection handle.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -718,7 +716,7 @@ void PeerToPeer::removeConn(tBRCM_JNI_HANDLE jniHandle)
** Description: Estabish a connection-oriented connection to a peer.
** jniHandle: Connection handle.
** serviceName: Peer's service name.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -778,7 +776,7 @@ bool PeerToPeer::connectConnOriented (tBRCM_JNI_HANDLE jniHandle, const char* se
** Description: Estabish a connection-oriented connection to a peer.
** jniHandle: Connection handle.
** destinationSap: Peer's service access point.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -800,7 +798,7 @@ bool PeerToPeer::connectConnOriented (tBRCM_JNI_HANDLE jniHandle, UINT8 destinat
** jniHandle: Connection handle.
** serviceName: Peer's service name.
** destinationSap: Peer's service access point.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -858,7 +856,7 @@ bool PeerToPeer::createDataLinkConn (tBRCM_JNI_HANDLE jniHandle, const char* ser
**
** Description: Find a PeerToPeer object with a client connection handle.
** nfaConnHandle: Connection handle.
-**
+**
** Returns: PeerToPeer object.
**
*******************************************************************************/
@@ -879,7 +877,7 @@ P2pClient *PeerToPeer::findClient (tNFA_HANDLE nfaConnHandle)
**
** Description: Find a PeerToPeer object with a client connection handle.
** jniHandle: Connection handle.
-**
+**
** Returns: PeerToPeer object.
**
*******************************************************************************/
@@ -900,7 +898,7 @@ P2pClient *PeerToPeer::findClient (tBRCM_JNI_HANDLE jniHandle)
**
** Description: Find a PeerToPeer object with a client connection handle.
** nfaConnHandle: Connection handle.
-**
+**
** Returns: PeerToPeer object.
**
*******************************************************************************/
@@ -921,7 +919,7 @@ P2pClient *PeerToPeer::findClientCon (tNFA_HANDLE nfaConnHandle)
**
** Description: Find a PeerToPeer object with a connection handle.
** nfaConnHandle: Connection handle.
-**
+**
** Returns: PeerToPeer object.
**
*******************************************************************************/
@@ -962,7 +960,7 @@ NfaConn *PeerToPeer::findConnection (tNFA_HANDLE nfaConnHandle)
**
** Description: Find a PeerToPeer object with a connection handle.
** jniHandle: Connection handle.
-**
+**
** Returns: PeerToPeer object.
**
*******************************************************************************/
@@ -1005,7 +1003,7 @@ NfaConn *PeerToPeer::findConnection (tBRCM_JNI_HANDLE jniHandle)
** jniHandle: Handle of connection.
** buffer: Buffer of data.
** bufferLen: Length of data.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -1021,7 +1019,7 @@ bool PeerToPeer::send (tBRCM_JNI_HANDLE jniHandle, UINT8 *buffer, UINT16 bufferL
return (false);
}
- ALOGD_IF ((mAppLogLevel>=BT_TRACE_LEVEL_DEBUG), "%s: send data; jniHandle: %u nfaHandle: 0x%04X mJniHandleSendingNppViaSnep: %u",
+ ALOGD_IF ((appl_trace_level>=BT_TRACE_LEVEL_DEBUG), "%s: send data; jniHandle: %u nfaHandle: 0x%04X mJniHandleSendingNppViaSnep: %u",
fn, pConn->mJniHandle, pConn->mNfaConnHandle, mJniHandleSendingNppViaSnep);
// Is this a SNEP fake-out
@@ -1044,7 +1042,7 @@ bool PeerToPeer::send (tBRCM_JNI_HANDLE jniHandle, UINT8 *buffer, UINT16 bufferL
}
if (nfaStat == NFA_STATUS_OK)
- ALOGD_IF ((mAppLogLevel>=BT_TRACE_LEVEL_DEBUG), "%s: exit OK; JNI handle: %u NFA Handle: 0x%04x", fn, jniHandle, pConn->mNfaConnHandle);
+ ALOGD_IF ((appl_trace_level>=BT_TRACE_LEVEL_DEBUG), "%s: exit OK; JNI handle: %u NFA Handle: 0x%04x", fn, jniHandle, pConn->mNfaConnHandle);
else
ALOGE ("%s: Data not sent; JNI handle: %u NFA Handle: 0x%04x error: 0x%04x",
fn, jniHandle, pConn->mNfaConnHandle, nfaStat);
@@ -1061,7 +1059,7 @@ bool PeerToPeer::send (tBRCM_JNI_HANDLE jniHandle, UINT8 *buffer, UINT16 bufferL
** jniHandle: Handle of connection.
** buffer: Buffer of data.
** dataLen: Length of data.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -1078,7 +1076,7 @@ bool PeerToPeer::sendViaSnep (tBRCM_JNI_HANDLE jniHandle, UINT8 *buffer, UINT16
return (false);
}
- ALOGD_IF ((mAppLogLevel>=BT_TRACE_LEVEL_DEBUG), "%s: send data; jniHandle: %u mSnepNdefMsgLen: %lu mSnepNdefBufLen: %lu dataLen: %d",
+ ALOGD_IF ((appl_trace_level>=BT_TRACE_LEVEL_DEBUG), "%s: send data; jniHandle: %u mSnepNdefMsgLen: %lu mSnepNdefBufLen: %lu dataLen: %d",
fn, jniHandle, pClient->mSnepNdefMsgLen, pClient->mSnepNdefBufLen, dataLen);
if (pClient->mSnepNdefMsgLen == 0)
@@ -1146,14 +1144,14 @@ bool PeerToPeer::sendViaSnep (tBRCM_JNI_HANDLE jniHandle, UINT8 *buffer, UINT16
** buffer: Buffer to store data.
** bufferLen: Max length of buffer.
** actualLen: Actual length received.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
bool PeerToPeer::receive (tBRCM_JNI_HANDLE jniHandle, UINT8* buffer, UINT16 bufferLen, UINT16& actualLen)
{
static const char fn [] = "PeerToPeer::receive";
- ALOGD_IF ((mAppLogLevel>=BT_TRACE_LEVEL_DEBUG), "%s: enter; jniHandle: %u bufferLen: %u", fn, jniHandle, bufferLen);
+ ALOGD_IF ((appl_trace_level>=BT_TRACE_LEVEL_DEBUG), "%s: enter; jniHandle: %u bufferLen: %u", fn, jniHandle, bufferLen);
NfaConn *pConn = NULL;
tNFA_STATUS stat = NFA_STATUS_FAILED;
UINT32 actualDataLen2 = 0;
@@ -1169,7 +1167,7 @@ bool PeerToPeer::receive (tBRCM_JNI_HANDLE jniHandle, UINT8* buffer, UINT16 buff
return (false);
}
- ALOGD_IF ((mAppLogLevel>=BT_TRACE_LEVEL_DEBUG), "%s: jniHandle: %u nfaHandle: 0x%04X buf len=%u", fn, pConn->mJniHandle, pConn->mNfaConnHandle, bufferLen);
+ ALOGD_IF ((appl_trace_level>=BT_TRACE_LEVEL_DEBUG), "%s: jniHandle: %u nfaHandle: 0x%04X buf len=%u", fn, pConn->mJniHandle, pConn->mNfaConnHandle, bufferLen);
while (pConn->mNfaConnHandle != NFA_HANDLE_INVALID)
{
@@ -1180,14 +1178,14 @@ bool PeerToPeer::receive (tBRCM_JNI_HANDLE jniHandle, UINT8* buffer, UINT16 buff
retVal = true;
break;
}
- ALOGD_IF ((mAppLogLevel>=BT_TRACE_LEVEL_DEBUG), "%s: waiting for data...", fn);
+ ALOGD_IF ((appl_trace_level>=BT_TRACE_LEVEL_DEBUG), "%s: waiting for data...", fn);
{
SyncEventGuard guard (pConn->mReadEvent);
pConn->mReadEvent.wait();
}
} //while
- ALOGD_IF ((mAppLogLevel>=BT_TRACE_LEVEL_DEBUG), "%s: exit; nfa h: 0x%X ok: %u actual len: %u", fn, pConn->mNfaConnHandle, retVal, actualLen);
+ ALOGD_IF ((appl_trace_level>=BT_TRACE_LEVEL_DEBUG), "%s: exit; nfa h: 0x%X ok: %u actual len: %u", fn, pConn->mNfaConnHandle, retVal, actualLen);
return retVal;
}
@@ -1200,7 +1198,7 @@ bool PeerToPeer::receive (tBRCM_JNI_HANDLE jniHandle, UINT8* buffer, UINT16 buff
** buffer: Buffer of data to send.
** bufferLen: Length of data in buffer.
** actualLen: Actual length sent.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -1208,7 +1206,7 @@ bool PeerToPeer::feedNppFromSnep (UINT8* buffer, UINT16 bufferLen, UINT16& actua
{
static const char fn [] = "PeerToPeer::feedNppFromSnep";
- ALOGD_IF ((mAppLogLevel>=BT_TRACE_LEVEL_DEBUG), "%s: mNppTotalLen: %lu mNppReadSoFar: %lu bufferLen: %u",
+ ALOGD_IF ((appl_trace_level>=BT_TRACE_LEVEL_DEBUG), "%s: mNppTotalLen: %lu mNppReadSoFar: %lu bufferLen: %u",
fn, mNppTotalLen, mNppReadSoFar, bufferLen);
if (bufferLen > (mNppTotalLen - mNppReadSoFar))
@@ -1236,7 +1234,7 @@ bool PeerToPeer::feedNppFromSnep (UINT8* buffer, UINT16 bufferLen, UINT16& actua
**
** Description: Disconnect a connection-oriented connection with peer.
** jniHandle: Handle of connection.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -1299,7 +1297,7 @@ bool PeerToPeer::disconnectConnOriented (tBRCM_JNI_HANDLE jniHandle)
**
** Description: Get peer's max information unit.
** jniHandle: Handle of the connection.
-**
+**
** Returns: Peer's max information unit.
**
*******************************************************************************/
@@ -1324,7 +1322,7 @@ UINT16 PeerToPeer::getRemoteMaxInfoUnit (tBRCM_JNI_HANDLE jniHandle)
**
** Description: Get peer's receive window size.
** jniHandle: Handle of the connection.
-**
+**
** Returns: Peer's receive window size.
**
*******************************************************************************/
@@ -1362,7 +1360,7 @@ void PeerToPeer::setP2pListenMask (tNFA_TECHNOLOGY_MASK p2pListenMask) {
**
** Description: Start/stop polling/listening to peer that supports P2P.
** isEnable: Is enable polling/listening?
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1382,7 +1380,7 @@ void PeerToPeer::enableP2pListening (bool isEnable)
mSetTechEvent.wait ();
mIsP2pListening = true;
}
- else
+ else
ALOGE ("%s: fail enable listen; error=0x%X", fn, nfaStat);
}
else if ( (isEnable == false) && (mIsP2pListening == true) )
@@ -1396,7 +1394,7 @@ void PeerToPeer::enableP2pListening (bool isEnable)
}
else
ALOGE ("%s: fail disable listen; error=0x%X", fn, nfaStat);
- }
+ }
ALOGD ("%s: exit; mIsP2pListening: %u", fn, mIsP2pListening);
}
@@ -1407,7 +1405,7 @@ void PeerToPeer::enableP2pListening (bool isEnable)
**
** Description: Handle events related to turning NFC on/off by the user.
** isOn: Is NFC turning on?
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1433,16 +1431,16 @@ void PeerToPeer::handleNfcOnOff (bool isOn)
SyncEventGuard guard (mSnepDefaultServerStartStopEvent);
stat = NFA_SnepStartDefaultServer (snepClientCallback);
if (stat == NFA_STATUS_OK)
- mSnepDefaultServerStartStopEvent.wait (); //wait for NFA_SNEP_DEFAULT_SERVER_STARTED_EVT
+ mSnepDefaultServerStartStopEvent.wait (); //wait for NFA_SNEP_DEFAULT_SERVER_STARTED_EVT
else
ALOGE ("%s: fail start snep server; error=0x%X", fn, stat);
}
- {
+ {
SyncEventGuard guard (mSnepRegisterEvent);
stat = NFA_SnepRegisterClient (snepClientCallback);
if (stat == NFA_STATUS_OK)
- mSnepRegisterEvent.wait (); //wait for NFA_SNEP_REG_EVT
+ mSnepRegisterEvent.wait (); //wait for NFA_SNEP_REG_EVT
else
ALOGE ("%s: fail register snep client; error=0x%X", fn, stat);
}
@@ -1520,8 +1518,8 @@ void PeerToPeer::handleNfcOnOff (bool isOn)
**
** Description: Receive LLCP-related events from the stack.
** p2pEvent: Event code.
-** eventData: Event data.
-**
+** eventData: Event data.
+**
** Returns: None
**
*******************************************************************************/
@@ -1531,7 +1529,7 @@ void PeerToPeer::nfaServerCallback (tNFA_P2P_EVT p2pEvent, tNFA_P2P_EVT_DATA* ev
P2pServer *pSrv = NULL;
NfaConn *pConn = NULL;
- ALOGD_IF ((sP2p.mAppLogLevel>=BT_TRACE_LEVEL_DEBUG), "%s: enter; event=0x%X", fn, p2pEvent);
+ ALOGD_IF ((appl_trace_level>=BT_TRACE_LEVEL_DEBUG), "%s: enter; event=0x%X", fn, p2pEvent);
switch (p2pEvent)
{
@@ -1554,7 +1552,7 @@ void PeerToPeer::nfaServerCallback (tNFA_P2P_EVT p2pEvent, tNFA_P2P_EVT_DATA* ev
case NFA_P2P_ACTIVATED_EVT: //remote device has activated
ALOGD ("%s: NFA_P2P_ACTIVATED_EVT; handle: 0x%04x", fn, eventData->activated.handle);
break;
-
+
case NFA_P2P_DEACTIVATED_EVT:
ALOGD ("%s: NFA_P2P_DEACTIVATED_EVT; handle: 0x%04x", fn, eventData->activated.handle);
break;
@@ -1632,7 +1630,7 @@ void PeerToPeer::nfaServerCallback (tNFA_P2P_EVT p2pEvent, tNFA_P2P_EVT_DATA* ev
}
else
{
- ALOGD_IF ((sP2p.mAppLogLevel>=BT_TRACE_LEVEL_DEBUG), "%s: NFA_P2P_DATA_EVT; h=0x%X; remote sap=0x%X", fn,
+ ALOGD_IF ((appl_trace_level>=BT_TRACE_LEVEL_DEBUG), "%s: NFA_P2P_DATA_EVT; h=0x%X; remote sap=0x%X", fn,
eventData->data.handle, eventData->data.remote_sap);
SyncEventGuard guard (pConn->mReadEvent);
pConn->mReadEvent.notifyOne();
@@ -1659,7 +1657,7 @@ void PeerToPeer::nfaServerCallback (tNFA_P2P_EVT p2pEvent, tNFA_P2P_EVT_DATA* ev
ALOGE ("%s: unknown event 0x%X ????", fn, p2pEvent);
break;
}
- ALOGD_IF ((sP2p.mAppLogLevel>=BT_TRACE_LEVEL_DEBUG), "%s: exit", fn);
+ ALOGD_IF ((appl_trace_level>=BT_TRACE_LEVEL_DEBUG), "%s: exit", fn);
}
@@ -1669,8 +1667,8 @@ void PeerToPeer::nfaServerCallback (tNFA_P2P_EVT p2pEvent, tNFA_P2P_EVT_DATA* ev
**
** Description: Receive LLCP-related events from the stack.
** p2pEvent: Event code.
-** eventData: Event data.
-**
+** eventData: Event data.
+**
** Returns: None
**
*******************************************************************************/
@@ -1680,7 +1678,7 @@ void PeerToPeer::nfaClientCallback (tNFA_P2P_EVT p2pEvent, tNFA_P2P_EVT_DATA* ev
NfaConn *pConn = NULL;
P2pClient *pClient = NULL;
- ALOGD_IF ((sP2p.mAppLogLevel>=BT_TRACE_LEVEL_DEBUG), "%s: enter; event=%u", fn, p2pEvent);
+ ALOGD_IF ((appl_trace_level>=BT_TRACE_LEVEL_DEBUG), "%s: enter; event=%u", fn, p2pEvent);
switch (p2pEvent)
{
@@ -1784,13 +1782,13 @@ void PeerToPeer::nfaClientCallback (tNFA_P2P_EVT p2pEvent, tNFA_P2P_EVT_DATA* ev
}
else
{
- ALOGD_IF ((sP2p.mAppLogLevel>=BT_TRACE_LEVEL_DEBUG), "%s: NFA_P2P_DATA_EVT; h=0x%X; remote sap=0x%X", fn,
+ ALOGD_IF ((appl_trace_level>=BT_TRACE_LEVEL_DEBUG), "%s: NFA_P2P_DATA_EVT; h=0x%X; remote sap=0x%X", fn,
eventData->data.handle, eventData->data.remote_sap);
SyncEventGuard guard (pConn->mReadEvent);
pConn->mReadEvent.notifyOne();
}
break;
-
+
case NFA_P2P_CONGEST_EVT:
// Look for the connection block
if ((pConn = sP2p.findConnection(eventData->congest.handle)) == NULL)
@@ -1799,7 +1797,7 @@ void PeerToPeer::nfaClientCallback (tNFA_P2P_EVT p2pEvent, tNFA_P2P_EVT_DATA* ev
}
else
{
- ALOGD_IF ((sP2p.mAppLogLevel>=BT_TRACE_LEVEL_DEBUG), "%s: NFA_P2P_CONGEST_EVT; nfa handle: 0x%04x congested: %u", fn,
+ ALOGD_IF ((appl_trace_level>=BT_TRACE_LEVEL_DEBUG), "%s: NFA_P2P_CONGEST_EVT; nfa handle: 0x%04x congested: %u", fn,
eventData->congest.handle, eventData->congest.is_congested);
SyncEventGuard guard (pConn->mCongEvent);
@@ -1821,7 +1819,7 @@ void PeerToPeer::nfaClientCallback (tNFA_P2P_EVT p2pEvent, tNFA_P2P_EVT_DATA* ev
** Description: Receive SNEP-related events from the stack.
** snepEvent: Event code.
** eventData: Event data.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1897,7 +1895,7 @@ void PeerToPeer::snepClientCallback (tNFA_SNEP_EVT snepEvent, tNFA_SNEP_EVT_DATA
pClient->mSnepEvent.notifyOne();
}
break;
-
+
case NFA_SNEP_DEFAULT_SERVER_STARTED_EVT:
{
ALOGE ("%s: NFA_SNEP_DEFAULT_SERVER_STARTED_EVT", fn);
@@ -1929,7 +1927,7 @@ void PeerToPeer::snepClientCallback (tNFA_SNEP_EVT snepEvent, tNFA_SNEP_EVT_DATA
** Description: Receive NDEF-related events from the stack.
** ndefEvent: Event code.
** eventData: Event data.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1999,27 +1997,12 @@ void PeerToPeer::ndefTypeCallback (tNFA_NDEF_EVT ndefEvent, tNFA_NDEF_EVT_DATA *
/*******************************************************************************
**
-** Function: getLogLevel
-**
-** Description: Get the diagnostic logging level.
-**
-** Returns: Log level; 0=no logging; 1=error only; 5=debug
-**
-*******************************************************************************/
-UINT32 PeerToPeer::getLogLevel ()
-{
- return mAppLogLevel;
-}
-
-
-/*******************************************************************************
-**
** Function: connectionEventHandler
**
** Description: Receive events from the stack.
** event: Event code.
** eventData: Event data.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -2046,7 +2029,7 @@ void PeerToPeer::connectionEventHandler (UINT8 event, tNFA_CONN_EVT_DATA* eventD
** Function: P2pServer
**
** Description: Initialize member variables.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -2064,7 +2047,7 @@ P2pServer::P2pServer()
**
** Description: Find a P2pServer that has the handle.
** nfaConnHandle: NFA connection handle.
-**
+**
** Returns: P2pServer object.
**
*******************************************************************************/
@@ -2092,7 +2075,7 @@ NfaConn *P2pServer::findServerConnection (tNFA_HANDLE nfaConnHandle)
** Function: P2pClient
**
** Description: Initialize member variables.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -2113,7 +2096,7 @@ P2pClient::P2pClient ()
** Function: ~P2pClient
**
** Description: Free all resources.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -2133,7 +2116,7 @@ P2pClient::~P2pClient ()
** Function: NfaConn
**
** Description: Initialize member variables.
-**
+**
** Returns: None
**
*******************************************************************************/
diff --git a/nci/jni/PeerToPeer.h b/nci/jni/PeerToPeer.h
index e7fcbf8..b9c7b39 100644
--- a/nci/jni/PeerToPeer.h
+++ b/nci/jni/PeerToPeer.h
@@ -35,57 +35,57 @@ typedef unsigned int tBRCM_JNI_HANDLE;
class PeerToPeer
{
public:
-
-
+
+
/*******************************************************************************
**
** Function: PeerToPeer
**
** Description: Initialize member variables.
- **
+ **
** Returns: None
**
*******************************************************************************/
PeerToPeer ();
-
-
+
+
/*******************************************************************************
**
** Function: ~PeerToPeer
**
** Description: Free all resources.
- **
+ **
** Returns: None
**
*******************************************************************************/
~PeerToPeer ();
-
+
/*******************************************************************************
**
** Function: getInstance
**
** Description: Get the singleton PeerToPeer object.
- **
+ **
** Returns: Singleton PeerToPeer object.
**
*******************************************************************************/
static PeerToPeer& getInstance();
-
-
+
+
/*******************************************************************************
**
** Function: initialize
**
** Description: Initialize member variables.
** jniVersion: JNI version.
- **
+ **
** Returns: None
**
*******************************************************************************/
void initialize (long jniVersion);
-
-
+
+
/*******************************************************************************
**
** Function: llcpActivatedHandler
@@ -93,13 +93,13 @@ public:
** Description: Receive LLLCP-activated event from stack.
** nat: JVM-related data.
** activated: Event data.
- **
+ **
** Returns: None
**
*******************************************************************************/
void llcpActivatedHandler (nfc_jni_native_data* nativeData, tNFA_LLCP_ACTIVATED& activated);
-
-
+
+
/*******************************************************************************
**
** Function: llcpDeactivatedHandler
@@ -107,13 +107,13 @@ public:
** Description: Receive LLLCP-deactivated event from stack.
** nat: JVM-related data.
** deactivated: Event data.
- **
+ **
** Returns: None
**
*******************************************************************************/
void llcpDeactivatedHandler (nfc_jni_native_data* nativeData, tNFA_LLCP_DEACTIVATED& deactivated);
-
-
+
+
/*******************************************************************************
**
** Function: connectionEventHandler
@@ -121,13 +121,13 @@ public:
** Description: Receive events from the stack.
** event: Event code.
** eventData: Event data.
- **
+ **
** Returns: None
**
*******************************************************************************/
void connectionEventHandler (UINT8 event, tNFA_CONN_EVT_DATA* eventData);
-
+
/*******************************************************************************
**
** Function: registerServer
@@ -135,25 +135,25 @@ public:
** Description: Let a server start listening for peer's connection request.
** jniHandle: Connection handle.
** serviceName: Server's service name.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
bool registerServer (tBRCM_JNI_HANDLE jniHandle, const char* serviceName);
-
-
+
+
/*******************************************************************************
**
** Function: deregisterServer
**
** Description: Stop a P2pServer from listening for peer.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
bool deregisterServer (tBRCM_JNI_HANDLE jniHandle);
-
-
+
+
/*******************************************************************************
**
** Function: accept
@@ -163,13 +163,13 @@ public:
** connJniHandle: Connection handle.
** maxInfoUnit: Maximum information unit.
** recvWindow: Receive window size.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
bool accept (tBRCM_JNI_HANDLE serverJniHandle, tBRCM_JNI_HANDLE connJniHandle, int maxInfoUnit, int recvWindow);
-
+
/*******************************************************************************
**
** Function: createClient
@@ -178,13 +178,13 @@ public:
** jniHandle: Connection handle.
** miu: Maximum information unit.
** rw: Receive window size.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
bool createClient (tBRCM_JNI_HANDLE jniHandle, UINT16 miu, UINT8 rw);
-
-
+
+
/*******************************************************************************
**
** Function: connectConnOriented
@@ -192,13 +192,13 @@ public:
** Description: Estabish a connection-oriented connection to a peer.
** jniHandle: Connection handle.
** serviceName: Peer's service name.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
bool connectConnOriented (tBRCM_JNI_HANDLE jniHandle, const char* serviceName);
-
-
+
+
/*******************************************************************************
**
** Function: connectConnOriented
@@ -206,13 +206,13 @@ public:
** Description: Estabish a connection-oriented connection to a peer.
** jniHandle: Connection handle.
** destinationSap: Peer's service access point.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
bool connectConnOriented (tBRCM_JNI_HANDLE jniHandle, UINT8 destinationSap);
-
-
+
+
/*******************************************************************************
**
** Function: send
@@ -221,13 +221,13 @@ public:
** jniHandle: Handle of connection.
** buffer: Buffer of data.
** bufferLen: Length of data.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
bool send (tBRCM_JNI_HANDLE jniHandle, UINT8* buffer, UINT16 bufferLen);
-
-
+
+
/*******************************************************************************
**
** Function: receive
@@ -237,7 +237,7 @@ public:
** buffer: Buffer to store data.
** bufferLen: Max length of buffer.
** actualLen: Actual length received.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
@@ -250,7 +250,7 @@ public:
**
** Description: Disconnect a connection-oriented connection with peer.
** jniHandle: Handle of connection.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
@@ -263,7 +263,7 @@ public:
**
** Description: Get peer's max information unit.
** jniHandle: Handle of the connection.
- **
+ **
** Returns: Peer's max information unit.
**
*******************************************************************************/
@@ -276,7 +276,7 @@ public:
**
** Description: Get peer's receive window size.
** jniHandle: Handle of the connection.
- **
+ **
** Returns: Peer's receive window size.
**
*******************************************************************************/
@@ -301,7 +301,7 @@ public:
**
** Description: Start/stop polling/listening to peer that supports P2P.
** isEnable: Is enable polling/listening?
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -314,24 +314,12 @@ public:
**
** Description: Handle events related to turning NFC on/off by the user.
** isOn: Is NFC turning on?
- **
+ **
** Returns: None
**
*******************************************************************************/
void handleNfcOnOff (bool isOn);
-
- /*******************************************************************************
- **
- ** Function: getLogLevel
- **
- ** Description: Get the diagnostic logging level.
- **
- ** Returns: Log level; 0=no logging; 1=error only; 5=debug
- **
- *******************************************************************************/
- UINT32 getLogLevel ();
-
private:
static const int sMax = 10;
static PeerToPeer sP2p;
@@ -339,7 +327,7 @@ private:
static const std::string sNppServiceName;
UINT16 mRemoteWKS; // Peer's well known services
bool mIsP2pListening; // If P2P listening is enabled or not
- tNFA_TECHNOLOGY_MASK mP2pListenTechMask; // P2P Listen mask
+ tNFA_TECHNOLOGY_MASK mP2pListenTechMask; // P2P Listen mask
tBRCM_JNI_HANDLE mJniHandleSendingNppViaSnep;
tNFA_HANDLE mSnepRegHandle;
tBRCM_JNI_HANDLE mRcvFakeNppJniHandle;
@@ -347,7 +335,6 @@ private:
UINT32 mNppTotalLen;
UINT32 mNppReadSoFar;
tNFA_HANDLE mNdefTypeHandlerHandle;
- UINT32 mAppLogLevel;
long mJniVersion;
P2pServer *mServers [sMax];
@@ -356,36 +343,36 @@ private:
SyncEvent mSnepDefaultServerStartStopEvent; // completion event for NFA_SnepStartDefaultServer(), NFA_SnepStopDefaultServer()
SyncEvent mSnepRegisterEvent; // completion event for NFA_SnepRegisterClient()
Mutex mDisconnectMutex; // synchronize the disconnect operation
-
-
+
+
/*******************************************************************************
**
** Function: nfaServerCallback
**
** Description: Receive LLCP-related events from the stack.
** p2pEvent: Event code.
- ** eventData: Event data.
- **
+ ** eventData: Event data.
+ **
** Returns: None
**
*******************************************************************************/
static void nfaServerCallback (tNFA_P2P_EVT p2pEvent, tNFA_P2P_EVT_DATA *eventData);
-
-
+
+
/*******************************************************************************
**
** Function: nfaClientCallback
**
** Description: Receive LLCP-related events from the stack.
** p2pEvent: Event code.
- ** eventData: Event data.
- **
+ ** eventData: Event data.
+ **
** Returns: None
**
*******************************************************************************/
static void nfaClientCallback (tNFA_P2P_EVT p2pEvent, tNFA_P2P_EVT_DATA *eventData);
-
-
+
+
/*******************************************************************************
**
** Function: snepClientCallback
@@ -393,13 +380,13 @@ private:
** 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);
-
-
+
+
/*******************************************************************************
**
** Function: ndefTypeCallback
@@ -407,20 +394,20 @@ private:
** Description: Receive NDEF-related events from the stack.
** ndefEvent: Event code.
** eventData: Event data.
- **
+ **
** Returns: None
**
*******************************************************************************/
static void ndefTypeCallback (tNFA_NDEF_EVT event, tNFA_NDEF_EVT_DATA *evetnData);
-
+
/*******************************************************************************
**
** Function: findServer
**
** Description: Find a PeerToPeer object by connection handle.
** nfaP2pServerHandle: Connectin handle.
- **
+ **
** Returns: PeerToPeer object.
**
*******************************************************************************/
@@ -433,7 +420,7 @@ private:
**
** Description: Find a PeerToPeer object by connection handle.
** serviceName: service name.
- **
+ **
** Returns: PeerToPeer object.
**
*******************************************************************************/
@@ -446,7 +433,7 @@ private:
**
** Description: Find a PeerToPeer object by service name
** serviceName: service name.
- **
+ **
** Returns: PeerToPeer object.
**
*******************************************************************************/
@@ -459,7 +446,7 @@ private:
**
** Description: Free resources related to a server.
** jniHandle: Connection handle.
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -472,7 +459,7 @@ private:
**
** Description: Free resources related to a connection.
** jniHandle: Connection handle.
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -487,7 +474,7 @@ private:
** jniHandle: Connection handle.
** serviceName: Peer's service name.
** destinationSap: Peer's service access point.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
@@ -500,7 +487,7 @@ private:
**
** Description: Find a PeerToPeer object with a client connection handle.
** nfaConnHandle: Connection handle.
- **
+ **
** Returns: PeerToPeer object.
**
*******************************************************************************/
@@ -513,7 +500,7 @@ private:
**
** Description: Find a PeerToPeer object with a client connection handle.
** jniHandle: Connection handle.
- **
+ **
** Returns: PeerToPeer object.
**
*******************************************************************************/
@@ -526,7 +513,7 @@ private:
**
** Description: Find a PeerToPeer object with a client connection handle.
** nfaConnHandle: Connection handle.
- **
+ **
** Returns: PeerToPeer object.
**
*******************************************************************************/
@@ -539,7 +526,7 @@ private:
**
** Description: Find a PeerToPeer object with a connection handle.
** nfaConnHandle: Connection handle.
- **
+ **
** Returns: PeerToPeer object.
**
*******************************************************************************/
@@ -552,7 +539,7 @@ private:
**
** Description: Find a PeerToPeer object with a connection handle.
** jniHandle: Connection handle.
- **
+ **
** Returns: PeerToPeer object.
**
*******************************************************************************/
@@ -567,7 +554,7 @@ private:
** jniHandle: Handle of connection.
** buffer: Buffer of data.
** dataLen: Length of data.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
@@ -582,7 +569,7 @@ private:
** buffer: Buffer of data to send.
** bufferLen: Length of data in buffer.
** actualLen: Actual length sent.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
@@ -616,7 +603,7 @@ public:
** Function: NfaConn
**
** Description: Initialize member variables.
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -640,13 +627,13 @@ public:
SyncEvent mConnRequestEvent; // for accept()
std::string mServiceName;
NfaConn *mServerConn[MAX_NFA_CONNS_PER_SERVER];
-
+
/*******************************************************************************
**
** Function: P2pServer
**
** Description: Initialize member variables.
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -659,7 +646,7 @@ public:
**
** Description: Find a P2pServer that has the handle.
** nfaConnHandle: NFA connection handle.
- **
+ **
** Returns: P2pServer object.
**
*******************************************************************************/
@@ -694,7 +681,7 @@ public:
** Function: P2pClient
**
** Description: Initialize member variables.
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -706,7 +693,7 @@ public:
** Function: ~P2pClient
**
** Description: Free all resources.
- **
+ **
** Returns: None
**
*******************************************************************************/
diff --git a/nci/jni/PowerSwitch.cpp b/nci/jni/PowerSwitch.cpp
index e5faaae..ba1a96b 100755
--- a/nci/jni/PowerSwitch.cpp
+++ b/nci/jni/PowerSwitch.cpp
@@ -8,6 +8,7 @@
** Proprietary and confidential.
**
*****************************************************************************/
+#include "OverrideLog.h"
#include "PowerSwitch.h"
#include "NfcJniUtil.h"
#include "config.h"
@@ -28,7 +29,7 @@ PowerSwitch PowerSwitch::sPowerSwitch;
** Function: PowerSwitch
**
** Description: Initialize member variables.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -40,13 +41,13 @@ PowerSwitch::PowerSwitch ()
{
}
-
+
/*******************************************************************************
**
** Function: ~PowerSwitch
**
** Description: Release all resources.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -60,7 +61,7 @@ PowerSwitch::~PowerSwitch ()
** Function: getInstance
**
** Description: Get the singleton of this object.
-**
+**
** Returns: Reference to this object.
**
*******************************************************************************/
@@ -75,7 +76,7 @@ PowerSwitch& PowerSwitch::getInstance ()
** Function: initialize
**
** Description: Initialize member variables.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -93,12 +94,12 @@ void PowerSwitch::initialize (PowerLevel level)
mCurrDeviceMgtPowerState = NFA_DM_PWR_MODE_FULL;
mCurrLevel = level;
break;
-
+
case UNKNOWN_LEVEL:
mCurrDeviceMgtPowerState = NFA_DM_PWR_STATE_UNKNOWN;
mCurrLevel = level;
break;
-
+
default:
ALOGE ("%s: not handled", fn);
break;
@@ -108,10 +109,10 @@ void PowerSwitch::initialize (PowerLevel level)
/*******************************************************************************
**
-** Function: getLevel
+** Function: getLevel
**
** Description: Get the current power level of the controller.
-**
+**
** Returns: Power level.
**
*******************************************************************************/
@@ -120,14 +121,14 @@ PowerSwitch::PowerLevel PowerSwitch::getLevel ()
return mCurrLevel;
}
-
+
/*******************************************************************************
**
** Function: setLevel
**
** Description: Set the controller's power level.
** level: power level.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -146,7 +147,7 @@ bool PowerSwitch::setLevel (PowerLevel newLevel)
if (mCurrDeviceMgtPowerState == NFA_DM_PWR_MODE_OFF_SLEEP)
retval = setPowerOffSleepState (false);
break;
-
+
case LOW_POWER:
case POWER_OFF:
if (isPowerOffSleepFeatureEnabled())
@@ -157,7 +158,7 @@ bool PowerSwitch::setLevel (PowerLevel newLevel)
retval = true;
}
break;
-
+
default:
ALOGE ("%s: not handled", fn);
break;
@@ -202,7 +203,7 @@ bool PowerSwitch::setScreenState(bool state)
**
** Description: Adjust controller's power-off-sleep state.
** sleep: whether to enter sleep state.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -245,12 +246,12 @@ bool PowerSwitch::setPowerOffSleepState (bool sleep)
}
else
{
- ALOGE ("%s: power is not ON; curr device mgt power state=%s (%u)", fn,
+ ALOGE ("%s: power is not ON; curr device mgt power state=%s (%u)", fn,
deviceMgtPowerStateToString (mCurrDeviceMgtPowerState), mCurrDeviceMgtPowerState);
goto TheEnd;
}
}
- else //exit power-off-sleep state
+ else //exit power-off-sleep state
{
//make sure the current power state is OFF
if (mCurrDeviceMgtPowerState != NFA_DM_PWR_MODE_FULL)
@@ -264,7 +265,7 @@ bool PowerSwitch::setPowerOffSleepState (bool sleep)
mPowerStateEvent.wait ();
if (mCurrDeviceMgtPowerState != NFA_DM_PWR_MODE_FULL)
{
- ALOGE ("%s: unable to full power; curr device mgt power stat=%s (%u)", fn,
+ ALOGE ("%s: unable to full power; curr device mgt power stat=%s (%u)", fn,
deviceMgtPowerStateToString (mCurrDeviceMgtPowerState), mCurrDeviceMgtPowerState);
goto TheEnd;
}
@@ -279,7 +280,7 @@ bool PowerSwitch::setPowerOffSleepState (bool sleep)
}
else
{
- ALOGE ("%s: not in power-off state; curr device mgt power state=%s (%u)", fn,
+ ALOGE ("%s: not in power-off state; curr device mgt power state=%s (%u)", fn,
deviceMgtPowerStateToString (mCurrDeviceMgtPowerState), mCurrDeviceMgtPowerState);
goto TheEnd;
}
@@ -296,9 +297,9 @@ TheEnd:
**
** Function: deviceMgtPowerStateToString
**
-** Description: Decode power level to a string.
+** Description: Decode power level to a string.
** deviceMgtPowerState: power level.
-**
+**
** Returns: Text representation of power level.
**
*******************************************************************************/
@@ -322,7 +323,7 @@ const char* PowerSwitch::deviceMgtPowerStateToString (UINT8 deviceMgtPowerState)
**
** Description: Decode power level to a string.
** level: power level.
-**
+**
** Returns: Text representation of power level.
**
*******************************************************************************/
@@ -349,7 +350,7 @@ const char* PowerSwitch::powerLevelToString (PowerLevel level)
** Function: abort
**
** Description: Abort and unblock currrent operation.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -369,7 +370,7 @@ void PowerSwitch::abort ()
** Description: Callback function for the stack.
** event: event ID.
** eventData: event's data.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -382,7 +383,7 @@ void PowerSwitch::deviceManagementCallback (UINT8 event, tNFA_DM_CBACK_DATA* eve
case NFA_DM_PWR_MODE_CHANGE_EVT:
{
tNFA_DM_PWR_MODE_CHANGE& power_mode = eventData->power_mode;
- ALOGD ("%s: NFA_DM_PWR_MODE_CHANGE_EVT; status=%u; device mgt power mode=%s (%u)", fn,
+ ALOGD ("%s: NFA_DM_PWR_MODE_CHANGE_EVT; status=%u; device mgt power mode=%s (%u)", fn,
power_mode.status, sPowerSwitch.deviceMgtPowerStateToString (power_mode.power_mode), power_mode.power_mode);
SyncEventGuard guard (sPowerSwitch.mPowerStateEvent);
if (power_mode.status == NFA_STATUS_OK)
@@ -399,12 +400,12 @@ void PowerSwitch::deviceManagementCallback (UINT8 event, tNFA_DM_CBACK_DATA* eve
** Function: isPowerOffSleepFeatureEnabled
**
** Description: Whether power-off-sleep feature is enabled in .conf file.
-**
+**
** Returns: True if feature is enabled.
**
*******************************************************************************/
bool PowerSwitch::isPowerOffSleepFeatureEnabled ()
{
- return mDesiredScreenOffPowerState == 0;
+ return mDesiredScreenOffPowerState == 0;
}
diff --git a/nci/jni/PowerSwitch.h b/nci/jni/PowerSwitch.h
index 09197f1..896133e 100755
--- a/nci/jni/PowerSwitch.h
+++ b/nci/jni/PowerSwitch.h
@@ -59,54 +59,54 @@ public:
** Function: PowerSwitch
**
** Description: Initialize member variables.
- **
+ **
** Returns: None
**
*******************************************************************************/
PowerSwitch ();
-
-
+
+
/*******************************************************************************
**
** Function: ~PowerSwitch
**
** Description: Release all resources.
- **
+ **
** Returns: None
**
*******************************************************************************/
~PowerSwitch ();
-
-
+
+
/*******************************************************************************
**
** Function: getInstance
**
** Description: Get the singleton of this object.
- **
+ **
** Returns: Reference to this object.
**
*******************************************************************************/
static PowerSwitch& getInstance ();
-
+
/*******************************************************************************
**
** Function: initialize
**
** Description: Initialize member variables.
- **
+ **
** Returns: None
**
*******************************************************************************/
void initialize (PowerLevel level);
-
-
+
+
/*******************************************************************************
**
- ** Function: getLevel
+ ** Function: getLevel
**
** Description: Get the current power level of the controller.
- **
+ **
** Returns: Power level.
**
*******************************************************************************/
@@ -124,19 +124,19 @@ public:
*******************************************************************************/
bool isScreenOn ();
-
+
/*******************************************************************************
**
** Function: setLevel
**
** Description: Set the controller's power level.
** level: power level.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
bool setLevel (PowerLevel level);
-
+
/*******************************************************************************
**
** Function: setScreenState
@@ -154,13 +154,13 @@ public:
** Function: abort
**
** Description: Abort and unblock currrent operation.
- **
+ **
** Returns: None
**
*******************************************************************************/
void abort ();
-
-
+
+
/*******************************************************************************
**
** Function: deviceManagementCallback
@@ -168,19 +168,19 @@ public:
** Description: Callback function for the stack.
** event: event ID.
** eventData: event's data.
- **
+ **
** Returns: None
**
*******************************************************************************/
static void deviceManagementCallback (UINT8 event, tNFA_DM_CBACK_DATA* eventData);
-
+
/*******************************************************************************
**
** Function: isPowerOffSleepFeatureEnabled
**
** Description: Whether power-off-sleep feature is enabled in .conf file.
- **
+ **
** Returns: True if feature is enabled.
**
*******************************************************************************/
@@ -194,41 +194,41 @@ private:
static PowerSwitch sPowerSwitch; //singleton object
static const UINT8 NFA_DM_PWR_STATE_UNKNOWN = -1; //device management power state power state is unknown
SyncEvent mPowerStateEvent;
-
-
+
+
/*******************************************************************************
**
** Function: setPowerOffSleepState
**
** Description: Adjust controller's power-off-sleep state.
** sleep: whether to enter sleep state.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
bool setPowerOffSleepState (bool sleep);
-
-
+
+
/*******************************************************************************
**
** Function: deviceMgtPowerStateToString
**
- ** Description: Decode power level to a string.
+ ** Description: Decode power level to a string.
** deviceMgtPowerState: power level.
- **
+ **
** Returns: Text representation of power level.
**
*******************************************************************************/
const char* deviceMgtPowerStateToString (UINT8 deviceMgtPowerState);
-
-
+
+
/*******************************************************************************
**
** Function: powerLevelToString
**
** Description: Decode power level to a string.
** level: power level.
- **
+ **
** Returns: Text representation of power level.
**
*******************************************************************************/
diff --git a/nci/jni/RouteDataSet.cpp b/nci/jni/RouteDataSet.cpp
index 6f6eff7..8985a90 100644
--- a/nci/jni/RouteDataSet.cpp
+++ b/nci/jni/RouteDataSet.cpp
@@ -8,7 +8,7 @@
** Proprietary and confidential.
**
*****************************************************************************/
-
+#include "OverrideLog.h"
#include "RouteDataSet.h"
#include "libxml/xmlmemory.h"
#include <errno.h>
@@ -88,7 +88,7 @@ const char* RouteDataSet::sConfigFile = "/param/route.xml";
** Function: ~RouteDataSet
**
** Description: Release all resources.
-**
+**
** Returns: None.
**
*******************************************************************************/
@@ -103,7 +103,7 @@ RouteDataSet::~RouteDataSet ()
** Function: initialize
**
** Description: Initialize resources.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -124,7 +124,7 @@ bool RouteDataSet::initialize ()
** Function: deleteDatabase
**
** Description: Delete all routes stored in all databases.
-**
+**
** Returns: None.
**
*******************************************************************************/
@@ -149,7 +149,7 @@ void RouteDataSet::deleteDatabase ()
** Function: import
**
** Description: Import data from an XML file. Fill the databases.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -164,7 +164,7 @@ bool RouteDataSet::import ()
strFilename += sConfigFile;
deleteDatabase ();
-
+
doc = xmlParseFile (strFilename.c_str());
if (doc == NULL)
{
@@ -218,7 +218,7 @@ bool RouteDataSet::import ()
node1 = node1->next;
} //loop through all elements in <Routes ...
retval = true;
-
+
TheEnd:
xmlFreeDoc (doc);
xmlCleanupParser ();
@@ -233,7 +233,7 @@ TheEnd:
**
** Description: Save XML data from a string into a file.
** routesXml: XML that represents routes.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -244,7 +244,7 @@ bool RouteDataSet::saveToFile (const char* routesXml)
size_t actualWritten = 0;
bool retval = false;
std::string filename (bcm_nfc_location);
-
+
filename.append (sConfigFile);
fh = fopen (filename.c_str (), "w");
if (fh == NULL)
@@ -252,14 +252,14 @@ bool RouteDataSet::saveToFile (const char* routesXml)
ALOGE ("%s: fail to open file", fn);
return false;
}
-
- actualWritten = fwrite (routesXml, sizeof(char), strlen(routesXml), fh);
+
+ actualWritten = fwrite (routesXml, sizeof(char), strlen(routesXml), fh);
retval = actualWritten == strlen(routesXml);
fclose (fh);
ALOGD ("%s: wrote %u bytes", fn, actualWritten);
if (retval == false)
ALOGE ("%s: error during write", fn);
-
+
//set file permission to
//owner read, write; group read; other read
chmod (filename.c_str (), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
@@ -269,11 +269,11 @@ bool RouteDataSet::saveToFile (const char* routesXml)
/*******************************************************************************
**
-** Function: loadFromFile
+** Function: loadFromFile
**
** Description: Load XML data from file into a string.
** routesXml: string to receive XML data.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -285,7 +285,7 @@ bool RouteDataSet::loadFromFile (std::string& routesXml)
char buffer [1024];
std::string filename (bcm_nfc_location);
- filename.append (sConfigFile);
+ filename.append (sConfigFile);
fh = fopen (filename.c_str (), "r");
if (fh == NULL)
{
diff --git a/nci/jni/RouteDataSet.h b/nci/jni/RouteDataSet.h
index 23fd958..63c88e4 100644
--- a/nci/jni/RouteDataSet.h
+++ b/nci/jni/RouteDataSet.h
@@ -158,37 +158,37 @@ public:
** Function: ~RouteDataSet
**
** Description: Release all resources.
- **
+ **
** Returns: None.
**
*******************************************************************************/
~RouteDataSet ();
-
-
+
+
/*******************************************************************************
**
** Function: initialize
**
** Description: Initialize resources.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
bool initialize ();
-
-
+
+
/*******************************************************************************
**
** Function: import
**
** Description: Import data from an XML file. Fill the database.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
bool import ();
-
-
+
+
/*******************************************************************************
**
** Function: getDatabase
@@ -201,27 +201,27 @@ public:
*******************************************************************************/
Database* getDatabase (DatabaseSelection selection);
-
+
/*******************************************************************************
**
** Function: saveToFile
**
** Description: Save XML data from a string into a file.
** routesXml: XML that represents routes.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
static bool saveToFile (const char* routesXml);
-
-
+
+
/*******************************************************************************
**
- ** Function: loadFromFile
+ ** Function: loadFromFile
**
** Description: Load XML data from file into a string.
** routesXml: string to receive XML data.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
@@ -249,20 +249,20 @@ public:
**
*******************************************************************************/
void printDiagnostic ();
-
+
private:
Database mSecElemRouteDatabase; //routes when NFC service selects sec elem
Database mDefaultRouteDatabase; //routes when NFC service deselects sec elem
static const char* sConfigFile;
static const bool sDebug = false;
-
+
/*******************************************************************************
**
** Function: deleteDatabase
**
** Description: Delete all routes stored in all databases.
- **
+ **
** Returns: None.
**
*******************************************************************************/
diff --git a/nci/jni/SecureElement.cpp b/nci/jni/SecureElement.cpp
index c3fb42f..76955f8 100755
--- a/nci/jni/SecureElement.cpp
+++ b/nci/jni/SecureElement.cpp
@@ -2,7 +2,7 @@
**
** Name: SecureElement.cpp
**
-** Description: Communicate with secure elements that are attached
+** Description: Communicate with secure elements that are attached
** to the NFC controller.
**
** Copyright (c) 2012, Broadcom Corp., All Rights Reserved.
@@ -11,6 +11,7 @@
*****************************************************************************/
#include <semaphore.h>
#include <errno.h>
+#include "OverrideLog.h"
#include "SecureElement.h"
#include "config.h"
#include "PowerSwitch.h"
@@ -48,7 +49,7 @@ SecureElement SecureElement::sSecElem;
** Function: SecureElement
**
** Description: Initialize member variables.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -61,7 +62,7 @@ SecureElement::SecureElement ()
mActualNumEe (0),
mNumEePresent(0),
mbNewEE (true), // by default we start w/thinking there are new EE
- mNewPipeId (0),
+ mNewPipeId (0),
mNewSourceGate (0),
mActiveSeOverride(0),
mCommandStatus (NFA_STATUS_OK),
@@ -81,7 +82,7 @@ SecureElement::SecureElement ()
** Function: ~SecureElement
**
** Description: Release all resources.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -95,7 +96,7 @@ SecureElement::~SecureElement ()
** Function: getInstance
**
** Description: Get the SecureElement singleton object.
-**
+**
** Returns: SecureElement object.
**
*******************************************************************************/
@@ -128,7 +129,7 @@ void SecureElement::setActiveSeOverride(UINT8 activeSeOverride)
**
** Description: Initialize all member variables.
** native: Native data.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -143,12 +144,12 @@ bool SecureElement::initialize (nfc_jni_native_data* native)
if (GetNumValue("NFA_HCI_DEFAULT_DEST_GATE", &num, sizeof(num)))
mDestinationGate = num;
- ALOGD ("%s: Default destination gate: %d", __FUNCTION__, mDestinationGate);
+ ALOGD ("%s: Default destination gate: %d", fn, mDestinationGate);
// active SE, if not set active all SEs
if (GetNumValue("ACTIVE_SE", &num, sizeof(num)))
mActiveSeOverride = num;
- ALOGD ("%s: Active SE override: %d", __FUNCTION__, mActiveSeOverride);
+ ALOGD ("%s: Active SE override: %d", fn, mActiveSeOverride);
mActiveEeHandle = NFA_HANDLE_INVALID;
mNfaHciHandle = NFA_HANDLE_INVALID;
@@ -169,7 +170,7 @@ bool SecureElement::initialize (nfc_jni_native_data* native)
return (false);
{
- SyncEventGuard guard (mEeRegisterEvent);
+ SyncEventGuard guard (mEeRegisterEvent);
ALOGD ("%s: try ee register", fn);
nfaStat = NFA_EeRegister (nfaEeCallback);
if (nfaStat != NFA_STATUS_OK)
@@ -187,7 +188,7 @@ bool SecureElement::initialize (nfc_jni_native_data* native)
{
ALOGD ("%s: Found HCI network, try hci register", fn);
- SyncEventGuard guard (mHciRegisterEvent);
+ SyncEventGuard guard (mHciRegisterEvent);
nfaStat = NFA_HciRegister ("brcm_jni", nfaHciCallback, TRUE);
if (nfaStat != NFA_STATUS_OK)
@@ -203,7 +204,7 @@ bool SecureElement::initialize (nfc_jni_native_data* native)
mRouteDataSet.initialize ();
mRouteDataSet.import (); //read XML file
HostAidRouter::getInstance().initialize ();
-
+
mIsInit = true;
ALOGD ("%s: exit", fn);
return (true);
@@ -215,7 +216,7 @@ bool SecureElement::initialize (nfc_jni_native_data* native)
** Function: finalize
**
** Description: Release all resources.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -250,7 +251,7 @@ void SecureElement::finalize ()
** Function: getEeInfo
**
** Description: Get latest information about execution environments from stack.
-**
+**
** Returns: True if at least 1 EE is available.
**
*******************************************************************************/
@@ -259,7 +260,7 @@ bool SecureElement::getEeInfo()
static const char fn [] = "SecureElement::getEeInfo";
ALOGD ("%s: enter; mbNewEE=%d, mActualNumEe=%d", fn, mbNewEE, mActualNumEe);
tNFA_STATUS nfaStat = NFA_STATUS_FAILED;
- UINT8 xx = 0, yy = 0;
+ UINT8 xx = 0, yy = 0;
// If mbNewEE is true then there is new EE info.
if (mbNewEE)
@@ -274,7 +275,7 @@ bool SecureElement::getEeInfo()
else
{
mbNewEE = false;
-
+
ALOGD ("%s: num EEs discovered: %u", fn, mActualNumEe);
if (mActualNumEe != 0)
{
@@ -308,7 +309,7 @@ bool SecureElement::getEeInfo()
**
** Description: Get the list of handles of all execution environments.
** e: Java Virtual Machine.
-**
+**
** Returns: List of handles of all execution environments.
**
*******************************************************************************/
@@ -335,13 +336,13 @@ jintArray SecureElement::getListOfEeHandles (JNIEnv* e)
int cnt = 0;
for (int ii = 0; ii < mActualNumEe && cnt < mNumEePresent; ii++)
{
- ALOGD ("%s: %u = 0x%X", fn, ii, mEeInfo[ii].ee_handle);
+ ALOGD ("%s: %u = 0x%X", fn, ii, mEeInfo[ii].ee_handle);
if ((mEeInfo[ii].num_interface == 0) || (mEeInfo[ii].ee_interface[0] == NCI_NFCEE_INTERFACE_HCI_ACCESS) )
{
continue;
}
- jj = mEeInfo[ii].ee_handle & ~NFA_HANDLE_GROUP_EE;
+ jj = mEeInfo[ii].ee_handle & ~NFA_HANDLE_GROUP_EE;
e->SetIntArrayRegion (list, cnt++, 1, &jj);
}
//e->DeleteLocalRef (list);
@@ -357,7 +358,7 @@ jintArray SecureElement::getListOfEeHandles (JNIEnv* e)
**
** Description: Turn on the secure element.
** seID: ID of secure element.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -374,13 +375,13 @@ bool SecureElement::activate (jint seID)
ALOGE ("%s: not init", fn);
return false;
}
-
+
if (mActiveEeHandle != NFA_HANDLE_INVALID)
{
ALOGD ("%s: already active", fn);
return true;
}
-
+
// Get Fresh EE info if needed.
if (! getEeInfo())
{
@@ -404,7 +405,7 @@ bool SecureElement::activate (jint seID)
//activate every discovered secure element
for (int index=0; index < mActualNumEe; index++)
{
- tNFA_EE_INFO& eeItem = mEeInfo[index];
+ tNFA_EE_INFO& eeItem = mEeInfo[index];
if ((eeItem.ee_handle == EE_HANDLE_0xF3) || (eeItem.ee_handle == EE_HANDLE_0xF4))
{
@@ -417,7 +418,7 @@ bool SecureElement::activate (jint seID)
numActivatedEe++;
continue;
}
-
+
{
SyncEventGuard guard (mEeSetModeEvent);
ALOGD ("%s: set EE mode activate; h=0x%X", fn, eeItem.ee_handle);
@@ -435,7 +436,7 @@ bool SecureElement::activate (jint seID)
for (UINT8 xx = 0; xx < mActualNumEe; xx++)
{
- if ((mEeInfo[xx].num_interface != 0) && (mEeInfo[xx].ee_interface[0] != NCI_NFCEE_INTERFACE_HCI_ACCESS) &&
+ if ((mEeInfo[xx].num_interface != 0) && (mEeInfo[xx].ee_interface[0] != NCI_NFCEE_INTERFACE_HCI_ACCESS) &&
(mEeInfo[xx].ee_status != NFC_NFCEE_STATUS_INACTIVE))
{
mActiveEeHandle = mEeInfo[xx].ee_handle;
@@ -454,7 +455,7 @@ bool SecureElement::activate (jint seID)
**
** Description: Turn off the secure element.
** seID: ID of secure element.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -576,7 +577,7 @@ TheEnd:
** Function: connectEE
**
** Description: Connect to the execution environment.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -590,7 +591,7 @@ bool SecureElement::connectEE ()
char pipeConfName[40];
tNFA_HANDLE eeHandle = mActiveEeHandle;
- ALOGD ("%s: enter, mActiveEeHandle: 0x%04x, SEID: 0x%x, pipe_gate_num=%d, use pipe=%d",
+ ALOGD ("%s: enter, mActiveEeHandle: 0x%04x, SEID: 0x%x, pipe_gate_num=%d, use pipe=%d",
fn, mActiveEeHandle, gSEId, gGatePipe, gUseStaticPipe);
if (!mIsInit)
@@ -636,7 +637,7 @@ bool SecureElement::connectEE ()
}
else
{
- ALOGD ("%s: Did not find value '%s' defined in the .conf", __FUNCTION__, pipeConfName);
+ ALOGD ("%s: Did not find value '%s' defined in the .conf", __FUNCTION__, pipeConfName);
}
}
else
@@ -699,7 +700,7 @@ bool SecureElement::connectEE ()
if (mNewSourceGate == 0)
{
ALOGD ("%s: allocate gate", fn);
- //allocate a source gate and store in mNewSourceGate
+ //allocate a source gate and store in mNewSourceGate
SyncEventGuard guard (mAllocateGateEvent);
if ((nfaStat = NFA_HciAllocGate (mNfaHciHandle)) != NFA_STATUS_OK)
{
@@ -723,7 +724,7 @@ bool SecureElement::connectEE ()
}
mCreatePipeEvent.wait ();
if (mCommandStatus != NFA_STATUS_OK)
- goto TheEnd;
+ goto TheEnd;
}
{
@@ -737,14 +738,14 @@ bool SecureElement::connectEE ()
}
mPipeOpenedEvent.wait ();
if (mCommandStatus != NFA_STATUS_OK)
- goto TheEnd;
+ goto TheEnd;
}
}
-
+
retVal = true;
TheEnd:
- mIsPiping = retVal;
+ mIsPiping = retVal;
if (!retVal)
{
// if open failed we need to de-allocate the gate
@@ -762,7 +763,7 @@ TheEnd:
**
** Description: Disconnect from the execution environment.
** seID: ID of secure element.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -792,13 +793,13 @@ bool SecureElement::disconnectEE (jint seID)
** Function: transceive
**
** Description: Send data to the secure element; read it's response.
-** xmitBuffer: Data to transmit.
+** xmitBuffer: Data to transmit.
** xmitBufferSize: Length of data.
** recvBuffer: Buffer to receive response.
** recvBufferMaxSize: Maximum size of buffer.
** recvBufferActualSize: Actual length of response.
** timeoutMillisec: timeout in millisecond.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -809,18 +810,18 @@ bool SecureElement::transceive (UINT8* xmitBuffer, INT32 xmitBufferSize, UINT8*
tNFA_STATUS nfaStat = NFA_STATUS_FAILED;
bool isSuccess = false;
bool waitOk = false;
-
+
ALOGD ("%s: enter; xmitBufferSize=%ld; recvBufferMaxSize=%ld; timeout=%ld", fn, xmitBufferSize, recvBufferMaxSize, timeoutMillisec);
- {
- SyncEventGuard guard (mTransceiveEvent);
+ {
+ SyncEventGuard guard (mTransceiveEvent);
mActualResponseSize = 0;
memset (mResponseData, 0, sizeof(mResponseData));
if ((mNewPipeId == STATIC_PIPE_0x70) || (mNewPipeId == STATIC_PIPE_0x71))
nfaStat = NFA_HciSendEvent (mNfaHciHandle, mNewPipeId, EVT_SEND_DATA, xmitBufferSize, xmitBuffer, sizeof(mResponseData), mResponseData);
else
nfaStat = NFA_HciSendEvent (mNfaHciHandle, mNewPipeId, NFA_HCI_EVT_POST_DATA, xmitBufferSize, xmitBuffer, sizeof(mResponseData), mResponseData);
-
+
if (nfaStat == NFA_STATUS_OK)
{
waitOk = mTransceiveEvent.wait (timeoutMillisec);
@@ -844,8 +845,8 @@ bool SecureElement::transceive (UINT8* xmitBuffer, INT32 xmitBufferSize, UINT8*
memcpy (recvBuffer, mResponseData, recvBufferActualSize);
isSuccess = true;
-
-TheEnd:
+
+TheEnd:
ALOGD ("%s: exit; isSuccess: %d; recvBufferActualSize: %ld", fn, isSuccess, recvBufferActualSize);
return (isSuccess);
}
@@ -857,7 +858,7 @@ TheEnd:
**
** Description: Notify the NFC service about RF field events from the stack.
** isActive: Whether any secure element is activated.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -897,7 +898,7 @@ void SecureElement::notifyRfFieldEvent (bool isActive)
**
** Description: Store a copy of the execution environment information from the stack.
** info: execution environment information.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -905,12 +906,12 @@ void SecureElement::storeUiccInfo (tNFA_EE_DISCOVER_REQ& info)
{
static const char fn [] = "SecureElement::storeUiccInfo";
ALOGD ("%s: Status: %u Num EE: %u", fn, info.status, info.num_ee);
-
+
SyncEventGuard guard (mUiccInfoEvent);
memcpy (&mUiccInfo, &info, sizeof(mUiccInfo));
for (UINT8 xx = 0; xx < info.num_ee; xx++)
{
- //for each technology (A, B, F, B'), print the bit field that shows
+ //for each technology (A, B, F, B'), print the bit field that shows
//what protocol(s) is support by that technology
ALOGD ("%s EE[%u] Handle: 0x%04x techA: 0x%02x techB: 0x%02x techF: 0x%02x techBprime: 0x%02x",
fn, xx, info.ee_disc_info[xx].ee_handle,
@@ -930,7 +931,7 @@ void SecureElement::storeUiccInfo (tNFA_EE_DISCOVER_REQ& info)
** Description: Get the ID of the secure element.
** eeHandle: Handle to the secure element.
** uid: Array to receive the ID.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -950,8 +951,8 @@ bool SecureElement::getUiccId (tNFA_HANDLE eeHandle, jbyteArray& uid)
findUiccByHandle (eeHandle);
//cannot get UID from the stack; nothing to do
-
-TheEnd:
+
+TheEnd:
mNativeData->vm->DetachCurrentThread ();
ALOGD ("%s: exit; ret=%u", fn, retval);
return retval;
@@ -965,7 +966,7 @@ TheEnd:
** Description: Get all the technologies supported by a secure element.
** eeHandle: Handle of secure element.
** techList: List to receive the technologies.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -976,7 +977,7 @@ bool SecureElement::getTechnologyList (tNFA_HANDLE eeHandle, jintArray& techList
bool retval = false;
JNIEnv* e = NULL;
jint theList = 0;
-
+
mNativeData->vm->AttachCurrentThread (&e, NULL);
if (e == NULL)
{
@@ -996,8 +997,8 @@ bool SecureElement::getTechnologyList (tNFA_HANDLE eeHandle, jintArray& techList
theList = TARGET_TYPE_ISO14443_3B;
else
theList = TARGET_TYPE_UNKNOWN;
-
-TheEnd:
+
+TheEnd:
mNativeData->vm->DetachCurrentThread ();
ALOGD ("%s: exit; ret=%u", fn, retval);
return retval;
@@ -1010,7 +1011,7 @@ TheEnd:
**
** Description: Adjust routes in the controller's listen-mode routing table.
** selection: which set of routes to configure the controller.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1035,7 +1036,7 @@ void SecureElement::adjustRoutes (RouteSelection selection)
goto TheEnd;
}
-
+
TheEnd:
NFA_EeUpdateNow (); //apply new routes now
ALOGD ("%s: exit", fn);
@@ -1047,7 +1048,7 @@ TheEnd:
** Function: applyRoutes
**
** Description: Read route data from file and apply them again.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1070,7 +1071,7 @@ void SecureElement::applyRoutes ()
**
** Description: Adjust default routing based on protocol in NFC listen mode.
** isRouteToEe: Whether routing to EE (true) or host (false).
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1080,7 +1081,7 @@ void SecureElement::adjustProtocolRoutes (RouteDataSet::Database* db, RouteSelec
ALOGD ("%s: enter", fn);
tNFA_STATUS nfaStat = NFA_STATUS_FAILED;
const tNFA_PROTOCOL_MASK protoMask = NFA_PROTOCOL_MASK_ISO_DEP;
-
+
///////////////////////
// delete route to host
///////////////////////
@@ -1226,7 +1227,7 @@ void SecureElement::adjustProtocolRoutes (RouteDataSet::Database* db, RouteSelec
**
** Description: Adjust default routing based on technology in NFC listen mode.
** isRouteToEe: Whether routing to EE (true) or host (false).
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1236,7 +1237,7 @@ void SecureElement::adjustTechnologyRoutes (RouteDataSet::Database* db, RouteSel
ALOGD ("%s: enter", fn);
tNFA_STATUS nfaStat = NFA_STATUS_FAILED;
const tNFA_TECHNOLOGY_MASK techMask = NFA_TECHNOLOGY_MASK_A | NFA_TECHNOLOGY_MASK_B;
-
+
///////////////////////
// delete route to host
///////////////////////
@@ -1383,7 +1384,7 @@ void SecureElement::adjustTechnologyRoutes (RouteDataSet::Database* db, RouteSel
** Description: Receive execution environment-related events from stack.
** event: Event code.
** eventData: Event data.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1412,7 +1413,7 @@ void SecureElement::nfaEeCallback (tNFA_EE_EVT event, tNFA_EE_CBACK_DATA* eventD
if (pEE)
{
pEE->ee_status ^= 1;
- ALOGD ("%s: NFA_EE_MODE_SET_EVT; pEE->ee_status: %s (0x%04x)", fn, SecureElement::eeStatusToString(pEE->ee_status), pEE->ee_status);
+ ALOGD ("%s: NFA_EE_MODE_SET_EVT; pEE->ee_status: %s (0x%04x)", fn, SecureElement::eeStatusToString(pEE->ee_status), pEE->ee_status);
}
else
ALOGE ("%s: NFA_EE_MODE_SET_EVT; EE: 0x%04x not found. mActiveEeHandle: 0x%04x", fn, eventData->mode_set.ee_handle, sSecElem.mActiveEeHandle);
@@ -1421,7 +1422,7 @@ void SecureElement::nfaEeCallback (tNFA_EE_EVT event, tNFA_EE_CBACK_DATA* eventD
sSecElem.mEeSetModeEvent.notifyOne();
}
break;
-
+
case NFA_EE_SET_TECH_CFG_EVT:
{
ALOGD ("%s: NFA_EE_SET_TECH_CFG_EVT; status=0x%X", fn, eventData->status);
@@ -1437,7 +1438,7 @@ void SecureElement::nfaEeCallback (tNFA_EE_EVT event, tNFA_EE_CBACK_DATA* eventD
sSecElem.mRoutingEvent.notifyOne ();
}
break;
-
+
case NFA_EE_ACTION_EVT:
{
tNFA_EE_ACTION& action = eventData->action;
@@ -1474,11 +1475,11 @@ void SecureElement::nfaEeCallback (tNFA_EE_EVT event, tNFA_EE_CBACK_DATA* eventD
eventData->discover_req.status, eventData->discover_req.num_ee);
sSecElem.storeUiccInfo (eventData->discover_req);
break;
-
+
case NFA_EE_NO_CB_ERR_EVT:
ALOGD ("%s: NFA_EE_NO_CB_ERR_EVT status=%u", fn, eventData->status);
break;
-
+
case NFA_EE_ADD_AID_EVT:
{
ALOGD ("%s: NFA_EE_ADD_AID_EVT status=%u", fn, eventData->status);
@@ -1494,10 +1495,10 @@ void SecureElement::nfaEeCallback (tNFA_EE_EVT event, tNFA_EE_CBACK_DATA* eventD
sSecElem.mAidAddRemoveEvent.notifyOne ();
}
break;
-
+
case NFA_EE_NEW_EE_EVT:
{
- ALOGD ("%s: NFA_EE_NEW_EE_EVT h=0x%X; status=%u", fn,
+ ALOGD ("%s: NFA_EE_NEW_EE_EVT h=0x%X; status=%u", fn,
eventData->new_ee.ee_handle, eventData->new_ee.ee_status);
// Indicate there are new EE
sSecElem.mbNewEE = true;
@@ -1515,7 +1516,7 @@ void SecureElement::nfaEeCallback (tNFA_EE_EVT event, tNFA_EE_CBACK_DATA* eventD
** Function getSeVerInfo
**
** Description Gets version information and id for a secure element. The
-** seIndex parmeter is the zero based index of the secure
+** seIndex parmeter is the zero based index of the secure
** element to get verion info for. The version infommation
** is returned as a string int the verInfo parameter.
**
@@ -1537,7 +1538,7 @@ bool SecureElement::getSeVerInfo(int seIndex, char * verInfo, int verInfoSz, UIN
if ((mEeInfo[seIndex].num_interface == 0) || (mEeInfo[seIndex].ee_interface[0] == NCI_NFCEE_INTERFACE_HCI_ACCESS) )
{
return false;
- }
+ }
strncpy(verInfo, "Version info not available", verInfoSz-1);
verInfo[verInfoSz-1] = '\0';
@@ -1556,7 +1557,7 @@ bool SecureElement::getSeVerInfo(int seIndex, char * verInfo, int verInfoSz, UIN
{
if (false == mVerInfoEvent.wait(200))
{
- ALOGE ("%s: wait response timeout", __FUNCTION__);
+ ALOGE ("%s: wait response timeout", __FUNCTION__);
}
else
{
@@ -1592,7 +1593,7 @@ UINT8 SecureElement::getActualNumEe()
** Description: Receive Host Controller Interface-related events from stack.
** event: Event code.
** eventData: Event data.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1631,7 +1632,7 @@ void SecureElement::nfaHciCallback (tNFA_HCI_EVT event, tNFA_HCI_EVT_DATA* event
sSecElem.mDeallocateGateEvent.notifyOne();
}
break;
-
+
case NFA_HCI_GET_GATE_PIPE_LIST_EVT:
{
ALOGD ("%s: NFA_HCI_GET_GATE_PIPE_LIST_EVT; status=0x%X; num_pipes: %u num_gates: %u", fn,
@@ -1666,7 +1667,7 @@ void SecureElement::nfaHciCallback (tNFA_HCI_EVT event, tNFA_HCI_EVT_DATA* event
case NFA_HCI_EVENT_SENT_EVT:
ALOGD ("%s: NFA_HCI_EVENT_SENT_EVT; status=0x%X", fn, eventData->evt_sent.status);
break;
-
+
case NFA_HCI_RSP_RCVD_EVT: //response received from secure element
{
tNFA_HCI_RSP_RCVD& rsp_rcvd = eventData->rsp_rcvd;
@@ -1728,7 +1729,7 @@ void SecureElement::nfaHciCallback (tNFA_HCI_EVT event, tNFA_HCI_EVT_DATA* event
**
** Description: Find information about an execution environment.
** eeHandle: Handle to execution environment.
-**
+**
** Returns: Information about an execution environment.
**
*******************************************************************************/
@@ -1748,7 +1749,7 @@ tNFA_EE_INFO *SecureElement::findEeByHandle (tNFA_HANDLE eeHandle)
** Function: getDefaultEeHandle
**
** Description: Get the handle to the execution environment.
-**
+**
** Returns: Handle to the execution environment.
**
*******************************************************************************/
@@ -1760,7 +1761,7 @@ tNFA_HANDLE SecureElement::getDefaultEeHandle ()
if ((mEeInfo[xx].num_interface != 0) && (mEeInfo[xx].ee_interface[0] != NCI_NFCEE_INTERFACE_HCI_ACCESS) )
return (mEeInfo[xx].ee_handle);
}
- return NFA_HANDLE_INVALID;
+ return NFA_HANDLE_INVALID;
}
@@ -1770,7 +1771,7 @@ tNFA_HANDLE SecureElement::getDefaultEeHandle ()
**
** Description: Find information about an execution environment.
** eeHandle: Handle of the execution environment.
- **
+ **
** Returns: Information about the execution environment.
**
*******************************************************************************/
@@ -1794,7 +1795,7 @@ tNFA_EE_DISCOVER_INFO *SecureElement::findUiccByHandle (tNFA_HANDLE eeHandle)
**
** Description: Convert status code to status text.
** status: Status code
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1820,7 +1821,7 @@ const char* SecureElement::eeStatusToString (UINT8 status)
** Description: Receive card-emulation related events from stack.
** event: Event code.
** eventData: Event data.
-**
+**
** Returns: None
**
*******************************************************************************/
@@ -1844,7 +1845,7 @@ void SecureElement::connectionEventHandler (UINT8 event, tNFA_CONN_EVT_DATA* eve
**
** Description: Adjust controller's listen-mode routing table so transactions
** are routed to the secure elements.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -1873,9 +1874,9 @@ bool SecureElement::routeToSecureElement ()
ALOGE ("%s: invalid EE handle", fn);
return false;
}
-
+
adjustRoutes (SecElemRoute);
-
+
{
unsigned long num = 0;
if (GetNumValue("UICC_LISTEN_TECH_MASK", &num, sizeof(num)))
@@ -1891,7 +1892,7 @@ bool SecureElement::routeToSecureElement ()
else
ALOGE ("%s: fail to start UICC listen", fn);
}
-
+
ALOGD ("%s: exit; ok=%u", fn, retval);
return retval;
}
@@ -1903,7 +1904,7 @@ bool SecureElement::routeToSecureElement ()
**
** Description: Adjust controller's listen-mode routing table so transactions
** are routed to the default destination.
-**
+**
** Returns: True if ok.
**
*******************************************************************************/
@@ -1939,7 +1940,7 @@ bool SecureElement::routeToDefault ()
}
adjustRoutes (DefaultRoute);
-
+
ALOGD ("%s: exit; ok=%u", fn, retval);
return retval;
}
@@ -1951,7 +1952,7 @@ bool SecureElement::routeToDefault ()
**
** Description: Whether controller is routing listen-mode events to
** secure elements or a pipe is connected.
-**
+**
** Returns: True if either case is true.
**
*******************************************************************************/
diff --git a/nci/jni/SecureElement.h b/nci/jni/SecureElement.h
index 8bfb8f5..ea1f568 100755
--- a/nci/jni/SecureElement.h
+++ b/nci/jni/SecureElement.h
@@ -2,7 +2,7 @@
**
** Name: SecureElement.h
**
-** Description: Communicate with secure elements that are attached
+** Description: Communicate with secure elements that are attached
** to the NFC controller.
**
** Copyright (c) 2012, Broadcom Corp., All Rights Reserved.
@@ -28,19 +28,19 @@ class SecureElement
{
public:
tNFA_HANDLE mActiveEeHandle;
-
+
/*******************************************************************************
**
** Function: getInstance
**
** Description: Get the SecureElement singleton object.
- **
+ **
** Returns: SecureElement object.
**
*******************************************************************************/
static SecureElement& getInstance ();
-
+
/*******************************************************************************
**
@@ -48,24 +48,24 @@ public:
**
** Description: Initialize all member variables.
** native: Native data.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
bool initialize (nfc_jni_native_data* native);
-
-
+
+
/*******************************************************************************
**
** Function: finalize
**
** Description: Release all resources.
- **
+ **
** Returns: None
**
*******************************************************************************/
void finalize ();
-
+
/*******************************************************************************
**
@@ -73,12 +73,12 @@ public:
**
** Description: Get the list of handles of all execution environments.
** e: Java Virtual Machine.
- **
+ **
** Returns: List of handles of all execution environments.
**
*******************************************************************************/
jintArray getListOfEeHandles (JNIEnv* e);
-
+
/*******************************************************************************
**
@@ -86,20 +86,20 @@ public:
**
** Description: Turn on the secure element.
** seID: ID of secure element.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
bool activate (jint seID);
-
+
/*******************************************************************************
**
** Function: deactivate
**
** Description: Turn off the secure element.
** seID: ID of secure element.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
@@ -111,7 +111,7 @@ public:
** Function: connectEE
**
** Description: Connect to the execution environment.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
@@ -124,7 +124,7 @@ public:
**
** Description: Disconnect from the execution environment.
** seID: ID of secure element.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
@@ -136,13 +136,13 @@ public:
** Function: transceive
**
** Description: Send data to the secure element; read it's response.
- ** xmitBuffer: Data to transmit.
+ ** xmitBuffer: Data to transmit.
** xmitBufferSize: Length of data.
** recvBuffer: Buffer to receive response.
** recvBufferMaxSize: Maximum size of buffer.
** recvBufferActualSize: Actual length of response.
** timeoutMillisec: timeout in millisecond
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
@@ -156,7 +156,7 @@ public:
**
** Description: Notify the NFC service about RF field events from the stack.
** isActive: Whether any secure element is activated.
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -169,7 +169,7 @@ public:
**
** Description: Store a copy of the execution environment information from the stack.
** info: execution environment information.
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -183,7 +183,7 @@ public:
** Description: Get the ID of the secure element.
** eeHandle: Handle to the secure element.
** uid: Array to receive the ID.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
@@ -197,7 +197,7 @@ public:
** Description: Get all the technologies supported by a secure element.
** eeHandle: Handle of secure element.
** techList: List to receive the technologies.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
@@ -211,7 +211,7 @@ public:
** Description: Notify the NFC service about a transaction event from secure element.
** aid: Buffer contains application ID.
** aidLen: Length of application ID.
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -240,7 +240,7 @@ public:
** Description: Receive card-emulation related events from stack.
** event: Event code.
** eventData: Event data.
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -253,7 +253,7 @@ public:
**
** Description: Read route data from XML and apply them again
** to every secure element.
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -272,39 +272,39 @@ public:
*******************************************************************************/
void setActiveSeOverride (UINT8 activeSeOverride);
-
+
/*******************************************************************************
**
** Function: routeToSecureElement
**
** Description: Adjust controller's listen-mode routing table so transactions
** are routed to the secure elements as specified in route.xml.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
bool routeToSecureElement ();
-
-
+
+
/*******************************************************************************
**
** Function: routeToDefault
**
** Description: Adjust controller's listen-mode routing table so transactions
** are routed to the default destination specified in route.xml.
- **
+ **
** Returns: True if ok.
**
*******************************************************************************/
bool routeToDefault ();
-
-
+
+
/*******************************************************************************
**
** Function: isBusy
**
** Description: Whether NFC controller is routing listen-mode events or a pipe is connected.
- **
+ **
** Returns: True if either case is true.
**
*******************************************************************************/
@@ -328,7 +328,7 @@ public:
** Function getSeVerInfo
**
** Description Gets version information and id for a secure element. The
- ** seIndex parmeter is the zero based index of the secure
+ ** seIndex parmeter is the zero based index of the secure
** element to get verion info for. The version infommation
** is returned as a string int the verInfo parameter.
**
@@ -345,10 +345,10 @@ private:
static const UINT8 STATIC_PIPE_0x70 = 0x70; //Broadcom's proprietary static pipe
static const UINT8 STATIC_PIPE_0x71 = 0x71; //Broadcom's proprietary static pipe
static const UINT8 EVT_SEND_DATA = 0x10; //see specification ETSI TS 102 622 v9.0.0 (Host Controller Interface); section 9.3.3.3
- static const tNFA_HANDLE EE_HANDLE_0xF3 = 0x4F3; //handle to secure element in slot 0
- static const tNFA_HANDLE EE_HANDLE_0xF4 = 0x4F4; //handle to secure element in slot 1
+ static const tNFA_HANDLE EE_HANDLE_0xF3 = 0x4F3; //handle to secure element in slot 0
+ static const tNFA_HANDLE EE_HANDLE_0xF4 = 0x4F4; //handle to secure element in slot 1
static SecureElement sSecElem;
-
+
UINT8 mDestinationGate; //destination gate of the UICC
tNFA_HANDLE mNfaHciHandle; //NFA handle to NFA's HCI component
nfc_jni_native_data* mNativeData;
@@ -409,7 +409,7 @@ private:
*******************************************************************************/
~SecureElement ();
-
+
/*******************************************************************************
**
** Function: nfaEeCallback
@@ -417,7 +417,7 @@ private:
** Description: Receive execution environment-related events from stack.
** event: Event code.
** eventData: Event data.
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -431,7 +431,7 @@ private:
** Description: Receive Host Controller Interface-related events from stack.
** event: Event code.
** eventData: Event data.
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -444,7 +444,7 @@ private:
**
** Description: Find information about an execution environment.
** eeHandle: Handle to execution environment.
- **
+ **
** Returns: Information about an execution environment.
**
*******************************************************************************/
@@ -457,7 +457,7 @@ private:
**
** Description: Find information about an execution environment.
** eeHandle: Handle of the execution environment.
- **
+ **
** Returns: Information about the execution environment.
**
*******************************************************************************/
@@ -469,33 +469,33 @@ private:
** Function: getDefaultEeHandle
**
** Description: Get the handle to the execution environment.
- **
+ **
** Returns: Handle to the execution environment.
**
*******************************************************************************/
tNFA_HANDLE getDefaultEeHandle ();
-
+
/*******************************************************************************
**
** Function: adjustRoutes
**
** Description: Adjust routes in the controller's listen-mode routing table.
** selection: which set of routes to configure the controller.
- **
+ **
** Returns: None
**
*******************************************************************************/
void adjustRoutes (RouteSelection selection);
-
+
/*******************************************************************************
**
** Function: adjustProtocolRoutes
**
** Description: Adjust default routing based on protocol in NFC listen mode.
** isRouteToEe: Whether routing to EE (true) or host (false).
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -508,7 +508,7 @@ private:
**
** Description: Adjust default routing based on technology in NFC listen mode.
** isRouteToEe: Whether routing to EE (true) or host (false).
- **
+ **
** Returns: None
**
*******************************************************************************/
@@ -520,12 +520,12 @@ private:
** Function: getEeInfo
**
** Description: Get latest information about execution environments from stack.
- **
+ **
** Returns: True if at least 1 EE is available.
**
*******************************************************************************/
bool getEeInfo ();
-
+
/*******************************************************************************
**
@@ -533,7 +533,7 @@ private:
**
** Description: Convert status code to status text.
** status: Status code
- **
+ **
** Returns: None
**
*******************************************************************************/
diff --git a/nci/jni/SyncEvent.h b/nci/jni/SyncEvent.h
index 5828569..5ab5d43 100644
--- a/nci/jni/SyncEvent.h
+++ b/nci/jni/SyncEvent.h
@@ -19,25 +19,25 @@ class SyncEvent
public:
/*******************************************************************************
**
- ** Function: ~SyncEvent
+ ** Function: ~SyncEvent
**
** Description: Cleanup all resources.
- **
+ **
** Returns: None.
**
*******************************************************************************/
- ~SyncEvent ()
+ ~SyncEvent ()
{
- mMutex.unlock ();
+ mMutex.unlock ();
}
-
+
/*******************************************************************************
**
** Function: start
**
- ** Description: Start a synchronization operation.
- **
+ ** Description: Start a synchronization operation.
+ **
** Returns: None.
**
*******************************************************************************/
@@ -46,71 +46,71 @@ public:
mMutex.lock ();
}
-
+
/*******************************************************************************
**
** Function: wait
**
** Description: Block the thread and wait for the event to occur.
- **
+ **
** Returns: None.
**
*******************************************************************************/
void wait ()
- {
+ {
mCondVar.wait (mMutex);
end ();
}
-
+
/*******************************************************************************
**
** Function: wait
**
** Description: Block the thread and wait for the event to occur.
** millisec: Timeout in milliseconds.
- **
+ **
** Returns: True if wait is successful; false if timeout occurs.
**
*******************************************************************************/
bool wait (long millisec)
- {
+ {
bool retVal = mCondVar.wait (mMutex, millisec);
end ();
return retVal;
}
-
+
/*******************************************************************************
**
- ** Function: notifyOne
+ ** Function: notifyOne
+ **
+ ** Description: Notify a blocked thread that the event has occured. Unblocks it.
**
- ** Description: Notify a blocked thread that the event has occured. Unblocks it.
- **
** Returns: None.
**
*******************************************************************************/
- void notifyOne ()
- {
- mCondVar.notifyOne ();
+ void notifyOne ()
+ {
+ mCondVar.notifyOne ();
end ();
}
-
+
/*******************************************************************************
**
- ** Function: end
+ ** Function: end
+ **
+ ** Description: End a synchronization operation.
**
- ** Description: End a synchronization operation.
- **
** Returns: None.
**
*******************************************************************************/
- void end ()
- {
+ void end ()
+ {
mMutex.unlock ();
}
-
+
private:
CondVar mCondVar;
Mutex mMutex;
@@ -133,10 +133,10 @@ class SyncEventGuard
public:
/*******************************************************************************
**
- ** Function: SyncEventGuard
+ ** Function: SyncEventGuard
**
** Description: Start a synchronization operation.
- **
+ **
** Returns: None.
**
*******************************************************************************/
@@ -145,14 +145,14 @@ public:
{
event.start (); //automatically start operation
};
-
+
/*******************************************************************************
**
- ** Function: ~SyncEventGuard
+ ** Function: ~SyncEventGuard
**
** Description: End a synchronization operation.
- **
+ **
** Returns: None.
**
*******************************************************************************/
@@ -160,7 +160,7 @@ public:
{
mEvent.end (); //automatically end operation
};
-
+
private:
SyncEvent& mEvent;
};