Merge "Reduce log clutter." into gingerbread
This commit is contained in:
committed by
Android (Google) Code Review
commit
2e2983c6ef
@@ -22,8 +22,17 @@
|
|||||||
#ifndef __ANDROID_NFC_H__
|
#ifndef __ANDROID_NFC_H__
|
||||||
#define __ANDROID_NFC_H__
|
#define __ANDROID_NFC_H__
|
||||||
|
|
||||||
|
#define LOG_TAG "NdefMessage"
|
||||||
|
#include <utils/Log.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
#define TRACE(...) LOG(LOG_DEBUG, "NdefMessage", __VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define TRACE(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct phFriNfc_NdefRecord {
|
typedef struct phFriNfc_NdefRecord {
|
||||||
uint8_t Flags;
|
uint8_t Flags;
|
||||||
uint8_t Tnf;
|
uint8_t Tnf;
|
||||||
|
|||||||
@@ -14,8 +14,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LOG_TAG "NdefMessage"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "jni.h"
|
#include "jni.h"
|
||||||
@@ -23,8 +21,6 @@
|
|||||||
|
|
||||||
#include "android_nfc.h"
|
#include "android_nfc.h"
|
||||||
|
|
||||||
#include <utils/Log.h>
|
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
|
|
||||||
static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o,
|
static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o,
|
||||||
@@ -53,7 +49,7 @@ static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Get the number of records in the message so we can allocate buffers */
|
/* Get the number of records in the message so we can allocate buffers */
|
||||||
LOGD("phFriNfc_NdefRecord_GetRecords(NULL)");
|
TRACE("phFriNfc_NdefRecord_GetRecords(NULL)");
|
||||||
|
|
||||||
status = phFriNfc_NdefRecord_GetRecords((uint8_t *)raw_msg,
|
status = phFriNfc_NdefRecord_GetRecords((uint8_t *)raw_msg,
|
||||||
(uint32_t)raw_msg_size, NULL, NULL, &num_of_records);
|
(uint32_t)raw_msg_size, NULL, NULL, &num_of_records);
|
||||||
@@ -62,9 +58,7 @@ static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o,
|
|||||||
LOGE("phFriNfc_NdefRecord_GetRecords(NULL) returned 0x%04x", status);
|
LOGE("phFriNfc_NdefRecord_GetRecords(NULL) returned 0x%04x", status);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
LOGD("phFriNfc_NdefRecord_GetRecords(NULL) returned 0x%04x", status);
|
TRACE("phFriNfc_NdefRecord_GetRecords(NULL) returned 0x%04x, with %d records", status, num_of_records);
|
||||||
|
|
||||||
LOGD("found %d records in message", num_of_records);
|
|
||||||
|
|
||||||
is_chunked = (uint8_t*)malloc(num_of_records);
|
is_chunked = (uint8_t*)malloc(num_of_records);
|
||||||
if (is_chunked == NULL)
|
if (is_chunked == NULL)
|
||||||
@@ -74,7 +68,7 @@ static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o,
|
|||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
/* Now, actually retrieve records position in message */
|
/* Now, actually retrieve records position in message */
|
||||||
LOGD("phFriNfc_NdefRecord_GetRecords()");
|
TRACE("phFriNfc_NdefRecord_GetRecords()");
|
||||||
|
|
||||||
status = phFriNfc_NdefRecord_GetRecords((uint8_t *)raw_msg,
|
status = phFriNfc_NdefRecord_GetRecords((uint8_t *)raw_msg,
|
||||||
(uint32_t)raw_msg_size, records, is_chunked, &num_of_records);
|
(uint32_t)raw_msg_size, records, is_chunked, &num_of_records);
|
||||||
@@ -83,7 +77,7 @@ static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o,
|
|||||||
LOGE("phFriNfc_NdefRecord_GetRecords() returned 0x%04x", status);
|
LOGE("phFriNfc_NdefRecord_GetRecords() returned 0x%04x", status);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
LOGD("phFriNfc_NdefRecord_GetRecords() returned 0x%04x", status);
|
TRACE("phFriNfc_NdefRecord_GetRecords() returned 0x%04x, with %d records", status, num_of_records);
|
||||||
|
|
||||||
/* Build NDEF records array */
|
/* Build NDEF records array */
|
||||||
record_cls = e->FindClass("android/nfc/NdefRecord");
|
record_cls = e->FindClass("android/nfc/NdefRecord");
|
||||||
@@ -94,13 +88,11 @@ static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o,
|
|||||||
|
|
||||||
ctor = e->GetMethodID(record_cls, "<init>", "(S[B[B[B)V");
|
ctor = e->GetMethodID(record_cls, "<init>", "(S[B[B[B)V");
|
||||||
|
|
||||||
LOGD("NFC_Number of records = %d\n", num_of_records);
|
|
||||||
|
|
||||||
for (i = 0; i < num_of_records; i++) {
|
for (i = 0; i < num_of_records; i++) {
|
||||||
jbyteArray type, id, payload;
|
jbyteArray type, id, payload;
|
||||||
jobject new_record;
|
jobject new_record;
|
||||||
|
|
||||||
LOGD("phFriNfc_NdefRecord_Parse()");
|
TRACE("phFriNfc_NdefRecord_Parse()");
|
||||||
|
|
||||||
status = phFriNfc_NdefRecord_Parse(&record, records[i]);
|
status = phFriNfc_NdefRecord_Parse(&record, records[i]);
|
||||||
|
|
||||||
@@ -108,7 +100,7 @@ static jint android_nfc_NdefMessage_parseNdefMessage(JNIEnv *e, jobject o,
|
|||||||
LOGE("phFriNfc_NdefRecord_Parse() returned 0x%04x", status);
|
LOGE("phFriNfc_NdefRecord_Parse() returned 0x%04x", status);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
LOGD("phFriNfc_NdefRecord_Parse() returned 0x%04x", status);
|
TRACE("phFriNfc_NdefRecord_Parse() returned 0x%04x", status);
|
||||||
|
|
||||||
type = e->NewByteArray(record.TypeLength);
|
type = e->NewByteArray(record.TypeLength);
|
||||||
if (type == NULL) {
|
if (type == NULL) {
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ static jbyteArray android_nfc_NdefRecord_generate(
|
|||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
LOGD("phFriNfc_NdefRecord_Generate()");
|
TRACE("phFriNfc_NdefRecord_Generate()");
|
||||||
|
|
||||||
status = phFriNfc_NdefRecord_Generate(&record, buf, buf_size,
|
status = phFriNfc_NdefRecord_Generate(&record, buf, buf_size,
|
||||||
&record_size);
|
&record_size);
|
||||||
@@ -63,7 +63,7 @@ static jbyteArray android_nfc_NdefRecord_generate(
|
|||||||
LOGE("phFriNfc_NdefRecord_Generate() returned 0x%04x", status);
|
LOGE("phFriNfc_NdefRecord_Generate() returned 0x%04x", status);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
LOGD("phFriNfc_NdefRecord_Generate() returned 0x%04x", status);
|
TRACE("phFriNfc_NdefRecord_Generate() returned 0x%04x", status);
|
||||||
|
|
||||||
result = e->NewByteArray(record_size);
|
result = e->NewByteArray(record_size);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
@@ -104,13 +104,13 @@ static jint android_nfc_NdefRecord_parseNdefRecord(JNIEnv *e, jobject o,
|
|||||||
goto clean_and_return;
|
goto clean_and_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGD("phFriNfc_NdefRecord_Parse()");
|
TRACE("phFriNfc_NdefRecord_Parse()");
|
||||||
status = phFriNfc_NdefRecord_Parse(&record, (uint8_t *)raw_record);
|
status = phFriNfc_NdefRecord_Parse(&record, (uint8_t *)raw_record);
|
||||||
if (status) {
|
if (status) {
|
||||||
LOGE("phFriNfc_NdefRecord_Parse() returned 0x%04x", status);
|
LOGE("phFriNfc_NdefRecord_Parse() returned 0x%04x", status);
|
||||||
goto clean_and_return;
|
goto clean_and_return;
|
||||||
}
|
}
|
||||||
LOGD("phFriNfc_NdefRecord_Parse() returned 0x%04x", status);
|
TRACE("phFriNfc_NdefRecord_Parse() returned 0x%04x", status);
|
||||||
|
|
||||||
/* Set TNF field */
|
/* Set TNF field */
|
||||||
mTnf = e->GetFieldID(record_cls, "mTnf", "S");
|
mTnf = e->GetFieldID(record_cls, "mTnf", "S");
|
||||||
|
|||||||
Reference in New Issue
Block a user