Replace error and tracing logs with standard log messages
am: 6767aec6e6
Change-Id: If6a7f8e7e734e9ae07e133093082eb34bbaf4aca
diff --git a/src/Android.bp b/src/Android.bp
index a69a6ab..44956be 100644
--- a/src/Android.bp
+++ b/src/Android.bp
@@ -13,6 +13,8 @@
"libmetricslogger",
"libpower",
"libz",
+ "libchrome",
+ "libbase",
// Treble configuration
"libhidlbase",
@@ -51,4 +53,11 @@
"gki/common/*.cc",
"gki/ulinux/*.cc",
],
+ product_variables: {
+ debuggable: {
+ cflags: [
+ "-DDCHECK_ALWAYS_ON"
+ ],
+ },
+ },
}
diff --git a/src/adaptation/CrcChecksum.cc b/src/adaptation/CrcChecksum.cc
index af20f6e..2c79c2f 100644
--- a/src/adaptation/CrcChecksum.cc
+++ b/src/adaptation/CrcChecksum.cc
@@ -24,9 +24,6 @@
#include <string>
#include "_OverrideLog.h"
-#undef LOG_TAG
-#define LOG_TAG "NfcNciHal"
-
static const unsigned short crctab[256] = {
0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241, 0xc601,
0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440, 0xcc01, 0x0cc0,
@@ -90,7 +87,8 @@
**
*******************************************************************************/
bool crcChecksumVerifyIntegrity(const char* filename) {
- ALOGD("%s: filename=%s", __func__, filename);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: filename=%s", __func__, filename);
bool isGood = FALSE;
int fileStream = open(filename, O_RDONLY);
if (fileStream >= 0) {
@@ -107,14 +105,15 @@
}
close(fileStream);
if ((actualReadCrc == sizeof(checksum)) && (data.size() > 0)) {
- ALOGD("%s: data size=%zu", __func__, data.size());
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: data size=%zu", __func__, data.size());
if (checksum ==
crcChecksumCompute((const unsigned char*)data.data(), data.size()))
isGood = TRUE;
else
- ALOGE("%s: checksum mismatch", __func__);
+ LOG(ERROR) << StringPrintf("%s: checksum mismatch", __func__);
} else
- ALOGE("%s: invalid length", __func__);
+ LOG(ERROR) << StringPrintf("%s: invalid length", __func__);
} else
isGood = TRUE; // assume file does not exist
return isGood;
diff --git a/src/adaptation/NfcAdaptation.cc b/src/adaptation/NfcAdaptation.cc
index f11521f..350a3bd 100644
--- a/src/adaptation/NfcAdaptation.cc
+++ b/src/adaptation/NfcAdaptation.cc
@@ -15,13 +15,13 @@
* limitations under the License.
*
******************************************************************************/
-#include "_OverrideLog.h"
-
+#include "NfcAdaptation.h"
#include <android/hardware/nfc/1.0/INfc.h>
#include <android/hardware/nfc/1.0/INfcClientCallback.h>
+#include <base/command_line.h>
#include <hwbinder/ProcessState.h>
#include <pthread.h>
-#include "NfcAdaptation.h"
+#include "_OverrideLog.h"
#include "debug_nfcsnoop.h"
#include "nfc_target.h"
@@ -34,9 +34,6 @@
#include "config.h"
#include "nfca_version.h"
-#undef LOG_TAG
-#define LOG_TAG "NfcAdaptation"
-
using android::OK;
using android::sp;
using android::status_t;
@@ -63,7 +60,7 @@
INfcClientCallback* NfcAdaptation::mCallback;
uint32_t ScrProtocolTraceFlag = SCR_PROTO_TRACE_ALL; // 0x017F00;
-uint8_t appl_trace_level = 0xff;
+bool nfc_debug_enabled = false;
uint8_t appl_dta_mode_flag = 0x00;
char bcm_nfc_location[120];
@@ -156,15 +153,24 @@
*******************************************************************************/
void NfcAdaptation::Initialize() {
const char* func = "NfcAdaptation::Initialize";
- ALOGD("%s: enter", func);
- ALOGE("%s: ver=%s nfa=%s", func, nfca_version_string, nfa_version_string);
unsigned long num;
+ const char* argv[] = {"libnfc_nci"};
+ // Init log tag
+ base::CommandLine::Init(1, argv);
+
+ // Android already logs thread_id, proc_id, timestamp, so disable those.
+ logging::SetLogItems(false, false, false, false);
+
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", func);
+ LOG(INFO) << StringPrintf("%s: ver=%s nfa=%s", func, nfca_version_string,
+ nfa_version_string);
if (GetNumValue(NAME_USE_RAW_NCI_TRACE, &num, sizeof(num))) {
if (num == 1) {
// display protocol traces in raw format
ProtoDispAdapterUseRawOutput(TRUE);
- ALOGD("%s: logging protocol in raw format", func);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: logging protocol in raw format", func);
}
}
if (!GetStrValue(NAME_NFA_STORAGE, bcm_nfc_location,
@@ -179,13 +185,15 @@
if (GetNumValue(NAME_NFA_MAX_EE_SUPPORTED, &num, sizeof(num))) {
nfa_ee_max_ee_cfg = num;
- ALOGD("%s: Overriding NFA_EE_MAX_EE_SUPPORTED to use %d", func,
- nfa_ee_max_ee_cfg);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: Overriding NFA_EE_MAX_EE_SUPPORTED to use %d",
+ func, nfa_ee_max_ee_cfg);
}
if (GetNumValue(NAME_NFA_POLL_BAIL_OUT_MODE, &num, sizeof(num))) {
nfa_poll_bail_out_mode = num;
- ALOGD("%s: Overriding NFA_POLL_BAIL_OUT_MODE to use %d", func,
- nfa_poll_bail_out_mode);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: Overriding NFA_POLL_BAIL_OUT_MODE to use %d", func,
+ nfa_poll_bail_out_mode);
}
if (GetStrValue(NAME_NFA_PROPRIETARY_CFG, (char*)nfa_proprietary_cfg,
@@ -212,7 +220,8 @@
verify_stack_non_volatile_store();
if (GetNumValue(NAME_PRESERVE_STORAGE, (char*)&num, sizeof(num)) &&
(num == 1))
- ALOGD("%s: preserve stack NV store", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: preserve stack NV store", __func__);
else {
delete_stack_non_volatile_store(FALSE);
}
@@ -232,7 +241,7 @@
memset(&mHalEntryFuncs, 0, sizeof(mHalEntryFuncs));
InitializeHalDeviceContext();
debug_nfcsnoop_init();
- ALOGD("%s: exit", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", func);
}
/*******************************************************************************
@@ -248,7 +257,7 @@
const char* func = "NfcAdaptation::Finalize";
AutoThreadMutex a(sLock);
- ALOGD("%s: enter", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", func);
GKI_shutdown();
resetConfig();
@@ -256,7 +265,7 @@
mCallback = NULL;
memset(&mHalEntryFuncs, 0, sizeof(mHalEntryFuncs));
- ALOGD("%s: exit", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", func);
delete this;
}
@@ -293,9 +302,9 @@
*******************************************************************************/
uint32_t NfcAdaptation::NFCA_TASK(uint32_t arg) {
const char* func = "NfcAdaptation::NFCA_TASK";
- ALOGD("%s: enter", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", func);
GKI_run(0);
- ALOGD("%s: exit", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", func);
return 0;
}
@@ -310,7 +319,7 @@
*******************************************************************************/
uint32_t NfcAdaptation::Thread(uint32_t arg) {
const char* func = "NfcAdaptation::Thread";
- ALOGD("%s: enter", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", func);
{
ThreadCondVar CondVar;
@@ -323,7 +332,7 @@
NfcAdaptation::GetInstance().signal();
GKI_exit_task(GKI_get_taskid());
- ALOGD("%s: exit", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", func);
return 0;
}
@@ -349,7 +358,7 @@
*******************************************************************************/
void NfcAdaptation::InitializeHalDeviceContext() {
const char* func = "NfcAdaptation::InitializeHalDeviceContext";
- ALOGD("%s: enter", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", func);
int ret = 0; // 0 means success
mHalEntryFuncs.initialize = HalInitialize;
@@ -362,12 +371,13 @@
mHalEntryFuncs.control_granted = HalControlGranted;
mHalEntryFuncs.power_cycle = HalPowerCycle;
mHalEntryFuncs.get_max_ee = HalGetMaxNfcee;
- ALOGI("%s: INfc::getService()", func);
+ LOG(INFO) << StringPrintf("%s: INfc::getService()", func);
mHal = INfc::getService();
LOG_FATAL_IF(mHal == nullptr, "Failed to retrieve the NFC HAL!");
- ALOGI("%s: INfc::getService() returned %p (%s)", func, mHal.get(),
- (mHal->isRemote() ? "remote" : "local"));
- ALOGD("%s: exit", func);
+ LOG(INFO) << StringPrintf("%s: INfc::getService() returned %p (%s)", func,
+ mHal.get(),
+ (mHal->isRemote() ? "remote" : "local"));
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", func);
}
/*******************************************************************************
@@ -382,7 +392,7 @@
*******************************************************************************/
void NfcAdaptation::HalInitialize() {
const char* func = "NfcAdaptation::HalInitialize";
- ALOGD("%s", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", func);
}
/*******************************************************************************
@@ -397,7 +407,7 @@
*******************************************************************************/
void NfcAdaptation::HalTerminate() {
const char* func = "NfcAdaptation::HalTerminate";
- ALOGD("%s", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", func);
}
/*******************************************************************************
@@ -412,7 +422,7 @@
void NfcAdaptation::HalOpen(tHAL_NFC_CBACK* p_hal_cback,
tHAL_NFC_DATA_CBACK* p_data_cback) {
const char* func = "NfcAdaptation::HalOpen";
- ALOGD("%s", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", func);
mCallback = new NfcClientCallback(p_hal_cback, p_data_cback);
mHal->open(mCallback);
}
@@ -428,7 +438,7 @@
*******************************************************************************/
void NfcAdaptation::HalClose() {
const char* func = "NfcAdaptation::HalClose";
- ALOGD("%s", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", func);
mHal->close();
}
@@ -445,7 +455,7 @@
void NfcAdaptation::HalDeviceContextCallback(nfc_event_t event,
nfc_status_t event_status) {
const char* func = "NfcAdaptation::HalDeviceContextCallback";
- ALOGD("%s: event=%u", func, event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: event=%u", func, event);
if (mHalCallback) mHalCallback(event, (tHAL_NFC_STATUS)event_status);
}
@@ -462,7 +472,8 @@
void NfcAdaptation::HalDeviceContextDataCallback(uint16_t data_len,
uint8_t* p_data) {
const char* func = "NfcAdaptation::HalDeviceContextDataCallback";
- ALOGD("%s: len=%u", func, data_len);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: len=%u", func, data_len);
if (mHalDataCallback) mHalDataCallback(data_len, p_data);
}
@@ -477,7 +488,7 @@
*******************************************************************************/
void NfcAdaptation::HalWrite(uint16_t data_len, uint8_t* p_data) {
const char* func = "NfcAdaptation::HalWrite";
- ALOGD("%s", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", func);
::android::hardware::nfc::V1_0::NfcData data;
data.setToExternal(p_data, data_len);
mHal->write(data);
@@ -495,7 +506,7 @@
void NfcAdaptation::HalCoreInitialized(uint16_t data_len,
uint8_t* p_core_init_rsp_params) {
const char* func = "NfcAdaptation::HalCoreInitialized";
- ALOGD("%s", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", func);
hidl_vec<uint8_t> data;
data.setToExternal(p_core_init_rsp_params, data_len);
@@ -518,7 +529,7 @@
*******************************************************************************/
bool NfcAdaptation::HalPrediscover() {
const char* func = "NfcAdaptation::HalPrediscover";
- ALOGD("%s", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", func);
bool retval = FALSE;
mHal->prediscover();
return retval;
@@ -539,7 +550,7 @@
*******************************************************************************/
void NfcAdaptation::HalControlGranted() {
const char* func = "NfcAdaptation::HalControlGranted";
- ALOGD("%s", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", func);
mHal->controlGranted();
}
@@ -554,7 +565,7 @@
*******************************************************************************/
void NfcAdaptation::HalPowerCycle() {
const char* func = "NfcAdaptation::HalPowerCycle";
- ALOGD("%s", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", func);
mHal->powerCycle();
}
@@ -570,7 +581,7 @@
uint8_t NfcAdaptation::HalGetMaxNfcee() {
const char* func = "NfcAdaptation::HalPowerCycle";
uint8_t maxNfcee = 0;
- ALOGD("%s", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", func);
return nfa_ee_max_ee_cfg;
}
@@ -586,21 +597,21 @@
*******************************************************************************/
void NfcAdaptation::DownloadFirmware() {
const char* func = "NfcAdaptation::DownloadFirmware";
- ALOGD("%s: enter", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", func);
HalInitialize();
mHalOpenCompletedEvent.lock();
- ALOGD("%s: try open HAL", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: try open HAL", func);
HalOpen(HalDownloadFirmwareCallback, HalDownloadFirmwareDataCallback);
mHalOpenCompletedEvent.wait();
mHalCloseCompletedEvent.lock();
- ALOGD("%s: try close HAL", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: try close HAL", func);
HalClose();
mHalCloseCompletedEvent.wait();
HalTerminate();
- ALOGD("%s: exit", func);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: exit", func);
}
/*******************************************************************************
@@ -615,15 +626,18 @@
void NfcAdaptation::HalDownloadFirmwareCallback(nfc_event_t event,
nfc_status_t event_status) {
const char* func = "NfcAdaptation::HalDownloadFirmwareCallback";
- ALOGD("%s: event=0x%X", func, event);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: event=0x%X", func, event);
switch (event) {
case HAL_NFC_OPEN_CPLT_EVT: {
- ALOGD("%s: HAL_NFC_OPEN_CPLT_EVT", func);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: HAL_NFC_OPEN_CPLT_EVT", func);
mHalOpenCompletedEvent.signal();
break;
}
case HAL_NFC_CLOSE_CPLT_EVT: {
- ALOGD("%s: HAL_NFC_CLOSE_CPLT_EVT", func);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: HAL_NFC_CLOSE_CPLT_EVT", func);
mHalCloseCompletedEvent.signal();
break;
}
diff --git a/src/adaptation/OverrideLog.cc b/src/adaptation/OverrideLog.cc
index 81beafc..84e784b 100644
--- a/src/adaptation/OverrideLog.cc
+++ b/src/adaptation/OverrideLog.cc
@@ -16,21 +16,12 @@
*
******************************************************************************/
-/******************************************************************************
- *
- * Override the ALOGD(), ALOGE(), and other logging macros from
- * /system/core/include/cutils/log.h
- *
- ******************************************************************************/
#include <cutils/properties.h>
#include <string.h>
#include "_OverrideLog.h"
#include "android_logmsg.h"
#include "config.h"
-#undef LOG_TAG
-#define LOG_TAG "BrcmNfcJni"
-
/*******************************************************************************
**
** Function: initializeGlobalAppLogLevel
@@ -40,12 +31,8 @@
** overrides .conf variable.
**
** Returns: Global log level:
-** BT_TRACE_LEVEL_NONE 0 * No trace messages to be generated
-** BT_TRACE_LEVEL_ERROR 1 * Error condition trace messages
-** BT_TRACE_LEVEL_WARNING 2 * Warning condition trace messages
-** BT_TRACE_LEVEL_API 3 * API traces
-** BT_TRACE_LEVEL_EVENT 4 * Debug messages for events
-** BT_TRACE_LEVEL_DEBUG 5 * Debug messages (general)
+** 0 * No trace messages to be generated
+** 1 * Debug messages
**
*******************************************************************************/
unsigned char initializeGlobalAppLogLevel() {
@@ -54,25 +41,24 @@
num = 1;
if (GetNumValue(NAME_APPL_TRACE_LEVEL, &num, sizeof(num)))
- appl_trace_level = (unsigned char)num;
+ nfc_debug_enabled = (num == 0) ? false : true;
int len = property_get("nfc.app_log_level", valueStr, "");
if (len > 0) {
// let Android property override .conf variable
sscanf(valueStr, "%lu", &num);
- appl_trace_level = (unsigned char)num;
+ nfc_debug_enabled = (num == 0) ? false : true;
}
- // 0xFF is a special value used by the stack to query the current
- // trace level; it does not change any trace level
- if (appl_trace_level == 0xFF) appl_trace_level = BT_TRACE_LEVEL_DEBUG;
- ALOGD("%s: level=%u", __func__, appl_trace_level);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: level=%u", __func__, nfc_debug_enabled);
- if (appl_trace_level < BT_TRACE_LEVEL_DEBUG) {
+ if (nfc_debug_enabled) {
// display protocol traces in raw format
ProtoDispAdapterUseRawOutput(TRUE);
}
- return appl_trace_level;
+
+ return nfc_debug_enabled;
}
uint32_t initializeProtocolLogLevel() {
@@ -96,5 +82,5 @@
void initializeGlobalAppDtaMode() {
appl_dta_mode_flag = 0x01;
- ALOGD("%s: DTA Enabled", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: DTA Enabled", __func__);
}
diff --git a/src/adaptation/android_logmsg.cc b/src/adaptation/android_logmsg.cc
index c7a7250..77b688d 100644
--- a/src/adaptation/android_logmsg.cc
+++ b/src/adaptation/android_logmsg.cc
@@ -55,8 +55,8 @@
if (!(ScrProtocolTraceFlag & SCR_PROTO_TRACE_NCI)) return;
char line_buf[(MAX_NCI_PACKET_SIZE * 2) + 1];
ToHex(nciPacket, nciPacketLen, line_buf, sizeof(line_buf));
- __android_log_write(ANDROID_LOG_DEBUG, (is_recv) ? "BrcmNciR" : "BrcmNciX",
- line_buf);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s:%s", is_recv ? "NciR" : "NciX", line_buf);
}
void ToHex(const uint8_t* data, uint16_t len, char* hexString,
@@ -166,7 +166,7 @@
uint8_t* data = (uint8_t*)p_buf;
int data_len = NFC_HDR_SIZE + p_buf->offset + p_buf->len;
- if (appl_trace_level < BT_TRACE_LEVEL_DEBUG) return;
+ if (!nfc_debug_enabled) return;
if (nBytes > sizeof(log_line)) return;
@@ -180,7 +180,7 @@
uint8_t* data = (uint8_t*)p_buf;
int data_len = NFC_HDR_SIZE + p_buf->offset + p_buf->len;
- if (appl_trace_level < BT_TRACE_LEVEL_DEBUG) return;
+ if (!nfc_debug_enabled) return;
if (nBytes > sizeof(log_line)) return;
@@ -202,13 +202,13 @@
uint8_t* data = (uint8_t*)p_buf;
int data_len = NFC_HDR_SIZE + p_buf->offset + p_buf->len;
- if (appl_trace_level < BT_TRACE_LEVEL_DEBUG) return;
+ if (!nfc_debug_enabled) return;
if (nBytes > sizeof(log_line)) return;
ToHex(data, data_len, log_line, sizeof(log_line));
- __android_log_write(ANDROID_LOG_DEBUG, (is_recv) ? "BrcmLlcpR" : "BrcmLlcpX",
- log_line);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s:%s", is_recv ? "LlcpR" : "LlcpX", log_line);
}
/***************************************************************************
@@ -223,7 +223,7 @@
void DispHcp(uint8_t* data, uint16_t len, bool is_recv) {
uint32_t nBytes = (len * 2) + 1;
- if (appl_trace_level < BT_TRACE_LEVEL_DEBUG) return;
+ if (!nfc_debug_enabled) return;
// Only trace HCP if we're tracing HCI as well
if (!(ScrProtocolTraceFlag & SCR_PROTO_TRACE_HCI_SUMMARY)) return;
@@ -231,8 +231,8 @@
if (nBytes > sizeof(log_line)) return;
ToHex(data, len, log_line, sizeof(log_line));
- __android_log_write(ANDROID_LOG_DEBUG, (is_recv) ? "BrcmHcpR" : "BrcmHcpX",
- log_line);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s:%s", is_recv ? "HcpR" : "HcpX", log_line);
}
void DispSNEP(uint8_t local_sap, uint8_t remote_sap, NFC_HDR* p_buf,
@@ -243,60 +243,3 @@
void DispCET4Tags(NFC_HDR* p_buf, bool is_rx) {}
void DispRWI93Tag(NFC_HDR* p_buf, bool is_rx, uint8_t command_to_respond) {}
void DispNDEFMsg(uint8_t* pMsg, uint32_t MsgLen, bool is_recv) {}
-
-/*******************************************************************************
-**
-** Function: LogMsg
-**
-** Description: Print messages from NFC stack.
-**
-** Returns: None.
-**
-*******************************************************************************/
-void LogMsg(uint32_t trace_set_mask, const char* fmt_str, ...) {
- static char buffer[BTE_LOG_BUF_SIZE];
- va_list ap;
- uint32_t trace_type =
- trace_set_mask & 0x07; // lower 3 bits contain trace type
- int android_log_type = ANDROID_LOG_INFO;
-
- va_start(ap, fmt_str);
- vsnprintf(buffer, BTE_LOG_MAX_SIZE, fmt_str, ap);
- va_end(ap);
- if (trace_type == TRACE_TYPE_ERROR) android_log_type = ANDROID_LOG_ERROR;
- __android_log_write(android_log_type, LOGMSG_TAG_NAME, buffer);
-}
-
-void LogMsg_0(uint32_t maskTraceSet, const char* p_str) {
- LogMsg(maskTraceSet, p_str);
-}
-
-void LogMsg_1(uint32_t maskTraceSet, const char* fmt_str, uintptr_t p1) {
- LogMsg(maskTraceSet, fmt_str, p1);
-}
-
-void LogMsg_2(uint32_t maskTraceSet, const char* fmt_str, uintptr_t p1,
- uintptr_t p2) {
- LogMsg(maskTraceSet, fmt_str, p1, p2);
-}
-
-void LogMsg_3(uint32_t maskTraceSet, const char* fmt_str, uintptr_t p1,
- uintptr_t p2, uintptr_t p3) {
- LogMsg(maskTraceSet, fmt_str, p1, p2, p3);
-}
-
-void LogMsg_4(uint32_t maskTraceSet, const char* fmt_str, uintptr_t p1,
- uintptr_t p2, uintptr_t p3, uintptr_t p4) {
- LogMsg(maskTraceSet, fmt_str, p1, p2, p3, p4);
-}
-
-void LogMsg_5(uint32_t maskTraceSet, const char* fmt_str, uintptr_t p1,
- uintptr_t p2, uintptr_t p3, uintptr_t p4, uintptr_t p5) {
- LogMsg(maskTraceSet, fmt_str, p1, p2, p3, p4, p5);
-}
-
-void LogMsg_6(uint32_t maskTraceSet, const char* fmt_str, uintptr_t p1,
- uintptr_t p2, uintptr_t p3, uintptr_t p4, uintptr_t p5,
- uintptr_t p6) {
- LogMsg(maskTraceSet, fmt_str, p1, p2, p3, p4, p5, p6);
-}
diff --git a/src/adaptation/config.cc b/src/adaptation/config.cc
index b2ebd72..1dc98e3 100644
--- a/src/adaptation/config.cc
+++ b/src/adaptation/config.cc
@@ -23,9 +23,6 @@
#include <vector>
#include "_OverrideLog.h"
-#undef LOG_TAG
-#define LOG_TAG "NfcAdaptation"
-
const char* transport_config_paths[] = {"/odm/etc/", "/vendor/etc/", "/etc/"};
const int transport_config_path_size =
(sizeof(transport_config_paths) / sizeof(transport_config_paths[0]));
@@ -188,15 +185,18 @@
state = BEGIN_LINE;
/* open config file, read it into a buffer */
if ((fd = fopen(name, "rb")) == NULL) {
- ALOGD("%s Cannot open config file %s\n", __func__, name);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s Cannot open config file %s", __func__, name);
if (bResetContent) {
- ALOGD("%s Using default value for all settings\n", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s Using default value for all settings", __func__);
mValidFile = false;
}
return false;
}
- ALOGD("%s Opened %s config %s\n", __func__,
- (bResetContent ? "base" : "optional"), name);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s Opened %s config %s", __func__,
+ (bResetContent ? "base" : "optional"), name);
mValidFile = true;
if (size() > 0) {
@@ -459,9 +459,11 @@
continue;
else if (**it == p_name) {
if ((*it)->str_len() > 0)
- ALOGD("%s found %s=%s\n", __func__, p_name, (*it)->str_value());
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "%s found %s=%s", __func__, p_name, (*it)->str_value());
else
- ALOGD("%s found %s=(0x%lX)\n", __func__, p_name, (*it)->numValue());
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "%s found %s=(0x%lX)", __func__, p_name, (*it)->numValue());
return *it;
} else
break;
diff --git a/src/adaptation/libmain.cc b/src/adaptation/libmain.cc
index bc78e6c..c46853c 100644
--- a/src/adaptation/libmain.cc
+++ b/src/adaptation/libmain.cc
@@ -85,12 +85,13 @@
strcpy(filename2, bcm_nfc_location);
strncat(filename2, sNfaStorageBin, sizeof(filename2) - strlen(filename2) - 1);
if (strlen(filename2) > 200) {
- ALOGE("%s: filename too long", __func__);
+ LOG(ERROR) << StringPrintf("%s: filename too long", __func__);
return;
}
sprintf(filename, "%s%u", filename2, block);
- ALOGD("%s: buffer len=%u; file=%s", __func__, nbytes, filename);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: buffer len=%u; file=%s", __func__, nbytes, filename);
int fileStream = open(filename, O_RDONLY);
if (fileStream >= 0) {
unsigned short checksum = 0;
@@ -98,14 +99,16 @@
size_t actualReadData = read(fileStream, pBuffer, nbytes);
close(fileStream);
if (actualReadData > 0) {
- ALOGD("%s: data size=%zu", __func__, actualReadData);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: data size=%zu", __func__, actualReadData);
nfa_nv_ci_read(actualReadData, NFA_NV_CO_OK, block);
} else {
- ALOGE("%s: fail to read", __func__);
+ LOG(ERROR) << StringPrintf("%s: fail to read", __func__);
nfa_nv_ci_read(0, NFA_NV_CO_FAIL, block);
}
} else {
- ALOGD("%s: fail to open", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: fail to open", __func__);
nfa_nv_ci_read(0, NFA_NV_CO_FAIL, block);
}
}
@@ -138,11 +141,12 @@
strcpy(filename2, bcm_nfc_location);
strncat(filename2, sNfaStorageBin, sizeof(filename2) - strlen(filename2) - 1);
if (strlen(filename2) > 200) {
- ALOGE("%s: filename too long", __func__);
+ LOG(ERROR) << StringPrintf("%s: filename too long", __func__);
return;
}
sprintf(filename, "%s%u", filename2, block);
- ALOGD("%s: bytes=%u; file=%s", __func__, nbytes, filename);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: bytes=%u; file=%s", __func__, nbytes, filename);
int fileStream = 0;
@@ -151,17 +155,18 @@
unsigned short checksum = crcChecksumCompute(pBuffer, nbytes);
size_t actualWrittenCrc = write(fileStream, &checksum, sizeof(checksum));
size_t actualWrittenData = write(fileStream, pBuffer, nbytes);
- ALOGD("%s: %zu bytes written", __func__, actualWrittenData);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: %zu bytes written", __func__, actualWrittenData);
if ((actualWrittenData == nbytes) &&
(actualWrittenCrc == sizeof(checksum))) {
nfa_nv_ci_write(NFA_NV_CO_OK);
} else {
- ALOGE("%s: fail to write", __func__);
+ LOG(ERROR) << StringPrintf("%s: fail to write", __func__);
nfa_nv_ci_write(NFA_NV_CO_FAIL);
}
close(fileStream);
} else {
- ALOGE("%s: fail to open, error = %d", __func__, errno);
+ LOG(ERROR) << StringPrintf("%s: fail to open, error = %d", __func__, errno);
nfa_nv_ci_write(NFA_NV_CO_FAIL);
}
}
@@ -184,14 +189,14 @@
if ((firstTime == false) && (forceDelete == false)) return;
firstTime = false;
- ALOGD("%s", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", __func__);
memset(filename, 0, sizeof(filename));
memset(filename2, 0, sizeof(filename2));
strcpy(filename2, bcm_nfc_location);
strncat(filename2, sNfaStorageBin, sizeof(filename2) - strlen(filename2) - 1);
if (strlen(filename2) > 200) {
- ALOGE("%s: filename too long", __func__);
+ LOG(ERROR) << StringPrintf("%s: filename too long", __func__);
return;
}
sprintf(filename, "%s%u", filename2, DH_NV_BLOCK);
@@ -218,7 +223,7 @@
**
*******************************************************************************/
void verify_stack_non_volatile_store() {
- ALOGD("%s", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", __func__);
char filename[256], filename2[256];
bool isValid = false;
@@ -227,7 +232,7 @@
strcpy(filename2, bcm_nfc_location);
strncat(filename2, sNfaStorageBin, sizeof(filename2) - strlen(filename2) - 1);
if (strlen(filename2) > 200) {
- ALOGE("%s: filename too long", __func__);
+ LOG(ERROR) << StringPrintf("%s: filename too long", __func__);
return;
}
diff --git a/src/gki/common/gki_buffer.cc b/src/gki/common/gki_buffer.cc
index f03fa1e..7a226cc 100644
--- a/src/gki/common/gki_buffer.cc
+++ b/src/gki/common/gki_buffer.cc
@@ -15,6 +15,8 @@
* limitations under the License.
*
******************************************************************************/
+#include <android-base/stringprintf.h>
+#include <base/logging.h>
#include <stdio.h>
#include "gki_int.h"
@@ -27,6 +29,7 @@
static void gki_remove_from_pool_list(uint8_t pool_id);
#endif /* BTU_STACK_LITE_ENABLED == FALSE */
+using android::base::StringPrintf;
/*******************************************************************************
**
** Function gki_init_free_queue
@@ -281,14 +284,14 @@
Q = &p_cb->freeq[p_cb->pool_list[i]];
if (Q->cur_cnt < Q->total) {
if (Q->p_first == 0 && gki_alloc_free_queue(i) != true) {
- GKI_TRACE_ERROR_0("GKI_getbuf() out of buffer");
+ LOG(ERROR) << StringPrintf("out of buffer");
GKI_enable();
return NULL;
}
if (Q->p_first == 0) {
/* gki_alloc_free_queue() failed to alloc memory */
- GKI_TRACE_ERROR_0("GKI_getbuf() fail alloc free queue");
+ LOG(ERROR) << StringPrintf("fail alloc free queue");
GKI_enable();
return NULL;
}
@@ -311,7 +314,7 @@
}
}
- GKI_TRACE_ERROR_0("GKI_getbuf() unable to allocate buffer!!!!!");
+ LOG(ERROR) << StringPrintf("unable to allocate buffer!!!!!");
GKI_enable();
@@ -350,7 +353,7 @@
if (Q->p_first == 0) {
/* gki_alloc_free_queue() failed to alloc memory */
- GKI_TRACE_ERROR_0("GKI_getpoolbuf() fail alloc free queue");
+ LOG(ERROR) << StringPrintf("fail alloc free queue");
return NULL;
}
diff --git a/src/gki/common/gki_time.cc b/src/gki/common/gki_time.cc
index 2cb136b..bf101cb 100644
--- a/src/gki/common/gki_time.cc
+++ b/src/gki/common/gki_time.cc
@@ -15,12 +15,11 @@
* limitations under the License.
*
******************************************************************************/
+#include <android-base/stringprintf.h>
+#include <base/logging.h>
+#include "_OverrideLog.h"
#include "gki_int.h"
-#ifndef BT_ERROR_TRACE_0
-#define BT_ERROR_TRACE_0(l, m)
-#endif
-
/* Make sure that this has been defined in target.h */
#ifndef GKI_NUM_TIMERS
#error NO TIMERS: Must define at least 1 timer in the system!
@@ -32,6 +31,7 @@
#define GKI_UNUSED_LIST_ENTRY (0x80000000L)
#define GKI_MAX_INT32 (0x7fffffffL)
+using android::base::StringPrintf;
/*******************************************************************************
**
** Function gki_timers_init
@@ -714,13 +714,13 @@
if (p_tle == p_target_tle) {
rem_ticks += p_tle->ticks;
} else {
- BT_ERROR_TRACE_0(TRACE_LAYER_GKI,
- "GKI_get_remaining_ticks: No timer entry in the list");
+ LOG(ERROR) << StringPrintf(
+ "GKI_get_remaining_ticks: No timer entry in the list");
return (0);
}
} else {
- BT_ERROR_TRACE_0(TRACE_LAYER_GKI,
- "GKI_get_remaining_ticks: timer entry is not active");
+ LOG(ERROR) << StringPrintf(
+ "GKI_get_remaining_ticks: timer entry is not active");
}
return (rem_ticks);
@@ -749,8 +749,9 @@
uint8_t tt;
TIMER_LIST_ENT* p_temp;
if (p_tle == NULL || p_timer_listq == NULL) {
- GKI_TRACE_3("%s: invalid argument %x, %x****************************<<",
- __func__, p_timer_listq, p_tle);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "%s: invalid argument %p, %p****************************<<", __func__,
+ p_timer_listq, p_tle);
return;
}
diff --git a/src/gki/ulinux/gki_ulinux.cc b/src/gki/ulinux/gki_ulinux.cc
index 79fdb48..c2a17ba 100644
--- a/src/gki/ulinux/gki_ulinux.cc
+++ b/src/gki/ulinux/gki_ulinux.cc
@@ -22,7 +22,7 @@
#include <pthread.h> /* must be 1st header defined */
#include <time.h>
-#include "bt_trace.h"
+#include "_OverrideLog.h"
#include "gki_int.h"
#include "gki_target.h"
@@ -89,36 +89,23 @@
void* gki_task_entry(void* params) {
pthread_t thread_id = pthread_self();
gki_pthread_info_t* p_pthread_info = (gki_pthread_info_t*)params;
- GKI_TRACE_5("gki_task_entry task_id=%i, thread_id=%x/%x, pCond/pMutex=%x/%x",
- p_pthread_info->task_id,
- gki_cb.os.thread_id[p_pthread_info->task_id], pthread_self(),
- p_pthread_info->pCond, p_pthread_info->pMutex);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "gki_task_entry task_id=%i, thread_id=%lx/%lx, pCond/pMutex=%p/%p",
+ p_pthread_info->task_id, gki_cb.os.thread_id[p_pthread_info->task_id],
+ pthread_self(), p_pthread_info->pCond, p_pthread_info->pMutex);
gki_cb.os.thread_id[p_pthread_info->task_id] = thread_id;
/* Call the actual thread entry point */
(p_pthread_info->task_entry)(p_pthread_info->params);
- GKI_TRACE_ERROR_1("gki_task task_id=%i terminating", p_pthread_info->task_id);
+ LOG(ERROR) << StringPrintf("gki_task task_id=%i terminating",
+ p_pthread_info->task_id);
gki_cb.os.thread_id[p_pthread_info->task_id] = 0;
return NULL;
}
/* end android */
-#ifndef ANDROID
-void GKI_TRACE(char* fmt, ...) {
- LOCK(gki_cb.os.GKI_trace_mutex);
- va_list ap;
-
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- fprintf(stderr, "\n");
-
- va_end(ap);
- UNLOCK(gki_cb.os.GKI_trace_mutex);
-}
-#endif
-
/*******************************************************************************
**
** Function GKI_init
@@ -209,12 +196,13 @@
pthread_condattr_init(&attr);
pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
- GKI_TRACE_5(
- "GKI_create_task func=0x%x id=%d name=%s stack=0x%x stackSize=%d",
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "GKI_create_task func=0x%p id=%d name=%s stack=0x%p stackSize=%d",
task_entry, task_id, taskname, stack, stacksize);
if (task_id >= GKI_MAX_TASKS) {
- GKI_TRACE_0("Error! task ID > max task allowed");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Error! task ID > max task allowed");
return (GKI_FAILURE);
}
@@ -234,10 +222,11 @@
#if (FALSE == GKI_PTHREAD_JOINABLE)
pthread_attr_setdetachstate(&attr1, PTHREAD_CREATE_DETACHED);
- GKI_TRACE_3("GKI creating task %i, pCond/pMutex=%x/%x", task_id, pCondVar,
- pMutex);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "GKI creating task %i, pCond/pMutex=%p/%p", task_id, pCondVar, pMutex);
#else
- GKI_TRACE_1("GKI creating JOINABLE task %i", task_id);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("GKI creating JOINABLE task %i", task_id);
#endif
/* On Android, the new tasks starts running before
@@ -254,7 +243,8 @@
&gki_pthread_info[task_id]);
if (ret != 0) {
- GKI_TRACE_2("pthread_create failed(%d), %s!", ret, taskname);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("pthread_create failed(%d), %s!", ret, taskname);
return GKI_FAILURE;
}
@@ -262,7 +252,8 @@
0) {
#if (PBS_SQL_TASK == TRUE)
if (task_id == PBS_SQL_TASK) {
- GKI_TRACE_0("PBS SQL lowest priority task");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("PBS SQL lowest priority task");
policy = SCHED_NORMAL;
} else
#endif
@@ -273,8 +264,9 @@
pthread_setschedparam(gki_cb.os.thread_id[task_id], policy, ¶m);
}
- GKI_TRACE_6("Leaving GKI_create_task %x %d %x %s %x %d", task_entry, task_id,
- gki_cb.os.thread_id[task_id], taskname, stack, stacksize);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Leaving GKI_create_task %p %d %lx %s %p %d", task_entry, task_id,
+ gki_cb.os.thread_id[task_id], taskname, stack, stacksize);
return (GKI_SUCCESS);
}
@@ -328,10 +320,12 @@
/* wait for proper Arnold Schwarzenegger task state */
result = pthread_join(gki_cb.os.thread_id[task_id - 1], NULL);
if (result < 0) {
- GKI_TRACE_1("pthread_join() FAILED: result: %d", result);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("FAILED: result: %d", result);
}
#endif
- GKI_TRACE_1("GKI_shutdown(): task %s dead", gki_cb.com.OSTName[task_id]);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("task %s dead", gki_cb.com.OSTName[task_id]);
GKI_exit_task(task_id - 1);
}
}
@@ -349,7 +343,8 @@
shutdown_timer = 1;
#endif
if (gki_cb.os.gki_timer_wake_lock_on) {
- GKI_TRACE_0("GKI_shutdown : release_wake_lock(brcm_btld)");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("GKI_shutdown : release_wake_lock(brcm_btld)");
release_wake_lock(WAKE_LOCK_ID);
gki_cb.os.gki_timer_wake_lock_on = 0;
}
@@ -383,9 +378,8 @@
*p_run_cond = GKI_TIMER_TICK_STOP_COND;
/* GKI_enable(); */
#ifdef GKI_TICK_TIMER_DEBUG
- BT_TRACE_1(TRACE_LAYER_HCI, TRACE_TYPE_DEBUG,
- ">>> STOP GKI_timer_update(), wake_lock_count:%d",
- --wake_lock_count);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf(">>> STOP wake_lock_count:%d", --wake_lock_count);
#endif
release_wake_lock(WAKE_LOCK_ID);
gki_cb.os.gki_timer_wake_lock_on = 0;
@@ -399,9 +393,8 @@
pthread_mutex_unlock(&p_os->gki_timer_mutex);
#ifdef GKI_TICK_TIMER_DEBUG
- BT_TRACE_1(TRACE_LAYER_HCI, TRACE_TYPE_DEBUG,
- ">>> START GKI_timer_update(), wake_lock_count:%d",
- ++wake_lock_count);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf(">>> START wake_lock_count:%d", ++wake_lock_count);
#endif
}
}
@@ -419,7 +412,7 @@
*******************************************************************************/
#ifdef NO_GKI_RUN_RETURN
void timer_thread(signed long id) {
- GKI_TRACE_1("%s enter", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s enter", __func__);
struct timespec delay;
int timeout = 1000; /* 10 ms per system tick */
int err;
@@ -436,7 +429,7 @@
GKI_timer_update(1);
}
- GKI_TRACE_ERROR_1("%s exit", __func__);
+ LOG(ERROR) << StringPrintf("%s exit", __func__);
return;
}
#endif
@@ -457,7 +450,7 @@
** should be empty.
*******************************************************************************/
void GKI_run(void* p_task_id) {
- GKI_TRACE_1("%s enter", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s enter", __func__);
struct timespec delay;
int err = 0;
volatile int* p_run_cond = &gki_cb.os.no_timer_suspend;
@@ -467,11 +460,13 @@
* timers are
* in any GKI/BTA/BTU this should save power when BTLD is idle! */
GKI_timer_queue_register_callback(gki_system_tick_start_stop_cback);
- APPL_TRACE_DEBUG0("GKI_run(): Start/Stop GKI_timer_update_registered!");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Start/Stop GKI_timer_update_registered!");
#endif
#ifdef NO_GKI_RUN_RETURN
- GKI_TRACE_0("GKI_run == NO_GKI_RUN_RETURN");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("GKI_run == NO_GKI_RUN_RETURN");
pthread_attr_t timer_attr;
shutdown_timer = 0;
@@ -479,11 +474,13 @@
pthread_attr_init(&timer_attr);
pthread_attr_setdetachstate(&timer_attr, PTHREAD_CREATE_DETACHED);
if (pthread_create(&timer_thread_id, &timer_attr, timer_thread, NULL) != 0) {
- GKI_TRACE_0("GKI_run: pthread_create failed to create timer_thread!");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "GKI_run: pthread_create failed to create timer_thread!");
return GKI_FAILURE;
}
#else
- GKI_TRACE_2("GKI_run, run_cond(%x)=%d ", p_run_cond, *p_run_cond);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("GKI_run, run_cond(%p)=%d ", p_run_cond, *p_run_cond);
for (; GKI_TIMER_TICK_EXIT_COND != *p_run_cond;) {
do {
/* adjust hear bit tick in btld by changning TICKS_PER_SEC!!!!! this
@@ -504,33 +501,32 @@
* e.g. power saving you may want to provide more ticks
*/
GKI_timer_update(1);
- /* BT_TRACE_2( TRACE_LAYER_HCI, TRACE_TYPE_DEBUG, "update: tv_sec: %d,
- * tv_nsec: %d", delay.tv_sec, delay.tv_nsec ); */
} while (GKI_TIMER_TICK_RUN_COND == *p_run_cond);
/* currently on reason to exit above loop is no_timer_suspend ==
* GKI_TIMER_TICK_STOP_COND
* block timer main thread till re-armed by */
#ifdef GKI_TICK_TIMER_DEBUG
- BT_TRACE_0(TRACE_LAYER_HCI, TRACE_TYPE_DEBUG,
- ">>> SUSPENDED GKI_timer_update()");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(">>> SUSPENDED");
#endif
if (GKI_TIMER_TICK_EXIT_COND != *p_run_cond) {
- GKI_TRACE_1("%s waiting timer mutex", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s waiting timer mutex", __func__);
pthread_mutex_lock(&gki_cb.os.gki_timer_mutex);
pthread_cond_wait(&gki_cb.os.gki_timer_cond, &gki_cb.os.gki_timer_mutex);
pthread_mutex_unlock(&gki_cb.os.gki_timer_mutex);
- GKI_TRACE_1("%s exited timer mutex", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s exited timer mutex", __func__);
}
/* potentially we need to adjust os gki_cb.com.OSTicks */
#ifdef GKI_TICK_TIMER_DEBUG
- BT_TRACE_1(TRACE_LAYER_HCI, TRACE_TYPE_DEBUG,
- ">>> RESTARTED GKI_timer_update(): run_cond: %d", *p_run_cond);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf(">>> RESTARTED run_cond: %d", *p_run_cond);
#endif
} /* for */
#endif
- GKI_TRACE_1("%s exit", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s exit", __func__);
}
/*******************************************************************************
@@ -584,18 +580,20 @@
int nano_sec;
rtask = GKI_get_taskid();
- GKI_TRACE_3("GKI_wait %d %x %d", rtask, flag, timeout);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("GKI_wait %d %x %d", rtask, flag, timeout);
if (rtask >= GKI_MAX_TASKS) {
- GKI_TRACE_ERROR_3("%s() Exiting thread; rtask %d >= %d", __func__, rtask,
- GKI_MAX_TASKS);
+ LOG(ERROR) << StringPrintf("%s() Exiting thread; rtask %d >= %d", __func__,
+ rtask, GKI_MAX_TASKS);
return EVENT_MASK(GKI_SHUTDOWN_EVT);
}
gki_pthread_info_t* p_pthread_info = &gki_pthread_info[rtask];
if (p_pthread_info->pCond != NULL && p_pthread_info->pMutex != NULL) {
int ret;
- GKI_TRACE_3("GKI_wait task=%i, pCond/pMutex = %x/%x", rtask,
- p_pthread_info->pCond, p_pthread_info->pMutex);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("GKI_wait task=%i, pCond/pMutex = %p/%p", rtask,
+ p_pthread_info->pCond, p_pthread_info->pMutex);
ret = pthread_mutex_lock(p_pthread_info->pMutex);
ret = pthread_cond_signal(p_pthread_info->pCond);
ret = pthread_mutex_unlock(p_pthread_info->pMutex);
@@ -674,7 +672,8 @@
/* unlock thread_evt_mutex as pthread_cond_wait() does auto lock when cond
* is met */
pthread_mutex_unlock(&gki_cb.os.thread_evt_mutex[rtask]);
- GKI_TRACE_ERROR_1("GKI TASK_DEAD received. exit thread %d...", rtask);
+ LOG(ERROR) << StringPrintf("GKI TASK_DEAD received. exit thread %d...",
+ rtask);
gki_cb.os.thread_id[rtask] = 0;
return (EVENT_MASK(GKI_SHUTDOWN_EVT));
@@ -693,7 +692,8 @@
/* unlock thread_evt_mutex as pthread_cond_wait() does auto lock mutex when
* cond is met */
pthread_mutex_unlock(&gki_cb.os.thread_evt_mutex[rtask]);
- GKI_TRACE_4("GKI_wait %d %x %d %x resumed", rtask, flag, timeout, evt);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "GKI_wait %d %x %d %x resumed", rtask, flag, timeout, evt);
return (evt);
}
@@ -717,7 +717,8 @@
struct timespec delay;
int err;
- GKI_TRACE_2("GKI_delay %d %d", rtask, timeout);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("GKI_delay %d %d", rtask, timeout);
delay.tv_sec = timeout / 1000;
delay.tv_nsec = 1000 * 1000 * (timeout % 1000);
@@ -736,7 +737,8 @@
if (rtask && gki_cb.com.OSRdyTbl[rtask] == TASK_DEAD) {
}
- GKI_TRACE_2("GKI_delay %d %d done", rtask, timeout);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("GKI_delay %d %d done", rtask, timeout);
return;
}
@@ -756,7 +758,8 @@
**
*******************************************************************************/
uint8_t GKI_send_event(uint8_t task_id, uint16_t event) {
- GKI_TRACE_2("GKI_send_event %d %x", task_id, event);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("GKI_send_event %d %x", task_id, event);
/* use efficient coding to avoid pipeline stalls */
if (task_id < GKI_MAX_TASKS) {
@@ -770,7 +773,8 @@
pthread_mutex_unlock(&gki_cb.os.thread_evt_mutex[task_id]);
- GKI_TRACE_2("GKI_send_event %d %x done", task_id, event);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("GKI_send_event %d %x done", task_id, event);
return (GKI_SUCCESS);
}
return (GKI_FAILURE);
@@ -797,8 +801,10 @@
**
*******************************************************************************/
uint8_t GKI_isend_event(uint8_t task_id, uint16_t event) {
- GKI_TRACE_2("GKI_isend_event %d %x", task_id, event);
- GKI_TRACE_2("GKI_isend_event %d %x done", task_id, event);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("GKI_isend_event %d %x", task_id, event);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("GKI_isend_event %d %x done", task_id, event);
return GKI_send_event(task_id, event);
}
@@ -822,12 +828,14 @@
pthread_t thread_id = pthread_self();
for (i = 0; i < GKI_MAX_TASKS; i++) {
if (gki_cb.os.thread_id[i] == thread_id) {
- GKI_TRACE_2("GKI_get_taskid %x %d done", thread_id, i);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("GKI_get_taskid %lx %d done", thread_id, i);
return (i);
}
}
- GKI_TRACE_1("GKI_get_taskid: thread id = %x, task id = -1", thread_id);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "GKI_get_taskid: thread id = %lx, task id = -1", thread_id);
return (-1);
}
@@ -850,11 +858,12 @@
**
*******************************************************************************/
int8_t* GKI_map_taskname(uint8_t task_id) {
- GKI_TRACE_1("GKI_map_taskname %d", task_id);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("GKI_map_taskname %d", task_id);
if (task_id < GKI_MAX_TASKS) {
- GKI_TRACE_2("GKI_map_taskname %d %s done", task_id,
- gki_cb.com.OSTName[task_id]);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "GKI_map_taskname %d %s done", task_id, gki_cb.com.OSTName[task_id]);
return (gki_cb.com.OSTName[task_id]);
} else if (task_id == GKI_MAX_TASKS) {
return (gki_cb.com.OSTName[GKI_get_taskid()]);
@@ -873,11 +882,11 @@
**
*******************************************************************************/
void GKI_enable(void) {
- GKI_TRACE_0("GKI_enable");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("GKI_enable");
pthread_mutex_unlock(&gki_cb.os.GKI_mutex);
/* pthread_mutex_xx is nesting save, no need for this: already_disabled =
* 0; */
- GKI_TRACE_0("Leaving GKI_enable");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("Leaving GKI_enable");
return;
}
@@ -892,14 +901,16 @@
*******************************************************************************/
void GKI_disable(void) {
- // GKI_TRACE_0("GKI_disable");
+ // DLOG_IF(INFO, nfc_debug_enabled) <<
+ // StringPrintf("GKI_disable");
/* pthread_mutex_xx is nesting save, no need for this: if
(!already_disabled) {
already_disabled = 1; */
pthread_mutex_lock(&gki_cb.os.GKI_mutex);
/* } */
- // GKI_TRACE_0("Leaving GKI_disable");
+ // DLOG_IF(INFO, nfc_debug_enabled) <<
+ // StringPrintf("Leaving GKI_disable");
return;
}
@@ -921,22 +932,22 @@
uint8_t task_id;
int i = 0;
- GKI_TRACE_ERROR_0("GKI_exception(): Task State Table");
+ LOG(ERROR) << StringPrintf("Task State Table");
for (task_id = 0; task_id < GKI_MAX_TASKS; task_id++) {
- GKI_TRACE_ERROR_3("TASK ID [%d] task name [%s] state [%d]", task_id,
- gki_cb.com.OSTName[task_id],
- gki_cb.com.OSRdyTbl[task_id]);
+ LOG(ERROR) << StringPrintf("TASK ID [%d] task name [%s] state [%d]",
+ task_id, gki_cb.com.OSTName[task_id],
+ gki_cb.com.OSRdyTbl[task_id]);
}
- GKI_TRACE_ERROR_2("GKI_exception %d %s", code, msg.c_str());
- GKI_TRACE_ERROR_0(
+ LOG(ERROR) << StringPrintf("%d %s", code, msg.c_str());
+ LOG(ERROR) << StringPrintf(
"********************************************************************");
- GKI_TRACE_ERROR_2("* GKI_exception(): %d %s", code, msg.c_str());
- GKI_TRACE_ERROR_0(
+ LOG(ERROR) << StringPrintf("* %d %s", code, msg.c_str());
+ LOG(ERROR) << StringPrintf(
"********************************************************************");
- GKI_TRACE_ERROR_2("GKI_exception %d %s done", code, msg.c_str());
+ LOG(ERROR) << StringPrintf("%d %s done", code, msg.c_str());
return;
}
@@ -1064,9 +1075,11 @@
**
*******************************************************************************/
uint8_t GKI_suspend_task(uint8_t task_id) {
- GKI_TRACE_1("GKI_suspend_task %d - NOT implemented", task_id);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("GKI_suspend_task %d - NOT implemented", task_id);
- GKI_TRACE_1("GKI_suspend_task %d done", task_id);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("GKI_suspend_task %d done", task_id);
return (GKI_SUCCESS);
}
@@ -1087,9 +1100,11 @@
**
*******************************************************************************/
uint8_t GKI_resume_task(uint8_t task_id) {
- GKI_TRACE_1("GKI_resume_task %d - NOT implemented", task_id);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("GKI_resume_task %d - NOT implemented", task_id);
- GKI_TRACE_1("GKI_resume_task %d done", task_id);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("GKI_resume_task %d done", task_id);
return (GKI_SUCCESS);
}
@@ -1123,7 +1138,8 @@
// GKI_send_event(task_id, EVENT_MASK(GKI_SHUTDOWN_EVT));
- GKI_TRACE_1("GKI_exit_task %d done", task_id);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("GKI_exit_task %d done", task_id);
return;
}
@@ -1142,7 +1158,7 @@
**
*******************************************************************************/
void GKI_sched_lock(void) {
- GKI_TRACE_0("GKI_sched_lock");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("GKI_sched_lock");
GKI_disable();
return;
}
@@ -1162,7 +1178,7 @@
**
*******************************************************************************/
void GKI_sched_unlock(void) {
- GKI_TRACE_0("GKI_sched_unlock");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("GKI_sched_unlock");
GKI_enable();
}
diff --git a/src/include/_OverrideLog.h b/src/include/_OverrideLog.h
index 7f28f3d..2c680e7 100644
--- a/src/include/_OverrideLog.h
+++ b/src/include/_OverrideLog.h
@@ -27,14 +27,13 @@
******************************************************************************/
#pragma once
-// Override Android's ALOGD macro by adding a boolean expression.
-#define ALOGD(...) \
- ((void)ALOGD_IF(appl_trace_level >= BT_TRACE_LEVEL_DEBUG, __VA_ARGS__))
-
-#include <cutils/log.h> //define Android logging macros
+#include <android-base/stringprintf.h>
+#include <base/logging.h>
#include "bt_types.h"
-extern unsigned char appl_trace_level;
+using android::base::StringPrintf;
+
+extern bool nfc_debug_enabled;
extern uint32_t ScrProtocolTraceFlag;
/* defined for run time DTA mode selection */
extern unsigned char appl_dta_mode_flag;
@@ -50,12 +49,8 @@
** overrides .conf variable.
**
** Returns: Global log level:
-** BT_TRACE_LEVEL_NONE 0 * No trace messages to be generated
-** BT_TRACE_LEVEL_ERROR 1 * Error condition trace messages
-** BT_TRACE_LEVEL_WARNING 2 * Warning condition trace messages
-** BT_TRACE_LEVEL_API 3 * API traces
-** BT_TRACE_LEVEL_EVENT 4 * Debug messages for events
-** BT_TRACE_LEVEL_DEBUG 5 * Debug messages (general)
+** 0 * No trace messages to be generated
+** 1 * Debug messages
**
*******************************************************************************/
unsigned char initializeGlobalAppLogLevel();
diff --git a/src/include/android_logmsg.h b/src/include/android_logmsg.h
index e033074..8920994 100644
--- a/src/include/android_logmsg.h
+++ b/src/include/android_logmsg.h
@@ -28,20 +28,6 @@
bool is_recv);
void ProtoDispAdapterUseRawOutput(bool isUseRaw);
void ScrLog(uint32_t trace_set_mask, const char* fmt_str, ...);
-void LogMsg(uint32_t trace_set_mask, const char* fmt_str, ...);
-void LogMsg_0(uint32_t trace_set_mask, const char* p_str);
-void LogMsg_1(uint32_t trace_set_mask, const char* fmt_str, uintptr_t p1);
-void LogMsg_2(uint32_t trace_set_mask, const char* fmt_str, uintptr_t p1,
- uintptr_t p2);
-void LogMsg_3(uint32_t trace_set_mask, const char* fmt_str, uintptr_t p1,
- uintptr_t p2, uintptr_t p3);
-void LogMsg_4(uint32_t trace_set_mask, const char* fmt_str, uintptr_t p1,
- uintptr_t p2, uintptr_t p3, uintptr_t p4);
-void LogMsg_5(uint32_t trace_set_mask, const char* fmt_str, uintptr_t p1,
- uintptr_t p2, uintptr_t p3, uintptr_t p4, uintptr_t p5);
-void LogMsg_6(uint32_t trace_set_mask, const char* fmt_str, uintptr_t p1,
- uintptr_t p2, uintptr_t p3, uintptr_t p4, uintptr_t p5,
- uintptr_t p6);
uint8_t* scru_dump_hex(uint8_t* p, char* pTitle, uint32_t len, uint32_t layer,
uint32_t type);
void BTDISP_LOCK_LOG();
diff --git a/src/include/bt_trace.h b/src/include/bt_trace.h
deleted file mode 100644
index a9177b7..0000000
--- a/src/include/bt_trace.h
+++ /dev/null
@@ -1,1867 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 1999-2012 Broadcom Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-#ifndef BT_TRACE_H
-#define BT_TRACE_H
-
-/* External declaration for appl_trace_level here to avoid to add the
- * declaration in all the files using APPL_TRACExxx macros */
-extern uint8_t appl_trace_level;
-
-/* Prototype for message logging function. */
-extern void LogMsg(uint32_t trace_set_mask, const char* fmt_str, ...);
-extern void LogMsg_0(uint32_t trace_set_mask, const char* p_str);
-extern void LogMsg_1(uint32_t trace_set_mask, const char* fmt_str,
- uintptr_t p1);
-extern void LogMsg_2(uint32_t trace_set_mask, const char* fmt_str, uintptr_t p1,
- uintptr_t p2);
-extern void LogMsg_3(uint32_t trace_set_mask, const char* fmt_str, uintptr_t p1,
- uintptr_t p2, uintptr_t p3);
-extern void LogMsg_4(uint32_t trace_set_mask, const char* fmt_str, uintptr_t p1,
- uintptr_t p2, uintptr_t p3, uintptr_t p4);
-extern void LogMsg_5(uint32_t trace_set_mask, const char* fmt_str, uintptr_t p1,
- uintptr_t p2, uintptr_t p3, uintptr_t p4, uintptr_t p5);
-extern void LogMsg_6(uint32_t trace_set_mask, const char* fmt_str, uintptr_t p1,
- uintptr_t p2, uintptr_t p3, uintptr_t p4, uintptr_t p5,
- uintptr_t p6);
-
-/******************************************************************************
-**
-** Trace configurable parameters
-**
-******************************************************************************/
-
-/* Enables or disables verbose trace information. */
-#ifndef BT_TRACE_VERBOSE
-#define BT_TRACE_VERBOSE FALSE
-#endif
-
-/* Enables or disables protocol trace information. */
-#ifndef BT_TRACE_PROTOCOL
-#define BT_TRACE_PROTOCOL TRUE /* Android requires TRUE */
-#endif
-
-/******************************************************************************
-**
-** Trace Levels
-**
-** The following values may be used for different levels:
-** BT_TRACE_LEVEL_NONE 0 * No trace messages to be generated
-** BT_TRACE_LEVEL_ERROR 1 * Error condition trace messages
-** BT_TRACE_LEVEL_WARNING 2 * Warning condition trace messages
-** BT_TRACE_LEVEL_API 3 * API traces
-** BT_TRACE_LEVEL_EVENT 4 * Debug messages for events
-** BT_TRACE_LEVEL_DEBUG 5 * Debug messages (general)
-******************************************************************************/
-
-/* Core Stack default trace levels */
-#ifndef HCI_INITIAL_TRACE_LEVEL
-#define HCI_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_DEBUG
-#endif
-
-#ifndef LLCP_INITIAL_TRACE_LEVEL
-#define LLCP_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_DEBUG
-#endif
-
-#ifndef APPL_INITIAL_TRACE_LEVEL
-#define APPL_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_DEBUG
-#endif
-
-#ifndef NFC_INITIAL_TRACE_LEVEL
-#define NFC_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_DEBUG
-#endif
-
-#ifndef SMP_INITIAL_TRACE_LEVEL
-#define SMP_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_DEBUG
-#endif
-
-#define BT_TRACE_0(l, t, m) \
- LogMsg_0((TRACE_CTRL_GENERAL | (l) | TRACE_ORG_STACK | (t)), (m))
-#define BT_TRACE_1(l, t, m, p1) \
- LogMsg_1(TRACE_CTRL_GENERAL | (l) | TRACE_ORG_STACK | (t), (m), \
- (uintptr_t)(p1))
-#define BT_TRACE_2(l, t, m, p1, p2) \
- LogMsg_2(TRACE_CTRL_GENERAL | (l) | TRACE_ORG_STACK | (t), (m), \
- (uintptr_t)(p1), (uintptr_t)(p2))
-#define BT_TRACE_3(l, t, m, p1, p2, p3) \
- LogMsg_3(TRACE_CTRL_GENERAL | (l) | TRACE_ORG_STACK | (t), (m), \
- (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3))
-#define BT_TRACE_4(l, t, m, p1, p2, p3, p4) \
- LogMsg_4(TRACE_CTRL_GENERAL | (l) | TRACE_ORG_STACK | (t), (m), \
- (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), (uintptr_t)(p4))
-#define BT_TRACE_5(l, t, m, p1, p2, p3, p4, p5) \
- LogMsg_5(TRACE_CTRL_GENERAL | (l) | TRACE_ORG_STACK | (t), (m), \
- (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), (uintptr_t)(p4), \
- (uintptr_t)(p5))
-#define BT_TRACE_6(l, t, m, p1, p2, p3, p4, p5, p6) \
- LogMsg_6(TRACE_CTRL_GENERAL | (l) | TRACE_ORG_STACK | (t), (m), \
- (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), (uintptr_t)(p4), \
- (uintptr_t)(p5), (uintptr_t)(p6))
-
-#define BT_ERROR_TRACE_0(l, m) \
- LogMsg_0(TRACE_CTRL_GENERAL | (l) | TRACE_ORG_STACK | TRACE_TYPE_ERROR, (m))
-#define BT_ERROR_TRACE_1(l, m, p1) \
- LogMsg_1(TRACE_CTRL_GENERAL | (l) | TRACE_ORG_STACK | TRACE_TYPE_ERROR, (m), \
- (uintptr_t)(p1))
-#define BT_ERROR_TRACE_2(l, m, p1, p2) \
- LogMsg_2(TRACE_CTRL_GENERAL | (l) | TRACE_ORG_STACK | TRACE_TYPE_ERROR, (m), \
- (uintptr_t)(p1), (uintptr_t)(p2))
-#define BT_ERROR_TRACE_3(l, m, p1, p2, p3) \
- LogMsg_3(TRACE_CTRL_GENERAL | (l) | TRACE_ORG_STACK | TRACE_TYPE_ERROR, (m), \
- (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3))
-
-/* Define tracing for the LLCP unit
-*/
-#define LLCP_TRACE_ERROR0(m) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_0(TRACE_LAYER_LLCP, TRACE_TYPE_ERROR, m); \
- }
-#define LLCP_TRACE_ERROR1(m, p1) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_1(TRACE_LAYER_LLCP, TRACE_TYPE_ERROR, m, p1); \
- }
-#define LLCP_TRACE_ERROR2(m, p1, p2) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_2(TRACE_LAYER_LLCP, TRACE_TYPE_ERROR, m, p1, p2); \
- }
-#define LLCP_TRACE_ERROR3(m, p1, p2, p3) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_3(TRACE_LAYER_LLCP, TRACE_TYPE_ERROR, m, p1, p2, p3); \
- }
-#define LLCP_TRACE_ERROR4(m, p1, p2, p3, p4) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_4(TRACE_LAYER_LLCP, TRACE_TYPE_ERROR, m, p1, p2, p3, p4); \
- }
-#define LLCP_TRACE_ERROR5(m, p1, p2, p3, p4, p5) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_5(TRACE_LAYER_LLCP, TRACE_TYPE_ERROR, m, p1, p2, p3, p4, p5); \
- }
-#define LLCP_TRACE_ERROR6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_6(TRACE_LAYER_LLCP, TRACE_TYPE_ERROR, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define LLCP_TRACE_WARNING0(m) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_0(TRACE_LAYER_LLCP, TRACE_TYPE_WARNING, m); \
- }
-#define LLCP_TRACE_WARNING1(m, p1) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_1(TRACE_LAYER_LLCP, TRACE_TYPE_WARNING, m, p1); \
- }
-#define LLCP_TRACE_WARNING2(m, p1, p2) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_2(TRACE_LAYER_LLCP, TRACE_TYPE_WARNING, m, p1, p2); \
- }
-#define LLCP_TRACE_WARNING3(m, p1, p2, p3) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_3(TRACE_LAYER_LLCP, TRACE_TYPE_WARNING, m, p1, p2, p3); \
- }
-#define LLCP_TRACE_WARNING4(m, p1, p2, p3, p4) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_4(TRACE_LAYER_LLCP, TRACE_TYPE_WARNING, m, p1, p2, p3, p4); \
- }
-#define LLCP_TRACE_WARNING5(m, p1, p2, p3, p4, p5) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_5(TRACE_LAYER_LLCP, TRACE_TYPE_WARNING, m, p1, p2, p3, p4, p5); \
- }
-#define LLCP_TRACE_WARNING6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_6(TRACE_LAYER_LLCP, TRACE_TYPE_WARNING, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define LLCP_TRACE_API0(m) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_0(TRACE_LAYER_LLCP, TRACE_TYPE_API, m); \
- }
-#define LLCP_TRACE_API1(m, p1) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_1(TRACE_LAYER_LLCP, TRACE_TYPE_API, m, p1); \
- }
-#define LLCP_TRACE_API2(m, p1, p2) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_2(TRACE_LAYER_LLCP, TRACE_TYPE_API, m, p1, p2); \
- }
-#define LLCP_TRACE_API3(m, p1, p2, p3) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_3(TRACE_LAYER_LLCP, TRACE_TYPE_API, m, p1, p2, p3); \
- }
-#define LLCP_TRACE_API4(m, p1, p2, p3, p4) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_4(TRACE_LAYER_LLCP, TRACE_TYPE_API, m, p1, p2, p3, p4); \
- }
-#define LLCP_TRACE_API5(m, p1, p2, p3, p4, p5) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_5(TRACE_LAYER_LLCP, TRACE_TYPE_API, m, p1, p2, p3, p4, p5); \
- }
-#define LLCP_TRACE_API6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_6(TRACE_LAYER_LLCP, TRACE_TYPE_API, m, p1, p2, p3, p4, p5, p6); \
- }
-
-#define LLCP_TRACE_EVENT0(m) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_0(TRACE_LAYER_LLCP, TRACE_TYPE_EVENT, m); \
- }
-#define LLCP_TRACE_EVENT1(m, p1) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_1(TRACE_LAYER_LLCP, TRACE_TYPE_EVENT, m, p1); \
- }
-#define LLCP_TRACE_EVENT2(m, p1, p2) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_2(TRACE_LAYER_LLCP, TRACE_TYPE_EVENT, m, p1, p2); \
- }
-#define LLCP_TRACE_EVENT3(m, p1, p2, p3) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_3(TRACE_LAYER_LLCP, TRACE_TYPE_EVENT, m, p1, p2, p3); \
- }
-#define LLCP_TRACE_EVENT4(m, p1, p2, p3, p4) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_4(TRACE_LAYER_LLCP, TRACE_TYPE_EVENT, m, p1, p2, p3, p4); \
- }
-#define LLCP_TRACE_EVENT5(m, p1, p2, p3, p4, p5) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_5(TRACE_LAYER_LLCP, TRACE_TYPE_EVENT, m, p1, p2, p3, p4, p5); \
- }
-#define LLCP_TRACE_EVENT6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_6(TRACE_LAYER_LLCP, TRACE_TYPE_EVENT, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define LLCP_TRACE_DEBUG0(m) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_0(TRACE_LAYER_LLCP, TRACE_TYPE_DEBUG, m); \
- }
-#define LLCP_TRACE_DEBUG1(m, p1) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_1(TRACE_LAYER_LLCP, TRACE_TYPE_DEBUG, m, p1); \
- }
-#define LLCP_TRACE_DEBUG2(m, p1, p2) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_2(TRACE_LAYER_LLCP, TRACE_TYPE_DEBUG, m, p1, p2); \
- }
-#define LLCP_TRACE_DEBUG3(m, p1, p2, p3) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_3(TRACE_LAYER_LLCP, TRACE_TYPE_DEBUG, m, p1, p2, p3); \
- }
-#define LLCP_TRACE_DEBUG4(m, p1, p2, p3, p4) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_4(TRACE_LAYER_LLCP, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4); \
- }
-#define LLCP_TRACE_DEBUG5(m, p1, p2, p3, p4, p5) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_5(TRACE_LAYER_LLCP, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4, p5); \
- }
-#define LLCP_TRACE_DEBUG6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (llcp_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_6(TRACE_LAYER_LLCP, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-/* Define tracing for the NFC unit
-*/
-#define NFC_TRACE_ERROR0(m) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_0(TRACE_LAYER_NFC, TRACE_TYPE_ERROR, m); \
- }
-#define NFC_TRACE_ERROR1(m, p1) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_1(TRACE_LAYER_NFC, TRACE_TYPE_ERROR, m, p1); \
- }
-#define NFC_TRACE_ERROR2(m, p1, p2) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_2(TRACE_LAYER_NFC, TRACE_TYPE_ERROR, m, p1, p2); \
- }
-#define NFC_TRACE_ERROR3(m, p1, p2, p3) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_3(TRACE_LAYER_NFC, TRACE_TYPE_ERROR, m, p1, p2, p3); \
- }
-#define NFC_TRACE_ERROR4(m, p1, p2, p3, p4) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_4(TRACE_LAYER_NFC, TRACE_TYPE_ERROR, m, p1, p2, p3, p4); \
- }
-#define NFC_TRACE_ERROR5(m, p1, p2, p3, p4, p5) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_5(TRACE_LAYER_NFC, TRACE_TYPE_ERROR, m, p1, p2, p3, p4, p5); \
- }
-#define NFC_TRACE_ERROR6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_6(TRACE_LAYER_NFC, TRACE_TYPE_ERROR, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define NFC_TRACE_WARNING0(m) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_0(TRACE_LAYER_NFC, TRACE_TYPE_WARNING, m); \
- }
-#define NFC_TRACE_WARNING1(m, p1) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_1(TRACE_LAYER_NFC, TRACE_TYPE_WARNING, m, p1); \
- }
-#define NFC_TRACE_WARNING2(m, p1, p2) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_2(TRACE_LAYER_NFC, TRACE_TYPE_WARNING, m, p1, p2); \
- }
-#define NFC_TRACE_WARNING3(m, p1, p2, p3) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_3(TRACE_LAYER_NFC, TRACE_TYPE_WARNING, m, p1, p2, p3); \
- }
-#define NFC_TRACE_WARNING4(m, p1, p2, p3, p4) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_4(TRACE_LAYER_NFC, TRACE_TYPE_WARNING, m, p1, p2, p3, p4); \
- }
-#define NFC_TRACE_WARNING5(m, p1, p2, p3, p4, p5) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_5(TRACE_LAYER_NFC, TRACE_TYPE_WARNING, m, p1, p2, p3, p4, p5); \
- }
-#define NFC_TRACE_WARNING6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_6(TRACE_LAYER_NFC, TRACE_TYPE_WARNING, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define NFC_TRACE_API0(m) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_0(TRACE_LAYER_NFC, TRACE_TYPE_API, m); \
- }
-#define NFC_TRACE_API1(m, p1) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_1(TRACE_LAYER_NFC, TRACE_TYPE_API, m, p1); \
- }
-#define NFC_TRACE_API2(m, p1, p2) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_2(TRACE_LAYER_NFC, TRACE_TYPE_API, m, p1, p2); \
- }
-#define NFC_TRACE_API3(m, p1, p2, p3) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_3(TRACE_LAYER_NFC, TRACE_TYPE_API, m, p1, p2, p3); \
- }
-#define NFC_TRACE_API4(m, p1, p2, p3, p4) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_4(TRACE_LAYER_NFC, TRACE_TYPE_API, m, p1, p2, p3, p4); \
- }
-#define NFC_TRACE_API5(m, p1, p2, p3, p4, p5) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_5(TRACE_LAYER_NFC, TRACE_TYPE_API, m, p1, p2, p3, p4, p5); \
- }
-#define NFC_TRACE_API6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_6(TRACE_LAYER_NFC, TRACE_TYPE_API, m, p1, p2, p3, p4, p5, p6); \
- }
-
-#define NFC_TRACE_EVENT0(m) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_0(TRACE_LAYER_NFC, TRACE_TYPE_EVENT, m); \
- }
-#define NFC_TRACE_EVENT1(m, p1) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_1(TRACE_LAYER_NFC, TRACE_TYPE_EVENT, m, p1); \
- }
-#define NFC_TRACE_EVENT2(m, p1, p2) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_2(TRACE_LAYER_NFC, TRACE_TYPE_EVENT, m, p1, p2); \
- }
-#define NFC_TRACE_EVENT3(m, p1, p2, p3) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_3(TRACE_LAYER_NFC, TRACE_TYPE_EVENT, m, p1, p2, p3); \
- }
-#define NFC_TRACE_EVENT4(m, p1, p2, p3, p4) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_4(TRACE_LAYER_NFC, TRACE_TYPE_EVENT, m, p1, p2, p3, p4); \
- }
-#define NFC_TRACE_EVENT5(m, p1, p2, p3, p4, p5) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_5(TRACE_LAYER_NFC, TRACE_TYPE_EVENT, m, p1, p2, p3, p4, p5); \
- }
-#define NFC_TRACE_EVENT6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_6(TRACE_LAYER_NFC, TRACE_TYPE_EVENT, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define NFC_TRACE_DEBUG0(m) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_0(TRACE_LAYER_NFC, TRACE_TYPE_DEBUG, m); \
- }
-#define NFC_TRACE_DEBUG1(m, p1) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_1(TRACE_LAYER_NFC, TRACE_TYPE_DEBUG, m, p1); \
- }
-#define NFC_TRACE_DEBUG2(m, p1, p2) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_2(TRACE_LAYER_NFC, TRACE_TYPE_DEBUG, m, p1, p2); \
- }
-#define NFC_TRACE_DEBUG3(m, p1, p2, p3) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_3(TRACE_LAYER_NFC, TRACE_TYPE_DEBUG, m, p1, p2, p3); \
- }
-#define NFC_TRACE_DEBUG4(m, p1, p2, p3, p4) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_4(TRACE_LAYER_NFC, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4); \
- }
-#define NFC_TRACE_DEBUG5(m, p1, p2, p3, p4, p5) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_5(TRACE_LAYER_NFC, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4, p5); \
- }
-#define NFC_TRACE_DEBUG6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (nfc_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_6(TRACE_LAYER_NFC, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define NCI_TRACE_ERROR0(m) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_0(TRACE_LAYER_NCI, TRACE_TYPE_ERROR, m); \
- }
-#define NCI_TRACE_ERROR1(m, p1) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_1(TRACE_LAYER_NCI, TRACE_TYPE_ERROR, m, p1); \
- }
-#define NCI_TRACE_ERROR2(m, p1, p2) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_2(TRACE_LAYER_NCI, TRACE_TYPE_ERROR, m, p1, p2); \
- }
-#define NCI_TRACE_ERROR3(m, p1, p2, p3) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_3(TRACE_LAYER_NCI, TRACE_TYPE_ERROR, m, p1, p2, p3); \
- }
-#define NCI_TRACE_ERROR4(m, p1, p2, p3, p4) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_4(TRACE_LAYER_NCI, TRACE_TYPE_ERROR, m, p1, p2, p3, p4); \
- }
-#define NCI_TRACE_ERROR5(m, p1, p2, p3, p4, p5) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_5(TRACE_LAYER_NCI, TRACE_TYPE_ERROR, m, p1, p2, p3, p4, p5); \
- }
-#define NCI_TRACE_ERROR6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_6(TRACE_LAYER_NCI, TRACE_TYPE_ERROR, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define NCI_TRACE_WARNING0(m) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_0(TRACE_LAYER_NCI, TRACE_TYPE_WARNING, m); \
- }
-#define NCI_TRACE_WARNING1(m, p1) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_1(TRACE_LAYER_NCI, TRACE_TYPE_WARNING, m, p1); \
- }
-#define NCI_TRACE_WARNING2(m, p1, p2) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_2(TRACE_LAYER_NCI, TRACE_TYPE_WARNING, m, p1, p2); \
- }
-#define NCI_TRACE_WARNING3(m, p1, p2, p3) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_3(TRACE_LAYER_NCI, TRACE_TYPE_WARNING, m, p1, p2, p3); \
- }
-#define NCI_TRACE_WARNING4(m, p1, p2, p3, p4) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_4(TRACE_LAYER_NCI, TRACE_TYPE_WARNING, m, p1, p2, p3, p4); \
- }
-#define NCI_TRACE_WARNING5(m, p1, p2, p3, p4, p5) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_5(TRACE_LAYER_NCI, TRACE_TYPE_WARNING, m, p1, p2, p3, p4, p5); \
- }
-#define NCI_TRACE_WARNING6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_6(TRACE_LAYER_NCI, TRACE_TYPE_WARNING, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define NCI_TRACE_API0(m) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_0(TRACE_LAYER_NCI, TRACE_TYPE_API, m); \
- }
-#define NCI_TRACE_API1(m, p1) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_1(TRACE_LAYER_NCI, TRACE_TYPE_API, m, p1); \
- }
-#define NCI_TRACE_API2(m, p1, p2) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_2(TRACE_LAYER_NCI, TRACE_TYPE_API, m, p1, p2); \
- }
-#define NCI_TRACE_API3(m, p1, p2, p3) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_3(TRACE_LAYER_NCI, TRACE_TYPE_API, m, p1, p2, p3); \
- }
-#define NCI_TRACE_API4(m, p1, p2, p3, p4) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_4(TRACE_LAYER_NCI, TRACE_TYPE_API, m, p1, p2, p3, p4); \
- }
-#define NCI_TRACE_API5(m, p1, p2, p3, p4, p5) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_5(TRACE_LAYER_NCI, TRACE_TYPE_API, m, p1, p2, p3, p4, p5); \
- }
-#define NCI_TRACE_API6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_6(TRACE_LAYER_NCI, TRACE_TYPE_API, m, p1, p2, p3, p4, p5, p6); \
- }
-
-#define NCI_TRACE_EVENT0(m) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_0(TRACE_LAYER_NCI, TRACE_TYPE_EVENT, m); \
- }
-#define NCI_TRACE_EVENT1(m, p1) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_1(TRACE_LAYER_NCI, TRACE_TYPE_EVENT, m, p1); \
- }
-#define NCI_TRACE_EVENT2(m, p1, p2) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_2(TRACE_LAYER_NCI, TRACE_TYPE_EVENT, m, p1, p2); \
- }
-#define NCI_TRACE_EVENT3(m, p1, p2, p3) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_3(TRACE_LAYER_NCI, TRACE_TYPE_EVENT, m, p1, p2, p3); \
- }
-#define NCI_TRACE_EVENT4(m, p1, p2, p3, p4) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_4(TRACE_LAYER_NCI, TRACE_TYPE_EVENT, m, p1, p2, p3, p4); \
- }
-#define NCI_TRACE_EVENT5(m, p1, p2, p3, p4, p5) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_5(TRACE_LAYER_NCI, TRACE_TYPE_EVENT, m, p1, p2, p3, p4, p5); \
- }
-#define NCI_TRACE_EVENT6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_6(TRACE_LAYER_NCI, TRACE_TYPE_EVENT, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define NCI_TRACE_DEBUG0(m) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_0(TRACE_LAYER_NCI, TRACE_TYPE_DEBUG, m); \
- }
-#define NCI_TRACE_DEBUG1(m, p1) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_1(TRACE_LAYER_NCI, TRACE_TYPE_DEBUG, m, p1); \
- }
-#define NCI_TRACE_DEBUG2(m, p1, p2) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_2(TRACE_LAYER_NCI, TRACE_TYPE_DEBUG, m, p1, p2); \
- }
-#define NCI_TRACE_DEBUG3(m, p1, p2, p3) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_3(TRACE_LAYER_NCI, TRACE_TYPE_DEBUG, m, p1, p2, p3); \
- }
-#define NCI_TRACE_DEBUG4(m, p1, p2, p3, p4) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_4(TRACE_LAYER_NCI, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4); \
- }
-#define NCI_TRACE_DEBUG5(m, p1, p2, p3, p4, p5) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_5(TRACE_LAYER_NCI, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4, p5); \
- }
-#define NCI_TRACE_DEBUG6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (ncit_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_6(TRACE_LAYER_NCI, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define RW_TRACE_ERROR0(m) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_0(TRACE_LAYER_RW, TRACE_TYPE_ERROR, m); \
- }
-#define RW_TRACE_ERROR1(m, p1) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_1(TRACE_LAYER_RW, TRACE_TYPE_ERROR, m, p1); \
- }
-#define RW_TRACE_ERROR2(m, p1, p2) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_2(TRACE_LAYER_RW, TRACE_TYPE_ERROR, m, p1, p2); \
- }
-#define RW_TRACE_ERROR3(m, p1, p2, p3) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_3(TRACE_LAYER_RW, TRACE_TYPE_ERROR, m, p1, p2, p3); \
- }
-#define RW_TRACE_ERROR4(m, p1, p2, p3, p4) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_4(TRACE_LAYER_RW, TRACE_TYPE_ERROR, m, p1, p2, p3, p4); \
- }
-#define RW_TRACE_ERROR5(m, p1, p2, p3, p4, p5) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_5(TRACE_LAYER_RW, TRACE_TYPE_ERROR, m, p1, p2, p3, p4, p5); \
- }
-#define RW_TRACE_ERROR6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_6(TRACE_LAYER_RW, TRACE_TYPE_ERROR, m, p1, p2, p3, p4, p5, p6); \
- }
-
-#define RW_TRACE_WARNING0(m) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_0(TRACE_LAYER_RW, TRACE_TYPE_WARNING, m); \
- }
-#define RW_TRACE_WARNING1(m, p1) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_1(TRACE_LAYER_RW, TRACE_TYPE_WARNING, m, p1); \
- }
-#define RW_TRACE_WARNING2(m, p1, p2) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_2(TRACE_LAYER_RW, TRACE_TYPE_WARNING, m, p1, p2); \
- }
-#define RW_TRACE_WARNING3(m, p1, p2, p3) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_3(TRACE_LAYER_RW, TRACE_TYPE_WARNING, m, p1, p2, p3); \
- }
-#define RW_TRACE_WARNING4(m, p1, p2, p3, p4) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_4(TRACE_LAYER_RW, TRACE_TYPE_WARNING, m, p1, p2, p3, p4); \
- }
-#define RW_TRACE_WARNING5(m, p1, p2, p3, p4, p5) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_5(TRACE_LAYER_RW, TRACE_TYPE_WARNING, m, p1, p2, p3, p4, p5); \
- }
-#define RW_TRACE_WARNING6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_6(TRACE_LAYER_RW, TRACE_TYPE_WARNING, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define RW_TRACE_API0(m) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_0(TRACE_LAYER_RW, TRACE_TYPE_API, m); \
- }
-#define RW_TRACE_API1(m, p1) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_1(TRACE_LAYER_RW, TRACE_TYPE_API, m, p1); \
- }
-#define RW_TRACE_API2(m, p1, p2) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_2(TRACE_LAYER_RW, TRACE_TYPE_API, m, p1, p2); \
- }
-#define RW_TRACE_API3(m, p1, p2, p3) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_3(TRACE_LAYER_RW, TRACE_TYPE_API, m, p1, p2, p3); \
- }
-#define RW_TRACE_API4(m, p1, p2, p3, p4) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_4(TRACE_LAYER_RW, TRACE_TYPE_API, m, p1, p2, p3, p4); \
- }
-#define RW_TRACE_API5(m, p1, p2, p3, p4, p5) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_5(TRACE_LAYER_RW, TRACE_TYPE_API, m, p1, p2, p3, p4, p5); \
- }
-#define RW_TRACE_API6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_6(TRACE_LAYER_RW, TRACE_TYPE_API, m, p1, p2, p3, p4, p5, p6); \
- }
-
-#define RW_TRACE_EVENT0(m) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_0(TRACE_LAYER_RW, TRACE_TYPE_EVENT, m); \
- }
-#define RW_TRACE_EVENT1(m, p1) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_1(TRACE_LAYER_RW, TRACE_TYPE_EVENT, m, p1); \
- }
-#define RW_TRACE_EVENT2(m, p1, p2) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_2(TRACE_LAYER_RW, TRACE_TYPE_EVENT, m, p1, p2); \
- }
-#define RW_TRACE_EVENT3(m, p1, p2, p3) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_3(TRACE_LAYER_RW, TRACE_TYPE_EVENT, m, p1, p2, p3); \
- }
-#define RW_TRACE_EVENT4(m, p1, p2, p3, p4) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_4(TRACE_LAYER_RW, TRACE_TYPE_EVENT, m, p1, p2, p3, p4); \
- }
-#define RW_TRACE_EVENT5(m, p1, p2, p3, p4, p5) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_5(TRACE_LAYER_RW, TRACE_TYPE_EVENT, m, p1, p2, p3, p4, p5); \
- }
-#define RW_TRACE_EVENT6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_6(TRACE_LAYER_RW, TRACE_TYPE_EVENT, m, p1, p2, p3, p4, p5, p6); \
- }
-
-#define RW_TRACE_DEBUG0(m) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_0(TRACE_LAYER_RW, TRACE_TYPE_DEBUG, m); \
- }
-#define RW_TRACE_DEBUG1(m, p1) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_1(TRACE_LAYER_RW, TRACE_TYPE_DEBUG, m, p1); \
- }
-#define RW_TRACE_DEBUG2(m, p1, p2) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_2(TRACE_LAYER_RW, TRACE_TYPE_DEBUG, m, p1, p2); \
- }
-#define RW_TRACE_DEBUG3(m, p1, p2, p3) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_3(TRACE_LAYER_RW, TRACE_TYPE_DEBUG, m, p1, p2, p3); \
- }
-#define RW_TRACE_DEBUG4(m, p1, p2, p3, p4) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_4(TRACE_LAYER_RW, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4); \
- }
-#define RW_TRACE_DEBUG5(m, p1, p2, p3, p4, p5) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_5(TRACE_LAYER_RW, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4, p5); \
- }
-#define RW_TRACE_DEBUG6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (rw_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_6(TRACE_LAYER_RW, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4, p5, p6); \
- }
-
-#define CE_TRACE_ERROR0(m) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_0(TRACE_LAYER_CE, TRACE_TYPE_ERROR, m); \
- }
-#define CE_TRACE_ERROR1(m, p1) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_1(TRACE_LAYER_CE, TRACE_TYPE_ERROR, m, p1); \
- }
-#define CE_TRACE_ERROR2(m, p1, p2) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_2(TRACE_LAYER_CE, TRACE_TYPE_ERROR, m, p1, p2); \
- }
-#define CE_TRACE_ERROR3(m, p1, p2, p3) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_3(TRACE_LAYER_CE, TRACE_TYPE_ERROR, m, p1, p2, p3); \
- }
-#define CE_TRACE_ERROR4(m, p1, p2, p3, p4) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_4(TRACE_LAYER_CE, TRACE_TYPE_ERROR, m, p1, p2, p3, p4); \
- }
-#define CE_TRACE_ERROR5(m, p1, p2, p3, p4, p5) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_5(TRACE_LAYER_CE, TRACE_TYPE_ERROR, m, p1, p2, p3, p4, p5); \
- }
-#define CE_TRACE_ERROR6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_6(TRACE_LAYER_CE, TRACE_TYPE_ERROR, m, p1, p2, p3, p4, p5, p6); \
- }
-
-#define CE_TRACE_WARNING0(m) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_0(TRACE_LAYER_CE, TRACE_TYPE_WARNING, m); \
- }
-#define CE_TRACE_WARNING1(m, p1) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_1(TRACE_LAYER_CE, TRACE_TYPE_WARNING, m, p1); \
- }
-#define CE_TRACE_WARNING2(m, p1, p2) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_2(TRACE_LAYER_CE, TRACE_TYPE_WARNING, m, p1, p2); \
- }
-#define CE_TRACE_WARNING3(m, p1, p2, p3) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_3(TRACE_LAYER_CE, TRACE_TYPE_WARNING, m, p1, p2, p3); \
- }
-#define CE_TRACE_WARNING4(m, p1, p2, p3, p4) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_4(TRACE_LAYER_CE, TRACE_TYPE_WARNING, m, p1, p2, p3, p4); \
- }
-#define CE_TRACE_WARNING5(m, p1, p2, p3, p4, p5) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_5(TRACE_LAYER_CE, TRACE_TYPE_WARNING, m, p1, p2, p3, p4, p5); \
- }
-#define CE_TRACE_WARNING6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_6(TRACE_LAYER_CE, TRACE_TYPE_WARNING, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define CE_TRACE_API0(m) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_0(TRACE_LAYER_CE, TRACE_TYPE_API, m); \
- }
-#define CE_TRACE_API1(m, p1) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_1(TRACE_LAYER_CE, TRACE_TYPE_API, m, p1); \
- }
-#define CE_TRACE_API2(m, p1, p2) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_2(TRACE_LAYER_CE, TRACE_TYPE_API, m, p1, p2); \
- }
-#define CE_TRACE_API3(m, p1, p2, p3) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_3(TRACE_LAYER_CE, TRACE_TYPE_API, m, p1, p2, p3); \
- }
-#define CE_TRACE_API4(m, p1, p2, p3, p4) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_4(TRACE_LAYER_CE, TRACE_TYPE_API, m, p1, p2, p3, p4); \
- }
-#define CE_TRACE_API5(m, p1, p2, p3, p4, p5) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_5(TRACE_LAYER_CE, TRACE_TYPE_API, m, p1, p2, p3, p4, p5); \
- }
-#define CE_TRACE_API6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_6(TRACE_LAYER_CE, TRACE_TYPE_API, m, p1, p2, p3, p4, p5, p6); \
- }
-
-#define CE_TRACE_EVENT0(m) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_0(TRACE_LAYER_CE, TRACE_TYPE_EVENT, m); \
- }
-#define CE_TRACE_EVENT1(m, p1) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_1(TRACE_LAYER_CE, TRACE_TYPE_EVENT, m, p1); \
- }
-#define CE_TRACE_EVENT2(m, p1, p2) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_2(TRACE_LAYER_CE, TRACE_TYPE_EVENT, m, p1, p2); \
- }
-#define CE_TRACE_EVENT3(m, p1, p2, p3) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_3(TRACE_LAYER_CE, TRACE_TYPE_EVENT, m, p1, p2, p3); \
- }
-#define CE_TRACE_EVENT4(m, p1, p2, p3, p4) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_4(TRACE_LAYER_CE, TRACE_TYPE_EVENT, m, p1, p2, p3, p4); \
- }
-#define CE_TRACE_EVENT5(m, p1, p2, p3, p4, p5) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_5(TRACE_LAYER_CE, TRACE_TYPE_EVENT, m, p1, p2, p3, p4, p5); \
- }
-#define CE_TRACE_EVENT6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_6(TRACE_LAYER_CE, TRACE_TYPE_EVENT, m, p1, p2, p3, p4, p5, p6); \
- }
-
-#define CE_TRACE_DEBUG0(m) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_0(TRACE_LAYER_CE, TRACE_TYPE_DEBUG, m); \
- }
-#define CE_TRACE_DEBUG1(m, p1) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_1(TRACE_LAYER_CE, TRACE_TYPE_DEBUG, m, p1); \
- }
-#define CE_TRACE_DEBUG2(m, p1, p2) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_2(TRACE_LAYER_CE, TRACE_TYPE_DEBUG, m, p1, p2); \
- }
-#define CE_TRACE_DEBUG3(m, p1, p2, p3) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_3(TRACE_LAYER_CE, TRACE_TYPE_DEBUG, m, p1, p2, p3); \
- }
-#define CE_TRACE_DEBUG4(m, p1, p2, p3, p4) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_4(TRACE_LAYER_CE, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4); \
- }
-#define CE_TRACE_DEBUG5(m, p1, p2, p3, p4, p5) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_5(TRACE_LAYER_CE, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4, p5); \
- }
-#define CE_TRACE_DEBUG6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (ce_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_6(TRACE_LAYER_CE, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4, p5, p6); \
- }
-
-#define NDEF_TRACE_ERROR0(m) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_0(TRACE_LAYER_NDEF, TRACE_TYPE_ERROR, m); \
- }
-#define NDEF_TRACE_ERROR1(m, p1) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_1(TRACE_LAYER_NDEF, TRACE_TYPE_ERROR, m, p1); \
- }
-#define NDEF_TRACE_ERROR2(m, p1, p2) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_2(TRACE_LAYER_NDEF, TRACE_TYPE_ERROR, m, p1, p2); \
- }
-#define NDEF_TRACE_ERROR3(m, p1, p2, p3) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_3(TRACE_LAYER_NDEF, TRACE_TYPE_ERROR, m, p1, p2, p3); \
- }
-#define NDEF_TRACE_ERROR4(m, p1, p2, p3, p4) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_4(TRACE_LAYER_NDEF, TRACE_TYPE_ERROR, m, p1, p2, p3, p4); \
- }
-#define NDEF_TRACE_ERROR5(m, p1, p2, p3, p4, p5) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_5(TRACE_LAYER_NDEF, TRACE_TYPE_ERROR, m, p1, p2, p3, p4, p5); \
- }
-#define NDEF_TRACE_ERROR6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_6(TRACE_LAYER_NDEF, TRACE_TYPE_ERROR, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define NDEF_TRACE_WARNING0(m) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_0(TRACE_LAYER_NDEF, TRACE_TYPE_WARNING, m); \
- }
-#define NDEF_TRACE_WARNING1(m, p1) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_1(TRACE_LAYER_NDEF, TRACE_TYPE_WARNING, m, p1); \
- }
-#define NDEF_TRACE_WARNING2(m, p1, p2) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_2(TRACE_LAYER_NDEF, TRACE_TYPE_WARNING, m, p1, p2); \
- }
-#define NDEF_TRACE_WARNING3(m, p1, p2, p3) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_3(TRACE_LAYER_NDEF, TRACE_TYPE_WARNING, m, p1, p2, p3); \
- }
-#define NDEF_TRACE_WARNING4(m, p1, p2, p3, p4) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_4(TRACE_LAYER_NDEF, TRACE_TYPE_WARNING, m, p1, p2, p3, p4); \
- }
-#define NDEF_TRACE_WARNING5(m, p1, p2, p3, p4, p5) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_5(TRACE_LAYER_NDEF, TRACE_TYPE_WARNING, m, p1, p2, p3, p4, p5); \
- }
-#define NDEF_TRACE_WARNING6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_6(TRACE_LAYER_NDEF, TRACE_TYPE_WARNING, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define NDEF_TRACE_API0(m) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_0(TRACE_LAYER_NDEF, TRACE_TYPE_API, m); \
- }
-#define NDEF_TRACE_API1(m, p1) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_1(TRACE_LAYER_NDEF, TRACE_TYPE_API, m, p1); \
- }
-#define NDEF_TRACE_API2(m, p1, p2) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_2(TRACE_LAYER_NDEF, TRACE_TYPE_API, m, p1, p2); \
- }
-#define NDEF_TRACE_API3(m, p1, p2, p3) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_3(TRACE_LAYER_NDEF, TRACE_TYPE_API, m, p1, p2, p3); \
- }
-#define NDEF_TRACE_API4(m, p1, p2, p3, p4) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_4(TRACE_LAYER_NDEF, TRACE_TYPE_API, m, p1, p2, p3, p4); \
- }
-#define NDEF_TRACE_API5(m, p1, p2, p3, p4, p5) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_5(TRACE_LAYER_NDEF, TRACE_TYPE_API, m, p1, p2, p3, p4, p5); \
- }
-#define NDEF_TRACE_API6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_6(TRACE_LAYER_NDEF, TRACE_TYPE_API, m, p1, p2, p3, p4, p5, p6); \
- }
-
-#define NDEF_TRACE_EVENT0(m) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_0(TRACE_LAYER_NDEF, TRACE_TYPE_EVENT, m); \
- }
-#define NDEF_TRACE_EVENT1(m, p1) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_1(TRACE_LAYER_NDEF, TRACE_TYPE_EVENT, m, p1); \
- }
-#define NDEF_TRACE_EVENT2(m, p1, p2) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_2(TRACE_LAYER_NDEF, TRACE_TYPE_EVENT, m, p1, p2); \
- }
-#define NDEF_TRACE_EVENT3(m, p1, p2, p3) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_3(TRACE_LAYER_NDEF, TRACE_TYPE_EVENT, m, p1, p2, p3); \
- }
-#define NDEF_TRACE_EVENT4(m, p1, p2, p3, p4) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_4(TRACE_LAYER_NDEF, TRACE_TYPE_EVENT, m, p1, p2, p3, p4); \
- }
-#define NDEF_TRACE_EVENT5(m, p1, p2, p3, p4, p5) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_5(TRACE_LAYER_NDEF, TRACE_TYPE_EVENT, m, p1, p2, p3, p4, p5); \
- }
-#define NDEF_TRACE_EVENT6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_6(TRACE_LAYER_NDEF, TRACE_TYPE_EVENT, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define NDEF_TRACE_DEBUG0(m) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_0(TRACE_LAYER_NDEF, TRACE_TYPE_DEBUG, m); \
- }
-#define NDEF_TRACE_DEBUG1(m, p1) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_1(TRACE_LAYER_NDEF, TRACE_TYPE_DEBUG, m, p1); \
- }
-#define NDEF_TRACE_DEBUG2(m, p1, p2) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_2(TRACE_LAYER_NDEF, TRACE_TYPE_DEBUG, m, p1, p2); \
- }
-#define NDEF_TRACE_DEBUG3(m, p1, p2, p3) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_3(TRACE_LAYER_NDEF, TRACE_TYPE_DEBUG, m, p1, p2, p3); \
- }
-#define NDEF_TRACE_DEBUG4(m, p1, p2, p3, p4) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_4(TRACE_LAYER_NDEF, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4); \
- }
-#define NDEF_TRACE_DEBUG5(m, p1, p2, p3, p4, p5) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_5(TRACE_LAYER_NDEF, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4, p5); \
- }
-#define NDEF_TRACE_DEBUG6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (ndef_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_6(TRACE_LAYER_NDEF, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-/* Define tracing for the NFA unit
-*/
-#define NFA_TRACE_ERROR0(m) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_0(TRACE_LAYER_NFA, TRACE_TYPE_ERROR, m); \
- }
-#define NFA_TRACE_ERROR1(m, p1) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_1(TRACE_LAYER_NFA, TRACE_TYPE_ERROR, m, p1); \
- }
-#define NFA_TRACE_ERROR2(m, p1, p2) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_2(TRACE_LAYER_NFA, TRACE_TYPE_ERROR, m, p1, p2); \
- }
-#define NFA_TRACE_ERROR3(m, p1, p2, p3) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_3(TRACE_LAYER_NFA, TRACE_TYPE_ERROR, m, p1, p2, p3); \
- }
-#define NFA_TRACE_ERROR4(m, p1, p2, p3, p4) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_4(TRACE_LAYER_NFA, TRACE_TYPE_ERROR, m, p1, p2, p3, p4); \
- }
-#define NFA_TRACE_ERROR5(m, p1, p2, p3, p4, p5) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_5(TRACE_LAYER_NFA, TRACE_TYPE_ERROR, m, p1, p2, p3, p4, p5); \
- }
-#define NFA_TRACE_ERROR6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_6(TRACE_LAYER_NFA, TRACE_TYPE_ERROR, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define NFA_TRACE_WARNING0(m) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_0(TRACE_LAYER_NFA, TRACE_TYPE_WARNING, m); \
- }
-#define NFA_TRACE_WARNING1(m, p1) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_1(TRACE_LAYER_NFA, TRACE_TYPE_WARNING, m, p1); \
- }
-#define NFA_TRACE_WARNING2(m, p1, p2) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_2(TRACE_LAYER_NFA, TRACE_TYPE_WARNING, m, p1, p2); \
- }
-#define NFA_TRACE_WARNING3(m, p1, p2, p3) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_3(TRACE_LAYER_NFA, TRACE_TYPE_WARNING, m, p1, p2, p3); \
- }
-#define NFA_TRACE_WARNING4(m, p1, p2, p3, p4) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_4(TRACE_LAYER_NFA, TRACE_TYPE_WARNING, m, p1, p2, p3, p4); \
- }
-#define NFA_TRACE_WARNING5(m, p1, p2, p3, p4, p5) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_5(TRACE_LAYER_NFA, TRACE_TYPE_WARNING, m, p1, p2, p3, p4, p5); \
- }
-#define NFA_TRACE_WARNING6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_6(TRACE_LAYER_NFA, TRACE_TYPE_WARNING, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define NFA_TRACE_API0(m) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_0(TRACE_LAYER_NFA, TRACE_TYPE_API, m); \
- }
-#define NFA_TRACE_API1(m, p1) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_1(TRACE_LAYER_NFA, TRACE_TYPE_API, m, p1); \
- }
-#define NFA_TRACE_API2(m, p1, p2) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_2(TRACE_LAYER_NFA, TRACE_TYPE_API, m, p1, p2); \
- }
-#define NFA_TRACE_API3(m, p1, p2, p3) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_3(TRACE_LAYER_NFA, TRACE_TYPE_API, m, p1, p2, p3); \
- }
-#define NFA_TRACE_API4(m, p1, p2, p3, p4) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_4(TRACE_LAYER_NFA, TRACE_TYPE_API, m, p1, p2, p3, p4); \
- }
-#define NFA_TRACE_API5(m, p1, p2, p3, p4, p5) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_5(TRACE_LAYER_NFA, TRACE_TYPE_API, m, p1, p2, p3, p4, p5); \
- }
-#define NFA_TRACE_API6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_6(TRACE_LAYER_NFA, TRACE_TYPE_API, m, p1, p2, p3, p4, p5, p6); \
- }
-
-#define NFA_TRACE_EVENT0(m) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_0(TRACE_LAYER_NFA, TRACE_TYPE_EVENT, m); \
- }
-#define NFA_TRACE_EVENT1(m, p1) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_1(TRACE_LAYER_NFA, TRACE_TYPE_EVENT, m, p1); \
- }
-#define NFA_TRACE_EVENT2(m, p1, p2) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_2(TRACE_LAYER_NFA, TRACE_TYPE_EVENT, m, p1, p2); \
- }
-#define NFA_TRACE_EVENT3(m, p1, p2, p3) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_3(TRACE_LAYER_NFA, TRACE_TYPE_EVENT, m, p1, p2, p3); \
- }
-#define NFA_TRACE_EVENT4(m, p1, p2, p3, p4) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_4(TRACE_LAYER_NFA, TRACE_TYPE_EVENT, m, p1, p2, p3, p4); \
- }
-#define NFA_TRACE_EVENT5(m, p1, p2, p3, p4, p5) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_5(TRACE_LAYER_NFA, TRACE_TYPE_EVENT, m, p1, p2, p3, p4, p5); \
- }
-#define NFA_TRACE_EVENT6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_6(TRACE_LAYER_NFA, TRACE_TYPE_EVENT, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define NFA_TRACE_DEBUG0(m) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_0(TRACE_LAYER_NFA, TRACE_TYPE_DEBUG, m); \
- }
-#define NFA_TRACE_DEBUG1(m, p1) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_1(TRACE_LAYER_NFA, TRACE_TYPE_DEBUG, m, p1); \
- }
-#define NFA_TRACE_DEBUG2(m, p1, p2) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_2(TRACE_LAYER_NFA, TRACE_TYPE_DEBUG, m, p1, p2); \
- }
-#define NFA_TRACE_DEBUG3(m, p1, p2, p3) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_3(TRACE_LAYER_NFA, TRACE_TYPE_DEBUG, m, p1, p2, p3); \
- }
-#define NFA_TRACE_DEBUG4(m, p1, p2, p3, p4) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_4(TRACE_LAYER_NFA, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4); \
- }
-#define NFA_TRACE_DEBUG5(m, p1, p2, p3, p4, p5) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_5(TRACE_LAYER_NFA, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4, p5); \
- }
-#define NFA_TRACE_DEBUG6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (nfa_sys_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_6(TRACE_LAYER_NFA, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-/* Define tracing for the NFA P2P unit
-*/
-#define P2P_TRACE_ERROR0(m) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_0(TRACE_LAYER_P2P, TRACE_TYPE_ERROR, m); \
- }
-#define P2P_TRACE_ERROR1(m, p1) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_1(TRACE_LAYER_P2P, TRACE_TYPE_ERROR, m, p1); \
- }
-#define P2P_TRACE_ERROR2(m, p1, p2) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_2(TRACE_LAYER_P2P, TRACE_TYPE_ERROR, m, p1, p2); \
- }
-#define P2P_TRACE_ERROR3(m, p1, p2, p3) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_3(TRACE_LAYER_P2P, TRACE_TYPE_ERROR, m, p1, p2, p3); \
- }
-#define P2P_TRACE_ERROR4(m, p1, p2, p3, p4) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_4(TRACE_LAYER_P2P, TRACE_TYPE_ERROR, m, p1, p2, p3, p4); \
- }
-#define P2P_TRACE_ERROR5(m, p1, p2, p3, p4, p5) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_5(TRACE_LAYER_P2P, TRACE_TYPE_ERROR, m, p1, p2, p3, p4, p5); \
- }
-#define P2P_TRACE_ERROR6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- BT_TRACE_6(TRACE_LAYER_P2P, TRACE_TYPE_ERROR, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define P2P_TRACE_WARNING0(m) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_0(TRACE_LAYER_P2P, TRACE_TYPE_WARNING, m); \
- }
-#define P2P_TRACE_WARNING1(m, p1) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_1(TRACE_LAYER_P2P, TRACE_TYPE_WARNING, m, p1); \
- }
-#define P2P_TRACE_WARNING2(m, p1, p2) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_2(TRACE_LAYER_P2P, TRACE_TYPE_WARNING, m, p1, p2); \
- }
-#define P2P_TRACE_WARNING3(m, p1, p2, p3) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_3(TRACE_LAYER_P2P, TRACE_TYPE_WARNING, m, p1, p2, p3); \
- }
-#define P2P_TRACE_WARNING4(m, p1, p2, p3, p4) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_4(TRACE_LAYER_P2P, TRACE_TYPE_WARNING, m, p1, p2, p3, p4); \
- }
-#define P2P_TRACE_WARNING5(m, p1, p2, p3, p4, p5) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_5(TRACE_LAYER_P2P, TRACE_TYPE_WARNING, m, p1, p2, p3, p4, p5); \
- }
-#define P2P_TRACE_WARNING6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- BT_TRACE_6(TRACE_LAYER_P2P, TRACE_TYPE_WARNING, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define P2P_TRACE_API0(m) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_0(TRACE_LAYER_P2P, TRACE_TYPE_API, m); \
- }
-#define P2P_TRACE_API1(m, p1) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_1(TRACE_LAYER_P2P, TRACE_TYPE_API, m, p1); \
- }
-#define P2P_TRACE_API2(m, p1, p2) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_2(TRACE_LAYER_P2P, TRACE_TYPE_API, m, p1, p2); \
- }
-#define P2P_TRACE_API3(m, p1, p2, p3) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_3(TRACE_LAYER_P2P, TRACE_TYPE_API, m, p1, p2, p3); \
- }
-#define P2P_TRACE_API4(m, p1, p2, p3, p4) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_4(TRACE_LAYER_P2P, TRACE_TYPE_API, m, p1, p2, p3, p4); \
- }
-#define P2P_TRACE_API5(m, p1, p2, p3, p4, p5) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_5(TRACE_LAYER_P2P, TRACE_TYPE_API, m, p1, p2, p3, p4, p5); \
- }
-#define P2P_TRACE_API6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_API) \
- BT_TRACE_6(TRACE_LAYER_P2P, TRACE_TYPE_API, m, p1, p2, p3, p4, p5, p6); \
- }
-
-#define P2P_TRACE_EVENT0(m) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_0(TRACE_LAYER_P2P, TRACE_TYPE_EVENT, m); \
- }
-#define P2P_TRACE_EVENT1(m, p1) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_1(TRACE_LAYER_P2P, TRACE_TYPE_EVENT, m, p1); \
- }
-#define P2P_TRACE_EVENT2(m, p1, p2) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_2(TRACE_LAYER_P2P, TRACE_TYPE_EVENT, m, p1, p2); \
- }
-#define P2P_TRACE_EVENT3(m, p1, p2, p3) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_3(TRACE_LAYER_P2P, TRACE_TYPE_EVENT, m, p1, p2, p3); \
- }
-#define P2P_TRACE_EVENT4(m, p1, p2, p3, p4) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_4(TRACE_LAYER_P2P, TRACE_TYPE_EVENT, m, p1, p2, p3, p4); \
- }
-#define P2P_TRACE_EVENT5(m, p1, p2, p3, p4, p5) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_5(TRACE_LAYER_P2P, TRACE_TYPE_EVENT, m, p1, p2, p3, p4, p5); \
- }
-#define P2P_TRACE_EVENT6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- BT_TRACE_6(TRACE_LAYER_P2P, TRACE_TYPE_EVENT, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define P2P_TRACE_DEBUG0(m) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_0(TRACE_LAYER_P2P, TRACE_TYPE_DEBUG, m); \
- }
-#define P2P_TRACE_DEBUG1(m, p1) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_1(TRACE_LAYER_P2P, TRACE_TYPE_DEBUG, m, p1); \
- }
-#define P2P_TRACE_DEBUG2(m, p1, p2) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_2(TRACE_LAYER_P2P, TRACE_TYPE_DEBUG, m, p1, p2); \
- }
-#define P2P_TRACE_DEBUG3(m, p1, p2, p3) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_3(TRACE_LAYER_P2P, TRACE_TYPE_DEBUG, m, p1, p2, p3); \
- }
-#define P2P_TRACE_DEBUG4(m, p1, p2, p3, p4) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_4(TRACE_LAYER_P2P, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4); \
- }
-#define P2P_TRACE_DEBUG5(m, p1, p2, p3, p4, p5) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_5(TRACE_LAYER_P2P, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4, p5); \
- }
-#define P2P_TRACE_DEBUG6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (nfa_p2p_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- BT_TRACE_6(TRACE_LAYER_P2P, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-/* define traces for application */
-#define APPL_TRACE_ERROR0(m) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_ERROR) \
- LogMsg_0(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_ERROR, \
- (m)); \
- }
-#define APPL_TRACE_ERROR1(m, p1) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_ERROR) \
- LogMsg_1(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_ERROR, \
- (m), (uintptr_t)(p1)); \
- }
-#define APPL_TRACE_ERROR2(m, p1, p2) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_ERROR) \
- LogMsg_2(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_ERROR, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2)); \
- }
-#define APPL_TRACE_ERROR3(m, p1, p2, p3) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_ERROR) \
- LogMsg_3(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_ERROR, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3)); \
- }
-#define APPL_TRACE_ERROR4(m, p1, p2, p3, p4) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_ERROR) \
- LogMsg_4(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_ERROR, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), \
- (uintptr_t)(p4)); \
- }
-#define APPL_TRACE_ERROR5(m, p1, p2, p3, p4, p5) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_ERROR) \
- LogMsg_5(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_ERROR, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), \
- (uintptr_t)(p4), (uintptr_t)(p5)); \
- }
-#define APPL_TRACE_ERROR6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_ERROR) \
- LogMsg_6(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_ERROR, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), \
- (uintptr_t)(p4), (uintptr_t)(p5), (uintptr_t)(p6)); \
- }
-
-#define APPL_TRACE_WARNING0(m) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_WARNING) \
- LogMsg_0(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_WARNING, \
- (m)); \
- }
-#define APPL_TRACE_WARNING1(m, p1) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_WARNING) \
- LogMsg_1(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_WARNING, \
- (m), (uintptr_t)(p1)); \
- }
-#define APPL_TRACE_WARNING2(m, p1, p2) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_WARNING) \
- LogMsg_2(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_WARNING, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2)); \
- }
-#define APPL_TRACE_WARNING3(m, p1, p2, p3) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_WARNING) \
- LogMsg_3(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_WARNING, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3)); \
- }
-#define APPL_TRACE_WARNING4(m, p1, p2, p3, p4) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_WARNING) \
- LogMsg_4(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_WARNING, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), \
- (uintptr_t)(p4)); \
- }
-#define APPL_TRACE_WARNING5(m, p1, p2, p3, p4, p5) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_WARNING) \
- LogMsg_5(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_WARNING, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), \
- (uintptr_t)(p4), (uintptr_t)(p5)); \
- }
-#define APPL_TRACE_WARNING6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_WARNING) \
- LogMsg_6(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_WARNING, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), \
- (uintptr_t)(p4), (uintptr_t)(p5), (uintptr_t)(p6)); \
- }
-
-#define APPL_TRACE_API0(m) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_API) \
- LogMsg_0(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_API, \
- (m)); \
- }
-#define APPL_TRACE_API1(m, p1) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_API) \
- LogMsg_1(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_API, \
- (m), (uintptr_t)(p1)); \
- }
-#define APPL_TRACE_API2(m, p1, p2) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_API) \
- LogMsg_2(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_API, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2)); \
- }
-#define APPL_TRACE_API3(m, p1, p2, p3) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_API) \
- LogMsg_3(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_API, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3)); \
- }
-#define APPL_TRACE_API4(m, p1, p2, p3, p4) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_API) \
- LogMsg_4(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_API, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), \
- (uintptr_t)(p4)); \
- }
-#define APPL_TRACE_API5(m, p1, p2, p3, p4, p5) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_API) \
- LogMsg_5(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_API, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), \
- (uintptr_t)(p4), (uintptr_t)(p5)); \
- }
-#define APPL_TRACE_API6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_API) \
- LogMsg_6(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_API, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), \
- (uintptr_t)(p4), (uintptr_t)(p5), (uintptr_t)(p6)); \
- }
-
-#define APPL_TRACE_EVENT0(m) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_EVENT) \
- LogMsg_0(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_EVENT, \
- (m)); \
- }
-#define APPL_TRACE_EVENT1(m, p1) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_EVENT) \
- LogMsg_1(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_EVENT, \
- (m), (uintptr_t)(p1)); \
- }
-#define APPL_TRACE_EVENT2(m, p1, p2) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_EVENT) \
- LogMsg_2(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_EVENT, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2)); \
- }
-#define APPL_TRACE_EVENT3(m, p1, p2, p3) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_EVENT) \
- LogMsg_3(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_EVENT, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3)); \
- }
-#define APPL_TRACE_EVENT4(m, p1, p2, p3, p4) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_EVENT) \
- LogMsg_4(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_EVENT, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), \
- (uintptr_t)(p4)); \
- }
-#define APPL_TRACE_EVENT5(m, p1, p2, p3, p4, p5) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_EVENT) \
- LogMsg_5(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_EVENT, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), \
- (uintptr_t)(p4), (uintptr_t)(p5)); \
- }
-#define APPL_TRACE_EVENT6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_EVENT) \
- LogMsg_6(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_EVENT, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), \
- (uintptr_t)(p4), (uintptr_t)(p5), (uintptr_t)(p6)); \
- }
-
-#define APPL_TRACE_DEBUG0(m) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_DEBUG) \
- LogMsg_0(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_DEBUG, \
- (m)); \
- }
-#define APPL_TRACE_DEBUG1(m, p1) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_DEBUG) \
- LogMsg_1(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_DEBUG, \
- (m), (uintptr_t)(p1)); \
- }
-#define APPL_TRACE_DEBUG2(m, p1, p2) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_DEBUG) \
- LogMsg_2(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_DEBUG, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2)); \
- }
-#define APPL_TRACE_DEBUG3(m, p1, p2, p3) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_DEBUG) \
- LogMsg_3(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_DEBUG, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3)); \
- }
-#define APPL_TRACE_DEBUG4(m, p1, p2, p3, p4) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_DEBUG) \
- LogMsg_4(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_DEBUG, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), \
- (uintptr_t)(p4)); \
- }
-#define APPL_TRACE_DEBUG5(m, p1, p2, p3, p4, p5) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_DEBUG) \
- LogMsg_5(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_DEBUG, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), \
- (uintptr_t)(p4), (uintptr_t)(p5)); \
- }
-#define APPL_TRACE_DEBUG6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (appl_trace_level >= BT_TRACE_LEVEL_DEBUG) \
- LogMsg_6(TRACE_CTRL_GENERAL | TRACE_LAYER_NONE | TRACE_ORG_APPL | \
- TRACE_TYPE_DEBUG, \
- (m), (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), \
- (uintptr_t)(p4), (uintptr_t)(p5), (uintptr_t)(p6)); \
- }
-
-#endif /* BT_TRACE_H */
diff --git a/src/include/buildcfg.h b/src/include/buildcfg.h
index 3149e06..52597fe 100644
--- a/src/include/buildcfg.h
+++ b/src/include/buildcfg.h
@@ -28,11 +28,6 @@
#define BTE_APPL_MAX_USERIAL_DEV_NAME (256)
-#ifdef BT_TRACE_VERBOSE
-#undef BT_TRACE_VERBOSE
-#endif
-#define BT_TRACE_VERBOSE TRUE
-
#define TRACE_TASK_INCLUDED TRUE
#define GKI_BUF1_MAX 0
diff --git a/src/include/gki_hal_target.h b/src/include/gki_hal_target.h
index 19363f9..447b11e 100644
--- a/src/include/gki_hal_target.h
+++ b/src/include/gki_hal_target.h
@@ -215,43 +215,6 @@
#define GKI_SEND_MSG_FROM_ISR FALSE
#endif
-#define GKI_TRACE_0(m)
-#define GKI_TRACE_1(m, p1)
-#define GKI_TRACE_2(m, p1, p2)
-#define GKI_TRACE_3(m, p1, p2, p3)
-#define GKI_TRACE_4(m, p1, p2, p3, p4)
-#define GKI_TRACE_5(m, p1, p2, p3, p4, p5)
-#define GKI_TRACE_6(m, p1, p2, p3, p4, p5, p6)
-
-#define GKI_TRACE_ERROR_0(m) \
- LogMsg( \
- TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR, \
- m)
-#define GKI_TRACE_ERROR_1(m, p1) \
- LogMsg( \
- TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR, \
- m, p1)
-#define GKI_TRACE_ERROR_2(m, p1, p2) \
- LogMsg( \
- TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR, \
- m, p1, p2)
-#define GKI_TRACE_ERROR_3(m, p1, p2, p3) \
- LogMsg( \
- TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR, \
- m, p1, p2, p3)
-#define GKI_TRACE_ERROR_4(m, p1, p2, p3, p4) \
- LogMsg( \
- TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR, \
- m, p1, p2, p3, p4)
-#define GKI_TRACE_ERROR_5(m, p1, p2, p3, p4, p5) \
- LogMsg( \
- TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR, \
- m, p1, p2, p3, p4, p5)
-#define GKI_TRACE_ERROR_6(m, p1, p2, p3, p4, p5, p6) \
- LogMsg( \
- TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR, \
- m, p1, p2, p3, p4, p5, p6)
-
extern void LogMsg(uint32_t trace_set_mask, const char* fmt_str, ...);
#endif /* GKI_TARGET_H */
diff --git a/src/include/gki_target.h b/src/include/gki_target.h
index 4233bdf..957b23f 100644
--- a/src/include/gki_target.h
+++ b/src/include/gki_target.h
@@ -361,43 +361,6 @@
#define GKI_BUF8_MAX 30
#endif
-#define GKI_TRACE_0(m)
-#define GKI_TRACE_1(m, p1)
-#define GKI_TRACE_2(m, p1, p2)
-#define GKI_TRACE_3(m, p1, p2, p3)
-#define GKI_TRACE_4(m, p1, p2, p3, p4)
-#define GKI_TRACE_5(m, p1, p2, p3, p4, p5)
-#define GKI_TRACE_6(m, p1, p2, p3, p4, p5, p6)
-
-#define GKI_TRACE_ERROR_0(m) \
- LogMsg( \
- TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR, \
- m)
-#define GKI_TRACE_ERROR_1(m, p1) \
- LogMsg( \
- TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR, \
- m, p1)
-#define GKI_TRACE_ERROR_2(m, p1, p2) \
- LogMsg( \
- TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR, \
- m, p1, p2)
-#define GKI_TRACE_ERROR_3(m, p1, p2, p3) \
- LogMsg( \
- TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR, \
- m, p1, p2, p3)
-#define GKI_TRACE_ERROR_4(m, p1, p2, p3, p4) \
- LogMsg( \
- TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR, \
- m, p1, p2, p3, p4)
-#define GKI_TRACE_ERROR_5(m, p1, p2, p3, p4, p5) \
- LogMsg( \
- TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR, \
- m, p1, p2, p3, p4, p5)
-#define GKI_TRACE_ERROR_6(m, p1, p2, p3, p4, p5, p6) \
- LogMsg( \
- TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI | TRACE_TYPE_ERROR, \
- m, p1, p2, p3, p4, p5, p6)
-
extern void LogMsg(uint32_t trace_set_mask, const char* fmt_str, ...);
#endif /* GKI_TARGET_H */
diff --git a/src/include/nfc_hal_int.h b/src/include/nfc_hal_int.h
index 9327a08..2f99b92 100644
--- a/src/include/nfc_hal_int.h
+++ b/src/include/nfc_hal_int.h
@@ -200,10 +200,10 @@
#if (NFC_HAL_DEBUG == TRUE)
extern const char* const nfc_hal_init_state_str[];
-#define NFC_HAL_SET_INIT_STATE(state) \
- HAL_TRACE_DEBUG3("init state: %d->%d(%s)", \
- nfc_hal_cb.dev_cb.initializing_state, state, \
- nfc_hal_init_state_str[state]); \
+#define NFC_HAL_SET_INIT_STATE(state) \
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf( \
+ "init state: %d->%d(%s)", nfc_hal_cb.dev_cb.initializing_state, state, \
+ nfc_hal_init_state_str[state]); \
nfc_hal_cb.dev_cb.initializing_state = state;
#else
#define NFC_HAL_SET_INIT_STATE(state) \
diff --git a/src/include/nfc_hal_target.h b/src/include/nfc_hal_target.h
index 4bb66e6..3e74216 100644
--- a/src/include/nfc_hal_target.h
+++ b/src/include/nfc_hal_target.h
@@ -165,273 +165,4 @@
#define NFC_HAL_TRACE_PROTOCOL TRUE
#endif
-/* Legacy protocol-trace-enable macro */
-#ifndef BT_TRACE_PROTOCOL
-#define BT_TRACE_PROTOCOL (NFC_HAL_TRACE_PROTOCOL)
-#endif
-
-/* Enable HAL tracing by default */
-#ifndef NFC_HAL_USE_TRACES
-#define NFC_HAL_USE_TRACES TRUE
-#endif
-
-/* HAL trace macros */
-#if (NFC_HAL_USE_TRACES == TRUE)
-#define NCI_TRACE_0(l, t, m) \
- LogMsg((TRACE_CTRL_GENERAL | (l) | TRACE_ORG_STACK | (t)), (m))
-#define NCI_TRACE_1(l, t, m, p1) \
- LogMsg(TRACE_CTRL_GENERAL | (l) | TRACE_ORG_STACK | (t), (m), (uintptr_t)(p1))
-#define NCI_TRACE_2(l, t, m, p1, p2) \
- LogMsg(TRACE_CTRL_GENERAL | (l) | TRACE_ORG_STACK | (t), (m), \
- (uintptr_t)(p1), (uintptr_t)(p2))
-#define NCI_TRACE_3(l, t, m, p1, p2, p3) \
- LogMsg(TRACE_CTRL_GENERAL | (l) | TRACE_ORG_STACK | (t), (m), \
- (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3))
-#define NCI_TRACE_4(l, t, m, p1, p2, p3, p4) \
- LogMsg(TRACE_CTRL_GENERAL | (l) | TRACE_ORG_STACK | (t), (m), \
- (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), (uintptr_t)(p4))
-#define NCI_TRACE_5(l, t, m, p1, p2, p3, p4, p5) \
- LogMsg(TRACE_CTRL_GENERAL | (l) | TRACE_ORG_STACK | (t), (m), \
- (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), (uintptr_t)(p4), \
- (uintptr_t)(p5))
-#define NCI_TRACE_6(l, t, m, p1, p2, p3, p4, p5, p6) \
- LogMsg(TRACE_CTRL_GENERAL | (l) | TRACE_ORG_STACK | (t), (m), \
- (uintptr_t)(p1), (uintptr_t)(p2), (uintptr_t)(p3), (uintptr_t)(p4), \
- (uintptr_t)(p5), (uintptr_t)(p6))
-
-#define HAL_TRACE_ERROR0(m) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- NCI_TRACE_0(TRACE_LAYER_HAL, TRACE_TYPE_ERROR, m); \
- }
-#define HAL_TRACE_ERROR1(m, p1) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- NCI_TRACE_1(TRACE_LAYER_HAL, TRACE_TYPE_ERROR, m, p1); \
- }
-#define HAL_TRACE_ERROR2(m, p1, p2) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- NCI_TRACE_2(TRACE_LAYER_HAL, TRACE_TYPE_ERROR, m, p1, p2); \
- }
-#define HAL_TRACE_ERROR3(m, p1, p2, p3) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- NCI_TRACE_3(TRACE_LAYER_HAL, TRACE_TYPE_ERROR, m, p1, p2, p3); \
- }
-#define HAL_TRACE_ERROR4(m, p1, p2, p3, p4) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- NCI_TRACE_4(TRACE_LAYER_HAL, TRACE_TYPE_ERROR, m, p1, p2, p3, p4); \
- }
-#define HAL_TRACE_ERROR5(m, p1, p2, p3, p4, p5) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- NCI_TRACE_5(TRACE_LAYER_HAL, TRACE_TYPE_ERROR, m, p1, p2, p3, p4, p5); \
- }
-#define HAL_TRACE_ERROR6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_ERROR) \
- NCI_TRACE_6(TRACE_LAYER_HAL, TRACE_TYPE_ERROR, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define HAL_TRACE_WARNING0(m) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- NCI_TRACE_0(TRACE_LAYER_HAL, TRACE_TYPE_WARNING, m); \
- }
-#define HAL_TRACE_WARNING1(m, p1) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- NCI_TRACE_1(TRACE_LAYER_HAL, TRACE_TYPE_WARNING, m, p1); \
- }
-#define HAL_TRACE_WARNING2(m, p1, p2) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- NCI_TRACE_2(TRACE_LAYER_HAL, TRACE_TYPE_WARNING, m, p1, p2); \
- }
-#define HAL_TRACE_WARNING3(m, p1, p2, p3) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- NCI_TRACE_3(TRACE_LAYER_HAL, TRACE_TYPE_WARNING, m, p1, p2, p3); \
- }
-#define HAL_TRACE_WARNING4(m, p1, p2, p3, p4) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- NCI_TRACE_4(TRACE_LAYER_HAL, TRACE_TYPE_WARNING, m, p1, p2, p3, p4); \
- }
-#define HAL_TRACE_WARNING5(m, p1, p2, p3, p4, p5) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- NCI_TRACE_5(TRACE_LAYER_HAL, TRACE_TYPE_WARNING, m, p1, p2, p3, p4, p5); \
- }
-#define HAL_TRACE_WARNING6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_WARNING) \
- NCI_TRACE_6(TRACE_LAYER_HAL, TRACE_TYPE_WARNING, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define HAL_TRACE_API0(m) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_API) \
- NCI_TRACE_0(TRACE_LAYER_HAL, TRACE_TYPE_API, m); \
- }
-#define HAL_TRACE_API1(m, p1) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_API) \
- NCI_TRACE_1(TRACE_LAYER_HAL, TRACE_TYPE_API, m, p1); \
- }
-#define HAL_TRACE_API2(m, p1, p2) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_API) \
- NCI_TRACE_2(TRACE_LAYER_HAL, TRACE_TYPE_API, m, p1, p2); \
- }
-#define HAL_TRACE_API3(m, p1, p2, p3) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_API) \
- NCI_TRACE_3(TRACE_LAYER_HAL, TRACE_TYPE_API, m, p1, p2, p3); \
- }
-#define HAL_TRACE_API4(m, p1, p2, p3, p4) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_API) \
- NCI_TRACE_4(TRACE_LAYER_HAL, TRACE_TYPE_API, m, p1, p2, p3, p4); \
- }
-#define HAL_TRACE_API5(m, p1, p2, p3, p4, p5) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_API) \
- NCI_TRACE_5(TRACE_LAYER_HAL, TRACE_TYPE_API, m, p1, p2, p3, p4, p5); \
- }
-#define HAL_TRACE_API6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_API) \
- NCI_TRACE_6(TRACE_LAYER_HAL, TRACE_TYPE_API, m, p1, p2, p3, p4, p5, p6); \
- }
-
-#define HAL_TRACE_EVENT0(m) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- NCI_TRACE_0(TRACE_LAYER_HAL, TRACE_TYPE_EVENT, m); \
- }
-#define HAL_TRACE_EVENT1(m, p1) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- NCI_TRACE_1(TRACE_LAYER_HAL, TRACE_TYPE_EVENT, m, p1); \
- }
-#define HAL_TRACE_EVENT2(m, p1, p2) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- NCI_TRACE_2(TRACE_LAYER_HAL, TRACE_TYPE_EVENT, m, p1, p2); \
- }
-#define HAL_TRACE_EVENT3(m, p1, p2, p3) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- NCI_TRACE_3(TRACE_LAYER_HAL, TRACE_TYPE_EVENT, m, p1, p2, p3); \
- }
-#define HAL_TRACE_EVENT4(m, p1, p2, p3, p4) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- NCI_TRACE_4(TRACE_LAYER_HAL, TRACE_TYPE_EVENT, m, p1, p2, p3, p4); \
- }
-#define HAL_TRACE_EVENT5(m, p1, p2, p3, p4, p5) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- NCI_TRACE_5(TRACE_LAYER_HAL, TRACE_TYPE_EVENT, m, p1, p2, p3, p4, p5); \
- }
-#define HAL_TRACE_EVENT6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_EVENT) \
- NCI_TRACE_6(TRACE_LAYER_HAL, TRACE_TYPE_EVENT, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#define HAL_TRACE_DEBUG0(m) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- NCI_TRACE_0(TRACE_LAYER_HAL, TRACE_TYPE_DEBUG, m); \
- }
-#define HAL_TRACE_DEBUG1(m, p1) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- NCI_TRACE_1(TRACE_LAYER_HAL, TRACE_TYPE_DEBUG, m, p1); \
- }
-#define HAL_TRACE_DEBUG2(m, p1, p2) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- NCI_TRACE_2(TRACE_LAYER_HAL, TRACE_TYPE_DEBUG, m, p1, p2); \
- }
-#define HAL_TRACE_DEBUG3(m, p1, p2, p3) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- NCI_TRACE_3(TRACE_LAYER_HAL, TRACE_TYPE_DEBUG, m, p1, p2, p3); \
- }
-#define HAL_TRACE_DEBUG4(m, p1, p2, p3, p4) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- NCI_TRACE_4(TRACE_LAYER_HAL, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4); \
- }
-#define HAL_TRACE_DEBUG5(m, p1, p2, p3, p4, p5) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- NCI_TRACE_5(TRACE_LAYER_HAL, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4, p5); \
- }
-#define HAL_TRACE_DEBUG6(m, p1, p2, p3, p4, p5, p6) \
- { \
- if (nfc_hal_cb.trace_level >= BT_TRACE_LEVEL_DEBUG) \
- NCI_TRACE_6(TRACE_LAYER_HAL, TRACE_TYPE_DEBUG, m, p1, p2, p3, p4, p5, \
- p6); \
- }
-
-#else /* Disable HAL tracing */
-
-#define HAL_TRACE_0(l, t, m)
-#define HAL_TRACE_1(l, t, m, p1)
-#define HAL_TRACE_2(l, t, m, p1, p2)
-#define HAL_TRACE_3(l, t, m, p1, p2, p3)
-#define HAL_TRACE_4(l, t, m, p1, p2, p3, p4)
-#define HAL_TRACE_5(l, t, m, p1, p2, p3, p4, p5)
-#define HAL_TRACE_6(l, t, m, p1, p2, p3, p4, p5, p6)
-
-#define HAL_TRACE_ERROR0(m)
-#define HAL_TRACE_ERROR1(m, p1)
-#define HAL_TRACE_ERROR2(m, p1, p2)
-#define HAL_TRACE_ERROR3(m, p1, p2, p3)
-#define HAL_TRACE_ERROR4(m, p1, p2, p3, p4)
-#define HAL_TRACE_ERROR5(m, p1, p2, p3, p4, p5)
-#define HAL_TRACE_ERROR6(m, p1, p2, p3, p4, p5, p6)
-
-#define HAL_TRACE_WARNING0(m)
-#define HAL_TRACE_WARNING1(m, p1)
-#define HAL_TRACE_WARNING2(m, p1, p2)
-#define HAL_TRACE_WARNING3(m, p1, p2, p3)
-#define HAL_TRACE_WARNING4(m, p1, p2, p3, p4)
-#define HAL_TRACE_WARNING5(m, p1, p2, p3, p4, p5)
-#define HAL_TRACE_WARNING6(m, p1, p2, p3, p4, p5, p6)
-
-#define HAL_TRACE_API0(m)
-#define HAL_TRACE_API1(m, p1)
-#define HAL_TRACE_API2(m, p1, p2)
-#define HAL_TRACE_API3(m, p1, p2, p3)
-#define HAL_TRACE_API4(m, p1, p2, p3, p4)
-#define HAL_TRACE_API5(m, p1, p2, p3, p4, p5)
-#define HAL_TRACE_API6(m, p1, p2, p3, p4, p5, p6)
-
-#define HAL_TRACE_EVENT0(m)
-#define HAL_TRACE_EVENT1(m, p1)
-#define HAL_TRACE_EVENT2(m, p1, p2)
-#define HAL_TRACE_EVENT3(m, p1, p2, p3)
-#define HAL_TRACE_EVENT4(m, p1, p2, p3, p4)
-#define HAL_TRACE_EVENT5(m, p1, p2, p3, p4, p5)
-#define HAL_TRACE_EVENT6(m, p1, p2, p3, p4, p5, p6)
-
-#define HAL_TRACE_DEBUG0(m)
-#define HAL_TRACE_DEBUG1(m, p1)
-#define HAL_TRACE_DEBUG2(m, p1, p2)
-#define HAL_TRACE_DEBUG3(m, p1, p2, p3)
-#define HAL_TRACE_DEBUG4(m, p1, p2, p3, p4)
-#define HAL_TRACE_DEBUG5(m, p1, p2, p3, p4, p5)
-#define HAL_TRACE_DEBUG6(m, p1, p2, p3, p4, p5, p6)
-#endif /* Disable HAL tracing */
-
#endif /* GKI_TARGET_H */
diff --git a/src/include/nfc_target.h b/src/include/nfc_target.h
index 7cd1f51..96ed6eb 100644
--- a/src/include/nfc_target.h
+++ b/src/include/nfc_target.h
@@ -19,6 +19,7 @@
#ifndef NFC_TARGET_H
#define NFC_TARGET_H
+#include "_OverrideLog.h"
#include "data_types.h"
#ifdef BUILDCFG
@@ -29,9 +30,6 @@
#include "gki_target.h"
#include "bt_types.h" /* This must be defined AFTER buildcfg.h */
-#ifndef LMP_TEST
-#include "bt_trace.h"
-#endif
#ifndef USERIAL_DEBUG
#define USERIAL_DEBUG FALSE
diff --git a/src/include/nfc_types.h b/src/include/nfc_types.h
index 77149cf..c72b0a2 100644
--- a/src/include/nfc_types.h
+++ b/src/include/nfc_types.h
@@ -319,20 +319,6 @@
/*****************************************************************************
** Define trace levels
*****************************************************************************/
-
-/* No trace messages to be generated */
-#define BT_TRACE_LEVEL_NONE 0
-/* Error condition trace messages */
-#define BT_TRACE_LEVEL_ERROR 1
-/* Warning condition trace messages */
-#define BT_TRACE_LEVEL_WARNING 2
-/* API traces */
-#define BT_TRACE_LEVEL_API 3
-/* Debug messages for events */
-#define BT_TRACE_LEVEL_EVENT 4
-/* Full debug messages */
-#define BT_TRACE_LEVEL_DEBUG 5
-
#define TRACE_CTRL_GENERAL 0x00000000
#define TRACE_LAYER_NCI 0x00280000
#define TRACE_LAYER_HAL 0x00310000
diff --git a/src/nfa/ce/nfa_ce_act.cc b/src/nfa/ce/nfa_ce_act.cc
index 6e1166b..675d193 100644
--- a/src/nfa/ce/nfa_ce_act.cc
+++ b/src/nfa/ce/nfa_ce_act.cc
@@ -49,7 +49,8 @@
tNFA_CE_CB* p_cb = &nfa_ce_cb;
tNFA_CONN_EVT_DATA conn_evt;
- NFA_TRACE_DEBUG1("nfa_ce_handle_t3t_evt: event 0x%x", event);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_ce_handle_t3t_evt: event 0x%x", event);
switch (event) {
case CE_T3T_NDEF_UPDATE_START_EVT:
@@ -58,7 +59,7 @@
conn_evt.status = NFA_STATUS_OK;
(*p_cb->p_active_conn_cback)(NFA_CE_NDEF_WRITE_START_EVT, &conn_evt);
} else {
- NFA_TRACE_ERROR0(
+ LOG(ERROR) << StringPrintf(
"nfa_ce_handle_t3t_evt: got CE_T3T_UPDATE_START_EVT, but no active "
"NDEF");
}
@@ -72,7 +73,7 @@
conn_evt.ndef_write_cplt.p_data = p_ce_data->update_info.p_data;
(*p_cb->p_active_conn_cback)(NFA_CE_NDEF_WRITE_CPLT_EVT, &conn_evt);
} else {
- NFA_TRACE_ERROR0(
+ LOG(ERROR) << StringPrintf(
"nfa_ce_handle_t3t_evt: got CE_T3T_UPDATE_CPLT_EVT, but no active "
"NDEF");
}
@@ -98,7 +99,8 @@
break;
default:
- NFA_TRACE_DEBUG1("nfa_ce_handle_t3t_evt unhandled event=0x%02x", event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfa_ce_handle_t3t_evt unhandled event=0x%02x", event);
break;
}
}
@@ -116,7 +118,8 @@
tNFA_CE_CB* p_cb = &nfa_ce_cb;
tNFA_CONN_EVT_DATA conn_evt;
- NFA_TRACE_DEBUG1("nfa_ce_handle_t4t_evt: event 0x%x", event);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_ce_handle_t4t_evt: event 0x%x", event);
/* AID for NDEF selected. we had notified the app of activation. */
p_cb->idx_cur_active = NFA_CE_LISTEN_INFO_IDX_NDEF;
@@ -154,7 +157,8 @@
default:
/* CE_T4T_RAW_FRAME_EVT is not used in NFA CE */
- NFA_TRACE_DEBUG1("nfa_ce_handle_t4t_evt unhandled event=0x%02x", event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfa_ce_handle_t4t_evt unhandled event=0x%02x", event);
break;
}
}
@@ -174,7 +178,8 @@
uint8_t listen_info_idx;
tNFA_CONN_EVT_DATA conn_evt;
- NFA_TRACE_DEBUG1("nfa_ce_handle_t4t_aid_evt: event 0x%x", event);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_ce_handle_t4t_aid_evt: event 0x%x", event);
/* Get listen_info for this aid callback */
for (listen_info_idx = 0; listen_info_idx < NFA_CE_LISTEN_INFO_IDX_INVALID;
@@ -219,10 +224,10 @@
conn_evt.ce_data.len = p_ce_data->raw_frame.p_data->len;
(*p_cb->p_active_conn_cback)(NFA_CE_DATA_EVT, &conn_evt);
} else {
- NFA_TRACE_ERROR1(
+ LOG(ERROR) << StringPrintf(
"nfa_ce_handle_t4t_aid_evt: unable to find listen_info for aid hdl "
"%i",
- p_ce_data->raw_frame.aid_handle)
+ p_ce_data->raw_frame.aid_handle);
}
GKI_freebuf(p_ce_data->raw_frame.p_data);
@@ -244,11 +249,12 @@
*******************************************************************************/
void nfa_ce_discovery_cback(tNFA_DM_RF_DISC_EVT event, tNFC_DISCOVER* p_data) {
tNFA_CE_MSG ce_msg;
- NFA_TRACE_DEBUG1("nfa_ce_discovery_cback(): event:0x%02X", event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("event:0x%02X", event);
switch (event) {
case NFA_DM_RF_DISC_START_EVT:
- NFA_TRACE_DEBUG1("nfa_ce_handle_disc_start (status=0x%x)", p_data->start);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfa_ce_handle_disc_start (status=0x%x)", p_data->start);
break;
case NFA_DM_RF_DISC_ACTIVATED_EVT:
@@ -268,7 +274,7 @@
break;
default:
- NFA_TRACE_ERROR0("Unexpected event");
+ LOG(ERROR) << StringPrintf("Unexpected event");
break;
}
}
@@ -494,8 +500,9 @@
p_cb->listen_info[listen_info_idx].tech_proto_mask = listen_mask;
}
} else {
- NFA_TRACE_ERROR1("UICC[0x%x] is not activated",
- p_cb->listen_info[listen_info_idx].ee_handle);
+ LOG(ERROR) << StringPrintf(
+ "UICC[0x%x] is not activated",
+ p_cb->listen_info[listen_info_idx].ee_handle);
}
}
#endif
@@ -554,7 +561,8 @@
tNFA_CE_CB* p_cb = &nfa_ce_cb;
tNFA_CONN_EVT_DATA conn_evt;
- NFA_TRACE_DEBUG1("NFA_CE: removing listen_info entry %i", listen_info_idx);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NFA_CE: removing listen_info entry %i", listen_info_idx);
/* Notify app that listening has stopped if requested (for API deregister) */
/* For LISTEN_START failures, app has already notified of NFA_LISTEN_START_EVT
@@ -671,7 +679,7 @@
if (nfa_ce_cb.p_scratch_buf != NULL) {
nfa_ce_cb.scratch_buf_size = nfa_ce_cb.ndef_max_size;
} else {
- NFA_TRACE_ERROR1(
+ LOG(ERROR) << StringPrintf(
"Unable to allocate scratch buffer for writable NDEF message (%i "
"bytes)",
nfa_ce_cb.ndef_max_size);
@@ -705,7 +713,7 @@
return (NFA_STATUS_OK);
}
- NFA_TRACE_DEBUG0("Setting NDEF contents");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("Setting NDEF contents");
readonly = (p_cb->listen_info[NFA_CE_LISTEN_INFO_IDX_NDEF].flags &
NFC_CE_LISTEN_INFO_READONLY_NDEF)
@@ -739,7 +747,7 @@
CE_T3tSetLocalNDEFMsg(true, 0, 0, NULL, NULL);
CE_T4tSetLocalNDEFMsg(true, 0, 0, NULL, NULL);
- NFA_TRACE_ERROR1("Unable to set contents (error %02x)", status);
+ LOG(ERROR) << StringPrintf("Unable to set contents (error %02x)", status);
}
return (status);
@@ -770,8 +778,8 @@
uint8_t i;
bool t4t_activate_pending = false;
- NFA_TRACE_DEBUG1("nfa_ce_activate_ntf () protocol=%d",
- p_ce_msg->activate_ntf.p_activation_params->protocol);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "protocol=%d", p_ce_msg->activate_ntf.p_activation_params->protocol);
/* Tag is in listen active state */
p_cb->flags |= NFA_CE_FLAGS_LISTEN_ACTIVE_SLEEP;
@@ -881,7 +889,7 @@
((listen_info_idx == NFA_CE_LISTEN_INFO_IDX_NDEF) &&
!(p_cb->listen_info[NFA_CE_LISTEN_INFO_IDX_NDEF].flags &
NFA_CE_LISTEN_INFO_IN_USE))) {
- NFA_TRACE_DEBUG1(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"No listen_info found for this activation. listen_info_idx=%d",
listen_info_idx);
return true;
@@ -943,7 +951,7 @@
tNFA_CONN_EVT_DATA conn_evt;
uint8_t i;
- NFA_TRACE_DEBUG1("nfa_ce_deactivate_ntf () deact_type=%d", deact_type);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("deact_type=%d", deact_type);
/* Check if deactivating to SLEEP mode */
if ((deact_type == NFC_DEACTIVATE_TYPE_SLEEP) ||
@@ -1042,7 +1050,7 @@
tNFA_CE_CB* p_cb = &nfa_ce_cb;
tNFA_CONN_EVT_DATA evt_data;
- NFA_TRACE_DEBUG0("Disabling local NDEF tag");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("Disabling local NDEF tag");
/* If local NDEF tag is in use, then disable it */
if (p_cb->listen_info[NFA_CE_LISTEN_INFO_IDX_NDEF].flags &
@@ -1092,9 +1100,9 @@
return true;
}
- NFA_TRACE_DEBUG5(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"Configuring local NDEF tag: protocol_mask=%01x cur_size=%i, "
- "max_size=%i, readonly=%i",
+ "max_size=%i, readonly=%i uid_len=%i",
p_ce_msg->local_tag.protocol_mask, p_ce_msg->local_tag.ndef_cur_size,
p_ce_msg->local_tag.ndef_max_size, p_ce_msg->local_tag.read_only,
p_ce_msg->local_tag.uid_len);
@@ -1145,7 +1153,8 @@
(NFA_PROTOCOL_MASK_T3T | NFA_PROTOCOL_MASK_ISO_DEP)) {
/* Ok to set contents now */
if (nfa_ce_set_content() != NFA_STATUS_OK) {
- NFA_TRACE_ERROR0("nfa_ce_api_cfg_local_tag: could not set contents");
+ LOG(ERROR) << StringPrintf(
+ "nfa_ce_api_cfg_local_tag: could not set contents");
nfa_dm_conn_cback_event_notify(NFA_CE_LOCAL_TAG_CONFIGURED_EVT,
&conn_evt);
return true;
@@ -1175,8 +1184,9 @@
uint8_t i;
uint8_t listen_info_idx = NFA_CE_LISTEN_INFO_IDX_INVALID;
- NFA_TRACE_DEBUG1("Registering UICC/Felica/Type-4 tag listener. Type=%i",
- p_ce_msg->reg_listen.listen_type);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Registering UICC/Felica/Type-4 tag listener. Type=%i",
+ p_ce_msg->reg_listen.listen_type);
/* Look for available entry in listen_info table */
/* - If registering UICC listen, make sure there isn't another entry for the
@@ -1187,8 +1197,8 @@
(p_cb->listen_info[i].flags & NFA_CE_LISTEN_INFO_IN_USE) &&
(p_cb->listen_info[i].flags & NFA_CE_LISTEN_INFO_UICC) &&
(p_cb->listen_info[i].ee_handle == p_ce_msg->reg_listen.ee_handle)) {
- NFA_TRACE_ERROR1("UICC (0x%x) listening already specified",
- p_ce_msg->reg_listen.ee_handle);
+ LOG(ERROR) << StringPrintf("UICC (0x%x) listening already specified",
+ p_ce_msg->reg_listen.ee_handle);
conn_evt.status = NFA_STATUS_FAILED;
nfa_dm_conn_cback_event_notify(NFA_CE_UICC_LISTEN_CONFIGURED_EVT,
&conn_evt);
@@ -1203,8 +1213,8 @@
/* Add new entry to listen_info table */
if (listen_info_idx == NFA_CE_LISTEN_INFO_IDX_INVALID) {
- NFA_TRACE_ERROR1("Maximum listen callbacks exceeded (%i)",
- NFA_CE_LISTEN_INFO_MAX);
+ LOG(ERROR) << StringPrintf("Maximum listen callbacks exceeded (%i)",
+ NFA_CE_LISTEN_INFO_MAX);
if (p_ce_msg->reg_listen.listen_type == NFA_CE_REG_TYPE_UICC) {
conn_evt.status = NFA_STATUS_FAILED;
@@ -1218,7 +1228,8 @@
}
return true;
} else {
- NFA_TRACE_DEBUG1("NFA_CE: adding listen_info entry %i", listen_info_idx);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NFA_CE: adding listen_info entry %i", listen_info_idx);
/* Store common parameters */
/* Mark entry as 'in-use', and NFA_CE_LISTEN_INFO_START_NTF_PND */
@@ -1243,7 +1254,7 @@
nfa_ce_handle_t4t_aid_evt);
if (p_cb->listen_info[listen_info_idx].t4t_aid_handle ==
CE_T4T_AID_HANDLE_INVALID) {
- NFA_TRACE_ERROR0("Unable to register AID");
+ LOG(ERROR) << StringPrintf("Unable to register AID");
p_cb->listen_info[listen_info_idx].flags = 0;
/* Notify application */
@@ -1294,7 +1305,7 @@
/* Start listening */
conn_evt.status = nfa_ce_start_listening();
if (conn_evt.status != NFA_STATUS_OK) {
- NFA_TRACE_ERROR0(
+ LOG(ERROR) << StringPrintf(
"nfa_ce_api_reg_listen: unable to register new listen params with DM");
p_cb->listen_info[listen_info_idx].flags = 0;
}
@@ -1305,8 +1316,9 @@
NFA_CE_UICC_LISTEN_CONFIGURED_EVT, &conn_evt);
} else {
conn_evt.ce_registered.handle = NFA_HANDLE_GROUP_CE | listen_info_idx;
- NFA_TRACE_DEBUG1("nfa_ce_api_reg_listen: registered handle 0x%04X",
- conn_evt.ce_registered.handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_ce_api_reg_listen: registered handle 0x%04X",
+ conn_evt.ce_registered.handle);
(*p_cb->listen_info[listen_info_idx].p_conn_cback)(NFA_CE_REGISTERED_EVT,
&conn_evt);
}
@@ -1365,8 +1377,7 @@
}
if (listen_info_idx == NFA_CE_LISTEN_INFO_MAX) {
- NFA_TRACE_ERROR0(
- "nfa_ce_api_dereg_listen (): cannot find listen_info for UICC");
+ LOG(ERROR) << StringPrintf("cannot find listen_info for UICC");
conn_evt.status = NFA_STATUS_INVALID_PARAM;
nfa_dm_conn_cback_event_notify(NFA_CE_UICC_LISTEN_CONFIGURED_EVT,
&conn_evt);
@@ -1403,8 +1414,8 @@
nfa_ce_remove_listen_info_entry(listen_info_idx, true);
}
} else {
- NFA_TRACE_ERROR0(
- "nfa_ce_api_dereg_listen (): cannot find listen_info for "
+ LOG(ERROR) << StringPrintf(
+ "cannot find listen_info for "
"Felica/T4tAID");
conn_evt.status = NFA_STATUS_INVALID_PARAM;
nfa_dm_conn_cback_event_notify(NFA_CE_DEREGISTERED_EVT, &conn_evt);
diff --git a/src/nfa/ce/nfa_ce_api.cc b/src/nfa/ce/nfa_ce_api.cc
index 836f0c3..d797251 100644
--- a/src/nfa/ce/nfa_ce_api.cc
+++ b/src/nfa/ce/nfa_ce_api.cc
@@ -47,7 +47,7 @@
/* Validate handle */
if ((listen_info != NFA_CE_LISTEN_INFO_UICC) &&
((handle & NFA_HANDLE_GROUP_MASK) != NFA_HANDLE_GROUP_CE)) {
- NFA_TRACE_ERROR0("nfa_ce_api_reregister_listen: Invalid handle");
+ LOG(ERROR) << StringPrintf("nfa_ce_api_reregister_listen: Invalid handle");
return (NFA_STATUS_BAD_HANDLE);
}
@@ -61,7 +61,7 @@
return (NFA_STATUS_OK);
} else {
- NFA_TRACE_ERROR0("nfa_ce_api_reregister_listen: Out of buffers");
+ LOG(ERROR) << StringPrintf("nfa_ce_api_reregister_listen: Out of buffers");
return (NFA_STATUS_FAILED);
}
}
@@ -119,25 +119,26 @@
{
tNFA_CE_MSG* p_msg;
- NFA_TRACE_API0("NFA_CeConfigureLocalTag ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (protocol_mask) {
/* If any protocols are specified, then NDEF buffer pointer must be non-NULL
*/
if (p_ndef_data == NULL) {
- NFA_TRACE_ERROR0("NFA_CeConfigureLocalTag: NULL ndef data pointer");
+ LOG(ERROR) << StringPrintf(
+ "NFA_CeConfigureLocalTag: NULL ndef data pointer");
return (NFA_STATUS_INVALID_PARAM);
}
if ((protocol_mask & NFA_PROTOCOL_MASK_T1T) ||
(protocol_mask & NFA_PROTOCOL_MASK_T2T)) {
- NFA_TRACE_ERROR0(
+ LOG(ERROR) << StringPrintf(
"NFA_CeConfigureLocalTag: Cannot emulate Type 1 / Type 2 tag");
return (NFA_STATUS_INVALID_PARAM);
}
if (uid_len) {
- NFA_TRACE_ERROR1(
+ LOG(ERROR) << StringPrintf(
"NFA_CeConfigureLocalTag: Cannot Set UID for Protocol_mask: 0x%x",
protocol_mask);
return (NFA_STATUS_INVALID_PARAM);
@@ -195,8 +196,8 @@
#if (NFC_NFCEE_INCLUDED == TRUE)
tNFA_CE_MSG* p_msg;
- NFA_TRACE_API1("NFA_CeConfigureUiccListenTech () ee_handle = 0x%x",
- ee_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("ee_handle = 0x%x", ee_handle);
/* If tech_mask is zero, then app is disabling listening for specified uicc */
if (tech_mask == 0) {
@@ -218,8 +219,8 @@
return (NFA_STATUS_OK);
}
#else
- NFA_TRACE_ERROR0(
- "NFA_CeConfigureUiccListenTech () NFCEE related functions are not "
+ LOG(ERROR) << StringPrintf(
+ "NFCEE related functions are not "
"enabled!");
#endif
return (NFA_STATUS_FAILED);
@@ -249,7 +250,7 @@
tNFA_CONN_CBACK* p_conn_cback) {
tNFA_CE_MSG* p_msg;
- NFA_TRACE_API0("NFA_CeRegisterFelicaSystemCodeOnDH ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* Validate parameters */
if (p_conn_cback == NULL) return (NFA_STATUS_INVALID_PARAM);
@@ -294,8 +295,7 @@
**
*******************************************************************************/
tNFA_STATUS NFA_CeDeregisterFelicaSystemCodeOnDH(tNFA_HANDLE handle) {
- NFA_TRACE_API1("NFA_CeDeregisterFelicaSystemCodeOnDH (): handle:0x%X",
- handle);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("handle:0x%X", handle);
return (nfa_ce_api_deregister_listen(handle, NFA_CE_LISTEN_INFO_FELICA));
}
@@ -325,7 +325,7 @@
tNFA_CONN_CBACK* p_conn_cback) {
tNFA_CE_MSG* p_msg;
- NFA_TRACE_API0("NFA_CeRegisterAidOnDH ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* Validate parameters */
if (p_conn_cback == NULL) return (NFA_STATUS_INVALID_PARAM);
@@ -368,7 +368,7 @@
**
*******************************************************************************/
tNFA_STATUS NFA_CeDeregisterAidOnDH(tNFA_HANDLE handle) {
- NFA_TRACE_API1("NFA_CeDeregisterAidOnDH (): handle:0x%X", handle);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("handle:0x%X", handle);
return (nfa_ce_api_deregister_listen(handle, NFA_CE_LISTEN_INFO_T4T_AID));
}
@@ -403,9 +403,10 @@
tNFA_TECHNOLOGY_MASK use_mask =
(NFA_TECHNOLOGY_MASK_A | NFA_TECHNOLOGY_MASK_B);
- NFA_TRACE_API1("NFA_CeSetIsoDepListenTech (): 0x%x", tech_mask);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("0x%x", tech_mask);
if (((tech_mask & use_mask) == 0) || ((tech_mask & ~use_mask) != 0)) {
- NFA_TRACE_ERROR0("NFA_CeSetIsoDepListenTech: Invalid technology mask");
+ LOG(ERROR) << StringPrintf(
+ "NFA_CeSetIsoDepListenTech: Invalid technology mask");
return (NFA_STATUS_INVALID_PARAM);
}
diff --git a/src/nfa/ce/nfa_ce_main.cc b/src/nfa/ce/nfa_ce_main.cc
index f9198a9..95a0a04 100644
--- a/src/nfa/ce/nfa_ce_main.cc
+++ b/src/nfa/ce/nfa_ce_main.cc
@@ -56,9 +56,7 @@
/*****************************************************************************
** Local function prototypes
*****************************************************************************/
-#if (BT_TRACE_VERBOSE == TRUE)
static std::string nfa_ce_evt_2_str(uint16_t event);
-#endif
/*******************************************************************************
**
@@ -70,7 +68,7 @@
**
*******************************************************************************/
void nfa_ce_init(void) {
- NFA_TRACE_DEBUG0("nfa_ce_init ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* initialize control block */
memset(&nfa_ce_cb, 0, sizeof(tNFA_CE_CB));
@@ -133,8 +131,8 @@
tNFA_CE_CB* p_cb = &nfa_ce_cb;
uint8_t listen_info_idx;
- NFA_TRACE_DEBUG1("nfa_ce_proc_nfcc_power_mode (): nfcc_power_mode=%d",
- nfcc_power_mode);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfcc_power_mode=%d", nfcc_power_mode);
/* if NFCC power mode is change to full power */
if (nfcc_power_mode == NFA_DM_PWR_MODE_FULL) {
@@ -170,14 +168,9 @@
uint16_t act_idx;
bool freebuf = true;
-#if (BT_TRACE_VERBOSE == TRUE)
- NFA_TRACE_EVENT3("nfa_ce_handle_event event: %s (0x%02x), flags: %08x",
- nfa_ce_evt_2_str(p_msg->event).c_str(), p_msg->event,
- nfa_ce_cb.flags);
-#else
- NFA_TRACE_EVENT2("nfa_ce_handle_event event: 0x%x, flags: %08x", p_msg->event,
- nfa_ce_cb.flags);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfa_ce_handle_event event: %s (0x%02x), flags: %08x",
+ nfa_ce_evt_2_str(p_msg->event).c_str(), p_msg->event, nfa_ce_cb.flags);
/* Get NFA_RW sub-event */
act_idx = (p_msg->event & 0x00FF);
@@ -193,7 +186,6 @@
return freebuf;
}
-#if (BT_TRACE_VERBOSE == TRUE)
/*******************************************************************************
**
** Function nfa_ce_evt_2_str
@@ -219,4 +211,3 @@
return "Unknown";
}
}
-#endif /* BT_TRACE_VERBOSE */
diff --git a/src/nfa/dm/nfa_dm_act.cc b/src/nfa/dm/nfa_dm_act.cc
index 61c36fc..1986403 100644
--- a/src/nfa/dm/nfa_dm_act.cc
+++ b/src/nfa/dm/nfa_dm_act.cc
@@ -89,9 +89,8 @@
static void nfa_dm_nfcc_power_mode_proc_complete_cback(void) {
tNFA_DM_PWR_MODE_CHANGE power_mode_change;
- NFA_TRACE_DEBUG1(
- "nfa_dm_nfcc_power_mode_proc_complete_cback () nfcc_pwr_mode = 0x%x",
- nfa_dm_cb.nfcc_pwr_mode);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfcc_pwr_mode = 0x%x", nfa_dm_cb.nfcc_pwr_mode);
/* if NFCC power state is change to full power */
if (nfa_dm_cb.nfcc_pwr_mode != NFA_DM_PWR_MODE_OFF_SLEEP) {
@@ -205,15 +204,15 @@
**
*******************************************************************************/
void nfa_dm_proc_nfcc_power_mode(uint8_t nfcc_power_mode) {
- NFA_TRACE_DEBUG1("nfa_dm_proc_nfcc_power_mode (): nfcc_power_mode=%d",
- nfcc_power_mode);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfcc_power_mode=%d", nfcc_power_mode);
/* if NFCC power mode is change to full power */
if (nfcc_power_mode == NFA_DM_PWR_MODE_FULL) {
memset(&nfa_dm_cb.params, 0x00, sizeof(tNFA_DM_PARAMS));
- NFA_TRACE_DEBUG2("setcfg_pending_mask=0x%x, setcfg_pending_num=%d",
- nfa_dm_cb.setcfg_pending_mask,
- nfa_dm_cb.setcfg_pending_num);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "setcfg_pending_mask=0x%x, setcfg_pending_num=%d",
+ nfa_dm_cb.setcfg_pending_mask, nfa_dm_cb.setcfg_pending_num);
nfa_dm_cb.setcfg_pending_mask = 0;
nfa_dm_cb.setcfg_pending_num = 0;
@@ -262,12 +261,8 @@
uint8_t dm_cback_evt;
uint8_t max_ee = 0;
-#if (BT_TRACE_VERBOSE == TRUE)
- NFA_TRACE_DEBUG2("nfa_dm_nfc_response_cback () %s(0x%x)",
- nfa_dm_nfc_revt_2_str(event).c_str(), event);
-#else
- NFA_TRACE_DEBUG1("nfa_dm_nfc_response_cback () event=0x%x", event);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s(0x%x)", nfa_dm_nfc_revt_2_str(event).c_str(), event);
switch (event) {
case NFC_ENABLE_REVT: /* 0 Enable event */
@@ -315,7 +310,8 @@
} else {
/* This should not occur (means we got a SET_CONFIG_NTF that's
* unaccounted for */
- NFA_TRACE_ERROR0("NFA received unexpected NFC_SET_CONFIG_REVT");
+ LOG(ERROR) << StringPrintf(
+ "NFA received unexpected NFC_SET_CONFIG_REVT");
}
break;
@@ -391,7 +387,8 @@
case NFC_NFCC_TIMEOUT_REVT:
case NFC_NFCC_TRANSPORT_ERR_REVT:
- NFA_TRACE_DEBUG1("flags:0x%08x", nfa_dm_cb.flags);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("flags:0x%08x", nfa_dm_cb.flags);
dm_cback_evt = (event == NFC_NFCC_TIMEOUT_REVT)
? NFA_DM_NFCC_TIMEOUT_EVT
: NFA_DM_NFCC_TRANSPORT_ERR_EVT;
@@ -428,7 +425,7 @@
*******************************************************************************/
bool nfa_dm_enable(tNFA_DM_MSG* p_data) {
tNFA_DM_CBACK_DATA dm_cback_data;
- NFA_TRACE_DEBUG0("nfa_dm_enable ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* Check if NFA is already enabled */
if (!(nfa_dm_cb.flags & NFA_DM_FLAGS_DM_IS_ACTIVE)) {
@@ -445,7 +442,7 @@
/* Enable NFC stack */
NFC_Enable(nfa_dm_nfc_response_cback);
} else {
- NFA_TRACE_ERROR0("nfa_dm_enable: ERROR ALREADY ENABLED.");
+ LOG(ERROR) << StringPrintf("nfa_dm_enable: ERROR ALREADY ENABLED.");
dm_cback_data.status = NFA_STATUS_ALREADY_STARTED;
(*(p_data->enable.p_dm_cback))(NFA_DM_ENABLE_EVT, &dm_cback_data);
}
@@ -463,7 +460,8 @@
**
*******************************************************************************/
bool nfa_dm_disable(tNFA_DM_MSG* p_data) {
- NFA_TRACE_DEBUG1("nfa_dm_disable (): graceful:%d", p_data->disable.graceful);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("graceful:%d", p_data->disable.graceful);
if (p_data->disable.graceful) {
/* if RF discovery is enabled */
@@ -512,11 +510,11 @@
**
*******************************************************************************/
void nfa_dm_disable_complete(void) {
- NFA_TRACE_DEBUG0("nfa_dm_disable_complete ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if ((nfa_dm_cb.flags & NFA_DM_FLAGS_DM_DISABLING_NFC) == 0) {
- NFA_TRACE_DEBUG0(
- "nfa_dm_disable_complete (): proceeding with nfc core shutdown.");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("proceeding with nfc core shutdown.");
nfa_dm_cb.flags |= NFA_DM_FLAGS_DM_DISABLING_NFC;
@@ -592,12 +590,12 @@
tNFC_STATUS status;
tNFA_DM_CBACK_DATA dm_cback_data;
- NFA_TRACE_DEBUG0(" nfa_dm_set_power_sub_state ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
nfa_dm_cb.power_state = p_data->set_power_state.screen_state;
if (nfa_dm_cb.disc_cb.disc_state == NFA_DM_RFST_LISTEN_ACTIVE) {
- NFA_TRACE_DEBUG0(
- "nfa_dm_set_power_sub_state () : NFA_DM_RFST_LISTEN_ACTIVE");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NFA_DM_RFST_LISTEN_ACTIVE");
/* NFCC will give semantic error for power sub state command in Rf listen
* active state */
status = NFC_STATUS_SEMANTIC_ERROR;
@@ -645,7 +643,7 @@
void nfa_dm_rel_excl_rf_control_and_notify(void) {
tNFA_CONN_EVT_DATA conn_evt;
- NFA_TRACE_DEBUG0("nfa_dm_rel_excl_rf_control_and_notify ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* Exclusive RF control stopped. Notify app */
nfa_dm_cb.flags &= ~NFA_DM_FLAGS_EXCL_RF_ACTIVE;
@@ -673,7 +671,7 @@
bool nfa_dm_act_request_excl_rf_ctrl(tNFA_DM_MSG* p_data) {
tNFA_CONN_EVT_DATA conn_evt;
- NFA_TRACE_DEBUG0("nfa_dm_act_request_excl_rf_ctrl ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (!nfa_dm_cb.p_excl_conn_cback) {
if (nfa_dm_cb.disc_cb.disc_state != NFA_DM_RFST_IDLE) {
@@ -694,7 +692,7 @@
&p_data->req_excl_rf_ctrl.listen_cfg,
nfa_dm_excl_disc_cback);
} else {
- NFA_TRACE_ERROR0("Exclusive rf control already requested");
+ LOG(ERROR) << StringPrintf("Exclusive rf control already requested");
conn_evt.status = NFA_STATUS_FAILED;
(*p_data->req_excl_rf_ctrl.p_conn_cback)(
@@ -714,7 +712,7 @@
**
*******************************************************************************/
bool nfa_dm_act_release_excl_rf_ctrl(tNFA_DM_MSG* p_data) {
- NFA_TRACE_DEBUG0("nfa_dm_act_release_excl_rf_ctrl ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* nfa_dm_rel_excl_rf_control_and_notify() is called when discovery state goes
* IDLE */
@@ -747,7 +745,7 @@
tNFA_CONN_EVT_DATA conn_evt;
tNFA_DEACTIVATE_TYPE deact_type;
- NFA_TRACE_DEBUG0("nfa_dm_act_deactivate ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* Always allow deactivate to IDLE */
/* Do not allow deactivate to SLEEP for T1T,NFCDEP, ISO15693 */
@@ -796,7 +794,7 @@
}
}
- NFA_TRACE_ERROR0("nfa_dm_act_deactivate (): invalid protocol, mode or state");
+ LOG(ERROR) << StringPrintf("invalid protocol, mode or state");
/* Notify error to application */
conn_evt.status = NFA_STATUS_FAILED;
@@ -815,7 +813,7 @@
**
*******************************************************************************/
bool nfa_dm_act_power_off_sleep(tNFA_DM_MSG* p_data) {
- NFA_TRACE_DEBUG0("nfa_dm_act_power_off_sleep ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
NFC_SetPowerOffSleep((bool)(p_data->hdr.layer_specific));
@@ -834,7 +832,7 @@
bool nfa_dm_act_reg_vsc(tNFA_DM_MSG* p_data) {
if (NFC_RegVSCback(p_data->reg_vsc.is_register, p_data->reg_vsc.p_cback) !=
NFC_STATUS_OK) {
- NFA_TRACE_ERROR0("NFC_RegVSCback failed");
+ LOG(ERROR) << StringPrintf("NFC_RegVSCback failed");
}
return true;
}
@@ -900,7 +898,7 @@
tNFA_TECHNOLOGY_MASK poll_tech_mask;
tNFA_DM_DISC_TECH_PROTO_MASK poll_disc_mask = 0;
- NFA_TRACE_DEBUG0("nfa_dm_start_polling ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
poll_tech_mask = nfa_dm_cb.poll_mask;
@@ -968,7 +966,7 @@
bool nfa_dm_act_enable_polling(tNFA_DM_MSG* p_data) {
tNFA_CONN_EVT_DATA evt_data;
- NFA_TRACE_DEBUG0("nfa_dm_act_enable_polling ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if ((!(nfa_dm_cb.flags & NFA_DM_FLAGS_POLLING_ENABLED)) &&
(!(nfa_dm_cb.flags & NFA_DM_FLAGS_EXCL_RF_ACTIVE))) {
@@ -982,7 +980,7 @@
return true;
}
} else {
- NFA_TRACE_ERROR0("nfa_dm_act_enable_polling (): already started");
+ LOG(ERROR) << StringPrintf("already started");
}
/* send NFA_POLL_ENABLED_EVT with NFA_STATUS_FAILED */
@@ -1002,7 +1000,7 @@
**
*******************************************************************************/
static bool nfa_dm_deactivate_polling(void) {
- NFA_TRACE_DEBUG0("nfa_dm_deactivate_polling ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if ((nfa_dm_cb.disc_cb.disc_state == NFA_DM_RFST_W4_ALL_DISCOVERIES) ||
(nfa_dm_cb.disc_cb.disc_state == NFA_DM_RFST_W4_HOST_SELECT)) {
@@ -1033,7 +1031,7 @@
bool nfa_dm_act_disable_polling(tNFA_DM_MSG* p_data) {
tNFA_CONN_EVT_DATA evt_data;
- NFA_TRACE_DEBUG0("nfa_dm_act_disable_polling ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (nfa_dm_cb.poll_disc_handle != NFA_HANDLE_INVALID) {
nfa_dm_cb.flags &= ~NFA_DM_FLAGS_POLLING_ENABLED;
@@ -1067,7 +1065,7 @@
bool nfa_dm_act_enable_listening(tNFA_DM_MSG* p_data) {
tNFA_CONN_EVT_DATA evt_data;
- NFA_TRACE_DEBUG0("nfa_dm_act_enable_listening ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
nfa_dm_cb.flags &= ~NFA_DM_FLAGS_LISTEN_DISABLED;
evt_data.status = NFA_STATUS_OK;
@@ -1088,7 +1086,7 @@
bool nfa_dm_act_disable_listening(tNFA_DM_MSG* p_data) {
tNFA_CONN_EVT_DATA evt_data;
- NFA_TRACE_DEBUG0("nfa_dm_act_disable_listening ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
nfa_dm_cb.flags |= NFA_DM_FLAGS_LISTEN_DISABLED;
evt_data.status = NFA_STATUS_OK;
@@ -1109,7 +1107,7 @@
bool nfa_dm_act_pause_p2p(tNFA_DM_MSG* p_data) {
tNFA_CONN_EVT_DATA evt_data;
- NFA_TRACE_DEBUG0("nfa_dm_act_pause_p2p ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
nfa_dm_cb.flags |= NFA_DM_FLAGS_P2P_PAUSED;
evt_data.status = NFA_STATUS_OK;
@@ -1130,7 +1128,7 @@
bool nfa_dm_act_resume_p2p(tNFA_DM_MSG* p_data) {
tNFA_CONN_EVT_DATA evt_data;
- NFA_TRACE_DEBUG0("nfa_dm_act_resume_p2p ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
nfa_dm_cb.flags &= ~NFA_DM_FLAGS_P2P_PAUSED;
evt_data.status = NFA_STATUS_OK;
@@ -1151,7 +1149,7 @@
bool nfa_dm_act_send_raw_frame(tNFA_DM_MSG* p_data) {
tNFC_STATUS status = NFC_STATUS_FAILED;
- NFA_TRACE_DEBUG0("nfa_dm_act_send_raw_frame ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* If NFC link is activated */
if ((nfa_dm_cb.disc_cb.disc_state == NFA_DM_RFST_POLL_ACTIVE) ||
@@ -1199,8 +1197,8 @@
**
*******************************************************************************/
bool nfa_dm_set_p2p_listen_tech(tNFA_DM_MSG* p_data) {
- NFA_TRACE_DEBUG1("nfa_dm_set_p2p_listen_tech () tech_mask = %d",
- p_data->set_p2p_listen_tech.tech_mask);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("tech_mask = %d", p_data->set_p2p_listen_tech.tech_mask);
nfa_p2p_update_listen_tech(p_data->set_p2p_listen_tech.tech_mask);
nfa_dm_conn_cback_event_notify(NFA_SET_P2P_LISTEN_TECH_EVT, NULL);
@@ -1220,7 +1218,7 @@
bool nfa_dm_act_start_rf_discovery(tNFA_DM_MSG* p_data) {
tNFA_CONN_EVT_DATA evt_data;
- NFA_TRACE_DEBUG0("nfa_dm_act_start_rf_discovery ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (nfa_dm_cb.disc_cb.disc_flags & NFA_DM_DISC_FLAGS_ENABLED) {
evt_data.status = NFA_STATUS_OK;
@@ -1249,7 +1247,7 @@
bool nfa_dm_act_stop_rf_discovery(tNFA_DM_MSG* p_data) {
tNFA_CONN_EVT_DATA evt_data;
- NFA_TRACE_DEBUG0("nfa_dm_act_stop_rf_discovery ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (!(nfa_dm_cb.disc_cb.disc_flags & NFA_DM_DISC_FLAGS_ENABLED) ||
(nfa_dm_cb.disc_cb.disc_state == NFA_DM_RFST_IDLE)) {
@@ -1312,7 +1310,7 @@
**
*******************************************************************************/
bool nfa_dm_act_select(tNFA_DM_MSG* p_data) {
- NFA_TRACE_DEBUG0("nfa_dm_act_select ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
nfa_dm_rf_discover_select(p_data->select.rf_disc_id, p_data->select.protocol,
p_data->select.rf_interface);
@@ -1331,7 +1329,7 @@
bool nfa_dm_act_update_rf_params(tNFA_DM_MSG* p_data) {
tNFA_CONN_EVT_DATA conn_evt;
- NFA_TRACE_DEBUG0("nfa_dm_act_update_rf_params ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (NFC_UpdateRFCommParams(&p_data->update_rf_params.params) !=
NFC_STATUS_OK) {
@@ -1369,7 +1367,7 @@
**
*******************************************************************************/
void nfa_dm_act_conn_cback_notify(uint8_t event, tNFA_CONN_EVT_DATA* p_data) {
- NFA_TRACE_DEBUG1("nfa_dm_act_conn_cback_notify (): event:0x%X", event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("event:0x%X", event);
/* Notify event using appropriate CONN_CBACK */
nfa_dm_conn_cback_event_notify(event, p_data);
@@ -1408,7 +1406,7 @@
NFC_HDR* p_msg;
tNFA_CONN_EVT_DATA evt_data;
- NFA_TRACE_DEBUG1("nfa_dm_act_data_cback (): event = 0x%X", event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("event = 0x%X", event);
if (event == NFC_DATA_CEVT) {
p_msg = (NFC_HDR*)p_data->data.p_data;
@@ -1422,8 +1420,8 @@
GKI_freebuf(p_msg);
} else {
- NFA_TRACE_ERROR0(
- "nfa_dm_act_data_cback (): received NFC_DATA_CEVT with NULL data "
+ LOG(ERROR) << StringPrintf(
+ "received NFC_DATA_CEVT with NULL data "
"pointer");
}
} else if (event == NFC_DEACTIVATE_CEVT) {
@@ -1444,7 +1442,7 @@
tNFC_DISCOVER* p_data) {
tNFA_CONN_EVT_DATA evt_data;
- NFA_TRACE_DEBUG1("nfa_dm_excl_disc_cback (): event:0x%02X", event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("event:0x%02X", event);
switch (event) {
case NFA_DM_RF_DISC_START_EVT:
@@ -1529,7 +1527,7 @@
break;
default:
- NFA_TRACE_ERROR0("Unexpected event");
+ LOG(ERROR) << StringPrintf("Unexpected event");
break;
}
}
@@ -1547,7 +1545,7 @@
tNFC_DISCOVER* p_data) {
tNFA_CONN_EVT_DATA evt_data;
- NFA_TRACE_DEBUG1("nfa_dm_poll_disc_cback (): event:0x%02X", event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("event:0x%02X", event);
switch (event) {
case NFA_DM_RF_DISC_START_EVT:
@@ -1587,7 +1585,7 @@
nfa_dm_cb.p_activate_ntf = NULL;
}
} else {
- NFA_TRACE_DEBUG0("P2P is paused");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("P2P is paused");
nfa_dm_notify_activation_status(NFA_STATUS_OK, NULL);
}
}
@@ -1699,7 +1697,7 @@
tNFC_RF_TECH_PARAMS* p_tech_params;
uint8_t *p_nfcid = NULL, nfcid_len;
- NFA_TRACE_DEBUG1("nfa_dm_notify_activation_status (): status:0x%X", status);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("status:0x%X", status);
if (!nfa_dm_cb.p_activate_ntf) {
/* this is for NFA P2P listen */
@@ -1805,7 +1803,6 @@
nfa_dm_cb.p_activate_ntf = NULL;
}
-#if (BT_TRACE_VERBOSE == TRUE)
/*******************************************************************************
**
** Function nfa_dm_nfc_revt_2_str
@@ -1853,4 +1850,3 @@
return "unknown revt";
}
}
-#endif /* BT_VERBOSE */
diff --git a/src/nfa/dm/nfa_dm_api.cc b/src/nfa/dm/nfa_dm_api.cc
index 08d9ac6..25e9586 100644
--- a/src/nfa/dm/nfa_dm_api.cc
+++ b/src/nfa/dm/nfa_dm_api.cc
@@ -51,7 +51,7 @@
**
*******************************************************************************/
void NFA_Init(tHAL_NFC_ENTRY* p_hal_entry_tbl) {
- NFA_TRACE_API0("NFA_Init ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
nfa_sys_init();
nfa_dm_init();
nfa_p2p_init();
@@ -93,11 +93,11 @@
tNFA_CONN_CBACK* p_conn_cback) {
tNFA_DM_API_ENABLE* p_msg;
- NFA_TRACE_API0("NFA_Enable ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* Validate parameters */
if ((!p_dm_cback) || (!p_conn_cback)) {
- NFA_TRACE_ERROR0("NFA_Enable (): error null callback");
+ LOG(ERROR) << StringPrintf("error null callback");
return (NFA_STATUS_FAILED);
}
@@ -138,7 +138,8 @@
tNFA_STATUS NFA_Disable(bool graceful) {
tNFA_DM_API_DISABLE* p_msg;
- NFA_TRACE_API1("NFA_Disable (graceful=%i)", graceful);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NFA_Disable (graceful=%i)", graceful);
p_msg = (tNFA_DM_API_DISABLE*)GKI_getbuf(sizeof(tNFA_DM_API_DISABLE));
if (p_msg != NULL) {
@@ -177,7 +178,8 @@
**
*******************************************************************************/
tNFA_STATUS NFA_SetPowerSubStateForScreenState(uint8_t screenState) {
- NFA_TRACE_API2("%s: state:0x%X", __func__, screenState);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: state:0x%X", __func__, screenState);
uint8_t nci_scren_state = 0xFF;
uint16_t buf_size = sizeof(tNFA_DM_API_SET_POWER_SUB_STATE);
@@ -201,7 +203,8 @@
break;
default:
- NFA_TRACE_API1("%s, unknown screen state", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s, unknown screen state", __func__);
break;
}
@@ -233,7 +236,7 @@
tNFA_STATUS NFA_SetConfig(tNFA_PMID param_id, uint8_t length, uint8_t* p_data) {
tNFA_DM_API_SET_CONFIG* p_msg;
- NFA_TRACE_API1("NFA_SetConfig (): param_id:0x%X", param_id);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("param_id:0x%X", param_id);
p_msg = (tNFA_DM_API_SET_CONFIG*)GKI_getbuf(
(uint16_t)(sizeof(tNFA_DM_API_SET_CONFIG) + length));
@@ -270,7 +273,7 @@
tNFA_STATUS NFA_GetConfig(uint8_t num_ids, tNFA_PMID* p_param_ids) {
tNFA_DM_API_GET_CONFIG* p_msg;
- NFA_TRACE_API1("NFA_GetConfig (): num_ids: %i", num_ids);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("num_ids: %i", num_ids);
p_msg = (tNFA_DM_API_GET_CONFIG*)GKI_getbuf(
(uint16_t)(sizeof(tNFA_DM_API_GET_CONFIG) + num_ids));
@@ -332,10 +335,10 @@
tNFA_NDEF_CBACK* p_ndef_cback) {
tNFA_DM_API_REQ_EXCL_RF_CTRL* p_msg;
- NFA_TRACE_API1("NFA_RequestExclusiveRfControl () poll_mask=0x%x", poll_mask);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("poll_mask=0x%x", poll_mask);
if (!p_conn_cback) {
- NFA_TRACE_ERROR0("NFA_RequestExclusiveRfControl (): error null callback");
+ LOG(ERROR) << StringPrintf("error null callback");
return (NFA_STATUS_FAILED);
}
@@ -374,11 +377,11 @@
tNFA_STATUS NFA_ReleaseExclusiveRfControl(void) {
NFC_HDR* p_msg;
- NFA_TRACE_API0("NFA_ReleaseExclusiveRfControl ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (!nfa_dm_cb.p_excl_conn_cback) {
- NFA_TRACE_ERROR0(
- "NFA_ReleaseExclusiveRfControl (): Exclusive rf control is not in "
+ LOG(ERROR) << StringPrintf(
+ "Exclusive rf control is not in "
"progress");
return (NFA_STATUS_FAILED);
}
@@ -431,7 +434,7 @@
tNFA_STATUS NFA_EnablePolling(tNFA_TECHNOLOGY_MASK poll_mask) {
tNFA_DM_API_ENABLE_POLL* p_msg;
- NFA_TRACE_API1("NFA_EnablePolling () 0x%X", poll_mask);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("0x%X", poll_mask);
p_msg = (tNFA_DM_API_ENABLE_POLL*)GKI_getbuf(sizeof(tNFA_DM_API_ENABLE_POLL));
if (p_msg != NULL) {
@@ -465,7 +468,7 @@
tNFA_STATUS NFA_DisablePolling(void) {
NFC_HDR* p_msg;
- NFA_TRACE_API0("NFA_DisablePolling ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_msg = (NFC_HDR*)GKI_getbuf(sizeof(NFC_HDR));
if (p_msg != NULL) {
@@ -505,7 +508,7 @@
tNFA_STATUS NFA_EnableListening(void) {
NFC_HDR* p_msg;
- NFA_TRACE_API0("NFA_EnableListening ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_msg = (NFC_HDR*)GKI_getbuf(sizeof(NFC_HDR));
if (p_msg != NULL) {
@@ -539,7 +542,7 @@
tNFA_STATUS NFA_DisableListening(void) {
NFC_HDR* p_msg;
- NFA_TRACE_API0("NFA_DisableListening ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_msg = (NFC_HDR*)GKI_getbuf(sizeof(NFC_HDR));
if (p_msg != NULL) {
@@ -576,7 +579,7 @@
tNFA_STATUS NFA_PauseP2p(void) {
NFC_HDR* p_msg;
- NFA_TRACE_API0("NFA_PauseP2p ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_msg = (NFC_HDR*)GKI_getbuf(sizeof(NFC_HDR));
if (p_msg != NULL) {
@@ -609,7 +612,7 @@
tNFA_STATUS NFA_ResumeP2p(void) {
NFC_HDR* p_msg;
- NFA_TRACE_API0("NFA_ResumeP2p ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_msg = (NFC_HDR*)GKI_getbuf(sizeof(NFC_HDR));
if (p_msg != NULL) {
@@ -646,7 +649,7 @@
tNFA_STATUS NFA_SetP2pListenTech(tNFA_TECHNOLOGY_MASK tech_mask) {
tNFA_DM_API_SET_P2P_LISTEN_TECH* p_msg;
- NFA_TRACE_API1("NFA_P2pSetListenTech (): tech_mask:0x%X", tech_mask);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("tech_mask:0x%X", tech_mask);
p_msg = (tNFA_DM_API_SET_P2P_LISTEN_TECH*)GKI_getbuf(
sizeof(tNFA_DM_API_SET_P2P_LISTEN_TECH));
@@ -679,7 +682,7 @@
tNFA_STATUS NFA_StartRfDiscovery(void) {
NFC_HDR* p_msg;
- NFA_TRACE_API0("NFA_StartRfDiscovery ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_msg = (NFC_HDR*)GKI_getbuf(sizeof(NFC_HDR));
if (p_msg != NULL) {
@@ -709,7 +712,7 @@
tNFA_STATUS NFA_StopRfDiscovery(void) {
NFC_HDR* p_msg;
- NFA_TRACE_API0("NFA_StopRfDiscovery ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_msg = (NFC_HDR*)GKI_getbuf(sizeof(NFC_HDR));
if (p_msg != NULL) {
@@ -748,7 +751,7 @@
tNFA_STATUS NFA_SetRfDiscoveryDuration(uint16_t discovery_period_ms) {
tNFA_DM_API_SET_RF_DISC_DUR* p_msg;
- NFA_TRACE_API0("NFA_SetRfDiscoveryDuration ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* Post the API message */
p_msg = (tNFA_DM_API_SET_RF_DISC_DUR*)GKI_getbuf(sizeof(NFC_HDR));
@@ -788,15 +791,15 @@
tNFA_INTF_TYPE rf_interface) {
tNFA_DM_API_SELECT* p_msg;
- NFA_TRACE_API3(
- "NFA_Select (): rf_disc_id:0x%X, protocol:0x%X, rf_interface:0x%X",
- rf_disc_id, protocol, rf_interface);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("rf_disc_id:0x%X, protocol:0x%X, rf_interface:0x%X",
+ rf_disc_id, protocol, rf_interface);
if (((rf_interface == NFA_INTERFACE_ISO_DEP) &&
(protocol != NFA_PROTOCOL_ISO_DEP)) ||
((rf_interface == NFA_INTERFACE_NFC_DEP) &&
(protocol != NFA_PROTOCOL_NFC_DEP))) {
- NFA_TRACE_ERROR0("NFA_Select (): RF interface is not matched protocol");
+ LOG(ERROR) << StringPrintf("RF interface is not matched protocol");
return (NFA_STATUS_INVALID_PARAM);
}
@@ -833,7 +836,7 @@
tNFA_STATUS NFA_UpdateRFCommParams(tNFA_RF_COMM_PARAMS* p_params) {
tNFA_DM_API_UPDATE_RF_PARAMS* p_msg;
- NFA_TRACE_API0("NFA_UpdateRFCommParams ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_msg = (tNFA_DM_API_UPDATE_RF_PARAMS*)GKI_getbuf(
(uint16_t)(sizeof(tNFA_DM_API_UPDATE_RF_PARAMS)));
@@ -883,7 +886,7 @@
extern tNFA_STATUS NFA_Deactivate(bool sleep_mode) {
tNFA_DM_API_DEACTIVATE* p_msg;
- NFA_TRACE_API1("NFA_Deactivate (): sleep_mode:%i", sleep_mode);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("sleep_mode:%i", sleep_mode);
p_msg = (tNFA_DM_API_DEACTIVATE*)GKI_getbuf(
(uint16_t)(sizeof(tNFA_DM_API_DEACTIVATE)));
@@ -924,7 +927,7 @@
uint16_t size;
uint8_t* p;
- NFA_TRACE_API1("NFA_SendRawFrame () data_len:%d", data_len);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("data_len:%d", data_len);
/* Validate parameters */
if ((data_len == 0) || (p_raw_data == NULL))
@@ -983,14 +986,14 @@
tNFA_NDEF_CBACK* p_ndef_cback) {
tNFA_DM_API_REG_NDEF_HDLR* p_msg;
- NFA_TRACE_API2(
- "NFA_RegisterNDefTypeHandler (): handle whole ndef message: %i, "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "handle whole ndef message: %i, "
"tnf=0x%02x",
handle_whole_message, tnf);
/* Check for NULL callback */
if (!p_ndef_cback) {
- NFA_TRACE_ERROR0("NFA_RegisterNDefTypeHandler (): error - null callback");
+ LOG(ERROR) << StringPrintf("error - null callback");
return (NFA_STATUS_INVALID_PARAM);
}
@@ -1043,14 +1046,14 @@
tNFA_NDEF_CBACK* p_ndef_cback) {
tNFA_DM_API_REG_NDEF_HDLR* p_msg;
- NFA_TRACE_API2(
- "NFA_RegisterNDefUriHandler (): handle whole ndef message: %i, "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "handle whole ndef message: %i, "
"uri_id=0x%02x",
handle_whole_message, uri_id);
/* Check for NULL callback */
if (!p_ndef_cback) {
- NFA_TRACE_ERROR0("NFA_RegisterNDefUriHandler (): error - null callback");
+ LOG(ERROR) << StringPrintf("error - null callback");
return (NFA_STATUS_INVALID_PARAM);
}
@@ -1097,8 +1100,8 @@
extern tNFA_STATUS NFA_DeregisterNDefTypeHandler(tNFA_HANDLE ndef_type_handle) {
tNFA_DM_API_DEREG_NDEF_HDLR* p_msg;
- NFA_TRACE_API1("NFA_DeregisterNDefHandler (): handle 0x%08x",
- ndef_type_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("handle 0x%08x", ndef_type_handle);
p_msg = (tNFA_DM_API_DEREG_NDEF_HDLR*)GKI_getbuf(
(uint16_t)(sizeof(tNFA_DM_API_DEREG_NDEF_HDLR)));
@@ -1132,11 +1135,10 @@
tNFA_STATUS NFA_PowerOffSleepMode(bool start_stop) {
NFC_HDR* p_msg;
- NFA_TRACE_API1("NFA_PowerOffSleepState () start_stop=%d", start_stop);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("start_stop=%d", start_stop);
if (nfa_dm_cb.flags & NFA_DM_FLAGS_SETTING_PWR_MODE) {
- NFA_TRACE_ERROR0(
- "NFA_PowerOffSleepState (): NFA DM is busy to update power mode");
+ LOG(ERROR) << StringPrintf("NFA DM is busy to update power mode");
return (NFA_STATUS_FAILED);
} else {
nfa_dm_cb.flags |= NFA_DM_FLAGS_SETTING_PWR_MODE;
@@ -1170,10 +1172,11 @@
tNFC_STATUS NFA_RegVSCback(bool is_register, tNFA_VSC_CBACK* p_cback) {
tNFA_DM_API_REG_VSC* p_msg;
- NFA_TRACE_API1("NFA_RegVSCback() is_register=%d", is_register);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("is_register=%d", is_register);
if (p_cback == NULL) {
- NFA_TRACE_ERROR0("NFA_RegVSCback() requires a valid callback function");
+ LOG(ERROR) << StringPrintf("requires a valid callback function");
return (NFA_STATUS_FAILED);
}
@@ -1213,7 +1216,7 @@
tNFA_DM_API_SEND_VSC* p_msg;
uint16_t size = sizeof(tNFA_DM_API_SEND_VSC) + cmd_params_len;
- NFA_TRACE_API1("NFA_SendVsCommand() oid=0x%x", oid);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("oid=0x%x", oid);
p_msg = (tNFA_DM_API_SEND_VSC*)GKI_getbuf(size);
if (p_msg != NULL) {
@@ -1306,7 +1309,8 @@
**
*******************************************************************************/
void NFA_EnableDtamode(tNFA_eDtaModes eDtaMode) {
- NFA_TRACE_API2("%s: 0x%x ", __func__, eDtaMode);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: 0x%x ", __func__, eDtaMode);
appl_dta_mode_flag = 0x01;
nfa_dm_cb.eDtaMode = eDtaMode;
}
diff --git a/src/nfa/dm/nfa_dm_discover.cc b/src/nfa/dm/nfa_dm_discover.cc
index 4163506..8737b86 100644
--- a/src/nfa/dm/nfa_dm_discover.cc
+++ b/src/nfa/dm/nfa_dm_discover.cc
@@ -57,10 +57,8 @@
static void nfa_dm_disc_kovio_timeout_cback(TIMER_LIST_ENT* p_tle);
static void nfa_dm_disc_report_kovio_presence_check(tNFC_STATUS status);
-#if (BT_TRACE_VERBOSE == TRUE)
static std::string nfa_dm_disc_state_2_str(uint8_t state);
static std::string nfa_dm_disc_event_2_str(uint8_t event);
-#endif
typedef struct nfa_dm_p2p_prio_logic {
bool isodep_detected; /* flag to check if ISO-DEP is detected */
@@ -89,9 +87,8 @@
uint8_t num_params = 0;
if (nfa_dm_cb.flags & NFA_DM_FLAGS_LISTEN_DISABLED) {
- NFA_TRACE_DEBUG1(
- "nfa_dm_get_rf_discover_config () listen disabled, rm listen from 0x%x",
- dm_disc_mask);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("listen disabled, rm listen from 0x%x", dm_disc_mask);
dm_disc_mask &= NFA_DM_DISC_MASK_POLL;
}
if (nfa_dm_is_p2p_paused()) {
@@ -274,9 +271,8 @@
uint8_t platform = 0;
uint8_t sens_info = 0;
- NFA_TRACE_DEBUG1(
- "nfa_dm_set_rf_listen_mode_config () tech_proto_mask = 0x%08X",
- tech_proto_mask);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("tech_proto_mask = 0x%08X", tech_proto_mask);
/*
** T1T listen LA_PROT 0x80, LA_SENS_RES byte1:0x00 byte2:0x0C
@@ -390,7 +386,7 @@
static void nfa_dm_set_total_duration(void) {
uint8_t params[10], *p;
- NFA_TRACE_DEBUG0("nfa_dm_set_total_duration ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p = params;
@@ -419,7 +415,7 @@
tNFA_LISTEN_CFG* p_cfg = &nfa_dm_cb.disc_cb.excl_listen_config;
uint8_t params[250], *p, xx;
- NFA_TRACE_DEBUG0("nfa_dm_set_rf_listen_mode_raw_config ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/*
** Discovery Configuration Parameters for Listen A
@@ -599,8 +595,8 @@
*p_disc_mask = disc_mask;
- NFA_TRACE_DEBUG1("nfa_dm_set_rf_listen_mode_raw_config () disc_mask = 0x%x",
- disc_mask);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("disc_mask = 0x%x", disc_mask);
}
/*******************************************************************************
@@ -694,8 +690,8 @@
}
}
- NFA_TRACE_DEBUG3(
- "nfa_dm_disc_get_disc_mask (): tech_n_mode:0x%X, protocol:0x%X, "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "tech_n_mode:0x%X, protocol:0x%X, "
"disc_mask:0x%X",
tech_n_mode, protocol, disc_mask);
return (disc_mask);
@@ -714,7 +710,7 @@
tNFC_DISCOVER* p_data) {
tNFA_DM_RF_DISC_SM_EVENT dm_disc_event = NFA_DM_DISC_SM_MAX_EVENT;
- NFA_TRACE_DEBUG1("nfa_dm_disc_discovery_cback (): event:0x%X", event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("event:0x%X", event);
switch (event) {
case NFC_START_DEVT:
@@ -741,7 +737,7 @@
dm_disc_event = NFA_DM_RF_DEACTIVATE_RSP;
break;
default:
- NFA_TRACE_ERROR0("Unexpected event");
+ LOG(ERROR) << StringPrintf("Unexpected event");
return;
}
@@ -815,8 +811,8 @@
static tNFC_STATUS nfa_dm_disc_force_to_idle(void) {
tNFC_STATUS status = NFC_STATUS_SEMANTIC_ERROR;
- NFA_TRACE_DEBUG1("nfa_dm_disc_force_to_idle() disc_flags = 0x%x",
- nfa_dm_cb.disc_cb.disc_flags);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("disc_flags = 0x%x", nfa_dm_cb.disc_cb.disc_flags);
/* do not execute more than one */
if (nfa_dm_cb.disc_cb.disc_flags & NFA_DM_DISC_FLAGS_W4_NTF) {
@@ -839,7 +835,7 @@
**
*******************************************************************************/
static void nfa_dm_disc_deact_ntf_timeout_cback(TIMER_LIST_ENT* p_tle) {
- NFA_TRACE_ERROR0("nfa_dm_disc_deact_ntf_timeout_cback()");
+ LOG(ERROR) << __func__;
nfa_dm_disc_force_to_idle();
}
@@ -903,7 +899,7 @@
uint8_t config_params[10], *p;
uint8_t num_params, xx;
- NFA_TRACE_DEBUG0("nfa_dm_start_rf_discover ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* Make sure that RF discovery was enabled, or some app has exclusive control
*/
if ((!(nfa_dm_cb.disc_cb.disc_flags & NFA_DM_DISC_FLAGS_ENABLED)) &&
@@ -1031,7 +1027,7 @@
nfa_dm_cb.disc_cb.entry[xx].selected_disc_mask =
poll_mask | listen_mask;
- NFA_TRACE_DEBUG2(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfa_dm_cb.disc_cb.entry[%d].selected_disc_mask = 0x%x", xx,
nfa_dm_cb.disc_cb.entry[xx].selected_disc_mask);
@@ -1067,7 +1063,8 @@
}
}
- NFA_TRACE_DEBUG1("dm_disc_mask = 0x%x", dm_disc_mask);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("dm_disc_mask = 0x%x", dm_disc_mask);
/* Get Discovery Technology parameters */
num_params = nfa_dm_get_rf_discover_config(dm_disc_mask, disc_params,
@@ -1153,7 +1150,8 @@
p_data->activate.rf_tech_param.param.pk.uid_len) ||
(memcmp(p_data->activate.rf_tech_param.param.pk.uid,
nfa_dm_cb.activated_nfcid, nfa_dm_cb.activated_nfcid_len))) {
- NFA_TRACE_DEBUG0("new Kovio tag is detected");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("new Kovio tag is detected");
/* notify presence check failure for previous tag, if presence check is
* pending */
@@ -1207,9 +1205,8 @@
tNFA_DM_DISC_TECH_PROTO_MASK activated_disc_mask;
- NFA_TRACE_DEBUG2(
- "nfa_dm_disc_notify_activation (): tech_n_mode:0x%X, proto:0x%X",
- tech_n_mode, protocol);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("tech_n_mode:0x%X, proto:0x%X", tech_n_mode, protocol);
if (nfa_dm_cb.disc_cb.excl_disc_entry.in_use) {
nfa_dm_cb.disc_cb.activated_tech_mode = tech_n_mode;
@@ -1246,9 +1243,10 @@
nfa_dm_cb.disc_cb.activated_protocol = NFC_PROTOCOL_UNKNOWN;
nfa_dm_cb.disc_cb.activated_handle = xx;
- NFA_TRACE_DEBUG2("activated_rf_interface:0x%x, activated_handle: 0x%x",
- nfa_dm_cb.disc_cb.activated_rf_interface,
- nfa_dm_cb.disc_cb.activated_handle);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "activated_rf_interface:0x%x, activated_handle: 0x%x",
+ nfa_dm_cb.disc_cb.activated_rf_interface,
+ nfa_dm_cb.disc_cb.activated_handle);
if (nfa_dm_cb.disc_cb.entry[xx].p_disc_cback)
(*(nfa_dm_cb.disc_cb.entry[xx].p_disc_cback))(
@@ -1323,7 +1321,8 @@
tech_n_mode == NFC_DISCOVERY_TYPE_LISTEN_A_ACTIVE ||
tech_n_mode == NFC_DISCOVERY_TYPE_LISTEN_A)) {
if (appl_dta_mode_flag == 1 && tech_n_mode == NFC_DISCOVERY_TYPE_LISTEN_A) {
- NFA_TRACE_DEBUG0("DTA Mode Enabled : NFC-A Passive Listen Mode");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("DTA Mode Enabled : NFC-A Passive Listen Mode");
}
}
@@ -1334,9 +1333,10 @@
nfa_dm_cb.disc_cb.activated_protocol = protocol;
nfa_dm_cb.disc_cb.activated_handle = xx;
- NFA_TRACE_DEBUG2("activated_protocol:0x%x, activated_handle: 0x%x",
- nfa_dm_cb.disc_cb.activated_protocol,
- nfa_dm_cb.disc_cb.activated_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("activated_protocol:0x%x, activated_handle: 0x%x",
+ nfa_dm_cb.disc_cb.activated_protocol,
+ nfa_dm_cb.disc_cb.activated_handle);
if (protocol == NFC_PROTOCOL_KOVIO) {
/* check whether it's new or repeated activation */
@@ -1374,11 +1374,11 @@
tNFA_CONN_EVT_DATA evt_data;
tNFC_DISCOVER disc_data;
- NFA_TRACE_DEBUG1("nfa_dm_disc_notify_deactivation (): activated_handle=%d",
- nfa_dm_cb.disc_cb.activated_handle);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "activated_handle=%d", nfa_dm_cb.disc_cb.activated_handle);
if (nfa_dm_cb.disc_cb.disc_flags & NFA_DM_DISC_FLAGS_CHECKING) {
- NFA_TRACE_DEBUG0("nfa_dm_disc_notify_deactivation (): for sleep wakeup");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("for sleep wakeup");
return;
}
@@ -1572,7 +1572,7 @@
**
*******************************************************************************/
static void nfa_dm_disc_kovio_timeout_cback(TIMER_LIST_ENT* p_tle) {
- NFA_TRACE_DEBUG0("nfa_dm_disc_kovio_timeout_cback()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* notify presence check failure, if presence check is pending */
nfa_dm_disc_report_kovio_presence_check(NFC_STATUS_FAILED);
@@ -1606,7 +1606,7 @@
tNFC_STATUS nfa_dm_disc_start_kovio_presence_check(void) {
tNFC_STATUS status = NFC_STATUS_FAILED;
- NFA_TRACE_DEBUG0("nfa_dm_disc_start_kovio_presence_check ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if ((nfa_dm_cb.disc_cb.activated_protocol == NFC_PROTOCOL_KOVIO) &&
(nfa_dm_cb.disc_cb.kovio_tle.in_use)) {
@@ -1645,7 +1645,7 @@
**
*******************************************************************************/
static void nfa_dm_disc_report_kovio_presence_check(tNFC_STATUS status) {
- NFA_TRACE_DEBUG0("nfa_dm_disc_report_kovio_presence_check ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (nfa_dm_cb.disc_cb.disc_flags & NFA_DM_DISC_FLAGS_CHECKING) {
nfa_dm_cb.disc_cb.disc_flags &= ~NFA_DM_DISC_FLAGS_CHECKING;
@@ -1674,7 +1674,7 @@
*******************************************************************************/
static void nfa_dm_disc_data_cback(uint8_t conn_id, tNFC_CONN_EVT event,
tNFC_CONN* p_data) {
- NFA_TRACE_DEBUG0("nfa_dm_disc_data_cback ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* if selection failed */
if (event == NFC_ERROR_CEVT) {
@@ -1697,18 +1697,12 @@
tNFA_CONN_EVT_DATA evt_data;
tNFA_DM_RF_DISC_STATE old_state = nfa_dm_cb.disc_cb.disc_state;
-#if (BT_TRACE_VERBOSE == TRUE)
- NFA_TRACE_DEBUG5(
- "nfa_dm_disc_new_state (): old_state: %s (%d), new_state: %s (%d) "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "old_state: %s (%d), new_state: %s (%d) "
"disc_flags: 0x%x",
nfa_dm_disc_state_2_str(nfa_dm_cb.disc_cb.disc_state).c_str(),
nfa_dm_cb.disc_cb.disc_state, nfa_dm_disc_state_2_str(new_state).c_str(),
new_state, nfa_dm_cb.disc_cb.disc_flags);
-#else
- NFA_TRACE_DEBUG3(
- "nfa_dm_disc_new_state(): old_state: %d, new_state: %d disc_flags: 0x%x",
- nfa_dm_cb.disc_cb.disc_state, new_state, nfa_dm_cb.disc_cb.disc_flags);
-#endif
nfa_dm_cb.disc_cb.disc_state = new_state;
@@ -1869,7 +1863,7 @@
break;
default:
- NFA_TRACE_ERROR0("nfa_dm_disc_sm_idle (): Unexpected discovery event");
+ LOG(ERROR) << StringPrintf("Unexpected discovery event");
break;
}
}
@@ -1913,7 +1907,8 @@
break;
case NFA_DM_RF_INTF_ACTIVATED_NTF:
if (nfa_dm_cb.disc_cb.disc_flags & NFA_DM_DISC_FLAGS_W4_RSP) {
- NFA_TRACE_DEBUG0("RF Activated while waiting for deactivation RSP");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("RF Activated while waiting for deactivation RSP");
/* it's race condition. DH has to wait for deactivation NTF */
nfa_dm_cb.disc_cb.disc_flags |= NFA_DM_DISC_FLAGS_W4_NTF;
} else {
@@ -1930,8 +1925,9 @@
if (nfa_dm_disc_notify_activation(&(p_data->nfc_discover)) ==
NFA_STATUS_FAILED) {
- NFA_TRACE_DEBUG0(
- "Not matched, restart discovery after receiving deactivate ntf");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Not matched, restart discovery after receiving "
+ "deactivate ntf");
/* after receiving deactivate event, restart discovery */
nfa_dm_cb.disc_cb.disc_flags |=
@@ -1962,8 +1958,7 @@
case NFA_DM_CORE_INTF_ERROR_NTF:
break;
default:
- NFA_TRACE_ERROR0(
- "nfa_dm_disc_sm_discovery (): Unexpected discovery event");
+ LOG(ERROR) << StringPrintf("Unexpected discovery event");
break;
}
}
@@ -2019,7 +2014,7 @@
if (nfa_dm_disc_notify_activation(&(p_data->nfc_discover)) ==
NFA_STATUS_FAILED) {
- NFA_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"Not matched, restart discovery after receiving deactivate ntf");
/* after receiving deactivate event, restart discovery */
@@ -2027,8 +2022,7 @@
}
break;
default:
- NFA_TRACE_ERROR0(
- "nfa_dm_disc_sm_w4_all_discoveries (): Unexpected discovery event");
+ LOG(ERROR) << StringPrintf("Unexpected discovery event");
break;
}
}
@@ -2089,7 +2083,7 @@
* if deactivation is pending then deactivate */
nfa_dm_disc_end_sleep_wakeup(NFC_STATUS_OK);
} else if (status == NFA_STATUS_FAILED) {
- NFA_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"Not matched, restart discovery after receiving deactivate ntf");
/* after receiving deactivate event, restart discovery */
@@ -2128,8 +2122,7 @@
}
break;
default:
- NFA_TRACE_ERROR0(
- "nfa_dm_disc_sm_w4_host_select (): Unexpected discovery event");
+ LOG(ERROR) << StringPrintf("Unexpected discovery event");
break;
}
@@ -2216,7 +2209,8 @@
if (nfa_dm_cb.disc_cb.disc_flags & NFA_DM_DISC_FLAGS_W4_RSP) {
/* it's race condition. received deactivate NTF before receiving RSP */
/* notify deactivation after receiving deactivate RSP */
- NFA_TRACE_DEBUG0("Rx deactivate NTF while waiting for deactivate RSP");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Rx deactivate NTF while waiting for deactivate RSP");
break;
}
if (p_data->nfc_discover.deactivate.reason !=
@@ -2294,8 +2288,7 @@
break;
default:
- NFA_TRACE_ERROR0(
- "nfa_dm_disc_sm_poll_active (): Unexpected discovery event");
+ LOG(ERROR) << StringPrintf("Unexpected discovery event");
break;
}
@@ -2351,7 +2344,8 @@
if (nfa_dm_cb.disc_cb.disc_flags & NFA_DM_DISC_FLAGS_W4_RSP) {
/* it's race condition. received deactivate NTF before receiving RSP */
/* notify deactivation after receiving deactivate RSP */
- NFA_TRACE_DEBUG0("Rx deactivate NTF while waiting for deactivate RSP");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Rx deactivate NTF while waiting for deactivate RSP");
} else {
nfa_dm_disc_notify_deactivation(NFA_DM_RF_DEACTIVATE_NTF,
&(p_data->nfc_discover));
@@ -2379,8 +2373,7 @@
case NFA_DM_CORE_INTF_ERROR_NTF:
break;
default:
- NFA_TRACE_ERROR0(
- "nfa_dm_disc_sm_listen_active (): Unexpected discovery event");
+ LOG(ERROR) << StringPrintf("Unexpected discovery event");
break;
}
}
@@ -2438,7 +2431,7 @@
NFA_DEACTIVATE_TYPE_DISCOVERY) {
nfa_dm_disc_new_state(NFA_DM_RFST_DISCOVERY);
} else {
- NFA_TRACE_ERROR0("Unexpected deactivation type");
+ LOG(ERROR) << StringPrintf("Unexpected deactivation type");
nfa_dm_disc_new_state(NFA_DM_RFST_IDLE);
nfa_dm_start_rf_discover();
}
@@ -2447,7 +2440,7 @@
nfa_dm_disc_new_state(NFA_DM_RFST_LISTEN_ACTIVE);
if (nfa_dm_disc_notify_activation(&(p_data->nfc_discover)) ==
NFA_STATUS_FAILED) {
- NFA_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"Not matched, restart discovery after receiving deactivate ntf");
/* after receiving deactivate event, restart discovery */
@@ -2455,8 +2448,7 @@
}
break;
default:
- NFA_TRACE_ERROR0(
- "nfa_dm_disc_sm_listen_sleep (): Unexpected discovery event");
+ LOG(ERROR) << StringPrintf("Unexpected discovery event");
break;
}
}
@@ -2478,13 +2470,13 @@
nfa_dm_disc_notify_activation(&(p_data->nfc_discover));
if (nfa_dm_disc_notify_activation(&(p_data->nfc_discover)) ==
NFA_STATUS_FAILED) {
- NFA_TRACE_DEBUG0("Not matched, unexpected activation");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Not matched, unexpected activation");
}
break;
default:
- NFA_TRACE_ERROR0(
- "nfa_dm_disc_sm_lp_listen (): Unexpected discovery event");
+ LOG(ERROR) << StringPrintf("Unexpected discovery event");
break;
}
}
@@ -2507,8 +2499,7 @@
&(p_data->nfc_discover));
break;
default:
- NFA_TRACE_ERROR0(
- "nfa_dm_disc_sm_lp_active (): Unexpected discovery event");
+ LOG(ERROR) << StringPrintf("Unexpected discovery event");
break;
}
}
@@ -2524,18 +2515,12 @@
*******************************************************************************/
void nfa_dm_disc_sm_execute(tNFA_DM_RF_DISC_SM_EVENT event,
tNFA_DM_RF_DISC_DATA* p_data) {
-#if (BT_TRACE_VERBOSE == TRUE)
- NFA_TRACE_DEBUG5(
- "nfa_dm_disc_sm_execute (): state: %s (%d), event: %s(%d) disc_flags: "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "state: %s (%d), event: %s(%d) disc_flags: "
"0x%x",
nfa_dm_disc_state_2_str(nfa_dm_cb.disc_cb.disc_state).c_str(),
nfa_dm_cb.disc_cb.disc_state, nfa_dm_disc_event_2_str(event).c_str(),
event, nfa_dm_cb.disc_cb.disc_flags);
-#else
- NFA_TRACE_DEBUG3(
- "nfa_dm_disc_sm_execute(): state: %d, event:%d disc_flags: 0x%x",
- nfa_dm_cb.disc_cb.disc_state, event, nfa_dm_cb.disc_cb.disc_flags);
-#endif
switch (nfa_dm_cb.disc_cb.disc_state) {
/* RF Discovery State - Idle */
@@ -2583,15 +2568,10 @@
nfa_dm_disc_sm_lp_active(event, p_data);
break;
}
-#if (BT_TRACE_VERBOSE == TRUE)
- NFA_TRACE_DEBUG3(
- "nfa_dm_disc_sm_execute (): new state: %s (%d), disc_flags: 0x%x",
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "new state: %s (%d), disc_flags: 0x%x",
nfa_dm_disc_state_2_str(nfa_dm_cb.disc_cb.disc_state).c_str(),
nfa_dm_cb.disc_cb.disc_state, nfa_dm_cb.disc_cb.disc_flags);
-#else
- NFA_TRACE_DEBUG2("nfa_dm_disc_sm_execute(): new state: %d, disc_flags: 0x%x",
- nfa_dm_cb.disc_cb.disc_state, nfa_dm_cb.disc_cb.disc_flags);
-#endif
}
/*******************************************************************************
@@ -2608,7 +2588,7 @@
tNFA_DISCOVER_CBACK* p_disc_cback) {
uint8_t xx;
- NFA_TRACE_DEBUG1("nfa_dm_add_rf_discover () disc_mask=0x%x", disc_mask);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("disc_mask=0x%x", disc_mask);
for (xx = 0; xx < NFA_DM_DISC_NUM_ENTRIES; xx++) {
if (!nfa_dm_cb.disc_cb.entry[xx].in_use) {
@@ -2638,7 +2618,7 @@
tNFA_DISCOVER_CBACK* p_disc_cback) {
tNFA_DM_DISC_TECH_PROTO_MASK poll_disc_mask = 0;
- NFA_TRACE_DEBUG0("nfa_dm_start_excl_discovery ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (poll_tech_mask & NFA_TECHNOLOGY_MASK_A) {
poll_disc_mask |= NFA_DM_DISC_MASK_PA_T1T;
@@ -2699,7 +2679,7 @@
**
*******************************************************************************/
void nfa_dm_stop_excl_discovery(void) {
- NFA_TRACE_DEBUG0("nfa_dm_stop_excl_discovery ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
nfa_dm_cb.disc_cb.excl_disc_entry.in_use = false;
nfa_dm_cb.disc_cb.excl_disc_entry.p_disc_cback = NULL;
@@ -2715,12 +2695,12 @@
**
*******************************************************************************/
void nfa_dm_delete_rf_discover(tNFA_HANDLE handle) {
- NFA_TRACE_DEBUG1("nfa_dm_delete_rf_discover () handle=0x%x", handle);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("handle=0x%x", handle);
if (handle < NFA_DM_DISC_NUM_ENTRIES) {
nfa_dm_cb.disc_cb.entry[handle].in_use = false;
} else {
- NFA_TRACE_ERROR0("Invalid discovery handle");
+ LOG(ERROR) << StringPrintf("Invalid discovery handle");
}
}
@@ -2738,9 +2718,9 @@
tNFA_DM_DISC_SELECT_PARAMS select_params;
tNFA_CONN_EVT_DATA conn_evt;
- NFA_TRACE_DEBUG3(
- "nfa_dm_disc_select () rf_disc_id:0x%X, protocol:0x%X, rf_interface:0x%X",
- rf_disc_id, protocol, rf_interface);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("rf_disc_id:0x%X, protocol:0x%X, rf_interface:0x%X",
+ rf_disc_id, protocol, rf_interface);
if (nfa_dm_cb.disc_cb.disc_state == NFA_DM_RFST_W4_HOST_SELECT) {
/* state is OK: notify the status when the response is received from NFCC */
@@ -2769,8 +2749,8 @@
**
*******************************************************************************/
tNFA_STATUS nfa_dm_rf_deactivate(tNFA_DEACTIVATE_TYPE deactivate_type) {
- NFA_TRACE_DEBUG1("nfa_dm_rf_deactivate () deactivate_type:0x%X",
- deactivate_type);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("deactivate_type:0x%X", deactivate_type);
if (deactivate_type == NFA_DEACTIVATE_TYPE_SLEEP) {
if (nfa_dm_cb.disc_cb.activated_protocol == NFA_PROTOCOL_NFC_DEP)
@@ -2789,7 +2769,8 @@
return NFA_STATUS_OK;
} else {
/* it could be race condition. */
- NFA_TRACE_DEBUG0("nfa_dm_rf_deactivate (): already in discovery state");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("already in discovery state");
return NFA_STATUS_FAILED;
}
} else if (deactivate_type == NFA_DEACTIVATE_TYPE_IDLE) {
@@ -2812,7 +2793,6 @@
}
}
-#if (BT_TRACE_VERBOSE == TRUE)
/*******************************************************************************
**
** Function nfa_dm_disc_state_2_str
@@ -2887,7 +2867,6 @@
return "Unknown";
}
}
-#endif /* BT_TRACE_VERBOSE */
/*******************************************************************************
**
@@ -2901,13 +2880,14 @@
*******************************************************************************/
bool nfa_dm_p2p_prio_logic(uint8_t event, uint8_t* p, uint8_t event_type) {
if (!nfa_poll_bail_out_mode) {
- NFA_TRACE_DEBUG0("p2p priority is running under bail out mode ONLY.");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("p2p priority is running under bail out mode ONLY.");
return true;
}
if ((nfa_dm_cb.flags & NFA_DM_FLAGS_P2P_PAUSED) &&
(nfa_dm_cb.flags & NFA_DM_FLAGS_LISTEN_DISABLED)) {
- NFA_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"returning from nfa_dm_p2p_prio_logic Disable p2p_prio_logic");
return true;
}
@@ -2918,7 +2898,7 @@
if (event == NCI_MSG_RF_DISCOVER &&
p2p_prio_logic_data.timer_expired == true &&
event_type == NFA_DM_P2P_PRIO_RSP) {
- NFA_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfa_dm_p2p_prio_logic starting a timer for next rf intf activated "
"ntf");
nfc_start_quick_timer(&p2p_prio_logic_data.timer_list,
@@ -2931,7 +2911,7 @@
if (event == NCI_MSG_RF_INTF_ACTIVATED &&
p2p_prio_logic_data.timer_expired == true) {
- NFA_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfa_dm_p2p_prio_logic stopping a timer for next rf intf activated "
"ntf");
nfc_stop_quick_timer(&p2p_prio_logic_data.timer_list);
@@ -2943,7 +2923,7 @@
uint8_t protocol = 0xFF;
uint8_t tech_mode = 0xFF;
- NFA_TRACE_DEBUG0("P2P_Prio_Logic");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("P2P_Prio_Logic");
if (event == NCI_MSG_RF_INTF_ACTIVATED) {
rf_disc_id = *p++;
@@ -2951,10 +2931,11 @@
protocol = *p++;
tech_mode = *p++;
}
- NFA_TRACE_DEBUG1("nfa_dm_p2p_prio_logic event_type = 0x%x", event_type);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_dm_p2p_prio_logic event_type = 0x%x", event_type);
if (event == NCI_MSG_RF_INTF_ACTIVATED && tech_mode >= 0x80) {
- NFA_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfa_dm_p2p_prio_logic listen mode activated reset all the "
"nfa_dm_p2p_prio_logic variables ");
nfa_dm_p2p_prio_logic_cleanup();
@@ -2966,7 +2947,8 @@
nfa_dm_p2p_prio_logic_cleanup();
p2p_prio_logic_data.isodep_detected = true;
p2p_prio_logic_data.first_tech_mode = tech_mode;
- NFA_TRACE_DEBUG0("ISO-DEP Detected First Time Resume the Polling Loop");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "ISO-DEP Detected First Time Resume the Polling Loop");
nci_snd_deactivate_cmd(NFA_DEACTIVATE_TYPE_DISCOVERY);
return false;
}
@@ -2977,7 +2959,7 @@
p2p_prio_logic_data.first_tech_mode != tech_mode) {
p2p_prio_logic_data.isodep_detected = true;
p2p_prio_logic_data.timer_expired = false;
- NFA_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"ISO-DEP Detected Second Time Other Techmode Resume the Polling "
"Loop");
nfc_stop_quick_timer(&p2p_prio_logic_data.timer_list);
@@ -2989,7 +2971,7 @@
protocol == NCI_PROTOCOL_ISO_DEP &&
p2p_prio_logic_data.isodep_detected == true &&
p2p_prio_logic_data.timer_expired == true) {
- NFA_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"ISO-DEP Detected TimerExpired, Final Notifying the Event");
nfc_stop_quick_timer(&p2p_prio_logic_data.timer_list);
nfa_dm_p2p_prio_logic_cleanup();
@@ -2999,20 +2981,20 @@
protocol == NCI_PROTOCOL_ISO_DEP &&
p2p_prio_logic_data.isodep_detected == true &&
p2p_prio_logic_data.first_tech_mode == tech_mode) {
- NFA_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"ISO-DEP Detected Same Techmode, Final Notifying the Event");
nfc_stop_quick_timer(&p2p_prio_logic_data.timer_list);
- NFA_TRACE_DEBUG0("P2P_Stop_Timer");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("P2P_Stop_Timer");
nfa_dm_p2p_prio_logic_cleanup();
}
else if (event == NCI_MSG_RF_INTF_ACTIVATED &&
protocol != NCI_PROTOCOL_ISO_DEP &&
p2p_prio_logic_data.isodep_detected == true) {
- NFA_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"ISO-DEP Not Detected Giving Priority for other Technology");
nfc_stop_quick_timer(&p2p_prio_logic_data.timer_list);
- NFA_TRACE_DEBUG0("P2P_Stop_Timer");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("P2P_Stop_Timer");
nfa_dm_p2p_prio_logic_cleanup();
}
@@ -3020,7 +3002,8 @@
p2p_prio_logic_data.isodep_detected == true &&
p2p_prio_logic_data.timer_expired == false &&
event_type == NFA_DM_P2P_PRIO_RSP) {
- NFA_TRACE_DEBUG0("NFA_DM_RF_DEACTIVATE_RSP");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NFA_DM_RF_DEACTIVATE_RSP");
return false;
}
@@ -3028,19 +3011,20 @@
p2p_prio_logic_data.isodep_detected == true &&
p2p_prio_logic_data.timer_expired == false &&
event_type == NFA_DM_P2P_PRIO_NTF) {
- NFA_TRACE_DEBUG0("NFA_DM_RF_DEACTIVATE_NTF");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NFA_DM_RF_DEACTIVATE_NTF");
nfc_start_quick_timer(&p2p_prio_logic_data.timer_list,
NFC_TTYPE_P2P_PRIO_RESPONSE,
((uint32_t)160 * QUICK_TIMER_TICKS_PER_SEC) / 1000);
- NFA_TRACE_DEBUG0("P2P_Start_Timer");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("P2P_Start_Timer");
return false;
}
}
- NFA_TRACE_DEBUG0("returning TRUE");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("returning TRUE");
return true;
}
@@ -3054,12 +3038,14 @@
**
*******************************************************************************/
void nfa_dm_p2p_timer_event() {
- NFA_TRACE_DEBUG0("P2P_Timer_timeout NFC-DEP Not Discovered!!");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("P2P_Timer_timeout NFC-DEP Not Discovered!!");
p2p_prio_logic_data.timer_expired = true;
if (p2p_prio_logic_data.isodep_detected == true) {
- NFA_TRACE_DEBUG0("Deactivate and Restart RF discovery");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Deactivate and Restart RF discovery");
nci_snd_deactivate_cmd(NFC_DEACTIVATE_TYPE_IDLE);
}
}
@@ -3090,7 +3076,8 @@
NFC_HDR* p_msg;
uint8_t* p;
- NFA_TRACE_DEBUG0("nfa_dm_send_tag_deselect_cmd");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_dm_send_tag_deselect_cmd");
p_msg = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (p_msg) {
diff --git a/src/nfa/dm/nfa_dm_main.cc b/src/nfa/dm/nfa_dm_main.cc
index b7c90e7..0d0fdd5 100644
--- a/src/nfa/dm/nfa_dm_main.cc
+++ b/src/nfa/dm/nfa_dm_main.cc
@@ -80,9 +80,7 @@
/*****************************************************************************
** Local function prototypes
*****************************************************************************/
-#if (BT_TRACE_VERBOSE == TRUE)
static std::string nfa_dm_evt_2_str(uint16_t event);
-#endif
/*******************************************************************************
**
** Function nfa_dm_init
@@ -93,7 +91,7 @@
**
*******************************************************************************/
void nfa_dm_init(void) {
- NFA_TRACE_DEBUG0("nfa_dm_init ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
memset(&nfa_dm_cb, 0, sizeof(tNFA_DM_CB));
nfa_dm_cb.poll_disc_handle = NFA_HANDLE_INVALID;
nfa_dm_cb.disc_cb.disc_duration = NFA_DM_DISC_DURATION_POLL;
@@ -117,12 +115,8 @@
bool freebuf = true;
uint16_t event = p_msg->event & 0x00ff;
-#if (BT_TRACE_VERBOSE == TRUE)
- NFA_TRACE_EVENT2("nfa_dm_evt_hdlr event: %s (0x%02x)",
- nfa_dm_evt_2_str(event).c_str(), event);
-#else
- NFA_TRACE_EVENT1("nfa_dm_evt_hdlr event: 0x%x", event);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "event: %s (0x%02x)", nfa_dm_evt_2_str(event).c_str(), event);
/* execute action functions */
if (event < NFA_DM_NUM_ACTIONS) {
@@ -153,9 +147,9 @@
nfa_dm_disable_complete();
} else {
/* probably waiting to be disabled */
- NFA_TRACE_WARNING2("DM disc_state state = %d disc_flags:0x%x",
- nfa_dm_cb.disc_cb.disc_state,
- nfa_dm_cb.disc_cb.disc_flags);
+ LOG(WARNING) << StringPrintf("DM disc_state state = %d disc_flags:0x%x",
+ nfa_dm_cb.disc_cb.disc_state,
+ nfa_dm_cb.disc_cb.disc_flags);
}
} else {
@@ -192,7 +186,8 @@
**
*******************************************************************************/
bool nfa_dm_is_active(void) {
- NFA_TRACE_DEBUG1("nfa_dm_is_active () flags:0x%x", nfa_dm_cb.flags);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("flags:0x%x", nfa_dm_cb.flags);
if ((nfa_dm_cb.flags & NFA_DM_FLAGS_DM_IS_ACTIVE) &&
((nfa_dm_cb.flags &
(NFA_DM_FLAGS_ENABLE_EVT_PEND | NFA_DM_FLAGS_NFCC_IS_RESTORING |
@@ -219,12 +214,12 @@
tNFC_STATUS nfc_status;
uint32_t cur_bit;
- NFA_TRACE_DEBUG0("nfa_dm_check_set_config ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* We only allow 32 pending SET_CONFIGs */
if (nfa_dm_cb.setcfg_pending_num >= NFA_DM_SETCONFIG_PENDING_MAX) {
- NFA_TRACE_ERROR0(
- "nfa_dm_check_set_config () error: pending number of SET_CONFIG "
+ LOG(ERROR) << StringPrintf(
+ "error: pending number of SET_CONFIG "
"exceeded");
return NFA_STATUS_FAILED;
}
@@ -446,7 +441,6 @@
}
}
-#if (BT_TRACE_VERBOSE == TRUE)
/*******************************************************************************
**
** Function nfa_dm_nfc_revt_2_str
@@ -510,4 +504,3 @@
return "Unknown or Vendor Specific";
}
-#endif /* BT_TRACE_VERBOSE */
diff --git a/src/nfa/dm/nfa_dm_ndef.cc b/src/nfa/dm/nfa_dm_ndef.cc
index 95cb1bb..8c9944b 100644
--- a/src/nfa/dm/nfa_dm_ndef.cc
+++ b/src/nfa/dm/nfa_dm_ndef.cc
@@ -136,13 +136,14 @@
if (p_reg_info->tnf == NFA_TNF_DEFAULT) {
/* check if default handler is already registered */
if (p_cb->p_ndef_handler[NFA_NDEF_DEFAULT_HANDLER_IDX]) {
- NFA_TRACE_WARNING0("Default NDEF handler being changed.");
+ LOG(WARNING) << StringPrintf("Default NDEF handler being changed.");
/* Free old registration info */
nfa_dm_ndef_dereg_hdlr_by_handle(
(tNFA_HANDLE)NFA_NDEF_DEFAULT_HANDLER_IDX);
}
- NFA_TRACE_DEBUG0("Default NDEF handler successfully registered.");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Default NDEF handler successfully registered.");
hdlr_idx = NFA_NDEF_DEFAULT_HANDLER_IDX;
}
/* Get available entry in ndef_handler table, and check if requested type is
@@ -171,8 +172,9 @@
ndef_register.ndef_type_handle = p_reg_info->ndef_type_handle;
ndef_register.status = NFA_STATUS_OK;
- NFA_TRACE_DEBUG1("NDEF handler successfully registered. Handle=0x%08x",
- p_reg_info->ndef_type_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NDEF handler successfully registered. Handle=0x%08x",
+ p_reg_info->ndef_type_handle);
tNFA_NDEF_EVT_DATA nfa_ndef_evt_data;
nfa_ndef_evt_data.ndef_reg = ndef_register;
(*(p_reg_info->p_ndef_cback))(NFA_NDEF_REGISTER_EVT, &nfa_ndef_evt_data);
@@ -182,7 +184,7 @@
return false;
} else {
/* Error */
- NFA_TRACE_ERROR0("NDEF handler failed to register.");
+ LOG(ERROR) << StringPrintf("NDEF handler failed to register.");
ndef_register.ndef_type_handle = NFA_HANDLE_INVALID;
ndef_register.status = NFA_STATUS_FAILED;
tNFA_NDEF_EVT_DATA nfa_ndef_evt_data;
@@ -211,8 +213,8 @@
NFA_HANDLE_GROUP_NDEF_HANDLER) ||
((p_dereginfo->ndef_type_handle & NFA_HANDLE_MASK) >=
NFA_NDEF_MAX_HANDLERS)) {
- NFA_TRACE_ERROR1("Invalid handle for NDEF type handler: 0x%08x",
- p_dereginfo->ndef_type_handle);
+ LOG(ERROR) << StringPrintf("Invalid handle for NDEF type handler: 0x%08x",
+ p_dereginfo->ndef_type_handle);
} else {
nfa_dm_ndef_dereg_hdlr_by_handle(p_dereginfo->ndef_type_handle);
}
@@ -365,8 +367,8 @@
uint8_t rec_count = 0;
bool record_handled, entire_message_handled;
- NFA_TRACE_DEBUG3("nfa_dm_ndef_handle_message status=%i, msgbuf=%08x, len=%i",
- status, p_msg_buf, len);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfa_dm_ndef_handle_message status=%i, len=%i", status, len);
if (status != NFA_STATUS_OK) {
/* If problem reading NDEF message, then exit (no action required) */
@@ -392,7 +394,7 @@
if (len == 0) {
p_handler = p_cb->p_ndef_handler[NFA_NDEF_DEFAULT_HANDLER_IDX];
if (p_handler != NULL) {
- NFA_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"Notifying default handler of zero-length NDEF message...");
ndef_data.ndef_type_handle = p_handler->ndef_type_handle;
ndef_data.p_data = NULL; /* Start of record */
@@ -407,8 +409,8 @@
/* Validate the NDEF message */
ndef_status = NDEF_MsgValidate(p_msg_buf, len, true);
if (ndef_status != NDEF_OK) {
- NFA_TRACE_ERROR1("Received invalid NDEF message. NDEF status=0x%x",
- ndef_status);
+ LOG(ERROR) << StringPrintf(
+ "Received invalid NDEF message. NDEF status=0x%x", ndef_status);
return;
}
@@ -443,7 +445,8 @@
/* Not a registered NDEF type. Use default handler */
p_handler = p_cb->p_ndef_handler[NFA_NDEF_DEFAULT_HANDLER_IDX];
if (p_handler != NULL) {
- NFA_TRACE_DEBUG0("No handler found. Using default handler...");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("No handler found. Using default handler...");
}
}
@@ -458,8 +461,8 @@
}
/* Get pointer to record payload */
- NFA_TRACE_DEBUG1("Calling ndef type handler (%x)",
- p_handler->ndef_type_handle);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Calling ndef type handler (%x)", p_handler->ndef_type_handle);
ndef_data.ndef_type_handle = p_handler->ndef_type_handle;
ndef_data.p_data = p_rec; /* Start of record */
@@ -526,7 +529,7 @@
* if no default handler was register) */
if ((!record_handled) && (!entire_message_handled)) {
/* Unregistered NDEF record type; no default handler */
- NFA_TRACE_WARNING1("Unhandled NDEF record (#%i)", rec_count);
+ LOG(WARNING) << StringPrintf("Unhandled NDEF record (#%i)", rec_count);
}
rec_count++;
diff --git a/src/nfa/ee/nfa_ee_act.cc b/src/nfa/ee/nfa_ee_act.cc
index 507279a..6ec2f0e 100644
--- a/src/nfa/ee/nfa_ee_act.cc
+++ b/src/nfa/ee/nfa_ee_act.cc
@@ -105,15 +105,16 @@
buff[0] = 0;
if (aid_len > NFA_MAX_AID_LEN) {
- NFA_TRACE_ERROR2("aid_len: %d exceeds max(%d)", aid_len, NFA_MAX_AID_LEN);
+ LOG(ERROR) << StringPrintf("aid_len: %d exceeds max(%d)", aid_len,
+ NFA_MAX_AID_LEN);
len = NFA_MAX_AID_LEN;
}
for (xx = 0; xx < len; xx++) {
yy += sprintf(&buff[yy], "%02x ", *p);
p++;
}
- NFA_TRACE_DEBUG4("%s id:0x%x len=%d aid:%s", p_str.c_str(), id, aid_len,
- buff);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "%s id:0x%x len=%d aid:%s", p_str.c_str(), id, aid_len, buff);
}
/*******************************************************************************
@@ -160,8 +161,9 @@
p_cb->size_mask += 5;
}
}
- NFA_TRACE_DEBUG2("nfa_ee_update_route_size nfcee_id:0x%x size_mask:%d",
- p_cb->nfcee_id, p_cb->size_mask);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_ee_update_route_size nfcee_id:0x%x size_mask:%d",
+ p_cb->nfcee_id, p_cb->size_mask);
}
/*******************************************************************************
@@ -195,8 +197,9 @@
start_offset += p_cb->aid_len[xx];
}
}
- NFA_TRACE_DEBUG2("nfa_ee_update_route_aid_size nfcee_id:0x%x size_aid:%d",
- p_cb->nfcee_id, p_cb->size_aid);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_ee_update_route_aid_size nfcee_id:0x%x size_aid:%d",
+ p_cb->nfcee_id, p_cb->size_aid);
}
/*******************************************************************************
@@ -223,7 +226,8 @@
lmrt_size += p_cb->size_aid;
}
}
- NFA_TRACE_DEBUG1("nfa_ee_total_lmrt_size size:%d", lmrt_size);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_ee_total_lmrt_size size:%d", lmrt_size);
return lmrt_size;
}
@@ -298,7 +302,8 @@
NCI_ROUTE_PWR_STATE_ON, NFC_PROTOCOL_NFC_DEP);
num_tlv++;
- NFA_TRACE_DEBUG1("%s - NFC DEP added for DH!!!", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s - NFC DEP added for DH!!!", __func__);
}
/* update the num_tlv and current offset */
uint8_t entry_size = (uint8_t)(pp - p);
@@ -324,16 +329,18 @@
num_tlv++;
uint8_t* pa = &p_cb->aid_cfg[start_offset];
- NFA_TRACE_DEBUG2("%s - p_cb->aid_info%x", __func__,
- p_cb->aid_info[xx]);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "%s - p_cb->aid_info%x", __func__, p_cb->aid_info[xx]);
if (p_cb->aid_info[xx] & NCI_ROUTE_QUAL_LONG_SELECT) {
- NFA_TRACE_DEBUG2("%s - %x", __func__,
- p_cb->aid_info[xx] & NCI_ROUTE_QUAL_LONG_SELECT);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s - %x", __func__,
+ p_cb->aid_info[xx] & NCI_ROUTE_QUAL_LONG_SELECT);
route_qual |= NCI_ROUTE_QUAL_LONG_SELECT;
}
if (p_cb->aid_info[xx] & NCI_ROUTE_QUAL_SHORT_SELECT) {
- NFA_TRACE_DEBUG2("%s - %x", __func__,
- p_cb->aid_info[xx] & NCI_ROUTE_QUAL_SHORT_SELECT);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s - %x", __func__,
+ p_cb->aid_info[xx] & NCI_ROUTE_QUAL_SHORT_SELECT);
route_qual |= NCI_ROUTE_QUAL_SHORT_SELECT;
}
@@ -361,7 +368,8 @@
}
}
} else {
- NFA_TRACE_DEBUG1("%s - No AID entries available", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s - No AID entries available", __func__);
}
}
@@ -378,8 +386,8 @@
tNFC_CONN* p_data) {
tNFA_EE_NCI_CONN cbk;
- NFA_TRACE_DEBUG2("nfa_ee_conn_cback: conn_id: %d, event=0x%02x", conn_id,
- event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfa_ee_conn_cback: conn_id: %d, event=0x%02x", conn_id, event);
cbk.hdr.event = NFA_EE_NCI_CONN_EVT;
if (event == NFC_DATA_CEVT) {
@@ -511,8 +519,8 @@
tNFA_EE_CBACK* p_cback = p_data->ee_discover.p_cback;
tNFA_EE_CBACK_DATA evt_data = {0};
- NFA_TRACE_DEBUG1("nfa_ee_api_discover() in_use:%d",
- nfa_ee_cb.discv_timer.in_use);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("in_use:%d", nfa_ee_cb.discv_timer.in_use);
if (nfa_ee_cb.discv_timer.in_use) {
nfa_sys_stop_timer(&nfa_ee_cb.discv_timer);
if (NFA_GetNCIVersion() != NCI_VERSION_2_0) NFC_NfceeDiscover(false);
@@ -583,7 +591,7 @@
int index = p_data->deregister.index;
tNFA_EE_CBACK_DATA evt_data = {0};
- NFA_TRACE_DEBUG0("nfa_ee_api_deregister");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("nfa_ee_api_deregister");
p_cback = nfa_ee_cb.p_ee_cback[index];
nfa_ee_cb.p_ee_cback[index] = NULL;
if (p_cback) (*p_cback)(NFA_EE_DEREGISTER_EVT, &evt_data);
@@ -601,8 +609,8 @@
void nfa_ee_api_mode_set(tNFA_EE_MSG* p_data) {
tNFA_EE_ECB* p_cb = p_data->cfg_hdr.p_cb;
tNFA_EE_MODE_SET mode_set;
- NFA_TRACE_DEBUG2("nfa_ee_api_mode_set() handle:0x%02x mode:%d",
- p_cb->nfcee_id, p_data->mode_set.mode);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "handle:0x%02x mode:%d", p_cb->nfcee_id, p_data->mode_set.mode);
mode_set.status = NFC_NfceeModeSet(p_cb->nfcee_id, p_data->mode_set.mode);
if (mode_set.status != NFC_STATUS_OK) {
/* the api is rejected at NFC layer, report the failure status right away */
@@ -661,7 +669,7 @@
p_cb->tech_battery_off = p_data->set_tech.technologies_battery_off;
nfa_ee_update_route_size(p_cb);
if (nfa_ee_total_lmrt_size() > NFC_GetLmrtSize()) {
- NFA_TRACE_ERROR0("nfa_ee_api_set_tech_cfg Exceed LMRT size");
+ LOG(ERROR) << StringPrintf("nfa_ee_api_set_tech_cfg Exceed LMRT size");
evt_data.status = NFA_STATUS_BUFFER_FULL;
p_cb->tech_switch_on = old_tech_switch_on;
p_cb->tech_switch_off = old_tech_switch_off;
@@ -712,7 +720,7 @@
p_cb->proto_battery_off = p_data->set_proto.protocols_battery_off;
nfa_ee_update_route_size(p_cb);
if (nfa_ee_total_lmrt_size() > NFC_GetLmrtSize()) {
- NFA_TRACE_ERROR0("nfa_ee_api_set_proto_cfg Exceed LMRT size");
+ LOG(ERROR) << StringPrintf("nfa_ee_api_set_proto_cfg Exceed LMRT size");
evt_data.status = NFA_STATUS_BUFFER_FULL;
p_cb->proto_switch_on = old_proto_switch_on;
p_cb->proto_switch_off = old_proto_switch_off;
@@ -757,21 +765,21 @@
p_chk_cb =
nfa_ee_find_aid_offset(p_add->aid_len, p_add->p_aid, &offset, &entry);
if (p_chk_cb) {
- NFA_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfa_ee_api_add_aid The AID entry is already in the database");
if (p_chk_cb == p_cb) {
p_cb->aid_rt_info[entry] |= NFA_EE_AE_ROUTE;
p_cb->aid_info[entry] = p_add->aidInfo;
new_size = nfa_ee_total_lmrt_size();
if (new_size > NFC_GetLmrtSize()) {
- NFA_TRACE_ERROR1("Exceed LMRT size:%d (add ROUTE)", new_size);
+ LOG(ERROR) << StringPrintf("Exceed LMRT size:%d (add ROUTE)", new_size);
evt_data.status = NFA_STATUS_BUFFER_FULL;
p_cb->aid_rt_info[entry] &= ~NFA_EE_AE_ROUTE;
} else {
p_cb->aid_pwr_cfg[entry] = p_add->power_state;
}
} else {
- NFA_TRACE_ERROR1(
+ LOG(ERROR) << StringPrintf(
"The AID entry is already in the database for different NFCEE "
"ID:0x%02x",
p_chk_cb->nfcee_id);
@@ -785,7 +793,7 @@
len_needed = p_add->aid_len + 2; /* tag/len */
if ((len_needed + len) > NFA_EE_MAX_AID_CFG_LEN) {
- NFA_TRACE_ERROR3(
+ LOG(ERROR) << StringPrintf(
"Exceed capacity: (len_needed:%d + len:%d) > "
"NFA_EE_MAX_AID_CFG_LEN:%d",
len_needed, len, NFA_EE_MAX_AID_CFG_LEN);
@@ -794,7 +802,7 @@
/* 4 = 1 (tag) + 1 (len) + 1(nfcee_id) + 1(power cfg) */
new_size = nfa_ee_total_lmrt_size() + 4 + p_add->aid_len;
if (new_size > NFC_GetLmrtSize()) {
- NFA_TRACE_ERROR1("Exceed LMRT size:%d", new_size);
+ LOG(ERROR) << StringPrintf("Exceed LMRT size:%d", new_size);
evt_data.status = NFA_STATUS_BUFFER_FULL;
} else {
/* add AID */
@@ -811,8 +819,8 @@
p_cb->aid_len[p_cb->aid_entries++] = (uint8_t)(p - p_start);
}
} else {
- NFA_TRACE_ERROR1("Exceed NFA_EE_MAX_AID_ENTRIES:%d",
- NFA_EE_MAX_AID_ENTRIES);
+ LOG(ERROR) << StringPrintf("Exceed NFA_EE_MAX_AID_ENTRIES:%d",
+ NFA_EE_MAX_AID_ENTRIES);
evt_data.status = NFA_STATUS_BUFFER_FULL;
}
}
@@ -824,8 +832,8 @@
nfa_ee_update_route_aid_size(p_cb);
nfa_ee_start_timer();
}
- NFA_TRACE_DEBUG2("status:%d ee_cfged:0x%02x ", evt_data.status,
- nfa_ee_cb.ee_cfged);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "status:%d ee_cfged:0x%02x ", evt_data.status, nfa_ee_cb.ee_cfged);
/* report the status of this operation */
nfa_ee_report_event(p_cb->p_ee_cback, NFA_EE_ADD_AID_EVT, &evt_data);
}
@@ -853,8 +861,8 @@
p_cb = nfa_ee_find_aid_offset(p_data->rm_aid.aid_len, p_data->rm_aid.p_aid,
&offset, &entry);
if (p_cb && p_cb->aid_entries) {
- NFA_TRACE_DEBUG2("aid_rt_info[%d]: 0x%02x", entry,
- p_cb->aid_rt_info[entry]);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "aid_rt_info[%d]: 0x%02x", entry, p_cb->aid_rt_info[entry]);
/* mark routing and VS changed */
if (p_cb->aid_rt_info[entry] & NFA_EE_AE_ROUTE)
p_cb->ecb_flags |= NFA_EE_ECB_FLAGS_AID;
@@ -869,8 +877,8 @@
rest_len = nfa_ee_find_total_aid_len(p_cb, entry + 1);
len = p_cb->aid_len[entry];
- NFA_TRACE_DEBUG2("nfa_ee_api_remove_aid len:%d, rest_len:%d", len,
- rest_len);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfa_ee_api_remove_aid len:%d, rest_len:%d", len, rest_len);
GKI_shiftup(&p_cb->aid_cfg[offset], &p_cb->aid_cfg[offset + len],
rest_len);
rest_len = p_cb->aid_entries - entry;
@@ -888,7 +896,7 @@
/* report NFA_EE_REMOVE_AID_EVT to the callback associated the NFCEE */
p_cback = p_cb->p_ee_cback;
} else {
- NFA_TRACE_ERROR0(
+ LOG(ERROR) << StringPrintf(
"nfa_ee_api_remove_aid The AID entry is not in the database");
evt_data.status = NFA_STATUS_INVALID_PARAM;
}
@@ -909,8 +917,9 @@
uint16_t total_size = NFC_GetLmrtSize();
evt_data.size = total_size - nfa_ee_total_lmrt_size();
- NFA_TRACE_DEBUG2("nfa_ee_api_lmrt_size total size:%d remaining size:%d",
- total_size, evt_data.size);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_ee_api_lmrt_size total size:%d remaining size:%d",
+ total_size, evt_data.size);
nfa_ee_report_event(NULL, NFA_EE_REMAINING_SIZE_EVT, &evt_data);
}
@@ -928,7 +937,7 @@
tNFA_EE_CBACK_DATA evt_data;
if (nfa_ee_cb.ee_wait_evt & NFA_EE_WAIT_UPDATE_ALL) {
- NFA_TRACE_ERROR2(
+ LOG(ERROR) << StringPrintf(
"nfa_ee_api_update_now still waiting for update complete "
"ee_wait_evt:0x%x wait_rsp:%d",
nfa_ee_cb.ee_wait_evt, nfa_ee_cb.wait_rsp);
@@ -1053,8 +1062,8 @@
tNFA_EE_CBACK* p_cback;
tNFA_EE_CBACK_DATA evt_data = {0};
- NFA_TRACE_DEBUG3(
- "nfa_ee_report_disc_done() em_state:%d num_ee_expecting:%d "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "em_state:%d num_ee_expecting:%d "
"notify_enable_done:%d",
nfa_ee_cb.em_state, nfa_ee_cb.num_ee_expecting, notify_enable_done);
if (nfa_ee_cb.num_ee_expecting == 0) {
@@ -1133,9 +1142,9 @@
}
}
- NFA_TRACE_DEBUG3(
- "nfa_ee_remove_pending() cur_ee:%d, num_removed:%d first_removed:%d",
- nfa_ee_cb.cur_ee, num_removed, first_removed);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("cur_ee:%d, num_removed:%d first_removed:%d",
+ nfa_ee_cb.cur_ee, num_removed, first_removed);
if (num_removed && (first_removed != (nfa_ee_cb.cur_ee - num_removed))) {
/* if the removes ECB entried are not at the end, move the entries up */
p_cb_end = &nfa_ee_cb.ecb[nfa_ee_cb.cur_ee - 1];
@@ -1172,8 +1181,9 @@
uint8_t num_nfcee = p_evt->num_nfcee;
bool notify_enable_done = false;
- NFA_TRACE_DEBUG3("nfa_ee_nci_disc_rsp() em_state:%d cur_ee:%d, num_nfcee:%d",
- nfa_ee_cb.em_state, nfa_ee_cb.cur_ee, num_nfcee);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("em_state:%d cur_ee:%d, num_nfcee:%d", nfa_ee_cb.em_state,
+ nfa_ee_cb.cur_ee, num_nfcee);
switch (nfa_ee_cb.em_state) {
case NFA_EE_EM_STATE_INIT:
nfa_ee_cb.cur_ee = 0;
@@ -1220,14 +1230,15 @@
if (p_evt->status == NFC_STATUS_OK) {
nfa_ee_cb.num_ee_expecting = p_evt->num_nfcee;
if (nfa_ee_cb.num_ee_expecting > NFA_EE_MAX_EE_SUPPORTED) {
- NFA_TRACE_ERROR2("NFA-EE num_ee_expecting:%d > max:%d",
- nfa_ee_cb.num_ee_expecting, NFA_EE_MAX_EE_SUPPORTED);
+ LOG(ERROR) << StringPrintf("NFA-EE num_ee_expecting:%d > max:%d",
+ nfa_ee_cb.num_ee_expecting,
+ NFA_EE_MAX_EE_SUPPORTED);
}
}
nfa_ee_report_disc_done(notify_enable_done);
- NFA_TRACE_DEBUG3(
- "nfa_ee_nci_disc_rsp() em_state:%d cur_ee:%d num_ee_expecting:%d",
- nfa_ee_cb.em_state, nfa_ee_cb.cur_ee, nfa_ee_cb.num_ee_expecting);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "em_state:%d cur_ee:%d num_ee_expecting:%d", nfa_ee_cb.em_state,
+ nfa_ee_cb.cur_ee, nfa_ee_cb.num_ee_expecting);
}
/*******************************************************************************
@@ -1248,8 +1259,8 @@
tNFA_EE_INFO* p_info;
tNFA_EE_EM_STATE new_em_state = NFA_EE_EM_STATE_MAX;
- NFA_TRACE_DEBUG4(
- "nfa_ee_nci_disc_ntf() em_state:%d ee_flags:0x%x cur_ee:%d "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "em_state:%d ee_flags:0x%x cur_ee:%d "
"num_ee_expecting:%d",
nfa_ee_cb.em_state, nfa_ee_cb.ee_flags, nfa_ee_cb.cur_ee,
nfa_ee_cb.num_ee_expecting);
@@ -1289,8 +1300,9 @@
nfa_ee_cb.cur_ee++;
notify_new_ee = true;
} else {
- NFA_TRACE_DEBUG3("cur_ee:%d ecb_flags=0x%02x ee_status=0x%x",
- nfa_ee_cb.cur_ee, p_cb->ecb_flags, p_cb->ee_status);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("cur_ee:%d ecb_flags=0x%02x ee_status=0x%x",
+ nfa_ee_cb.cur_ee, p_cb->ecb_flags, p_cb->ee_status);
}
break;
@@ -1314,7 +1326,8 @@
}
break;
}
- NFA_TRACE_DEBUG1("nfa_ee_nci_disc_ntf cur_ee:%d", nfa_ee_cb.cur_ee);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_ee_nci_disc_ntf cur_ee:%d", nfa_ee_cb.cur_ee);
if (p_cb) {
p_cb->nfcee_id = p_ee->nfcee_id;
@@ -1360,7 +1373,8 @@
nfa_ee_report_disc_done(notify_enable_done);
if (p_cb->ecb_flags & NFA_EE_ECB_FLAGS_ORDER) {
- NFA_TRACE_DEBUG0("NFA_EE_ECB_FLAGS_ORDER");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NFA_EE_ECB_FLAGS_ORDER");
p_cb->ecb_flags &= ~NFA_EE_ECB_FLAGS_ORDER;
nfa_ee_report_discover_req_evt();
}
@@ -1409,7 +1423,7 @@
}
}
- NFA_TRACE_DEBUG2(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfa_ee_check_restore_complete nfa_ee_cb.ee_cfg_sts:0x%02x "
"proc_complete:%d",
nfa_ee_cb.ee_cfg_sts, proc_complete);
@@ -1457,7 +1471,7 @@
p_evt_data->num_ee++;
p_info++;
- NFA_TRACE_DEBUG6(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"[%d] ee_handle:0x%x, listen protocol A:%d, B:%d, F:%d, BP:%d",
p_evt_data->num_ee, p_cb->nfcee_id, p_cb->la_protocol,
p_cb->lb_protocol, p_cb->lf_protocol, p_cb->lbp_protocol);
@@ -1481,7 +1495,8 @@
/* if this is restoring NFCC */
if (!nfa_dm_is_active()) {
- NFA_TRACE_DEBUG0("nfa_ee_report_discover_req_evt DM is not active");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_ee_report_discover_req_evt DM is not active");
return;
}
@@ -1504,18 +1519,19 @@
tNFA_EE_MODE_SET mode_set;
tNFC_NFCEE_MODE_SET_REVT* p_rsp = p_data->mode_set_rsp.p_data;
- NFA_TRACE_DEBUG3("%s handle:0x%02x mode:%d", __func__, p_rsp->nfcee_id,
- p_rsp->mode);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "%s handle:0x%02x mode:%d", __func__, p_rsp->nfcee_id, p_rsp->mode);
p_cb = nfa_ee_find_ecb(p_rsp->nfcee_id);
if (p_cb == NULL) {
- NFA_TRACE_ERROR2("%s Can not find cb for handle:0x%02x", __func__,
- p_rsp->nfcee_id);
+ LOG(ERROR) << StringPrintf("%s Can not find cb for handle:0x%02x", __func__,
+ p_rsp->nfcee_id);
return;
}
/* update routing table and vs on mode change */
nfa_ee_start_timer();
- NFA_TRACE_ERROR2("%s p_rsp->status:0x%02x", __func__, p_rsp->status);
+ LOG(ERROR) << StringPrintf("%s p_rsp->status:0x%02x", __func__,
+ p_rsp->status);
if (p_rsp->status == NFA_STATUS_OK) {
if (p_rsp->mode == NFA_EE_MD_ACTIVATE) {
p_cb->ee_status = NFC_NFCEE_STATUS_ACTIVE;
@@ -1528,7 +1544,8 @@
* configuration */
nfa_ee_cb.ee_cfged &= ~nfa_ee_ecb_to_mask(p_cb);
nfa_ee_cb.ee_cfg_sts |= NFA_EE_STS_CHANGED_ROUTING;
- NFA_TRACE_DEBUG0("deactivating/still configured. Force update");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("deactivating/still configured. Force update");
}
p_cb->tech_switch_on = p_cb->tech_switch_off = p_cb->tech_battery_off = 0;
p_cb->proto_switch_on = p_cb->proto_switch_off = p_cb->proto_battery_off =
@@ -1539,9 +1556,9 @@
} else if (p_rsp->mode == NFA_EE_MD_ACTIVATE) {
p_cb->ee_status = NFC_NFCEE_STATUS_REMOVED;
}
- NFA_TRACE_DEBUG4("status:%d ecb_flags :0x%02x ee_cfged:0x%02x ee_status:%d",
- p_rsp->status, p_cb->ecb_flags, nfa_ee_cb.ee_cfged,
- p_cb->ee_status);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "status:%d ecb_flags :0x%02x ee_cfged:0x%02x ee_status:%d",
+ p_rsp->status, p_cb->ecb_flags, nfa_ee_cb.ee_cfged, p_cb->ee_status);
if (p_cb->ecb_flags & NFA_EE_ECB_FLAGS_RESTORE) {
if (p_cb->conn_st == NFA_EE_CONN_ST_CONN) {
/* NFA_HCI module handles restoring configurations for HCI access */
@@ -1585,8 +1602,9 @@
void nfa_ee_report_update_evt(void) {
tNFA_EE_CBACK_DATA evt_data;
- NFA_TRACE_DEBUG2("nfa_ee_report_update_evt ee_wait_evt:0x%x wait_rsp:%d",
- nfa_ee_cb.ee_wait_evt, nfa_ee_cb.wait_rsp);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_ee_report_update_evt ee_wait_evt:0x%x wait_rsp:%d",
+ nfa_ee_cb.ee_wait_evt, nfa_ee_cb.wait_rsp);
if (nfa_ee_cb.wait_rsp == 0) {
nfa_ee_cb.ee_wait_evt &= ~NFA_EE_WAIT_UPDATE_RSP;
@@ -1611,8 +1629,9 @@
void nfa_ee_nci_wait_rsp(tNFA_EE_MSG* p_data) {
tNFA_EE_NCI_WAIT_RSP* p_rsp = &p_data->wait_rsp;
- NFA_TRACE_DEBUG2("nfa_ee_nci_wait_rsp() ee_wait_evt:0x%x wait_rsp:%d",
- nfa_ee_cb.ee_wait_evt, nfa_ee_cb.wait_rsp);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("ee_wait_evt:0x%x wait_rsp:%d", nfa_ee_cb.ee_wait_evt,
+ nfa_ee_cb.wait_rsp);
if (nfa_ee_cb.wait_rsp) {
if (p_rsp->opcode == NCI_MSG_RF_SET_ROUTING) nfa_ee_cb.wait_rsp--;
}
@@ -1739,23 +1758,23 @@
uint8_t report_ntf = 0;
uint8_t xx;
- NFA_TRACE_DEBUG2("nfa_ee_nci_disc_req_ntf () num_info: %d cur_ee:%d",
- p_cbk->num_info, nfa_ee_cb.cur_ee);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "num_info: %d cur_ee:%d", p_cbk->num_info, nfa_ee_cb.cur_ee);
for (xx = 0; xx < p_cbk->num_info; xx++) {
ee_handle = NFA_HANDLE_GROUP_EE | p_cbk->info[xx].nfcee_id;
p_cb = nfa_ee_find_ecb(p_cbk->info[xx].nfcee_id);
if (!p_cb) {
- NFA_TRACE_DEBUG1("Cannot find cb for NFCEE: 0x%x",
- p_cbk->info[xx].nfcee_id);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Cannot find cb for NFCEE: 0x%x", p_cbk->info[xx].nfcee_id);
p_cb = nfa_ee_find_ecb(NFA_EE_INVALID);
if (p_cb) {
p_cb->nfcee_id = p_cbk->info[xx].nfcee_id;
p_cb->ecb_flags |= NFA_EE_ECB_FLAGS_ORDER;
} else {
- NFA_TRACE_ERROR1("Cannot allocate cb for NFCEE: 0x%x",
- p_cbk->info[xx].nfcee_id);
+ LOG(ERROR) << StringPrintf("Cannot allocate cb for NFCEE: 0x%x",
+ p_cbk->info[xx].nfcee_id);
continue;
}
} else {
@@ -1774,7 +1793,7 @@
NFC_DISCOVERY_TYPE_LISTEN_B_PRIME) {
p_cb->lbp_protocol = p_cbk->info[xx].protocol;
}
- NFA_TRACE_DEBUG6(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfcee_id=0x%x ee_status=0x%x ecb_flags=0x%x la_protocol=0x%x "
"la_protocol=0x%x la_protocol=0x%x",
p_cb->nfcee_id, p_cb->ee_status, p_cb->ecb_flags, p_cb->la_protocol,
@@ -1844,7 +1863,7 @@
NFA_TECHNOLOGY_MASK_A, NFA_TECHNOLOGY_MASK_B, NFA_TECHNOLOGY_MASK_F,
NFA_TECHNOLOGY_MASK_B_PRIME};
- NFA_TRACE_DEBUG1("nfa_ee_get_tech_route(): %d", power_state);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%d", power_state);
for (xx = 0; xx < NFA_EE_MAX_TECH_ROUTE; xx++) {
p_handles[xx] = NFC_DH_ID;
@@ -1868,8 +1887,9 @@
}
}
}
- NFA_TRACE_DEBUG4("0x%x, 0x%x, 0x%x, 0x%x", p_handles[0], p_handles[1],
- p_handles[2], p_handles[3]);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("0x%x, 0x%x, 0x%x, 0x%x", p_handles[0], p_handles[1],
+ p_handles[2], p_handles[3]);
}
/*******************************************************************************
@@ -1937,7 +1957,7 @@
: *p_max_len);
/* use the first byte of the buffer (ps) to keep the num_tlv */
num_tlv = *ps;
- NFA_TRACE_DEBUG5(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfa_ee_route_add_one_ecb max_len:%d, max_tlv:%d, cur_offset:%d, "
"more:%d, num_tlv:%d",
*p_max_len, max_tlv, *p_cur_offset, more, num_tlv);
@@ -2052,8 +2072,8 @@
if (p_cb->ecb_flags & NFA_EE_ECB_FLAGS_ROUTING) {
nfa_ee_cb.ee_cfg_sts |= NFA_EE_STS_CHANGED_ROUTING;
}
- NFA_TRACE_DEBUG2("ee_cfg_sts:0x%02x lmrt_size:%d", nfa_ee_cb.ee_cfg_sts,
- tlv_size);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "ee_cfg_sts:0x%02x lmrt_size:%d", nfa_ee_cb.ee_cfg_sts, tlv_size);
if (more == false) {
/* last entry. update routing table now */
@@ -2063,7 +2083,7 @@
} else {
nfa_ee_cb.ee_cfg_sts &= ~NFA_EE_STS_PREV_ROUTING;
}
- NFA_TRACE_DEBUG2(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfa_ee_route_add_one_ecb: set routing num_tlv:%d tlv_size:%d",
num_tlv, tlv_size);
if (NFC_SetRouting(more, num_tlv, (uint8_t)(*p_cur_offset), ps + 1) ==
@@ -2100,7 +2120,7 @@
/* use the first byte of the buffer (ps) to keep the num_tlv */
uint8_t num_tlv = *ps;
- NFA_TRACE_DEBUG6(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"%s - max_len:%d, cur_offset:%d, more:%d, num_tlv:%d,rout_type:- %d",
__func__, *p_max_len, *p_cur_offset, more, num_tlv, rout_type);
uint8_t* pp = ps + 1 + *p_cur_offset;
@@ -2119,7 +2139,8 @@
nfa_ee_add_aid_route_to_ecb(p_cb, pp, p, ps, p_cur_offset, p_max_len);
} break;
default: {
- NFA_TRACE_DEBUG2("%s - Route type - NA:- %d", __func__, rout_type);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s - Route type - NA:- %d", __func__, rout_type);
}
}
@@ -2133,8 +2154,8 @@
if (p_cb->ecb_flags & NFA_EE_ECB_FLAGS_ROUTING) {
nfa_ee_cb.ee_cfg_sts |= NFA_EE_STS_CHANGED_ROUTING;
}
- NFA_TRACE_DEBUG2("ee_cfg_sts:0x%02x lmrt_size:%d", nfa_ee_cb.ee_cfg_sts,
- tlv_size);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "ee_cfg_sts:0x%02x lmrt_size:%d", nfa_ee_cb.ee_cfg_sts, tlv_size);
if (more == false) {
/* last entry. update routing table now */
@@ -2144,8 +2165,9 @@
} else {
nfa_ee_cb.ee_cfg_sts &= ~NFA_EE_STS_PREV_ROUTING;
}
- NFA_TRACE_DEBUG3("%s : set routing num_tlv:%d tlv_size:%d", __func__,
- num_tlv, tlv_size);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s : set routing num_tlv:%d tlv_size:%d", __func__,
+ num_tlv, tlv_size);
if (NFC_SetRouting(more, num_tlv, (uint8_t)(*p_cur_offset), ps + 1) ==
NFA_STATUS_OK) {
nfa_ee_cb.wait_rsp++;
@@ -2199,8 +2221,9 @@
tNFA_EE_ECB* p_cb;
uint8_t mask;
- NFA_TRACE_DEBUG2("nfa_ee_need_recfg() ee_cfged: 0x%02x ee_cfg_sts: 0x%02x",
- nfa_ee_cb.ee_cfged, nfa_ee_cb.ee_cfg_sts);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("ee_cfged: 0x%02x ee_cfg_sts: 0x%02x", nfa_ee_cb.ee_cfged,
+ nfa_ee_cb.ee_cfg_sts);
/* if no routing/vs is configured, do not need to send the info to NFCC */
if (nfa_ee_cb.ee_cfged || nfa_ee_cb.ee_cfg_sts) {
if (nfa_ee_cb.ee_cfg_sts & NFA_EE_STS_CHANGED) {
@@ -2209,8 +2232,8 @@
p_cb = &nfa_ee_cb.ecb[NFA_EE_CB_4_DH];
mask = 1 << NFA_EE_CB_4_DH;
for (xx = 0; xx <= nfa_ee_cb.cur_ee; xx++) {
- NFA_TRACE_DEBUG3("%d: ecb_flags : 0x%02x, mask: 0x%02x", xx,
- p_cb->ecb_flags, mask);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "%d: ecb_flags : 0x%02x, mask: 0x%02x", xx, p_cb->ecb_flags, mask);
if ((p_cb->ecb_flags) && (nfa_ee_cb.ee_cfged & mask)) {
needed = true;
break;
@@ -2238,7 +2261,7 @@
void nfa_ee_rout_timeout(tNFA_EE_MSG* p_data) {
uint8_t ee_cfged = nfa_ee_cb.ee_cfged;
- NFA_TRACE_DEBUG0("nfa_ee_rout_timeout()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (nfa_ee_need_recfg()) {
/* discovery is not started */
nfa_ee_update_rout();
@@ -2296,7 +2319,7 @@
/* update routing table: DH and the activated NFCEEs */
p = (uint8_t*)GKI_getbuf(NFA_EE_ROUT_BUF_SIZE);
if (p == NULL) {
- NFA_TRACE_ERROR0("nfa_ee_lmrt_to_nfcc() no buffer to send routing info.");
+ LOG(ERROR) << StringPrintf("no buffer to send routing info.");
tNFA_EE_CBACK_DATA nfa_ee_cback_data;
nfa_ee_cback_data.status = status;
nfa_ee_report_event(NULL, NFA_EE_NO_MEM_ERR_EVT, &nfa_ee_cback_data);
@@ -2309,7 +2332,8 @@
if (p_cb->ee_status == NFC_NFCEE_STATUS_ACTIVE) {
if (last_active == NFA_EE_INVALID) {
last_active = p_cb->nfcee_id;
- NFA_TRACE_DEBUG1("last_active: 0x%x", last_active);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("last_active: 0x%x", last_active);
}
}
}
@@ -2329,14 +2353,16 @@
p_cb = &nfa_ee_cb.ecb[0];
for (xx = 0; (xx < nfa_ee_cb.cur_ee) && check; xx++, p_cb++) {
if (p_cb->ee_status == NFC_NFCEE_STATUS_ACTIVE) {
- NFA_TRACE_DEBUG1("%s --add the routing for NFCEEs!!", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s --add the routing for NFCEEs!!", __func__);
nfa_ee_route_add_one_ecb_by_route_order(p_cb, rt, &max_len, more, p,
&cur_offset);
}
}
if (rt == NCI_ROUTE_ORDER_TECHNOLOGY) more = false;
/* add the routing entries for DH */
- NFA_TRACE_DEBUG1("%s --add the routing for DH!!", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s --add the routing for DH!!", __func__);
nfa_ee_route_add_one_ecb_by_route_order(&nfa_ee_cb.ecb[NFA_EE_CB_4_DH], rt,
&max_len, more, p, &cur_offset);
}
@@ -2360,8 +2386,8 @@
uint8_t mask;
tNFA_EE_MSG nfa_ee_msg;
- NFA_TRACE_DEBUG1("nfa_ee_update_rout ee_cfg_sts:0x%02x",
- nfa_ee_cb.ee_cfg_sts);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfa_ee_update_rout ee_cfg_sts:0x%02x", nfa_ee_cb.ee_cfg_sts);
/* use action function to send routing and VS configuration to NFCC */
nfa_ee_msg.hdr.event = NFA_EE_CFG_TO_NFCC_EVT;
@@ -2381,6 +2407,7 @@
nfa_ee_cb.ee_cfged |= mask;
}
}
- NFA_TRACE_DEBUG2("nfa_ee_update_rout ee_cfg_sts:0x%02x ee_cfged:0x%02x",
- nfa_ee_cb.ee_cfg_sts, nfa_ee_cb.ee_cfged);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_ee_update_rout ee_cfg_sts:0x%02x ee_cfged:0x%02x",
+ nfa_ee_cb.ee_cfg_sts, nfa_ee_cb.ee_cfged);
}
diff --git a/src/nfa/ee/nfa_ee_api.cc b/src/nfa/ee/nfa_ee_api.cc
index 87fe0be..de3a8f8 100644
--- a/src/nfa/ee/nfa_ee_api.cc
+++ b/src/nfa/ee/nfa_ee_api.cc
@@ -49,13 +49,14 @@
tNFA_EE_API_DISCOVER* p_msg;
tNFA_STATUS status = NFA_STATUS_FAILED;
- NFA_TRACE_API0("NFA_EeDiscover()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (nfa_ee_cb.em_state != NFA_EE_EM_STATE_INIT_DONE) {
- NFA_TRACE_ERROR1("NFA_EeDiscover bad em state: %d", nfa_ee_cb.em_state);
+ LOG(ERROR) << StringPrintf("NFA_EeDiscover bad em state: %d",
+ nfa_ee_cb.em_state);
status = NFA_STATUS_FAILED;
} else if ((nfa_ee_cb.p_ee_disc_cback != NULL) || (p_cback == NULL)) {
- NFA_TRACE_ERROR0("NFA_EeDiscover() in progress or NULL callback function");
+ LOG(ERROR) << StringPrintf("in progress or NULL callback function");
status = NFA_STATUS_INVALID_PARAM;
} else {
p_msg = (tNFA_EE_API_DISCOVER*)GKI_getbuf(sizeof(tNFA_EE_API_DISCOVER));
@@ -91,24 +92,27 @@
uint8_t max_ret;
uint8_t num_ret = 0;
- NFA_TRACE_DEBUG2("NFA_EeGetInfo em_state:%d cur_ee:%d", nfa_ee_cb.em_state,
- nfa_ee_cb.cur_ee);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NFA_EeGetInfo em_state:%d cur_ee:%d", nfa_ee_cb.em_state,
+ nfa_ee_cb.cur_ee);
/* validate parameters */
if (p_info == NULL || p_num_nfcee == NULL) {
- NFA_TRACE_ERROR0("NFA_EeGetInfo bad parameter");
+ LOG(ERROR) << StringPrintf("NFA_EeGetInfo bad parameter");
return (NFA_STATUS_INVALID_PARAM);
}
max_ret = *p_num_nfcee;
*p_num_nfcee = 0;
if (nfa_ee_cb.em_state == NFA_EE_EM_STATE_INIT) {
- NFA_TRACE_ERROR1("NFA_EeGetInfo bad em state: %d", nfa_ee_cb.em_state);
+ LOG(ERROR) << StringPrintf("NFA_EeGetInfo bad em state: %d",
+ nfa_ee_cb.em_state);
return (NFA_STATUS_FAILED);
}
/* compose output */
for (xx = 0; (xx < ret) && (num_ret < max_ret); xx++, p_cb++) {
- NFA_TRACE_DEBUG4("xx:%d max_ret:%d, num_ret:%d ee_status:0x%x", xx, max_ret,
- num_ret, p_cb->ee_status);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("xx:%d max_ret:%d, num_ret:%d ee_status:0x%x", xx,
+ max_ret, num_ret, p_cb->ee_status);
if ((p_cb->ee_status & NFA_EE_STATUS_INT_MASK) ||
(p_cb->ee_status == NFA_EE_STATUS_REMOVED)) {
continue;
@@ -123,7 +127,7 @@
p_info++;
num_ret++;
}
- NFA_TRACE_DEBUG1("num_ret:%d", num_ret);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("num_ret:%d", num_ret);
*p_num_nfcee = num_ret;
return (NFA_STATUS_OK);
}
@@ -144,10 +148,10 @@
tNFA_EE_API_REGISTER* p_msg;
tNFA_STATUS status = NFA_STATUS_FAILED;
- NFA_TRACE_API0("NFA_EeRegister()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (p_cback == NULL) {
- NFA_TRACE_ERROR0("NFA_EeRegister(): with NULL callback function");
+ LOG(ERROR) << StringPrintf("with NULL callback function");
status = NFA_STATUS_INVALID_PARAM;
} else {
p_msg = (tNFA_EE_API_REGISTER*)GKI_getbuf(sizeof(tNFA_EE_API_REGISTER));
@@ -189,7 +193,8 @@
}
}
- NFA_TRACE_API2("NFA_EeDeregister() %d, status:%d", index, status);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%d, status:%d", index, status);
if ((status != NFA_STATUS_INVALID_PARAM) &&
(p_msg = (tNFA_EE_API_DEREGISTER*)GKI_getbuf(
sizeof(tNFA_EE_API_DEREGISTER))) != NULL) {
@@ -233,11 +238,11 @@
break;
}
}
- NFA_TRACE_API2("NFA_EeModeSet(): handle:<0x%x>, mode:0x%02X", ee_handle,
- mode);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("handle:<0x%x>, mode:0x%02X", ee_handle, mode);
if (p_found == NULL) {
- NFA_TRACE_ERROR1("NFA_EeModeSet() invalid NFCEE:0x%04x", ee_handle);
+ LOG(ERROR) << StringPrintf("invalid NFCEE:0x%04x", ee_handle);
status = NFA_STATUS_INVALID_PARAM;
} else {
p_msg = (tNFA_EE_API_MODE_SET*)GKI_getbuf(sizeof(tNFA_EE_API_MODE_SET));
@@ -286,15 +291,15 @@
uint8_t nfcee_id = (uint8_t)(ee_handle & 0xFF);
tNFA_EE_ECB* p_cb;
- NFA_TRACE_API4(
- "NFA_EeSetDefaultTechRouting(): "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ ""
"handle:<0x%x>technology_mask:<0x%x>/<0x%x>/<0x%x>",
ee_handle, technologies_switch_on, technologies_switch_off,
technologies_battery_off);
p_cb = nfa_ee_find_ecb(nfcee_id);
if (p_cb == NULL) {
- NFA_TRACE_ERROR0("Bad ee_handle");
+ LOG(ERROR) << StringPrintf("Bad ee_handle");
status = NFA_STATUS_INVALID_PARAM;
} else {
p_msg =
@@ -346,15 +351,15 @@
uint8_t nfcee_id = (uint8_t)(ee_handle & 0xFF);
tNFA_EE_ECB* p_cb;
- NFA_TRACE_API4(
- "NFA_EeSetDefaultProtoRouting(): "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ ""
"handle:<0x%x>protocol_mask:<0x%x>/<0x%x>/<0x%x>",
ee_handle, protocols_switch_on, protocols_switch_off,
protocols_battery_off);
p_cb = nfa_ee_find_ecb(nfcee_id);
if (p_cb == NULL) {
- NFA_TRACE_ERROR0("Bad ee_handle");
+ LOG(ERROR) << StringPrintf("Bad ee_handle");
status = NFA_STATUS_INVALID_PARAM;
} else {
p_msg = (tNFA_EE_API_SET_PROTO_CFG*)GKI_getbuf(
@@ -405,18 +410,19 @@
uint8_t nfcee_id = (uint8_t)(ee_handle & 0xFF);
tNFA_EE_ECB* p_cb;
- NFA_TRACE_API1("NFA_EeAddAidRouting(): handle:<0x%x>", ee_handle);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("handle:<0x%x>", ee_handle);
p_cb = nfa_ee_find_ecb(nfcee_id);
/* validate parameters - make sure the AID is in valid length range */
if ((p_cb == NULL) || (aid_len == 0) || (p_aid == NULL) ||
(aid_len < NFA_MIN_AID_LEN) || (aid_len > NFA_MAX_AID_LEN)) {
- NFA_TRACE_ERROR1("Bad ee_handle or AID (len=%d)", aid_len);
+ LOG(ERROR) << StringPrintf("Bad ee_handle or AID (len=%d)", aid_len);
status = NFA_STATUS_INVALID_PARAM;
} else {
p_msg = (tNFA_EE_API_ADD_AID*)GKI_getbuf(size);
if (p_msg != NULL) {
- NFA_TRACE_DEBUG2("aid:<%02x%02x>", p_aid[0], p_aid[1]);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("aid:<%02x%02x>", p_aid[0], p_aid[1]);
p_msg->hdr.event = NFA_EE_API_ADD_AID_EVT;
p_msg->nfcee_id = nfcee_id;
p_msg->p_cb = p_cb;
@@ -461,9 +467,9 @@
tNFA_STATUS status = NFA_STATUS_FAILED;
uint16_t size = sizeof(tNFA_EE_API_REMOVE_AID) + aid_len;
- NFA_TRACE_API0("NFA_EeRemoveAidRouting()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if ((aid_len == 0) || (p_aid == NULL) || (aid_len > NFA_MAX_AID_LEN)) {
- NFA_TRACE_ERROR0("Bad AID");
+ LOG(ERROR) << StringPrintf("Bad AID");
status = NFA_STATUS_INVALID_PARAM;
} else {
p_msg = (tNFA_EE_API_REMOVE_AID*)GKI_getbuf(size);
@@ -498,7 +504,7 @@
tNFA_EE_API_LMRT_SIZE* p_msg;
tNFA_STATUS status = NFA_STATUS_FAILED;
- NFA_TRACE_API0("NFA_EeGetLmrtRemainingSize()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_msg = (tNFA_EE_API_LMRT_SIZE*)GKI_getbuf(sizeof(tNFA_EE_API_LMRT_SIZE));
if (p_msg != NULL) {
p_msg->event = NFA_EE_API_LMRT_SIZE_EVT;
@@ -529,9 +535,9 @@
NFC_HDR* p_msg;
tNFA_STATUS status = NFA_STATUS_FAILED;
- NFA_TRACE_API0("NFA_EeUpdateNow()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (nfa_ee_cb.ee_wait_evt & NFA_EE_WAIT_UPDATE_ALL) {
- NFA_TRACE_ERROR0("update in progress");
+ LOG(ERROR) << StringPrintf("update in progress");
status = NFA_STATUS_SEMANTIC_ERROR;
} else {
p_msg = (NFC_HDR*)GKI_getbuf(NFC_HDR_SIZE);
@@ -568,12 +574,12 @@
uint8_t nfcee_id = (uint8_t)(ee_handle & 0xFF);
tNFA_EE_ECB* p_cb;
- NFA_TRACE_API2("NFA_EeConnect(): handle:<0x%x> ee_interface:0x%x", ee_handle,
- ee_interface);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "handle:<0x%x> ee_interface:0x%x", ee_handle, ee_interface);
p_cb = nfa_ee_find_ecb(nfcee_id);
if ((p_cb == NULL) || (p_cback == NULL)) {
- NFA_TRACE_ERROR0("Bad ee_handle or NULL callback function");
+ LOG(ERROR) << StringPrintf("Bad ee_handle or NULL callback function");
status = NFA_STATUS_INVALID_PARAM;
} else {
p_msg = (tNFA_EE_API_CONNECT*)GKI_getbuf(sizeof(tNFA_EE_API_CONNECT));
@@ -614,13 +620,13 @@
uint8_t nfcee_id = (uint8_t)(ee_handle & 0xFF);
tNFA_EE_ECB* p_cb;
- NFA_TRACE_API1("NFA_EeSendData(): handle:<0x%x>", ee_handle);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("handle:<0x%x>", ee_handle);
p_cb = nfa_ee_find_ecb(nfcee_id);
if ((p_cb == NULL) || (p_cb->conn_st != NFA_EE_CONN_ST_CONN) ||
(p_data == NULL)) {
- NFA_TRACE_ERROR0("Bad ee_handle or NULL data");
+ LOG(ERROR) << StringPrintf("Bad ee_handle or NULL data");
status = NFA_STATUS_INVALID_PARAM;
} else {
p_msg = (tNFA_EE_API_SEND_DATA*)GKI_getbuf(
@@ -661,11 +667,11 @@
uint8_t nfcee_id = (uint8_t)(ee_handle & 0xFF);
tNFA_EE_ECB* p_cb;
- NFA_TRACE_API1("NFA_EeDisconnect(): handle:<0x%x>", ee_handle);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("handle:<0x%x>", ee_handle);
p_cb = nfa_ee_find_ecb(nfcee_id);
if ((p_cb == NULL) || (p_cb->conn_st != NFA_EE_CONN_ST_CONN)) {
- NFA_TRACE_ERROR0("NFA_EeDisconnect() Bad ee_handle");
+ LOG(ERROR) << StringPrintf("Bad ee_handle");
status = NFA_STATUS_INVALID_PARAM;
} else {
p_msg = (tNFA_EE_API_DISCONNECT*)GKI_getbuf(sizeof(tNFA_EE_API_DISCONNECT));
diff --git a/src/nfa/ee/nfa_ee_main.cc b/src/nfa/ee/nfa_ee_main.cc
index ae85e10..bcf9692 100644
--- a/src/nfa/ee/nfa_ee_main.cc
+++ b/src/nfa/ee/nfa_ee_main.cc
@@ -87,7 +87,7 @@
void nfa_ee_init(void) {
int xx;
- NFA_TRACE_DEBUG0("nfa_ee_init ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* initialize control block */
memset(&nfa_ee_cb, 0, sizeof(tNFA_EE_CB));
@@ -115,15 +115,15 @@
void nfa_ee_sys_enable(void) {
unsigned long retlen = 0;
- NFA_TRACE_DEBUG1("%s", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s", __func__);
nfa_ee_cb.route_block_control = 0x00;
if (GetNumValue(NAME_NFA_AID_BLOCK_ROUTE, (void*)&retlen, sizeof(retlen))) {
if ((retlen == 0x01) && (NFC_GetNCIVersion() == NCI_VERSION_2_0)) {
nfa_ee_cb.route_block_control = NCI_ROUTE_QUAL_BLOCK_ROUTE;
- NFA_TRACE_DEBUG1("nfa_ee_cb.route_block_control=0x%x",
- nfa_ee_cb.route_block_control);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfa_ee_cb.route_block_control=0x%x", nfa_ee_cb.route_block_control);
}
}
@@ -153,8 +153,8 @@
tNFC_NFCEE_MODE_SET_REVT rsp;
tNFA_EE_NCI_MODE_SET ee_msg;
- NFA_TRACE_DEBUG4(
- "nfa_ee_restore_one_ecb () nfcee_id:0x%x, ecb_flags:0x%x ee_status:0x%x "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfcee_id:0x%x, ecb_flags:0x%x ee_status:0x%x "
"ee_old_status: 0x%x",
p_cb->nfcee_id, p_cb->ecb_flags, p_cb->ee_status, p_cb->ee_old_status);
if ((p_cb->nfcee_id != NFA_EE_INVALID) &&
@@ -214,8 +214,8 @@
tNFA_EE_ECB* p_cb;
bool proc_complete = true;
- NFA_TRACE_DEBUG1("nfa_ee_proc_nfcc_power_mode (): nfcc_power_mode=%d",
- nfcc_power_mode);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfcc_power_mode=%d", nfcc_power_mode);
/* if NFCC power state is change to full power */
if (nfcc_power_mode == NFA_DM_PWR_MODE_FULL) {
if (nfa_ee_max_ee_cfg) {
@@ -275,7 +275,7 @@
tNFA_EE_ECB* p_cb;
tNFA_EE_MSG data;
- NFA_TRACE_DEBUG0("nfa_ee_proc_hci_info_cback ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* if NFCC power state is change to full power */
nfa_ee_cb.ee_flags &= ~NFA_EE_FLAG_WAIT_HCI;
@@ -344,8 +344,8 @@
break;
}
- NFA_TRACE_DEBUG2("nfa_ee_proc_evt: event=0x%02x int_event:0x%x", event,
- int_event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfa_ee_proc_evt: event=0x%02x int_event:0x%x", event, int_event);
if (int_event) {
cbk.hdr.event = int_event;
cbk.p_data = p_data;
@@ -388,7 +388,7 @@
tNFA_EE_ECB* nfa_ee_find_ecb(uint8_t nfcee_id) {
uint32_t xx;
tNFA_EE_ECB *p_ret = NULL, *p_cb;
- NFA_TRACE_DEBUG0("nfa_ee_find_ecb ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (nfcee_id == NFC_DH_ID) {
p_ret = &nfa_ee_cb.ecb[NFA_EE_CB_4_DH];
@@ -417,7 +417,7 @@
tNFA_EE_ECB* nfa_ee_find_ecb_by_conn_id(uint8_t conn_id) {
uint32_t xx;
tNFA_EE_ECB *p_ret = NULL, *p_cb;
- NFA_TRACE_DEBUG0("nfa_ee_find_ecb_by_conn_id ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_cb = nfa_ee_cb.ecb;
for (xx = 0; xx < nfa_ee_cb.cur_ee; xx++, p_cb++) {
@@ -445,7 +445,7 @@
tNFA_EE_ECB* p_cb;
tNFA_EE_MSG msg;
- NFA_TRACE_DEBUG0("nfa_ee_sys_disable ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
nfa_ee_cb.em_state = NFA_EE_EM_STATE_DISABLED;
/* report NFA_EE_DEREGISTER_EVT to all registered to EE */
@@ -519,7 +519,6 @@
nfa_ee_cb.p_enable_cback = p_cback;
}
-#if (BT_TRACE_VERBOSE == TRUE)
/*******************************************************************************
**
** Function nfa_ee_sm_st_2_str
@@ -605,7 +604,6 @@
return "Unknown";
}
}
-#endif /* BT_TRACE_VERBOSE */
/*******************************************************************************
**
@@ -620,15 +618,10 @@
bool nfa_ee_evt_hdlr(NFC_HDR* p_msg) {
bool act = false;
-#if (BT_TRACE_VERBOSE == TRUE)
- NFA_TRACE_DEBUG4("nfa_ee_evt_hdlr (): Event %s(0x%02x), State: %s(%d)",
- nfa_ee_sm_evt_2_str(p_msg->event).c_str(), p_msg->event,
- nfa_ee_sm_st_2_str(nfa_ee_cb.em_state).c_str(),
- nfa_ee_cb.em_state);
-#else
- NFA_TRACE_DEBUG2("nfa_ee_evt_hdlr (): Event 0x%02x, State: %d", p_msg->event,
- nfa_ee_cb.em_state);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Event %s(0x%02x), State: %s(%d)",
+ nfa_ee_sm_evt_2_str(p_msg->event).c_str(), p_msg->event,
+ nfa_ee_sm_st_2_str(nfa_ee_cb.em_state).c_str(), nfa_ee_cb.em_state);
switch (nfa_ee_cb.em_state) {
case NFA_EE_EM_STATE_INIT_DONE:
diff --git a/src/nfa/hci/nfa_hci_act.cc b/src/nfa/hci/nfa_hci_act.cc
index b65256f..8290044 100644
--- a/src/nfa/hci/nfa_hci_act.cc
+++ b/src/nfa/hci/nfa_hci_act.cc
@@ -208,8 +208,7 @@
break;
default:
- NFA_TRACE_ERROR1("nfa_hci_check_api_requests () Unknown event: 0x%04x",
- p_msg->event);
+ LOG(ERROR) << StringPrintf("Unknown event: 0x%04x", p_msg->event);
break;
}
@@ -239,8 +238,8 @@
if ((nfa_hci_cb.cfg.reg_app_names[xx][0] != 0) &&
!strncmp(p_app_name, &nfa_hci_cb.cfg.reg_app_names[xx][0],
strlen(p_app_name))) {
- NFA_TRACE_EVENT2("nfa_hci_api_register (%s) Reusing: %u", p_app_name,
- xx);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfa_hci_api_register (%s) Reusing: %u", p_app_name, xx);
break;
}
}
@@ -265,14 +264,15 @@
strncpy(&nfa_hci_cb.cfg.reg_app_names[xx][0], p_app_name,
NFA_MAX_HCI_APP_NAME_LEN);
nfa_hci_cb.nv_write_needed = true;
- NFA_TRACE_EVENT2("nfa_hci_api_register (%s) Allocated: %u", p_app_name,
- xx);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfa_hci_api_register (%s) Allocated: %u", p_app_name, xx);
break;
}
}
if (xx == NFA_HCI_MAX_APP_CB) {
- NFA_TRACE_ERROR1("nfa_hci_api_register (%s) NO ENTRIES", p_app_name);
+ LOG(ERROR) << StringPrintf("nfa_hci_api_register (%s) NO ENTRIES",
+ p_app_name);
evt_data.hci_register.status = NFA_STATUS_FAILED;
p_evt_data->app_info.p_cback(NFA_HCI_REGISTER_EVT, &evt_data);
@@ -317,15 +317,16 @@
!strncmp(p_evt_data->app_info.app_name,
&nfa_hci_cb.cfg.reg_app_names[xx][0],
strlen(p_evt_data->app_info.app_name))) {
- NFA_TRACE_EVENT2("nfa_hci_api_deregister (%s) inx: %u",
- p_evt_data->app_info.app_name, xx);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_hci_api_deregister (%s) inx: %u",
+ p_evt_data->app_info.app_name, xx);
break;
}
}
if (xx == NFA_HCI_MAX_APP_CB) {
- NFA_TRACE_WARNING1("nfa_hci_api_deregister () Unknown app: %s",
- p_evt_data->app_info.app_name);
+ LOG(WARNING) << StringPrintf("Unknown app: %s",
+ p_evt_data->app_info.app_name);
return;
}
nfa_hci_cb.app_in_use = (tNFA_HANDLE)(xx | NFA_HANDLE_GROUP_HCI);
@@ -477,9 +478,8 @@
} else if (p_gate->gate_owner != app_handle) {
/* Some other app owns the gate */
p_gate = NULL;
- NFA_TRACE_ERROR1(
- "nfa_hci_api_alloc_gate (): The Gate (0X%02x) already taken!",
- p_evt_data->gate_info.gate);
+ LOG(ERROR) << StringPrintf("The Gate (0X%02x) already taken!",
+ p_evt_data->gate_info.gate);
}
}
@@ -601,7 +601,7 @@
if ((p_gate == NULL) ||
(p_gate->gate_owner != p_evt_data->create_pipe.hci_handle)) {
report_failed = true;
- NFA_TRACE_ERROR2(
+ LOG(ERROR) << StringPrintf(
"nfa_hci_api_create_pipe Cannot create pipe! APP: 0x%02x does not own "
"the gate:0x%x",
p_evt_data->create_pipe.hci_handle,
@@ -611,7 +611,7 @@
p_evt_data->create_pipe.dest_host,
p_evt_data->create_pipe.dest_gate)) {
report_failed = true;
- NFA_TRACE_ERROR0(
+ LOG(ERROR) << StringPrintf(
"nfa_hci_api_create_pipe : Cannot create multiple pipe between the "
"same two gates!");
}
@@ -708,8 +708,9 @@
}
if (p_pipe->pipe_state == NFA_HCI_PIPE_CLOSED) {
- NFA_TRACE_WARNING1("nfa_hci_api_get_reg_value pipe:%d not open",
- p_evt_data->get_registry.pipe);
+ LOG(WARNING) << StringPrintf(
+ "nfa_hci_api_get_reg_value pipe:%d not open",
+ p_evt_data->get_registry.pipe);
} else {
status = nfa_hciu_send_get_param_cmd(p_evt_data->get_registry.pipe,
p_evt_data->get_registry.reg_inx);
@@ -756,8 +757,9 @@
}
if (p_pipe->pipe_state == NFA_HCI_PIPE_CLOSED) {
- NFA_TRACE_WARNING1("nfa_hci_api_set_reg_value pipe:%d not open",
- p_evt_data->set_registry.pipe);
+ LOG(WARNING) << StringPrintf(
+ "nfa_hci_api_set_reg_value pipe:%d not open",
+ p_evt_data->set_registry.pipe);
} else {
status = nfa_hciu_send_set_param_cmd(
p_evt_data->set_registry.pipe, p_evt_data->set_registry.reg_inx,
@@ -878,18 +880,18 @@
p_evt_data->send_cmd.data);
if (status == NFA_STATUS_OK) return true;
} else {
- NFA_TRACE_WARNING1("nfa_hci_api_send_cmd pipe:%d not open",
- p_pipe->pipe_id);
+ LOG(WARNING) << StringPrintf("nfa_hci_api_send_cmd pipe:%d not open",
+ p_pipe->pipe_id);
}
} else {
- NFA_TRACE_WARNING1(
+ LOG(WARNING) << StringPrintf(
"nfa_hci_api_send_cmd pipe:%d Owned by different application or "
"Destination host is not active",
p_pipe->pipe_id);
}
} else {
- NFA_TRACE_WARNING1("nfa_hci_api_send_cmd pipe:%d not found",
- p_evt_data->send_cmd.pipe);
+ LOG(WARNING) << StringPrintf("nfa_hci_api_send_cmd pipe:%d not found",
+ p_evt_data->send_cmd.pipe);
}
evt_data.cmd_sent.status = status;
@@ -928,18 +930,18 @@
p_evt_data->send_rsp.data);
if (status == NFA_STATUS_OK) return;
} else {
- NFA_TRACE_WARNING1("nfa_hci_api_send_rsp pipe:%d not open",
- p_pipe->pipe_id);
+ LOG(WARNING) << StringPrintf("nfa_hci_api_send_rsp pipe:%d not open",
+ p_pipe->pipe_id);
}
} else {
- NFA_TRACE_WARNING1(
+ LOG(WARNING) << StringPrintf(
"nfa_hci_api_send_rsp pipe:%d Owned by different application or "
"Destination host is not active",
p_pipe->pipe_id);
}
} else {
- NFA_TRACE_WARNING1("nfa_hci_api_send_rsp pipe:%d not found",
- p_evt_data->send_rsp.pipe);
+ LOG(WARNING) << StringPrintf("nfa_hci_api_send_rsp pipe:%d not found",
+ p_evt_data->send_rsp.pipe);
}
evt_data.rsp_sent.status = status;
@@ -1011,18 +1013,18 @@
}
}
} else {
- NFA_TRACE_WARNING1("nfa_hci_api_send_event pipe:%d not open",
- p_pipe->pipe_id);
+ LOG(WARNING) << StringPrintf("nfa_hci_api_send_event pipe:%d not open",
+ p_pipe->pipe_id);
}
} else {
- NFA_TRACE_WARNING1(
+ LOG(WARNING) << StringPrintf(
"nfa_hci_api_send_event pipe:%d Owned by different application or "
"Destination host is not active",
p_pipe->pipe_id);
}
} else {
- NFA_TRACE_WARNING1("nfa_hci_api_send_event pipe:%d not found",
- p_evt_data->send_evt.pipe);
+ LOG(WARNING) << StringPrintf("nfa_hci_api_send_event pipe:%d not found",
+ p_evt_data->send_evt.pipe);
}
evt_data.evt_sent.status = status;
@@ -1318,19 +1320,11 @@
uint8_t host_id = 0;
uint32_t os_tick;
-#if (BT_TRACE_VERBOSE == TRUE)
- NFA_TRACE_DEBUG4(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfa_hci_handle_admin_gate_rsp - LastCmdSent: %s App: 0x%04x Gate: "
"0x%02x Pipe: 0x%02x",
nfa_hciu_instr_2_str(nfa_hci_cb.cmd_sent).c_str(), nfa_hci_cb.app_in_use,
nfa_hci_cb.local_gate_in_use, nfa_hci_cb.pipe_in_use);
-#else
- NFA_TRACE_DEBUG4(
- "nfa_hci_handle_admin_gate_rsp LastCmdSent: %u App: 0x%04x Gate: "
- "0x%02x Pipe: 0x%02x",
- nfa_hci_cb.cmd_sent, nfa_hci_cb.app_in_use, nfa_hci_cb.local_gate_in_use,
- nfa_hci_cb.pipe_in_use);
-#endif
/* If starting up, handle events here */
if ((nfa_hci_cb.hci_state == NFA_HCI_STATE_STARTUP) ||
@@ -1343,7 +1337,8 @@
}
if (nfa_hci_cb.inst != NFA_HCI_ANY_OK) {
- NFA_TRACE_ERROR0("nfa_hci_handle_admin_gate_rsp - Initialization failed");
+ LOG(ERROR) << StringPrintf(
+ "nfa_hci_handle_admin_gate_rsp - Initialization failed");
nfa_hci_startup_complete(NFA_STATUS_FAILED);
return;
}
@@ -1519,7 +1514,7 @@
/* Sanity check */
if (source_gate != nfa_hci_cb.local_gate_in_use) {
- NFA_TRACE_WARNING2(
+ LOG(WARNING) << StringPrintf(
"nfa_hci_handle_admin_gate_rsp sent create pipe with gate: %u "
"got back: %u",
nfa_hci_cb.local_gate_in_use, source_gate);
@@ -1610,12 +1605,12 @@
tNFA_HCI_API_GET_HOST_LIST* p_msg;
if (nfa_hci_cb.inst != NFA_HCI_EVT_HOT_PLUG) {
- NFA_TRACE_ERROR0(
+ LOG(ERROR) << StringPrintf(
"nfa_hci_handle_admin_gate_evt - Unknown event on ADMIN Pipe");
return;
}
- NFA_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfa_hci_handle_admin_gate_evt - HOT PLUG EVT event on ADMIN Pipe");
nfa_hci_cb.num_hot_plug_evts++;
@@ -1680,7 +1675,8 @@
if (p_pipe == NULL) {
/* Invalid pipe ID */
- NFA_TRACE_ERROR1("nfa_hci_handle_dyn_pipe_pkt - Unknown pipe %d", pipe_id);
+ LOG(ERROR) << StringPrintf("nfa_hci_handle_dyn_pipe_pkt - Unknown pipe %d",
+ pipe_id);
if (nfa_hci_cb.type == NFA_HCI_COMMAND_TYPE)
nfa_hciu_send_msg(pipe_id, NFA_HCI_RESPONSE_TYPE, NFA_HCI_ANY_E_NOK, 0,
NULL);
@@ -1696,7 +1692,7 @@
} else {
p_gate = nfa_hciu_find_gate_by_gid(p_pipe->local_gate);
if (p_gate == NULL) {
- NFA_TRACE_ERROR1(
+ LOG(ERROR) << StringPrintf(
"nfa_hci_handle_dyn_pipe_pkt - Pipe's gate %d is corrupt",
p_pipe->local_gate);
if (nfa_hci_cb.type == NFA_HCI_COMMAND_TYPE)
diff --git a/src/nfa/hci/nfa_hci_api.cc b/src/nfa/hci/nfa_hci_api.cc
index 987176a..ab7b3c9 100644
--- a/src/nfa/hci/nfa_hci_api.cc
+++ b/src/nfa/hci/nfa_hci_api.cc
@@ -52,18 +52,20 @@
uint8_t app_name_len;
if (p_app_name == NULL) {
- NFA_TRACE_API0("NFA_HciRegister (): Invalid Application name");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid Application name");
return (NFA_STATUS_FAILED);
}
if (p_cback == NULL) {
- NFA_TRACE_API0(
- "NFA_HciRegister (): Application should provide callback function to "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Application should provide callback function to "
"register!");
return (NFA_STATUS_FAILED);
}
- NFA_TRACE_API1("NFA_HciRegister (): Application Name: %s", p_app_name);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Application Name: %s", p_app_name);
app_name_len = (uint8_t)strlen(p_app_name);
@@ -107,12 +109,13 @@
tNFA_HCI_API_GET_APP_GATE_PIPE* p_msg;
if ((NFA_HANDLE_GROUP_MASK & hci_handle) != NFA_HANDLE_GROUP_HCI) {
- NFA_TRACE_API1("NFA_HciGetGateAndPipeList (): Invalid hci_handle:0x%04x",
- hci_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid hci_handle:0x%04x", hci_handle);
return (NFA_STATUS_FAILED);
}
- NFA_TRACE_API1("NFA_HciGetGateAndPipeList (): hci_handle:0x%04x", hci_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("hci_handle:0x%04x", hci_handle);
/* Register the application with HCI */
if ((nfa_hci_cb.hci_state != NFA_HCI_STATE_DISABLED) &&
@@ -150,11 +153,12 @@
uint8_t app_name_len;
if (p_app_name == NULL) {
- NFA_TRACE_API0("NFA_HciDeregister (): Invalid Application");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("Invalid Application");
return (NFA_STATUS_FAILED);
}
- NFA_TRACE_API1("NFA_HciDeregister (): Application Name: %s", p_app_name);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Application Name: %s", p_app_name);
app_name_len = (uint8_t)strlen(p_app_name);
if (app_name_len > NFA_MAX_HCI_APP_NAME_LEN) return (NFA_STATUS_FAILED);
@@ -168,8 +172,7 @@
}
if (xx == NFA_HCI_MAX_APP_CB) {
- NFA_TRACE_ERROR1("NFA_HciDeregister (): Application Name: %s NOT FOUND",
- p_app_name);
+ LOG(ERROR) << StringPrintf("Application Name: %s NOT FOUND", p_app_name);
return (NFA_STATUS_FAILED);
}
@@ -210,20 +213,21 @@
tNFA_HCI_API_ALLOC_GATE* p_msg;
if ((NFA_HANDLE_GROUP_MASK & hci_handle) != NFA_HANDLE_GROUP_HCI) {
- NFA_TRACE_API1("NFA_HciAllocGate (): Invalid hci_handle:0x%04x",
- hci_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid hci_handle:0x%04x", hci_handle);
return (NFA_STATUS_FAILED);
}
if ((gate) && ((gate < NFA_HCI_FIRST_HOST_SPECIFIC_GENERIC_GATE) ||
(gate > NFA_HCI_LAST_PROP_GATE) ||
(gate == NFA_HCI_CONNECTIVITY_GATE))) {
- NFA_TRACE_API1("NFA_HciAllocGate (): Cannot allocate gate:0x%02x", gate);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Cannot allocate gate:0x%02x", gate);
return (NFA_STATUS_FAILED);
}
- NFA_TRACE_API2("NFA_HciAllocGate (): hci_handle:0x%04x, Gate:0x%02x",
- hci_handle, gate);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("hci_handle:0x%04x, Gate:0x%02x", hci_handle, gate);
/* Request HCI to allocate gate to the application */
if ((nfa_hci_cb.hci_state != NFA_HCI_STATE_DISABLED) &&
@@ -256,20 +260,20 @@
tNFA_HCI_API_DEALLOC_GATE* p_msg;
if ((NFA_HANDLE_GROUP_MASK & hci_handle) != NFA_HANDLE_GROUP_HCI) {
- NFA_TRACE_API1("NFA_HciDeallocGate (): Invalid hci_handle:0x%04x",
- hci_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid hci_handle:0x%04x", hci_handle);
return (NFA_STATUS_FAILED);
}
if ((gate < NFA_HCI_FIRST_HOST_SPECIFIC_GENERIC_GATE) ||
(gate > NFA_HCI_LAST_PROP_GATE) || (gate == NFA_HCI_CONNECTIVITY_GATE)) {
- NFA_TRACE_API1("NFA_HciDeallocGate (): Cannot deallocate the gate:0x%02x",
- gate);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Cannot deallocate the gate:0x%02x", gate);
return (NFA_STATUS_FAILED);
}
- NFA_TRACE_API2("NFA_HciDeallocGate (): hci_handle:0x%04x, gate:0x%02X",
- hci_handle, gate);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("hci_handle:0x%04x, gate:0x%02X", hci_handle, gate);
/* Request HCI to deallocate the gate that was previously allocated to the
* application */
@@ -303,12 +307,13 @@
tNFA_HCI_API_GET_HOST_LIST* p_msg;
if ((NFA_HANDLE_GROUP_MASK & hci_handle) != NFA_HANDLE_GROUP_HCI) {
- NFA_TRACE_API1("NFA_HciGetHostList (): Invalid hci_handle:0x%04x",
- hci_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid hci_handle:0x%04x", hci_handle);
return (NFA_STATUS_FAILED);
}
- NFA_TRACE_API1("NFA_HciGetHostList (): hci_handle:0x%04x", hci_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("hci_handle:0x%04x", hci_handle);
/* Request HCI to get list of host in the hci network */
if ((nfa_hci_cb.hci_state != NFA_HCI_STATE_DISABLED) &&
@@ -349,21 +354,21 @@
tNFA_HCI_API_CREATE_PIPE_EVT* p_msg;
uint8_t xx;
- NFA_TRACE_API4(
- "NFA_HciCreatePipe (): hci_handle:0x%04x, source gate:0x%02X, "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "hci_handle:0x%04x, source gate:0x%02X, "
"destination host:0x%02X , destination gate:0x%02X",
hci_handle, source_gate_id, dest_host, dest_gate);
if ((NFA_HANDLE_GROUP_MASK & hci_handle) != NFA_HANDLE_GROUP_HCI) {
- NFA_TRACE_API1("NFA_HciCreatePipe (): Invalid hci_handle:0x%04x",
- hci_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid hci_handle:0x%04x", hci_handle);
return (NFA_STATUS_FAILED);
}
if ((source_gate_id < NFA_HCI_FIRST_HOST_SPECIFIC_GENERIC_GATE) ||
(source_gate_id > NFA_HCI_LAST_PROP_GATE)) {
- NFA_TRACE_API1("NFA_HciCreatePipe (): Invalid local Gate:0x%02x",
- source_gate_id);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid local Gate:0x%02x", source_gate_id);
return (NFA_STATUS_FAILED);
}
@@ -371,8 +376,8 @@
(dest_gate != NFA_HCI_LOOP_BACK_GATE) &&
(dest_gate != NFA_HCI_IDENTITY_MANAGEMENT_GATE)) ||
(dest_gate > NFA_HCI_LAST_PROP_GATE)) {
- NFA_TRACE_API1("NFA_HciCreatePipe (): Invalid Destination Gate:0x%02x",
- dest_gate);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid Destination Gate:0x%02x", dest_gate);
return (NFA_STATUS_FAILED);
}
@@ -380,7 +385,8 @@
if (nfa_hci_cb.inactive_host[xx] == dest_host) break;
if (xx != NFA_HCI_MAX_HOST_IN_NETWORK) {
- NFA_TRACE_API1("NFA_HciCreatePipe (): Host not active:0x%02x", dest_host);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Host not active:0x%02x", dest_host);
return (NFA_STATUS_FAILED);
}
@@ -418,18 +424,20 @@
tNFA_HCI_API_OPEN_PIPE_EVT* p_msg;
if ((NFA_HANDLE_GROUP_MASK & hci_handle) != NFA_HANDLE_GROUP_HCI) {
- NFA_TRACE_API1("NFA_HciOpenPipe (): Invalid hci_handle:0x%04x", hci_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid hci_handle:0x%04x", hci_handle);
return (NFA_STATUS_FAILED);
}
if ((pipe < NFA_HCI_FIRST_DYNAMIC_PIPE) ||
(pipe > NFA_HCI_LAST_DYNAMIC_PIPE)) {
- NFA_TRACE_API1("NFA_HciOpenPipe (): Invalid Pipe:0x%02x", pipe);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid Pipe:0x%02x", pipe);
return (NFA_STATUS_FAILED);
}
- NFA_TRACE_API2("NFA_HciOpenPipe (): hci_handle:0x%04x, pipe:0x%02X",
- hci_handle, pipe);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("hci_handle:0x%04x, pipe:0x%02X", hci_handle, pipe);
/* Request HCI to open a pipe if it is in closed state */
if ((nfa_hci_cb.hci_state != NFA_HCI_STATE_DISABLED) &&
@@ -467,18 +475,19 @@
tNFA_HCI_API_GET_REGISTRY* p_msg;
if ((NFA_HANDLE_GROUP_MASK & hci_handle) != NFA_HANDLE_GROUP_HCI) {
- NFA_TRACE_API1("NFA_HciGetRegistry (): Invalid hci_handle:0x%04x",
- hci_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid hci_handle:0x%04x", hci_handle);
return (NFA_STATUS_FAILED);
}
if (pipe < NFA_HCI_FIRST_DYNAMIC_PIPE) {
- NFA_TRACE_API1("NFA_HciGetRegistry (): Invalid Pipe:0x%02x", pipe);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid Pipe:0x%02x", pipe);
return (NFA_STATUS_FAILED);
}
- NFA_TRACE_API2("NFA_HciGetRegistry (): hci_handle:0x%04x Pipe: 0x%02x",
- hci_handle, pipe);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("hci_handle:0x%04x Pipe: 0x%02x", hci_handle, pipe);
/* Request HCI to get list of gates supported by the specified host */
if ((nfa_hci_cb.hci_state != NFA_HCI_STATE_DISABLED) &&
@@ -518,25 +527,26 @@
tNFA_HCI_API_SET_REGISTRY* p_msg;
if ((NFA_HANDLE_GROUP_MASK & hci_handle) != NFA_HANDLE_GROUP_HCI) {
- NFA_TRACE_API1("NFA_HciSetRegistry (): Invalid hci_handle:0x%04x",
- hci_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid hci_handle:0x%04x", hci_handle);
return (NFA_STATUS_FAILED);
}
if (pipe < NFA_HCI_FIRST_DYNAMIC_PIPE) {
- NFA_TRACE_API1("NFA_HciSetRegistry (): Invalid Pipe:0x%02x", pipe);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid Pipe:0x%02x", pipe);
return (NFA_STATUS_FAILED);
}
if ((data_size == 0) || (p_data == NULL) ||
(data_size > NFA_MAX_HCI_CMD_LEN)) {
- NFA_TRACE_API1("NFA_HciSetRegistry (): Invalid data size:0x%02x",
- data_size);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid data size:0x%02x", data_size);
return (NFA_STATUS_FAILED);
}
- NFA_TRACE_API2("NFA_HciSetRegistry (): hci_handle:0x%04x Pipe: 0x%02x",
- hci_handle, pipe);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("hci_handle:0x%04x Pipe: 0x%02x", hci_handle, pipe);
/* Request HCI to get list of gates supported by the specified host */
if ((nfa_hci_cb.hci_state != NFA_HCI_STATE_DISABLED) &&
@@ -577,24 +587,26 @@
tNFA_HCI_API_SEND_CMD_EVT* p_msg;
if ((NFA_HANDLE_GROUP_MASK & hci_handle) != NFA_HANDLE_GROUP_HCI) {
- NFA_TRACE_API1("NFA_HciSendCommand (): Invalid hci_handle:0x%04x",
- hci_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid hci_handle:0x%04x", hci_handle);
return (NFA_STATUS_FAILED);
}
if (pipe < NFA_HCI_FIRST_DYNAMIC_PIPE) {
- NFA_TRACE_API1("NFA_HciSendCommand (): Invalid Pipe:0x%02x", pipe);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid Pipe:0x%02x", pipe);
return (NFA_STATUS_FAILED);
}
if ((cmd_size && (p_data == NULL)) || (cmd_size > NFA_MAX_HCI_CMD_LEN)) {
- NFA_TRACE_API1("NFA_HciSendCommand (): Invalid cmd size:0x%02x", cmd_size);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid cmd size:0x%02x", cmd_size);
return (NFA_STATUS_FAILED);
}
- NFA_TRACE_API3(
- "NFA_HciSendCommand (): hci_handle:0x%04x, pipe:0x%02x Code: 0x%02x",
- hci_handle, pipe, cmd_code);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("hci_handle:0x%04x, pipe:0x%02x Code: 0x%02x",
+ hci_handle, pipe, cmd_code);
/* Request HCI to post event data on a particular pipe */
if ((nfa_hci_cb.hci_state != NFA_HCI_STATE_DISABLED) &&
@@ -634,24 +646,25 @@
tNFA_HCI_API_SEND_RSP_EVT* p_msg;
if ((NFA_HANDLE_GROUP_MASK & hci_handle) != NFA_HANDLE_GROUP_HCI) {
- NFA_TRACE_API1("NFA_HciSendResponse (): Invalid hci_handle:0x%04x",
- hci_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid hci_handle:0x%04x", hci_handle);
return (NFA_STATUS_FAILED);
}
if (pipe < NFA_HCI_FIRST_DYNAMIC_PIPE) {
- NFA_TRACE_API1("NFA_HciSendResponse (): Invalid Pipe:0x%02x", pipe);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid Pipe:0x%02x", pipe);
return (NFA_STATUS_FAILED);
}
if ((data_size && (p_data == NULL)) || (data_size > NFA_MAX_HCI_RSP_LEN)) {
- NFA_TRACE_API1("NFA_HciSendResponse (): Invalid data size:0x%02x",
- data_size);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid data size:0x%02x", data_size);
return (NFA_STATUS_FAILED);
}
- NFA_TRACE_API3(
- "NFA_HciSendResponse (): hci_handle:0x%04x Pipe: 0x%02x Response: "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "hci_handle:0x%04x Pipe: 0x%02x Response: "
"0x%02x",
hci_handle, pipe, response);
@@ -710,29 +723,31 @@
uint8_t* p_rsp_buf, uint16_t rsp_timeout) {
tNFA_HCI_API_SEND_EVENT_EVT* p_msg;
- NFA_TRACE_API3(
- "NFA_HciSendEvent(): hci_handle:0x%04x, pipe:0x%02x Code: 0x%02x",
- hci_handle, pipe, evt_code);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("hci_handle:0x%04x, pipe:0x%02x Code: 0x%02x",
+ hci_handle, pipe, evt_code);
if ((NFA_HANDLE_GROUP_MASK & hci_handle) != NFA_HANDLE_GROUP_HCI) {
- NFA_TRACE_API1("NFA_HciSendEvent (): Invalid hci_handle:0x%04x",
- hci_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid hci_handle:0x%04x", hci_handle);
return (NFA_STATUS_FAILED);
}
if (pipe < NFA_HCI_FIRST_DYNAMIC_PIPE) {
- NFA_TRACE_API1("NFA_HciSendEvent (): Invalid Pipe:0x%02x", pipe);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid Pipe:0x%02x", pipe);
return (NFA_STATUS_FAILED);
}
if (evt_size && (p_data == NULL)) {
- NFA_TRACE_API1("NFA_HciSendEvent (): Invalid Event size:0x%02x", evt_size);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid Event size:0x%02x", evt_size);
return (NFA_STATUS_FAILED);
}
if (rsp_size && (p_rsp_buf == NULL)) {
- NFA_TRACE_API1(
- "NFA_HciSendEvent (): No Event buffer, but invalid event buffer size "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "No Event buffer, but invalid event buffer size "
":%u",
rsp_size);
return (NFA_STATUS_FAILED);
@@ -775,18 +790,19 @@
tNFA_STATUS NFA_HciClosePipe(tNFA_HANDLE hci_handle, uint8_t pipe) {
tNFA_HCI_API_CLOSE_PIPE_EVT* p_msg;
- NFA_TRACE_API2("NFA_HciClosePipe (): hci_handle:0x%04x, pipe:0x%02X",
- hci_handle, pipe);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("hci_handle:0x%04x, pipe:0x%02X", hci_handle, pipe);
if ((NFA_HANDLE_GROUP_MASK & hci_handle) != NFA_HANDLE_GROUP_HCI) {
- NFA_TRACE_API1("NFA_HciClosePipe (): Invalid hci_handle:0x%04x",
- hci_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid hci_handle:0x%04x", hci_handle);
return (NFA_STATUS_FAILED);
}
if ((pipe < NFA_HCI_FIRST_DYNAMIC_PIPE) ||
(pipe > NFA_HCI_LAST_DYNAMIC_PIPE)) {
- NFA_TRACE_API1("NFA_HciClosePipe (): Invalid Pipe:0x%02x", pipe);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid Pipe:0x%02x", pipe);
return (NFA_STATUS_FAILED);
}
@@ -825,19 +841,20 @@
tNFA_HCI_API_DELETE_PIPE_EVT* p_msg;
if ((NFA_HANDLE_GROUP_MASK & hci_handle) != NFA_HANDLE_GROUP_HCI) {
- NFA_TRACE_API1("NFA_HciDeletePipe (): Invalid hci_handle:0x%04x",
- hci_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid hci_handle:0x%04x", hci_handle);
return (NFA_STATUS_FAILED);
}
if ((pipe < NFA_HCI_FIRST_DYNAMIC_PIPE) ||
(pipe > NFA_HCI_LAST_DYNAMIC_PIPE)) {
- NFA_TRACE_API1("NFA_HciDeletePipe (): Invalid Pipe:0x%02x", pipe);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid Pipe:0x%02x", pipe);
return (NFA_STATUS_FAILED);
}
- NFA_TRACE_API2("NFA_HciDeletePipe (): hci_handle:0x%04x, pipe:0x%02X",
- hci_handle, pipe);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("hci_handle:0x%04x, pipe:0x%02X", hci_handle, pipe);
/* Request HCI to delete a pipe created by the application identified by hci
* handle */
@@ -874,8 +891,8 @@
uint8_t xx;
if ((NFA_HANDLE_GROUP_MASK & hci_handle) != NFA_HANDLE_GROUP_HCI) {
- NFA_TRACE_API1("NFA_HciAddStaticPipe (): Invalid hci_handle:0x%04x",
- hci_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid hci_handle:0x%04x", hci_handle);
return (NFA_STATUS_FAILED);
}
@@ -883,22 +900,25 @@
if (nfa_hci_cb.inactive_host[xx] == host) break;
if (xx != NFA_HCI_MAX_HOST_IN_NETWORK) {
- NFA_TRACE_API1("NFA_HciAddStaticPipe (): Host not active:0x%02x", host);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Host not active:0x%02x", host);
return (NFA_STATUS_FAILED);
}
if (gate <= NFA_HCI_LAST_HOST_SPECIFIC_GATE) {
- NFA_TRACE_API1("NFA_HciAddStaticPipe (): Invalid Gate:0x%02x", gate);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid Gate:0x%02x", gate);
return (NFA_STATUS_FAILED);
}
if (pipe <= NFA_HCI_LAST_DYNAMIC_PIPE) {
- NFA_TRACE_API1("NFA_HciAddStaticPipe (): Invalid Pipe:0x%02x", pipe);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid Pipe:0x%02x", pipe);
return (NFA_STATUS_FAILED);
}
- NFA_TRACE_API2("NFA_HciAddStaticPipe (): hci_handle:0x%04x, pipe:0x%02X",
- hci_handle, pipe);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("hci_handle:0x%04x, pipe:0x%02X", hci_handle, pipe);
/* Request HCI to delete a pipe created by the application identified by hci
* handle */
@@ -934,29 +954,34 @@
switch (action) {
case NFA_HCI_DEBUG_DISPLAY_CB:
- NFA_TRACE_API0("NFA_HciDebug Host List:");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NFA_HciDebug Host List:");
for (xx = 0; xx < NFA_HCI_MAX_APP_CB; xx++) {
if (nfa_hci_cb.cfg.reg_app_names[xx][0] != 0) {
- NFA_TRACE_API2(" Host Inx: %u Name: %s", xx,
- &nfa_hci_cb.cfg.reg_app_names[xx][0]);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf(" Host Inx: %u Name: %s", xx,
+ &nfa_hci_cb.cfg.reg_app_names[xx][0]);
}
}
- NFA_TRACE_API0("NFA_HciDebug Gate List:");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NFA_HciDebug Gate List:");
for (xx = 0; xx < NFA_HCI_MAX_GATE_CB; xx++, pg++) {
if (pg->gate_id != 0) {
- NFA_TRACE_API4(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
" Gate Inx: %x ID: 0x%02x Owner: 0x%04x "
"PipeInxMask: 0x%08x",
xx, pg->gate_id, pg->gate_owner, pg->pipe_inx_mask);
}
}
- NFA_TRACE_API0("NFA_HciDebug Pipe List:");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NFA_HciDebug Pipe List:");
for (xx = 0; xx < NFA_HCI_MAX_PIPE_CB; xx++, pp++) {
if (pp->pipe_id != 0) {
- NFA_TRACE_API6(
- " Pipe Inx: %x ID: 0x%02x State: %u LocalGate: "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ " Pipe Inx: %x ID: 0x%02x State: %u "
+ "LocalGate: "
"0x%02x Dest Gate: 0x%02x Host: 0x%02x",
xx, pp->pipe_id, pp->pipe_state, pp->local_gate, pp->dest_gate,
pp->dest_host);
@@ -980,12 +1005,14 @@
break;
case NFA_HCI_DEBUG_ENABLE_LOOPBACK:
- NFA_TRACE_API0("NFA_HciDebug HCI_LOOPBACK_DEBUG = TRUE");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NFA_HciDebug HCI_LOOPBACK_DEBUG = TRUE");
HCI_LOOPBACK_DEBUG = NFA_HCI_DEBUG_ON;
break;
case NFA_HCI_DEBUG_DISABLE_LOOPBACK:
- NFA_TRACE_API0("NFA_HciDebug HCI_LOOPBACK_DEBUG = FALSE");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NFA_HciDebug HCI_LOOPBACK_DEBUG = FALSE");
HCI_LOOPBACK_DEBUG = NFA_HCI_DEBUG_OFF;
break;
}
diff --git a/src/nfa/hci/nfa_hci_main.cc b/src/nfa/hci/nfa_hci_main.cc
index 03b52fc..7f23aea 100644
--- a/src/nfa/hci/nfa_hci_main.cc
+++ b/src/nfa/hci/nfa_hci_main.cc
@@ -82,7 +82,7 @@
**
*******************************************************************************/
void nfa_hci_ee_info_cback(tNFA_EE_DISC_STS status) {
- NFA_TRACE_DEBUG1("nfa_hci_ee_info_cback (): %d", status);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%d", status);
switch (status) {
case NFA_EE_DISC_STS_ON:
@@ -178,7 +178,7 @@
**
*******************************************************************************/
void nfa_hci_init(void) {
- NFA_TRACE_DEBUG0("nfa_hci_init ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* initialize control block */
memset(&nfa_hci_cb, 0, sizeof(tNFA_HCI_CB));
@@ -227,8 +227,9 @@
&nfa_hci_cb.cfg.reg_app_names[yy][0],
strlen(nfa_hci_cb.cfg.reg_app_names[xx])))) {
/* Two app cannot have the same name , NVRAM is corrupted */
- NFA_TRACE_EVENT2("nfa_hci_is_valid_cfg (%s) Reusing: %u",
- &nfa_hci_cb.cfg.reg_app_names[xx][0], xx);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_hci_is_valid_cfg (%s) Reusing: %u",
+ &nfa_hci_cb.cfg.reg_app_names[xx][0], xx);
return false;
}
}
@@ -254,15 +255,17 @@
if ((nfa_hci_cb.cfg.dyn_gates[yy].gate_id != 0) &&
(nfa_hci_cb.cfg.dyn_gates[xx].gate_id ==
nfa_hci_cb.cfg.dyn_gates[yy].gate_id)) {
- NFA_TRACE_EVENT1("nfa_hci_is_valid_cfg Reusing: %u",
- nfa_hci_cb.cfg.dyn_gates[xx].gate_id);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_hci_is_valid_cfg Reusing: %u",
+ nfa_hci_cb.cfg.dyn_gates[xx].gate_id);
return false;
}
}
if ((nfa_hci_cb.cfg.dyn_gates[xx].gate_owner & (~NFA_HANDLE_GROUP_HCI)) >=
NFA_HCI_MAX_APP_CB) {
- NFA_TRACE_EVENT1("nfa_hci_is_valid_cfg Invalid Gate owner: %u",
- nfa_hci_cb.cfg.dyn_gates[xx].gate_owner);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_hci_is_valid_cfg Invalid Gate owner: %u",
+ nfa_hci_cb.cfg.dyn_gates[xx].gate_owner);
return false;
}
if (!((nfa_hci_cb.cfg.dyn_gates[xx].gate_id ==
@@ -276,8 +279,9 @@
if (nfa_hci_cb.cfg.dyn_gates[xx].gate_owner == reg_app[zz]) break;
}
if (zz == app_count) {
- NFA_TRACE_EVENT1("nfa_hci_is_valid_cfg Invalid Gate owner: %u",
- nfa_hci_cb.cfg.dyn_gates[xx].gate_owner);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_hci_is_valid_cfg Invalid Gate owner: %u",
+ nfa_hci_cb.cfg.dyn_gates[xx].gate_owner);
return false;
}
}
@@ -342,8 +346,9 @@
if ((nfa_hci_cb.cfg.dyn_pipes[yy].pipe_id != 0) &&
(nfa_hci_cb.cfg.dyn_pipes[xx].pipe_id ==
nfa_hci_cb.cfg.dyn_pipes[yy].pipe_id)) {
- NFA_TRACE_EVENT1("nfa_hci_is_valid_cfg Reusing: %u",
- nfa_hci_cb.cfg.dyn_pipes[xx].pipe_id);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_hci_is_valid_cfg Reusing: %u",
+ nfa_hci_cb.cfg.dyn_pipes[xx].pipe_id);
return false;
}
}
@@ -352,8 +357,9 @@
if (nfa_hci_cb.cfg.dyn_pipes[xx].local_gate == valid_gate[zz]) break;
}
if (zz == gate_count) {
- NFA_TRACE_EVENT1("nfa_hci_is_valid_cfg Invalid Gate: %u",
- nfa_hci_cb.cfg.dyn_pipes[xx].local_gate);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_hci_is_valid_cfg Invalid Gate: %u",
+ nfa_hci_cb.cfg.dyn_pipes[xx].local_gate);
return false;
}
}
@@ -414,8 +420,8 @@
**
*******************************************************************************/
void nfa_hci_proc_nfcc_power_mode(uint8_t nfcc_power_mode) {
- NFA_TRACE_DEBUG1("nfa_hci_proc_nfcc_power_mode () nfcc_power_mode=%d",
- nfcc_power_mode);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfcc_power_mode=%d", nfcc_power_mode);
/* if NFCC power mode is change to full power */
if (nfcc_power_mode == NFA_DM_PWR_MODE_FULL) {
@@ -432,7 +438,7 @@
nfa_hci_cb.num_ee_dis_req_ntf = 0;
nfa_hci_cb.num_hot_plug_evts = 0;
} else {
- NFA_TRACE_ERROR0("nfa_hci_proc_nfcc_power_mode (): Cannot restore now");
+ LOG(ERROR) << StringPrintf("Cannot restore now");
nfa_sys_cback_notify_nfcc_power_mode_proc_complete(NFA_ID_HCI);
}
} else {
@@ -494,7 +500,7 @@
void nfa_hci_startup_complete(tNFA_STATUS status) {
tNFA_HCI_EVT_DATA evt_data;
- NFA_TRACE_EVENT1("nfa_hci_startup_complete (): Status: %u", status);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("Status: %u", status);
nfa_sys_stop_timer(&nfa_hci_cb.timer);
@@ -529,7 +535,7 @@
uint8_t xx;
uint8_t nfceeid = 0;
- NFA_TRACE_DEBUG1("nfa_hci_enable_one_nfcee () %d", nfa_hci_cb.num_nfcee);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%d", nfa_hci_cb.num_nfcee);
for (xx = 0; xx < nfa_hci_cb.num_nfcee; xx++) {
nfceeid = nfa_hci_cb.ee_info[xx].ee_handle & ~NFA_HANDLE_GROUP_EE;
@@ -590,7 +596,7 @@
NFA_HCI_CON_CREATE_TIMEOUT_VAL);
else {
nfa_hci_cb.hci_state = NFA_HCI_STATE_DISABLED;
- NFA_TRACE_ERROR0(
+ LOG(ERROR) << StringPrintf(
"nfa_hci_startup - Failed to Create Logical connection. HCI "
"Initialization/Restore failed");
nfa_hci_startup_complete(NFA_STATUS_FAILED);
@@ -599,7 +605,7 @@
count++;
}
if (!found) {
- NFA_TRACE_ERROR0(
+ LOG(ERROR) << StringPrintf(
"nfa_hci_startup - HCI ACCESS Interface not discovered. HCI "
"Initialization/Restore failed");
nfa_hci_startup_complete(NFA_STATUS_FAILED);
@@ -618,7 +624,7 @@
**
*******************************************************************************/
static void nfa_hci_sys_enable(void) {
- NFA_TRACE_DEBUG0("nfa_hci_sys_enable ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
nfa_ee_reg_cback_enable_done(&nfa_hci_ee_info_cback);
nfa_nv_co_read((uint8_t*)&nfa_hci_cb.cfg, sizeof(nfa_hci_cb.cfg),
@@ -674,11 +680,9 @@
uint8_t chaining_bit;
uint8_t pipe;
uint16_t pkt_len;
-#if (BT_TRACE_VERBOSE == TRUE)
char buff[100];
-#endif
- NFA_TRACE_EVENT3("%s State: %u Cmd: %u", __func__, nfa_hci_cb.hci_state,
- event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "%s State: %u Cmd: %u", __func__, nfa_hci_cb.hci_state, event);
if (event == NFC_CONN_CREATE_CEVT) {
nfa_hci_cb.conn_id = conn_id;
nfa_hci_cb.buff_size = p_data->conn_create.buff_size;
@@ -718,9 +722,7 @@
p = (uint8_t*)(p_pkt + 1) + p_pkt->offset;
pkt_len = p_pkt->len;
-#if (BT_TRACE_PROTOCOL == TRUE)
DispHcp(p, pkt_len, true);
-#endif
chaining_bit = ((*p) >> 0x07) & 0x01;
pipe = (*p++) & 0x7F;
@@ -750,8 +752,8 @@
if (nfa_hci_cb.assembly_failed) {
/* If Reassembly failed because of insufficient buffer, just drop the new
* segmented packets */
- NFA_TRACE_ERROR1(
- "nfa_hci_conn_cback (): Insufficient buffer to Reassemble HCP "
+ LOG(ERROR) << StringPrintf(
+ "Insufficient buffer to Reassemble HCP "
"packet! Dropping :%u bytes",
pkt_len);
} else {
@@ -767,19 +769,12 @@
}
}
-#if (BT_TRACE_VERBOSE == TRUE)
- NFA_TRACE_EVENT5(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfa_hci_conn_cback Recvd data pipe:%d %s chain:%d assmbl:%d len:%d",
- (uint8_t)pipe, nfa_hciu_get_type_inst_names(pipe, nfa_hci_cb.type,
- nfa_hci_cb.inst, buff),
+ (uint8_t)pipe,
+ nfa_hciu_get_type_inst_names(pipe, nfa_hci_cb.type, nfa_hci_cb.inst,
+ buff),
(uint8_t)chaining_bit, (uint8_t)nfa_hci_cb.assembling, p_pkt->len);
-#else
- NFA_TRACE_EVENT6(
- "nfa_hci_conn_cback Recvd data pipe:%d Type: %u Inst: %u chain:%d "
- "reassm:%d len:%d",
- pipe, nfa_hci_cb.type, nfa_hci_cb.inst, chaining_bit,
- nfa_hci_cb.assembling, p_pkt->len);
-#endif
/* If still reassembling fragments, just return */
if (nfa_hci_cb.assembling) {
@@ -886,15 +881,16 @@
tNFA_HCI_EVT_DATA evt_data;
uint8_t delete_pipe;
- NFA_TRACE_EVENT2("nfa_hci_rsp_timeout () State: %u Cmd: %u",
- nfa_hci_cb.hci_state, nfa_hci_cb.cmd_sent);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "State: %u Cmd: %u", nfa_hci_cb.hci_state, nfa_hci_cb.cmd_sent);
evt_data.status = NFA_STATUS_FAILED;
switch (nfa_hci_cb.hci_state) {
case NFA_HCI_STATE_STARTUP:
case NFA_HCI_STATE_RESTORE:
- NFA_TRACE_ERROR0("nfa_hci_rsp_timeout - Initialization failed!");
+ LOG(ERROR) << StringPrintf(
+ "nfa_hci_rsp_timeout - Initialization failed!");
nfa_hci_startup_complete(NFA_STATUS_TIMEOUT);
break;
@@ -1038,8 +1034,8 @@
break;
case NFA_HCI_STATE_DISABLED:
default:
- NFA_TRACE_DEBUG0(
- "nfa_hci_rsp_timeout () Timeout in DISABLED/ Invalid state");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Timeout in DISABLED/ Invalid state");
break;
}
if (evt != 0) nfa_hciu_send_to_app(evt, &evt_data, nfa_hci_cb.app_in_use);
@@ -1084,8 +1080,8 @@
nfa_hci_cb.msg_len = nfa_hci_cb.max_msg_len;
/* Set Reassembly failed */
nfa_hci_cb.assembly_failed = true;
- NFA_TRACE_ERROR1(
- "nfa_hci_assemble_msg (): Insufficient buffer to Reassemble HCP "
+ LOG(ERROR) << StringPrintf(
+ "Insufficient buffer to Reassemble HCP "
"packet! Dropping :%u bytes",
((nfa_hci_cb.msg_len + data_len) - nfa_hci_cb.max_msg_len));
} else {
@@ -1104,15 +1100,11 @@
**
*******************************************************************************/
static bool nfa_hci_evt_hdlr(NFC_HDR* p_msg) {
-#if (BT_TRACE_VERBOSE == TRUE)
- NFA_TRACE_EVENT4("nfa_hci_evt_hdlr state: %s (%d) event: %s (0x%04x)",
- nfa_hciu_get_state_name(nfa_hci_cb.hci_state).c_str(),
- nfa_hci_cb.hci_state,
- nfa_hciu_get_event_name(p_msg->event).c_str(), p_msg->event);
-#else
- NFA_TRACE_EVENT2("nfa_hci_evt_hdlr state: %d event: 0x%04x",
- nfa_hci_cb.hci_state, p_msg->event);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfa_hci_evt_hdlr state: %s (%d) event: %s (0x%04x)",
+ nfa_hciu_get_state_name(nfa_hci_cb.hci_state).c_str(),
+ nfa_hci_cb.hci_state, nfa_hciu_get_event_name(p_msg->event).c_str(),
+ p_msg->event);
/* If this is an API request, queue it up */
if ((p_msg->event >= NFA_HCI_FIRST_API_EVENT) &&
diff --git a/src/nfa/hci/nfa_hci_utils.cc b/src/nfa/hci/nfa_hci_utils.cc
index 11315d5..8055e24 100644
--- a/src/nfa/hci/nfa_hci_utils.cc
+++ b/src/nfa/hci/nfa_hci_utils.cc
@@ -250,7 +250,7 @@
if (nfa_hciu_find_gate_by_gid(gate_id) == NULL) break;
}
if (gate_id > NFA_HCI_LAST_PROP_GATE) {
- NFA_TRACE_ERROR2(
+ LOG(ERROR) << StringPrintf(
"nfa_hci_alloc_gate - no free Gate ID: %u App Handle: 0x%04x",
gate_id, app_handle);
return (NULL);
@@ -266,8 +266,8 @@
pg->gate_owner = app_handle;
pg->pipe_inx_mask = 0;
- NFA_TRACE_DEBUG2("nfa_hciu_alloc_gate id:%d app_handle: 0x%04x", gate_id,
- app_handle);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfa_hciu_alloc_gate id:%d app_handle: 0x%04x", gate_id, app_handle);
nfa_hci_cb.nv_write_needed = true;
return (pg);
@@ -275,7 +275,7 @@
}
/* If here, no free gate control block */
- NFA_TRACE_ERROR2(
+ LOG(ERROR) << StringPrintf(
"nfa_hci_alloc_gate - no CB Gate ID: %u App Handle: 0x%04x", gate_id,
app_handle);
return (NULL);
@@ -301,16 +301,11 @@
tNFA_STATUS status = NFA_STATUS_OK;
uint16_t max_seg_hcp_pkt_size = nfa_hci_cb.buff_size - NCI_DATA_HDR_SIZE;
-#if (BT_TRACE_VERBOSE == TRUE)
char buff[100];
- NFA_TRACE_DEBUG3(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfa_hciu_send_msg pipe_id:%d %s len:%d", pipe_id,
nfa_hciu_get_type_inst_names(pipe_id, type, instruction, buff), msg_len);
-#else
- NFA_TRACE_DEBUG4("nfa_hciu_send_msg pipe_id:%d Type: %u Inst: %u len: %d",
- pipe_id, type, instruction, msg_len);
-#endif
if (instruction == NFA_HCI_ANY_GET_PARAMETER)
nfa_hci_cb.param_in_use = *p_msg;
@@ -352,16 +347,14 @@
if (msg_len > 0) p_msg += data_len;
}
-#if (BT_TRACE_PROTOCOL == TRUE)
DispHcp(((uint8_t*)(p_buf + 1) + p_buf->offset), p_buf->len, false);
-#endif
if (HCI_LOOPBACK_DEBUG == NFA_HCI_DEBUG_ON)
handle_debug_loopback(p_buf, pipe_id, type, instruction);
else
status = NFC_SendData(nfa_hci_cb.conn_id, p_buf);
} else {
- NFA_TRACE_ERROR0("nfa_hciu_send_data_packet no buffers");
+ LOG(ERROR) << StringPrintf("nfa_hciu_send_data_packet no buffers");
status = NFA_STATUS_NO_BUFFERS;
break;
}
@@ -403,7 +396,7 @@
}
}
- NFA_TRACE_DEBUG1("nfa_hciu_get_allocated_gate_list () returns: %u", count);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("returns: %u", count);
return (count);
}
@@ -433,7 +426,8 @@
for (xx = 0, pp = nfa_hci_cb.cfg.dyn_pipes; xx < NFA_HCI_MAX_PIPE_CB;
xx++, pp++) {
if (pp->pipe_id == 0) {
- NFA_TRACE_DEBUG2("nfa_hciu_alloc_pipe:%d, index:%d", pipe_id, xx);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_hciu_alloc_pipe:%d, index:%d", pipe_id, xx);
pp->pipe_id = pipe_id;
nfa_hci_cb.nv_write_needed = true;
@@ -441,7 +435,8 @@
}
}
- NFA_TRACE_DEBUG1("nfa_hciu_alloc_pipe:%d, NO free entries !!", pipe_id);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_hciu_alloc_pipe:%d, NO free entries !!", pipe_id);
return (NULL);
}
@@ -458,9 +453,9 @@
tNFA_HCI_DYN_GATE* p_gate = nfa_hciu_find_gate_by_gid(gate_id);
if (p_gate != NULL) {
- NFA_TRACE_DEBUG3(
- "nfa_hciu_release_gate () ID: %d owner: 0x%04x pipe_inx_mask: 0x%04x",
- gate_id, p_gate->gate_owner, p_gate->pipe_inx_mask);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("ID: %d owner: 0x%04x pipe_inx_mask: 0x%04x", gate_id,
+ p_gate->gate_owner, p_gate->pipe_inx_mask);
p_gate->gate_id = 0;
p_gate->gate_owner = 0;
@@ -468,7 +463,7 @@
nfa_hci_cb.nv_write_needed = true;
} else {
- NFA_TRACE_WARNING1("nfa_hciu_release_gate () ID: %d NOT FOUND", gate_id);
+ LOG(WARNING) << StringPrintf("ID: %d NOT FOUND", gate_id);
}
}
@@ -505,7 +500,7 @@
pipe_index = (uint8_t)(p_pipe - nfa_hci_cb.cfg.dyn_pipes);
p_gate->pipe_inx_mask |= (uint32_t)(1 << pipe_index);
- NFA_TRACE_DEBUG4(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfa_hciu_add_pipe_to_gate Gate ID: 0x%02x Pipe ID: 0x%02x "
"pipe_index: %u App Handle: 0x%08x",
local_gate, pipe_id, pipe_index, p_gate->gate_owner);
@@ -513,7 +508,8 @@
}
}
- NFA_TRACE_DEBUG1("nfa_hciu_add_pipe_to_gate: 0x%02x NOT FOUND", local_gate);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfa_hciu_add_pipe_to_gate: 0x%02x NOT FOUND", local_gate);
return (NFA_HCI_ADM_E_NO_PIPES_AVAILABLE);
}
@@ -535,7 +531,7 @@
tNFA_HCI_DYN_PIPE* p_pipe;
uint8_t pipe_index;
- NFA_TRACE_EVENT4(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfa_hciu_add_pipe_to_static_gate (%u) Pipe: 0x%02x Dest Host: 0x%02x "
"Dest Gate: 0x%02x)",
local_gate, pipe_id, dest_host, dest_gate);
@@ -575,8 +571,8 @@
tNFA_HCI_DYN_PIPE* pp;
int xx;
- NFA_TRACE_DEBUG1("nfa_hciu_find_pipe_by_owner () app_handle:0x%x",
- app_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("app_handle:0x%x", app_handle);
/* Loop through all pipes looking for the owner */
for (xx = 0, pp = nfa_hci_cb.cfg.dyn_pipes; xx < NFA_HCI_MAX_PIPE_CB;
@@ -610,8 +606,8 @@
tNFA_HCI_DYN_PIPE* pp;
int xx;
- NFA_TRACE_DEBUG3(
- "nfa_hciu_check_pipe_between_gates () Local gate: 0x%02X, Host[0x%02X] "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Local gate: 0x%02X, Host[0x%02X] "
"gate: 0x%02X",
local_gate, dest_host, dest_gate);
@@ -644,8 +640,8 @@
tNFA_HCI_DYN_PIPE* pp;
int xx;
- NFA_TRACE_DEBUG1("nfa_hciu_find_pipe_by_owner () app_handle:0x%x",
- app_handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("app_handle:0x%x", app_handle);
/* Loop through all pipes looking for the owner */
for (xx = 0, pp = nfa_hci_cb.cfg.dyn_pipes; xx < NFA_HCI_MAX_PIPE_CB;
@@ -675,7 +671,7 @@
tNFA_HCI_DYN_PIPE* pp;
int xx;
- NFA_TRACE_DEBUG1("nfa_hciu_find_pipe_on_gate () Gate:0x%x", gate_id);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("Gate:0x%x", gate_id);
/* Loop through all pipes looking for the owner */
for (xx = 0, pp = nfa_hci_cb.cfg.dyn_pipes; xx < NFA_HCI_MAX_PIPE_CB;
@@ -765,7 +761,7 @@
tNFA_HCI_DYN_PIPE* pp;
int xx;
- NFA_TRACE_DEBUG1("nfa_hciu_find_active_pipe_on_gate () Gate:0x%x", gate_id);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("Gate:0x%x", gate_id);
/* Loop through all pipes looking for the owner */
for (xx = 0, pp = nfa_hci_cb.cfg.dyn_pipes; xx < NFA_HCI_MAX_PIPE_CB;
@@ -798,13 +794,15 @@
tNFA_HCI_DYN_PIPE* p_pipe;
uint8_t pipe_index;
- NFA_TRACE_EVENT1("nfa_hciu_release_pipe: %u", pipe_id);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_hciu_release_pipe: %u", pipe_id);
p_pipe = nfa_hciu_find_pipe_by_pid(pipe_id);
if (p_pipe == NULL) return (NFA_HCI_ANY_E_NOK);
if (pipe_id > NFA_HCI_LAST_DYNAMIC_PIPE) {
- NFA_TRACE_DEBUG1("ignore pipe: %d", pipe_id);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("ignore pipe: %d", pipe_id);
return (NFA_HCI_ANY_E_NOK);
}
@@ -846,7 +844,8 @@
int xx;
tNFA_HCI_EVT_DATA evt_data;
- NFA_TRACE_EVENT1("nfa_hciu_remove_all_pipes_from_host (0x%02x)", host);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_hciu_remove_all_pipes_from_host (0x%02x)", host);
/* Remove all pipes from the specified host connected to all generic gates */
for (xx = 0, pp = nfa_hci_cb.cfg.dyn_pipes; xx < NFA_HCI_MAX_PIPE_CB;
@@ -886,7 +885,7 @@
data[1] = dest_host;
data[2] = dest_gate;
- NFA_TRACE_DEBUG3(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfa_hciu_send_create_pipe_cmd source_gate:%d, dest_host:%d, "
"dest_gate:%d",
source_gate, dest_host, dest_gate);
@@ -909,10 +908,11 @@
tNFA_STATUS nfa_hciu_send_delete_pipe_cmd(uint8_t pipe) {
tNFA_STATUS status;
- NFA_TRACE_DEBUG1("nfa_hciu_send_delete_pipe_cmd: %d", pipe);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_hciu_send_delete_pipe_cmd: %d", pipe);
if (pipe > NFA_HCI_LAST_DYNAMIC_PIPE) {
- NFA_TRACE_DEBUG1("ignore pipe: %d", pipe);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("ignore pipe: %d", pipe);
return (NFA_HCI_ANY_E_NOK);
}
nfa_hci_cb.pipe_in_use = pipe;
@@ -939,7 +939,8 @@
tNFA_STATUS status;
uint16_t id_ref_data = 0x0102;
- NFA_TRACE_DEBUG0("nfa_hciu_send_clear_all_pipe_cmd");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_hciu_send_clear_all_pipe_cmd");
status =
nfa_hciu_send_msg(NFA_HCI_ADMIN_PIPE, NFA_HCI_COMMAND_TYPE,
@@ -1056,7 +1057,7 @@
}
if (app_handle != NFA_HANDLE_INVALID) {
- NFA_TRACE_WARNING2(
+ LOG(WARNING) << StringPrintf(
"nfa_hciu_send_to_app no callback, event: 0x%04x app_handle: 0x%04x",
event, app_handle);
}
@@ -1102,7 +1103,6 @@
}
}
-#if (BT_TRACE_VERBOSE == TRUE)
/*******************************************************************************
**
** Function nfa_hciu_get_response_name
@@ -1364,7 +1364,6 @@
return "UNKNOWN";
}
}
-#endif
static void handle_debug_loopback(NFC_HDR* p_buf, uint8_t pipe, uint8_t type,
uint8_t instruction) {
diff --git a/src/nfa/include/nfa_dm_int.h b/src/nfa/include/nfa_dm_int.h
index dc7e018..a791b62 100644
--- a/src/nfa/include/nfa_dm_int.h
+++ b/src/nfa/include/nfa_dm_int.h
@@ -681,8 +681,6 @@
memset(ha, NFC_DH_ID, NFA_DM_MAX_TECH_ROUTE);
#endif
-#if (BT_TRACE_VERBOSE == TRUE)
std::string nfa_dm_nfc_revt_2_str(tNFC_RESPONSE_EVT event);
-#endif
#endif /* NFA_DM_INT_H */
diff --git a/src/nfa/include/nfa_ee_int.h b/src/nfa/include/nfa_ee_int.h
index 580a222..65ea748 100644
--- a/src/nfa/include/nfa_ee_int.h
+++ b/src/nfa/include/nfa_ee_int.h
@@ -30,7 +30,6 @@
/*****************************************************************************
** Constants and data types
*****************************************************************************/
-#define NFA_EE_DEBUG BT_TRACE_VERBOSE
/* the number of tNFA_EE_ECBs (for NFCEEs and DH) */
#define NFA_EE_NUM_ECBS (NFA_EE_MAX_EE_SUPPORTED + 1)
/* The index for DH in nfa_ee_cb.ee_cb[] */
diff --git a/src/nfa/include/nfa_hci_int.h b/src/nfa/include/nfa_hci_int.h
index 8c6b836..9a26511 100644
--- a/src/nfa/include/nfa_hci_int.h
+++ b/src/nfa/include/nfa_hci_int.h
@@ -525,13 +525,11 @@
uint8_t instruction, uint16_t pkt_len,
uint8_t* p_pkt);
-#if (BT_TRACE_VERBOSE == TRUE)
extern std::string nfa_hciu_instr_2_str(uint8_t type);
extern std::string nfa_hciu_get_event_name(uint16_t event);
extern std::string nfa_hciu_get_state_name(uint8_t state);
extern char* nfa_hciu_get_type_inst_names(uint8_t pipe, uint8_t type,
uint8_t inst, char* p_buff);
extern std::string nfa_hciu_evt_2_str(uint8_t pipe_id, uint8_t evt);
-#endif
#endif /* NFA_HCI_INT_H */
diff --git a/src/nfa/p2p/nfa_p2p_act.cc b/src/nfa/p2p/nfa_p2p_act.cc
index efac872..45feb9e 100644
--- a/src/nfa/p2p/nfa_p2p_act.cc
+++ b/src/nfa/p2p/nfa_p2p_act.cc
@@ -66,7 +66,7 @@
}
}
- P2P_TRACE_ERROR0("nfa_p2p_allocate_conn_cb (): No resource");
+ LOG(ERROR) << StringPrintf("No resource");
return LLCP_MAX_DATA_LINK;
}
@@ -85,7 +85,7 @@
if (xx < LLCP_MAX_DATA_LINK) {
nfa_p2p_cb.conn_cb[xx].flags = 0;
} else {
- P2P_TRACE_ERROR1("nfa_p2p_deallocate_conn_cb (): Invalid index (%d)", xx);
+ LOG(ERROR) << StringPrintf("Invalid index (%d)", xx);
}
}
@@ -124,8 +124,9 @@
**
*******************************************************************************/
static void nfa_p2p_llcp_cback(tLLCP_SAP_CBACK_DATA* p_data) {
- P2P_TRACE_DEBUG2("nfa_p2p_llcp_cback (): event:0x%02X, local_sap:0x%02X",
- p_data->hdr.event, p_data->hdr.local_sap);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("event:0x%02X, local_sap:0x%02X", p_data->hdr.event,
+ p_data->hdr.local_sap);
switch (p_data->hdr.event) {
case LLCP_SAP_EVT_DATA_IND:
@@ -157,8 +158,7 @@
break;
default:
- P2P_TRACE_ERROR1("nfa_p2p_llcp_cback (): Unknown event:0x%02X",
- p_data->hdr.event);
+ LOG(ERROR) << StringPrintf("Unknown event:0x%02X", p_data->hdr.event);
return;
}
}
@@ -178,8 +178,8 @@
uint8_t xx;
tNFA_P2P_EVT_DATA evt_data;
- P2P_TRACE_DEBUG2("nfa_p2p_sdp_cback (): tid:0x%02X, remote_sap:0x%02X", tid,
- remote_sap);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("tid:0x%02X, remote_sap:0x%02X", tid, remote_sap);
/* search for callback function to process */
for (xx = 0; xx < LLCP_MAX_SDP_TRANSAC; xx++) {
@@ -210,7 +210,7 @@
bool nfa_p2p_start_sdp(char* p_service_name, uint8_t local_sap) {
int xx;
- P2P_TRACE_DEBUG1("nfa_p2p_start_sdp (): SN:<%s>", p_service_name);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("SN:<%s>", p_service_name);
/* search for empty slot */
for (xx = 0; xx < LLCP_MAX_SDP_TRANSAC; xx++) {
@@ -243,7 +243,7 @@
uint8_t local_sap, xx;
tNFA_P2P_EVT_DATA evt_data;
- P2P_TRACE_DEBUG0("nfa_p2p_proc_llcp_data_ind ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
local_sap = p_data->data_ind.local_sap;
@@ -285,8 +285,8 @@
tNFA_P2P_EVT_DATA evt_data;
uint8_t xx;
- P2P_TRACE_DEBUG1("nfa_p2p_proc_llcp_connect_ind () server_sap:0x%x",
- p_data->connect_ind.server_sap);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("server_sap:0x%x", p_data->connect_ind.server_sap);
server_sap = p_data->connect_ind.server_sap;
local_sap = p_data->connect_ind.local_sap;
@@ -312,7 +312,7 @@
nfa_p2p_cb.sap_cb[server_sap].p_cback(NFA_P2P_CONN_REQ_EVT, &evt_data);
}
} else {
- P2P_TRACE_ERROR0("nfa_p2p_proc_llcp_connect_ind (): Not registered");
+ LOG(ERROR) << StringPrintf("Not registered");
}
}
@@ -330,7 +330,7 @@
uint8_t local_sap, xx;
tNFA_P2P_EVT_DATA evt_data;
- P2P_TRACE_DEBUG0("nfa_p2p_proc_llcp_connect_resp ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
local_sap = p_data->connect_resp.local_sap;
@@ -371,7 +371,7 @@
uint8_t local_sap, xx;
tNFA_P2P_EVT_DATA evt_data;
- P2P_TRACE_DEBUG0("nfa_p2p_proc_llcp_disconnect_ind ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
local_sap = p_data->disconnect_ind.local_sap;
@@ -399,7 +399,7 @@
nfa_p2p_cb.sap_cb[local_sap].p_cback(NFA_P2P_DISC_EVT, &evt_data);
- P2P_TRACE_ERROR0("nfa_p2p_proc_llcp_disconnect_ind (): Link deactivated");
+ LOG(ERROR) << StringPrintf("Link deactivated");
}
}
}
@@ -418,7 +418,7 @@
uint8_t local_sap, xx;
tNFA_P2P_EVT_DATA evt_data;
- P2P_TRACE_DEBUG0("nfa_p2p_proc_llcp_disconnect_resp ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
local_sap = p_data->disconnect_resp.local_sap;
@@ -458,8 +458,7 @@
nfa_p2p_cb.sap_cb[local_sap].p_cback(NFA_P2P_DISC_EVT, &evt_data);
} else {
- P2P_TRACE_ERROR0(
- "nfa_p2p_proc_llcp_disconnect_resp (): No connection found");
+ LOG(ERROR) << StringPrintf("No connection found");
}
} else {
evt_data.disc.handle = (NFA_HANDLE_GROUP_P2P | local_sap);
@@ -489,12 +488,12 @@
evt_data.congest.is_congested = p_data->congest.is_congested;
if (p_data->congest.is_congested) {
- P2P_TRACE_DEBUG2("nfa_p2p_proc_llcp_congestion () START SAP=(0x%x,0x%x)",
- local_sap, remote_sap);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("START SAP=(0x%x,0x%x)", local_sap, remote_sap);
} else {
- P2P_TRACE_DEBUG2("nfa_p2p_proc_llcp_congestion () END SAP=(0x%x,0x%x)",
- local_sap, remote_sap);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("END SAP=(0x%x,0x%x)", local_sap, remote_sap);
}
if (nfa_p2p_cb.sap_cb[local_sap].p_cback) {
@@ -532,8 +531,7 @@
nfa_p2p_cb.sap_cb[local_sap].p_cback(NFA_P2P_CONGEST_EVT, &evt_data);
}
} else {
- P2P_TRACE_ERROR0(
- "nfa_p2p_proc_llcp_congestion (): No connection found");
+ LOG(ERROR) << StringPrintf("No connection found");
}
}
}
@@ -553,8 +551,8 @@
uint8_t local_sap, xx;
tNFA_P2P_EVT_DATA evt_data;
- P2P_TRACE_DEBUG1("nfa_p2p_proc_llcp_link_status () is_activated:%d",
- p_data->link_status.is_activated);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("is_activated:%d", p_data->link_status.is_activated);
local_sap = p_data->link_status.local_sap;
@@ -615,7 +613,7 @@
tNFA_P2P_EVT_DATA evt_data;
uint8_t server_sap;
- P2P_TRACE_DEBUG0("nfa_p2p_reg_server ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
server_sap = LLCP_RegisterServer(
p_msg->api_reg_server.server_sap, p_msg->api_reg_server.link_type,
@@ -679,7 +677,7 @@
tNFA_P2P_EVT_DATA evt_data;
uint8_t local_sap;
- P2P_TRACE_DEBUG0("nfa_p2p_reg_client ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
local_sap =
LLCP_RegisterClient(p_msg->api_reg_client.link_type, nfa_p2p_llcp_cback);
@@ -723,7 +721,7 @@
bool nfa_p2p_dereg(tNFA_P2P_MSG* p_msg) {
uint8_t local_sap, xx;
- P2P_TRACE_DEBUG0("nfa_p2p_dereg ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
local_sap = (uint8_t)(p_msg->api_dereg.handle & NFA_HANDLE_MASK);
@@ -778,7 +776,7 @@
uint8_t xx;
tLLCP_CONNECTION_PARAMS params;
- P2P_TRACE_DEBUG0("nfa_p2p_accept_connection ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
xx = (uint8_t)(p_msg->api_accept.conn_handle & NFA_HANDLE_MASK);
xx &= ~NFA_P2P_HANDLE_FLAG_CONN;
@@ -806,7 +804,7 @@
bool nfa_p2p_reject_connection(tNFA_P2P_MSG* p_msg) {
uint8_t xx;
- P2P_TRACE_DEBUG0("nfa_p2p_reject_connection ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
xx = (uint8_t)(p_msg->api_reject.conn_handle & NFA_HANDLE_MASK);
xx &= ~NFA_P2P_HANDLE_FLAG_CONN;
@@ -836,7 +834,7 @@
tLLCP_STATUS status;
tNFA_P2P_EVT_DATA evt_data;
- P2P_TRACE_DEBUG0("nfa_p2p_disconnect ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
xx = (uint8_t)(p_msg->api_disconnect.conn_handle & NFA_HANDLE_MASK);
@@ -868,7 +866,7 @@
}
}
} else {
- P2P_TRACE_ERROR0("Handle is not for Data link connection");
+ LOG(ERROR) << StringPrintf("Handle is not for Data link connection");
}
return true;
@@ -890,7 +888,7 @@
tLLCP_CONNECTION_PARAMS conn_params;
tLLCP_STATUS status;
- P2P_TRACE_DEBUG0("nfa_p2p_create_data_link_connection ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
local_sap = (uint8_t)(p_msg->api_connect.client_handle & NFA_HANDLE_MASK);
@@ -935,7 +933,7 @@
tLLCP_STATUS status;
tNFA_P2P_EVT_DATA evt_data;
- P2P_TRACE_DEBUG0("nfa_p2p_send_ui ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
local_sap = (uint8_t)(p_msg->api_send_ui.handle & NFA_HANDLE_MASK);
@@ -981,7 +979,7 @@
tLLCP_STATUS status;
uint8_t xx;
- P2P_TRACE_DEBUG0("nfa_p2p_send_data ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
xx = (uint8_t)(p_msg->api_send_data.conn_handle & NFA_HANDLE_MASK);
xx &= ~NFA_P2P_HANDLE_FLAG_CONN;
@@ -1028,7 +1026,7 @@
bool nfa_p2p_set_local_busy(tNFA_P2P_MSG* p_msg) {
uint8_t xx;
- P2P_TRACE_DEBUG0("nfa_p2p_set_local_busy ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
xx = (uint8_t)(p_msg->api_local_busy.conn_handle & NFA_HANDLE_MASK);
xx &= ~NFA_P2P_HANDLE_FLAG_CONN;
@@ -1054,7 +1052,7 @@
tNFA_P2P_EVT_DATA evt_data;
uint8_t local_sap;
- P2P_TRACE_DEBUG0("nfa_p2p_get_link_info ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
evt_data.link_info.handle = p_msg->api_link_info.handle;
evt_data.link_info.wks = LLCP_GetRemoteWKS();
@@ -1081,7 +1079,7 @@
tNFA_P2P_EVT_DATA evt_data;
uint8_t local_sap;
- P2P_TRACE_DEBUG0("nfa_p2p_get_remote_sap ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
local_sap = (uint8_t)(p_msg->api_remote_sap.handle & NFA_HANDLE_MASK);
@@ -1128,7 +1126,7 @@
**
*******************************************************************************/
bool nfa_p2p_restart_rf_discovery(tNFA_P2P_MSG* p_msg) {
- P2P_TRACE_DEBUG0("nfa_p2p_restart_rf_discovery ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
nfa_dm_rf_deactivate(NFA_DEACTIVATE_TYPE_IDLE);
diff --git a/src/nfa/p2p/nfa_p2p_api.cc b/src/nfa/p2p/nfa_p2p_api.cc
index c676701..fc0ef4c 100644
--- a/src/nfa/p2p/nfa_p2p_api.cc
+++ b/src/nfa/p2p/nfa_p2p_api.cc
@@ -65,22 +65,19 @@
tNFA_P2P_CBACK* p_cback) {
tNFA_P2P_API_REG_SERVER* p_msg;
- P2P_TRACE_API3(
- "NFA_P2pRegisterServer (): server_sap:0x%02x, link_type:0x%x, SN:<%s>",
- server_sap, link_type, p_service_name);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("server_sap:0x%02x, link_type:0x%x, SN:<%s>", server_sap,
+ link_type, p_service_name);
if ((server_sap != NFA_P2P_ANY_SAP) &&
((server_sap <= LLCP_SAP_SDP) ||
(server_sap > LLCP_UPPER_BOUND_SDP_SAP))) {
- P2P_TRACE_ERROR2(
- "NFA_P2pRegisterServer (): server_sap must be between %d and %d",
- LLCP_SAP_SDP + 1, LLCP_UPPER_BOUND_SDP_SAP);
+ LOG(ERROR) << StringPrintf("server_sap must be between %d and %d",
+ LLCP_SAP_SDP + 1, LLCP_UPPER_BOUND_SDP_SAP);
return (NFA_STATUS_FAILED);
} else if (((link_type & NFA_P2P_LLINK_TYPE) == 0x00) &&
((link_type & NFA_P2P_DLINK_TYPE) == 0x00)) {
- P2P_TRACE_ERROR1(
- "NFA_P2pRegisterServer(): link type (0x%x) must be specified",
- link_type);
+ LOG(ERROR) << StringPrintf("link type (0x%x) must be specified", link_type);
return (NFA_STATUS_FAILED);
}
@@ -124,13 +121,11 @@
tNFA_P2P_CBACK* p_cback) {
tNFA_P2P_API_REG_CLIENT* p_msg;
- P2P_TRACE_API1("NFA_P2pRegisterClient (): link_type:0x%x", link_type);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("link_type:0x%x", link_type);
if (((link_type & NFA_P2P_LLINK_TYPE) == 0x00) &&
((link_type & NFA_P2P_DLINK_TYPE) == 0x00)) {
- P2P_TRACE_ERROR1(
- "NFA_P2pRegisterClient (): link type (0x%x) must be specified",
- link_type);
+ LOG(ERROR) << StringPrintf("link type (0x%x) must be specified", link_type);
return (NFA_STATUS_FAILED);
}
@@ -170,13 +165,12 @@
tNFA_P2P_API_DEREG* p_msg;
tNFA_HANDLE xx;
- P2P_TRACE_API1("NFA_P2pDeregister (): handle:0x%02X", handle);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("handle:0x%02X", handle);
xx = handle & NFA_HANDLE_MASK;
if ((xx >= NFA_P2P_NUM_SAP) || (nfa_p2p_cb.sap_cb[xx].p_cback == NULL)) {
- P2P_TRACE_ERROR0(
- "NFA_P2pDeregister (): Handle is invalid or not registered");
+ LOG(ERROR) << StringPrintf("Handle is invalid or not registered");
return (NFA_STATUS_BAD_HANDLE);
}
@@ -211,26 +205,26 @@
tNFA_P2P_API_ACCEPT_CONN* p_msg;
tNFA_HANDLE xx;
- P2P_TRACE_API3("NFA_P2pAcceptConn (): handle:0x%02X, MIU:%d, RW:%d", handle,
- miu, rw);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("handle:0x%02X, MIU:%d, RW:%d", handle, miu, rw);
xx = handle & NFA_HANDLE_MASK;
if (!(xx & NFA_P2P_HANDLE_FLAG_CONN)) {
- P2P_TRACE_ERROR0("NFA_P2pAcceptConn (): Connection Handle is not valid");
+ LOG(ERROR) << StringPrintf("Connection Handle is not valid");
return (NFA_STATUS_BAD_HANDLE);
} else {
xx &= ~NFA_P2P_HANDLE_FLAG_CONN;
}
if ((xx >= LLCP_MAX_DATA_LINK) || (nfa_p2p_cb.conn_cb[xx].flags == 0)) {
- P2P_TRACE_ERROR0("NFA_P2pAcceptConn (): Connection Handle is not valid");
+ LOG(ERROR) << StringPrintf("Connection Handle is not valid");
return (NFA_STATUS_BAD_HANDLE);
}
if ((miu < LLCP_DEFAULT_MIU) || (nfa_p2p_cb.local_link_miu < miu)) {
- P2P_TRACE_ERROR3("NFA_P2pAcceptConn (): MIU(%d) must be between %d and %d",
- miu, LLCP_DEFAULT_MIU, nfa_p2p_cb.local_link_miu);
+ LOG(ERROR) << StringPrintf("MIU(%d) must be between %d and %d", miu,
+ LLCP_DEFAULT_MIU, nfa_p2p_cb.local_link_miu);
} else if ((p_msg = (tNFA_P2P_API_ACCEPT_CONN*)GKI_getbuf(
sizeof(tNFA_P2P_API_ACCEPT_CONN))) != NULL) {
p_msg->hdr.event = NFA_P2P_API_ACCEPT_CONN_EVT;
@@ -264,19 +258,19 @@
tNFA_P2P_API_REJECT_CONN* p_msg;
tNFA_HANDLE xx;
- P2P_TRACE_API1("NFA_P2pRejectConn (): handle:0x%02X", handle);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("handle:0x%02X", handle);
xx = handle & NFA_HANDLE_MASK;
if (!(xx & NFA_P2P_HANDLE_FLAG_CONN)) {
- P2P_TRACE_ERROR0("NFA_P2pRejectConn (): Connection Handle is not valid");
+ LOG(ERROR) << StringPrintf("Connection Handle is not valid");
return (NFA_STATUS_BAD_HANDLE);
} else {
xx &= ~NFA_P2P_HANDLE_FLAG_CONN;
}
if ((xx >= LLCP_MAX_DATA_LINK) || (nfa_p2p_cb.conn_cb[xx].flags == 0)) {
- P2P_TRACE_ERROR0("NFA_P2pRejectConn (): Connection Handle is not valid");
+ LOG(ERROR) << StringPrintf("Connection Handle is not valid");
return (NFA_STATUS_BAD_HANDLE);
}
@@ -316,8 +310,8 @@
tNFA_P2P_API_DISCONNECT* p_msg;
tNFA_HANDLE xx;
- P2P_TRACE_API2("NFA_P2pDisconnect (): handle:0x%02X, flush=%d", handle,
- flush);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("handle:0x%02X, flush=%d", handle, flush);
xx = handle & NFA_HANDLE_MASK;
@@ -325,11 +319,11 @@
xx &= ~NFA_P2P_HANDLE_FLAG_CONN;
if ((xx >= LLCP_MAX_DATA_LINK) || (nfa_p2p_cb.conn_cb[xx].flags == 0)) {
- P2P_TRACE_ERROR0("NFA_P2pDisconnect (): Connection Handle is not valid");
+ LOG(ERROR) << StringPrintf("Connection Handle is not valid");
return (NFA_STATUS_BAD_HANDLE);
}
} else {
- P2P_TRACE_ERROR0("NFA_P2pDisconnect (): Handle is not valid");
+ LOG(ERROR) << StringPrintf("Handle is not valid");
return (NFA_STATUS_BAD_HANDLE);
}
@@ -368,22 +362,22 @@
tNFA_P2P_API_CONNECT* p_msg;
tNFA_HANDLE xx;
- P2P_TRACE_API4(
- "NFA_P2pConnectByName (): client_handle:0x%x, SN:<%s>, MIU:%d, RW:%d",
- client_handle, p_service_name, miu, rw);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("client_handle:0x%x, SN:<%s>, MIU:%d, RW:%d",
+ client_handle, p_service_name, miu, rw);
xx = client_handle & NFA_HANDLE_MASK;
if ((xx >= NFA_P2P_NUM_SAP) || (nfa_p2p_cb.sap_cb[xx].p_cback == NULL)) {
- P2P_TRACE_ERROR0("NFA_P2pConnectByName (): Client Handle is not valid");
+ LOG(ERROR) << StringPrintf("Client Handle is not valid");
return (NFA_STATUS_BAD_HANDLE);
}
if ((miu < LLCP_DEFAULT_MIU) ||
(nfa_p2p_cb.llcp_state != NFA_P2P_LLCP_STATE_ACTIVATED) ||
(nfa_p2p_cb.local_link_miu < miu)) {
- P2P_TRACE_ERROR3(
- "NFA_P2pConnectByName (): MIU(%d) must be between %d and %d or LLCP "
+ LOG(ERROR) << StringPrintf(
+ "MIU(%d) must be between %d and %d or LLCP "
"link is not activated",
miu, LLCP_DEFAULT_MIU, nfa_p2p_cb.local_link_miu);
} else if ((p_msg = (tNFA_P2P_API_CONNECT*)GKI_getbuf(
@@ -425,22 +419,22 @@
tNFA_P2P_API_CONNECT* p_msg;
tNFA_HANDLE xx;
- P2P_TRACE_API4(
- "NFA_P2pConnectBySap (): client_handle:0x%x, DSAP:0x%02X, MIU:%d, RW:%d",
- client_handle, dsap, miu, rw);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("client_handle:0x%x, DSAP:0x%02X, MIU:%d, RW:%d",
+ client_handle, dsap, miu, rw);
xx = client_handle & NFA_HANDLE_MASK;
if ((xx >= NFA_P2P_NUM_SAP) || (nfa_p2p_cb.sap_cb[xx].p_cback == NULL)) {
- P2P_TRACE_ERROR0("NFA_P2pConnectBySap (): Client Handle is not valid");
+ LOG(ERROR) << StringPrintf("Client Handle is not valid");
return (NFA_STATUS_BAD_HANDLE);
}
if ((miu < LLCP_DEFAULT_MIU) ||
(nfa_p2p_cb.llcp_state != NFA_P2P_LLCP_STATE_ACTIVATED) ||
(nfa_p2p_cb.local_link_miu < miu)) {
- P2P_TRACE_ERROR3(
- "NFA_P2pConnectBySap (): MIU(%d) must be between %d and %d, or LLCP "
+ LOG(ERROR) << StringPrintf(
+ "MIU(%d) must be between %d and %d, or LLCP "
"link is not activated",
miu, LLCP_DEFAULT_MIU, nfa_p2p_cb.local_link_miu);
} else if ((p_msg = (tNFA_P2P_API_CONNECT*)GKI_getbuf(
@@ -483,26 +477,25 @@
tNFA_STATUS ret_status = NFA_STATUS_FAILED;
tNFA_HANDLE xx;
- P2P_TRACE_API3("NFA_P2pSendUI (): handle:0x%X, DSAP:0x%02X, length:%d",
- handle, dsap, length);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "handle:0x%X, DSAP:0x%02X, length:%d", handle, dsap, length);
GKI_sched_lock();
xx = handle & NFA_HANDLE_MASK;
if ((xx >= NFA_P2P_NUM_SAP) || (nfa_p2p_cb.sap_cb[xx].p_cback == NULL)) {
- P2P_TRACE_ERROR1("NFA_P2pSendUI (): Handle (0x%X) is not valid", handle);
+ LOG(ERROR) << StringPrintf("Handle (0x%X) is not valid", handle);
ret_status = NFA_STATUS_BAD_HANDLE;
} else if (length > nfa_p2p_cb.remote_link_miu) {
- P2P_TRACE_ERROR3(
- "NFA_P2pSendUI (): handle:0x%X, length(%d) must be less than remote "
+ LOG(ERROR) << StringPrintf(
+ "handle:0x%X, length(%d) must be less than remote "
"link MIU(%d)",
handle, length, nfa_p2p_cb.remote_link_miu);
ret_status = NFA_STATUS_BAD_LENGTH;
} else if (nfa_p2p_cb.sap_cb[xx].flags & NFA_P2P_SAP_FLAG_LLINK_CONGESTED) {
- P2P_TRACE_WARNING1(
- "NFA_P2pSendUI (): handle:0x%X, logical data link is already congested",
- handle);
+ LOG(WARNING) << StringPrintf(
+ "handle:0x%X, logical data link is already congested", handle);
ret_status = NFA_STATUS_CONGESTED;
} else if (LLCP_IsLogicalLinkCongested(
(uint8_t)xx, nfa_p2p_cb.sap_cb[xx].num_pending_ui_pdu,
@@ -510,8 +503,8 @@
nfa_p2p_cb.total_pending_i_pdu)) {
nfa_p2p_cb.sap_cb[xx].flags |= NFA_P2P_SAP_FLAG_LLINK_CONGESTED;
- P2P_TRACE_WARNING1(
- "NFA_P2pSendUI(): handle:0x%X, logical data link is congested", handle);
+ LOG(WARNING) << StringPrintf("handle:0x%X, logical data link is congested",
+ handle);
ret_status = NFA_STATUS_CONGESTED;
} else if ((p_msg = (tNFA_P2P_API_SEND_UI*)GKI_getbuf(
sizeof(tNFA_P2P_API_SEND_UI))) != NULL) {
@@ -572,14 +565,14 @@
tNFA_STATUS ret_status;
tNFA_HANDLE xx;
- P2P_TRACE_API1("NFA_P2pReadUI (): handle:0x%X", handle);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("handle:0x%X", handle);
GKI_sched_lock();
xx = handle & NFA_HANDLE_MASK;
if ((xx >= NFA_P2P_NUM_SAP) || (nfa_p2p_cb.sap_cb[xx].p_cback == NULL)) {
- P2P_TRACE_ERROR1("NFA_P2pReadUI (): Handle (0x%X) is not valid", handle);
+ LOG(ERROR) << StringPrintf("Handle (0x%X) is not valid", handle);
ret_status = NFA_STATUS_BAD_HANDLE;
} else {
*p_more = LLCP_ReadLogicalLinkData((uint8_t)xx, max_data_len, p_remote_sap,
@@ -607,14 +600,14 @@
tNFA_STATUS ret_status;
tNFA_HANDLE xx;
- P2P_TRACE_API1("NFA_P2pReadUI (): handle:0x%X", handle);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("handle:0x%X", handle);
GKI_sched_lock();
xx = handle & NFA_HANDLE_MASK;
if ((xx >= NFA_P2P_NUM_SAP) || (nfa_p2p_cb.sap_cb[xx].p_cback == NULL)) {
- P2P_TRACE_ERROR1("NFA_P2pFlushUI (): Handle (0x%X) is not valid", handle);
+ LOG(ERROR) << StringPrintf("Handle (0x%X) is not valid", handle);
ret_status = NFA_STATUS_BAD_HANDLE;
*p_length = 0;
} else {
@@ -647,7 +640,8 @@
tNFA_STATUS ret_status = NFA_STATUS_FAILED;
tNFA_HANDLE xx;
- P2P_TRACE_API2("NFA_P2pSendData (): handle:0x%X, length:%d", handle, length);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("handle:0x%X, length:%d", handle, length);
GKI_sched_lock();
@@ -656,21 +650,19 @@
if ((!(handle & NFA_P2P_HANDLE_FLAG_CONN)) || (xx >= LLCP_MAX_DATA_LINK) ||
(nfa_p2p_cb.conn_cb[xx].flags == 0)) {
- P2P_TRACE_ERROR1("NFA_P2pSendData (): Handle(0x%X) is not valid", handle);
+ LOG(ERROR) << StringPrintf("Handle(0x%X) is not valid", handle);
ret_status = NFA_STATUS_BAD_HANDLE;
} else if (nfa_p2p_cb.conn_cb[xx].flags & NFA_P2P_CONN_FLAG_REMOTE_RW_ZERO) {
- P2P_TRACE_ERROR1(
- "NFA_P2pSendData (): handle:0x%X, Remote set RW to 0 (flow off)",
- handle);
+ LOG(ERROR) << StringPrintf("handle:0x%X, Remote set RW to 0 (flow off)",
+ handle);
ret_status = NFA_STATUS_FAILED;
} else if (nfa_p2p_cb.conn_cb[xx].remote_miu < length) {
- P2P_TRACE_ERROR2(
- "NFA_P2pSendData (): handle:0x%X, Data more than remote MIU(%d)",
- handle, nfa_p2p_cb.conn_cb[xx].remote_miu);
+ LOG(ERROR) << StringPrintf("handle:0x%X, Data more than remote MIU(%d)",
+ handle, nfa_p2p_cb.conn_cb[xx].remote_miu);
ret_status = NFA_STATUS_BAD_LENGTH;
} else if (nfa_p2p_cb.conn_cb[xx].flags & NFA_P2P_CONN_FLAG_CONGESTED) {
- P2P_TRACE_WARNING1(
- "NFA_P2pSendData (): handle:0x%X, data link connection is already "
+ LOG(WARNING) << StringPrintf(
+ "handle:0x%X, data link connection is already "
"congested",
handle);
ret_status = NFA_STATUS_CONGESTED;
@@ -681,9 +673,8 @@
nfa_p2p_cb.total_pending_i_pdu)) {
nfa_p2p_cb.conn_cb[xx].flags |= NFA_P2P_CONN_FLAG_CONGESTED;
- P2P_TRACE_WARNING1(
- "NFA_P2pSendData (): handle:0x%X, data link connection is congested",
- handle);
+ LOG(WARNING) << StringPrintf(
+ "handle:0x%X, data link connection is congested", handle);
ret_status = NFA_STATUS_CONGESTED;
} else if ((p_msg = (tNFA_P2P_API_SEND_DATA*)GKI_getbuf(
sizeof(tNFA_P2P_API_SEND_DATA))) != NULL) {
@@ -741,7 +732,7 @@
tNFA_STATUS ret_status;
tNFA_HANDLE xx;
- P2P_TRACE_API1("NFA_P2pReadData (): handle:0x%X", handle);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("handle:0x%X", handle);
GKI_sched_lock();
@@ -750,7 +741,7 @@
if ((!(handle & NFA_P2P_HANDLE_FLAG_CONN)) || (xx >= LLCP_MAX_DATA_LINK) ||
(nfa_p2p_cb.conn_cb[xx].flags == 0)) {
- P2P_TRACE_ERROR1("NFA_P2pReadData (): Handle(0x%X) is not valid", handle);
+ LOG(ERROR) << StringPrintf("Handle(0x%X) is not valid", handle);
ret_status = NFA_STATUS_BAD_HANDLE;
} else {
*p_more = LLCP_ReadDataLinkData(nfa_p2p_cb.conn_cb[xx].local_sap,
@@ -779,7 +770,7 @@
tNFA_STATUS ret_status;
tNFA_HANDLE xx;
- P2P_TRACE_API1("NFA_P2pFlushData (): handle:0x%X", handle);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("handle:0x%X", handle);
GKI_sched_lock();
@@ -788,7 +779,7 @@
if ((!(handle & NFA_P2P_HANDLE_FLAG_CONN)) || (xx >= LLCP_MAX_DATA_LINK) ||
(nfa_p2p_cb.conn_cb[xx].flags == 0)) {
- P2P_TRACE_ERROR1("NFA_P2pFlushData (): Handle(0x%X) is not valid", handle);
+ LOG(ERROR) << StringPrintf("Handle(0x%X) is not valid", handle);
ret_status = NFA_STATUS_BAD_HANDLE;
} else {
*p_length = LLCP_FlushDataLinkRxData(nfa_p2p_cb.conn_cb[xx].local_sap,
@@ -817,20 +808,20 @@
tNFA_P2P_API_SET_LOCAL_BUSY* p_msg;
tNFA_HANDLE xx;
- P2P_TRACE_API2("NFA_P2pSetLocalBusy (): conn_handle:0x%02X, is_busy:%d",
- conn_handle, is_busy);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("conn_handle:0x%02X, is_busy:%d", conn_handle, is_busy);
xx = conn_handle & NFA_HANDLE_MASK;
if (!(xx & NFA_P2P_HANDLE_FLAG_CONN)) {
- P2P_TRACE_ERROR0("NFA_P2pSetLocalBusy (): Connection Handle is not valid");
+ LOG(ERROR) << StringPrintf("Connection Handle is not valid");
return (NFA_STATUS_BAD_HANDLE);
} else {
xx &= ~NFA_P2P_HANDLE_FLAG_CONN;
}
if ((xx >= LLCP_MAX_DATA_LINK) || (nfa_p2p_cb.conn_cb[xx].flags == 0)) {
- P2P_TRACE_ERROR0("NFA_P2pSetLocalBusy (): Connection Handle is not valid");
+ LOG(ERROR) << StringPrintf("Connection Handle is not valid");
return (NFA_STATUS_BAD_HANDLE);
}
@@ -866,18 +857,17 @@
tNFA_P2P_API_GET_LINK_INFO* p_msg;
tNFA_HANDLE xx;
- P2P_TRACE_API1("NFA_P2pGetLinkInfo (): handle:0x%x", handle);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("handle:0x%x", handle);
if (nfa_p2p_cb.llcp_state != NFA_P2P_LLCP_STATE_ACTIVATED) {
- P2P_TRACE_ERROR0("NFA_P2pGetLinkInfo (): LLCP link is not activated");
+ LOG(ERROR) << StringPrintf("LLCP link is not activated");
return (NFA_STATUS_FAILED);
}
xx = handle & NFA_HANDLE_MASK;
if ((xx >= NFA_P2P_NUM_SAP) || (nfa_p2p_cb.sap_cb[xx].p_cback == NULL)) {
- P2P_TRACE_ERROR0(
- "NFA_P2pGetLinkInfo (): Handle is invalid or not registered");
+ LOG(ERROR) << StringPrintf("Handle is invalid or not registered");
return (NFA_STATUS_BAD_HANDLE);
}
@@ -912,19 +902,18 @@
tNFA_P2P_API_GET_REMOTE_SAP* p_msg;
tNFA_HANDLE xx;
- P2P_TRACE_API2("NFA_P2pGetRemoteSap(): handle:0x%x, SN:<%s>", handle,
- p_service_name);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("handle:0x%x, SN:<%s>", handle, p_service_name);
if (nfa_p2p_cb.llcp_state != NFA_P2P_LLCP_STATE_ACTIVATED) {
- P2P_TRACE_ERROR0("NFA_P2pGetRemoteSap(): LLCP link is not activated");
+ LOG(ERROR) << StringPrintf("LLCP link is not activated");
return (NFA_STATUS_FAILED);
}
xx = handle & NFA_HANDLE_MASK;
if ((xx >= NFA_P2P_NUM_SAP) || (nfa_p2p_cb.sap_cb[xx].p_cback == NULL)) {
- P2P_TRACE_ERROR0(
- "NFA_P2pGetRemoteSap (): Handle is invalid or not registered");
+ LOG(ERROR) << StringPrintf("Handle is invalid or not registered");
return (NFA_STATUS_BAD_HANDLE);
}
@@ -980,18 +969,19 @@
uint16_t delay_first_pdu_timeout) {
tNFA_P2P_API_SET_LLCP_CFG* p_msg;
- P2P_TRACE_API4(
- "NFA_P2pSetLLCPConfig ():link_miu:%d, opt:0x%02X, wt:%d, link_timeout:%d",
- link_miu, opt, wt, link_timeout);
- P2P_TRACE_API4(
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("link_miu:%d, opt:0x%02X, wt:%d, link_timeout:%d",
+ link_miu, opt, wt, link_timeout);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
" inact_timeout(init:%d, target:%d), "
"symm_delay:%d, data_link_timeout:%d",
inact_timeout_init, inact_timeout_target, symm_delay, data_link_timeout);
- P2P_TRACE_API1(" delay_first_pdu_timeout:%d",
- delay_first_pdu_timeout);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf(" delay_first_pdu_timeout:%d",
+ delay_first_pdu_timeout);
if (nfa_p2p_cb.llcp_state == NFA_P2P_LLCP_STATE_ACTIVATED) {
- P2P_TRACE_ERROR0("NFA_P2pSetLLCPConfig (): LLCP link is activated");
+ LOG(ERROR) << StringPrintf("LLCP link is activated");
return (NFA_STATUS_FAILED);
}
@@ -1047,16 +1037,17 @@
p_inact_timeout_target, p_symm_delay, p_data_link_timeout,
p_delay_first_pdu_timeout);
- P2P_TRACE_API4(
- "NFA_P2pGetLLCPConfig () link_miu:%d, opt:0x%02X, wt:%d, link_timeout:%d",
- *p_link_miu, *p_opt, *p_wt, *p_link_timeout);
- P2P_TRACE_API4(
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("link_miu:%d, opt:0x%02X, wt:%d, link_timeout:%d",
+ *p_link_miu, *p_opt, *p_wt, *p_link_timeout);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
" inact_timeout(init:%d, target:%d), "
"symm_delay:%d, data_link_timeout:%d",
*p_inact_timeout_init, *p_inact_timeout_target, *p_symm_delay,
*p_data_link_timeout);
- P2P_TRACE_API1(" delay_first_pdu_timeout:%d",
- *p_delay_first_pdu_timeout);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf(" delay_first_pdu_timeout:%d",
+ *p_delay_first_pdu_timeout);
}
/*******************************************************************************
diff --git a/src/nfa/p2p/nfa_p2p_main.cc b/src/nfa/p2p/nfa_p2p_main.cc
index 6e5b55d..4f14f07 100644
--- a/src/nfa/p2p/nfa_p2p_main.cc
+++ b/src/nfa/p2p/nfa_p2p_main.cc
@@ -50,10 +50,8 @@
static void nfa_p2p_update_active_listen(void);
/* debug functions type */
-#if (BT_TRACE_VERBOSE == TRUE)
static std::string nfa_p2p_llcp_state_code(tNFA_P2P_LLCP_STATE state_code);
static std::string nfa_p2p_evt_code(uint16_t evt_code);
-#endif
/*****************************************************************************
** Constants
@@ -100,7 +98,7 @@
void nfa_p2p_discovery_cback(tNFA_DM_RF_DISC_EVT event, tNFC_DISCOVER* p_data) {
tNFA_CONN_EVT_DATA evt_data;
- P2P_TRACE_DEBUG1("nfa_p2p_discovery_cback (): event:0x%02X", event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("event:0x%02X", event);
switch (event) {
case NFA_DM_RF_DISC_START_EVT:
@@ -151,7 +149,7 @@
break;
default:
- P2P_TRACE_ERROR0("Unexpected event");
+ LOG(ERROR) << StringPrintf("Unexpected event");
break;
}
}
@@ -166,7 +164,7 @@
**
*******************************************************************************/
static void nfa_p2p_update_active_listen_timeout_cback(TIMER_LIST_ENT* p_tle) {
- NFA_TRACE_ERROR0("nfa_p2p_update_active_listen_timeout_cback()");
+ LOG(ERROR) << __func__;
/* restore active listen mode */
nfa_p2p_update_active_listen();
@@ -186,9 +184,9 @@
tNFA_DM_DISC_TECH_PROTO_MASK p2p_listen_mask = 0;
NFC_HDR* p_msg;
- P2P_TRACE_DEBUG1(
- "nfa_p2p_update_active_listen (): listen_tech_mask_to_restore:0x%x",
- nfa_p2p_cb.listen_tech_mask_to_restore);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("listen_tech_mask_to_restore:0x%x",
+ nfa_p2p_cb.listen_tech_mask_to_restore);
/* if active listen mode was removed temporarily */
if (nfa_p2p_cb.listen_tech_mask_to_restore) {
@@ -244,7 +242,7 @@
((nfa_dm_cb.eDtaMode & 0x0F) == NFA_DTA_DEFAULT_MODE)) {
// Configure listen technologies and protocols and register callback to DTA
- P2P_TRACE_DEBUG1(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"%s: DTA mode:Registering nfa_dm_poll_disc_cback to avoid LLCP in P2P",
__func__);
nfa_p2p_cb.dm_disc_handle =
@@ -279,8 +277,8 @@
tNFA_LLCP_ACTIVATED llcp_activated;
tNFA_LLCP_DEACTIVATED llcp_deactivated;
- P2P_TRACE_DEBUG2("nfa_p2p_llcp_link_cback () event:0x%x, reason:0x%x", event,
- reason);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("event:0x%x, reason:0x%x", event, reason);
if (event == LLCP_LINK_ACTIVATION_COMPLETE_EVT) {
LLCP_GetLinkMIU(&nfa_p2p_cb.local_link_miu, &nfa_p2p_cb.remote_link_miu);
@@ -326,7 +324,8 @@
if ((nfa_p2p_cb.listen_tech_mask_to_restore == 0x00) &&
(nfa_p2p_cb.listen_tech_mask &
(NFA_TECHNOLOGY_MASK_A | NFA_TECHNOLOGY_MASK_F))) {
- P2P_TRACE_DEBUG0("Retry without active listen mode");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Retry without active listen mode");
/* retry without active listen mode */
nfa_p2p_update_active_listen();
@@ -364,7 +363,8 @@
** target needs to trun off RF in case of receiving invalid
** frame from initiator
*/
- P2P_TRACE_DEBUG0("Got LLCP_LINK_TIMEOUT in active mode on target");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Got LLCP_LINK_TIMEOUT in active mode on target");
nfa_dm_rf_deactivate(NFA_DEACTIVATE_TYPE_DISCOVERY);
}
}
@@ -384,7 +384,7 @@
void nfa_p2p_activate_llcp(tNFC_DISCOVER* p_data) {
tLLCP_ACTIVATE_CONFIG config;
- P2P_TRACE_DEBUG0("nfa_p2p_activate_llcp ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if ((p_data->activate.rf_tech_param.mode == NFC_DISCOVERY_TYPE_POLL_A) ||
(p_data->activate.rf_tech_param.mode == NFC_DISCOVERY_TYPE_POLL_F)) {
@@ -452,7 +452,7 @@
**
*******************************************************************************/
void nfa_p2p_deactivate_llcp(void) {
- P2P_TRACE_DEBUG0("nfa_p2p_deactivate_llcp ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
LLCP_DeactivateLink();
}
@@ -470,7 +470,7 @@
void nfa_p2p_init(void) {
uint8_t xx;
- P2P_TRACE_DEBUG0("nfa_p2p_init ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* initialize control block */
memset(&nfa_p2p_cb, 0, sizeof(tNFA_P2P_CB));
@@ -496,7 +496,7 @@
**
*******************************************************************************/
static void nfa_p2p_sys_disable(void) {
- P2P_TRACE_DEBUG0("nfa_p2p_sys_disable()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
nfa_sys_stop_timer(&nfa_p2p_cb.active_listen_restore_timer);
@@ -518,7 +518,7 @@
uint8_t wt, gen_bytes_len = LLCP_MAX_GEN_BYTES;
uint8_t params[LLCP_MAX_GEN_BYTES + 5], *p, length;
- P2P_TRACE_DEBUG0("nfa_p2p_set_config ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
LLCP_GetDiscoveryConfig(&wt, params + 2, &gen_bytes_len);
if (nfa_dm_is_p2p_paused()) {
@@ -581,8 +581,8 @@
void nfa_p2p_enable_listening(tNFA_SYS_ID sys_id, bool update_wks) {
tNFA_DM_DISC_TECH_PROTO_MASK p2p_listen_mask = 0;
- P2P_TRACE_DEBUG2("nfa_p2p_enable_listening () sys_id = %d, update_wks = %d",
- sys_id, update_wks);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("sys_id = %d, update_wks = %d", sys_id, update_wks);
if (sys_id == NFA_ID_P2P)
nfa_p2p_cb.is_p2p_listening = true;
@@ -625,7 +625,7 @@
((nfa_dm_cb.eDtaMode & 0x0F) == NFA_DTA_DEFAULT_MODE)) {
/* Configure listen technologies and protocols and register callback to
* NFA DM discovery */
- P2P_TRACE_DEBUG1(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"%s: DTA mode:Registering nfa_dm_poll_disc_cback to avoid LLCP in "
"P2P",
__func__);
@@ -654,8 +654,8 @@
**
*******************************************************************************/
void nfa_p2p_disable_listening(tNFA_SYS_ID sys_id, bool update_wks) {
- P2P_TRACE_DEBUG2("nfa_p2p_disable_listening () sys_id = %d, update_wks = %d",
- sys_id, update_wks);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("sys_id = %d, update_wks = %d", sys_id, update_wks);
if (sys_id == NFA_ID_P2P)
nfa_p2p_cb.is_p2p_listening = false;
@@ -689,8 +689,8 @@
**
*******************************************************************************/
void nfa_p2p_update_listen_tech(tNFA_TECHNOLOGY_MASK tech_mask) {
- P2P_TRACE_DEBUG1("nfa_p2p_update_listen_tech () tech_mask = 0x%x",
- tech_mask);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("tech_mask = 0x%x", tech_mask);
if (nfa_p2p_cb.listen_tech_mask_to_restore) {
nfa_p2p_cb.listen_tech_mask_to_restore = 0;
@@ -729,14 +729,10 @@
bool delete_msg = true;
uint16_t event;
-#if (BT_TRACE_VERBOSE == TRUE)
- P2P_TRACE_DEBUG2("nfa_p2p_evt_hdlr (): LLCP State [%s], Event [%s]",
- nfa_p2p_llcp_state_code(nfa_p2p_cb.llcp_state).c_str(),
- nfa_p2p_evt_code(p_hdr->event).c_str());
-#else
- P2P_TRACE_DEBUG2("nfa_p2p_evt_hdlr (): State 0x%02x, Event 0x%02x",
- nfa_p2p_cb.llcp_state, p_hdr->event);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("LLCP State [%s], Event [%s]",
+ nfa_p2p_llcp_state_code(nfa_p2p_cb.llcp_state).c_str(),
+ nfa_p2p_evt_code(p_hdr->event).c_str());
event = p_hdr->event & 0x00ff;
@@ -745,13 +741,12 @@
tNFA_P2P_MSG* p_msg = (tNFA_P2P_MSG*)p_hdr;
delete_msg = (*nfa_p2p_action[event])(p_msg);
} else {
- P2P_TRACE_ERROR0("Unhandled event");
+ LOG(ERROR) << StringPrintf("Unhandled event");
}
return delete_msg;
}
-#if (BT_TRACE_VERBOSE == TRUE)
/*******************************************************************************
**
** Function nfa_p2p_llcp_state_code
@@ -817,4 +812,3 @@
return "Unknown event";
}
}
-#endif /* Debug Functions */
diff --git a/src/nfa/rw/nfa_rw_act.cc b/src/nfa/rw/nfa_rw_act.cc
index 52d48f5..2ffaf11 100644
--- a/src/nfa/rw/nfa_rw_act.cc
+++ b/src/nfa/rw/nfa_rw_act.cc
@@ -101,14 +101,10 @@
(p_rw_data->data.p_data == NULL))
return;
-#if (BT_TRACE_VERBOSE == TRUE)
- NFA_TRACE_DEBUG2("nfa_rw_send_data_to_upper: Len [0x%X] Status [%s]",
- &p_rw_data->data.p_data->len,
- NFC_GetStatusName(p_rw_data->data.status).c_str());
-#else
- NFA_TRACE_DEBUG2("nfa_rw_send_data_to_upper: Len [0x%X] Status [0x%X]",
- &p_rw_data->data.p_data->len, p_rw_data->data.status);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_rw_send_data_to_upper: Len [0x%X] Status [%s]",
+ p_rw_data->data.p_data->len,
+ NFC_GetStatusName(p_rw_data->data.status).c_str());
/* Notify conn cback of NFA_DATA_EVT */
conn_evt_data.data.status = p_rw_data->data.status;
@@ -156,7 +152,8 @@
if (nfa_rw_cb.flags & NFA_RW_FL_NOT_EXCL_RF_MODE) {
if (presence_check_start_delay) {
- NFA_TRACE_DEBUG0("Starting presence check timer...");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Starting presence check timer...");
nfa_sys_start_timer(&nfa_rw_cb.tle, NFA_RW_PRESENCE_CHECK_TICK_EVT,
presence_check_start_delay);
} else {
@@ -177,7 +174,8 @@
*******************************************************************************/
void nfa_rw_stop_presence_check_timer(void) {
nfa_sys_stop_timer(&nfa_rw_cb.tle);
- NFA_TRACE_DEBUG0("Stopped presence check timer (if started)");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Stopped presence check timer (if started)");
}
/*******************************************************************************
@@ -192,7 +190,7 @@
static void nfa_rw_handle_ndef_detect(tRW_EVENT event, tRW_DATA* p_rw_data) {
tNFA_CONN_EVT_DATA conn_evt_data;
- NFA_TRACE_DEBUG3(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"NDEF Detection completed: cur_size=%i, max_size=%i, flags=0x%x",
p_rw_data->ndef.cur_size, p_rw_data->ndef.max_size,
p_rw_data->ndef.flags);
@@ -320,8 +318,8 @@
/* Check if TLV detection succeeded */
if (p_rw_data->tlv.status == NFC_STATUS_OK) {
- NFA_TRACE_DEBUG1("TLV Detection succeeded: num_bytes=%i",
- p_rw_data->tlv.num_bytes);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "TLV Detection succeeded: num_bytes=%i", p_rw_data->tlv.num_bytes);
/* Store tlv properties */
conn_evt_data.tlv_detect.status = NFA_STATUS_OK;
@@ -379,12 +377,12 @@
(nfa_rw_cb.activated_tech_mode == NFC_DISCOVERY_TYPE_POLL_A) &&
(nfa_rw_cb.protocol == NFC_PROTOCOL_T2T) &&
(nfa_rw_cb.pa_sel_res == NFC_SEL_RES_NFC_FORUM_T2T)) {
- NFA_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfa_rw_handle_sleep_wakeup_rsp; Attempt to wake up Type 2 tag from "
"HALT State is complete");
if (status == NFC_STATUS_OK) {
/* Type 2 Tag is wakeup from HALT state */
- NFA_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfa_rw_handle_sleep_wakeup_rsp; Handle the NACK rsp received now");
/* Initialize control block */
activate_params.protocol = nfa_rw_cb.protocol;
@@ -395,7 +393,7 @@
if ((RW_SetActivatedTagType(&activate_params, nfa_rw_cback)) !=
NFC_STATUS_OK) {
/* Log error (stay in NFA_RW_ST_ACTIVATED state until deactivation) */
- NFA_TRACE_ERROR0("RW_SetActivatedTagType failed.");
+ LOG(ERROR) << StringPrintf("RW_SetActivatedTagType failed.");
if (nfa_rw_cb.halt_event == RW_T2T_READ_CPLT_EVT) {
if (nfa_rw_cb.rw_data.data.p_data)
GKI_freebuf(nfa_rw_cb.rw_data.data.p_data);
@@ -427,11 +425,12 @@
* mode) then deactivate the link if sleep wakeup failed */
if ((nfa_rw_cb.flags & NFA_RW_FL_NOT_EXCL_RF_MODE) &&
(status != NFC_STATUS_OK)) {
- NFA_TRACE_DEBUG0("Sleep wakeup failed. Deactivating...");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Sleep wakeup failed. Deactivating...");
nfa_dm_rf_deactivate(NFA_DEACTIVATE_TYPE_DISCOVERY);
}
} else {
- NFA_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfa_rw_handle_sleep_wakeup_rsp; Legacy presence check performed");
/* Legacy presence check performed */
nfa_rw_handle_presence_check_rsp(status);
@@ -481,7 +480,7 @@
/* For all other APIs called during auto-presence check, perform the
command now (if tag is still present) */
else if (status == NFC_STATUS_OK) {
- NFA_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"Performing deferred operation after presence check...");
p_pending_msg = (NFC_HDR*)nfa_rw_cb.p_pending_msg;
nfa_rw_cb.p_pending_msg = NULL;
@@ -496,7 +495,8 @@
/* Auto-presence check failed. Deactivate */
if (status != NFC_STATUS_OK) {
- NFA_TRACE_DEBUG0("Auto presence check failed. Deactivating...");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Auto presence check failed. Deactivating...");
nfa_dm_rf_deactivate(NFA_DEACTIVATE_TYPE_DISCOVERY);
}
}
@@ -511,7 +511,8 @@
* presence check failed */
if ((nfa_rw_cb.flags & NFA_RW_FL_NOT_EXCL_RF_MODE) &&
(nfa_conn_evt_data.status != NFC_STATUS_OK)) {
- NFA_TRACE_DEBUG0("Presence check failed. Deactivating...");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Presence check failed. Deactivating...");
nfa_dm_rf_deactivate(NFA_DEACTIVATE_TYPE_DISCOVERY);
}
}
@@ -709,8 +710,8 @@
conn_evt_data.status = p_rw_data->status;
if (p_rw_data->status == NFC_STATUS_REJECTED) {
- NFA_TRACE_DEBUG0(
- "nfa_rw_handle_t2t_evt(); Waking the tag first before handling the "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "; Waking the tag first before handling the "
"response!");
/* Received NACK. Let DM wakeup the tag first (by putting tag to sleep and
* then waking it up) */
@@ -963,8 +964,8 @@
break;
default:
- NFA_TRACE_DEBUG1("nfa_rw_handle_t3t_evt(); Unhandled RW event 0x%X",
- event);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("; Unhandled RW event 0x%X", event);
break;
}
}
@@ -1096,8 +1097,8 @@
break;
default:
- NFA_TRACE_DEBUG1("nfa_rw_handle_t4t_evt(); Unhandled RW event 0x%X",
- event);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("; Unhandled RW event 0x%X", event);
break;
}
}
@@ -1370,8 +1371,8 @@
break;
default:
- NFA_TRACE_DEBUG1("nfa_rw_handle_i93_evt(); Unhandled RW event 0x%X",
- event);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("; Unhandled RW event 0x%X", event);
break;
}
}
@@ -1386,7 +1387,8 @@
**
*******************************************************************************/
static void nfa_rw_cback(tRW_EVENT event, tRW_DATA* p_rw_data) {
- NFA_TRACE_DEBUG1("nfa_rw_cback: event=0x%02x", event);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_rw_cback: event=0x%02x", event);
/* Call appropriate event handler for tag type */
if (event < RW_T1T_MAX_EVT) {
@@ -1405,7 +1407,7 @@
/* Handle ISO 15693 tag events */
nfa_rw_handle_i93_evt(event, p_rw_data);
} else {
- NFA_TRACE_ERROR1("nfa_rw_cback: unhandled event=0x%02x", event);
+ LOG(ERROR) << StringPrintf("nfa_rw_cback: unhandled event=0x%02x", event);
}
}
@@ -1460,7 +1462,8 @@
/* Handle zero length NDEF message */
if (nfa_rw_cb.ndef_cur_size == 0) {
- NFA_TRACE_DEBUG0("NDEF message is zero-length");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NDEF message is zero-length");
/* Send zero-lengh NDEF message to ndef callback */
nfa_dm_ndef_handle_message(NFA_STATUS_OK, NULL, 0);
@@ -1477,8 +1480,9 @@
nfa_rw_free_ndef_rx_buf();
nfa_rw_cb.p_ndef_buf = (uint8_t*)nfa_mem_co_alloc(nfa_rw_cb.ndef_cur_size);
if (nfa_rw_cb.p_ndef_buf == NULL) {
- NFA_TRACE_ERROR1("Unable to allocate a buffer for reading NDEF (size=%i)",
- nfa_rw_cb.ndef_cur_size);
+ LOG(ERROR) << StringPrintf(
+ "Unable to allocate a buffer for reading NDEF (size=%i)",
+ nfa_rw_cb.ndef_cur_size);
/* Command complete - perform cleanup, notify app */
nfa_rw_command_complete();
@@ -1523,7 +1527,7 @@
*******************************************************************************/
static bool nfa_rw_detect_ndef(tNFA_RW_MSG* p_data) {
tNFA_CONN_EVT_DATA conn_evt_data;
- NFA_TRACE_DEBUG0("nfa_rw_detect_ndef");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
conn_evt_data.ndef_detect.status = nfa_rw_start_ndef_detection();
if (conn_evt_data.ndef_detect.status != NFC_STATUS_OK) {
@@ -1554,13 +1558,13 @@
if (nfa_rw_cb.flags & NFA_RW_FL_TAG_IS_READONLY) {
/* error: ndef tag is read-only */
status = NFC_STATUS_FAILED;
- NFA_TRACE_ERROR0("Unable to write NDEF. Tag is read-only")
+ LOG(ERROR) << StringPrintf("Unable to write NDEF. Tag is read-only");
} else if (nfa_rw_cb.ndef_max_size < nfa_rw_cb.ndef_wr_len) {
/* error: ndef tag size is too small */
status = NFC_STATUS_BUFFER_FULL;
- NFA_TRACE_ERROR2(
+ LOG(ERROR) << StringPrintf(
"Unable to write NDEF. Tag maxsize=%i, request write size=%i",
- nfa_rw_cb.ndef_max_size, nfa_rw_cb.ndef_wr_len)
+ nfa_rw_cb.ndef_max_size, nfa_rw_cb.ndef_wr_len);
} else {
if (NFC_PROTOCOL_T1T == protocol) {
/* Type1Tag - NFC-A */
@@ -1602,7 +1606,7 @@
tNFA_STATUS status = NFA_STATUS_OK;
tNFA_CONN_EVT_DATA conn_evt_data;
- NFA_TRACE_DEBUG0("nfa_rw_read_ndef");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* Check if ndef detection has been performed yet */
if (nfa_rw_cb.ndef_st == NFA_RW_NDEF_ST_UNKNOWN) {
@@ -1640,14 +1644,14 @@
tNDEF_STATUS ndef_status;
tNFA_STATUS write_status = NFA_STATUS_OK;
tNFA_CONN_EVT_DATA conn_evt_data;
- NFA_TRACE_DEBUG0("nfa_rw_write_ndef");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* Validate NDEF message */
ndef_status = NDEF_MsgValidate(p_data->op_req.params.write_ndef.p_data,
p_data->op_req.params.write_ndef.len, false);
if (ndef_status != NDEF_OK) {
- NFA_TRACE_ERROR1("Invalid NDEF message. NDEF_MsgValidate returned %i",
- ndef_status);
+ LOG(ERROR) << StringPrintf(
+ "Invalid NDEF message. NDEF_MsgValidate returned %i", ndef_status);
/* Command complete - perform cleanup, notify app */
nfa_rw_command_complete();
@@ -1826,7 +1830,8 @@
/* Store the current operation */
nfa_rw_cb.cur_op = NFA_RW_OP_PRESENCE_CHECK;
nfa_rw_cb.flags |= NFA_RW_FL_AUTO_PRESENCE_CHECK_BUSY;
- NFA_TRACE_DEBUG0("Auto-presence check starting...");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Auto-presence check starting...");
/* Perform presence check */
nfa_rw_presence_check(NULL);
@@ -1888,7 +1893,7 @@
**
*******************************************************************************/
static bool nfa_rw_detect_tlv(tNFA_RW_MSG* p_data, uint8_t tlv) {
- NFA_TRACE_DEBUG0("nfa_rw_detect_tlv");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
switch (nfa_rw_cb.protocol) {
case NFC_PROTOCOL_T1T:
@@ -1923,7 +1928,7 @@
tNFC_PROTOCOL protocol = nfa_rw_cb.protocol;
tNFC_STATUS status = NFC_STATUS_FAILED;
- NFA_TRACE_DEBUG0("nfa_rw_config_tag_ro ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (NFC_PROTOCOL_T1T == protocol) {
/* Type1Tag - NFC-A */
@@ -2388,7 +2393,7 @@
NFC_HDR* p_msg;
tNFA_CONN_EVT_DATA evt_data;
- NFA_TRACE_DEBUG1("nfa_rw_raw_mode_data_cback(): event = 0x%X", event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("event = 0x%X", event);
if ((event == NFC_DATA_CEVT) &&
((p_data->data.status == NFC_STATUS_OK) ||
@@ -2404,9 +2409,8 @@
GKI_freebuf(p_msg);
} else {
- NFA_TRACE_ERROR0(
- "nfa_rw_raw_mode_data_cback (): received NFC_DATA_CEVT with NULL "
- "data pointer");
+ LOG(ERROR) << StringPrintf(
+ "received NFC_DATA_CEVT with NULL data pointer");
}
} else if (event == NFC_DEACTIVATE_CEVT) {
NFC_SetStaticRfCback(NULL);
@@ -2438,12 +2442,12 @@
GKI_freebuf(nfa_dm_cb.p_activate_ntf);
nfa_dm_cb.p_activate_ntf = NULL;
}
- NFA_TRACE_DEBUG0(
- "nfa_rw_activate_ntf () - Type 2 tag wake up from HALT State");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("- Type 2 tag wake up from HALT State");
return true;
}
- NFA_TRACE_DEBUG0("nfa_rw_activate_ntf");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* Initialize control block */
nfa_rw_cb.protocol = p_activate_params->protocol;
@@ -2511,7 +2515,7 @@
if ((RW_SetActivatedTagType(p_activate_params, nfa_rw_cback)) !=
NFC_STATUS_OK) {
/* Log error (stay in NFA_RW_ST_ACTIVATED state until deactivation) */
- NFA_TRACE_ERROR0("RW_SetActivatedTagType failed.");
+ LOG(ERROR) << StringPrintf("RW_SetActivatedTagType failed.");
return true;
}
@@ -2688,7 +2692,7 @@
/* Check if activated */
if (!(nfa_rw_cb.flags & NFA_RW_FL_ACTIVATED)) {
- NFA_TRACE_ERROR0("nfa_rw_handle_op_req: not activated");
+ LOG(ERROR) << StringPrintf("nfa_rw_handle_op_req: not activated");
return true;
}
/* Check if currently busy with another API call */
@@ -2699,7 +2703,7 @@
else if (nfa_rw_cb.flags & NFA_RW_FL_AUTO_PRESENCE_CHECK_BUSY) {
/* Cache the command (will be handled once auto-presence check is completed)
*/
- NFA_TRACE_DEBUG1(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"Deferring operation %i until after auto-presence check is completed",
p_data->op_req.op);
nfa_rw_cb.p_pending_msg = p_data;
@@ -2707,7 +2711,8 @@
return false;
}
- NFA_TRACE_DEBUG1("nfa_rw_handle_op_req: op=0x%02x", p_data->op_req.op);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_rw_handle_op_req: op=0x%02x", p_data->op_req.op);
nfa_rw_cb.flags |= NFA_RW_FL_API_BUSY;
@@ -2840,8 +2845,8 @@
break;
default:
- NFA_TRACE_ERROR1("nfa_rw_handle_api: unhandled operation: %i",
- p_data->op_req.op);
+ LOG(ERROR) << StringPrintf("nfa_rw_handle_api: unhandled operation: %i",
+ p_data->op_req.op);
break;
}
@@ -2863,7 +2868,7 @@
tNFA_CONN_EVT_DATA conn_evt_data;
uint8_t event;
- NFA_TRACE_ERROR0("nfa_rw_op_req_while_busy: unable to handle API");
+ LOG(ERROR) << StringPrintf("nfa_rw_op_req_while_busy: unable to handle API");
/* Return appropriate event for requested API, with status=BUSY */
conn_evt_data.status = NFA_STATUS_BUSY;
diff --git a/src/nfa/rw/nfa_rw_api.cc b/src/nfa/rw/nfa_rw_api.cc
index c21414d..d6fdc7c 100644
--- a/src/nfa/rw/nfa_rw_api.cc
+++ b/src/nfa/rw/nfa_rw_api.cc
@@ -61,7 +61,7 @@
tNFA_STATUS NFA_RwDetectNDef(void) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API0("NFA_RwDetectNDef");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_msg = (tNFA_RW_OPERATION*)GKI_getbuf((uint16_t)(sizeof(tNFA_RW_OPERATION)));
if (p_msg != NULL) {
@@ -106,7 +106,7 @@
tNFA_STATUS NFA_RwReadNDef(void) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API0("NFA_RwReadNDef");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_msg = (tNFA_RW_OPERATION*)GKI_getbuf((uint16_t)(sizeof(tNFA_RW_OPERATION)));
if (p_msg != NULL) {
@@ -145,7 +145,7 @@
tNFA_STATUS NFA_RwWriteNDef(uint8_t* p_data, uint32_t len) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API2("NFA_RwWriteNDef (): ndef p_data=%08x, len: %i", p_data, len);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("ndef len: %i", len);
/* Validate parameters */
if (p_data == NULL) return (NFA_STATUS_INVALID_PARAM);
@@ -183,7 +183,7 @@
tNFA_STATUS NFA_RwPresenceCheck(tNFA_RW_PRES_CHK_OPTION option) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API0("NFA_RwPresenceCheck");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_msg = (tNFA_RW_OPERATION*)GKI_getbuf((uint16_t)(sizeof(tNFA_RW_OPERATION)));
if (p_msg != NULL) {
@@ -216,7 +216,7 @@
tNFA_STATUS NFA_RwFormatTag(void) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API0("NFA_RwFormatTag");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_msg = (tNFA_RW_OPERATION*)GKI_getbuf((uint16_t)(sizeof(tNFA_RW_OPERATION)));
if (p_msg != NULL) {
@@ -255,8 +255,8 @@
if ((protocol != NFC_PROTOCOL_T1T) && (protocol != NFC_PROTOCOL_T2T) &&
(protocol != NFC_PROTOCOL_T5T) && (protocol != NFC_PROTOCOL_ISO_DEP) &&
(protocol != NFC_PROTOCOL_T3T)) {
- NFA_TRACE_API1(
- "NFA_RwSetTagReadOnly (): Cannot Configure as read only for Protocol: "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Cannot Configure as read only for Protocol: "
"%d",
protocol);
return (NFA_STATUS_REJECTED);
@@ -264,13 +264,14 @@
if ((!b_hard_lock && (protocol == NFC_PROTOCOL_T5T)) ||
(b_hard_lock && (protocol == NFC_PROTOCOL_ISO_DEP))) {
- NFA_TRACE_API2("NFA_RwSetTagReadOnly (): Cannot %s for Protocol: %d",
- b_hard_lock ? "Hard lock" : "Soft lock", protocol);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Cannot %s for Protocol: %d",
+ b_hard_lock ? "Hard lock" : "Soft lock", protocol);
return (NFA_STATUS_REJECTED);
}
- NFA_TRACE_API1("NFA_RwSetTagReadOnly (): %s",
- b_hard_lock ? "Hard lock" : "Soft lock");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s", b_hard_lock ? "Hard lock" : "Soft lock");
p_msg = (tNFA_RW_OPERATION*)GKI_getbuf((uint16_t)(sizeof(tNFA_RW_OPERATION)));
if (p_msg != NULL) {
@@ -328,7 +329,7 @@
tNFA_STATUS NFA_RwLocateTlv(uint8_t tlv_type) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API0("NFA_RwLocateTlv");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_msg = (tNFA_RW_OPERATION*)GKI_getbuf((uint16_t)(sizeof(tNFA_RW_OPERATION)));
if (p_msg != NULL) {
@@ -601,7 +602,8 @@
tNFA_STATUS NFA_RwT2tRead(uint8_t block_number) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API1("NFA_RwT2tRead (): Block to read: %d", block_number);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Block to read: %d", block_number);
p_msg = (tNFA_RW_OPERATION*)GKI_getbuf((uint16_t)(sizeof(tNFA_RW_OPERATION)));
if (p_msg != NULL) {
@@ -634,7 +636,8 @@
tNFA_STATUS NFA_RwT2tWrite(uint8_t block_number, uint8_t* p_data) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API1("NFA_RwT2tWrite (): Block to write: %d", block_number);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Block to write: %d", block_number);
p_msg = (tNFA_RW_OPERATION*)GKI_getbuf((uint16_t)(sizeof(tNFA_RW_OPERATION)));
if (p_msg != NULL) {
@@ -670,7 +673,8 @@
tNFA_STATUS NFA_RwT2tSectorSelect(uint8_t sector_number) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API1("NFA_RwT2tRead (): sector to select: %d", sector_number);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("sector to select: %d", sector_number);
p_msg = (tNFA_RW_OPERATION*)GKI_getbuf((uint16_t)(sizeof(tNFA_RW_OPERATION)));
if (p_msg != NULL) {
@@ -706,7 +710,8 @@
tNFA_RW_OPERATION* p_msg;
uint8_t* p_block_desc;
- NFA_TRACE_API1("NFA_RwT3tRead (): num_blocks to read: %i", num_blocks);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("num_blocks to read: %i", num_blocks);
/* Validate parameters */
if ((num_blocks == 0) || (t3t_blocks == NULL))
@@ -757,7 +762,8 @@
tNFA_RW_OPERATION* p_msg;
uint8_t *p_block_desc, *p_data_area;
- NFA_TRACE_API1("NFA_RwT3tWrite (): num_blocks to write: %i", num_blocks);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("num_blocks to write: %i", num_blocks);
/* Validate parameters */
if ((num_blocks == 0) || (t3t_blocks == NULL) | (p_data == NULL))
@@ -814,8 +820,8 @@
tNFA_STATUS NFA_RwI93Inventory(bool afi_present, uint8_t afi, uint8_t* p_uid) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API2("NFA_RwI93Inventory (): afi_present:%d, AFI: 0x%02X",
- afi_present, afi);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("afi_present:%d, AFI: 0x%02X", afi_present, afi);
if (nfa_rw_cb.protocol != NFC_PROTOCOL_T5T) {
return (NFA_STATUS_WRONG_PROTOCOL);
@@ -864,7 +870,7 @@
tNFA_STATUS NFA_RwI93StayQuiet(void) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API0("NFA_RwI93StayQuiet ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (nfa_rw_cb.protocol != NFC_PROTOCOL_T5T) {
return (NFA_STATUS_WRONG_PROTOCOL);
@@ -904,8 +910,8 @@
tNFA_STATUS NFA_RwI93ReadSingleBlock(uint8_t block_number) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API1("NFA_RwI93ReadSingleBlock (): block_number: 0x%02X",
- block_number);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("block_number: 0x%02X", block_number);
if (nfa_rw_cb.protocol != NFC_PROTOCOL_T5T) {
return (NFA_STATUS_WRONG_PROTOCOL);
@@ -946,8 +952,8 @@
tNFA_STATUS NFA_RwI93WriteSingleBlock(uint8_t block_number, uint8_t* p_data) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API1("NFA_RwI93WriteSingleBlock (): block_number: 0x%02X",
- block_number);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("block_number: 0x%02X", block_number);
if (nfa_rw_cb.protocol != NFC_PROTOCOL_T5T) {
return (NFA_STATUS_WRONG_PROTOCOL);
@@ -997,7 +1003,8 @@
tNFA_STATUS NFA_RwI93LockBlock(uint8_t block_number) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API1("NFA_RwI93LockBlock (): block_number: 0x%02X", block_number);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("block_number: 0x%02X", block_number);
if (nfa_rw_cb.protocol != NFC_PROTOCOL_T5T) {
return (NFA_STATUS_WRONG_PROTOCOL);
@@ -1040,8 +1047,8 @@
uint16_t number_blocks) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API2("NFA_RwI93ReadMultipleBlocks(): %d, %d", first_block_number,
- number_blocks);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%d, %d", first_block_number, number_blocks);
if (nfa_rw_cb.protocol != NFC_PROTOCOL_T5T) {
return (NFA_STATUS_WRONG_PROTOCOL);
@@ -1086,8 +1093,8 @@
tNFA_RW_OPERATION* p_msg;
uint16_t data_length;
- NFA_TRACE_API2("NFA_RwI93WriteMultipleBlocks (): %d, %d", first_block_number,
- number_blocks);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%d, %d", first_block_number, number_blocks);
if (nfa_rw_cb.protocol != NFC_PROTOCOL_T5T) {
return (NFA_STATUS_WRONG_PROTOCOL);
@@ -1145,8 +1152,8 @@
tNFA_STATUS NFA_RwI93Select(uint8_t* p_uid) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API3("NFA_RwI93Select (): UID: [%02X%02X%02X...]", *(p_uid),
- *(p_uid + 1), *(p_uid + 2));
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "UID: [%02X%02X%02X...]", *(p_uid), *(p_uid + 1), *(p_uid + 2));
if (nfa_rw_cb.protocol != NFC_PROTOCOL_T5T) {
return (NFA_STATUS_WRONG_PROTOCOL);
@@ -1189,7 +1196,7 @@
tNFA_STATUS NFA_RwI93ResetToReady(void) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API0("NFA_RwI93ResetToReady ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (nfa_rw_cb.protocol != NFC_PROTOCOL_T5T) {
return (NFA_STATUS_WRONG_PROTOCOL);
@@ -1228,7 +1235,7 @@
tNFA_STATUS NFA_RwI93WriteAFI(uint8_t afi) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API1("NFA_RwI93WriteAFI (): AFI: 0x%02X", afi);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("AFI: 0x%02X", afi);
if (nfa_rw_cb.protocol != NFC_PROTOCOL_T5T) {
return (NFA_STATUS_WRONG_PROTOCOL);
@@ -1269,7 +1276,7 @@
tNFA_STATUS NFA_RwI93LockAFI(void) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API0("NFA_RwI93LockAFI ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (nfa_rw_cb.protocol != NFC_PROTOCOL_T5T) {
return (NFA_STATUS_WRONG_PROTOCOL);
@@ -1308,7 +1315,7 @@
tNFA_STATUS NFA_RwI93WriteDSFID(uint8_t dsfid) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API1("NFA_RwI93WriteDSFID (): DSFID: 0x%02X", dsfid);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("DSFID: 0x%02X", dsfid);
if (nfa_rw_cb.protocol != NFC_PROTOCOL_T5T) {
return (NFA_STATUS_WRONG_PROTOCOL);
@@ -1349,7 +1356,7 @@
tNFA_STATUS NFA_RwI93LockDSFID(void) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API0("NFA_RwI93LockDSFID ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (nfa_rw_cb.protocol != NFC_PROTOCOL_T5T) {
return (NFA_STATUS_WRONG_PROTOCOL);
@@ -1389,7 +1396,7 @@
tNFA_STATUS NFA_RwI93GetSysInfo(uint8_t* p_uid) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API0("NFA_RwI93GetSysInfo ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (nfa_rw_cb.protocol != NFC_PROTOCOL_T5T) {
return (NFA_STATUS_WRONG_PROTOCOL);
@@ -1438,8 +1445,8 @@
uint16_t number_blocks) {
tNFA_RW_OPERATION* p_msg;
- NFA_TRACE_API2("NFA_RwI93GetMultiBlockSecurityStatus(): %d, %d",
- first_block_number, number_blocks);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%d, %d", first_block_number, number_blocks);
if (nfa_rw_cb.protocol != NFC_PROTOCOL_T5T) {
return (NFA_STATUS_WRONG_PROTOCOL);
diff --git a/src/nfa/rw/nfa_rw_main.cc b/src/nfa/rw/nfa_rw_main.cc
index e849030..8a96dcd 100644
--- a/src/nfa/rw/nfa_rw_main.cc
+++ b/src/nfa/rw/nfa_rw_main.cc
@@ -49,9 +49,7 @@
/*****************************************************************************
** Local function prototypes
*****************************************************************************/
-#if (BT_TRACE_VERBOSE == TRUE)
static std::string nfa_rw_evt_2_str(uint16_t event);
-#endif
/*******************************************************************************
**
@@ -63,7 +61,7 @@
**
*******************************************************************************/
void nfa_rw_init(void) {
- NFA_TRACE_DEBUG0("nfa_rw_init ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* initialize control block */
memset(&nfa_rw_cb, 0, sizeof(tNFA_RW_CB));
@@ -172,27 +170,21 @@
bool nfa_rw_handle_event(NFC_HDR* p_msg) {
uint16_t act_idx;
-#if (BT_TRACE_VERBOSE == TRUE)
- NFA_TRACE_EVENT3("nfa_rw_handle_event event: %s (0x%02x), flags: %08x",
- nfa_rw_evt_2_str(p_msg->event).c_str(), p_msg->event,
- nfa_rw_cb.flags);
-#else
- NFA_TRACE_EVENT2("nfa_rw_handle_event event: 0x%x, flags: %08x", p_msg->event,
- nfa_rw_cb.flags);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfa_rw_handle_event event: %s (0x%02x), flags: %08x",
+ nfa_rw_evt_2_str(p_msg->event).c_str(), p_msg->event, nfa_rw_cb.flags);
/* Get NFA_RW sub-event */
act_idx = (p_msg->event & 0x00FF);
if (act_idx < (NFA_RW_MAX_EVT & 0xFF)) {
return (*nfa_rw_action_tbl[act_idx])((tNFA_RW_MSG*)p_msg);
} else {
- NFA_TRACE_ERROR1("nfa_rw_handle_event: unhandled event 0x%02X",
- p_msg->event);
+ LOG(ERROR) << StringPrintf("nfa_rw_handle_event: unhandled event 0x%02X",
+ p_msg->event);
return true;
}
}
-#if (BT_TRACE_VERBOSE == TRUE)
/*******************************************************************************
**
** Function nfa_rw_evt_2_str
@@ -216,4 +208,3 @@
return "Unknown";
}
}
-#endif /* BT_TRACE_VERBOSE */
diff --git a/src/nfa/sys/nfa_sys_cback.cc b/src/nfa/sys/nfa_sys_cback.cc
index 0ccd3d8..2b3617d 100644
--- a/src/nfa/sys/nfa_sys_cback.cc
+++ b/src/nfa/sys/nfa_sys_cback.cc
@@ -52,9 +52,8 @@
void nfa_sys_cback_notify_enable_complete(uint8_t id) {
nfa_sys_cb.enable_cplt_flags |= (0x0001 << id);
- NFA_TRACE_DEBUG2(
- "nfa_sys_cback_notify_enable_complete () enable_cplt_flags=0x%x, "
- "enable_cplt_mask=0x%x",
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "enable_cplt_flags=0x%x, enable_cplt_mask=0x%x",
nfa_sys_cb.enable_cplt_flags, nfa_sys_cb.enable_cplt_mask);
if ((nfa_sys_cb.enable_cplt_flags == nfa_sys_cb.enable_cplt_mask) &&
@@ -93,10 +92,8 @@
void nfa_sys_cback_notify_nfcc_power_mode_proc_complete(uint8_t id) {
nfa_sys_cb.proc_nfcc_pwr_mode_cplt_flags |= (0x0001 << id);
- NFA_TRACE_DEBUG2(
- "nfa_sys_cback_notify_nfcc_power_mode_proc_complete () flags=0x%x, "
- "mask=0x%x",
- nfa_sys_cb.proc_nfcc_pwr_mode_cplt_flags,
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "flags=0x%x, mask=0x%x", nfa_sys_cb.proc_nfcc_pwr_mode_cplt_flags,
nfa_sys_cb.proc_nfcc_pwr_mode_cplt_mask);
/* except SYS */
diff --git a/src/nfa/sys/nfa_sys_main.cc b/src/nfa/sys/nfa_sys_main.cc
index fafbf15..8dcf242 100644
--- a/src/nfa/sys/nfa_sys_main.cc
+++ b/src/nfa/sys/nfa_sys_main.cc
@@ -70,7 +70,8 @@
uint8_t id;
bool freebuf = true;
- NFA_TRACE_EVENT1("NFA got event 0x%04X", p_msg->event);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NFA got event 0x%04X", p_msg->event);
/* get subsystem id from event */
id = (uint8_t)(p_msg->event >> 8);
@@ -79,7 +80,7 @@
if ((id < NFA_ID_MAX) && (nfa_sys_cb.is_reg[id])) {
freebuf = (*nfa_sys_cb.reg[id]->evt_hdlr)(p_msg);
} else {
- NFA_TRACE_WARNING1("NFA got unregistered event id %d", id);
+ LOG(WARNING) << StringPrintf("NFA got unregistered event id %d", id);
}
if (freebuf) {
@@ -125,8 +126,8 @@
nfa_sys_cb.proc_nfcc_pwr_mode_cplt_mask |= (0x0001 << id);
}
- NFA_TRACE_DEBUG2("nfa_sys_register () id=%i, enable_cplt_mask=0x%x", id,
- nfa_sys_cb.enable_cplt_mask);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "id=%i, enable_cplt_mask=0x%x", id, nfa_sys_cb.enable_cplt_mask);
}
/*******************************************************************************
@@ -170,7 +171,8 @@
**
*******************************************************************************/
void nfa_sys_deregister(uint8_t id) {
- NFA_TRACE_DEBUG1("nfa_sys: deregistering subsystem %i", id);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_sys: deregistering subsystem %i", id);
nfa_sys_cb.is_reg[id] = false;
@@ -227,7 +229,8 @@
void nfa_sys_enable_subsystems(void) {
uint8_t id;
- NFA_TRACE_DEBUG0("nfa_sys: enabling subsystems");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_sys: enabling subsystems");
/* Enable all subsystems except SYS */
for (id = NFA_ID_DM; id < NFA_ID_MAX; id++) {
@@ -257,7 +260,8 @@
uint8_t id;
bool done = true;
- NFA_TRACE_DEBUG1("nfa_sys: disabling subsystems:%d", graceful);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_sys: disabling subsystems:%d", graceful);
nfa_sys_cb.graceful_disable = graceful;
/* Disable all subsystems above NFA_DM. (NFA_DM and NFA_SYS will be disabled
@@ -294,8 +298,8 @@
void nfa_sys_notify_nfcc_power_mode(uint8_t nfcc_power_mode) {
uint8_t id;
- NFA_TRACE_DEBUG1("nfa_sys: notify NFCC power mode(%d) to subsystems",
- nfcc_power_mode);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfa_sys: notify NFCC power mode(%d) to subsystems", nfcc_power_mode);
/* Notify NFCC power state to all subsystems except NFA_SYS */
for (id = NFA_ID_DM; id < NFA_ID_MAX; id++) {
diff --git a/src/nfa/sys/nfa_sys_ptim.cc b/src/nfa/sys/nfa_sys_ptim.cc
index 0e42042..c99f6fd 100644
--- a/src/nfa/sys/nfa_sys_ptim.cc
+++ b/src/nfa/sys/nfa_sys_ptim.cc
@@ -86,7 +86,8 @@
(p_cb->timer_queue.p_first->ticks <= 0)) {
/* removed expired timer from list */
p_tle = p_cb->timer_queue.p_first;
- NFA_TRACE_DEBUG1("nfa_sys_ptim_timer_update expired: %08x", p_tle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_sys_ptim_timer_update expired: %p", p_tle);
GKI_remove_from_timer_list(&p_cb->timer_queue, p_tle);
/* call timer callback */
@@ -104,7 +105,7 @@
/* if timer list is empty stop periodic GKI timer */
if (p_cb->timer_queue.p_first == NULL) {
- NFA_TRACE_DEBUG0("ptim timer stop");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("ptim timer stop");
GKI_stop_timer(p_cb->timer_id);
}
}
@@ -121,11 +122,12 @@
*******************************************************************************/
void nfa_sys_ptim_start_timer(tPTIM_CB* p_cb, TIMER_LIST_ENT* p_tle,
uint16_t type, int32_t timeout) {
- NFA_TRACE_DEBUG1("nfa_sys_ptim_start_timer %08x", p_tle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_sys_ptim_start_timer %p", p_tle);
/* if timer list is currently empty, start periodic GKI timer */
if (p_cb->timer_queue.p_first == NULL) {
- NFA_TRACE_DEBUG0("ptim timer start");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("ptim timer start");
p_cb->last_gki_ticks = GKI_get_tick_count();
GKI_start_timer(p_cb->timer_id, GKI_MS_TO_TICKS(p_cb->period), true);
}
@@ -148,13 +150,14 @@
**
*******************************************************************************/
void nfa_sys_ptim_stop_timer(tPTIM_CB* p_cb, TIMER_LIST_ENT* p_tle) {
- NFA_TRACE_DEBUG1("nfa_sys_ptim_stop_timer %08x", p_tle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfa_sys_ptim_stop_timer %p", p_tle);
GKI_remove_from_timer_list(&p_cb->timer_queue, p_tle);
/* if timer list is empty stop periodic GKI timer */
if (p_cb->timer_queue.p_first == NULL) {
- NFA_TRACE_DEBUG0("ptim timer stop");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("ptim timer stop");
GKI_stop_timer(p_cb->timer_id);
}
}
diff --git a/src/nfc/include/nfc_api.h b/src/nfc/include/nfc_api.h
index 1e635d0..d8b33cf 100644
--- a/src/nfc/include/nfc_api.h
+++ b/src/nfc/include/nfc_api.h
@@ -1424,7 +1424,6 @@
*******************************************************************************/
extern void NFC_SetStaticHciCback(tNFC_CONN_CBACK* p_cback);
-#if (BT_TRACE_VERBOSE == TRUE)
/*******************************************************************************
**
** Function NFC_GetStatusName
@@ -1437,6 +1436,5 @@
**
*******************************************************************************/
extern std::string NFC_GetStatusName(tNFC_STATUS status);
-#endif
#endif /* NFC_API_H */
diff --git a/src/nfc/include/tags_int.h b/src/nfc/include/tags_int.h
index edaecdf..b7fc8d3 100644
--- a/src/nfc/include/tags_int.h
+++ b/src/nfc/include/tags_int.h
@@ -82,13 +82,8 @@
extern const tT2T_CMD_RSP_INFO* t2t_cmd_to_rsp_info(uint8_t opcode);
extern uint8_t t2t_info_to_evt(const tT2T_CMD_RSP_INFO* p_info);
-#if (BT_TRACE_PROTOCOL == TRUE)
extern const char* t1t_info_to_str(const tT1T_CMD_RSP_INFO* p_info);
extern const char* t2t_info_to_str(const tT2T_CMD_RSP_INFO* p_info);
-#else
-#define t1t_info_to_str(x) ""
-#define t2t_info_to_str(x) ""
-#endif
extern int tags_pow(int x, int y);
extern unsigned int tags_log2(register unsigned int x);
diff --git a/src/nfc/llcp/llcp_api.cc b/src/nfc/llcp/llcp_api.cc
index ec6ddda..61aaa16 100644
--- a/src/nfc/llcp/llcp_api.cc
+++ b/src/nfc/llcp/llcp_api.cc
@@ -48,8 +48,8 @@
**
*******************************************************************************/
void LLCP_SetTestParams(uint8_t version, uint16_t wks) {
- LLCP_TRACE_API2("LLCP_SetTestParams () version:0x%02X, wks:0x%04X", version,
- wks);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("version:0x%02X, wks:0x%04X", version, wks);
if (version != 0xFF) llcp_test_params.version = version;
@@ -68,7 +68,7 @@
**
*******************************************************************************/
void LLCP_RegisterDtaCback(tLLCP_DTA_CBACK* p_dta_cback) {
- LLCP_TRACE_API1("%s", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
llcp_cb.p_dta_cback = p_dta_cback;
}
@@ -96,25 +96,25 @@
uint16_t inact_timeout_target, uint16_t symm_delay,
uint16_t data_link_timeout,
uint16_t delay_first_pdu_timeout) {
- LLCP_TRACE_API4(
- "LLCP_SetConfig () link_miu:%d, opt:0x%02X, wt:%d, link_timeout:%d",
- link_miu, opt, wt, link_timeout);
- LLCP_TRACE_API4(
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("link_miu:%d, opt:0x%02X, wt:%d, link_timeout:%d",
+ link_miu, opt, wt, link_timeout);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
" inact_timeout (init:%d,target:%d), symm_delay:%d, "
"data_link_timeout:%d",
inact_timeout_init, inact_timeout_target, symm_delay, data_link_timeout);
- LLCP_TRACE_API1(" delay_first_pdu_timeout:%d",
- delay_first_pdu_timeout);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ " delay_first_pdu_timeout:%d", delay_first_pdu_timeout);
if (link_miu < LLCP_DEFAULT_MIU) {
- LLCP_TRACE_ERROR1(
- "LLCP_SetConfig (): link_miu shall not be smaller than "
+ LOG(ERROR) << StringPrintf(
+ "link_miu shall not be smaller than "
"LLCP_DEFAULT_MIU (%d)",
LLCP_DEFAULT_MIU);
link_miu = LLCP_DEFAULT_MIU;
} else if (link_miu > LLCP_MAX_MIU) {
- LLCP_TRACE_ERROR1(
- "LLCP_SetConfig (): link_miu shall not be bigger than LLCP_MAX_MIU "
+ LOG(ERROR) << StringPrintf(
+ "link_miu shall not be bigger than LLCP_MAX_MIU "
"(%d)",
LLCP_MAX_MIU);
link_miu = LLCP_MAX_MIU;
@@ -122,9 +122,8 @@
/* if Link MIU is bigger than GKI buffer */
if (link_miu > LLCP_MIU) {
- LLCP_TRACE_ERROR1(
- "LLCP_SetConfig (): link_miu shall not be bigger than LLCP_MIU (%d)",
- LLCP_MIU);
+ LOG(ERROR) << StringPrintf(
+ "link_miu shall not be bigger than LLCP_MIU (%zu)", LLCP_MIU);
llcp_cb.lcb.local_link_miu = LLCP_MIU;
} else
llcp_cb.lcb.local_link_miu = link_miu;
@@ -133,14 +132,14 @@
llcp_cb.lcb.local_wt = wt;
if (link_timeout < LLCP_LTO_UNIT) {
- LLCP_TRACE_ERROR1(
- "LLCP_SetConfig (): link_timeout shall not be smaller than "
+ LOG(ERROR) << StringPrintf(
+ "link_timeout shall not be smaller than "
"LLCP_LTO_UNIT (%d ms)",
LLCP_LTO_UNIT);
llcp_cb.lcb.local_lto = LLCP_DEFAULT_LTO_IN_MS;
} else if (link_timeout > LLCP_MAX_LTO_IN_MS) {
- LLCP_TRACE_ERROR1(
- "LLCP_SetConfig (): link_timeout shall not be bigger than "
+ LOG(ERROR) << StringPrintf(
+ "link_timeout shall not be bigger than "
"LLCP_MAX_LTO_IN_MS (%d ms)",
LLCP_MAX_LTO_IN_MS);
llcp_cb.lcb.local_lto = LLCP_MAX_LTO_IN_MS;
@@ -187,16 +186,15 @@
*p_data_link_timeout = llcp_cb.lcb.data_link_timeout;
*p_delay_first_pdu_timeout = llcp_cb.lcb.delay_first_pdu_timeout;
- LLCP_TRACE_API4(
- "LLCP_GetConfig () link_miu:%d, opt:0x%02X, wt:%d, link_timeout:%d",
- *p_link_miu, *p_opt, *p_wt, *p_link_timeout);
- LLCP_TRACE_API4(
- " inact_timeout (init:%d, target:%d), symm_delay:%d, "
- "data_link_timeout:%d",
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("link_miu:%d, opt:0x%02X, wt:%d, link_timeout:%d",
+ *p_link_miu, *p_opt, *p_wt, *p_link_timeout);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "inact_timeout (init:%d, target:%d), symm_delay:%d, data_link_timeout:%d",
*p_inact_timeout_init, *p_inact_timeout_target, *p_symm_delay,
*p_data_link_timeout);
- LLCP_TRACE_API1(" delay_first_pdu_timeout:%d",
- *p_delay_first_pdu_timeout);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("delay_first_pdu_timeout:%d", *p_delay_first_pdu_timeout);
}
/*******************************************************************************
@@ -228,11 +226,11 @@
uint8_t* p_gen_bytes_len) {
uint8_t* p = p_gen_bytes;
- LLCP_TRACE_API0("LLCP_GetDiscoveryConfig ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (*p_gen_bytes_len < LLCP_MIN_GEN_BYTES) {
- LLCP_TRACE_ERROR1(
- "LLCP_GetDiscoveryConfig (): GenBytes length shall not be smaller than "
+ LOG(ERROR) << StringPrintf(
+ "GenBytes length shall not be smaller than "
"LLCP_MIN_GEN_BYTES (%d)",
LLCP_MIN_GEN_BYTES);
*p_gen_bytes_len = 0;
@@ -303,8 +301,8 @@
*******************************************************************************/
tLLCP_STATUS LLCP_ActivateLink(tLLCP_ACTIVATE_CONFIG config,
tLLCP_LINK_CBACK* p_link_cback) {
- LLCP_TRACE_API1("LLCP_ActivateLink () link_state = %d",
- llcp_cb.lcb.link_state);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("link_state = %d", llcp_cb.lcb.link_state);
if ((llcp_cb.lcb.link_state == LLCP_LINK_STATE_DEACTIVATED) &&
(p_link_cback)) {
@@ -328,8 +326,8 @@
**
*******************************************************************************/
tLLCP_STATUS LLCP_DeactivateLink(void) {
- LLCP_TRACE_API1("LLCP_DeactivateLink () link_state = %d",
- llcp_cb.lcb.link_state);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("link_state = %d", llcp_cb.lcb.link_state);
if (llcp_cb.lcb.link_state != LLCP_LINK_STATE_DEACTIVATED) {
llcp_link_deactivate(LLCP_LINK_LOCAL_INITIATED);
@@ -366,19 +364,16 @@
0,
};
- LLCP_TRACE_API3(
- "LLCP_RegisterServer (): SAP:0x%x, link_type:0x%x, ServiceName:<%s>",
- reg_sap, link_type,
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "SAP:0x%x, link_type:0x%x, ServiceName:<%s>", reg_sap, link_type,
((p_service_name.empty()) ? "" : p_service_name.c_str()));
if (!p_app_cback) {
- LLCP_TRACE_ERROR0("LLCP_RegisterServer (): Callback must be provided");
+ LOG(ERROR) << StringPrintf("Callback must be provided");
return LLCP_INVALID_SAP;
} else if (((link_type & LLCP_LINK_TYPE_LOGICAL_DATA_LINK) == 0x00) &&
((link_type & LLCP_LINK_TYPE_DATA_LINK_CONNECTION) == 0x00)) {
- LLCP_TRACE_ERROR1(
- "LLCP_RegisterServer (): link type (0x%x) must be specified",
- link_type);
+ LOG(ERROR) << StringPrintf("link type (0x%x) must be specified", link_type);
return LLCP_INVALID_SAP;
}
@@ -393,42 +388,36 @@
}
if (reg_sap == LLCP_INVALID_SAP) {
- LLCP_TRACE_ERROR0("LLCP_RegisterServer (): out of resource");
+ LOG(ERROR) << StringPrintf("out of resource");
return LLCP_INVALID_SAP;
}
} else if (reg_sap == LLCP_SAP_LM) {
- LLCP_TRACE_ERROR1("LLCP_RegisterServer (): SAP (0x%x) is for link manager",
- reg_sap);
+ LOG(ERROR) << StringPrintf("SAP (0x%x) is for link manager", reg_sap);
return LLCP_INVALID_SAP;
} else if (reg_sap <= LLCP_UPPER_BOUND_WK_SAP) {
if (reg_sap >= LLCP_MAX_WKS) {
- LLCP_TRACE_ERROR1(
- "LLCP_RegisterServer (): out of resource for SAP (0x%x)", reg_sap);
+ LOG(ERROR) << StringPrintf("out of resource for SAP (0x%x)", reg_sap);
return LLCP_INVALID_SAP;
} else if (llcp_cb.wks_cb[reg_sap].p_app_cback) {
- LLCP_TRACE_ERROR1(
- "LLCP_RegisterServer (): SAP (0x%x) is already registered", reg_sap);
+ LOG(ERROR) << StringPrintf("SAP (0x%x) is already registered", reg_sap);
return LLCP_INVALID_SAP;
} else {
p_app_cb = &llcp_cb.wks_cb[reg_sap];
}
} else if (reg_sap <= LLCP_UPPER_BOUND_SDP_SAP) {
if (reg_sap - LLCP_LOWER_BOUND_SDP_SAP >= LLCP_MAX_SERVER) {
- LLCP_TRACE_ERROR1(
- "LLCP_RegisterServer (): out of resource for SAP (0x%x)", reg_sap);
+ LOG(ERROR) << StringPrintf("out of resource for SAP (0x%x)", reg_sap);
return LLCP_INVALID_SAP;
} else if (llcp_cb.server_cb[reg_sap - LLCP_LOWER_BOUND_SDP_SAP]
.p_app_cback) {
- LLCP_TRACE_ERROR1(
- "LLCP_RegisterServer (): SAP (0x%x) is already registered", reg_sap);
+ LOG(ERROR) << StringPrintf("SAP (0x%x) is already registered", reg_sap);
return LLCP_INVALID_SAP;
} else {
p_app_cb = &llcp_cb.server_cb[reg_sap - LLCP_LOWER_BOUND_SDP_SAP];
}
} else if (reg_sap >= LLCP_LOWER_BOUND_LOCAL_SAP) {
- LLCP_TRACE_ERROR2(
- "LLCP_RegisterServer (): SAP (0x%x) must be less than 0x%x", reg_sap,
- LLCP_LOWER_BOUND_LOCAL_SAP);
+ LOG(ERROR) << StringPrintf("SAP (0x%x) must be less than 0x%x", reg_sap,
+ LLCP_LOWER_BOUND_LOCAL_SAP);
return LLCP_INVALID_SAP;
}
@@ -437,15 +426,13 @@
if (!p_service_name.empty()) {
length = p_service_name.length();
if (length > LLCP_MAX_SN_LEN) {
- LLCP_TRACE_ERROR1(
- "LLCP_RegisterServer (): Service Name (%d bytes) is too long",
- length);
+ LOG(ERROR) << StringPrintf("Service Name (%d bytes) is too long", length);
return LLCP_INVALID_SAP;
}
p_app_cb->p_service_name = (char*)GKI_getbuf((uint16_t)(length + 1));
if (p_app_cb->p_service_name == NULL) {
- LLCP_TRACE_ERROR0("LLCP_RegisterServer (): Out of resource");
+ LOG(ERROR) << StringPrintf("Out of resource");
return LLCP_INVALID_SAP;
}
@@ -461,7 +448,8 @@
llcp_cb.lcb.wks |= (1 << reg_sap);
}
- LLCP_TRACE_DEBUG1("LLCP_RegisterServer (): Registered SAP = 0x%02X", reg_sap);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Registered SAP = 0x%02X", reg_sap);
if (link_type & LLCP_LINK_TYPE_LOGICAL_DATA_LINK) {
llcp_cb.num_logical_data_link++;
@@ -489,16 +477,15 @@
uint8_t sap;
tLLCP_APP_CB* p_app_cb;
- LLCP_TRACE_API1("LLCP_RegisterClient (): link_type = 0x%x", link_type);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("link_type = 0x%x", link_type);
if (!p_app_cback) {
- LLCP_TRACE_ERROR0("LLCP_RegisterClient (): Callback must be provided");
+ LOG(ERROR) << StringPrintf("Callback must be provided");
return LLCP_INVALID_SAP;
} else if (((link_type & LLCP_LINK_TYPE_LOGICAL_DATA_LINK) == 0x00) &&
((link_type & LLCP_LINK_TYPE_DATA_LINK_CONNECTION) == 0x00)) {
- LLCP_TRACE_ERROR1(
- "LLCP_RegisterClient (): link type (0x%x) must be specified",
- link_type);
+ LOG(ERROR) << StringPrintf("link type (0x%x) must be specified", link_type);
return LLCP_INVALID_SAP;
}
@@ -513,7 +500,7 @@
}
if (reg_sap == LLCP_INVALID_SAP) {
- LLCP_TRACE_ERROR0("LLCP_RegisterClient (): out of resource");
+ LOG(ERROR) << StringPrintf("out of resource");
return LLCP_INVALID_SAP;
}
@@ -521,7 +508,8 @@
p_app_cb->p_service_name = NULL;
p_app_cb->link_type = link_type;
- LLCP_TRACE_DEBUG1("LLCP_RegisterClient (): Registered SAP = 0x%02X", reg_sap);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Registered SAP = 0x%02X", reg_sap);
if (link_type & LLCP_LINK_TYPE_LOGICAL_DATA_LINK) {
llcp_cb.num_logical_data_link++;
@@ -545,13 +533,12 @@
uint8_t idx;
tLLCP_APP_CB* p_app_cb;
- LLCP_TRACE_API1("LLCP_Deregister () SAP:0x%x", local_sap);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("SAP:0x%x", local_sap);
p_app_cb = llcp_util_get_app_cb(local_sap);
if ((!p_app_cb) || (p_app_cb->p_app_cback == NULL)) {
- LLCP_TRACE_ERROR1("LLCP_Deregister (): SAP (0x%x) is not registered",
- local_sap);
+ LOG(ERROR) << StringPrintf("SAP (0x%x) is not registered", local_sap);
return LLCP_STATUS_FAIL;
}
@@ -608,9 +595,9 @@
uint8_t total_pending_i_pdu) {
tLLCP_APP_CB* p_app_cb;
- LLCP_TRACE_API4(
- "LLCP_IsLogicalLinkCongested () Local SAP:0x%x, pending = (%d, %d, %d)",
- local_sap, num_pending_ui_pdu, total_pending_ui_pdu, total_pending_i_pdu);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Local SAP:0x%x, pending = (%d, %d, %d)", local_sap, num_pending_ui_pdu,
+ total_pending_ui_pdu, total_pending_i_pdu);
p_app_cb = llcp_util_get_app_cb(local_sap);
@@ -650,34 +637,34 @@
tLLCP_STATUS status = LLCP_STATUS_FAIL;
tLLCP_APP_CB* p_app_cb;
- LLCP_TRACE_API2("LLCP_SendUI () SSAP=0x%x, DSAP=0x%x", ssap, dsap);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("SSAP=0x%x, DSAP=0x%x", ssap, dsap);
p_app_cb = llcp_util_get_app_cb(ssap);
if ((p_app_cb == NULL) || (p_app_cb->p_app_cback == NULL)) {
- LLCP_TRACE_ERROR1("LLCP_SendUI (): SSAP (0x%x) is not registered", ssap);
+ LOG(ERROR) << StringPrintf("SSAP (0x%x) is not registered", ssap);
} else if ((p_app_cb->link_type & LLCP_LINK_TYPE_LOGICAL_DATA_LINK) == 0) {
- LLCP_TRACE_ERROR1(
- "LLCP_SendUI (): Logical link on SSAP (0x%x) is not enabled", ssap);
+ LOG(ERROR) << StringPrintf("Logical link on SSAP (0x%x) is not enabled",
+ ssap);
} else if (llcp_cb.lcb.link_state != LLCP_LINK_STATE_ACTIVATED) {
- LLCP_TRACE_ERROR0("LLCP_SendUI (): LLCP link is not activated");
+ LOG(ERROR) << StringPrintf("LLCP link is not activated");
} else if ((llcp_cb.lcb.peer_opt == LLCP_LSC_UNKNOWN) ||
(llcp_cb.lcb.peer_opt & LLCP_LSC_1)) {
if (p_buf->len <= llcp_cb.lcb.peer_miu) {
if (p_buf->offset >= LLCP_MIN_OFFSET) {
status = llcp_util_send_ui(ssap, dsap, p_app_cb, p_buf);
} else {
- LLCP_TRACE_ERROR2("LLCP_SendUI (): offset (%d) must be %d at least",
- p_buf->offset, LLCP_MIN_OFFSET);
+ LOG(ERROR) << StringPrintf("offset (%d) must be %d at least",
+ p_buf->offset, LLCP_MIN_OFFSET);
}
} else {
- LLCP_TRACE_ERROR0(
- "LLCP_SendUI (): Data length shall not be bigger than peer's link "
+ LOG(ERROR) << StringPrintf(
+ "Data length shall not be bigger than peer's link "
"MIU");
}
} else {
- LLCP_TRACE_ERROR0(
- "LLCP_SendUI (): Peer doesn't support connectionless link");
+ LOG(ERROR) << StringPrintf("Peer doesn't support connectionless link");
}
if (status == LLCP_STATUS_FAIL) {
@@ -710,7 +697,7 @@
uint8_t* p_ui_pdu;
uint16_t pdu_hdr, ui_pdu_length;
- LLCP_TRACE_API1("LLCP_ReadLogicalLinkData () Local SAP:0x%x", local_sap);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("Local SAP:0x%x", local_sap);
*p_data_len = 0;
@@ -773,8 +760,7 @@
return false;
}
} else {
- LLCP_TRACE_ERROR1("LLCP_ReadLogicalLinkData (): Unregistered SAP:0x%x",
- local_sap);
+ LOG(ERROR) << StringPrintf("Unregistered SAP:0x%x", local_sap);
return false;
}
@@ -797,7 +783,7 @@
uint8_t* p_ui_pdu;
uint16_t ui_pdu_length;
- LLCP_TRACE_API1("LLCP_FlushLogicalLinkRxData () Local SAP:0x%x", local_sap);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("Local SAP:0x%x", local_sap);
p_app_cb = llcp_util_get_app_cb(local_sap);
@@ -830,8 +816,7 @@
/* number of received UI PDU is decreased so check rx congestion status */
llcp_util_check_rx_congested_status();
} else {
- LLCP_TRACE_ERROR1("LLCP_FlushLogicalLinkRxData (): Unregistered SAP:0x%x",
- local_sap);
+ LOG(ERROR) << StringPrintf("Unregistered SAP:0x%x", local_sap);
}
return (flushed_length);
@@ -856,12 +841,12 @@
tLLCP_APP_CB* p_app_cb;
tLLCP_CONNECTION_PARAMS params;
- LLCP_TRACE_API2("LLCP_ConnectReq () reg_sap=0x%x, DSAP=0x%x", reg_sap, dsap);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("reg_sap=0x%x, DSAP=0x%x", reg_sap, dsap);
if ((llcp_cb.lcb.peer_opt != LLCP_LSC_UNKNOWN) &&
((llcp_cb.lcb.peer_opt & LLCP_LSC_2) == 0)) {
- LLCP_TRACE_ERROR0(
- "LLCP_ConnectReq (): Peer doesn't support connection-oriented link");
+ LOG(ERROR) << StringPrintf("Peer doesn't support connection-oriented link");
return LLCP_STATUS_FAIL;
}
@@ -876,29 +861,27 @@
/* if application is registered */
if ((p_app_cb == NULL) || (p_app_cb->p_app_cback == NULL)) {
- LLCP_TRACE_ERROR1("LLCP_ConnectReq (): SSAP (0x%x) is not registered",
- reg_sap);
+ LOG(ERROR) << StringPrintf("SSAP (0x%x) is not registered", reg_sap);
return LLCP_STATUS_FAIL;
}
if (dsap == LLCP_SAP_LM) {
- LLCP_TRACE_ERROR1(
- "LLCP_ConnectReq (): DSAP (0x%x) must not be link manager SAP", dsap);
+ LOG(ERROR) << StringPrintf("DSAP (0x%x) must not be link manager SAP",
+ dsap);
return LLCP_STATUS_FAIL;
}
if (dsap == LLCP_SAP_SDP) {
if (strlen(p_params->sn) > LLCP_MAX_SN_LEN) {
- LLCP_TRACE_ERROR1(
- "LLCP_ConnectReq (): Service Name (%d bytes) is too long",
- strlen(p_params->sn));
+ LOG(ERROR) << StringPrintf("Service Name (%zu bytes) is too long",
+ strlen(p_params->sn));
return LLCP_STATUS_FAIL;
}
}
if ((p_params) && (p_params->miu > llcp_cb.lcb.local_link_miu)) {
- LLCP_TRACE_ERROR0(
- "LLCP_ConnectReq (): Data link MIU shall not be bigger than local link "
+ LOG(ERROR) << StringPrintf(
+ "Data link MIU shall not be bigger than local link "
"MIU");
return LLCP_STATUS_FAIL;
}
@@ -911,8 +894,8 @@
** link connection if there is multiple pending connection request on
** the same local SAP.
*/
- LLCP_TRACE_ERROR0(
- "LLCP_ConnectReq (): There is pending connect request on this reg_sap");
+ LOG(ERROR) << StringPrintf(
+ "There is pending connect request on this reg_sap");
return LLCP_STATUS_FAIL;
}
@@ -922,7 +905,7 @@
status =
llcp_dlsm_execute(p_dlcb, LLCP_DLC_EVENT_API_CONNECT_REQ, p_params);
if (status != LLCP_STATUS_SUCCESS) {
- LLCP_TRACE_ERROR0("LLCP_ConnectReq (): Error in state machine");
+ LOG(ERROR) << StringPrintf("Error in state machine");
llcp_util_deallocate_data_link(p_dlcb);
return LLCP_STATUS_FAIL;
}
@@ -950,8 +933,8 @@
tLLCP_DLCB* p_dlcb;
tLLCP_CONNECTION_PARAMS params;
- LLCP_TRACE_API2("LLCP_ConnectCfm () Local SAP:0x%x, Remote SAP:0x%x)",
- local_sap, remote_sap);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Local SAP:0x%x, Remote SAP:0x%x)", local_sap, remote_sap);
if (!p_params) {
params.miu = LLCP_DEFAULT_MIU;
@@ -960,8 +943,8 @@
p_params = ¶ms;
}
if (p_params->miu > llcp_cb.lcb.local_link_miu) {
- LLCP_TRACE_ERROR0(
- "LLCP_ConnectCfm (): Data link MIU shall not be bigger than local link "
+ LOG(ERROR) << StringPrintf(
+ "Data link MIU shall not be bigger than local link "
"MIU");
return LLCP_STATUS_FAIL;
}
@@ -972,7 +955,7 @@
status =
llcp_dlsm_execute(p_dlcb, LLCP_DLC_EVENT_API_CONNECT_CFM, p_params);
} else {
- LLCP_TRACE_ERROR0("LLCP_ConnectCfm (): No data link");
+ LOG(ERROR) << StringPrintf("No data link");
status = LLCP_STATUS_FAIL;
}
@@ -1000,9 +983,9 @@
tLLCP_STATUS status;
tLLCP_DLCB* p_dlcb;
- LLCP_TRACE_API3(
- "LLCP_ConnectReject () Local SAP:0x%x, Remote SAP:0x%x, reason:0x%x",
- local_sap, remote_sap, reason);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Local SAP:0x%x, Remote SAP:0x%x, reason:0x%x", local_sap,
+ remote_sap, reason);
p_dlcb = llcp_dlc_find_dlcb_by_sap(local_sap, remote_sap);
@@ -1011,7 +994,7 @@
llcp_dlsm_execute(p_dlcb, LLCP_DLC_EVENT_API_CONNECT_REJECT, &reason);
llcp_util_deallocate_data_link(p_dlcb);
} else {
- LLCP_TRACE_ERROR0("LLCP_ConnectReject (): No data link");
+ LOG(ERROR) << StringPrintf("No data link");
status = LLCP_STATUS_FAIL;
}
@@ -1034,8 +1017,8 @@
uint8_t total_pending_i_pdu) {
tLLCP_DLCB* p_dlcb;
- LLCP_TRACE_API5(
- "LLCP_IsDataLinkCongested () Local SAP:0x%x, Remote SAP:0x%x, pending = "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Local SAP:0x%x, Remote SAP:0x%x, pending = "
"(%d, %d, %d)",
local_sap, remote_sap, num_pending_i_pdu, total_pending_ui_pdu,
total_pending_i_pdu);
@@ -1075,8 +1058,8 @@
tLLCP_STATUS status = LLCP_STATUS_FAIL;
tLLCP_DLCB* p_dlcb;
- LLCP_TRACE_API2("LLCP_SendData () Local SAP:0x%x, Remote SAP:0x%x", local_sap,
- remote_sap);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Local SAP:0x%x, Remote SAP:0x%x", local_sap, remote_sap);
p_dlcb = llcp_dlc_find_dlcb_by_sap(local_sap, remote_sap);
@@ -1085,17 +1068,17 @@
if (p_buf->offset >= LLCP_MIN_OFFSET) {
status = llcp_dlsm_execute(p_dlcb, LLCP_DLC_EVENT_API_DATA_REQ, p_buf);
} else {
- LLCP_TRACE_ERROR2("LLCP_SendData (): offset (%d) must be %d at least",
- p_buf->offset, LLCP_MIN_OFFSET);
+ LOG(ERROR) << StringPrintf("offset (%d) must be %d at least",
+ p_buf->offset, LLCP_MIN_OFFSET);
}
} else {
- LLCP_TRACE_ERROR2(
- "LLCP_SendData (): Information (%d bytes) cannot be more than peer "
+ LOG(ERROR) << StringPrintf(
+ "Information (%d bytes) cannot be more than peer "
"MIU (%d bytes)",
p_buf->len, p_dlcb->remote_miu);
}
} else {
- LLCP_TRACE_ERROR0("LLCP_SendData (): No data link");
+ LOG(ERROR) << StringPrintf("No data link");
}
if (status == LLCP_STATUS_FAIL) {
@@ -1128,8 +1111,8 @@
uint8_t* p_i_pdu;
uint16_t i_pdu_length;
- LLCP_TRACE_API2("LLCP_ReadDataLinkData () Local SAP:0x%x, Remote SAP:0x%x",
- local_sap, remote_sap);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Local SAP:0x%x, Remote SAP:0x%x", local_sap, remote_sap);
p_dlcb = llcp_dlc_find_dlcb_by_sap(local_sap, remote_sap);
@@ -1196,7 +1179,7 @@
return false;
}
} else {
- LLCP_TRACE_ERROR0("LLCP_ReadDataLinkData (): No data link connection");
+ LOG(ERROR) << StringPrintf("No data link connection");
return false;
}
@@ -1219,8 +1202,8 @@
uint8_t* p_i_pdu;
uint16_t i_pdu_length;
- LLCP_TRACE_API2("LLCP_FlushDataLinkRxData () Local SAP:0x%x, Remote SAP:0x%x",
- local_sap, remote_sap);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Local SAP:0x%x, Remote SAP:0x%x", local_sap, remote_sap);
p_dlcb = llcp_dlc_find_dlcb_by_sap(local_sap, remote_sap);
@@ -1260,7 +1243,7 @@
/* number of received I PDU is decreased so check rx congestion status */
llcp_util_check_rx_congested_status();
} else {
- LLCP_TRACE_ERROR0("LLCP_FlushDataLinkRxData (): No data link connection");
+ LOG(ERROR) << StringPrintf("No data link connection");
}
return (flushed_length);
@@ -1281,9 +1264,9 @@
tLLCP_STATUS status;
tLLCP_DLCB* p_dlcb;
- LLCP_TRACE_API3(
- "LLCP_DisconnectReq () Local SAP:0x%x, Remote SAP:0x%x, flush=%d",
- local_sap, remote_sap, flush);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Local SAP:0x%x, Remote SAP:0x%x, flush=%d", local_sap,
+ remote_sap, flush);
p_dlcb = llcp_dlc_find_dlcb_by_sap(local_sap, remote_sap);
@@ -1291,7 +1274,7 @@
status =
llcp_dlsm_execute(p_dlcb, LLCP_DLC_EVENT_API_DISCONNECT_REQ, &flush);
} else {
- LLCP_TRACE_ERROR0("LLCP_DisconnectReq (): No data link");
+ LOG(ERROR) << StringPrintf("No data link");
status = LLCP_STATUS_FAIL;
}
@@ -1314,8 +1297,8 @@
tLLCP_STATUS status;
tLLCP_DLCB* p_dlcb;
- LLCP_TRACE_API2("LLCP_SetTxCompleteNtf () Local SAP:0x%x, Remote SAP:0x%x",
- local_sap, remote_sap);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Local SAP:0x%x, Remote SAP:0x%x", local_sap, remote_sap);
p_dlcb = llcp_dlc_find_dlcb_by_sap(local_sap, remote_sap);
@@ -1324,7 +1307,7 @@
p_dlcb->flags |= LLCP_DATA_LINK_FLAG_NOTIFY_TX_DONE;
status = LLCP_STATUS_SUCCESS;
} else {
- LLCP_TRACE_ERROR0("LLCP_SetTxCompleteNtf (): No data link");
+ LOG(ERROR) << StringPrintf("No data link");
status = LLCP_STATUS_FAIL;
}
@@ -1346,8 +1329,8 @@
tLLCP_STATUS status;
tLLCP_DLCB* p_dlcb;
- LLCP_TRACE_API2("LLCP_SetLocalBusyStatus () Local SAP:0x%x, is_busy=%d",
- local_sap, is_busy);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Local SAP:0x%x, is_busy=%d", local_sap, is_busy);
p_dlcb = llcp_dlc_find_dlcb_by_sap(local_sap, remote_sap);
@@ -1366,7 +1349,7 @@
}
status = LLCP_STATUS_SUCCESS;
} else {
- LLCP_TRACE_ERROR0("LLCP_SetLocalBusyStatus (): No data link");
+ LOG(ERROR) << StringPrintf("No data link");
status = LLCP_STATUS_FAIL;
}
@@ -1384,10 +1367,10 @@
**
*******************************************************************************/
uint16_t LLCP_GetRemoteWKS(void) {
- LLCP_TRACE_API1("LLCP_GetRemoteWKS () WKS:0x%04x",
- (llcp_cb.lcb.link_state == LLCP_LINK_STATE_ACTIVATED)
- ? llcp_cb.lcb.peer_wks
- : 0);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "WKS:0x%04x", (llcp_cb.lcb.link_state == LLCP_LINK_STATE_ACTIVATED)
+ ? llcp_cb.lcb.peer_wks
+ : 0);
if (llcp_cb.lcb.link_state == LLCP_LINK_STATE_ACTIVATED)
return (llcp_cb.lcb.peer_wks);
@@ -1406,8 +1389,8 @@
**
*******************************************************************************/
uint8_t LLCP_GetRemoteLSC(void) {
- LLCP_TRACE_API1("LLCP_GetRemoteLSC () LSC:0x%x",
- (llcp_cb.lcb.link_state == LLCP_LINK_STATE_ACTIVATED)
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "LSC:0x%x", (llcp_cb.lcb.link_state == LLCP_LINK_STATE_ACTIVATED)
? llcp_cb.lcb.peer_opt & (LLCP_LSC_1 | LLCP_LSC_2)
: 0);
@@ -1428,10 +1411,10 @@
**
*******************************************************************************/
uint8_t LLCP_GetRemoteVersion(void) {
- LLCP_TRACE_API1("LLCP_GetRemoteVersion () Version: 0x%x",
- (llcp_cb.lcb.link_state == LLCP_LINK_STATE_ACTIVATED)
- ? llcp_cb.lcb.peer_version
- : 0);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Version: 0x%x", (llcp_cb.lcb.link_state == LLCP_LINK_STATE_ACTIVATED)
+ ? llcp_cb.lcb.peer_version
+ : 0);
if (llcp_cb.lcb.link_state == LLCP_LINK_STATE_ACTIVATED)
return (llcp_cb.lcb.peer_version);
@@ -1450,7 +1433,7 @@
**
*******************************************************************************/
void LLCP_GetLinkMIU(uint16_t* p_local_link_miu, uint16_t* p_remote_link_miu) {
- LLCP_TRACE_API0("LLCP_GetLinkMIU ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (llcp_cb.lcb.link_state == LLCP_LINK_STATE_ACTIVATED) {
*p_local_link_miu = llcp_cb.lcb.local_link_miu;
@@ -1460,9 +1443,9 @@
*p_remote_link_miu = 0;
}
- LLCP_TRACE_DEBUG2(
- "LLCP_GetLinkMIU (): local_link_miu = %d, remote_link_miu = %d",
- *p_local_link_miu, *p_remote_link_miu);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("local_link_miu = %d, remote_link_miu = %d",
+ *p_local_link_miu, *p_remote_link_miu);
}
/*******************************************************************************
@@ -1481,22 +1464,22 @@
tLLCP_STATUS status;
uint8_t i;
- LLCP_TRACE_API1("LLCP_DiscoverService () Service Name:%s", p_name);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("Service Name:%s", p_name);
if (llcp_cb.lcb.link_state != LLCP_LINK_STATE_ACTIVATED) {
- LLCP_TRACE_ERROR0("LLCP_DiscoverService (): Link is not activated");
+ LOG(ERROR) << StringPrintf("Link is not activated");
return LLCP_STATUS_FAIL;
}
if (!p_cback) {
- LLCP_TRACE_ERROR0("LLCP_DiscoverService (): Callback must be provided.");
+ LOG(ERROR) << StringPrintf("Callback must be provided.");
return LLCP_STATUS_FAIL;
}
/* if peer version is less than V1.1 then SNL is not supported */
if ((llcp_cb.lcb.agreed_major_version == 0x01) &&
(llcp_cb.lcb.agreed_minor_version < 0x01)) {
- LLCP_TRACE_ERROR0("LLCP_DiscoverService (): Peer doesn't support SNL");
+ LOG(ERROR) << StringPrintf("Peer doesn't support SNL");
return LLCP_STATUS_FAIL;
}
@@ -1517,7 +1500,7 @@
}
}
- LLCP_TRACE_ERROR0("LLCP_DiscoverService (): Out of resource");
+ LOG(ERROR) << StringPrintf("Out of resource");
return LLCP_STATUS_FAIL;
}
diff --git a/src/nfc/llcp/llcp_dlc.cc b/src/nfc/llcp/llcp_dlc.cc
index c551b82..4f7e15a 100644
--- a/src/nfc/llcp/llcp_dlc.cc
+++ b/src/nfc/llcp/llcp_dlc.cc
@@ -44,10 +44,8 @@
tLLCP_DLC_EVENT event, void* p_data);
extern unsigned char appl_dta_mode_flag;
-#if (BT_TRACE_VERBOSE == TRUE)
static std::string llcp_dlsm_get_state_name(tLLCP_DLC_STATE state);
static std::string llcp_dlsm_get_event_name(tLLCP_DLC_EVENT event);
-#endif
/*******************************************************************************
**
@@ -63,14 +61,10 @@
void* p_data) {
tLLCP_STATUS status;
-#if (BT_TRACE_VERBOSE == TRUE)
- LLCP_TRACE_EVENT3("DLC (0x%02X) - state: %s, evt: %s", p_dlcb->local_sap,
- llcp_dlsm_get_state_name(p_dlcb->state).c_str(),
- llcp_dlsm_get_event_name(event).c_str());
-#else
- LLCP_TRACE_EVENT3("DLC (0x%02X) - state: %d, evt: %d", p_dlcb->local_sap,
- p_dlcb->state, event);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("DLC (0x%02X) - state: %s, evt: %s", p_dlcb->local_sap,
+ llcp_dlsm_get_state_name(p_dlcb->state).c_str(),
+ llcp_dlsm_get_event_name(event).c_str());
switch (p_dlcb->state) {
case LLCP_DLC_STATE_IDLE:
@@ -144,8 +138,8 @@
p_params = (tLLCP_CONNECTION_PARAMS*)p_data;
if (p_params->miu > llcp_cb.lcb.peer_miu) {
- LLCP_TRACE_WARNING0(
- "llcp_dlsm_idle (): Peer sent data link MIU bigger than peer's "
+ LOG(WARNING) << StringPrintf(
+ "Peer sent data link MIU bigger than peer's "
"link MIU");
p_params->miu = llcp_cb.lcb.peer_miu;
}
@@ -161,8 +155,8 @@
p_dlcb->remote_miu = p_params->miu;
p_dlcb->remote_rw = p_params->rw;
- LLCP_TRACE_DEBUG2("llcp_dlsm_idle (): Remote MIU:%d, RW:%d",
- p_dlcb->remote_miu, p_dlcb->remote_rw);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Remote MIU:%d, RW:%d", p_dlcb->remote_miu, p_dlcb->remote_rw);
/* wait for response from upper layer */
p_dlcb->state = LLCP_DLC_STATE_W4_LOCAL_RESP;
@@ -177,7 +171,7 @@
break;
default:
- LLCP_TRACE_ERROR0("llcp_dlsm_idle (): Unexpected event");
+ LOG(ERROR) << StringPrintf("Unexpected event");
status = LLCP_STATUS_FAIL;
break;
}
@@ -212,8 +206,8 @@
/* data link MIU must be up to link MIU */
if (p_params->miu > llcp_cb.lcb.peer_miu) {
- LLCP_TRACE_WARNING0(
- "llcp_dlsm_w4_remote_resp (): Peer sent data link MIU bigger than "
+ LOG(WARNING) << StringPrintf(
+ "Peer sent data link MIU bigger than "
"peer's link MIU");
p_params->miu = llcp_cb.lcb.peer_miu;
}
@@ -221,8 +215,8 @@
p_dlcb->remote_miu = p_params->miu;
p_dlcb->remote_rw = p_params->rw;
- LLCP_TRACE_DEBUG2("llcp_dlsm_w4_remote_resp (): Remote MIU:%d, RW:%d",
- p_dlcb->remote_miu, p_dlcb->remote_rw);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Remote MIU:%d, RW:%d", p_dlcb->remote_miu, p_dlcb->remote_rw);
p_dlcb->state = LLCP_DLC_STATE_CONNECTED;
llcp_util_adjust_dl_rx_congestion();
@@ -271,7 +265,7 @@
break;
default:
- LLCP_TRACE_ERROR0("llcp_dlsm_w4_remote_resp (): Unexpected event");
+ LOG(ERROR) << StringPrintf("Unexpected event");
status = LLCP_STATUS_FAIL;
break;
}
@@ -359,7 +353,7 @@
break;
default:
- LLCP_TRACE_ERROR0("llcp_dlsm_w4_local_resp (): Unexpected event");
+ LOG(ERROR) << StringPrintf("Unexpected event");
status = LLCP_STATUS_FAIL;
break;
}
@@ -444,8 +438,8 @@
(p_dlcb->i_xmit_q.count >=
p_dlcb->remote_rw)) /*if enough data to send next round */
{
- LLCP_TRACE_DEBUG3(
- "llcp_dlsm_connected (): Data link (SSAP:DSAP=0x%X:0x%X) "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Data link (SSAP:DSAP=0x%X:0x%X) "
"congested: xmit_q.count=%d",
p_dlcb->local_sap, p_dlcb->remote_sap, p_dlcb->i_xmit_q.count);
@@ -455,8 +449,7 @@
status = LLCP_STATUS_CONGESTED;
}
} else {
- LLCP_TRACE_ERROR0(
- "llcp_dlsm_connected (): Remote RW is zero: discard data");
+ LOG(ERROR) << StringPrintf("Remote RW is zero: discard data");
/* buffer will be freed when returned to API function */
status = LLCP_STATUS_FAIL;
}
@@ -488,7 +481,7 @@
break;
default:
- LLCP_TRACE_ERROR0("llcp_dlsm_connected (): Unexpected event");
+ LOG(ERROR) << StringPrintf("Unexpected event");
status = LLCP_STATUS_FAIL;
break;
}
@@ -550,7 +543,7 @@
break;
default:
- LLCP_TRACE_ERROR0("llcp_dlsm_w4_remote_dm (): Unexpected event");
+ LOG(ERROR) << StringPrintf("Unexpected event");
status = LLCP_STATUS_FAIL;
break;
}
@@ -598,8 +591,8 @@
*******************************************************************************/
void llcp_dlc_flush_q(tLLCP_DLCB* p_dlcb) {
if (p_dlcb) {
- LLCP_TRACE_DEBUG1("llcp_dlc_flush_q (): local SAP:0x%02X",
- p_dlcb->local_sap);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("local SAP:0x%02X", p_dlcb->local_sap);
/* Release any held buffers */
while (p_dlcb->i_xmit_q.p_first) {
@@ -610,7 +603,7 @@
/* discard any received I PDU on data link including in AGF */
LLCP_FlushDataLinkRxData(p_dlcb->local_sap, p_dlcb->remote_sap);
} else {
- LLCP_TRACE_ERROR0("llcp_dlc_flush_q (): p_dlcb is NULL");
+ LOG(ERROR) << StringPrintf("p_dlcb is NULL");
}
}
@@ -631,21 +624,20 @@
tLLCP_CONNECTION_PARAMS params;
- LLCP_TRACE_DEBUG0("llcp_dlc_proc_connect_pdu ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_app_cb = llcp_util_get_app_cb(dsap);
if ((p_app_cb == NULL) || (p_app_cb->p_app_cback == NULL) ||
((p_app_cb->link_type & LLCP_LINK_TYPE_DATA_LINK_CONNECTION) == 0)) {
- LLCP_TRACE_ERROR1("llcp_dlc_proc_connect_pdu (): Unregistered SAP:0x%x",
- dsap);
+ LOG(ERROR) << StringPrintf("Unregistered SAP:0x%x", dsap);
llcp_util_send_dm(ssap, dsap, LLCP_SAP_DM_REASON_NO_SERVICE);
return;
}
/* parse CONNECT PDU and get connection parameters */
if (llcp_util_parse_connect(p_data, length, ¶ms) != LLCP_STATUS_SUCCESS) {
- LLCP_TRACE_ERROR0("llcp_dlc_proc_connect_pdu (): Bad format CONNECT");
+ LOG(ERROR) << StringPrintf("Bad format CONNECT");
/* fix to pass TC_CTO_TAR_BI_02_x (x=5) test case
* As per the LLCP test specification v1.2.00 by receiving erroneous SNL PDU
* i'e with improper length and service name "urn:nfc:sn:dta-co-echo-in",
@@ -653,7 +645,8 @@
if (appl_dta_mode_flag == 1 &&
p_data[1] == strlen((const char*)&p_data[2])) {
- LLCP_TRACE_DEBUG1("%s: Strings are not equal", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: Strings are not equal", __func__);
llcp_util_send_dm(ssap, dsap, LLCP_SAP_DM_REASON_NO_SERVICE);
} else {
llcp_util_send_dm(ssap, dsap, LLCP_SAP_DM_REASON_NO_SERVICE);
@@ -679,15 +672,13 @@
}
if (dsap == LLCP_SAP_SDP) {
- LLCP_TRACE_ERROR0(
- "llcp_dlc_proc_connect_pdu (): SDP doesn't accept connection");
+ LOG(ERROR) << StringPrintf("SDP doesn't accept connection");
llcp_util_send_dm(ssap, LLCP_SAP_SDP,
LLCP_SAP_DM_REASON_PERM_REJECT_THIS);
return;
} else if (dsap == 0) {
- LLCP_TRACE_ERROR1("llcp_dlc_proc_connect_pdu (): Unregistered Service:%s",
- params.sn);
+ LOG(ERROR) << StringPrintf("Unregistered Service:%s", params.sn);
llcp_util_send_dm(ssap, LLCP_SAP_SDP, LLCP_SAP_DM_REASON_NO_SERVICE);
return;
@@ -697,8 +688,8 @@
if ((p_app_cb == NULL) || (p_app_cb->p_app_cback == NULL) ||
((p_app_cb->link_type & LLCP_LINK_TYPE_DATA_LINK_CONNECTION) == 0)) {
- LLCP_TRACE_ERROR1(
- "llcp_dlc_proc_connect_pdu (): SAP(0x%x) doesn't support "
+ LOG(ERROR) << StringPrintf(
+ "SAP(0x%x) doesn't support "
"connection-oriented",
dsap);
llcp_util_send_dm(ssap, dsap, LLCP_SAP_DM_REASON_NO_SERVICE);
@@ -710,8 +701,7 @@
/* check if any data link */
p_dlcb = llcp_dlc_find_dlcb_by_sap(dsap, ssap);
if (p_dlcb) {
- LLCP_TRACE_ERROR0(
- "llcp_dlc_proc_connect_pdu (): Data link is aleady established");
+ LOG(ERROR) << StringPrintf("Data link is aleady established");
llcp_util_send_dm(ssap, dsap, LLCP_SAP_DM_REASON_TEMP_REJECT_THIS);
} else {
/* allocate data link connection control block and notify upper layer
@@ -722,12 +712,11 @@
status =
llcp_dlsm_execute(p_dlcb, LLCP_DLC_EVENT_PEER_CONNECT_IND, ¶ms);
if (status != LLCP_STATUS_SUCCESS) {
- LLCP_TRACE_ERROR0(
- "llcp_dlc_proc_connect_pdu (): Error in state machine");
+ LOG(ERROR) << StringPrintf("Error in state machine");
llcp_util_deallocate_data_link(p_dlcb);
}
} else {
- LLCP_TRACE_ERROR0("llcp_dlc_proc_connect_pdu (): Out of resource");
+ LOG(ERROR) << StringPrintf("Out of resource");
llcp_util_send_dm(ssap, dsap, LLCP_SAP_DM_REASON_TEMP_REJECT_ANY);
}
}
@@ -746,13 +735,13 @@
uint8_t* p_data) {
tLLCP_DLCB* p_dlcb;
- LLCP_TRACE_DEBUG0("llcp_dlc_proc_disc_pdu ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_dlcb = llcp_dlc_find_dlcb_by_sap(dsap, ssap);
if (p_dlcb) {
if (length > 0) {
- LLCP_TRACE_ERROR1(
- "llcp_dlc_proc_disc_pdu (): Received extra data (%d bytes) in DISC "
+ LOG(ERROR) << StringPrintf(
+ "Received extra data (%d bytes) in DISC "
"PDU",
length);
@@ -764,9 +753,7 @@
llcp_dlsm_execute(p_dlcb, LLCP_DLC_EVENT_PEER_DISCONNECT_IND, NULL);
}
} else {
- LLCP_TRACE_ERROR2(
- "llcp_dlc_proc_disc_pdu (): No data link for SAP (0x%x,0x%x)", dsap,
- ssap);
+ LOG(ERROR) << StringPrintf("No data link for SAP (0x%x,0x%x)", dsap, ssap);
}
}
@@ -785,7 +772,7 @@
tLLCP_CONNECTION_PARAMS params;
tLLCP_STATUS status;
- LLCP_TRACE_DEBUG0("llcp_dlc_proc_cc_pdu ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* find a DLCB waiting for CC on this local SAP */
p_dlcb = llcp_dlc_find_dlcb_by_sap(dsap, LLCP_INVALID_SAP);
@@ -799,7 +786,7 @@
status =
llcp_dlsm_execute(p_dlcb, LLCP_DLC_EVENT_PEER_CONNECT_CFM, ¶ms);
if (status != LLCP_STATUS_SUCCESS) {
- LLCP_TRACE_ERROR0("llcp_dlc_proc_cc_pdu (): Error in state machine");
+ LOG(ERROR) << StringPrintf("Error in state machine");
llcp_util_deallocate_data_link(p_dlcb);
}
} else {
@@ -809,9 +796,7 @@
llcp_dlsm_execute(p_dlcb, LLCP_DLC_EVENT_FRAME_ERROR, NULL);
}
} else {
- LLCP_TRACE_ERROR2(
- "llcp_dlc_proc_cc_pdu (): No data link for SAP (0x%x,0x%x)", dsap,
- ssap);
+ LOG(ERROR) << StringPrintf("No data link for SAP (0x%x,0x%x)", dsap, ssap);
}
}
@@ -828,10 +813,10 @@
uint8_t* p_data) {
tLLCP_DLCB* p_dlcb;
- LLCP_TRACE_DEBUG0("llcp_dlc_proc_dm_pdu ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (length != LLCP_PDU_DM_SIZE - LLCP_PDU_HEADER_SIZE) {
- LLCP_TRACE_ERROR0("llcp_dlc_proc_dm_pdu (): Received invalid DM PDU");
+ LOG(ERROR) << StringPrintf("Received invalid DM PDU");
} else {
if (*p_data == LLCP_SAP_DM_REASON_RESP_DISC) {
/* local device initiated disconnecting */
@@ -846,9 +831,8 @@
llcp_dlsm_execute(p_dlcb, LLCP_DLC_EVENT_PEER_DISCONNECT_RESP,
p_data); /* passing reason */
} else {
- LLCP_TRACE_ERROR2(
- "llcp_dlc_proc_dm_pdu (): No data link for SAP (0x%x,0x%x)", dsap,
- ssap);
+ LOG(ERROR) << StringPrintf("No data link for SAP (0x%x,0x%x)", dsap,
+ ssap);
}
}
}
@@ -870,7 +854,7 @@
bool appended;
NFC_HDR* p_last_buf;
- LLCP_TRACE_DEBUG0("llcp_dlc_proc_i_pdu ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_dlcb = llcp_dlc_find_dlcb_by_sap(dsap, ssap);
@@ -885,8 +869,8 @@
info_len = i_pdu_length - LLCP_PDU_HEADER_SIZE - LLCP_SEQUENCE_SIZE;
if (info_len > p_dlcb->local_miu) {
- LLCP_TRACE_ERROR2(
- "llcp_dlc_proc_i_pdu (): exceeding local MIU (%d bytes): got %d "
+ LOG(ERROR) << StringPrintf(
+ "exceeding local MIU (%d bytes): got %d "
"bytes SDU",
p_dlcb->local_miu, info_len);
@@ -899,26 +883,24 @@
send_seq = LLCP_GET_NS(*p);
rcv_seq = LLCP_GET_NR(*p);
-#if (BT_TRACE_VERBOSE == TRUE)
- LLCP_TRACE_DEBUG6(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"LLCP RX I PDU - N(S,R):(%d,%d) V(S,SA,R,RA):(%d,%d,%d,%d)", send_seq,
rcv_seq, p_dlcb->next_tx_seq, p_dlcb->rcvd_ack_seq, p_dlcb->next_rx_seq,
p_dlcb->sent_ack_seq);
-#endif
/* if send sequence number, N(S) is not expected one, V(R) */
if (p_dlcb->next_rx_seq != send_seq) {
- LLCP_TRACE_ERROR2("llcp_dlc_proc_i_pdu (): Bad N(S) got:%d, expected:%d",
- send_seq, p_dlcb->next_rx_seq);
+ LOG(ERROR) << StringPrintf("Bad N(S) got:%d, expected:%d", send_seq,
+ p_dlcb->next_rx_seq);
error_flags |= LLCP_FRMR_S_ERROR_FLAG;
} else {
/* if peer device sends more than our receiving window size */
if ((uint8_t)(send_seq - p_dlcb->sent_ack_seq) % LLCP_SEQ_MODULO >=
p_dlcb->local_rw) {
- LLCP_TRACE_ERROR3(
- "llcp_dlc_proc_i_pdu (): Bad N(S):%d >= V(RA):%d + RW(L):%d",
- send_seq, p_dlcb->sent_ack_seq, p_dlcb->local_rw);
+ LOG(ERROR) << StringPrintf("Bad N(S):%d >= V(RA):%d + RW(L):%d",
+ send_seq, p_dlcb->sent_ack_seq,
+ p_dlcb->local_rw);
error_flags |= LLCP_FRMR_S_ERROR_FLAG;
}
@@ -930,9 +912,9 @@
(uint8_t)(p_dlcb->next_tx_seq - p_dlcb->rcvd_ack_seq) %
LLCP_SEQ_MODULO) {
error_flags |= LLCP_FRMR_R_ERROR_FLAG;
- LLCP_TRACE_ERROR3(
- "llcp_dlc_proc_i_pdu (): Bad N(R):%d valid range [V(SA):%d, V(S):%d]",
- rcv_seq, p_dlcb->rcvd_ack_seq, p_dlcb->next_tx_seq);
+ LOG(ERROR) << StringPrintf("Bad N(R):%d valid range [V(SA):%d, V(S):%d]",
+ rcv_seq, p_dlcb->rcvd_ack_seq,
+ p_dlcb->next_tx_seq);
}
/* if any error is found */
@@ -1008,7 +990,7 @@
p_msg->len = LLCP_PDU_AGF_LEN_SIZE + info_len;
p_msg->layer_specific = 0;
} else {
- LLCP_TRACE_ERROR0("llcp_dlc_proc_i_pdu (): out of buffer");
+ LOG(ERROR) << StringPrintf("out of buffer");
}
}
@@ -1032,8 +1014,8 @@
if ((!p_dlcb->is_rx_congested) &&
(p_dlcb->num_rx_i_pdu >= p_dlcb->rx_congest_threshold)) {
- LLCP_TRACE_DEBUG2(
- "llcp_dlc_proc_i_pdu (): congested num_rx_i_pdu=%d, "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "congested num_rx_i_pdu=%d, "
"rx_congest_threshold=%d",
p_dlcb->num_rx_i_pdu, p_dlcb->rx_congest_threshold);
@@ -1043,8 +1025,7 @@
}
}
} else {
- LLCP_TRACE_ERROR2(
- "llcp_dlc_proc_i_pdu (): No data link for SAP (0x%x,0x%x)", dsap, ssap);
+ LOG(ERROR) << StringPrintf("No data link for SAP (0x%x,0x%x)", dsap, ssap);
llcp_util_send_dm(ssap, dsap, LLCP_SAP_DM_REASON_NO_ACTIVE_CONNECTION);
}
@@ -1070,7 +1051,7 @@
tLLCP_SAP_CBACK_DATA cback_data;
bool old_remote_busy;
- LLCP_TRACE_DEBUG0("llcp_dlc_proc_rr_rnr_pdu ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_dlcb = llcp_dlc_find_dlcb_by_sap(dsap, ssap);
if (p_dlcb != NULL) {
@@ -1088,8 +1069,8 @@
(uint8_t)(p_dlcb->next_tx_seq - p_dlcb->rcvd_ack_seq) %
LLCP_SEQ_MODULO) {
error_flags |= LLCP_FRMR_R_ERROR_FLAG;
- LLCP_TRACE_ERROR3(
- "llcp_dlc_proc_rr_rnr_pdu (): Bad N(R):%d valid range [V(SA):%d, "
+ LOG(ERROR) << StringPrintf(
+ "Bad N(R):%d valid range [V(SA):%d, "
"V(S):%d]",
rcv_seq, p_dlcb->rcvd_ack_seq, p_dlcb->next_tx_seq);
}
@@ -1100,18 +1081,17 @@
} else {
p_dlcb->rcvd_ack_seq = rcv_seq;
-#if (BT_TRACE_VERBOSE == TRUE)
- LLCP_TRACE_DEBUG5("LLCP RX - N(S,R):(NA,%d) V(S,SA,R,RA):(%d,%d,%d,%d)",
- rcv_seq, p_dlcb->next_tx_seq, p_dlcb->rcvd_ack_seq,
- p_dlcb->next_rx_seq, p_dlcb->sent_ack_seq);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("LLCP RX - N(S,R):(NA,%d) V(S,SA,R,RA):(%d,%d,%d,%d)",
+ rcv_seq, p_dlcb->next_tx_seq, p_dlcb->rcvd_ack_seq,
+ p_dlcb->next_rx_seq, p_dlcb->sent_ack_seq);
old_remote_busy = p_dlcb->remote_busy;
if (ptype == LLCP_PDU_RNR_TYPE) {
p_dlcb->remote_busy = true;
/* if upper layer hasn't get congestion started notification */
if ((!old_remote_busy) && (!p_dlcb->is_tx_congested)) {
- LLCP_TRACE_WARNING3(
- "llcp_dlc_proc_rr_rnr_pdu (): Data link (SSAP:DSAP=0x%X:0x%X) "
+ LOG(WARNING) << StringPrintf(
+ "Data link (SSAP:DSAP=0x%X:0x%X) "
"congestion start: i_xmit_q.count=%d",
p_dlcb->local_sap, p_dlcb->remote_sap, p_dlcb->i_xmit_q.count);
@@ -1128,8 +1108,8 @@
/* if upper layer hasn't get congestion ended notification and data link
* is not congested */
if ((old_remote_busy) && (!p_dlcb->is_tx_congested)) {
- LLCP_TRACE_WARNING3(
- "llcp_dlc_proc_rr_rnr_pdu (): Data link (SSAP:DSAP=0x%X:0x%X) "
+ LOG(WARNING) << StringPrintf(
+ "Data link (SSAP:DSAP=0x%X:0x%X) "
"congestion end: i_xmit_q.count=%d",
p_dlcb->local_sap, p_dlcb->remote_sap, p_dlcb->i_xmit_q.count);
@@ -1155,9 +1135,7 @@
}
}
} else {
- LLCP_TRACE_ERROR2(
- "llcp_dlc_proc_rr_rnr_pdu (): No data link for SAP (0x%x,0x%x)", dsap,
- ssap);
+ LOG(ERROR) << StringPrintf("No data link for SAP (0x%x,0x%x)", dsap, ssap);
}
}
@@ -1174,13 +1152,11 @@
uint16_t length, uint8_t* p_data) {
tLLCP_DLCB* p_dlcb;
- LLCP_TRACE_DEBUG3("llcp_dlc_proc_rx_pdu (): DSAP:0x%x, PTYPE:0x%x, SSAP:0x%x",
- dsap, ptype, ssap);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("DSAP:0x%x, PTYPE:0x%x, SSAP:0x%x", dsap, ptype, ssap);
if (dsap == LLCP_SAP_LM) {
- LLCP_TRACE_ERROR2(
- "llcp_dlc_proc_rx_pdu (): Invalid SAP:0x%x for PTYPE:0x%x", dsap,
- ptype);
+ LOG(ERROR) << StringPrintf("Invalid SAP:0x%x for PTYPE:0x%x", dsap, ptype);
return;
}
@@ -1214,8 +1190,7 @@
break;
default:
- LLCP_TRACE_ERROR1("llcp_dlc_proc_rx_pdu (): Unexpected PDU type (0x%x)",
- ptype);
+ LOG(ERROR) << StringPrintf("Unexpected PDU type (0x%x)", ptype);
p_dlcb = llcp_dlc_find_dlcb_by_sap(dsap, ssap);
if (p_dlcb) {
@@ -1239,7 +1214,7 @@
uint8_t idx;
bool flush = true;
- LLCP_TRACE_DEBUG0("llcp_dlc_check_to_send_rr_rnr ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/*
** DLC doesn't send RR PDU for each received I PDU because multiple I PDUs
@@ -1283,9 +1258,9 @@
p_dlcb->remote_rw) {
return true;
} else {
- LLCP_TRACE_DEBUG3(
- "llcp_dlc_is_rw_open ():Flow Off, V(S):%d, V(SA):%d, RW(R):%d",
- p_dlcb->next_tx_seq, p_dlcb->rcvd_ack_seq, p_dlcb->remote_rw);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Flow Off, V(S):%d, V(SA):%d, RW(R):%d", p_dlcb->next_tx_seq,
+ p_dlcb->rcvd_ack_seq, p_dlcb->remote_rw);
return false;
}
}
@@ -1304,9 +1279,7 @@
bool flush = true;
tLLCP_SAP_CBACK_DATA data;
-#if (BT_TRACE_VERBOSE == TRUE)
uint8_t send_seq = p_dlcb->next_tx_seq;
-#endif
/* if there is data to send and remote device can receive it */
if ((p_dlcb->i_xmit_q.count) && (!p_dlcb->remote_busy) &&
@@ -1321,16 +1294,13 @@
p_dlcb->next_tx_seq = (p_dlcb->next_tx_seq + 1) % LLCP_SEQ_MODULO;
-#if (BT_TRACE_VERBOSE == TRUE)
- LLCP_TRACE_DEBUG6("LLCP TX - N(S,R):(%d,%d) V(S,SA,R,RA):(%d,%d,%d,%d)",
- send_seq, p_dlcb->next_rx_seq, p_dlcb->next_tx_seq,
- p_dlcb->rcvd_ack_seq, p_dlcb->next_rx_seq,
- p_dlcb->sent_ack_seq);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "LLCP TX - N(S,R):(%d,%d) V(S,SA,R,RA):(%d,%d,%d,%d)", send_seq,
+ p_dlcb->next_rx_seq, p_dlcb->next_tx_seq, p_dlcb->rcvd_ack_seq,
+ p_dlcb->next_rx_seq, p_dlcb->sent_ack_seq);
} else {
- LLCP_TRACE_ERROR2(
- "LLCP - llcp_dlc_get_next_pdu (): offset (%d) must be %d at least",
- p_msg->offset, LLCP_MIN_OFFSET);
+ LOG(ERROR) << StringPrintf("offset (%d) must be %d at least",
+ p_msg->offset, LLCP_MIN_OFFSET);
GKI_freebuf(p_msg);
p_msg = NULL;
}
@@ -1383,7 +1353,6 @@
return 0;
}
-#if (BT_TRACE_VERBOSE == TRUE)
/*******************************************************************************
**
** Function llcp_dlsm_get_state_name
@@ -1451,4 +1420,3 @@
return "???? UNKNOWN EVENT";
}
}
-#endif /* (BT_TRACE_VERBOSE == TRUE) */
diff --git a/src/nfc/llcp/llcp_link.cc b/src/nfc/llcp/llcp_link.cc
index 4799016..0bd0b78 100644
--- a/src/nfc/llcp/llcp_link.cc
+++ b/src/nfc/llcp/llcp_link.cc
@@ -80,9 +80,7 @@
extern unsigned char appl_dta_mode_flag;
/* debug functions type */
-#if (BT_TRACE_VERBOSE == TRUE)
static std::string llcp_pdu_type(uint8_t ptype);
-#endif
/*******************************************************************************
**
@@ -96,8 +94,8 @@
static void llcp_link_start_inactivity_timer(void) {
if ((llcp_cb.lcb.inact_timer.in_use == false) &&
(llcp_cb.lcb.inact_timeout > 0)) {
- LLCP_TRACE_DEBUG1("Start inactivity_timer: %d ms",
- llcp_cb.lcb.inact_timeout);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Start inactivity_timer: %d ms", llcp_cb.lcb.inact_timeout);
nfc_start_quick_timer(&llcp_cb.lcb.inact_timer, NFC_TTYPE_LLCP_LINK_INACT,
((uint32_t)llcp_cb.lcb.inact_timeout) *
@@ -116,7 +114,7 @@
*******************************************************************************/
static void llcp_link_stop_inactivity_timer(void) {
if (llcp_cb.lcb.inact_timer.in_use) {
- LLCP_TRACE_DEBUG0("Stop inactivity_timer");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("Stop inactivity_timer");
nfc_stop_quick_timer(&llcp_cb.lcb.inact_timer);
}
@@ -169,23 +167,23 @@
**
*******************************************************************************/
tLLCP_STATUS llcp_link_activate(tLLCP_ACTIVATE_CONFIG* p_config) {
- LLCP_TRACE_DEBUG0("llcp_link_activate ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* At this point, MAC link activation procedure has been successfully
* completed */
/* The Length Reduction values LRi and LRt MUST be 11b. (254bytes) */
if (p_config->max_payload_size != LLCP_NCI_MAX_PAYL_SIZE) {
- LLCP_TRACE_WARNING2(
- "llcp_link_activate (): max payload size (%d) must be %d bytes",
- p_config->max_payload_size, LLCP_NCI_MAX_PAYL_SIZE);
+ LOG(WARNING) << StringPrintf("max payload size (%d) must be %d bytes",
+ p_config->max_payload_size,
+ LLCP_NCI_MAX_PAYL_SIZE);
}
/* Processing the parametes that have been received with the MAC link
* activation */
if (llcp_link_parse_gen_bytes(p_config->gen_bytes_len,
p_config->p_gen_bytes) == false) {
- LLCP_TRACE_ERROR0("llcp_link_activate (): Failed to parse general bytes");
+ LOG(ERROR) << StringPrintf("Failed to parse general bytes");
/* For LLCP DTA test, In case of bad magic bytes normal p2p communication is
* expected,but in case of wrong magic bytes in ATR_REQ, LLC layer will be
* disconnected but P2P connection is expected to be in connected state
@@ -224,8 +222,8 @@
*/
if ((p_config->is_initiator) &&
(llcp_link_rwt[p_config->waiting_time] > llcp_cb.lcb.peer_lto)) {
- LLCP_TRACE_WARNING3(
- "llcp_link_activate (): WT (%d, %dms) must be less than or equal to "
+ LOG(WARNING) << StringPrintf(
+ "WT (%d, %dms) must be less than or equal to "
"LTO (%dms)",
p_config->waiting_time, llcp_link_rwt[p_config->waiting_time],
llcp_cb.lcb.peer_lto);
@@ -239,7 +237,7 @@
}
/* LLCP version number agreement */
if (llcp_link_version_agreement() == false) {
- LLCP_TRACE_ERROR0("llcp_link_activate (): Failed to agree version");
+ LOG(ERROR) << StringPrintf("Failed to agree version");
(*llcp_cb.lcb.p_link_cback)(LLCP_LINK_ACTIVATION_FAILED_EVT,
LLCP_LINK_VERSION_FAILED);
@@ -269,7 +267,7 @@
** symmetry procedure.
*/
if (llcp_cb.lcb.is_initiator) {
- LLCP_TRACE_DEBUG0("llcp_link_activate (): Connected as Initiator");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("Connected as Initiator");
llcp_cb.lcb.inact_timeout = llcp_cb.lcb.inact_timeout_init;
llcp_cb.lcb.symm_state = LLCP_LINK_SYMM_LOCAL_XMIT_NEXT;
@@ -284,7 +282,7 @@
llcp_link_send_SYMM();
}
} else {
- LLCP_TRACE_DEBUG0("llcp_link_activate (): Connected as Target");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("Connected as Target");
llcp_cb.lcb.inact_timeout = llcp_cb.lcb.inact_timeout_target;
llcp_cb.lcb.symm_state = LLCP_LINK_SYMM_REMOTE_XMIT_NEXT;
@@ -352,8 +350,8 @@
if ((llcp_cb.lcb.symm_delay > 0) &&
(llcp_cb.lcb.symm_state == LLCP_LINK_SYMM_LOCAL_XMIT_NEXT)) {
/* upper layer doesn't have anything to send */
- LLCP_TRACE_DEBUG0(
- "llcp_link_process_link_timeout (): LEVT_TIMEOUT in state of "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "LEVT_TIMEOUT in state of "
"LLCP_LINK_SYMM_LOCAL_XMIT_NEXT");
llcp_link_send_SYMM();
@@ -365,8 +363,8 @@
llcp_link_start_inactivity_timer();
}
} else {
- LLCP_TRACE_ERROR0(
- "llcp_link_process_link_timeout (): LEVT_TIMEOUT in state of "
+ LOG(ERROR) << StringPrintf(
+ "LEVT_TIMEOUT in state of "
"LLCP_LINK_SYMM_REMOTE_XMIT_NEXT");
llcp_link_deactivate(LLCP_LINK_TIMEOUT);
}
@@ -391,7 +389,7 @@
tLLCP_DLCB* p_dlcb;
tLLCP_APP_CB* p_app_cb;
- LLCP_TRACE_DEBUG1("llcp_link_deactivate () reason = 0x%x", reason);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("reason = 0x%x", reason);
/* Release any held buffers in signaling PDU queue */
while (llcp_cb.lcb.sig_xmit_q.p_first)
@@ -448,8 +446,8 @@
llcp_util_send_disc(LLCP_SAP_LM, LLCP_SAP_LM);
/* Wait until DISC is sent to peer */
- LLCP_TRACE_DEBUG0(
- "llcp_link_deactivate (): Wait until DISC is sent to peer");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Wait until DISC is sent to peer");
llcp_cb.lcb.link_state = LLCP_LINK_STATE_DEACTIVATING;
@@ -527,8 +525,8 @@
peer_minor_version = LLCP_GET_MINOR_VERSION(llcp_cb.lcb.peer_version);
if (peer_major_version < LLCP_MIN_MAJOR_VERSION) {
- LLCP_TRACE_ERROR1(
- "llcp_link_version_agreement(): unsupported peer version number. Peer "
+ LOG(ERROR) << StringPrintf(
+ "unsupported peer version number. Peer "
"Major Version:%d",
peer_major_version);
return false;
@@ -550,7 +548,7 @@
llcp_cb.lcb.agreed_minor_version = LLCP_VERSION_MINOR;
}
- LLCP_TRACE_DEBUG6(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"local version:%d.%d, remote version:%d.%d, agreed version:%d.%d",
LLCP_VERSION_MAJOR, LLCP_VERSION_MINOR, peer_major_version,
peer_minor_version, llcp_cb.lcb.agreed_major_version,
@@ -614,7 +612,7 @@
/* overall buffer usage is high */
llcp_cb.overall_tx_congested = true;
- LLCP_TRACE_WARNING2(
+ LOG(WARNING) << StringPrintf(
"overall tx congestion start: total_tx_ui_pdu=%d, total_tx_i_pdu=%d",
llcp_cb.total_tx_ui_pdu, llcp_cb.total_tx_i_pdu);
@@ -634,7 +632,7 @@
if (!p_app_cb->is_ui_tx_congested) {
p_app_cb->is_ui_tx_congested = true;
- LLCP_TRACE_WARNING2(
+ LOG(WARNING) << StringPrintf(
"Logical link (SAP=0x%X) congestion start: count=%d", sap,
p_app_cb->ui_xmit_q.count);
@@ -653,7 +651,7 @@
(llcp_cb.dlcb[idx].is_tx_congested == false)) {
llcp_cb.dlcb[idx].is_tx_congested = true;
- LLCP_TRACE_WARNING3(
+ LOG(WARNING) << StringPrintf(
"Data link (SSAP:DSAP=0x%X:0x%X) congestion start: count=%d",
llcp_cb.dlcb[idx].local_sap, llcp_cb.dlcb[idx].remote_sap,
llcp_cb.dlcb[idx].i_xmit_q.count);
@@ -689,7 +687,7 @@
/* overall congestion is cleared */
llcp_cb.overall_tx_congested = false;
- LLCP_TRACE_WARNING2(
+ LOG(WARNING) << StringPrintf(
"overall tx congestion end: total_tx_ui_pdu=%d, total_tx_i_pdu=%d",
llcp_cb.total_tx_ui_pdu, llcp_cb.total_tx_i_pdu);
} else {
@@ -725,8 +723,9 @@
/* if it was congested but now tx queue count is below threshold */
p_app_cb->is_ui_tx_congested = false;
- LLCP_TRACE_DEBUG2("Logical link (SAP=0x%X) congestion end: count=%d",
- sap, p_app_cb->ui_xmit_q.count);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Logical link (SAP=0x%X) congestion end: count=%d", sap,
+ p_app_cb->ui_xmit_q.count);
data.congest.local_sap = sap;
p_app_cb->p_app_cback(&data);
@@ -770,7 +769,7 @@
llcp_cb.dlcb[idx].is_tx_congested = false;
if (llcp_cb.dlcb[idx].remote_busy == false) {
- LLCP_TRACE_DEBUG3(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"Data link (SSAP:DSAP=0x%X:0x%X) congestion end: count=%d",
llcp_cb.dlcb[idx].local_sap, llcp_cb.dlcb[idx].remote_sap,
llcp_cb.dlcb[idx].i_xmit_q.count);
@@ -875,8 +874,8 @@
if (llcp_cb.lcb.symm_state == LLCP_LINK_SYMM_LOCAL_XMIT_NEXT ||
(appl_dta_mode_flag &&
llcp_cb.lcb.link_state == LLCP_LINK_STATE_DEACTIVATING)) {
- LLCP_TRACE_DEBUG0(
- "llcp_link_check_send_data () in state of "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "in state of "
"LLCP_LINK_SYMM_LOCAL_XMIT_NEXT");
p_pdu = llcp_link_build_next_pdu(NULL);
@@ -973,9 +972,8 @@
/* if application is registered and expecting UI PDU on logical data link */
if ((p_app_cb) && (p_app_cb->p_app_cback) &&
(p_app_cb->link_type & LLCP_LINK_TYPE_LOGICAL_DATA_LINK)) {
- LLCP_TRACE_DEBUG2(
- "llcp_link_proc_ui_pdu () Local SAP:0x%x, Remote SAP:0x%x", local_sap,
- remote_sap);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Local SAP:0x%x, Remote SAP:0x%x", local_sap, remote_sap);
/* if this is not from AGF PDU */
if (p_msg) {
@@ -1038,7 +1036,7 @@
p_msg->len = LLCP_PDU_AGF_LEN_SIZE + ui_pdu_length;
p_msg->layer_specific = 0;
} else {
- LLCP_TRACE_ERROR0("llcp_link_proc_ui_pdu (): out of buffer");
+ LOG(ERROR) << StringPrintf("out of buffer");
}
}
@@ -1050,8 +1048,8 @@
}
if (p_app_cb->ui_rx_q.count > llcp_cb.ll_rx_congest_start) {
- LLCP_TRACE_WARNING2(
- "llcp_link_proc_ui_pdu (): SAP:0x%x, rx link is congested (%d), "
+ LOG(WARNING) << StringPrintf(
+ "SAP:0x%x, rx link is congested (%d), "
"discard oldest UI PDU",
local_sap, p_app_cb->ui_rx_q.count);
@@ -1067,8 +1065,7 @@
(*p_app_cb->p_app_cback)(&data);
}
} else {
- LLCP_TRACE_ERROR1("llcp_link_proc_ui_pdu (): Unregistered SAP:0x%x",
- local_sap);
+ LOG(ERROR) << StringPrintf("Unregistered SAP:0x%x", local_sap);
if (p_msg) {
GKI_freebuf(p_msg);
@@ -1117,7 +1114,7 @@
}
if (agf_length != 0) {
- LLCP_TRACE_ERROR0("llcp_link_proc_agf_pdu (): Received invalid AGF PDU");
+ LOG(ERROR) << StringPrintf("Received invalid AGF PDU");
GKI_freebuf(p_agf);
return;
}
@@ -1142,12 +1139,10 @@
ptype = (uint8_t)(LLCP_GET_PTYPE(pdu_hdr));
ssap = LLCP_GET_SSAP(pdu_hdr);
-#if (BT_TRACE_VERBOSE == TRUE)
- LLCP_TRACE_DEBUG4(
- "llcp_link_proc_agf_pdu (): Rx DSAP:0x%x, PTYPE:%s (0x%x), SSAP:0x%x "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Rx DSAP:0x%x, PTYPE:%s (0x%x), SSAP:0x%x "
"in AGF",
dsap, llcp_pdu_type(ptype).c_str(), ptype, ssap);
-#endif
if ((ptype == LLCP_PDU_DISC_TYPE) && (dsap == LLCP_SAP_LM) &&
(ssap == LLCP_SAP_LM)) {
@@ -1155,11 +1150,9 @@
llcp_link_deactivate(LLCP_LINK_REMOTE_INITIATED);
return;
} else if (ptype == LLCP_PDU_SYMM_TYPE) {
- LLCP_TRACE_ERROR0(
- "llcp_link_proc_agf_pdu (): SYMM PDU exchange shall not be in AGF");
+ LOG(ERROR) << StringPrintf("SYMM PDU exchange shall not be in AGF");
} else if (ptype == LLCP_PDU_PAX_TYPE) {
- LLCP_TRACE_ERROR0(
- "llcp_link_proc_agf_pdu (): PAX PDU exchange shall not be used");
+ LOG(ERROR) << StringPrintf("PAX PDU exchange shall not be used");
} else if (ptype == LLCP_PDU_SNL_TYPE) {
llcp_sdp_proc_snl((uint16_t)(pdu_length - LLCP_PDU_HEADER_SIZE), p_info);
} else if ((ptype == LLCP_PDU_UI_TYPE) &&
@@ -1197,8 +1190,7 @@
switch (ptype) {
case LLCP_PDU_PAX_TYPE:
- LLCP_TRACE_ERROR0(
- "llcp_link_proc_rx_pdu (); PAX PDU exchange shall not be used");
+ LOG(ERROR) << StringPrintf("; PAX PDU exchange shall not be used");
break;
case LLCP_PDU_DISC_TYPE:
@@ -1277,7 +1269,8 @@
llcp_link_process_link_timeout();
} else {
if (p_msg->len < LLCP_PDU_HEADER_SIZE) {
- LLCP_TRACE_ERROR1("Received too small PDU: got %d bytes", p_msg->len);
+ LOG(ERROR) << StringPrintf("Received too small PDU: got %d bytes",
+ p_msg->len);
frame_error = true;
} else {
p = (uint8_t*)(p_msg + 1) + p_msg->offset;
@@ -1294,7 +1287,8 @@
info_length =
p_msg->len - LLCP_PDU_HEADER_SIZE - LLCP_SEQUENCE_SIZE;
} else {
- LLCP_TRACE_ERROR0("Received I/RR/RNR PDU without sequence");
+ LOG(ERROR) << StringPrintf(
+ "Received I/RR/RNR PDU without sequence");
frame_error = true;
}
} else {
@@ -1303,22 +1297,21 @@
/* check if length of information is bigger than link MIU */
if ((!frame_error) && (info_length > llcp_cb.lcb.local_link_miu)) {
- LLCP_TRACE_ERROR2("Received exceeding MIU (%d): got %d bytes SDU",
- llcp_cb.lcb.local_link_miu, info_length);
+ LOG(ERROR) << StringPrintf(
+ "Received exceeding MIU (%d): got %d bytes SDU",
+ llcp_cb.lcb.local_link_miu, info_length);
frame_error = true;
} else {
-#if (BT_TRACE_VERBOSE == TRUE)
- LLCP_TRACE_DEBUG4(
- "llcp_link_proc_rx_data (): DSAP:0x%x, PTYPE:%s (0x%x), "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "DSAP:0x%x, PTYPE:%s (0x%x), "
"SSAP:0x%x",
dsap, llcp_pdu_type(ptype).c_str(), ptype, ssap);
-#endif
if (ptype == LLCP_PDU_SYMM_TYPE) {
if (info_length > 0) {
- LLCP_TRACE_ERROR1("Received extra data (%d bytes) in SYMM PDU",
- info_length);
+ LOG(ERROR) << StringPrintf(
+ "Received extra data (%d bytes) in SYMM PDU", info_length);
frame_error = true;
}
} else {
@@ -1337,7 +1330,7 @@
llcp_link_check_send_data();
}
} else {
- LLCP_TRACE_ERROR0("Received PDU in state of SYMM_MUST_XMIT_NEXT");
+ LOG(ERROR) << StringPrintf("Received PDU in state of SYMM_MUST_XMIT_NEXT");
}
if (free_buffer) GKI_freebuf(p_msg);
@@ -1473,7 +1466,7 @@
uint8_t *p, ptype;
uint16_t next_pdu_length, pdu_hdr;
- LLCP_TRACE_DEBUG0("llcp_link_build_next_pdu ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* add any pending SNL PDU into sig_xmit_q for transmitting */
llcp_sdp_check_send_snl();
@@ -1524,7 +1517,7 @@
GKI_freebuf(p_msg);
p_msg = p_agf;
} else {
- LLCP_TRACE_ERROR0("llcp_link_build_next_pdu (): Out of buffer");
+ LOG(ERROR) << StringPrintf("Out of buffer");
return p_msg;
}
} else {
@@ -1571,9 +1564,7 @@
**
*******************************************************************************/
static void llcp_link_send_to_lower(NFC_HDR* p_pdu) {
-#if (BT_TRACE_PROTOCOL == TRUE)
DispLLCP(p_pdu, false);
-#endif
llcp_cb.lcb.symm_state = LLCP_LINK_SYMM_REMOTE_XMIT_NEXT;
@@ -1592,9 +1583,7 @@
void llcp_link_connection_cback(uint8_t conn_id, tNFC_CONN_EVT event,
tNFC_CONN* p_data) {
if (event == NFC_DATA_CEVT) {
-#if (BT_TRACE_PROTOCOL == TRUE)
DispLLCP((NFC_HDR*)p_data->data.p_data, true);
-#endif
if (llcp_cb.lcb.link_state == LLCP_LINK_STATE_DEACTIVATED) {
/* respoding SYMM while LLCP is deactivated but RF link is not deactivated
* yet */
@@ -1644,7 +1633,6 @@
*/
}
-#if (BT_TRACE_VERBOSE == TRUE)
/*******************************************************************************
**
** Function llcp_pdu_type
@@ -1686,5 +1674,3 @@
return "RESERVED";
}
}
-
-#endif
diff --git a/src/nfc/llcp/llcp_main.cc b/src/nfc/llcp/llcp_main.cc
index 577777c..f755c5b 100644
--- a/src/nfc/llcp/llcp_main.cc
+++ b/src/nfc/llcp/llcp_main.cc
@@ -48,9 +48,7 @@
memset(&llcp_cb, 0, sizeof(tLLCP_CB));
- llcp_cb.trace_level = LLCP_INITIAL_TRACE_LEVEL;
-
- LLCP_TRACE_DEBUG0("LLCP - llcp_init ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
llcp_cb.lcb.local_link_miu =
(LLCP_MIU <= LLCP_MAX_MIU ? LLCP_MIU : LLCP_MAX_MIU);
@@ -82,7 +80,7 @@
llcp_cb.max_num_ll_rx_buff =
(uint8_t)((llcp_cb.num_rx_buff * LLCP_LL_RX_BUFF_LIMIT) / 100);
- LLCP_TRACE_DEBUG4(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"num_rx_buff = %d, rx_congest_start = %d, rx_congest_end = %d, "
"max_num_ll_rx_buff = %d",
llcp_cb.num_rx_buff, llcp_cb.overall_rx_congest_start,
@@ -95,8 +93,9 @@
llcp_cb.max_num_ll_tx_buff =
(uint8_t)((llcp_cb.max_num_tx_buff * LLCP_LL_TX_BUFF_LIMIT) / 100);
- LLCP_TRACE_DEBUG2("max_num_tx_buff = %d, max_num_ll_tx_buff = %d",
- llcp_cb.max_num_tx_buff, llcp_cb.max_num_ll_tx_buff);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("max_num_tx_buff = %d, max_num_ll_tx_buff = %d",
+ llcp_cb.max_num_tx_buff, llcp_cb.max_num_ll_tx_buff);
llcp_cb.ll_tx_uncongest_ntf_start_sap = LLCP_SAP_SDP + 1;
@@ -117,7 +116,7 @@
uint8_t sap;
tLLCP_APP_CB* p_app_cb;
- LLCP_TRACE_DEBUG0("LLCP - llcp_cleanup ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
for (sap = LLCP_SAP_SDP; sap < LLCP_NUM_SAPS; sap++) {
p_app_cb = llcp_util_get_app_cb(sap);
@@ -143,7 +142,8 @@
void llcp_process_timeout(TIMER_LIST_ENT* p_tle) {
uint8_t reason;
- LLCP_TRACE_DEBUG1("llcp_process_timeout: event=%d", p_tle->event);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("llcp_process_timeout: event=%d", p_tle->event);
switch (p_tle->event) {
case NFC_TTYPE_LLCP_LINK_MANAGER:
diff --git a/src/nfc/llcp/llcp_sdp.cc b/src/nfc/llcp/llcp_sdp.cc
index 2c40263..daa88a9 100644
--- a/src/nfc/llcp/llcp_sdp.cc
+++ b/src/nfc/llcp/llcp_sdp.cc
@@ -63,7 +63,7 @@
uint8_t* p;
if (llcp_cb.sdp_cb.p_snl) {
- LLCP_TRACE_DEBUG0("SDP: llcp_sdp_check_send_snl ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
llcp_cb.sdp_cb.p_snl->len += LLCP_PDU_HEADER_SIZE;
llcp_cb.sdp_cb.p_snl->offset -= LLCP_PDU_HEADER_SIZE;
@@ -124,8 +124,8 @@
uint16_t name_len;
uint16_t available_bytes;
- LLCP_TRACE_DEBUG2("llcp_sdp_send_sdreq (): tid=0x%x, ServiceName=%s", tid,
- p_name);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("tid=0x%x, ServiceName=%s", tid, p_name);
/* if there is no pending SNL */
if (!llcp_cb.sdp_cb.p_snl) {
@@ -219,7 +219,8 @@
tLLCP_STATUS status;
uint16_t available_bytes;
- LLCP_TRACE_DEBUG2("llcp_sdp_send_sdres (): tid=0x%x, SAP=0x%x", tid, sap);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("tid=0x%x, SAP=0x%x", tid, sap);
/* if there is no pending SNL */
if (!llcp_cb.sdp_cb.p_snl) {
@@ -318,7 +319,8 @@
static void llcp_sdp_return_sap(uint8_t tid, uint8_t sap) {
uint8_t i;
- LLCP_TRACE_DEBUG2("llcp_sdp_return_sap (): tid=0x%x, SAP=0x%x", tid, sap);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("tid=0x%x, SAP=0x%x", tid, sap);
for (i = 0; i < LLCP_MAX_SDP_TRANSAC; i++) {
if ((llcp_cb.sdp_cb.transac[i].p_cback) &&
@@ -344,7 +346,7 @@
void llcp_sdp_proc_deactivation(void) {
uint8_t i;
- LLCP_TRACE_DEBUG0("llcp_sdp_proc_deactivation ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
for (i = 0; i < LLCP_MAX_SDP_TRANSAC; i++) {
if (llcp_cb.sdp_cb.transac[i].p_cback) {
@@ -377,13 +379,13 @@
tLLCP_STATUS llcp_sdp_proc_snl(uint16_t sdu_length, uint8_t* p) {
uint8_t type, length, tid, sap, *p_value;
- LLCP_TRACE_DEBUG0("llcp_sdp_proc_snl ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if ((llcp_cb.lcb.agreed_major_version < LLCP_MIN_SNL_MAJOR_VERSION) ||
((llcp_cb.lcb.agreed_major_version == LLCP_MIN_SNL_MAJOR_VERSION) &&
(llcp_cb.lcb.agreed_minor_version < LLCP_MIN_SNL_MINOR_VERSION))) {
- LLCP_TRACE_DEBUG0(
- "llcp_sdp_proc_snl(): version number less than 1.1, SNL not "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "version number less than 1.1, SNL not "
"supported.");
return LLCP_STATUS_FAIL;
}
@@ -406,10 +408,11 @@
* SNL PDU i'e with improper service name "urn:nfc:sn:dta-co-echo-in",
* the IUT should not send any PDU except SYMM PDU */
if (appl_dta_mode_flag == 1 && sap == 0x00) {
- LLCP_TRACE_DEBUG2("%s: In dta mode sap == 0x00 p_value = %s",
- __func__, p_value);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "%s: In dta mode sap == 0x00 p_value = %s", __func__, p_value);
if ((length - 1) == strlen((const char*)p_value)) {
- LLCP_TRACE_DEBUG1("%s: Strings are not equal", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: Strings are not equal", __func__);
llcp_sdp_send_sdres(tid, sap);
}
} else {
@@ -419,14 +422,14 @@
/*For P2P in LLCP mode TC_CTO_TAR_BI_03_x(x=3) fix*/
if (appl_dta_mode_flag == 1 &&
((nfa_dm_cb.eDtaMode & 0x0F) == NFA_DTA_LLCP_MODE)) {
- LLCP_TRACE_ERROR1("%s: Calling llcp_sdp_send_sdres", __func__);
+ LOG(ERROR) << StringPrintf("%s: Calling llcp_sdp_send_sdres",
+ __func__);
tid = 0x01;
sap = 0x00;
llcp_sdp_send_sdres(tid, sap);
}
- LLCP_TRACE_ERROR1(
- "llcp_sdp_proc_snl (): bad length (%d) in LLCP_SDREQ_TYPE",
- length);
+ LOG(ERROR) << StringPrintf("bad length (%d) in LLCP_SDREQ_TYPE",
+ length);
}
break;
@@ -439,15 +442,13 @@
BE_STREAM_TO_UINT8(sap, p_value);
llcp_sdp_return_sap(tid, sap);
} else {
- LLCP_TRACE_ERROR1(
- "llcp_sdp_proc_snl (): bad length (%d) in LLCP_SDRES_TYPE",
- length);
+ LOG(ERROR) << StringPrintf("bad length (%d) in LLCP_SDRES_TYPE",
+ length);
}
break;
default:
- LLCP_TRACE_WARNING1(
- "llcp_sdp_proc_snl (): Unknown type (0x%x) is ignored", type);
+ LOG(WARNING) << StringPrintf("Unknown type (0x%x) is ignored", type);
break;
}
@@ -461,7 +462,7 @@
}
if (sdu_length) {
- LLCP_TRACE_ERROR0("llcp_sdp_proc_snl (): Bad format of SNL");
+ LOG(ERROR) << StringPrintf("Bad format of SNL");
return LLCP_STATUS_FAIL;
} else {
return LLCP_STATUS_SUCCESS;
diff --git a/src/nfc/llcp/llcp_util.cc b/src/nfc/llcp/llcp_util.cc
index afd5749..35204a8 100644
--- a/src/nfc/llcp/llcp_util.cc
+++ b/src/nfc/llcp/llcp_util.cc
@@ -51,7 +51,8 @@
case LLCP_VERSION_TYPE:
BE_STREAM_TO_UINT8(param_len, p);
BE_STREAM_TO_UINT8(llcp_cb.lcb.peer_version, p);
- LLCP_TRACE_DEBUG1("Peer Version - 0x%02X", llcp_cb.lcb.peer_version);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Peer Version - 0x%02X", llcp_cb.lcb.peer_version);
break;
case LLCP_MIUX_TYPE:
@@ -59,31 +60,34 @@
BE_STREAM_TO_UINT16(llcp_cb.lcb.peer_miu, p);
llcp_cb.lcb.peer_miu &= LLCP_MIUX_MASK;
llcp_cb.lcb.peer_miu += LLCP_DEFAULT_MIU;
- LLCP_TRACE_DEBUG1("Peer MIU - %d bytes", llcp_cb.lcb.peer_miu);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Peer MIU - %d bytes", llcp_cb.lcb.peer_miu);
break;
case LLCP_WKS_TYPE:
BE_STREAM_TO_UINT8(param_len, p);
BE_STREAM_TO_UINT16(llcp_cb.lcb.peer_wks, p);
- LLCP_TRACE_DEBUG1("Peer WKS - 0x%04X", llcp_cb.lcb.peer_wks);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Peer WKS - 0x%04X", llcp_cb.lcb.peer_wks);
break;
case LLCP_LTO_TYPE:
BE_STREAM_TO_UINT8(param_len, p);
BE_STREAM_TO_UINT8(llcp_cb.lcb.peer_lto, p);
llcp_cb.lcb.peer_lto *= LLCP_LTO_UNIT; /* 10ms unit */
- LLCP_TRACE_DEBUG1("Peer LTO - %d ms", llcp_cb.lcb.peer_lto);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Peer LTO - %d ms", llcp_cb.lcb.peer_lto);
break;
case LLCP_OPT_TYPE:
BE_STREAM_TO_UINT8(param_len, p);
BE_STREAM_TO_UINT8(llcp_cb.lcb.peer_opt, p);
- LLCP_TRACE_DEBUG1("Peer OPT - 0x%02X", llcp_cb.lcb.peer_opt);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Peer OPT - 0x%02X", llcp_cb.lcb.peer_opt);
break;
default:
- LLCP_TRACE_ERROR1(
- "llcp_util_parse_link_params (): Unexpected type 0x%x", param_type);
+ LOG(ERROR) << StringPrintf("Unexpected type 0x%x", param_type);
BE_STREAM_TO_UINT8(param_len, p);
p += param_len;
break;
@@ -92,7 +96,7 @@
if (length >= param_len + 1)
length -= param_len + 1;
else {
- LLCP_TRACE_ERROR0("llcp_util_parse_link_params (): Bad LTV's");
+ LOG(ERROR) << StringPrintf("Bad LTV's");
return false;
}
}
@@ -134,7 +138,7 @@
llcp_cb.ll_tx_congest_end = 0;
}
- LLCP_TRACE_DEBUG4(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"num_logical_data_link=%d, ll_tx_congest_start=%d, ll_tx_congest_end=%d, "
"ll_rx_congest_start=%d",
llcp_cb.num_logical_data_link, llcp_cb.ll_tx_congest_start,
@@ -172,9 +176,9 @@
llcp_cb.dlcb[idx].rx_congest_threshold = LLCP_DL_MIN_RX_CONGEST;
}
- LLCP_TRACE_DEBUG3("DLC[%d], local_rw=%d, rx_congest_threshold=%d", idx,
- llcp_cb.dlcb[idx].local_rw,
- llcp_cb.dlcb[idx].rx_congest_threshold);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "DLC[%d], local_rw=%d, rx_congest_threshold=%d", idx,
+ llcp_cb.dlcb[idx].local_rw, llcp_cb.dlcb[idx].rx_congest_threshold);
}
}
}
@@ -196,8 +200,8 @@
/* check if rx congestion clear */
if (llcp_cb.total_rx_ui_pdu + llcp_cb.total_rx_i_pdu <=
llcp_cb.overall_rx_congest_end) {
- LLCP_TRACE_DEBUG3(
- "llcp_util_check_rx_congested_status (): rx link is uncongested, "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "rx link is uncongested, "
"%d+%d <= %d",
llcp_cb.total_rx_ui_pdu, llcp_cb.total_rx_i_pdu,
llcp_cb.overall_rx_congest_end);
@@ -216,8 +220,8 @@
/* check if rx link is congested */
if (llcp_cb.total_rx_ui_pdu + llcp_cb.total_rx_i_pdu >=
llcp_cb.overall_rx_congest_start) {
- LLCP_TRACE_WARNING3(
- "llcp_util_check_rx_congested_status (): rx link is congested, %d+%d "
+ LOG(WARNING) << StringPrintf(
+ "rx link is congested, %d+%d "
">= %d",
llcp_cb.total_rx_ui_pdu, llcp_cb.total_rx_i_pdu,
llcp_cb.overall_rx_congest_start);
@@ -269,8 +273,9 @@
/* or notify uncongestion later */
p_app_cb->is_ui_tx_congested = true;
- LLCP_TRACE_WARNING2("Logical link (SAP=0x%X) congested: ui_xmit_q.count=%d",
- ssap, p_app_cb->ui_xmit_q.count);
+ LOG(WARNING) << StringPrintf(
+ "Logical link (SAP=0x%X) congested: ui_xmit_q.count=%d", ssap,
+ p_app_cb->ui_xmit_q.count);
status = LLCP_STATUS_CONGESTED;
}
@@ -318,9 +323,8 @@
tLLCP_DLCB* p_dlcb = NULL;
int idx;
- LLCP_TRACE_DEBUG2(
- "llcp_util_allocate_data_link (): reg_sap = 0x%x, remote_sap = 0x%x",
- reg_sap, remote_sap);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("reg_sap = 0x%x, remote_sap = 0x%x", reg_sap, remote_sap);
for (idx = 0; idx < LLCP_MAX_DATA_LINK; idx++) {
if (llcp_cb.dlcb[idx].state == LLCP_DLC_STATE_IDLE) {
@@ -332,7 +336,7 @@
}
if (!p_dlcb) {
- LLCP_TRACE_ERROR0("llcp_util_allocate_data_link (): Out of DLCB");
+ LOG(ERROR) << StringPrintf("Out of DLCB");
} else {
p_dlcb->p_app_cb = llcp_util_get_app_cb(reg_sap);
p_dlcb->local_sap = reg_sap;
@@ -342,8 +346,8 @@
/* this is for inactivity timer and congestion control. */
llcp_cb.num_data_link_connection++;
- LLCP_TRACE_DEBUG3(
- "llcp_util_allocate_data_link (): local_sap = 0x%x, remote_sap = 0x%x, "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "local_sap = 0x%x, remote_sap = 0x%x, "
"num_data_link_connection = %d",
p_dlcb->local_sap, p_dlcb->remote_sap,
llcp_cb.num_data_link_connection);
@@ -362,8 +366,8 @@
******************************************************************************/
void llcp_util_deallocate_data_link(tLLCP_DLCB* p_dlcb) {
if (p_dlcb) {
- LLCP_TRACE_DEBUG1("llcp_util_deallocate_data_link (): local_sap = 0x%x",
- p_dlcb->local_sap);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("local_sap = 0x%x", p_dlcb->local_sap);
if (p_dlcb->state != LLCP_DLC_STATE_IDLE) {
nfc_stop_quick_timer(&p_dlcb->timer);
@@ -375,9 +379,8 @@
llcp_cb.num_data_link_connection--;
}
- LLCP_TRACE_DEBUG1(
- "llcp_util_deallocate_data_link (): num_data_link_connection = %d",
- llcp_cb.num_data_link_connection);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "num_data_link_connection = %d", llcp_cb.num_data_link_connection);
}
}
}
@@ -476,8 +479,8 @@
p_params->miu &= LLCP_MIUX_MASK;
p_params->miu += LLCP_DEFAULT_MIU;
- LLCP_TRACE_DEBUG1("llcp_util_parse_connect (): LLCP_MIUX_TYPE:%d",
- p_params->miu);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("LLCP_MIUX_TYPE:%d", p_params->miu);
break;
case LLCP_RW_TYPE:
@@ -485,8 +488,8 @@
BE_STREAM_TO_UINT8(p_params->rw, p);
p_params->rw &= 0x0F;
- LLCP_TRACE_DEBUG1("llcp_util_parse_connect (): LLCP_RW_TYPE:%d",
- p_params->rw);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("LLCP_RW_TYPE:%d", p_params->rw);
break;
case LLCP_SN_TYPE:
@@ -504,13 +507,12 @@
}
p += param_len;
- LLCP_TRACE_DEBUG1("llcp_util_parse_connect (): LLCP_SN_TYPE:<%s>",
- p_params->sn);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("LLCP_SN_TYPE:<%s>", p_params->sn);
break;
default:
- LLCP_TRACE_ERROR1("llcp_util_parse_connect (): Unexpected type 0x%x",
- param_type);
+ LOG(ERROR) << StringPrintf("Unexpected type 0x%x", param_type);
BE_STREAM_TO_UINT8(param_len, p);
p += param_len;
break;
@@ -520,7 +522,7 @@
if (length >= param_len + 1) {
length -= param_len + 1;
} else {
- LLCP_TRACE_ERROR0("llcp_util_parse_connect (): Bad LTV's");
+ LOG(ERROR) << StringPrintf("Bad LTV's");
return LLCP_STATUS_FAIL;
}
}
@@ -610,7 +612,8 @@
(*p_miu) &= LLCP_MIUX_MASK;
(*p_miu) += LLCP_DEFAULT_MIU;
- LLCP_TRACE_DEBUG1("llcp_util_parse_cc (): LLCP_MIUX_TYPE:%d", *p_miu);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("LLCP_MIUX_TYPE:%d", *p_miu);
break;
case LLCP_RW_TYPE:
@@ -618,12 +621,12 @@
BE_STREAM_TO_UINT8((*p_rw), p);
(*p_rw) &= 0x0F;
- LLCP_TRACE_DEBUG1("llcp_util_parse_cc (): LLCP_RW_TYPE:%d", *p_rw);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("LLCP_RW_TYPE:%d", *p_rw);
break;
default:
- LLCP_TRACE_ERROR1("llcp_util_parse_cc (): Unexpected type 0x%x",
- param_type);
+ LOG(ERROR) << StringPrintf("Unexpected type 0x%x", param_type);
BE_STREAM_TO_UINT8(param_len, p);
p += param_len;
break;
@@ -632,7 +635,7 @@
if (length >= param_len + 1)
length -= param_len + 1;
else {
- LLCP_TRACE_ERROR0("llcp_util_parse_cc (): Bad LTV's");
+ LOG(ERROR) << StringPrintf("Bad LTV's");
return LLCP_STATUS_FAIL;
}
}
@@ -736,7 +739,7 @@
return LLCP_STATUS_SUCCESS;
} else {
- LLCP_TRACE_ERROR0("llcp_util_send_frmr (): Out of resource");
+ LOG(ERROR) << StringPrintf("Out of resource");
return LLCP_STATUS_FAIL;
}
}
@@ -775,8 +778,8 @@
if ((p_dlcb->local_busy) || (p_dlcb->is_rx_congested) ||
(llcp_cb.overall_rx_congested)) {
- LLCP_TRACE_DEBUG3(
- "llcp_util_send_rr_rnr (): "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ ""
"local_busy=%d,is_rx_congested=%d,overall_rx_congested=%d",
p_dlcb->local_busy, p_dlcb->is_rx_congested,
llcp_cb.overall_rx_congested);
@@ -809,16 +812,14 @@
UINT8_TO_BE_STREAM(p, rcv_seq);
-#if (BT_TRACE_VERBOSE == TRUE)
- LLCP_TRACE_DEBUG5("LLCP TX - N(S,R):(NA,%d) V(S,SA,R,RA):(%d,%d,%d,%d)",
- p_dlcb->next_rx_seq, p_dlcb->next_tx_seq,
- p_dlcb->rcvd_ack_seq, p_dlcb->next_rx_seq,
- p_dlcb->sent_ack_seq);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "LLCP TX - N(S,R):(NA,%d) V(S,SA,R,RA):(%d,%d,%d,%d)",
+ p_dlcb->next_rx_seq, p_dlcb->next_tx_seq, p_dlcb->rcvd_ack_seq,
+ p_dlcb->next_rx_seq, p_dlcb->sent_ack_seq);
GKI_enqueue(&llcp_cb.lcb.sig_xmit_q, p_msg);
llcp_link_check_send_data();
} else {
- LLCP_TRACE_ERROR0("llcp_util_send_rr_rnr (): Out of resource");
+ LOG(ERROR) << StringPrintf("Out of resource");
}
}
diff --git a/src/nfc/nci/nci_hrcv.cc b/src/nfc/nci/nci_hrcv.cc
index 7af9aa7..35089cd 100644
--- a/src/nfc/nci/nci_hrcv.cc
+++ b/src/nfc/nci/nci_hrcv.cc
@@ -51,7 +51,8 @@
p = (uint8_t*)(p_msg + 1) + p_msg->offset;
pp = p + 1;
NCI_MSG_PRS_HDR1(pp, op_code);
- NFC_TRACE_DEBUG1("nci_proc_core_rsp opcode:0x%x", op_code);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nci_proc_core_rsp opcode:0x%x", op_code);
len = *pp++;
/* process the message based on the opcode and message type */
@@ -84,7 +85,7 @@
nfc_ncif_event_status(NFC_SET_POWER_SUB_STATE_REVT, *pp);
break;
default:
- NFC_TRACE_ERROR1("unknown opcode:0x%x", op_code);
+ LOG(ERROR) << StringPrintf("unknown opcode:0x%x", op_code);
break;
}
@@ -109,7 +110,8 @@
p = (uint8_t*)(p_msg + 1) + p_msg->offset;
pp = p + 1;
NCI_MSG_PRS_HDR1(pp, op_code);
- NFC_TRACE_DEBUG1("nci_proc_core_ntf opcode:0x%x", op_code);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nci_proc_core_ntf opcode:0x%x", op_code);
len = *pp++;
/* process the message based on the opcode and message type */
@@ -135,7 +137,7 @@
break;
default:
- NFC_TRACE_ERROR1("unknown opcode:0x%x", op_code);
+ LOG(ERROR) << StringPrintf("unknown opcode:0x%x", op_code);
break;
}
}
@@ -206,7 +208,7 @@
nfc_ncif_proc_isodep_nak_presence_check_status(*pp, false);
break;
default:
- NFC_TRACE_ERROR1("unknown opcode:0x%x", op_code);
+ LOG(ERROR) << StringPrintf("unknown opcode:0x%x", op_code);
break;
}
}
@@ -280,7 +282,7 @@
nfc_ncif_proc_isodep_nak_presence_check_status(*pp, true);
break;
default:
- NFC_TRACE_ERROR1("unknown opcode:0x%x", op_code);
+ LOG(ERROR) << StringPrintf("unknown opcode:0x%x", op_code);
break;
}
}
@@ -309,7 +311,8 @@
p = (uint8_t*)(p_msg + 1) + p_msg->offset;
pp = p + 1;
NCI_MSG_PRS_HDR1(pp, op_code);
- NFC_TRACE_DEBUG1("nci_proc_ee_management_rsp opcode:0x%x", op_code);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nci_proc_ee_management_rsp opcode:0x%x", op_code);
len = *pp++;
switch (op_code) {
@@ -344,7 +347,7 @@
break;
default:
p_cback = NULL;
- NFC_TRACE_ERROR1("unknown opcode:0x%x", op_code);
+ LOG(ERROR) << StringPrintf("unknown opcode:0x%x", op_code);
break;
}
@@ -374,7 +377,8 @@
p = (uint8_t*)(p_msg + 1) + p_msg->offset;
pp = p + 1;
NCI_MSG_PRS_HDR1(pp, op_code);
- NFC_TRACE_DEBUG1("nci_proc_ee_management_ntf opcode:0x%x", op_code);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nci_proc_ee_management_ntf opcode:0x%x", op_code);
len = *pp++;
if (op_code == NCI_MSG_NFCEE_DISCOVER) {
@@ -394,10 +398,10 @@
pp = p + yy;
nfc_response.nfcee_info.num_tlvs = *pp++;
- NFC_TRACE_DEBUG4("nfcee_id: 0x%x num_interface:0x%x/0x%x, num_tlvs:0x%x",
- nfc_response.nfcee_info.nfcee_id,
- nfc_response.nfcee_info.num_interface, yy,
- nfc_response.nfcee_info.num_tlvs);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfcee_id: 0x%x num_interface:0x%x/0x%x, num_tlvs:0x%x",
+ nfc_response.nfcee_info.nfcee_id, nfc_response.nfcee_info.num_interface,
+ yy, nfc_response.nfcee_info.num_tlvs);
if (nfc_response.nfcee_info.num_tlvs > NFC_MAX_EE_TLVS)
nfc_response.nfcee_info.num_tlvs = NFC_MAX_EE_TLVS;
@@ -407,7 +411,8 @@
for (xx = 0; xx < nfc_response.nfcee_info.num_tlvs; xx++, p_tlv++) {
p_tlv->tag = *pp++;
p_tlv->len = yy = *pp++;
- NFC_TRACE_DEBUG2("tag:0x%x, len:0x%x", p_tlv->tag, p_tlv->len);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("tag:0x%x, len:0x%x", p_tlv->tag, p_tlv->len);
if (p_tlv->len > NFC_MAX_EE_INFO) p_tlv->len = NFC_MAX_EE_INFO;
p = pp;
STREAM_TO_ARRAY(p_tlv->info, pp, p_tlv->len);
@@ -427,7 +432,7 @@
nfc_response.nfcee_status.nfcee_status = *pp;
} else {
p_cback = NULL;
- NFC_TRACE_ERROR1("unknown opcode:0x%x", op_code);
+ LOG(ERROR) << StringPrintf("unknown opcode:0x%x", op_code);
}
if (p_cback) (*p_cback)(event, &nfc_response);
diff --git a/src/nfc/nfc/nfc_ee.cc b/src/nfc/nfc/nfc_ee.cc
index 24d2c26..7873151 100644
--- a/src/nfc/nfc/nfc_ee.cc
+++ b/src/nfc/nfc/nfc_ee.cc
@@ -69,7 +69,7 @@
tNFC_STATUS NFC_NfceeModeSet(uint8_t nfcee_id, tNFC_NFCEE_MODE mode) {
tNFC_STATUS status = NCI_STATUS_OK;
if (mode >= NCI_NUM_NFCEE_MODE || nfcee_id == NCI_DH_ID) {
- NFC_TRACE_ERROR2("%s invalid parameter:%d", __func__, mode);
+ LOG(ERROR) << StringPrintf("%s invalid parameter:%d", __func__, mode);
return NFC_STATUS_FAILED;
}
if (nfc_cb.nci_version != NCI_VERSION_2_0)
diff --git a/src/nfc/nfc/nfc_main.cc b/src/nfc/nfc/nfc_main.cc
index cc58914..f50d86b 100644
--- a/src/nfc/nfc/nfc_main.cc
+++ b/src/nfc/nfc/nfc_main.cc
@@ -76,7 +76,6 @@
#endif
};
-#if (BT_TRACE_VERBOSE == TRUE)
/*******************************************************************************
**
** Function nfc_state_name
@@ -144,7 +143,6 @@
return "???? UNKNOWN EVENT";
}
}
-#endif /* BT_TRACE_VERBOSE == TRUE */
/*******************************************************************************
**
@@ -238,8 +236,8 @@
p_cb->init_credits = p_cb->num_buff;
evt_data.enable.hci_packet_size = p_cb->buff_size;
evt_data.enable.hci_conn_credits = p_cb->init_credits;
- NFC_TRACE_DEBUG2("hci num_buf=%d buf_size=%d", p_cb->num_buff,
- p_cb->buff_size);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "hci num_buf=%d buf_size=%d", p_cb->num_buff, p_cb->buff_size);
} else {
/*HCI n/w not enabled skip data buff size and data credit HCI conn */
p += 2;
@@ -314,13 +312,10 @@
**
*******************************************************************************/
void nfc_set_state(tNFC_STATE nfc_state) {
-#if (BT_TRACE_VERBOSE == TRUE)
- NFC_TRACE_DEBUG4("nfc_set_state %d (%s)->%d (%s)", nfc_cb.nfc_state,
- nfc_state_name(nfc_cb.nfc_state).c_str(), nfc_state,
- nfc_state_name(nfc_state).c_str());
-#else
- NFC_TRACE_DEBUG2("nfc_set_state %d->%d", nfc_cb.nfc_state, nfc_state);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfc_set_state %d (%s)->%d (%s)", nfc_cb.nfc_state,
+ nfc_state_name(nfc_cb.nfc_state).c_str(), nfc_state,
+ nfc_state_name(nfc_state).c_str());
nfc_cb.nfc_state = nfc_state;
}
@@ -370,7 +365,8 @@
void nfc_main_handle_hal_evt(tNFC_HAL_EVT_MSG* p_msg) {
uint8_t* ps;
- NFC_TRACE_DEBUG1("nfc_main_handle_hal_evt(): HAL event=0x%x", p_msg->hal_evt);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("HAL event=0x%x", p_msg->hal_evt);
switch (p_msg->hal_evt) {
case HAL_NFC_OPEN_CPLT_EVT: /* only for failure case */
@@ -486,8 +482,7 @@
break;
default:
- NFC_TRACE_ERROR1("nfc_main_handle_hal_evt (): unhandled event (0x%x).",
- p_msg->hal_evt);
+ LOG(ERROR) << StringPrintf("unhandled event (0x%x).", p_msg->hal_evt);
break;
}
}
@@ -504,7 +499,7 @@
void nfc_main_flush_cmd_queue(void) {
NFC_HDR* p_msg;
- NFC_TRACE_DEBUG0("nfc_main_flush_cmd_queue ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* initialize command window */
nfc_cb.nci_cmd_window = NCI_MAX_CMD_WINDOW;
@@ -541,7 +536,7 @@
p_msg->status = status;
GKI_send_msg(NFC_TASK, NFC_MBOX_ID, p_msg);
} else {
- NFC_TRACE_ERROR0("nfc_main_post_hal_evt (): No buffer");
+ LOG(ERROR) << StringPrintf("No buffer");
}
}
@@ -555,12 +550,9 @@
**
*******************************************************************************/
static void nfc_main_hal_cback(uint8_t event, tHAL_NFC_STATUS status) {
-#if (BT_TRACE_VERBOSE == TRUE)
- NFC_TRACE_DEBUG3("nfc_main_hal_cback event: %s(0x%x), status=%d",
- nfc_hal_event_name(event).c_str(), event, status);
-#else
- NFC_TRACE_DEBUG2("nfc_main_hal_cback event: 0x%x, status=%d", event, status);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfc_main_hal_cback event: %s(0x%x), status=%d",
+ nfc_hal_event_name(event).c_str(), event, status);
switch (event) {
case HAL_NFC_OPEN_CPLT_EVT:
@@ -588,7 +580,8 @@
break;
default:
- NFC_TRACE_DEBUG1("nfc_main_hal_cback unhandled event %x", event);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfc_main_hal_cback unhandled event %x", event);
break;
}
}
@@ -623,7 +616,7 @@
GKI_send_msg(NFC_TASK, NFC_MBOX_ID, p_msg);
} else {
- NFC_TRACE_ERROR0("nfc_main_hal_data_cback (): No buffer");
+ LOG(ERROR) << StringPrintf("No buffer");
}
}
}
@@ -652,7 +645,7 @@
**
*******************************************************************************/
tNFC_STATUS NFC_Enable(tNFC_RESPONSE_CBACK* p_cback) {
- NFC_TRACE_API0("NFC_Enable ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* Validate callback */
if (!p_cback) {
@@ -683,7 +676,8 @@
**
*******************************************************************************/
void NFC_Disable(void) {
- NFC_TRACE_API1("NFC_Disable (): nfc_state = %d", nfc_cb.nfc_state);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfc_state = %d", nfc_cb.nfc_state);
if ((nfc_cb.nfc_state == NFC_STATE_NONE) ||
(nfc_cb.nfc_state == NFC_STATE_NFCC_POWER_OFF_SLEEP)) {
@@ -815,8 +809,8 @@
nfc_cb.p_discv_cback = p_cback;
num_intf = 0;
- NFC_TRACE_DEBUG1("nci_interfaces supported by NFCC: 0x%x",
- nfc_cb.nci_interfaces);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nci_interfaces supported by NFCC: 0x%x", nfc_cb.nci_interfaces);
for (xx = 0; xx < NFC_NFCC_MAX_NUM_VS_INTERFACE + NCI_INTERFACE_MAX; xx++) {
memset(&max_maps[xx], 0x00, sizeof(tNFC_DISCOVER_MAPS));
@@ -829,20 +823,22 @@
if (nfc_cb.vs_interface[yy] == p_maps[xx].intf_type)
is_supported = true;
}
- NFC_TRACE_DEBUG3("[%d]: vs intf_type:0x%x is_supported:%d", xx,
- p_maps[xx].intf_type, is_supported);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("[%d]: vs intf_type:0x%x is_supported:%d", xx,
+ p_maps[xx].intf_type, is_supported);
} else {
intf_mask = (1 << (p_maps[xx].intf_type));
if (intf_mask & nfc_cb.nci_interfaces) {
is_supported = true;
}
- NFC_TRACE_DEBUG4("[%d]: intf_type:%d intf_mask: 0x%x is_supported:%d", xx,
- p_maps[xx].intf_type, intf_mask, is_supported);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("[%d]: intf_type:%d intf_mask: 0x%x is_supported:%d",
+ xx, p_maps[xx].intf_type, intf_mask, is_supported);
}
if (is_supported)
memcpy(&max_maps[num_intf++], &p_maps[xx], sizeof(tNFC_DISCOVER_MAPS));
else {
- NFC_TRACE_WARNING1(
+ LOG(WARNING) << StringPrintf(
"NFC_DiscoveryMap interface=0x%x is not supported by NFCC",
p_maps[xx].intf_type);
}
@@ -874,9 +870,9 @@
int params_size;
tNFC_STATUS status = NFC_STATUS_NO_BUFFERS;
- NFC_TRACE_API0("NFC_DiscoveryStart");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (nfc_cb.p_disc_pending) {
- NFC_TRACE_ERROR0("There's pending NFC_DiscoveryStart");
+ LOG(ERROR) << StringPrintf("There's pending NFC_DiscoveryStart");
status = NFC_STATUS_BUSY;
} else {
nfc_cb.p_discv_cback = p_cback;
@@ -894,7 +890,8 @@
}
}
- NFC_TRACE_API1("NFC_DiscoveryStart status: 0x%x", status);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NFC_DiscoveryStart status: 0x%x", status);
return status;
}
@@ -1112,13 +1109,9 @@
tNFC_CONN_CB* p_cb = &nfc_cb.conn_cb[NFC_RF_CONN_ID];
tNFC_STATUS status = NFC_STATUS_OK;
-#if (BT_TRACE_VERBOSE == TRUE)
- NFC_TRACE_API3("NFC_Deactivate %d (%s) deactivate_type:%d", nfc_cb.nfc_state,
- nfc_state_name(nfc_cb.nfc_state).c_str(), deactivate_type);
-#else
- NFC_TRACE_API2("NFC_Deactivate %d deactivate_type:%d", nfc_cb.nfc_state,
- deactivate_type);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "NFC_Deactivate %d (%s) deactivate_type:%d", nfc_cb.nfc_state,
+ nfc_state_name(nfc_cb.nfc_state).c_str(), deactivate_type);
if (nfc_cb.flags & NFC_FL_DISCOVER_PENDING) {
/* the HAL pre-discover is still active - clear the pending flag */
@@ -1134,8 +1127,9 @@
if (nfc_cb.nfc_state == NFC_STATE_OPEN) {
nfc_set_state(NFC_STATE_CLOSING);
- NFC_TRACE_DEBUG3("act_protocol %d credits:%d/%d", p_cb->act_protocol,
- p_cb->init_credits, p_cb->num_buff);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("act_protocol %d credits:%d/%d", p_cb->act_protocol,
+ p_cb->init_credits, p_cb->num_buff);
if ((p_cb->act_protocol == NCI_PROTOCOL_NFC_DEP) &&
(p_cb->init_credits != p_cb->num_buff)) {
nfc_cb.flags |= NFC_FL_DEACTIVATING;
@@ -1235,7 +1229,7 @@
**
*******************************************************************************/
tNFC_STATUS NFC_SetPowerOffSleep(bool enable) {
- NFC_TRACE_API1("NFC_SetPowerOffSleep () enable = %d", enable);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("enable = %d", enable);
if ((enable == false) &&
(nfc_cb.nfc_state == NFC_STATE_NFCC_POWER_OFF_SLEEP)) {
@@ -1254,8 +1248,7 @@
return NFC_STATUS_OK;
}
- NFC_TRACE_ERROR1("NFC_SetPowerOffSleep () invalid state = %d",
- nfc_cb.nfc_state);
+ LOG(ERROR) << StringPrintf("invalid state = %d", nfc_cb.nfc_state);
return NFC_STATUS_FAILED;
}
@@ -1269,7 +1262,7 @@
**
*******************************************************************************/
tNFC_STATUS NFC_PowerCycleNFCC(void) {
- NFC_TRACE_API0("NFC_PowerCycleNFCC ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (nfc_cb.nfc_state == NFC_STATE_IDLE) {
/* power cycle NFCC */
@@ -1279,8 +1272,7 @@
return NFC_STATUS_OK;
}
- NFC_TRACE_ERROR1("NFC_PowerCycleNFCC () invalid state = %d",
- nfc_cb.nfc_state);
+ LOG(ERROR) << StringPrintf("invalid state = %d", nfc_cb.nfc_state);
return NFC_STATUS_FAILED;
}
@@ -1345,13 +1337,15 @@
**
*******************************************************************************/
void NFC_SetStaticHciCback(tNFC_CONN_CBACK* p_cback) {
- NFC_TRACE_DEBUG2("%s dest: %d", __func__, NCI_DEST_TYPE_NFCEE);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s dest: %d", __func__, NCI_DEST_TYPE_NFCEE);
tNFC_CONN_CB* p_cb = &nfc_cb.conn_cb[NFC_HCI_CONN_ID];
tNFC_CONN evt_data;
p_cb->p_cback = p_cback;
if (p_cback && p_cb->buff_size && p_cb->num_buff) {
- NFC_TRACE_DEBUG2("%s dest: %d", __func__, NCI_DEST_TYPE_NFCEE);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s dest: %d", __func__, NCI_DEST_TYPE_NFCEE);
evt_data.conn_create.status = NFC_STATUS_OK;
evt_data.conn_create.dest_type = NCI_DEST_TYPE_NFCEE;
evt_data.conn_create.id = p_cb->id;
@@ -1360,7 +1354,7 @@
(*p_cback)(NFC_HCI_CONN_ID, NFC_CONN_CREATE_CEVT, &evt_data);
}
}
-#if (BT_TRACE_VERBOSE == TRUE)
+
/*******************************************************************************
**
** Function NFC_GetStatusName
@@ -1448,4 +1442,3 @@
return "UNKNOWN";
}
}
-#endif
diff --git a/src/nfc/nfc/nfc_ncif.cc b/src/nfc/nfc/nfc_ncif.cc
index ae340b8..84fdf17 100644
--- a/src/nfc/nfc/nfc_ncif.cc
+++ b/src/nfc/nfc/nfc_ncif.cc
@@ -61,7 +61,7 @@
/* Sanity check - see if we were expecting a update_window */
if (nfc_cb.nci_cmd_window == NCI_MAX_CMD_WINDOW) {
if (nfc_cb.nfc_state != NFC_STATE_W4_HAL_CLOSE) {
- NFC_TRACE_ERROR0("nfc_ncif_update_window: Unexpected call");
+ LOG(ERROR) << StringPrintf("nfc_ncif_update_window: Unexpected call");
}
return;
}
@@ -86,7 +86,7 @@
**
*******************************************************************************/
void nfc_ncif_cmd_timeout(void) {
- NFC_TRACE_ERROR0("nfc_ncif_cmd_timeout");
+ LOG(ERROR) << StringPrintf("nfc_ncif_cmd_timeout");
/* report an error */
nfc_ncif_event_status(NFC_GEN_ERROR_REVT, NFC_STATUS_HW_TIMEOUT);
@@ -111,7 +111,7 @@
**
*******************************************************************************/
void nfc_wait_2_deactivate_timeout(void) {
- NFC_TRACE_ERROR0("nfc_wait_2_deactivate_timeout");
+ LOG(ERROR) << StringPrintf("nfc_wait_2_deactivate_timeout");
nfc_cb.flags &= ~NFC_FL_DEACTIVATING;
nci_snd_deactivate_cmd((uint8_t)nfc_cb.deactivate_timer.param);
}
@@ -137,8 +137,9 @@
uint8_t hdr0 = p_cb->conn_id;
bool fragmented = false;
- NFC_TRACE_DEBUG3("nfc_ncif_send_data :%d, num_buff:%d qc:%d", p_cb->conn_id,
- p_cb->num_buff, p_cb->tx_q.count);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfc_ncif_send_data :%d, num_buff:%d qc:%d",
+ p_cb->conn_id, p_cb->num_buff, p_cb->tx_q.count);
if (p_cb->id == NFC_RF_CONN_ID) {
if (nfc_cb.nfc_state != NFC_STATE_OPEN) {
if (nfc_cb.nfc_state == NFC_STATE_CLOSING) {
@@ -147,7 +148,7 @@
if (p_cb->init_credits == p_cb->num_buff) {
/* all the credits are back */
nfc_cb.flags &= ~NFC_FL_DEACTIVATING;
- NFC_TRACE_DEBUG2(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"deactivating NFC-DEP init_credits:%d, num_buff:%d",
p_cb->init_credits, p_cb->num_buff);
nfc_stop_timer(&nfc_cb.deactivate_timer);
@@ -367,13 +368,14 @@
nfcsnoop_capture(p_msg, true);
switch (mt) {
case NCI_MT_DATA:
- NFC_TRACE_DEBUG0("NFC received data");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("NFC received data");
nfc_ncif_proc_data(p_msg);
free = false;
break;
case NCI_MT_RSP:
- NFC_TRACE_DEBUG1("NFC received rsp gid:%d", gid);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NFC received rsp gid:%d", gid);
oid = ((*pp) & NCI_OID_MASK);
p_old = nfc_cb.last_hdr;
NCI_MSG_PRS_HDR0(p_old, old_mt, pbf, old_gid);
@@ -381,7 +383,7 @@
/* make sure this is the RSP we are waiting for before updating the
* command window */
if ((old_gid != gid) || (old_oid != oid)) {
- NFC_TRACE_ERROR2(
+ LOG(ERROR) << StringPrintf(
"nfc_ncif_process_event unexpected rsp: gid:0x%x, oid:0x%x", gid,
oid);
return true;
@@ -405,7 +407,7 @@
nci_proc_prop_rsp(p_msg);
break;
default:
- NFC_TRACE_ERROR1("NFC: Unknown gid:%d", gid);
+ LOG(ERROR) << StringPrintf("NFC: Unknown gid:%d", gid);
break;
}
@@ -413,7 +415,8 @@
break;
case NCI_MT_NTF:
- NFC_TRACE_DEBUG1("NFC received ntf gid:%d", gid);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NFC received ntf gid:%d", gid);
switch (gid) {
case NCI_GID_CORE: /* 0000b NCI Core group */
nci_proc_core_ntf(p_msg);
@@ -432,13 +435,14 @@
nci_proc_prop_ntf(p_msg);
break;
default:
- NFC_TRACE_ERROR1("NFC: Unknown gid:%d", gid);
+ LOG(ERROR) << StringPrintf("NFC: Unknown gid:%d", gid);
break;
}
break;
default:
- NFC_TRACE_DEBUG2("NFC received unknown mt:0x%x, gid:%d", mt, gid);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NFC received unknown mt:0x%x, gid:%d", mt, gid);
}
return (free);
@@ -583,8 +587,8 @@
/* if this happens in activated state, it's very likely that our NFCC
* has issues */
/* However, credit may be returned after deactivation */
- NFC_TRACE_ERROR2("num_buff:0x%x, init_credits:0x%x", p_cb->num_buff,
- p_cb->init_credits);
+ LOG(ERROR) << StringPrintf("num_buff:0x%x, init_credits:0x%x",
+ p_cb->num_buff, p_cb->init_credits);
}
p_cb->num_buff = p_cb->init_credits;
}
@@ -703,8 +707,8 @@
} else if (NCI_DISCOVERY_TYPE_POLL_KOVIO == p_param->mode) {
p_param->param.pk.uid_len = len;
if (p_param->param.pk.uid_len > NFC_KOVIO_MAX_LEN) {
- NFC_TRACE_ERROR2("Kovio UID len:0x%x exceeds max(0x%x)",
- p_param->param.pk.uid_len, NFC_KOVIO_MAX_LEN);
+ LOG(ERROR) << StringPrintf("Kovio UID len:0x%x exceeds max(0x%x)",
+ p_param->param.pk.uid_len, NFC_KOVIO_MAX_LEN);
p_param->param.pk.uid_len = NFC_KOVIO_MAX_LEN;
}
STREAM_TO_ARRAY(p_param->param.pk.uid, p, p_param->param.pk.uid_len);
@@ -846,8 +850,8 @@
evt_data.activate.rx_bitrate = *p++;
mode = evt_data.activate.rf_tech_param.mode;
len_act = *p++;
- NFC_TRACE_DEBUG3("nfc_ncif_proc_activate:%d %d, mode:0x%02x", len, len_act,
- mode);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfc_ncif_proc_activate:%d %d, mode:0x%02x", len, len_act, mode);
/* just in case the interface reports activation parameters not defined in the
* NCI spec */
p_intf->intf_param.frame.param_len = len_act;
@@ -1150,7 +1154,8 @@
tNFC_EE_DISCOVER_INFO* p_info;
uint8_t u8;
- NFC_TRACE_DEBUG2("nfc_ncif_proc_ee_discover_req %d len:%d", *p, plen);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfc_ncif_proc_ee_discover_req %d len:%d", *p, plen);
if (p_cback) {
u8 = *p;
ee_disc_req.status = NFC_STATUS_OK;
@@ -1161,7 +1166,8 @@
p_info->op = *p++; /* T */
if (*p != NFC_EE_DISCOVER_INFO_LEN) /* L */
{
- NFC_TRACE_DEBUG1("bad entry len:%d", *p);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("bad entry len:%d", *p);
return;
}
p++;
@@ -1298,22 +1304,25 @@
uint8_t status = *p++;
uint8_t wait_for_ntf = FALSE;
if (is_ntf) {
- NFC_TRACE_ERROR1("reset notification!!:0x%x ", status);
+ LOG(ERROR) << StringPrintf("reset notification!!:0x%x ", status);
/* clean up, if the state is OPEN
* FW does not report reset ntf right now */
if (status == NCI2_0_RESET_TRIGGER_TYPE_CORE_RESET_CMD_RECEIVED ||
status == NCI2_0_RESET_TRIGGER_TYPE_POWERED_ON) {
- NFC_TRACE_DEBUG2("CORE_RESET_NTF Received status nfc_state : 0x%x : 0x%x",
- status, nfc_cb.nfc_state);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "CORE_RESET_NTF Received status nfc_state : 0x%x : 0x%x", status,
+ nfc_cb.nfc_state);
nfc_stop_timer(&nfc_cb.nci_wait_rsp_timer);
p++;
STREAM_TO_UINT8(nfc_cb.nci_version, p);
- NFC_TRACE_DEBUG1(" CORE_RESET_NTF nci_version%x", nfc_cb.nci_version);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf(" CORE_RESET_NTF nci_version%x", nfc_cb.nci_version);
status = NCI_STATUS_OK;
} else {
/* CORE_RESET_NTF received error case , trigger recovery*/
- NFC_TRACE_DEBUG2("CORE_RESET_NTF Received status nfc_state : 0x%x : 0x%x",
- status, nfc_cb.nfc_state);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "CORE_RESET_NTF Received status nfc_state : 0x%x : 0x%x", status,
+ nfc_cb.nfc_state);
nfc_ncif_cmd_timeout();
status = NCI_STATUS_FAILED;
}
@@ -1323,7 +1332,8 @@
nfc_reset_all_conn_cbs();
}
} else {
- NFC_TRACE_DEBUG1("CORE_RESET_RSP len :0x%x ", *p_len);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("CORE_RESET_RSP len :0x%x ", *p_len);
if ((*p_len) == NCI_CORE_RESET_RSP_LEN(NCI_VERSION_2_0)) {
wait_for_ntf = TRUE;
} else if ((*p_len) == NCI_CORE_RESET_RSP_LEN(NCI_VERSION_1_0)) {
@@ -1349,7 +1359,7 @@
nci_snd_core_init(NCI_VERSION_2_0);
}
} else {
- NFC_TRACE_ERROR0("Failed to reset NFCC");
+ LOG(ERROR) << StringPrintf("Failed to reset NFCC");
nfc_enabled(status, NULL);
}
}
@@ -1497,7 +1507,8 @@
if ((data_cevt.status != NFC_STATUS_OK) &&
((data_cevt.status >= T2T_STATUS_OK_1_BIT) &&
(data_cevt.status <= T2T_STATUS_OK_7_BIT))) {
- NFC_TRACE_DEBUG1("%s: T2T tag data xchange", __func__);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: T2T tag data xchange", __func__);
data_cevt.status = NFC_STATUS_OK;
}
}
@@ -1539,11 +1550,13 @@
uint16_t len;
pp = (uint8_t*)(p_msg + 1) + p_msg->offset;
- NFC_TRACE_DEBUG3("nfc_ncif_proc_data 0x%02x%02x%02x", pp[0], pp[1], pp[2]);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfc_ncif_proc_data 0x%02x%02x%02x", pp[0], pp[1], pp[2]);
NCI_DATA_PRS_HDR(pp, pbf, cid, len);
p_cb = nfc_find_conn_cb_by_conn_id(cid);
if (p_cb && (p_msg->len >= NCI_DATA_HDR_SIZE)) {
- NFC_TRACE_DEBUG1("nfc_ncif_proc_data len:%d", len);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfc_ncif_proc_data len:%d", len);
p_msg->layer_specific = 0;
if (pbf) p_msg->layer_specific = NFC_RAS_FRAGMENTED;
@@ -1589,7 +1602,8 @@
p_last->len += len;
/* do not need to update pbf and len in NCI header.
* They are stripped off at NFC_DATA_CEVT and len may exceed 255 */
- NFC_TRACE_DEBUG1("nfc_ncif_proc_data len:%d", p_last->len);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfc_ncif_proc_data len:%d", p_last->len);
p_last->layer_specific = p_msg->layer_specific;
GKI_freebuf(p_msg);
#ifdef DISP_NCI
@@ -1634,7 +1648,8 @@
*******************************************************************************/
bool nfc_ncif_proc_proprietary_rsp(uint8_t mt, uint8_t gid, uint8_t oid) {
bool stat = FALSE;
- NFC_TRACE_DEBUG4("%s: mt=%u, gid=%u, oid=%u", __func__, mt, gid, oid);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: mt=%u, gid=%u, oid=%u", __func__, mt, gid, oid);
switch (mt) {
case NCI_MT_DATA:
@@ -1666,7 +1681,8 @@
stat = TRUE;
break;
}
- NFC_TRACE_DEBUG2("%s: exit status=%u", __func__, stat);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("%s: exit status=%u", __func__, stat);
return stat;
}
@@ -1679,7 +1695,7 @@
**
*******************************************************************************/
void nfc_mode_set_ntf_timeout() {
- NFC_TRACE_ERROR1("%s", __func__);
+ LOG(ERROR) << StringPrintf("%s", __func__);
tNFC_RESPONSE nfc_response;
nfc_response.mode_set.status = NCI_STATUS_FAILED;
nfc_response.mode_set.nfcee_id = *nfc_cb.last_cmd;
diff --git a/src/nfc/nfc/nfc_task.cc b/src/nfc/nfc/nfc_task.cc
index dc008f9..fd4fe02 100644
--- a/src/nfc/nfc/nfc_task.cc
+++ b/src/nfc/nfc/nfc_task.cc
@@ -122,9 +122,10 @@
nfc_mode_set_ntf_timeout();
break;
default:
- NFC_TRACE_DEBUG2("nfc_process_timer_evt: timer:0x%x event (0x%04x)",
- p_tle, p_tle->event);
- NFC_TRACE_DEBUG1(
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfc_process_timer_evt: timer:0x%p event (0x%04x)",
+ p_tle, p_tle->event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfc_process_timer_evt: unhandled timer event (0x%04x)",
p_tle->event);
}
@@ -270,7 +271,7 @@
break;
#endif
default:
- NFC_TRACE_DEBUG1(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"nfc_process_quick_timer_evt: unhandled timer event (0x%04x)",
p_tle->event);
break;
@@ -340,7 +341,7 @@
memset(&nfc_cb, 0, sizeof(tNFC_CB));
nfc_cb.trace_level = NFC_INITIAL_TRACE_LEVEL;
- NFC_TRACE_DEBUG0("NFC_TASK started.");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("NFC_TASK started.");
/* main loop */
while (true) {
@@ -350,7 +351,8 @@
}
/* Handle NFC_TASK_EVT_TRANSPORT_READY from NFC HAL */
if (event & NFC_TASK_EVT_TRANSPORT_READY) {
- NFC_TRACE_DEBUG0("NFC_TASK got NFC_TASK_EVT_TRANSPORT_READY.");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NFC_TASK got NFC_TASK_EVT_TRANSPORT_READY.");
/* Reset the NFC controller. */
nfc_set_state(NFC_STATE_CORE_INIT);
@@ -385,8 +387,8 @@
break;
default:
- NFC_TRACE_DEBUG1("nfc_task: unhandle mbox message, event=%04x",
- p_msg->event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "nfc_task: unhandle mbox message, event=%04x", p_msg->event);
break;
}
@@ -417,7 +419,7 @@
}
}
- NFC_TRACE_DEBUG0("nfc_task terminated");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("nfc_task terminated");
GKI_exit_task(GKI_get_taskid());
return 0;
diff --git a/src/nfc/nfc/nfc_utils.cc b/src/nfc/nfc/nfc_utils.cc
index c5a9e4e..d861fbf 100644
--- a/src/nfc/nfc/nfc_utils.cc
+++ b/src/nfc/nfc/nfc_utils.cc
@@ -74,7 +74,8 @@
p_cb->conn_id = conn_id;
handle = (uint8_t)(p_cb - nfc_cb.conn_cb + 1);
nfc_cb.conn_id[conn_id] = handle;
- NFC_TRACE_DEBUG2("nfc_set_conn_id conn_id:%d, handle:%d", conn_id, handle);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("nfc_set_conn_id conn_id:%d, handle:%d", conn_id, handle);
}
/*******************************************************************************
diff --git a/src/nfc/nfc/nfc_vs.cc b/src/nfc/nfc/nfc_vs.cc
index 5e2548a..e82eff2 100644
--- a/src/nfc/nfc/nfc_vs.cc
+++ b/src/nfc/nfc/nfc_vs.cc
@@ -87,7 +87,8 @@
tNFC_STATUS NFC_SendRawVsCommand(NFC_HDR* p_data, tNFC_VS_CBACK* p_cback) {
/* Validate parameters */
if (p_data == NULL || (p_data->len > NCI_MAX_VSC_SIZE)) {
- NFC_TRACE_ERROR1("buffer offset must be >= %d", NCI_VSC_MSG_HDR_SIZE);
+ LOG(ERROR) << StringPrintf("buffer offset must be >= %d",
+ NCI_VSC_MSG_HDR_SIZE);
if (p_data) GKI_freebuf(p_data);
return NFC_STATUS_INVALID_PARAM;
}
@@ -132,7 +133,8 @@
/* Validate parameters */
if ((p_data == NULL) || (p_data->offset < NCI_VSC_MSG_HDR_SIZE) ||
(p_data->len > NCI_MAX_VSC_SIZE)) {
- NFC_TRACE_ERROR1("buffer offset must be >= %d", NCI_VSC_MSG_HDR_SIZE);
+ LOG(ERROR) << StringPrintf("buffer offset must be >= %d",
+ NCI_VSC_MSG_HDR_SIZE);
if (p_data) GKI_freebuf(p_data);
return NFC_STATUS_INVALID_PARAM;
}
diff --git a/src/nfc/tags/ce_main.cc b/src/nfc/tags/ce_main.cc
index cf207cb..63cacf4 100644
--- a/src/nfc/tags/ce_main.cc
+++ b/src/nfc/tags/ce_main.cc
@@ -67,7 +67,8 @@
p = (uint8_t*)(p_data + 1) + p_data->offset;
memcpy(p, p_raw_data, data_len);
p_data->len = data_len;
- CE_TRACE_EVENT1("CE SENT raw frame (0x%x)", data_len);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("CE SENT raw frame (0x%x)", data_len);
status = NFC_SendData(NFC_RF_CONN_ID, p_data);
}
}
@@ -89,7 +90,8 @@
tNFC_STATUS status = NFC_STATUS_FAILED;
tNFC_PROTOCOL protocol = p_activate_params->protocol;
- CE_TRACE_API1("CE_SetActivatedTagType protocol:%d", protocol);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("CE_SetActivatedTagType protocol:%d", protocol);
switch (protocol) {
case NFC_PROTOCOL_T1T:
@@ -110,7 +112,7 @@
break;
default:
- CE_TRACE_ERROR0("CE_SetActivatedTagType Invalid protocol");
+ LOG(ERROR) << StringPrintf("CE_SetActivatedTagType Invalid protocol");
return NFC_STATUS_FAILED;
}
diff --git a/src/nfc/tags/ce_t3t.cc b/src/nfc/tags/ce_t3t.cc
index 43cd060..84ca93b 100644
--- a/src/nfc/tags/ce_t3t.cc
+++ b/src/nfc/tags/ce_t3t.cc
@@ -90,12 +90,10 @@
UINT8_TO_STREAM(p, (p_msg->len + 1));
p_msg->len += 1; /* Increment len to include SoD */
-#if (BT_TRACE_PROTOCOL == TRUE)
DispT3TagMessage(p_msg, false);
-#endif
if (NFC_SendData(NFC_RF_CONN_ID, p_msg) != NFC_STATUS_OK) {
- CE_TRACE_ERROR0("ce_t3t_send_to_lower (): NFC_SendData () failed");
+ LOG(ERROR) << StringPrintf("failed");
}
}
@@ -182,7 +180,8 @@
p_rsp_msg->len = (uint16_t)(p_dst - p_rsp_start);
ce_t3t_send_to_lower(p_rsp_msg);
} else {
- CE_TRACE_ERROR0("CE: Unable to allocat buffer for response message");
+ LOG(ERROR) << StringPrintf(
+ "CE: Unable to allocat buffer for response message");
}
}
@@ -229,7 +228,7 @@
/* Reject UPDATE command if service code=T3T_MSG_NDEF_SC_RO */
if (service_code == T3T_MSG_NDEF_SC_RO) {
/* Error: invalid block number to update */
- CE_TRACE_ERROR0("CE: UPDATE request using read-only service");
+ LOG(ERROR) << StringPrintf("CE: UPDATE request using read-only service");
nfc_status = NFC_STATUS_FAILED;
break;
}
@@ -237,18 +236,19 @@
/* Check for NDEF */
if (service_code == T3T_MSG_NDEF_SC_RW) {
if (p_cb->cur_cmd.num_blocks > p_cb->ndef_info.nbw) {
- CE_TRACE_ERROR2(
+ LOG(ERROR) << StringPrintf(
"CE: Requested too many blocks to update (requested: %i, max: %i)",
p_cb->cur_cmd.num_blocks, p_cb->ndef_info.nbw);
nfc_status = NFC_STATUS_FAILED;
break;
} else if (p_cb->ndef_info.rwflag == T3T_MSG_NDEF_RWFLAG_RO) {
- CE_TRACE_ERROR0("CE: error: write-request to read-only NDEF message.");
+ LOG(ERROR) << StringPrintf(
+ "CE: error: write-request to read-only NDEF message.");
nfc_status = NFC_STATUS_FAILED;
break;
} else if (block_number == 0) {
- CE_TRACE_DEBUG2("CE: Update sc 0x%04x block %i.", service_code,
- block_number);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "CE: Update sc 0x%04x block %i.", service_code, block_number);
/* Special caes: NDEF block0 is the ndef attribute block */
p_temp = p_block_data;
@@ -270,7 +270,8 @@
/* Compare calcuated checksum with received checksum */
if (checksum != checksum_rx) {
- CE_TRACE_ERROR0("CE: Checksum failed for NDEF attribute block.");
+ LOG(ERROR) << StringPrintf(
+ "CE: Checksum failed for NDEF attribute block.");
nfc_status = NFC_STATUS_FAILED;
} else {
/* Update NDEF attribute block (only allowed to update current length
@@ -288,13 +289,13 @@
}
}
} else {
- CE_TRACE_DEBUG2("CE: Udpate sc 0x%04x block %i.", service_code,
- block_number);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "CE: Udpate sc 0x%04x block %i.", service_code, block_number);
/* Verify that block_number is within NDEF memory */
if (block_number > p_cb->ndef_info.nmaxb) {
/* Error: invalid block number to update */
- CE_TRACE_ERROR2(
+ LOG(ERROR) << StringPrintf(
"CE: Requested invalid NDEF block number to update %i (max is "
"%i).",
block_number, p_cb->ndef_info.nmaxb);
@@ -313,8 +314,8 @@
}
} else {
/* Error: invalid service code */
- CE_TRACE_ERROR1("CE: Requested invalid service code: 0x%04x.",
- service_code);
+ LOG(ERROR) << StringPrintf("CE: Requested invalid service code: 0x%04x.",
+ service_code);
nfc_status = NFC_STATUS_FAILED;
break;
}
@@ -412,7 +413,7 @@
/* Verify Nbr (NDEF only) */
if (p_cb->cur_cmd.num_blocks > p_cb->ndef_info.nbr) {
/* Error: invalid number of blocks to check */
- CE_TRACE_ERROR2(
+ LOG(ERROR) << StringPrintf(
"CE: Requested too many blocks to check (requested: %i, max: %i)",
p_cb->cur_cmd.num_blocks, p_cb->ndef_info.nbr);
@@ -456,8 +457,8 @@
/* Invalid block number */
p_dst = p_status;
- CE_TRACE_ERROR1("CE: Requested block number to check %i.",
- block_number);
+ LOG(ERROR) << StringPrintf(
+ "CE: Requested block number to check %i.", block_number);
/* Error: invalid number of blocks to check */
UINT8_TO_STREAM(p_dst, T3T_MSG_RSP_STATUS_ERROR);
@@ -483,8 +484,8 @@
}
} else {
/* Error: invalid service code */
- CE_TRACE_ERROR1("CE: Requested invalid service code: 0x%04x.",
- service_code);
+ LOG(ERROR) << StringPrintf(
+ "CE: Requested invalid service code: 0x%04x.", service_code);
p_dst = p_status;
UINT8_TO_STREAM(p_dst, T3T_MSG_RSP_STATUS_ERROR);
@@ -496,7 +497,8 @@
p_rsp_msg->len = (uint16_t)(p_dst - p_rsp_start);
ce_t3t_send_to_lower(p_rsp_msg);
} else {
- CE_TRACE_ERROR0("CE: Unable to allocat buffer for response message");
+ LOG(ERROR) << StringPrintf(
+ "CE: Unable to allocat buffer for response message");
}
GKI_freebuf(p_cmd_msg);
@@ -583,7 +585,7 @@
case T3T_MSG_OPC_REQ_SERVICE_CMD:
default:
/* Unhandled command */
- CE_TRACE_ERROR1("Unhandled CE opcode: %02x", cmd_id);
+ LOG(ERROR) << StringPrintf("Unhandled CE opcode: %02x", cmd_id);
send_response = false;
break;
}
@@ -595,7 +597,8 @@
GKI_freebuf(p_rsp_msg);
}
} else {
- CE_TRACE_ERROR0("CE: Unable to allocat buffer for response message");
+ LOG(ERROR) << StringPrintf(
+ "CE: Unable to allocat buffer for response message");
}
GKI_freebuf(p_cmd_msg);
}
@@ -624,9 +627,7 @@
uint8_t sod;
uint8_t cmd_type;
-#if (BT_TRACE_PROTOCOL == TRUE)
DispT3TagMessage(p_msg, true);
-#endif
/* If activate system code is not NDEF, or if no local NDEF contents was set,
* then pass data up to the app */
@@ -640,8 +641,8 @@
/* Verify that message contains at least Sod and cmd_id */
if (p_msg->len < 2) {
- CE_TRACE_ERROR1("CE: received invalid T3t message (invalid length: %i)",
- p_msg->len);
+ LOG(ERROR) << StringPrintf(
+ "CE: received invalid T3t message (invalid length: %i)", p_msg->len);
} else {
/* Get and validate command opcode */
STREAM_TO_UINT8(sod, p);
@@ -650,7 +651,7 @@
/* Valid command and message length */
cmd_type = ce_t3t_is_valid_opcode(cmd_id);
if (cmd_type == CE_T3T_COMMAND_INVALID) {
- CE_TRACE_ERROR1(
+ LOG(ERROR) << StringPrintf(
"CE: received invalid T3t message (invalid command: 0x%02X)", cmd_id);
} else if (cmd_type == CE_T3T_COMMAND_FELICA) {
ce_t3t_handle_non_nfc_forum_cmd(p_ce_cb, cmd_id, p_msg);
@@ -658,8 +659,9 @@
} else {
/* Verify that message contains at least NFCID2 and NUM services */
if (p_msg->len < T3T_MSG_CMD_COMMON_HDR_LEN) {
- CE_TRACE_ERROR1("CE: received invalid T3t message (invalid length: %i)",
- p_msg->len);
+ LOG(ERROR) << StringPrintf(
+ "CE: received invalid T3t message (invalid length: %i)",
+ p_msg->len);
} else {
/* Handle NFC_FORUM command (UPDATE or CHECK) */
STREAM_TO_ARRAY(cmd_nfcid2, p, NCI_RF_F_UID_LEN);
@@ -670,17 +672,18 @@
T3T_MSG_CMD_COMMON_HDR_LEN + 2 * p_cb->cur_cmd.num_services + 1;
if (p_cb->state == CE_T3T_STATE_NOT_ACTIVATED) {
- CE_TRACE_ERROR2(
+ LOG(ERROR) << StringPrintf(
"CE: received command 0x%02X while in bad state (%i))", cmd_id,
p_cb->state);
} else if (memcmp(cmd_nfcid2, p_cb->local_nfcid2, NCI_RF_F_UID_LEN) !=
0) {
- CE_TRACE_ERROR0("CE: received invalid T3t message (invalid NFCID2)");
+ LOG(ERROR) << StringPrintf(
+ "CE: received invalid T3t message (invalid NFCID2)");
p_nfcid2 = cmd_nfcid2; /* respond with ERROR using the NFCID2 from the
command message */
} else if (p_msg->len < block_list_start_offset) {
/* Does not have minimum (including number_of_blocks field) */
- CE_TRACE_ERROR0("CE: incomplete message");
+ LOG(ERROR) << StringPrintf("CE: incomplete message");
} else {
/* Parse service code list */
for (i = 0; i < p_cb->cur_cmd.num_services; i++) {
@@ -696,7 +699,7 @@
/* Each entry is at lease 2 bytes long */
if (remaining < 2) {
/* Unexpected end of message (while reading block-list) */
- CE_TRACE_ERROR0(
+ LOG(ERROR) << StringPrintf(
"CE: received invalid T3t message (unexpected end of "
"block-list)");
block_list_ok = false;
@@ -710,7 +713,7 @@
if ((bl0 & T3T_MSG_SERVICE_LIST_MASK) >=
p_cb->cur_cmd.num_services) {
/* Invalid service code */
- CE_TRACE_ERROR1(
+ LOG(ERROR) << StringPrintf(
"CE: received invalid T3t message (invalid service index: "
"%i)",
(bl0 & T3T_MSG_SERVICE_LIST_MASK));
@@ -719,7 +722,7 @@
} else if ((!(bl0 & T3T_MSG_MASK_TWO_BYTE_BLOCK_DESC_FORMAT)) &&
(remaining < 3)) {
/* Unexpected end of message (while reading 3-byte entry) */
- CE_TRACE_ERROR0(
+ LOG(ERROR) << StringPrintf(
"CE: received invalid T3t message (unexpected end of "
"block-list)");
block_list_ok = false;
@@ -739,9 +742,9 @@
/* This is a CHECK command. Sanity check: there shouldn't be any
* more data remaining after reading block list */
if (remaining) {
- CE_TRACE_ERROR1(
- "CE: unexpected data after after CHECK command (#i bytes)",
- remaining);
+ LOG(ERROR) << StringPrintf(
+ "CE: unexpected data after after CHECK command (%u bytes)",
+ (unsigned int)remaining);
}
ce_t3t_handle_check_cmd(p_ce_cb, p_msg);
msg_processed = true;
@@ -749,7 +752,7 @@
/* This is an UPDATE command. See if message contains all the
* expected block data */
if (remaining < p_cb->cur_cmd.num_blocks * T3T_MSG_BLOCKSIZE) {
- CE_TRACE_ERROR0("CE: unexpected end of block-data");
+ LOG(ERROR) << StringPrintf("CE: unexpected end of block-data");
} else {
ce_t3t_handle_update_cmd(p_ce_cb, p_msg);
msg_processed = true;
@@ -782,7 +785,8 @@
tNFC_CONN* p_data) {
tCE_T3T_MEM* p_cb = &ce_cb.mem.t3t;
- CE_TRACE_DEBUG2("ce_t3t_conn_cback: conn_id=%i, evt=%i", conn_id, event);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("ce_t3t_conn_cback: conn_id=%i, evt=%i", conn_id, event);
switch (event) {
case NFC_CONN_CREATE_CEVT:
@@ -821,7 +825,7 @@
uint8_t nfcid2[NCI_RF_F_UID_LEN]) {
tCE_T3T_MEM* p_cb = &ce_cb.mem.t3t;
- CE_TRACE_DEBUG0("ce_select_t3t ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_cb->state = CE_T3T_STATE_IDLE;
p_cb->system_code = system_code;
@@ -845,13 +849,14 @@
uint8_t* p_scratch_buf) {
tCE_T3T_MEM* p_cb = &ce_cb.mem.t3t;
- CE_TRACE_API3("CE_T3tSetContent: ro=%i, size_max=%i, size_current=%i",
- read_only, size_max, size_current);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("CE_T3tSetContent: ro=%i, size_max=%i, size_current=%i",
+ read_only, size_max, size_current);
/* Verify scratch buffer was provided if NDEF message is read/write */
if ((!read_only) && (!p_scratch_buf)) {
- CE_TRACE_ERROR0(
- "CE_T3tSetLocalNDEFMsg (): p_scratch_buf cannot be NULL if not "
+ LOG(ERROR) << StringPrintf(
+ "p_scratch_buf cannot be NULL if not "
"read-only");
return NFC_STATUS_FAILED;
}
@@ -897,12 +902,13 @@
tNFC_STATUS CE_T3tSetLocalNDefParams(uint8_t nbr, uint8_t nbw) {
tCE_T3T_MEM* p_cb = &ce_cb.mem.t3t;
- CE_TRACE_API2("CE_T3tSetLocalNDefParams: nbr=%i, nbw=%i", nbr, nbw);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("CE_T3tSetLocalNDefParams: nbr=%i, nbw=%i", nbr, nbw);
/* Validate */
if ((nbr > T3T_MSG_NUM_BLOCKS_CHECK_MAX) ||
(nbw > T3T_MSG_NUM_BLOCKS_UPDATE_MAX) || (nbr < 1) || (nbw < 1)) {
- CE_TRACE_ERROR0("CE_T3tSetLocalNDefParams: invalid params");
+ LOG(ERROR) << StringPrintf("CE_T3tSetLocalNDefParams: invalid params");
return NFC_STATUS_FAILED;
}
@@ -928,13 +934,15 @@
NFC_HDR* p_rsp_msg;
uint8_t *p_dst, *p_rsp_start;
- CE_TRACE_API3("CE_T3tCheckRsp: status1=0x%02X, status2=0x%02X, num_blocks=%i",
- status1, status2, num_blocks);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "CE_T3tCheckRsp: status1=0x%02X, status2=0x%02X, num_blocks=%i", status1,
+ status2, num_blocks);
/* Validate num_blocks */
if (num_blocks > T3T_MSG_NUM_BLOCKS_CHECK_MAX) {
- CE_TRACE_ERROR2("CE_T3tCheckRsp num_blocks (%i) exceeds maximum (%i)",
- num_blocks, T3T_MSG_NUM_BLOCKS_CHECK_MAX);
+ LOG(ERROR) << StringPrintf(
+ "CE_T3tCheckRsp num_blocks (%i) exceeds maximum (%i)", num_blocks,
+ T3T_MSG_NUM_BLOCKS_CHECK_MAX);
return (NFC_STATUS_FAILED);
}
@@ -960,7 +968,8 @@
p_rsp_msg->len = (uint16_t)(p_dst - p_rsp_start);
ce_t3t_send_to_lower(p_rsp_msg);
} else {
- CE_TRACE_ERROR0("CE: Unable to allocate buffer for response message");
+ LOG(ERROR) << StringPrintf(
+ "CE: Unable to allocate buffer for response message");
}
return (retval);
@@ -979,8 +988,8 @@
tNFC_STATUS retval = NFC_STATUS_OK;
tCE_CB* p_ce_cb = &ce_cb;
- CE_TRACE_API2("CE_T3tUpdateRsp: status1=0x%02X, status2=0x%02X", status1,
- status2);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "CE_T3tUpdateRsp: status1=0x%02X, status2=0x%02X", status1, status2);
ce_t3t_send_rsp(p_ce_cb, NULL, T3T_MSG_OPC_UPDATE_RSP, status1, status2);
return (retval);
diff --git a/src/nfc/tags/ce_t4t.cc b/src/nfc/tags/ce_t4t.cc
index f641c77..0d15ae1 100644
--- a/src/nfc/tags/ce_t4t.cc
+++ b/src/nfc/tags/ce_t4t.cc
@@ -50,12 +50,10 @@
**
*******************************************************************************/
static bool ce_t4t_send_to_lower(NFC_HDR* p_r_apdu) {
-#if (BT_TRACE_PROTOCOL == TRUE)
DispCET4Tags(p_r_apdu, false);
-#endif
if (NFC_SendData(NFC_RF_CONN_ID, p_r_apdu) != NFC_STATUS_OK) {
- CE_TRACE_ERROR0("ce_t4t_send_to_lower (): NFC_SendData () failed");
+ LOG(ERROR) << StringPrintf("failed");
return false;
}
return true;
@@ -74,12 +72,12 @@
NFC_HDR* p_r_apdu;
uint8_t* p;
- CE_TRACE_DEBUG1("ce_t4t_send_status (): Status:0x%04X", status);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("Status:0x%04X", status);
p_r_apdu = (NFC_HDR*)GKI_getpoolbuf(NFC_CE_POOL_ID);
if (!p_r_apdu) {
- CE_TRACE_ERROR0("ce_t4t_send_status (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return false;
}
@@ -108,10 +106,10 @@
static bool ce_t4t_select_file(uint16_t file_id) {
tCE_T4T_MEM* p_t4t = &ce_cb.mem.t4t;
- CE_TRACE_DEBUG1("ce_t4t_select_file (): FileID:0x%04X", file_id);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("FileID:0x%04X", file_id);
if (file_id == T4T_CC_FILE_ID) {
- CE_TRACE_DEBUG0("ce_t4t_select_file (): Select CC file");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("Select CC file");
p_t4t->status |= CE_T4T_STATUS_CC_FILE_SELECTED;
p_t4t->status &= ~(CE_T4T_STATUS_NDEF_SELECTED);
@@ -120,8 +118,8 @@
}
if (file_id == CE_T4T_MANDATORY_NDEF_FILE_ID) {
- CE_TRACE_DEBUG3(
- "ce_t4t_select_file (): NLEN:0x%04X, MaxFileSize:0x%04X, "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "NLEN:0x%04X, MaxFileSize:0x%04X, "
"WriteAccess:%s",
p_t4t->nlen, p_t4t->max_file_size,
(p_t4t->status & CE_T4T_STATUS_NDEF_FILE_READ_ONLY ? "RW" : "RO"));
@@ -131,8 +129,7 @@
return true;
} else {
- CE_TRACE_ERROR1("ce_t4t_select_file (): Cannot find file ID (0x%04X)",
- file_id);
+ LOG(ERROR) << StringPrintf("Cannot find file ID (0x%04X)", file_id);
p_t4t->status &= ~(CE_T4T_STATUS_CC_FILE_SELECTED);
p_t4t->status &= ~(CE_T4T_STATUS_NDEF_SELECTED);
@@ -155,8 +152,8 @@
uint8_t *p_src = NULL, *p_dst;
NFC_HDR* p_r_apdu;
- CE_TRACE_DEBUG3(
- "ce_t4t_read_binary (): Offset:0x%04X, Length:0x%04X, selected status = "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Offset:0x%04X, Length:0x%04X, selected status = "
"0x%02X",
offset, length, p_t4t->status);
@@ -173,7 +170,7 @@
p_r_apdu = (NFC_HDR*)GKI_getpoolbuf(NFC_CE_POOL_ID);
if (!p_r_apdu) {
- CE_TRACE_ERROR0("ce_t4t_read_binary (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return false;
}
@@ -216,7 +213,7 @@
}
return true;
} else {
- CE_TRACE_ERROR0("ce_t4t_read_binary (): No selected file");
+ LOG(ERROR) << StringPrintf("No selected file");
if (!ce_t4t_send_status(T4T_RSP_CMD_NOT_ALLOWED)) {
return false;
@@ -242,8 +239,8 @@
uint16_t starting_offset;
tCE_DATA ce_data;
- CE_TRACE_DEBUG3(
- "ce_t4t_update_binary (): Offset:0x%04X, Length:0x%04X, selected status "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Offset:0x%04X, Length:0x%04X, selected status "
"= 0x%02X",
offset, length, p_t4t->status);
@@ -277,8 +274,8 @@
ce_data.update_info.p_data = p_t4t->p_scratch_buf;
(*ce_cb.p_cback)(CE_T4T_NDEF_UPDATE_CPLT_EVT, &ce_data);
- CE_TRACE_DEBUG0(
- "ce_t4t_update_binary (): Sent CE_T4T_NDEF_UPDATE_CPLT_EVT");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Sent CE_T4T_NDEF_UPDATE_CPLT_EVT");
}
p_t4t->status &= ~(CE_T4T_STATUS_NDEF_FILE_UPDATING);
@@ -317,7 +314,7 @@
tCE_T4T_MEM* p_t4t = &ce_cb.mem.t4t;
uint8_t* p;
- CE_TRACE_DEBUG1("ce_t4t_set_version_in_cc (): version = 0x%02X", version);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("version = 0x%02X", version);
p = p_t4t->cc_file + T4T_VERSION_OFFSET_IN_CC;
@@ -337,7 +334,7 @@
uint8_t data_len;
uint16_t file_id, status_words;
- CE_TRACE_DEBUG0("ce_t4t_process_select_file_cmd ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_cmd++; /* skip P2 */
@@ -382,7 +379,7 @@
tCE_DATA ce_data;
uint8_t xx;
- CE_TRACE_DEBUG0("ce_t4t_process_select_app_cmd ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_cmd++; /* skip P2 */
@@ -424,8 +421,8 @@
ce_cb.mem.t4t.status &= ~(CE_T4T_STATUS_WILDCARD_AID_SELECTED);
ce_cb.mem.t4t.status |= CE_T4T_STATUS_REG_AID_SELECTED;
- CE_TRACE_DEBUG4(
- "ce_t4t_process_select_app_cmd (): Registered AID[%02X%02X%02X%02X...] "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Registered AID[%02X%02X%02X%02X...] "
"is selected",
ce_cb.mem.t4t.reg_aid[ce_cb.mem.t4t.selected_aid_idx].aid[0],
ce_cb.mem.t4t.reg_aid[ce_cb.mem.t4t.selected_aid_idx].aid[1],
@@ -453,8 +450,7 @@
ce_t4t_set_version_in_cc(T4T_VERSION_2_0);
status_words = T4T_RSP_CMD_CMPLTED;
} else {
- CE_TRACE_DEBUG0(
- "ce_t4t_process_select_app_cmd (): Not found matched AID");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("Not found matched AID");
status_words = T4T_RSP_NOT_FOUND;
}
} else if (ce_cb.mem.t4t.p_wildcard_aid_cback) {
@@ -469,12 +465,12 @@
ce_data.raw_frame.aid_handle = CE_T4T_WILDCARD_AID_HANDLE;
p_c_apdu = NULL;
- CE_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"CET4T: Forward raw frame (SELECT APP) to wildcard AID handler");
(*(ce_cb.mem.t4t.p_wildcard_aid_cback))(CE_T4T_RAW_FRAME_EVT, &ce_data);
} else {
- CE_TRACE_DEBUG0(
- "ce_t4t_process_select_app_cmd (): Not found matched AID or not "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Not found matched AID or not "
"listening T4T NDEF");
status_words = T4T_RSP_NOT_FOUND;
}
@@ -488,7 +484,7 @@
ce_cb.mem.t4t.status &= ~(CE_T4T_STATUS_WILDCARD_AID_SELECTED);
ce_cb.mem.t4t.status |= CE_T4T_STATUS_T4T_APP_SELECTED;
- CE_TRACE_DEBUG0("ce_t4t_process_select_app_cmd (): T4T CE App selected");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("T4T CE App selected");
}
ce_t4t_send_status(status_words);
@@ -512,7 +508,7 @@
tCE_T4T_MEM* p_t4t = &ce_cb.mem.t4t;
tCE_DATA ce_data;
- CE_TRACE_DEBUG1("ce_t4t_process_timeout () event=%d", p_tle->event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("event=%d", p_tle->event);
if (p_tle->event == NFC_TTYPE_CE_T4T_UPDATE) {
if (p_t4t->status & CE_T4T_STATUS_NDEF_FILE_UPDATING) {
@@ -524,7 +520,7 @@
p_t4t->status &= ~(CE_T4T_STATUS_NDEF_FILE_UPDATING);
}
} else {
- CE_TRACE_ERROR1("ce_t4t_process_timeout () unknown event=%d", p_tle->event);
+ LOG(ERROR) << StringPrintf("unknown event=%d", p_tle->event);
}
}
@@ -555,11 +551,9 @@
p_c_apdu = (NFC_HDR*)p_data->data.p_data;
-#if (BT_TRACE_PROTOCOL == TRUE)
DispCET4Tags(p_c_apdu, true);
-#endif
- CE_TRACE_DEBUG1("ce_t4t_data_cback (): conn_id = 0x%02X", conn_id);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("conn_id = 0x%02X", conn_id);
p_cmd = (uint8_t*)(p_c_apdu + 1) + p_c_apdu->offset;
@@ -590,7 +584,8 @@
/* if registered AID is selected */
if (ce_cb.mem.t4t.status & CE_T4T_STATUS_REG_AID_SELECTED) {
- CE_TRACE_DEBUG0("CET4T: Forward raw frame to registered AID");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("CET4T: Forward raw frame to registered AID");
/* forward raw frame to upper layer */
if (ce_cb.mem.t4t.selected_aid_idx < CE_T4T_MAX_REG_AID) {
@@ -606,7 +601,8 @@
ce_t4t_send_status(T4T_RSP_NOT_FOUND);
}
} else if (ce_cb.mem.t4t.status & CE_T4T_STATUS_WILDCARD_AID_SELECTED) {
- CE_TRACE_DEBUG0("CET4T: Forward raw frame to wildcard AID handler");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("CET4T: Forward raw frame to wildcard AID handler");
/* forward raw frame to upper layer */
ce_data.raw_frame.status = p_data->data.status;
@@ -621,7 +617,7 @@
if (select_type == T4T_CMD_P1_SELECT_BY_FILE_ID) {
ce_t4t_process_select_file_cmd(p_cmd);
} else {
- CE_TRACE_ERROR1("CET4T: Bad P1 byte (0x%02X)", select_type);
+ LOG(ERROR) << StringPrintf("CET4T: Bad P1 byte (0x%02X)", select_type);
ce_t4t_send_status(T4T_RSP_WRONG_PARAMS);
}
} else if (instruct == T4T_CMD_INS_READ_BINARY) {
@@ -644,19 +640,20 @@
if (offset < max_file_size) {
length = (uint8_t)(max_file_size - offset);
- CE_TRACE_DEBUG2(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"CET4T: length is reduced to %d by max_file_size (%d)",
length, max_file_size);
} else {
- CE_TRACE_ERROR2(
+ LOG(ERROR) << StringPrintf(
"CET4T: offset (%d) must be less than max_file_size (%d)",
offset, max_file_size);
length = 0;
}
}
} else {
- CE_TRACE_ERROR2("CET4T: length (%d) must be less than MLe (%d)",
- length, CE_T4T_MAX_LE);
+ LOG(ERROR) << StringPrintf(
+ "CET4T: length (%d) must be less than MLe (%zu)", length,
+ CE_T4T_MAX_LE);
length = 0;
}
@@ -665,12 +662,12 @@
else
ce_t4t_send_status(T4T_RSP_WRONG_PARAMS);
} else {
- CE_TRACE_ERROR0("CET4T: File has not been selected");
+ LOG(ERROR) << StringPrintf("CET4T: File has not been selected");
ce_t4t_send_status(T4T_RSP_CMD_NOT_ALLOWED);
}
} else if (instruct == T4T_CMD_INS_UPDATE_BINARY) {
if (ce_cb.mem.t4t.status & CE_T4T_STATUS_NDEF_FILE_READ_ONLY) {
- CE_TRACE_ERROR0("CET4T: No access right");
+ LOG(ERROR) << StringPrintf("CET4T: No access right");
ce_t4t_send_status(T4T_RSP_CMD_NOT_ALLOWED);
} else if (ce_cb.mem.t4t.status & CE_T4T_STATUS_NDEF_SELECTED) {
BE_STREAM_TO_UINT16(offset, p_cmd); /* Offset */
@@ -679,15 +676,16 @@
/* check if valid parameters */
if ((uint32_t)length <= CE_T4T_MAX_LC) {
if (length + offset > ce_cb.mem.t4t.max_file_size) {
- CE_TRACE_ERROR3(
+ LOG(ERROR) << StringPrintf(
"CET4T: length (%d) + offset (%d) must be less than "
"max_file_size (%d)",
length, offset, ce_cb.mem.t4t.max_file_size);
length = 0;
}
} else {
- CE_TRACE_ERROR2("CET4T: length (%d) must be less than MLc (%d)",
- length, CE_T4T_MAX_LC);
+ LOG(ERROR) << StringPrintf(
+ "CET4T: length (%d) must be less than MLc (%zu)", length,
+ CE_T4T_MAX_LC);
length = 0;
}
@@ -696,15 +694,16 @@
else
ce_t4t_send_status(T4T_RSP_WRONG_PARAMS);
} else {
- CE_TRACE_ERROR0("CET4T: NDEF File has not been selected");
+ LOG(ERROR) << StringPrintf("CET4T: NDEF File has not been selected");
ce_t4t_send_status(T4T_RSP_CMD_NOT_ALLOWED);
}
} else {
- CE_TRACE_ERROR1("CET4T: Unsupported Instruction byte (0x%02X)", instruct);
+ LOG(ERROR) << StringPrintf("CET4T: Unsupported Instruction byte (0x%02X)",
+ instruct);
ce_t4t_send_status(T4T_RSP_INSTR_NOT_SUPPORTED);
}
} else {
- CE_TRACE_ERROR0("CET4T: Application has not been selected");
+ LOG(ERROR) << StringPrintf("CET4T: Application has not been selected");
ce_t4t_send_status(T4T_RSP_CMD_NOT_ALLOWED);
}
@@ -723,7 +722,7 @@
tNFC_STATUS ce_select_t4t(void) {
tCE_T4T_MEM* p_t4t = &ce_cb.mem.t4t;
- CE_TRACE_DEBUG0("ce_select_t4t ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
nfc_stop_quick_timer(&p_t4t->timer);
@@ -762,20 +761,20 @@
tCE_T4T_MEM* p_t4t = &ce_cb.mem.t4t;
uint8_t* p;
- CE_TRACE_API3(
- "CE_T4tSetLocalNDEFMsg () read_only=%d, ndef_msg_max=%d, ndef_msg_len=%d",
- read_only, ndef_msg_max, ndef_msg_len);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("read_only=%d, ndef_msg_max=%d, ndef_msg_len=%d",
+ read_only, ndef_msg_max, ndef_msg_len);
if (!p_ndef_msg) {
p_t4t->p_ndef_msg = NULL;
- CE_TRACE_DEBUG0("CE_T4tSetLocalNDEFMsg (): T4T is disabled");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("T4T is disabled");
return NFC_STATUS_OK;
}
if ((!read_only) && (!p_scratch_buf)) {
- CE_TRACE_ERROR0(
- "CE_T4tSetLocalNDEFMsg (): p_scratch_buf cannot be NULL if not "
+ LOG(ERROR) << StringPrintf(
+ "p_scratch_buf cannot be NULL if not "
"read-only");
return NFC_STATUS_FAILED;
}
@@ -844,43 +843,43 @@
/* Handle registering callback for wildcard AID (all AIDs) */
if (aid_len == 0) {
- CE_TRACE_API0(
- "CE_T4tRegisterAID (): registering callback for wildcard AID ");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("registering callback for wildcard AID ");
/* Check if a wildcard callback is already registered (only one is allowed)
*/
if (p_t4t->p_wildcard_aid_cback != NULL) {
- CE_TRACE_ERROR0(
- "CE_T4tRegisterAID (): only one wildcard AID can be registered at "
+ LOG(ERROR) << StringPrintf(
+ "only one wildcard AID can be registered at "
"time.");
return CE_T4T_AID_HANDLE_INVALID;
}
- CE_TRACE_DEBUG1(
- "CE_T4tRegisterAID (): handle 0x%02x registered (for wildcard AID)",
- CE_T4T_WILDCARD_AID_HANDLE);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("handle 0x%02x registered (for wildcard AID)",
+ CE_T4T_WILDCARD_AID_HANDLE);
p_t4t->p_wildcard_aid_cback = p_cback;
return CE_T4T_WILDCARD_AID_HANDLE;
}
- CE_TRACE_API5("CE_T4tRegisterAID () AID [%02X%02X%02X%02X...], %d bytes",
- *p_aid, *(p_aid + 1), *(p_aid + 2), *(p_aid + 3), aid_len);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("AID [%02X%02X%02X%02X...], %d bytes", *p_aid,
+ *(p_aid + 1), *(p_aid + 2), *(p_aid + 3), aid_len);
if (aid_len > NFC_MAX_AID_LEN) {
- CE_TRACE_ERROR1("CE_T4tRegisterAID (): AID is up to %d bytes",
- NFC_MAX_AID_LEN);
+ LOG(ERROR) << StringPrintf("AID is up to %d bytes", NFC_MAX_AID_LEN);
return CE_T4T_AID_HANDLE_INVALID;
}
if (p_cback == NULL) {
- CE_TRACE_ERROR0("CE_T4tRegisterAID (): callback must be provided");
+ LOG(ERROR) << StringPrintf("callback must be provided");
return CE_T4T_AID_HANDLE_INVALID;
}
for (xx = 0; xx < CE_T4T_MAX_REG_AID; xx++) {
if ((p_t4t->reg_aid[xx].aid_len == aid_len) &&
(!(memcmp(p_t4t->reg_aid[xx].aid, p_aid, aid_len)))) {
- CE_TRACE_ERROR0("CE_T4tRegisterAID (): already registered");
+ LOG(ERROR) << StringPrintf("already registered");
return CE_T4T_AID_HANDLE_INVALID;
}
}
@@ -895,10 +894,11 @@
}
if (xx >= CE_T4T_MAX_REG_AID) {
- CE_TRACE_ERROR0("CE_T4tRegisterAID (): No resource");
+ LOG(ERROR) << StringPrintf("No resource");
return CE_T4T_AID_HANDLE_INVALID;
} else {
- CE_TRACE_DEBUG1("CE_T4tRegisterAID (): handle 0x%02x registered", xx);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("handle 0x%02x registered", xx);
}
return (xx);
@@ -916,14 +916,14 @@
extern void CE_T4tDeregisterAID(tCE_T4T_AID_HANDLE aid_handle) {
tCE_T4T_MEM* p_t4t = &ce_cb.mem.t4t;
- CE_TRACE_API1("CE_T4tDeregisterAID () handle 0x%02x", aid_handle);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("handle 0x%02x", aid_handle);
/* Check if deregistering wildcard AID */
if (aid_handle == CE_T4T_WILDCARD_AID_HANDLE) {
if (p_t4t->p_wildcard_aid_cback != NULL) {
p_t4t->p_wildcard_aid_cback = NULL;
} else {
- CE_TRACE_ERROR0("CE_T4tDeregisterAID (): Invalid handle");
+ LOG(ERROR) << StringPrintf("Invalid handle");
}
return;
}
@@ -931,7 +931,7 @@
/* Deregister AID */
if ((aid_handle >= CE_T4T_MAX_REG_AID) ||
(p_t4t->reg_aid[aid_handle].aid_len == 0)) {
- CE_TRACE_ERROR0("CE_T4tDeregisterAID (): Invalid handle");
+ LOG(ERROR) << StringPrintf("Invalid handle");
} else {
p_t4t->reg_aid[aid_handle].aid_len = 0;
p_t4t->reg_aid[aid_handle].p_cback = NULL;
@@ -953,8 +953,8 @@
tCE_T4T_MEM* p_t4t = &ce_cb.mem.t4t;
uint8_t* p;
- CE_TRACE_DEBUG4(
- "CE_T4TTestSetCC (): CCLen:0x%04X, Ver:0x%02X, MaxLe:0x%04X, "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "CCLen:0x%04X, Ver:0x%02X, MaxLe:0x%04X, "
"MaxLc:0x%04X",
cc_len, version, max_le, max_lc);
@@ -1014,8 +1014,8 @@
tCE_T4T_MEM* p_t4t = &ce_cb.mem.t4t;
uint8_t* p;
- CE_TRACE_DEBUG6(
- "CE_T4TTestSetNDEFCtrlTLV (): type:0x%02X, len:0x%02X, FileID:0x%04X, "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "type:0x%02X, len:0x%02X, FileID:0x%04X, "
"MaxFile:0x%04X, RdAcc:0x%02X, WrAcc:0x%02X",
type, length, file_id, max_file_size, read_access, write_access);
diff --git a/src/nfc/tags/rw_i93.cc b/src/nfc/tags/rw_i93.cc
index 990aba1..75dacab 100644
--- a/src/nfc/tags/rw_i93.cc
+++ b/src/nfc/tags/rw_i93.cc
@@ -80,11 +80,9 @@
RW_I93_SUBSTATE_WAIT_LOCK_CC /* lock block of CC */
};
-#if (BT_TRACE_VERBOSE == TRUE)
static std::string rw_i93_get_state_name(uint8_t state);
static std::string rw_i93_get_sub_state_name(uint8_t sub_state);
static std::string rw_i93_get_tag_name(uint8_t product_version);
-#endif
static void rw_i93_data_cback(uint8_t conn_id, tNFC_CONN_EVT event,
tNFC_CONN* p_data);
@@ -107,7 +105,7 @@
return;
}
- RW_TRACE_DEBUG0("rw_i93_get_product_version ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
memcpy(p_i93->uid, p_uid, I93_UID_BYTE_LEN);
@@ -169,12 +167,9 @@
p_i93->product_version = RW_I93_UNKNOWN_PRODUCT;
}
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_DEBUG1("product_version = <%s>",
- rw_i93_get_tag_name(p_i93->product_version).c_str());
-#else
- RW_TRACE_DEBUG1("product_version = %d", p_i93->product_version);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("product_version = <%s>",
+ rw_i93_get_tag_name(p_i93->product_version).c_str());
switch (p_i93->product_version) {
case RW_I93_TAG_IT_HF_I_STD_CHIP_INLAY:
@@ -204,7 +199,7 @@
tRW_I93_CB* p_i93 = &rw_cb.tcb.i93;
uint8_t uid[I93_UID_BYTE_LEN], *p_uid;
- RW_TRACE_DEBUG0("rw_i93_process_sys_info ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
STREAM_TO_UINT8(p_i93->info_flags, p);
@@ -300,7 +295,7 @@
bool rw_i93_check_sys_info_prot_ext(uint8_t error_code) {
tRW_I93_CB* p_i93 = &rw_cb.tcb.i93;
- RW_TRACE_DEBUG0("rw_i93_check_sys_info_prot_ext ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if ((p_i93->uid[1] == I93_UID_IC_MFG_CODE_STM) &&
(p_i93->sent_cmd == I93_CMD_GET_SYS_INFO) &&
@@ -331,7 +326,7 @@
uint8_t flags;
NFC_HDR* p_buff;
- RW_TRACE_DEBUG0("rw_i93_send_to_upper ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
STREAM_TO_UINT8(flags, p);
length--;
@@ -444,7 +439,7 @@
if (event != RW_I93_MAX_EVT) {
(*(rw_cb.p_cback))(event, &rw_data);
} else {
- RW_TRACE_ERROR0("rw_i93_send_to_upper (): Invalid response");
+ LOG(ERROR) << StringPrintf("Invalid response");
}
}
@@ -458,9 +453,7 @@
**
*******************************************************************************/
bool rw_i93_send_to_lower(NFC_HDR* p_msg) {
-#if (BT_TRACE_PROTOCOL == TRUE)
DispRWI93Tag(p_msg, false, 0x00);
-#endif
/* store command for retransmitting */
if (rw_cb.tcb.i93.p_retry_cmd) {
@@ -476,7 +469,7 @@
}
if (NFC_SendData(NFC_RF_CONN_ID, p_msg) != NFC_STATUS_OK) {
- RW_TRACE_ERROR0("rw_i93_send_to_lower (): NFC_SendData () failed");
+ LOG(ERROR) << StringPrintf("failed");
return false;
}
@@ -500,13 +493,13 @@
NFC_HDR* p_cmd;
uint8_t *p, flags;
- RW_TRACE_DEBUG2("rw_i93_send_cmd_inventory () including_afi:%d, AFI:0x%02X",
- including_afi, afi);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("including_afi:%d, AFI:0x%02X", including_afi, afi);
p_cmd = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_cmd) {
- RW_TRACE_ERROR0("rw_i93_send_cmd_inventory (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return NFC_STATUS_NO_BUFFERS;
}
@@ -561,12 +554,12 @@
NFC_HDR* p_cmd;
uint8_t* p;
- RW_TRACE_DEBUG0("rw_i93_send_cmd_stay_quiet ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_cmd = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_cmd) {
- RW_TRACE_ERROR0("rw_i93_send_cmd_stay_quiet (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return NFC_STATUS_NO_BUFFERS;
}
@@ -611,13 +604,12 @@
NFC_HDR* p_cmd;
uint8_t *p, flags;
- RW_TRACE_DEBUG0("rw_i93_send_cmd_read_single_block ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_cmd = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_cmd) {
- RW_TRACE_ERROR0(
- "rw_i93_send_cmd_read_single_block (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return NFC_STATUS_NO_BUFFERS;
}
@@ -671,13 +663,12 @@
NFC_HDR* p_cmd;
uint8_t *p, flags;
- RW_TRACE_DEBUG0("rw_i93_send_cmd_write_single_block ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_cmd = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_cmd) {
- RW_TRACE_ERROR0(
- "rw_i93_send_cmd_write_single_block (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return NFC_STATUS_NO_BUFFERS;
}
@@ -743,12 +734,12 @@
NFC_HDR* p_cmd;
uint8_t* p;
- RW_TRACE_DEBUG0("rw_i93_send_cmd_lock_block ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_cmd = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_cmd) {
- RW_TRACE_ERROR0("rw_i93_send_cmd_lock_block (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return NFC_STATUS_NO_BUFFERS;
}
@@ -798,13 +789,12 @@
NFC_HDR* p_cmd;
uint8_t *p, flags;
- RW_TRACE_DEBUG0("rw_i93_send_cmd_read_multi_blocks ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_cmd = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_cmd) {
- RW_TRACE_ERROR0(
- "rw_i93_send_cmd_read_multi_blocks (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return NFC_STATUS_NO_BUFFERS;
}
@@ -860,13 +850,12 @@
NFC_HDR* p_cmd;
uint8_t* p;
- RW_TRACE_DEBUG0("rw_i93_send_cmd_write_multi_blocks ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_cmd = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_cmd) {
- RW_TRACE_ERROR0(
- "rw_i93_send_cmd_write_multi_blocks (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return NFC_STATUS_NO_BUFFERS;
}
@@ -911,12 +900,12 @@
NFC_HDR* p_cmd;
uint8_t* p;
- RW_TRACE_DEBUG0("rw_i93_send_cmd_select ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_cmd = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_cmd) {
- RW_TRACE_ERROR0("rw_i93_send_cmd_select (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return NFC_STATUS_NO_BUFFERS;
}
@@ -955,13 +944,12 @@
NFC_HDR* p_cmd;
uint8_t* p;
- RW_TRACE_DEBUG0("rw_i93_send_cmd_reset_to_ready ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_cmd = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_cmd) {
- RW_TRACE_ERROR0(
- "rw_i93_send_cmd_reset_to_ready (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return NFC_STATUS_NO_BUFFERS;
}
@@ -1000,12 +988,12 @@
NFC_HDR* p_cmd;
uint8_t* p;
- RW_TRACE_DEBUG0("rw_i93_send_cmd_write_afi ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_cmd = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_cmd) {
- RW_TRACE_ERROR0("rw_i93_send_cmd_write_afi (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return NFC_STATUS_NO_BUFFERS;
}
@@ -1045,12 +1033,12 @@
NFC_HDR* p_cmd;
uint8_t* p;
- RW_TRACE_DEBUG0("rw_i93_send_cmd_lock_afi ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_cmd = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_cmd) {
- RW_TRACE_ERROR0("rw_i93_send_cmd_lock_afi (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return NFC_STATUS_NO_BUFFERS;
}
@@ -1089,12 +1077,12 @@
NFC_HDR* p_cmd;
uint8_t* p;
- RW_TRACE_DEBUG0("rw_i93_send_cmd_write_dsfid ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_cmd = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_cmd) {
- RW_TRACE_ERROR0("rw_i93_send_cmd_write_dsfid (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return NFC_STATUS_NO_BUFFERS;
}
@@ -1134,12 +1122,12 @@
NFC_HDR* p_cmd;
uint8_t* p;
- RW_TRACE_DEBUG0("rw_i93_send_cmd_lock_dsfid ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_cmd = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_cmd) {
- RW_TRACE_ERROR0("rw_i93_send_cmd_lock_dsfid (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return NFC_STATUS_NO_BUFFERS;
}
@@ -1178,12 +1166,12 @@
NFC_HDR* p_cmd;
uint8_t* p;
- RW_TRACE_DEBUG0("rw_i93_send_cmd_get_sys_info ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_cmd = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_cmd) {
- RW_TRACE_ERROR0("rw_i93_send_cmd_get_sys_info (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return NFC_STATUS_NO_BUFFERS;
}
@@ -1227,13 +1215,12 @@
NFC_HDR* p_cmd;
uint8_t *p, flags;
- RW_TRACE_DEBUG0("rw_i93_send_cmd_get_multi_block_sec ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
p_cmd = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_cmd) {
- RW_TRACE_ERROR0(
- "rw_i93_send_cmd_get_multi_block_sec (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return NFC_STATUS_NO_BUFFERS;
}
@@ -1290,7 +1277,7 @@
uint16_t first_block;
uint16_t num_block;
- RW_TRACE_DEBUG0("rw_i93_get_next_blocks ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
first_block = offset / p_i93->block_size;
@@ -1344,11 +1331,12 @@
tRW_I93_CB* p_i93 = &rw_cb.tcb.i93;
uint16_t num_blocks;
- RW_TRACE_DEBUG0("rw_i93_get_next_block_sec ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (p_i93->num_block <= p_i93->rw_offset) {
- RW_TRACE_ERROR2("rw_offset(0x%x) must be less than num_block(0x%x)",
- p_i93->rw_offset, p_i93->num_block);
+ LOG(ERROR) << StringPrintf(
+ "rw_offset(0x%x) must be less than num_block(0x%x)", p_i93->rw_offset,
+ p_i93->num_block);
return NFC_STATUS_FAILED;
}
@@ -1384,13 +1372,9 @@
tRW_DATA rw_data;
tNFC_STATUS status = NFC_STATUS_FAILED;
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_DEBUG2("rw_i93_sm_detect_ndef () sub_state:%s (0x%x)",
- rw_i93_get_sub_state_name(p_i93->sub_state).c_str(),
- p_i93->sub_state);
-#else
- RW_TRACE_DEBUG1("rw_i93_sm_detect_ndef () sub_state:0x%x", p_i93->sub_state);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "sub_state:%s (0x%x)",
+ rw_i93_get_sub_state_name(p_i93->sub_state).c_str(), p_i93->sub_state);
STREAM_TO_UINT8(flags, p);
length--;
@@ -1401,7 +1385,8 @@
/* This STM tag supports more than 2040 bytes */
p_i93->intl_flags |= RW_I93_FLAG_16BIT_NUM_BLOCK;
} else {
- RW_TRACE_DEBUG1("Got error flags (0x%02x)", flags);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Got error flags (0x%02x)", flags);
rw_i93_handle_error(NFC_STATUS_FAILED);
}
return;
@@ -1416,7 +1401,8 @@
if (u8 != I93_DFS_UNSUPPORTED) {
/* if Data Storage Format is unknown */
- RW_TRACE_DEBUG1("Got unknown DSFID (0x%02x)", u8);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Got unknown DSFID (0x%02x)", u8);
rw_i93_handle_error(NFC_STATUS_FAILED);
} else {
/* get system information to get memory size */
@@ -1440,7 +1426,8 @@
}
if ((p_i93->block_size == 0) || (p_i93->num_block == 0)) {
- RW_TRACE_DEBUG0("Unable to get tag memory size");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Unable to get tag memory size");
rw_i93_handle_error(status);
} else {
/* read CC in the first block */
@@ -1476,12 +1463,11 @@
** : Bit 2:More than 2040 bytes are supported [STM]
*/
- RW_TRACE_DEBUG4(
- "rw_i93_sm_detect_ndef (): cc: 0x%02X 0x%02X 0x%02X 0x%02X", cc[0],
- cc[1], cc[2], cc[3]);
- RW_TRACE_DEBUG2(
- "rw_i93_sm_detect_ndef (): Total blocks:0x%04X, Block size:0x%02X",
- p_i93->num_block, p_i93->block_size);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "cc: 0x%02X 0x%02X 0x%02X 0x%02X", cc[0], cc[1], cc[2], cc[3]);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Total blocks:0x%04X, Block size:0x%02X",
+ p_i93->num_block, p_i93->block_size);
if ((cc[0] == I93_ICODE_CC_MAGIC_NUMER) &&
((cc[3] & I93_STM_CC_OVERFLOW_MASK) ||
@@ -1540,7 +1526,8 @@
p_i93->tlv_type = I93_ICODE_TLV_TYPE_TERM;
break;
} else {
- RW_TRACE_DEBUG1("Invalid type: 0x%02x", *(p + xx));
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Invalid type: 0x%02x", *(p + xx));
rw_i93_handle_error(NFC_STATUS_FAILED);
return;
}
@@ -1735,9 +1722,9 @@
p_i93->state = RW_I93_STATE_IDLE;
p_i93->sent_cmd = 0;
- RW_TRACE_DEBUG3("NDEF cur_size(%d),max_size (%d), flags (0x%x)",
- rw_data.ndef.cur_size, rw_data.ndef.max_size,
- rw_data.ndef.flags);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "NDEF cur_size(%d),max_size (%d), flags (0x%x)",
+ rw_data.ndef.cur_size, rw_data.ndef.max_size, rw_data.ndef.flags);
(*(rw_cb.p_cback))(RW_I93_NDEF_DETECT_EVT, &rw_data);
break;
@@ -1763,13 +1750,14 @@
tRW_I93_CB* p_i93 = &rw_cb.tcb.i93;
tRW_DATA rw_data;
- RW_TRACE_DEBUG0("rw_i93_sm_read_ndef ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
STREAM_TO_UINT8(flags, p);
length--;
if (flags & I93_FLAG_ERROR_DETECTED) {
- RW_TRACE_DEBUG1("Got error flags (0x%02x)", flags);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Got error flags (0x%02x)", flags);
rw_i93_handle_error(NFC_STATUS_FAILED);
return;
}
@@ -1815,13 +1803,15 @@
p_i93->state = RW_I93_STATE_IDLE;
p_i93->sent_cmd = 0;
- RW_TRACE_DEBUG2("NDEF read complete read (%d)/total (%d)", p_resp->len,
- p_i93->ndef_length);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NDEF read complete read (%d)/total (%d)", p_resp->len,
+ p_i93->ndef_length);
(*(rw_cb.p_cback))(RW_I93_NDEF_READ_CPLT_EVT, &rw_data);
} else {
- RW_TRACE_DEBUG2("NDEF read segment read (%d)/total (%d)", p_resp->len,
- p_i93->ndef_length);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NDEF read segment read (%d)/total (%d)", p_resp->len,
+ p_i93->ndef_length);
if (p_resp->len > 0) {
(*(rw_cb.p_cback))(RW_I93_NDEF_READ_EVT, &rw_data);
@@ -1856,13 +1846,9 @@
tRW_I93_CB* p_i93 = &rw_cb.tcb.i93;
tRW_DATA rw_data;
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_DEBUG2("rw_i93_sm_update_ndef () sub_state:%s (0x%x)",
- rw_i93_get_sub_state_name(p_i93->sub_state).c_str(),
- p_i93->sub_state);
-#else
- RW_TRACE_DEBUG1("rw_i93_sm_update_ndef () sub_state:0x%x", p_i93->sub_state);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "sub_state:%s (0x%x)",
+ rw_i93_get_sub_state_name(p_i93->sub_state).c_str(), p_i93->sub_state);
STREAM_TO_UINT8(flags, p);
length--;
@@ -1875,7 +1861,8 @@
(*p == I93_ERROR_CODE_BLOCK_FAIL_TO_WRITE)) {
/* ignore error */
} else {
- RW_TRACE_DEBUG1("Got error flags (0x%02x)", flags);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Got error flags (0x%02x)", flags);
rw_i93_handle_error(NFC_STATUS_FAILED);
return;
}
@@ -2069,9 +2056,9 @@
}
}
} else {
- RW_TRACE_DEBUG3("NDEF update complete, %d bytes, (%d-%d)",
- p_i93->ndef_length, p_i93->ndef_tlv_start_offset,
- p_i93->ndef_tlv_last_offset);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "NDEF update complete, %d bytes, (%d-%d)", p_i93->ndef_length,
+ p_i93->ndef_tlv_start_offset, p_i93->ndef_tlv_last_offset);
p_i93->state = RW_I93_STATE_IDLE;
p_i93->sent_cmd = 0;
@@ -2109,13 +2096,9 @@
tRW_DATA rw_data;
tNFC_STATUS status = NFC_STATUS_FAILED;
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_DEBUG2("rw_i93_sm_format () sub_state:%s (0x%x)",
- rw_i93_get_sub_state_name(p_i93->sub_state).c_str(),
- p_i93->sub_state);
-#else
- RW_TRACE_DEBUG1("rw_i93_sm_format () sub_state:0x%x", p_i93->sub_state);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "sub_state:%s (0x%x)",
+ rw_i93_get_sub_state_name(p_i93->sub_state).c_str(), p_i93->sub_state);
STREAM_TO_UINT8(flags, p);
length--;
@@ -2133,7 +2116,8 @@
p_i93->intl_flags |= RW_I93_FLAG_16BIT_NUM_BLOCK;
return;
} else {
- RW_TRACE_DEBUG1("Got error flags (0x%02x)", flags);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Got error flags (0x%02x)", flags);
rw_i93_handle_error(NFC_STATUS_FAILED);
return;
}
@@ -2179,7 +2163,8 @@
}
if ((p_i93->block_size == 0) || (p_i93->num_block == 0)) {
- RW_TRACE_DEBUG0("Unable to get tag memory size");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Unable to get tag memory size");
rw_i93_handle_error(status);
} else if (p_i93->intl_flags & RW_I93_FLAG_RESET_DSFID) {
if (rw_i93_send_cmd_write_dsfid(I93_DFS_UNSUPPORTED) == NFC_STATUS_OK) {
@@ -2325,7 +2310,7 @@
p_i93->p_update_data = (uint8_t*)GKI_getbuf(RW_I93_FORMAT_DATA_LEN);
if (!p_i93->p_update_data) {
- RW_TRACE_ERROR0("rw_i93_sm_format (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
rw_i93_handle_error(NFC_STATUS_FAILED);
break;
}
@@ -2441,14 +2426,9 @@
tRW_I93_CB* p_i93 = &rw_cb.tcb.i93;
tRW_DATA rw_data;
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_DEBUG2("rw_i93_sm_set_read_only () sub_state:%s (0x%x)",
- rw_i93_get_sub_state_name(p_i93->sub_state).c_str(),
- p_i93->sub_state);
-#else
- RW_TRACE_DEBUG1("rw_i93_sm_set_read_only () sub_state:0x%x",
- p_i93->sub_state);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "sub_state:%s (0x%x)",
+ rw_i93_get_sub_state_name(p_i93->sub_state).c_str(), p_i93->sub_state);
STREAM_TO_UINT8(flags, p);
length--;
@@ -2461,7 +2441,8 @@
(*p == I93_ERROR_CODE_BLOCK_FAIL_TO_WRITE)) {
/* ignore error */
} else {
- RW_TRACE_DEBUG1("Got error flags (0x%02x)", flags);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Got error flags (0x%02x)", flags);
rw_i93_handle_error(NFC_STATUS_FAILED);
return;
}
@@ -2554,8 +2535,8 @@
tRW_DATA rw_data;
tRW_EVENT event;
- RW_TRACE_DEBUG2("rw_i93_handle_error (): status:0x%02X, state:0x%X", status,
- p_i93->state);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("status:0x%02X, state:0x%X", status, p_i93->state);
nfc_stop_quick_timer(&p_i93->timer);
@@ -2642,15 +2623,14 @@
void rw_i93_process_timeout(TIMER_LIST_ENT* p_tle) {
NFC_HDR* p_buf;
- RW_TRACE_DEBUG1("rw_i93_process_timeout () event=%d", p_tle->event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("event=%d", p_tle->event);
if (p_tle->event == NFC_TTYPE_RW_I93_RESPONSE) {
if ((rw_cb.tcb.i93.retry_count < RW_MAX_RETRIES) &&
(rw_cb.tcb.i93.p_retry_cmd) &&
(rw_cb.tcb.i93.sent_cmd != I93_CMD_STAY_QUIET)) {
rw_cb.tcb.i93.retry_count++;
- RW_TRACE_ERROR1("rw_i93_process_timeout (): retry_count = %d",
- rw_cb.tcb.i93.retry_count);
+ LOG(ERROR) << StringPrintf("retry_count = %d", rw_cb.tcb.i93.retry_count);
p_buf = rw_cb.tcb.i93.p_retry_cmd;
rw_cb.tcb.i93.p_retry_cmd = NULL;
@@ -2668,7 +2648,7 @@
}
rw_i93_handle_error(NFC_STATUS_TIMEOUT);
} else {
- RW_TRACE_ERROR1("rw_i93_process_timeout () unknown event=%d", p_tle->event);
+ LOG(ERROR) << StringPrintf("unknown event=%d", p_tle->event);
}
}
@@ -2687,11 +2667,9 @@
NFC_HDR* p_resp;
tRW_DATA rw_data;
-#if (BT_TRACE_VERBOSE == TRUE)
uint8_t begin_state = p_i93->state;
-#endif
- RW_TRACE_DEBUG1("rw_i93_data_cback () event = 0x%X", event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("event = 0x%X", event);
if ((event == NFC_DEACTIVATE_CEVT) || (event == NFC_ERROR_CEVT) ||
((event == NFC_DATA_CEVT) && (p_data->status != NFC_STATUS_OK))) {
@@ -2701,8 +2679,7 @@
if ((p_i93->retry_count < RW_MAX_RETRIES) && (p_i93->p_retry_cmd)) {
p_i93->retry_count++;
- RW_TRACE_ERROR1("rw_i93_data_cback (): retry_count = %d",
- p_i93->retry_count);
+ LOG(ERROR) << StringPrintf("retry_count = %d", p_i93->retry_count);
p_resp = p_i93->p_retry_cmd;
p_i93->p_retry_cmd = NULL;
@@ -2747,16 +2724,11 @@
p_i93->retry_count = 0;
}
-#if (BT_TRACE_PROTOCOL == TRUE)
DispRWI93Tag(p_resp, true, p_i93->sent_cmd);
-#endif
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_DEBUG2("RW I93 state: <%s (%d)>",
- rw_i93_get_state_name(p_i93->state).c_str(), p_i93->state);
-#else
- RW_TRACE_DEBUG1("RW I93 state: %d", p_i93->state);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "RW I93 state: <%s (%d)>", rw_i93_get_state_name(p_i93->state).c_str(),
+ p_i93->state);
switch (p_i93->state) {
case RW_I93_STATE_IDLE:
@@ -2814,18 +2786,17 @@
break;
default:
- RW_TRACE_ERROR1("rw_i93_data_cback (): invalid state=%d", p_i93->state);
+ LOG(ERROR) << StringPrintf("invalid state=%d", p_i93->state);
GKI_freebuf(p_resp);
break;
}
-#if (BT_TRACE_VERBOSE == TRUE)
if (begin_state != p_i93->state) {
- RW_TRACE_DEBUG2("RW I93 state changed:<%s> -> <%s>",
- rw_i93_get_state_name(begin_state).c_str(),
- rw_i93_get_state_name(p_i93->state).c_str());
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("RW I93 state changed:<%s> -> <%s>",
+ rw_i93_get_state_name(begin_state).c_str(),
+ rw_i93_get_state_name(p_i93->state).c_str());
}
-#endif
}
/*******************************************************************************
@@ -2841,7 +2812,7 @@
tRW_I93_CB* p_i93 = &rw_cb.tcb.i93;
uint8_t uid[I93_UID_BYTE_LEN], *p;
- RW_TRACE_DEBUG0("rw_i93_select ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
NFC_SetStaticRfCback(rw_i93_data_cback);
@@ -2874,13 +2845,12 @@
tNFC_STATUS RW_I93Inventory(bool including_afi, uint8_t afi, uint8_t* p_uid) {
tNFC_STATUS status;
- RW_TRACE_API2("RW_I93Inventory (), including_afi:%d, AFI:0x%02X",
- including_afi, afi);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf(", including_afi:%d, AFI:0x%02X", including_afi, afi);
if (rw_cb.tcb.i93.state != RW_I93_STATE_IDLE) {
- RW_TRACE_ERROR1(
- "RW_I93Inventory ():Unable to start command at state (0x%X)",
- rw_cb.tcb.i93.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.i93.state);
return NFC_STATUS_BUSY;
}
@@ -2910,12 +2880,11 @@
tNFC_STATUS RW_I93StayQuiet(void) {
tNFC_STATUS status;
- RW_TRACE_API0("RW_I93StayQuiet ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.i93.state != RW_I93_STATE_IDLE) {
- RW_TRACE_ERROR1(
- "RW_I93StayQuiet ():Unable to start command at state (0x%X)",
- rw_cb.tcb.i93.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.i93.state);
return NFC_STATUS_BUSY;
}
@@ -2944,12 +2913,12 @@
tNFC_STATUS RW_I93ReadSingleBlock(uint16_t block_number) {
tNFC_STATUS status;
- RW_TRACE_API1("RW_I93ReadSingleBlock () block_number:0x%02X", block_number);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("block_number:0x%02X", block_number);
if (rw_cb.tcb.i93.state != RW_I93_STATE_IDLE) {
- RW_TRACE_ERROR1(
- "RW_I93ReadSingleBlock ():Unable to start command at state (0x%X)",
- rw_cb.tcb.i93.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.i93.state);
return NFC_STATUS_BUSY;
}
@@ -2980,17 +2949,16 @@
tNFC_STATUS RW_I93WriteSingleBlock(uint16_t block_number, uint8_t* p_data) {
tNFC_STATUS status;
- RW_TRACE_API0("RW_I93WriteSingleBlock ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.i93.state != RW_I93_STATE_IDLE) {
- RW_TRACE_ERROR1(
- "RW_I93WriteSingleBlock ():Unable to start command at state (0x%X)",
- rw_cb.tcb.i93.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.i93.state);
return NFC_STATUS_BUSY;
}
if (rw_cb.tcb.i93.block_size == 0) {
- RW_TRACE_ERROR0("RW_I93WriteSingleBlock ():Block size is unknown");
+ LOG(ERROR) << StringPrintf("Block size is unknown");
return NFC_STATUS_FAILED;
}
@@ -3019,12 +2987,11 @@
tNFC_STATUS RW_I93LockBlock(uint8_t block_number) {
tNFC_STATUS status;
- RW_TRACE_API0("RW_I93LockBlock ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.i93.state != RW_I93_STATE_IDLE) {
- RW_TRACE_ERROR1(
- "RW_I93LockBlock ():Unable to start command at state (0x%X)",
- rw_cb.tcb.i93.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.i93.state);
return NFC_STATUS_BUSY;
}
@@ -3054,12 +3021,11 @@
uint16_t number_blocks) {
tNFC_STATUS status;
- RW_TRACE_API0("RW_I93ReadMultipleBlocks ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.i93.state != RW_I93_STATE_IDLE) {
- RW_TRACE_ERROR1(
- "RW_I93ReadMultipleBlocks ():Unable to start command at state (0x%X)",
- rw_cb.tcb.i93.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.i93.state);
return NFC_STATUS_BUSY;
}
@@ -3089,17 +3055,16 @@
uint16_t number_blocks, uint8_t* p_data) {
tNFC_STATUS status;
- RW_TRACE_API0("RW_I93WriteMultipleBlocks ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.i93.state != RW_I93_STATE_IDLE) {
- RW_TRACE_ERROR1(
- "RW_I93WriteMultipleBlocks ():Unable to start command at state (0x%X)",
- rw_cb.tcb.i93.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.i93.state);
return NFC_STATUS_BUSY;
}
if (rw_cb.tcb.i93.block_size == 0) {
- RW_TRACE_ERROR0("RW_I93WriteSingleBlock ():Block size is unknown");
+ LOG(ERROR) << StringPrintf("Block size is unknown");
return NFC_STATUS_FAILED;
}
@@ -3134,11 +3099,11 @@
tNFC_STATUS RW_I93Select(uint8_t* p_uid) {
tNFC_STATUS status;
- RW_TRACE_API0("RW_I93Select ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.i93.state != RW_I93_STATE_IDLE) {
- RW_TRACE_ERROR1("RW_I93Select ():Unable to start command at state (0x%X)",
- rw_cb.tcb.i93.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.i93.state);
return NFC_STATUS_BUSY;
}
@@ -3148,7 +3113,7 @@
rw_cb.tcb.i93.state = RW_I93_STATE_BUSY;
}
} else {
- RW_TRACE_ERROR0("RW_I93Select ():UID shall be provided");
+ LOG(ERROR) << StringPrintf("UID shall be provided");
status = NFC_STATUS_FAILED;
}
@@ -3172,12 +3137,11 @@
tNFC_STATUS RW_I93ResetToReady(void) {
tNFC_STATUS status;
- RW_TRACE_API0("RW_I93ResetToReady ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.i93.state != RW_I93_STATE_IDLE) {
- RW_TRACE_ERROR1(
- "RW_I93ResetToReady ():Unable to start command at state (0x%X)",
- rw_cb.tcb.i93.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.i93.state);
return NFC_STATUS_BUSY;
}
@@ -3206,11 +3170,11 @@
tNFC_STATUS RW_I93WriteAFI(uint8_t afi) {
tNFC_STATUS status;
- RW_TRACE_API0("RW_I93WriteAFI ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.i93.state != RW_I93_STATE_IDLE) {
- RW_TRACE_ERROR1("RW_I93WriteAFI ():Unable to start command at state (0x%X)",
- rw_cb.tcb.i93.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.i93.state);
return NFC_STATUS_BUSY;
}
@@ -3239,11 +3203,11 @@
tNFC_STATUS RW_I93LockAFI(void) {
tNFC_STATUS status;
- RW_TRACE_API0("RW_I93LockAFI ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.i93.state != RW_I93_STATE_IDLE) {
- RW_TRACE_ERROR1("RW_I93LockAFI ():Unable to start command at state (0x%X)",
- rw_cb.tcb.i93.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.i93.state);
return NFC_STATUS_BUSY;
}
@@ -3272,12 +3236,11 @@
tNFC_STATUS RW_I93WriteDSFID(uint8_t dsfid) {
tNFC_STATUS status;
- RW_TRACE_API0("RW_I93WriteDSFID ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.i93.state != RW_I93_STATE_IDLE) {
- RW_TRACE_ERROR1(
- "RW_I93WriteDSFID ():Unable to start command at state (0x%X)",
- rw_cb.tcb.i93.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.i93.state);
return NFC_STATUS_BUSY;
}
@@ -3306,12 +3269,11 @@
tNFC_STATUS RW_I93LockDSFID(void) {
tNFC_STATUS status;
- RW_TRACE_API0("RW_I93LockDSFID ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.i93.state != RW_I93_STATE_IDLE) {
- RW_TRACE_ERROR1(
- "RW_I93LockDSFID ():Unable to start command at state (0x%X)",
- rw_cb.tcb.i93.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.i93.state);
return NFC_STATUS_BUSY;
}
@@ -3340,12 +3302,11 @@
tNFC_STATUS RW_I93GetSysInfo(uint8_t* p_uid) {
tNFC_STATUS status;
- RW_TRACE_API0("RW_I93GetSysInfo ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.i93.state != RW_I93_STATE_IDLE) {
- RW_TRACE_ERROR1(
- "RW_I93GetSysInfo ():Unable to start command at state (0x%X)",
- rw_cb.tcb.i93.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.i93.state);
return NFC_STATUS_BUSY;
}
@@ -3381,11 +3342,11 @@
uint16_t number_blocks) {
tNFC_STATUS status;
- RW_TRACE_API0("RW_I93GetMultiBlockSecurityStatus ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.i93.state != RW_I93_STATE_IDLE) {
- RW_TRACE_ERROR1(
- "RW_I93GetMultiBlockSecurityStatus ():Unable to start command at state "
+ LOG(ERROR) << StringPrintf(
+ "Unable to start command at state "
"(0x%X)",
rw_cb.tcb.i93.state);
return NFC_STATUS_BUSY;
@@ -3416,12 +3377,11 @@
tNFC_STATUS status;
tRW_I93_RW_SUBSTATE sub_state;
- RW_TRACE_API0("RW_I93DetectNDef ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.i93.state != RW_I93_STATE_IDLE) {
- RW_TRACE_ERROR1(
- "RW_I93DetectNDef ():Unable to start command at state (0x%X)",
- rw_cb.tcb.i93.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.i93.state);
return NFC_STATUS_FAILED;
}
@@ -3471,11 +3431,11 @@
**
*******************************************************************************/
tNFC_STATUS RW_I93ReadNDef(void) {
- RW_TRACE_API0("RW_I93ReadNDef ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.i93.state != RW_I93_STATE_IDLE) {
- RW_TRACE_ERROR1("RW_I93ReadNDef ():Unable to start command at state (0x%X)",
- rw_cb.tcb.i93.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.i93.state);
return NFC_STATUS_FAILED;
}
@@ -3490,7 +3450,7 @@
return NFC_STATUS_FAILED;
}
} else {
- RW_TRACE_ERROR0("RW_I93ReadNDef ():No NDEF detected");
+ LOG(ERROR) << StringPrintf("No NDEF detected");
return NFC_STATUS_FAILED;
}
@@ -3517,23 +3477,22 @@
tNFC_STATUS RW_I93UpdateNDef(uint16_t length, uint8_t* p_data) {
uint16_t block_number;
- RW_TRACE_API1("RW_I93UpdateNDef () length:%d", length);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("length:%d", length);
if (rw_cb.tcb.i93.state != RW_I93_STATE_IDLE) {
- RW_TRACE_ERROR1(
- "RW_I93UpdateNDef ():Unable to start command at state (0x%X)",
- rw_cb.tcb.i93.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.i93.state);
return NFC_STATUS_FAILED;
}
if (rw_cb.tcb.i93.tlv_type == I93_ICODE_TLV_TYPE_NDEF) {
if (rw_cb.tcb.i93.intl_flags & RW_I93_FLAG_READ_ONLY) {
- RW_TRACE_ERROR0("RW_I93UpdateNDef ():NDEF is read-only");
+ LOG(ERROR) << StringPrintf("NDEF is read-only");
return NFC_STATUS_FAILED;
}
if (rw_cb.tcb.i93.max_ndef_length < length) {
- RW_TRACE_ERROR2(
- "RW_I93UpdateNDef ():data (%d bytes) is more than max NDEF length "
+ LOG(ERROR) << StringPrintf(
+ "data (%d bytes) is more than max NDEF length "
"(%d)",
length, rw_cb.tcb.i93.max_ndef_length);
return NFC_STATUS_FAILED;
@@ -3556,7 +3515,7 @@
return NFC_STATUS_FAILED;
}
} else {
- RW_TRACE_ERROR0("RW_I93ReadNDef ():No NDEF detected");
+ LOG(ERROR) << StringPrintf("No NDEF detected");
return NFC_STATUS_FAILED;
}
@@ -3579,12 +3538,11 @@
tNFC_STATUS status;
tRW_I93_RW_SUBSTATE sub_state;
- RW_TRACE_API0("RW_I93FormatNDef ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.i93.state != RW_I93_STATE_IDLE) {
- RW_TRACE_ERROR1(
- "RW_I93FormatNDef ():Unable to start command at state (0x%X)",
- rw_cb.tcb.i93.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.i93.state);
return NFC_STATUS_FAILED;
}
@@ -3627,18 +3585,17 @@
**
*******************************************************************************/
tNFC_STATUS RW_I93SetTagReadOnly(void) {
- RW_TRACE_API0("RW_I93SetTagReadOnly ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.i93.state != RW_I93_STATE_IDLE) {
- RW_TRACE_ERROR1(
- "RW_I93SetTagReadOnly ():Unable to start command at state (0x%X)",
- rw_cb.tcb.i93.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.i93.state);
return NFC_STATUS_FAILED;
}
if (rw_cb.tcb.i93.tlv_type == I93_ICODE_TLV_TYPE_NDEF) {
if (rw_cb.tcb.i93.intl_flags & RW_I93_FLAG_READ_ONLY) {
- RW_TRACE_ERROR0("RW_I93SetTagReadOnly ():NDEF is already read-only");
+ LOG(ERROR) << StringPrintf("NDEF is already read-only");
return NFC_STATUS_FAILED;
}
@@ -3650,7 +3607,7 @@
return NFC_STATUS_FAILED;
}
} else {
- RW_TRACE_ERROR0("RW_I93SetTagReadOnly ():No NDEF detected");
+ LOG(ERROR) << StringPrintf("No NDEF detected");
return NFC_STATUS_FAILED;
}
@@ -3676,7 +3633,7 @@
tNFC_STATUS status;
tRW_DATA evt_data;
- RW_TRACE_API0("RW_I93PresenceCheck ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (!rw_cb.p_cback) {
return NFC_STATUS_FAILED;
@@ -3701,7 +3658,6 @@
return (status);
}
-#if (BT_TRACE_VERBOSE == TRUE)
/*******************************************************************************
**
** Function rw_i93_get_state_name
@@ -3832,5 +3788,3 @@
return "UNKNOWN";
}
}
-
-#endif
diff --git a/src/nfc/tags/rw_main.cc b/src/nfc/tags/rw_main.cc
index 9ff1d14..83e49ab 100644
--- a/src/nfc/tags/rw_main.cc
+++ b/src/nfc/tags/rw_main.cc
@@ -137,14 +137,16 @@
ticks = GKI_get_tick_count() - rw_cb.stats.start_tick;
elapsed_ms = GKI_TICKS_TO_MS(ticks);
- RW_TRACE_DEBUG5(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"NFC tx stats: cmds:%i, retries:%i, aborted: %i, tx_errs: %i, bytes "
"sent:%i",
rw_cb.stats.num_ops, rw_cb.stats.num_retries, rw_cb.stats.num_fail,
rw_cb.stats.num_trans_err, rw_cb.stats.bytes_sent);
- RW_TRACE_DEBUG2(" rx stats: rx-crc errors %i, bytes received: %i",
- rw_cb.stats.num_crc, rw_cb.stats.bytes_received);
- RW_TRACE_DEBUG1(" time activated %i ms", elapsed_ms);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf(" rx stats: rx-crc errors %i, bytes received: %i",
+ rw_cb.stats.num_crc, rw_cb.stats.bytes_received);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf(" time activated %i ms", elapsed_ms);
}
#endif /* RW_STATS_INCLUDED */
@@ -171,7 +173,8 @@
memcpy(p, p_raw_data, data_len);
p_data->len = data_len;
- RW_TRACE_EVENT1("RW SENT raw frame (0x%x)", data_len);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("RW SENT raw frame (0x%x)", data_len);
status = NFC_SendData(NFC_RF_CONN_ID, p_data);
}
}
@@ -192,13 +195,14 @@
tNFC_STATUS status = NFC_STATUS_FAILED;
/* check for null cback here / remove checks from rw_t?t */
- RW_TRACE_DEBUG3("RW_SetActivatedTagType protocol:%d, technology:%d, SAK:%d",
- p_activate_params->protocol,
- p_activate_params->rf_tech_param.mode,
- p_activate_params->rf_tech_param.param.pa.sel_rsp);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "RW_SetActivatedTagType protocol:%d, technology:%d, SAK:%d",
+ p_activate_params->protocol, p_activate_params->rf_tech_param.mode,
+ p_activate_params->rf_tech_param.param.pa.sel_rsp);
if (p_cback == NULL) {
- RW_TRACE_ERROR0("RW_SetActivatedTagType called with NULL callback");
+ LOG(ERROR) << StringPrintf(
+ "RW_SetActivatedTagType called with NULL callback");
return (NFC_STATUS_FAILED);
}
@@ -247,7 +251,7 @@
}
/* TODO set up callback for proprietary protocol */
else {
- RW_TRACE_ERROR0("RW_SetActivatedTagType Invalid protocol");
+ LOG(ERROR) << StringPrintf("RW_SetActivatedTagType Invalid protocol");
}
if (status != NFC_STATUS_OK) rw_cb.p_cback = NULL;
diff --git a/src/nfc/tags/rw_t1t.cc b/src/nfc/tags/rw_t1t.cc
index d48eb9b..f3706bd 100644
--- a/src/nfc/tags/rw_t1t.cc
+++ b/src/nfc/tags/rw_t1t.cc
@@ -40,11 +40,9 @@
static void rw_t1t_process_frame_error(void);
static void rw_t1t_process_error(void);
static void rw_t1t_handle_presence_check_rsp(tNFC_STATUS status);
-#if (BT_TRACE_VERBOSE == TRUE)
static std::string rw_t1t_get_state_name(uint8_t state);
static char* rw_t1t_get_sub_state_name(uint8_t sub_state);
static char* rw_t1t_get_event_name(uint8_t event);
-#endif
/*******************************************************************************
**
@@ -65,21 +63,16 @@
uint8_t* p;
tT1T_CMD_RSP_INFO* p_cmd_rsp_info =
(tT1T_CMD_RSP_INFO*)rw_cb.tcb.t1t.p_cmd_rsp_info;
-#if (BT_TRACE_VERBOSE == TRUE)
uint8_t begin_state = p_t1t->state;
-#endif
p_pkt = (NFC_HDR*)(p_data->data.p_data);
if (p_pkt == NULL) return;
/* Assume the data is just the response byte sequence */
p = (uint8_t*)(p_pkt + 1) + p_pkt->offset;
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_DEBUG2("rw_t1t_data_cback (): state:%s (%d)",
- rw_t1t_get_state_name(p_t1t->state).c_str(), p_t1t->state);
-#else
- RW_TRACE_DEBUG1("rw_t1t_data_cback (): state=%d", p_t1t->state);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "state:%s (%d)", rw_t1t_get_state_name(p_t1t->state).c_str(),
+ p_t1t->state);
evt_data.status = NFC_STATUS_OK;
@@ -97,7 +90,7 @@
(p_t1t->prev_cmd_rsp_info.op_code == T1T_CMD_RALL) ||
(p_t1t->prev_cmd_rsp_info.addr == *p))) {
/* Response to previous command retransmission */
- RW_TRACE_ERROR2(
+ LOG(ERROR) << StringPrintf(
"T1T Response to previous command in Idle state. command=0x%02x, "
"Remaining max retx rsp:0x%02x ",
p_t1t->prev_cmd_rsp_info.op_code,
@@ -134,7 +127,7 @@
((p_t1t->prev_cmd_rsp_info.op_code == T1T_CMD_RID) ||
(p_t1t->prev_cmd_rsp_info.op_code == T1T_CMD_RALL) ||
(p_t1t->prev_cmd_rsp_info.addr == *p))) {
- RW_TRACE_ERROR2(
+ LOG(ERROR) << StringPrintf(
"T1T Response to previous command. command=0x%02x, Remaining max "
"retx rsp:0x%02x",
p_t1t->prev_cmd_rsp_info.op_code,
@@ -144,14 +137,9 @@
/* Stop timer as some response to current command is received */
nfc_stop_quick_timer(&p_t1t->timer);
/* Retrasmit the last sent command if retry-count < max retry */
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_ERROR2("T1T Frame error. state=%s command (opcode) = 0x%02x",
- rw_t1t_get_state_name(p_t1t->state).c_str(),
- p_cmd_rsp_info->opcode);
-#else
- RW_TRACE_ERROR2("T1T Frame error. state=0x%02x command = 0x%02x ",
- p_t1t->state, p_cmd_rsp_info->opcode);
-#endif
+ LOG(ERROR) << StringPrintf(
+ "T1T Frame error. state=%s command (opcode) = 0x%02x",
+ rw_t1t_get_state_name(p_t1t->state).c_str(), p_cmd_rsp_info->opcode);
rw_t1t_process_frame_error();
}
GKI_freebuf(p_pkt);
@@ -161,8 +149,9 @@
/* Stop timer as response to current command is received */
nfc_stop_quick_timer(&p_t1t->timer);
- RW_TRACE_EVENT2("RW RECV [%s]:0x%x RSP", t1t_info_to_str(p_cmd_rsp_info),
- p_cmd_rsp_info->opcode);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("RW RECV [%s]:0x%x RSP", t1t_info_to_str(p_cmd_rsp_info),
+ p_cmd_rsp_info->opcode);
/* If we did not receive response to all retransmitted previous command,
* dont expect that as response have come for the current command itself.
@@ -207,13 +196,12 @@
} else
GKI_freebuf(p_pkt);
-#if (BT_TRACE_VERBOSE == TRUE)
if (begin_state != p_t1t->state) {
- RW_TRACE_DEBUG2("RW T1T state changed:<%s> -> <%s>",
- rw_t1t_get_state_name(begin_state).c_str(),
- rw_t1t_get_state_name(p_t1t->state).c_str());
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("RW T1T state changed:<%s> -> <%s>",
+ rw_t1t_get_state_name(begin_state).c_str(),
+ rw_t1t_get_state_name(p_t1t->state).c_str());
}
-#endif
}
/*******************************************************************************
@@ -229,11 +217,12 @@
tNFC_CONN* p_data) {
tRW_T1T_CB* p_t1t = &rw_cb.tcb.t1t;
- RW_TRACE_DEBUG2("rw_t1t_conn_cback: conn_id=%i, evt=0x%x", conn_id, event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "rw_t1t_conn_cback: conn_id=%i, evt=0x%x", conn_id, event);
/* Only handle static conn_id */
if (conn_id != NFC_RF_CONN_ID) {
- RW_TRACE_WARNING1("rw_t1t_conn_cback - Not static connection id: =%i",
- conn_id);
+ LOG(WARNING) << StringPrintf(
+ "rw_t1t_conn_cback - Not static connection id: =%i", conn_id);
return;
}
@@ -357,8 +346,9 @@
rw_main_update_tx_stats(p_data->len, false);
#endif /* RW_STATS_INCLUDED */
- RW_TRACE_EVENT2("RW SENT [%s]:0x%x CMD", t1t_info_to_str(p_cmd_rsp_info),
- p_cmd_rsp_info->opcode);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "RW SENT [%s]:0x%x CMD", t1t_info_to_str(p_cmd_rsp_info),
+ p_cmd_rsp_info->opcode);
status = NFC_SendData(NFC_RF_CONN_ID, p_data);
if (status == NFC_STATUS_OK) {
nfc_start_quick_timer(
@@ -421,8 +411,9 @@
rw_main_update_tx_stats(p_data->len, false);
#endif /* RW_STATS_INCLUDED */
- RW_TRACE_EVENT2("RW SENT [%s]:0x%x CMD", t1t_info_to_str(p_cmd_rsp_info),
- p_cmd_rsp_info->opcode);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "RW SENT [%s]:0x%x CMD", t1t_info_to_str(p_cmd_rsp_info),
+ p_cmd_rsp_info->opcode);
status = NFC_SendData(NFC_RF_CONN_ID, p_data);
if (status == NFC_STATUS_OK) {
@@ -467,13 +458,11 @@
/* Extract HR and UID from response */
STREAM_TO_ARRAY(p_t1t->hr, p_rid_rsp, T1T_HR_LEN);
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_DEBUG2("hr0:0x%x, hr1:0x%x", p_t1t->hr[0], p_t1t->hr[1]);
- RW_TRACE_DEBUG4("rw_t1t_handle_rid_rsp (): UID0-3=%02x%02x%02x%02x",
- p_rid_rsp[0], p_rid_rsp[1], p_rid_rsp[2], p_rid_rsp[3]);
-#else
- RW_TRACE_DEBUG0("rw_t1t_handle_rid_rsp ()");
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("hr0:0x%x, hr1:0x%x", p_t1t->hr[0], p_t1t->hr[1]);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("UID0-3=%02x%02x%02x%02x", p_rid_rsp[0], p_rid_rsp[1],
+ p_rid_rsp[2], p_rid_rsp[3]);
/* Fetch UID0-3 from RID response message */
STREAM_TO_ARRAY(p_t1t->mem, p_rid_rsp, T1T_CMD_UID_LEN);
@@ -503,7 +492,7 @@
if (p_t1t->p_cur_cmd_buf == NULL) {
p_t1t->p_cur_cmd_buf = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (p_t1t->p_cur_cmd_buf == NULL) {
- RW_TRACE_ERROR0(
+ LOG(ERROR) << StringPrintf(
"rw_t1t_select: unable to allocate buffer for retransmission");
return status;
}
@@ -531,14 +520,9 @@
void rw_t1t_process_timeout(TIMER_LIST_ENT* p_tle) {
tRW_T1T_CB* p_t1t = &rw_cb.tcb.t1t;
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_ERROR2("T1T timeout. state=%s command (opcode)=0x%02x ",
- rw_t1t_get_state_name(p_t1t->state).c_str(),
- (rw_cb.tcb.t1t.p_cmd_rsp_info)->opcode);
-#else
- RW_TRACE_ERROR2("T1T timeout. state=0x%02x command=0x%02x ", p_t1t->state,
- (rw_cb.tcb.t1t.p_cmd_rsp_info)->opcode);
-#endif
+ LOG(ERROR) << StringPrintf("T1T timeout. state=%s command (opcode)=0x%02x ",
+ rw_t1t_get_state_name(p_t1t->state).c_str(),
+ (rw_cb.tcb.t1t.p_cmd_rsp_info)->opcode);
if (p_t1t->state == RW_T1T_STATE_CHECK_PRESENCE) {
/* Tag has moved from range */
@@ -583,15 +567,15 @@
tT1T_CMD_RSP_INFO* p_cmd_rsp_info =
(tT1T_CMD_RSP_INFO*)rw_cb.tcb.t1t.p_cmd_rsp_info;
- RW_TRACE_DEBUG1("rw_t1t_process_error () State: %u", p_t1t->state);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("State: %u", p_t1t->state);
/* Retry sending command if retry-count < max */
if (rw_cb.cur_retry < RW_MAX_RETRIES) {
/* retry sending the command */
rw_cb.cur_retry++;
- RW_TRACE_DEBUG2("T1T retransmission attempt %i of %i", rw_cb.cur_retry,
- RW_MAX_RETRIES);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "T1T retransmission attempt %i of %i", rw_cb.cur_retry, RW_MAX_RETRIES);
/* allocate a new buffer for message */
p_cmd_buf = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
@@ -617,8 +601,8 @@
} else {
/* we might get response later to all or some of the retrasnmission
* of the current command, update previous command response information */
- RW_TRACE_DEBUG1("T1T maximum retransmission attempts reached (%i)",
- RW_MAX_RETRIES);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "T1T maximum retransmission attempts reached (%i)", RW_MAX_RETRIES);
p_t1t->prev_cmd_rsp_info.addr = ((p_cmd_rsp_info->opcode != T1T_CMD_RALL) &&
(p_cmd_rsp_info->opcode != T1T_CMD_RID))
? p_t1t->addr
@@ -719,7 +703,7 @@
tRW_DATA evt_data;
tRW_CB* p_rw_cb = &rw_cb;
- RW_TRACE_API0("RW_T1tPresenceCheck");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* If RW_SelectTagType was not called (no conn_callback) return failure */
if (!p_rw_cb->p_cback) {
@@ -762,10 +746,10 @@
tRW_T1T_CB* p_t1t = &rw_cb.tcb.t1t;
tNFC_STATUS status = NFC_STATUS_FAILED;
- RW_TRACE_API0("RW_T1tRid");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (p_t1t->state != RW_T1T_STATE_IDLE) {
- RW_TRACE_WARNING1("RW_T1tRid - Busy - State: %u", p_t1t->state);
+ LOG(WARNING) << StringPrintf("RW_T1tRid - Busy - State: %u", p_t1t->state);
return (NFC_STATUS_BUSY);
}
@@ -791,10 +775,11 @@
tRW_T1T_CB* p_t1t = &rw_cb.tcb.t1t;
tNFC_STATUS status = NFC_STATUS_FAILED;
- RW_TRACE_API0("RW_T1tReadAll");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (p_t1t->state != RW_T1T_STATE_IDLE) {
- RW_TRACE_WARNING1("RW_T1tReadAll - Busy - State: %u", p_t1t->state);
+ LOG(WARNING) << StringPrintf("RW_T1tReadAll - Busy - State: %u",
+ p_t1t->state);
return (NFC_STATUS_BUSY);
}
@@ -822,7 +807,7 @@
uint8_t addr;
if (p_t1t->state != RW_T1T_STATE_IDLE) {
- RW_TRACE_WARNING1("RW_T1tRead - Busy - State: %u", p_t1t->state);
+ LOG(WARNING) << StringPrintf("RW_T1tRead - Busy - State: %u", p_t1t->state);
return (NFC_STATUS_BUSY);
}
@@ -851,22 +836,23 @@
uint8_t addr;
if (p_t1t->state != RW_T1T_STATE_IDLE) {
- RW_TRACE_WARNING1("RW_T1tWriteErase - Busy - State: %u", p_t1t->state);
+ LOG(WARNING) << StringPrintf("RW_T1tWriteErase - Busy - State: %u",
+ p_t1t->state);
return (NFC_STATUS_BUSY);
}
if ((p_t1t->tag_attribute == RW_T1_TAG_ATTRB_READ_ONLY) &&
(block != T1T_CC_BLOCK) && (byte != T1T_CC_RWA_OFFSET)) {
- RW_TRACE_ERROR0("RW_T1tWriteErase - Tag is in Read only state");
+ LOG(ERROR) << StringPrintf("RW_T1tWriteErase - Tag is in Read only state");
return (NFC_STATUS_REFUSED);
}
if ((block >= T1T_STATIC_BLOCKS) || (byte >= T1T_BLOCK_SIZE)) {
- RW_TRACE_ERROR2("RW_T1tWriteErase - Invalid Block/byte: %u / %u", block,
- byte);
+ LOG(ERROR) << StringPrintf("RW_T1tWriteErase - Invalid Block/byte: %u / %u",
+ block, byte);
return (NFC_STATUS_REFUSED);
}
if ((block == T1T_UID_BLOCK) || (block == T1T_RES_BLOCK)) {
- RW_TRACE_WARNING1("RW_T1tWriteErase - Cannot write to Locked block: %u",
- block);
+ LOG(WARNING) << StringPrintf(
+ "RW_T1tWriteErase - Cannot write to Locked block: %u", block);
return (NFC_STATUS_REFUSED);
}
/* send WRITE-E command */
@@ -898,22 +884,23 @@
uint8_t addr;
if (p_t1t->state != RW_T1T_STATE_IDLE) {
- RW_TRACE_WARNING1("RW_T1tWriteNoErase - Busy - State: %u", p_t1t->state);
+ LOG(WARNING) << StringPrintf("RW_T1tWriteNoErase - Busy - State: %u",
+ p_t1t->state);
return (NFC_STATUS_BUSY);
}
if ((p_t1t->tag_attribute == RW_T1_TAG_ATTRB_READ_ONLY) &&
(block != T1T_CC_BLOCK) && (byte != T1T_CC_RWA_OFFSET)) {
- RW_TRACE_ERROR0("RW_T1tWriteErase - Tag is in Read only state");
+ LOG(ERROR) << StringPrintf("RW_T1tWriteErase - Tag is in Read only state");
return (NFC_STATUS_REFUSED);
}
if ((block >= T1T_STATIC_BLOCKS) || (byte >= T1T_BLOCK_SIZE)) {
- RW_TRACE_ERROR2("RW_T1tWriteErase - Invalid Block/byte: %u / %u", block,
- byte);
+ LOG(ERROR) << StringPrintf("RW_T1tWriteErase - Invalid Block/byte: %u / %u",
+ block, byte);
return (NFC_STATUS_REFUSED);
}
if ((block == T1T_UID_BLOCK) || (block == T1T_RES_BLOCK)) {
- RW_TRACE_WARNING1("RW_T1tWriteNoErase - Cannot write to Locked block: %u",
- block);
+ LOG(WARNING) << StringPrintf(
+ "RW_T1tWriteNoErase - Cannot write to Locked block: %u", block);
return (NFC_STATUS_REFUSED);
}
/* send WRITE-NE command */
@@ -944,11 +931,12 @@
uint8_t adds;
if (p_t1t->state != RW_T1T_STATE_IDLE) {
- RW_TRACE_WARNING1("RW_T1tReadSeg - Busy - State: %u", p_t1t->state);
+ LOG(WARNING) << StringPrintf("RW_T1tReadSeg - Busy - State: %u",
+ p_t1t->state);
return (NFC_STATUS_BUSY);
}
if (segment >= T1T_MAX_SEGMENTS) {
- RW_TRACE_ERROR1("RW_T1tReadSeg - Invalid Segment: %u", segment);
+ LOG(ERROR) << StringPrintf("RW_T1tReadSeg - Invalid Segment: %u", segment);
return (NFC_STATUS_REFUSED);
}
if (rw_cb.tcb.t1t.hr[0] != T1T_STATIC_HR0) {
@@ -976,7 +964,8 @@
tRW_T1T_CB* p_t1t = &rw_cb.tcb.t1t;
if (p_t1t->state != RW_T1T_STATE_IDLE) {
- RW_TRACE_WARNING1("RW_T1tRead8 - Busy - State: %u", p_t1t->state);
+ LOG(WARNING) << StringPrintf("RW_T1tRead8 - Busy - State: %u",
+ p_t1t->state);
return (NFC_STATUS_BUSY);
}
@@ -1006,19 +995,20 @@
tNFC_STATUS status = NFC_STATUS_FAILED;
if (p_t1t->state != RW_T1T_STATE_IDLE) {
- RW_TRACE_WARNING1("RW_T1tWriteErase8 - Busy - State: %u", p_t1t->state);
+ LOG(WARNING) << StringPrintf("RW_T1tWriteErase8 - Busy - State: %u",
+ p_t1t->state);
return (NFC_STATUS_BUSY);
}
if ((p_t1t->tag_attribute == RW_T1_TAG_ATTRB_READ_ONLY) &&
(block != T1T_CC_BLOCK)) {
- RW_TRACE_ERROR0("RW_T1tWriteErase8 - Tag is in Read only state");
+ LOG(ERROR) << StringPrintf("RW_T1tWriteErase8 - Tag is in Read only state");
return (NFC_STATUS_REFUSED);
}
if ((block == T1T_UID_BLOCK) || (block == T1T_RES_BLOCK)) {
- RW_TRACE_WARNING1("RW_T1tWriteErase8 - Cannot write to Locked block: %u",
- block);
+ LOG(WARNING) << StringPrintf(
+ "RW_T1tWriteErase8 - Cannot write to Locked block: %u", block);
return (NFC_STATUS_REFUSED);
}
@@ -1052,19 +1042,21 @@
tRW_T1T_CB* p_t1t = &rw_cb.tcb.t1t;
if (p_t1t->state != RW_T1T_STATE_IDLE) {
- RW_TRACE_WARNING1("RW_T1tWriteNoErase8 - Busy - State: %u", p_t1t->state);
+ LOG(WARNING) << StringPrintf("RW_T1tWriteNoErase8 - Busy - State: %u",
+ p_t1t->state);
return (NFC_STATUS_BUSY);
}
if ((p_t1t->tag_attribute == RW_T1_TAG_ATTRB_READ_ONLY) &&
(block != T1T_CC_BLOCK)) {
- RW_TRACE_ERROR0("RW_T1tWriteNoErase8 - Tag is in Read only state");
+ LOG(ERROR) << StringPrintf(
+ "RW_T1tWriteNoErase8 - Tag is in Read only state");
return (NFC_STATUS_REFUSED);
}
if ((block == T1T_UID_BLOCK) || (block == T1T_RES_BLOCK)) {
- RW_TRACE_WARNING1("RW_T1tWriteNoErase8 - Cannot write to Locked block: %u",
- block);
+ LOG(WARNING) << StringPrintf(
+ "RW_T1tWriteNoErase8 - Cannot write to Locked block: %u", block);
return (NFC_STATUS_REFUSED);
}
@@ -1083,7 +1075,6 @@
return status;
}
-#if (BT_TRACE_VERBOSE == TRUE)
/*******************************************************************************
**
** Function rw_t1t_get_state_name
@@ -1121,5 +1112,3 @@
return "???? UNKNOWN STATE";
}
}
-
-#endif /* (BT_TRACE_VERBOSE == TRUE) */
diff --git a/src/nfc/tags/rw_t1t_ndef.cc b/src/nfc/tags/rw_t1t_ndef.cc
index 1f64d85..307064d 100644
--- a/src/nfc/tags/rw_t1t_ndef.cc
+++ b/src/nfc/tags/rw_t1t_ndef.cc
@@ -813,7 +813,7 @@
p_data +=
T1T_UID_LEN + T1T_RES_BYTE_LEN; /* skip Block 0, UID and Reserved byte */
- RW_TRACE_DEBUG0("rw_t1t_handle_rall_rsp ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
rw_t1t_update_tag_state();
rw_t1t_update_attributes();
@@ -1038,7 +1038,7 @@
p_t1t->lockbyte[p_t1t->num_lockbytes].b_lock_read = false;
p_t1t->num_lockbytes++;
} else
- RW_TRACE_ERROR1(
+ LOG(ERROR) << StringPrintf(
"T1T Buffer overflow error. Max supported lock "
"bytes=0x%02X",
RW_T1T_MAX_LOCK_BYTES);
@@ -1047,7 +1047,7 @@
p_t1t->num_lock_tlvs++;
rw_t1t_update_attributes();
} else
- RW_TRACE_ERROR1(
+ LOG(ERROR) << StringPrintf(
"T1T Buffer overflow error. Max supported lock "
"tlvs=0x%02X",
RW_T1T_MAX_LOCK_TLVS);
@@ -1068,7 +1068,7 @@
tlv_value[2 - bytes_count] = p_readbytes[offset];
if (bytes_count == 0) {
if (p_t1t->num_mem_tlvs >= RW_T1T_MAX_MEM_TLVS) {
- RW_TRACE_ERROR0(
+ LOG(ERROR) << StringPrintf(
"rw_t1t_handle_tlv_detect_rsp - Maximum buffer allocated "
"for Memory tlv has reached");
failed = true;
@@ -1186,8 +1186,9 @@
}
}
} else {
- RW_TRACE_ERROR1("RW_T1tReadNDef - Invalid NDEF len: %u or NDEF corrupted",
- p_t1t->ndef_msg_len);
+ LOG(ERROR) << StringPrintf(
+ "RW_T1tReadNDef - Invalid NDEF len: %u or NDEF corrupted",
+ p_t1t->ndef_msg_len);
status = NFC_STATUS_FAILED;
}
} else {
@@ -2140,13 +2141,14 @@
uint8_t* p;
if (p_t1t->state != RW_T1T_STATE_IDLE) {
- RW_TRACE_WARNING1("RW_T1tFormatNDef - Tag not initialized/ Busy! State: %u",
- p_t1t->state);
+ LOG(WARNING) << StringPrintf(
+ "RW_T1tFormatNDef - Tag not initialized/ Busy! State: %u",
+ p_t1t->state);
return (NFC_STATUS_FAILED);
}
if ((p_t1t->hr[0] & 0xF0) != T1T_NDEF_SUPPORTED) {
- RW_TRACE_WARNING1(
+ LOG(WARNING) << StringPrintf(
"RW_T1tFormatNDef - Cannot format tag as NDEF not supported. HR0: %u",
p_t1t->hr[0]);
return (NFC_STATUS_REJECTED);
@@ -2154,8 +2156,9 @@
p_ret = t1t_tag_init_data(p_t1t->hr[0]);
if (p_ret == NULL) {
- RW_TRACE_WARNING2("RW_T1tFormatNDef - Invalid HR - HR0: %u, HR1: %u",
- p_t1t->hr[0], p_t1t->hr[1]);
+ LOG(WARNING) << StringPrintf(
+ "RW_T1tFormatNDef - Invalid HR - HR0: %u, HR1: %u", p_t1t->hr[0],
+ p_t1t->hr[1]);
return (NFC_STATUS_REJECTED);
}
@@ -2235,14 +2238,16 @@
uint8_t adds;
if (p_t1t->state != RW_T1T_STATE_IDLE) {
- RW_TRACE_WARNING1("RW_T1tLocateTlv - Busy - State: %u", p_t1t->state);
+ LOG(WARNING) << StringPrintf("RW_T1tLocateTlv - Busy - State: %u",
+ p_t1t->state);
return (NFC_STATUS_FAILED);
}
p_t1t->tlv_detect = tlv_type;
if ((p_t1t->tlv_detect == TAG_NDEF_TLV) &&
(((p_t1t->hr[0]) & 0xF0) != T1T_NDEF_SUPPORTED)) {
- RW_TRACE_ERROR0("RW_T1tLocateTlv - Error: NDEF not supported by the tag");
+ LOG(ERROR) << StringPrintf(
+ "RW_T1tLocateTlv - Error: NDEF not supported by the tag");
return (NFC_STATUS_REFUSED);
}
@@ -2320,18 +2325,20 @@
t1t_cmd_to_rsp_info(T1T_CMD_RSEG);
if (p_t1t->state != RW_T1T_STATE_IDLE) {
- RW_TRACE_WARNING1("RW_T1tReadNDef - Busy - State: %u", p_t1t->state);
+ LOG(WARNING) << StringPrintf("RW_T1tReadNDef - Busy - State: %u",
+ p_t1t->state);
return (NFC_STATUS_FAILED);
}
/* Check HR0 if NDEF supported by the tag */
if (((p_t1t->hr[0]) & 0xF0) != T1T_NDEF_SUPPORTED) {
- RW_TRACE_ERROR0("RW_T1tReadNDef - Error: NDEF not supported by the tag");
+ LOG(ERROR) << StringPrintf(
+ "RW_T1tReadNDef - Error: NDEF not supported by the tag");
return (NFC_STATUS_REFUSED);
}
if (p_t1t->tag_attribute == RW_T1_TAG_ATTRB_INITIALIZED_NDEF) {
- RW_TRACE_WARNING1(
+ LOG(WARNING) << StringPrintf(
"RW_T1tReadNDef - NDEF Message length is zero, NDEF Length : %u ",
p_t1t->ndef_msg_len);
return (NFC_STATUS_NOT_INITIALIZED);
@@ -2339,14 +2346,14 @@
if ((p_t1t->tag_attribute != RW_T1_TAG_ATTRB_READ_WRITE) &&
(p_t1t->tag_attribute != RW_T1_TAG_ATTRB_READ_ONLY)) {
- RW_TRACE_ERROR0(
+ LOG(ERROR) << StringPrintf(
"RW_T1tReadNDef - Error: NDEF detection not performed yet/ Tag is in "
"Initialized state");
return (NFC_STATUS_FAILED);
}
if (buf_len < p_t1t->ndef_msg_len) {
- RW_TRACE_WARNING2(
+ LOG(WARNING) << StringPrintf(
"RW_T1tReadNDef - buffer size: %u less than NDEF msg sise: %u",
buf_len, p_t1t->ndef_msg_len);
return (NFC_STATUS_FAILED);
@@ -2409,24 +2416,26 @@
uint16_t init_ndef_msg_offset;
if (p_t1t->state != RW_T1T_STATE_IDLE) {
- RW_TRACE_WARNING1("RW_T1tWriteNDef - Busy - State: %u", p_t1t->state);
+ LOG(WARNING) << StringPrintf("RW_T1tWriteNDef - Busy - State: %u",
+ p_t1t->state);
return (NFC_STATUS_FAILED);
}
/* Check HR0 if NDEF supported by the tag */
if (((p_t1t->hr[0]) & 0xF0) != T1T_NDEF_SUPPORTED) {
- RW_TRACE_ERROR0("RW_T1tWriteNDef - Error: NDEF not supported by the tag");
+ LOG(ERROR) << StringPrintf(
+ "RW_T1tWriteNDef - Error: NDEF not supported by the tag");
return (NFC_STATUS_REFUSED);
}
if ((p_t1t->tag_attribute != RW_T1_TAG_ATTRB_READ_WRITE) &&
(p_t1t->tag_attribute != RW_T1_TAG_ATTRB_INITIALIZED_NDEF)) {
- RW_TRACE_ERROR0("RW_T1tWriteNDef - Tag cannot update NDEF");
+ LOG(ERROR) << StringPrintf("RW_T1tWriteNDef - Tag cannot update NDEF");
return (NFC_STATUS_REFUSED);
}
if (msg_len > p_t1t->max_ndef_msg_len) {
- RW_TRACE_ERROR1(
+ LOG(ERROR) << StringPrintf(
"RW_T1tWriteNDef - Cannot write NDEF of size greater than %u bytes",
p_t1t->max_ndef_msg_len);
return (NFC_STATUS_REFUSED);
@@ -2514,7 +2523,8 @@
uint8_t num_locks;
if (p_t1t->state != RW_T1T_STATE_IDLE) {
- RW_TRACE_WARNING1("RW_T1tSetTagReadOnly - Busy - State: %u", p_t1t->state);
+ LOG(WARNING) << StringPrintf("RW_T1tSetTagReadOnly - Busy - State: %u",
+ p_t1t->state);
return (NFC_STATUS_BUSY);
}
@@ -2545,7 +2555,6 @@
return status;
}
-#if (BT_TRACE_VERBOSE == TRUE)
/*******************************************************************************
**
** Function rw_t1t_get_sub_state_name
@@ -2585,6 +2594,5 @@
return "???? UNKNOWN SUBSTATE";
}
}
-#endif /* (BT_TRACE_VERBOSE == TRUE) */
#endif /* (RW_NDEF_INCLUDED == TRUE) */
diff --git a/src/nfc/tags/rw_t2t.cc b/src/nfc/tags/rw_t2t.cc
index 15d865a..a288cbd 100644
--- a/src/nfc/tags/rw_t2t.cc
+++ b/src/nfc/tags/rw_t2t.cc
@@ -41,10 +41,8 @@
static void rw_t2t_handle_presence_check_rsp(tNFC_STATUS status);
static void rw_t2t_resume_op(void);
-#if (BT_TRACE_VERBOSE == TRUE)
static std::string rw_t2t_get_state_name(uint8_t state);
static std::string rw_t2t_get_substate_name(uint8_t substate);
-#endif
/*******************************************************************************
**
@@ -68,18 +66,12 @@
tT2T_CMD_RSP_INFO* p_cmd_rsp_info =
(tT2T_CMD_RSP_INFO*)rw_cb.tcb.t2t.p_cmd_rsp_info;
tRW_DETECT_NDEF_DATA ndef_data;
-#if (BT_TRACE_VERBOSE == TRUE)
uint8_t begin_state = p_t2t->state;
-#endif
if ((p_t2t->state == RW_T2T_STATE_IDLE) || (p_cmd_rsp_info == NULL)) {
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_DEBUG2("RW T2T Raw Frame: Len [0x%X] Status [%s]", &p_pkt->len,
- NFC_GetStatusName(p_data->status).c_str());
-#else
- RW_TRACE_DEBUG2("RW T2T Raw Frame: Len [0x%X] Status [0x%X]", p_pkt->len,
- p_data->status);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("RW T2T Raw Frame: Len [0x%X] Status [%s]", p_pkt->len,
+ NFC_GetStatusName(p_data->status).c_str());
evt_data.status = p_data->status;
evt_data.p_data = p_pkt;
tRW_DATA rw_data;
@@ -94,20 +86,16 @@
/* Stop timer as response is received */
nfc_stop_quick_timer(&p_t2t->t2_timer);
- RW_TRACE_EVENT2("RW RECV [%s]:0x%x RSP", t2t_info_to_str(p_cmd_rsp_info),
- p_cmd_rsp_info->opcode);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("RW RECV [%s]:0x%x RSP", t2t_info_to_str(p_cmd_rsp_info),
+ p_cmd_rsp_info->opcode);
if (((p_pkt->len != p_cmd_rsp_info->rsp_len) &&
(p_pkt->len != p_cmd_rsp_info->nack_rsp_len) &&
(p_t2t->substate != RW_T2T_SUBSTATE_WAIT_SELECT_SECTOR)) ||
(p_t2t->state == RW_T2T_STATE_HALT)) {
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_ERROR1("T2T Frame error. state=%s ",
- rw_t2t_get_state_name(p_t2t->state).c_str());
-#else
- RW_TRACE_ERROR1("T2T Frame error. state=0x%02X command=0x%02X ",
- p_t2t->state);
-#endif
+ LOG(ERROR) << StringPrintf("T2T Frame error. state=%s ",
+ rw_t2t_get_state_name(p_t2t->state).c_str());
if (p_t2t->state != RW_T2T_STATE_HALT) {
/* Retrasmit the last sent command if retry-count < max retry */
rw_t2t_process_frame_error();
@@ -121,7 +109,7 @@
/* Assume the data is just the response byte sequence */
p = (uint8_t*)(p_pkt + 1) + p_pkt->offset;
- RW_TRACE_EVENT4(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"rw_t2t_proc_data State: %u conn_id: %u len: %u data[0]: 0x%02x",
p_t2t->state, conn_id, p_pkt->len, *p);
@@ -135,7 +123,7 @@
else
evt_data.status = NFC_STATUS_FAILED;
} else {
- RW_TRACE_EVENT1(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"rw_t2t_proc_data - Received NACK response(0x%x) to SEC-SELCT CMD",
(*p & 0x0f));
evt_data.status = NFC_STATUS_REJECTED;
@@ -149,8 +137,8 @@
evt_data.p_data = p_pkt;
if (p_t2t->state == RW_T2T_STATE_READ) b_release = false;
- RW_TRACE_EVENT1("rw_t2t_proc_data - Received NACK response(0x%x)",
- (*p & 0x0f));
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "rw_t2t_proc_data - Received NACK response(0x%x)", (*p & 0x0f));
if (!p_t2t->check_tag_halt) {
/* Just received first NACK. Retry just one time to find if tag went in to
@@ -226,13 +214,12 @@
if (b_release) GKI_freebuf(p_pkt);
-#if (BT_TRACE_VERBOSE == TRUE)
if (begin_state != p_t2t->state) {
- RW_TRACE_DEBUG2("RW T2T state changed:<%s> -> <%s>",
- rw_t2t_get_state_name(begin_state).c_str(),
- rw_t2t_get_state_name(p_t2t->state).c_str());
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("RW T2T state changed:<%s> -> <%s>",
+ rw_t2t_get_state_name(begin_state).c_str(),
+ rw_t2t_get_state_name(p_t2t->state).c_str());
}
-#endif
}
/*******************************************************************************
@@ -249,7 +236,8 @@
tRW_T2T_CB* p_t2t = &rw_cb.tcb.t2t;
tRW_READ_DATA evt_data;
- RW_TRACE_DEBUG2("rw_t2t_conn_cback: conn_id=%i, evt=%i", conn_id, event);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("rw_t2t_conn_cback: conn_id=%i, evt=%i", conn_id, event);
/* Only handle static conn_id */
if (conn_id != NFC_RF_CONN_ID) {
return;
@@ -383,8 +371,9 @@
/* Update stats */
rw_main_update_tx_stats(p_data->len, false);
#endif
- RW_TRACE_EVENT2("RW SENT [%s]:0x%x CMD", t2t_info_to_str(p_cmd_rsp_info),
- p_cmd_rsp_info->opcode);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "RW SENT [%s]:0x%x CMD", t2t_info_to_str(p_cmd_rsp_info),
+ p_cmd_rsp_info->opcode);
status = NFC_SendData(NFC_RF_CONN_ID, p_data);
if (status == NFC_STATUS_OK) {
@@ -392,15 +381,10 @@
&p_t2t->t2_timer, NFC_TTYPE_RW_T2T_RESPONSE,
(RW_T2T_TOUT_RESP * QUICK_TIMER_TICKS_PER_SEC) / 1000);
} else {
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_ERROR2("T2T NFC Send data failed. state=%s substate=%s ",
- rw_t2t_get_state_name(p_t2t->state).c_str(),
- rw_t2t_get_substate_name(p_t2t->substate).c_str());
-#else
- RW_TRACE_ERROR2(
- "T2T NFC Send data failed. state=0x%02X substate=0x%02X ",
- p_t2t->state, p_t2t->substate);
-#endif
+ LOG(ERROR) << StringPrintf(
+ "T2T NFC Send data failed. state=%s substate=%s ",
+ rw_t2t_get_state_name(p_t2t->state).c_str(),
+ rw_t2t_get_substate_name(p_t2t->substate).c_str());
}
} else {
status = NFC_STATUS_NO_BUFFERS;
@@ -449,12 +433,8 @@
rw_t2t_resume_op();
}
} else if (p_t2t->state != RW_T2T_STATE_IDLE) {
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_ERROR1("T2T timeout. state=%s ",
- rw_t2t_get_state_name(p_t2t->state).c_str());
-#else
- RW_TRACE_ERROR1("T2T timeout. state=0x%02X ", p_t2t->state);
-#endif
+ LOG(ERROR) << StringPrintf("T2T timeout. state=%s ",
+ rw_t2t_get_state_name(p_t2t->state).c_str());
/* Handle timeout error as no response to the command sent */
rw_t2t_process_error();
}
@@ -498,15 +478,15 @@
(tT2T_CMD_RSP_INFO*)rw_cb.tcb.t2t.p_cmd_rsp_info;
tRW_DETECT_NDEF_DATA ndef_data;
- RW_TRACE_DEBUG1("rw_t2t_process_error () State: %u", p_t2t->state);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("State: %u", p_t2t->state);
/* Retry sending command if retry-count < max */
if ((!p_t2t->check_tag_halt) && (rw_cb.cur_retry < RW_MAX_RETRIES)) {
/* retry sending the command */
rw_cb.cur_retry++;
- RW_TRACE_DEBUG2("T2T retransmission attempt %i of %i", rw_cb.cur_retry,
- RW_MAX_RETRIES);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "T2T retransmission attempt %i of %i", rw_cb.cur_retry, RW_MAX_RETRIES);
/* allocate a new buffer for message */
p_cmd_buf = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
@@ -529,10 +509,11 @@
}
} else {
if (p_t2t->check_tag_halt) {
- RW_TRACE_DEBUG0("T2T Went to HALT State!");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("T2T Went to HALT State!");
} else {
- RW_TRACE_DEBUG1("T2T maximum retransmission attempts reached (%i)",
- RW_MAX_RETRIES);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "T2T maximum retransmission attempts reached (%i)", RW_MAX_RETRIES);
}
}
rw_event = rw_t2t_info_to_event(p_cmd_rsp_info);
@@ -668,7 +649,7 @@
p_data = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (p_data == NULL) {
- RW_TRACE_ERROR0("rw_t2t_sector_change - No buffer");
+ LOG(ERROR) << StringPrintf("rw_t2t_sector_change - No buffer");
return (NFC_STATUS_NO_BUFFERS);
}
@@ -688,12 +669,13 @@
p_t2t->p_cmd_rsp_info = NULL;
p_t2t->substate = RW_T2T_SUBSTATE_WAIT_SELECT_SECTOR;
- RW_TRACE_EVENT0("rw_t2t_sector_change Sent Second Command");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("rw_t2t_sector_change Sent Second Command");
nfc_start_quick_timer(
&p_t2t->t2_timer, NFC_TTYPE_RW_T2T_RESPONSE,
(RW_T2T_SEC_SEL_TOUT_RESP * QUICK_TIMER_TICKS_PER_SEC) / 1000);
} else {
- RW_TRACE_ERROR1(
+ LOG(ERROR) << StringPrintf(
"rw_t2t_sector_change Send failed at rw_t2t_send_cmd, error: %u",
status);
}
@@ -751,7 +733,8 @@
status = rw_t2t_send_cmd(T2T_CMD_READ, (uint8_t*)read_cmd);
if (status == NFC_STATUS_OK) {
p_t2t->block_read = block;
- RW_TRACE_EVENT1("rw_t2t_read Sent Command for Block: %u", block);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("rw_t2t_read Sent Command for Block: %u", block);
}
return status;
@@ -808,7 +791,8 @@
/* Send Write command as sector change is not needed */
status = rw_t2t_send_cmd(T2T_CMD_WRITE, write_cmd);
if (status == NFC_STATUS_OK) {
- RW_TRACE_EVENT1("rw_t2t_write Sent Command for Block: %u", block);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("rw_t2t_write Sent Command for Block: %u", block);
}
return status;
@@ -833,7 +817,7 @@
if (p_t2t->p_cur_cmd_buf == NULL) {
p_t2t->p_cur_cmd_buf = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (p_t2t->p_cur_cmd_buf == NULL) {
- RW_TRACE_ERROR0(
+ LOG(ERROR) << StringPrintf(
"rw_t2t_select: unable to allocate buffer for retransmission");
return (NFC_STATUS_FAILED);
}
@@ -842,7 +826,7 @@
if (p_t2t->p_sec_cmd_buf == NULL) {
p_t2t->p_sec_cmd_buf = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (p_t2t->p_sec_cmd_buf == NULL) {
- RW_TRACE_ERROR0(
+ LOG(ERROR) << StringPrintf(
"rw_t2t_select: unable to allocate buffer used during sector change");
return (NFC_STATUS_FAILED);
}
@@ -899,7 +883,7 @@
tRW_CB* p_rw_cb = &rw_cb;
uint8_t sector_blk = 0; /* block 0 of current sector */
- RW_TRACE_API0("RW_T2tPresenceCheck");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* If RW_SelectTagType was not called (no conn_callback) return failure */
if (!p_rw_cb->p_cback) {
@@ -941,15 +925,16 @@
tNFC_STATUS status;
if (p_t2t->state != RW_T2T_STATE_IDLE) {
- RW_TRACE_ERROR1("Error: Type 2 tag not activated or Busy - State: %u",
- p_t2t->state);
+ LOG(ERROR) << StringPrintf(
+ "Error: Type 2 tag not activated or Busy - State: %u", p_t2t->state);
return (NFC_STATUS_FAILED);
}
status = rw_t2t_read(block);
if (status == NFC_STATUS_OK) {
p_t2t->state = RW_T2T_STATE_READ;
- RW_TRACE_EVENT0("RW_T2tRead Sent Read command");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("RW_T2tRead Sent Read command");
}
return status;
@@ -973,8 +958,8 @@
tNFC_STATUS status;
if (p_t2t->state != RW_T2T_STATE_IDLE) {
- RW_TRACE_ERROR1("Error: Type 2 tag not activated or Busy - State: %u",
- p_t2t->state);
+ LOG(ERROR) << StringPrintf(
+ "Error: Type 2 tag not activated or Busy - State: %u", p_t2t->state);
return (NFC_STATUS_FAILED);
}
@@ -985,7 +970,8 @@
p_t2t->b_read_hdr = false;
else if (block < (T2T_FIRST_DATA_BLOCK + T2T_READ_BLOCKS))
p_t2t->b_read_data = false;
- RW_TRACE_EVENT0("RW_T2tWrite Sent Write command");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("RW_T2tWrite Sent Write command");
}
return status;
@@ -1015,13 +1001,13 @@
uint8_t sector_byte2[1];
if (p_t2t->state != RW_T2T_STATE_IDLE) {
- RW_TRACE_ERROR1("Error: Type 2 tag not activated or Busy - State: %u",
- p_t2t->state);
+ LOG(ERROR) << StringPrintf(
+ "Error: Type 2 tag not activated or Busy - State: %u", p_t2t->state);
return (NFC_STATUS_FAILED);
}
if (sector >= T2T_MAX_SECTOR) {
- RW_TRACE_ERROR2(
+ LOG(ERROR) << StringPrintf(
"RW_T2tSectorSelect - Invalid sector: %u, T2 Max supported sector "
"value: %u",
sector, T2T_MAX_SECTOR - 1);
@@ -1036,13 +1022,13 @@
p_t2t->select_sector = sector;
p_t2t->substate = RW_T2T_SUBSTATE_WAIT_SELECT_SECTOR_SUPPORT;
- RW_TRACE_EVENT0("RW_T2tSectorSelect Sent Sector select first command");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("RW_T2tSectorSelect Sent Sector select first command");
}
return status;
}
-#if (BT_TRACE_VERBOSE == TRUE)
/*******************************************************************************
**
** Function rw_t2t_get_state_name
@@ -1138,5 +1124,3 @@
return "???? UNKNOWN SUBSTATE";
}
}
-
-#endif /* (BT_TRACE_VERBOSE == TRUE) */
diff --git a/src/nfc/tags/rw_t2t_ndef.cc b/src/nfc/tags/rw_t2t_ndef.cc
index 1fb64f8..a47c608 100644
--- a/src/nfc/tags/rw_t2t_ndef.cc
+++ b/src/nfc/tags/rw_t2t_ndef.cc
@@ -107,7 +107,7 @@
if (p_t2t->tag_hdr[T2T_CC0_NMN_BYTE] == T2T_CC0_NMN) {
rw_t2t_handle_cc_read_rsp();
} else {
- RW_TRACE_WARNING3(
+ LOG(WARNING) << StringPrintf(
"NDEF Detection failed!, CC[0]: 0x%02x, CC[1]: 0x%02x, CC[3]: "
"0x%02x",
p_t2t->tag_hdr[T2T_CC0_NMN_BYTE],
@@ -638,7 +638,7 @@
p_t2t->tlv_value[2 - p_t2t->bytes_count] = p_data[offset];
if (p_t2t->bytes_count == 0) {
if (p_t2t->num_mem_tlvs >= RW_T2T_MAX_MEM_TLVS) {
- RW_TRACE_ERROR0(
+ LOG(ERROR) << StringPrintf(
"rw_t2t_handle_tlv_detect_rsp - Maximum buffer allocated "
"for Memory tlv has reached");
failed = true;
@@ -2554,7 +2554,7 @@
p_ret = t2t_tag_init_data(p_t2t->tag_hdr[0], false, 0);
if (p_ret == NULL) {
- RW_TRACE_WARNING1(
+ LOG(WARNING) << StringPrintf(
"rw_t2t_format_tag - Unknown Manufacturer ID: %u, Cannot Format the "
"tag!",
p_t2t->tag_hdr[0]);
@@ -2564,7 +2564,7 @@
if (p_t2t->tag_hdr[T2T_CC2_TMS_BYTE] != 0) {
/* If OTP tag has valid NDEF Message, cannot format the tag */
if ((p_t2t->ndef_msg_len > 0) && (p_ret->b_otp)) {
- RW_TRACE_WARNING0(
+ LOG(WARNING) << StringPrintf(
"rw_t2t_format_tag - Cannot Format a OTP tag with NDEF Message!");
return (NFC_STATUS_FAILED);
}
@@ -2575,7 +2575,8 @@
(p_t2t->tag_hdr[T2T_CC1_VNO_BYTE] != T2T_CC1_LEGACY_VNO) &&
(p_t2t->tag_hdr[T2T_CC1_VNO_BYTE] != T2T_CC1_VNO) &&
(p_t2t->tag_hdr[T2T_CC1_VNO_BYTE] != T2T_CC1_NEW_VNO))) {
- RW_TRACE_WARNING0("rw_t2t_format_tag - Tag not blank to Format!");
+ LOG(WARNING) << StringPrintf(
+ "rw_t2t_format_tag - Tag not blank to Format!");
return (NFC_STATUS_FAILED);
} else {
tms = p_t2t->tag_hdr[T2T_CC2_TMS_BYTE];
@@ -2626,7 +2627,7 @@
/* If CC block is read and cc3 is soft locked, reject the command */
if ((p_t2t->tag_hdr[T2T_CC3_RWA_BYTE] & T2T_CC3_RWA_RO) == T2T_CC3_RWA_RO) {
- RW_TRACE_ERROR1(
+ LOG(ERROR) << StringPrintf(
"rw_t2t_soft_lock_tag: Error: Type 2 tag is in Read only state, CC3: "
"%u",
p_t2t->tag_hdr[T2T_CC3_RWA_BYTE]);
@@ -2641,7 +2642,7 @@
if ((p_t2t->tag_hdr[T2T_CC2_TMS_BYTE] != T2T_CC2_TMS_STATIC) &&
(p_t2t->num_lockbytes == 0)) {
- RW_TRACE_ERROR0(
+ LOG(ERROR) << StringPrintf(
"rw_t2t_soft_lock_tag: Error: Lock TLV not detected! Cannot hard "
"lock the tag");
return (NFC_STATUS_FAILED);
@@ -2689,8 +2690,9 @@
tNFC_STATUS status = NFC_STATUS_FAILED;
if (p_t2t->state != RW_T2T_STATE_IDLE) {
- RW_TRACE_WARNING1("RW_T2tFormatNDef - Tag not initialized/ Busy! State: %u",
- p_t2t->state);
+ LOG(WARNING) << StringPrintf(
+ "RW_T2tFormatNDef - Tag not initialized/ Busy! State: %u",
+ p_t2t->state);
return (NFC_STATUS_FAILED);
}
@@ -2733,21 +2735,22 @@
uint16_t block;
if (p_t2t->state != RW_T2T_STATE_IDLE) {
- RW_TRACE_ERROR1("Error: Type 2 tag not activated or Busy - State: %u",
- p_t2t->state);
+ LOG(ERROR) << StringPrintf(
+ "Error: Type 2 tag not activated or Busy - State: %u", p_t2t->state);
return (NFC_STATUS_BUSY);
}
if ((tlv_type != TAG_LOCK_CTRL_TLV) && (tlv_type != TAG_MEM_CTRL_TLV) &&
(tlv_type != TAG_NDEF_TLV) && (tlv_type != TAG_PROPRIETARY_TLV)) {
- RW_TRACE_API1("RW_T2tLocateTlv - Cannot search TLV: 0x%02x", tlv_type);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "RW_T2tLocateTlv - Cannot search TLV: 0x%02x", tlv_type);
return (NFC_STATUS_FAILED);
}
if ((tlv_type == TAG_LOCK_CTRL_TLV) && (p_t2t->b_read_hdr) &&
(p_t2t->tag_hdr[T2T_CC2_TMS_BYTE] == T2T_CC2_TMS_STATIC)) {
p_t2t->b_read_hdr = false;
- RW_TRACE_API1(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"RW_T2tLocateTlv - No Lock tlv in static structure tag, CC[0]: 0x%02x",
p_t2t->tag_hdr[T2T_CC2_TMS_BYTE]);
return (NFC_STATUS_FAILED);
@@ -2756,7 +2759,7 @@
if ((tlv_type == TAG_NDEF_TLV) && (p_t2t->b_read_hdr) &&
(p_t2t->tag_hdr[T2T_CC0_NMN_BYTE] != T2T_CC0_NMN)) {
p_t2t->b_read_hdr = false;
- RW_TRACE_WARNING3(
+ LOG(WARNING) << StringPrintf(
"RW_T2tLocateTlv - Invalid NDEF Magic Number!, CC[0]: 0x%02x, CC[1]: "
"0x%02x, CC[3]: 0x%02x",
p_t2t->tag_hdr[T2T_CC0_NMN_BYTE], p_t2t->tag_hdr[T2T_CC1_VNO_BYTE],
@@ -2857,26 +2860,27 @@
uint16_t block;
if (p_t2t->state != RW_T2T_STATE_IDLE) {
- RW_TRACE_ERROR1("Error: Type 2 tag not activated or Busy - State: %u",
- p_t2t->state);
+ LOG(ERROR) << StringPrintf(
+ "Error: Type 2 tag not activated or Busy - State: %u", p_t2t->state);
return (NFC_STATUS_FAILED);
}
if (p_t2t->ndef_status == T2T_NDEF_NOT_DETECTED) {
- RW_TRACE_ERROR0("RW_T2tReadNDef - Error: NDEF detection not performed yet");
+ LOG(ERROR) << StringPrintf(
+ "RW_T2tReadNDef - Error: NDEF detection not performed yet");
return (NFC_STATUS_FAILED);
}
if (buf_len < p_t2t->ndef_msg_len) {
- RW_TRACE_WARNING2(
+ LOG(WARNING) << StringPrintf(
"RW_T2tReadNDef - buffer size: %u less than NDEF msg sise: %u",
buf_len, p_t2t->ndef_msg_len);
return (NFC_STATUS_FAILED);
}
if (!p_t2t->ndef_msg_len) {
- RW_TRACE_WARNING1("RW_T2tReadNDef - NDEF Message length is zero ",
- p_t2t->ndef_msg_len);
+ LOG(WARNING) << StringPrintf(
+ "RW_T2tReadNDef - NDEF Message length is zero");
return (NFC_STATUS_NOT_INITIALIZED);
}
@@ -2934,25 +2938,27 @@
tNFC_STATUS status = NFC_STATUS_OK;
if (p_t2t->state != RW_T2T_STATE_IDLE) {
- RW_TRACE_ERROR1("Error: Type 2 tag not activated or Busy - State: %u",
- p_t2t->state);
+ LOG(ERROR) << StringPrintf(
+ "Error: Type 2 tag not activated or Busy - State: %u", p_t2t->state);
return (NFC_STATUS_FAILED);
}
if (p_t2t->ndef_status == T2T_NDEF_NOT_DETECTED) {
- RW_TRACE_ERROR0("RW_T2tWriteNDef - Error: NDEF detection not performed!");
+ LOG(ERROR) << StringPrintf(
+ "RW_T2tWriteNDef - Error: NDEF detection not performed!");
return (NFC_STATUS_FAILED);
}
if (p_t2t->tag_hdr[T2T_CC3_RWA_BYTE] != T2T_CC3_RWA_RW) {
- RW_TRACE_ERROR1("RW_T2tWriteNDef - Write access not granted - CC3: %u",
- p_t2t->tag_hdr[T2T_CC3_RWA_BYTE]);
+ LOG(ERROR) << StringPrintf(
+ "RW_T2tWriteNDef - Write access not granted - CC3: %u",
+ p_t2t->tag_hdr[T2T_CC3_RWA_BYTE]);
return (NFC_STATUS_REFUSED);
}
/* Check if there is enough memory on the tag */
if (msg_len > p_t2t->max_ndef_msg_len) {
- RW_TRACE_ERROR1(
+ LOG(ERROR) << StringPrintf(
"RW_T2tWriteNDef - Cannot write NDEF of size greater than %u bytes",
p_t2t->max_ndef_msg_len);
return (NFC_STATUS_FAILED);
@@ -2963,7 +2969,7 @@
if ((p_t2t->ndef_msg_len > 0) &&
((p_ret = t2t_tag_init_data(p_t2t->tag_hdr[0], false, 0)) != NULL) &&
(p_ret->b_otp)) {
- RW_TRACE_WARNING0(
+ LOG(WARNING) << StringPrintf(
"RW_T2tWriteNDef - Cannot Overwrite NDEF Message on a OTP tag!");
return (NFC_STATUS_FAILED);
}
@@ -3010,7 +3016,7 @@
tRW_T2T_CB* p_t2t = &rw_cb.tcb.t2t;
if (p_t2t->state != RW_T2T_STATE_IDLE) {
- RW_TRACE_ERROR1(
+ LOG(ERROR) << StringPrintf(
"RW_T2tSetTagReadOnly: Error: Type 2 tag not activated or Busy - "
"State: %u",
p_t2t->state);
diff --git a/src/nfc/tags/rw_t3t.cc b/src/nfc/tags/rw_t3t.cc
index ef77c59..6b799a8 100644
--- a/src/nfc/tags/rw_t3t.cc
+++ b/src/nfc/tags/rw_t3t.cc
@@ -121,10 +121,8 @@
block-write to complete */
};
-#if (BT_TRACE_VERBOSE == TRUE)
static std::string rw_t3t_cmd_str(uint8_t cmd_id);
static std::string rw_t3t_state_str(uint8_t state_id);
-#endif
/* Local static functions */
static void rw_t3t_update_ndef_flag(uint8_t* p_flag);
@@ -256,8 +254,9 @@
/* retry sending the command */
rw_cb.cur_retry++;
- RW_TRACE_DEBUG2("T3T retransmission attempt %i of %i", rw_cb.cur_retry,
- RW_MAX_RETRIES);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("T3T retransmission attempt %i of %i",
+ rw_cb.cur_retry, RW_MAX_RETRIES);
/* allocate a new buffer for message */
p_cmd_buf = rw_t3t_get_cmd_buf();
@@ -277,8 +276,8 @@
}
}
} else {
- RW_TRACE_DEBUG1("T3T maximum retransmission attempts reached (%i)",
- RW_MAX_RETRIES);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "T3T maximum retransmission attempts reached (%i)", RW_MAX_RETRIES);
}
#if (RW_STATS_INCLUDED == TRUE)
@@ -400,10 +399,11 @@
evt_data.t3t_sc.num_system_codes = p_cb->num_system_codes;
evt_data.t3t_sc.p_system_codes = p_cb->system_codes;
- RW_TRACE_DEBUG1("rw_t3t_handle_get_system_codes_cplt, number of systems: %i",
- evt_data.t3t_sc.num_system_codes);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "number of systems: %i", evt_data.t3t_sc.num_system_codes);
for (i = 0; i < evt_data.t3t_sc.num_system_codes; i++) {
- RW_TRACE_DEBUG2(" system %i: %04X", i, evt_data.t3t_sc.p_system_codes[i]);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "system %i: %04X", i, evt_data.t3t_sc.p_system_codes[i]);
}
p_cb->rw_state = RW_T3T_STATE_IDLE;
@@ -478,19 +478,14 @@
/* Check which timer timed out */
if (p_tle == &p_cb->timer) {
/* UPDATE/CHECK response timeout */
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_ERROR3("T3T timeout. state=%s cur_cmd=0x%02X (%s)",
- rw_t3t_state_str(rw_cb.tcb.t3t.rw_state).c_str(),
- rw_cb.tcb.t3t.cur_cmd,
- rw_t3t_cmd_str(rw_cb.tcb.t3t.cur_cmd).c_str());
-#else
- RW_TRACE_ERROR2("T3T timeout. state=0x%02X cur_cmd=0x%02X",
- rw_cb.tcb.t3t.rw_state, rw_cb.tcb.t3t.cur_cmd);
-#endif
+LOG(ERROR) << StringPrintf("T3T timeout. state=%s cur_cmd=0x%02X (%s)",
+ rw_t3t_state_str(rw_cb.tcb.t3t.rw_state).c_str(),
+ rw_cb.tcb.t3t.cur_cmd,
+ rw_t3t_cmd_str(rw_cb.tcb.t3t.cur_cmd).c_str());
- rw_t3t_process_error(NFC_STATUS_TIMEOUT);
+rw_t3t_process_error(NFC_STATUS_TIMEOUT);
} else {
- RW_TRACE_ERROR0("T3T POLL timeout.");
+ LOG(ERROR) << StringPrintf("T3T POLL timeout.");
/* POLL response timeout */
if (p_cb->flags & RW_T3T_FL_W4_PRESENCE_CHECK_POLL_RSP) {
@@ -506,12 +501,12 @@
} else if (p_cb->flags & RW_T3T_FL_W4_FMT_FELICA_LITE_POLL_RSP) {
/* POLL timeout for formatting Felica Lite */
p_cb->flags &= ~RW_T3T_FL_W4_FMT_FELICA_LITE_POLL_RSP;
- RW_TRACE_ERROR0("Felica-Lite tag not detected");
+ LOG(ERROR) << StringPrintf("Felica-Lite tag not detected");
rw_t3t_format_cplt(NFC_STATUS_FAILED);
} else if (p_cb->flags & RW_T3T_FL_W4_SRO_FELICA_LITE_POLL_RSP) {
/* POLL timeout for configuring Felica Lite read only */
p_cb->flags &= ~RW_T3T_FL_W4_SRO_FELICA_LITE_POLL_RSP;
- RW_TRACE_ERROR0("Felica-Lite tag not detected");
+ LOG(ERROR) << StringPrintf("Felica-Lite tag not detected");
rw_t3t_set_readonly_cplt(NFC_STATUS_FAILED);
} else if (p_cb->flags & RW_T3T_FL_W4_NDEF_DETECT_POLL_RSP) {
/* POLL timeout for ndef detection */
@@ -536,15 +531,10 @@
**
*******************************************************************************/
void rw_t3t_process_frame_error(void) {
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_ERROR3("T3T frame error. state=%s cur_cmd=0x%02X (%s)",
- rw_t3t_state_str(rw_cb.tcb.t3t.rw_state).c_str(),
- rw_cb.tcb.t3t.cur_cmd,
- rw_t3t_cmd_str(rw_cb.tcb.t3t.cur_cmd).c_str());
-#else
- RW_TRACE_ERROR2("T3T frame error. state=0x%02X cur_cmd=0x%02X",
- rw_cb.tcb.t3t.rw_state, rw_cb.tcb.t3t.cur_cmd);
-#endif
+ LOG(ERROR) << StringPrintf("T3T frame error. state=%s cur_cmd=0x%02X (%s)",
+ rw_t3t_state_str(rw_cb.tcb.t3t.rw_state).c_str(),
+ rw_cb.tcb.t3t.cur_cmd,
+ rw_t3t_cmd_str(rw_cb.tcb.t3t.cur_cmd).c_str());
#if (RW_STATS_INCLUDED == TRUE)
/* Update stats */
@@ -579,9 +569,7 @@
UINT8_TO_STREAM(p, (p_msg->len + 1));
p_msg->len += 1; /* Increment len to include SoD */
-#if (BT_TRACE_PROTOCOL == TRUE)
DispT3TagMessage(p_msg, false);
-#endif
return (NFC_SendData(NFC_RF_CONN_ID, p_msg));
}
@@ -641,8 +629,9 @@
p_cb->rw_state = RW_T3T_STATE_IDLE;
}
- RW_TRACE_DEBUG3("rw_t3t_send_cmd: cur_tout: %d, timeout_ticks: %d ret:%d",
- p_cb->cur_tout, timeout_ticks, retval);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("cur_tout: %d, timeout_ticks: %d ret:%d", p_cb->cur_tout,
+ timeout_ticks, retval);
return (retval);
}
@@ -926,9 +915,8 @@
p_cb->ndef_rx_readlen = ((uint32_t)p_cb->ndef_attrib.nbr * 16);
}
- RW_TRACE_DEBUG3(
- "rw_t3t_send_next_ndef_check_cmd: bytes_remaining: %i, "
- "cur_blocks_to_read: %i, is_final: %i",
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "bytes_remaining: %i, cur_blocks_to_read: %i, is_final: %i",
ndef_bytes_remaining, cur_blocks_to_read,
(p_cb->flags & RW_T3T_FL_IS_FINAL_NDEF_SEGMENT));
@@ -1185,7 +1173,7 @@
return rw_t3t_send_cmd(p_cb, p_cb->cur_cmd, p_cmd_buf,
rw_t3t_check_timeout(1));
} else {
- RW_TRACE_ERROR0("Unable to allocate buffer to read MC block");
+ LOG(ERROR) << StringPrintf("Unable to allocate buffer to read MC block");
return (NFC_STATUS_NO_BUFFERS);
}
}
@@ -1252,9 +1240,9 @@
/* Check if response code is CHECK resp (for reading NDEF attribute block) */
if (p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE] != T3T_MSG_OPC_CHECK_RSP) {
- RW_TRACE_ERROR2("Response error: expecting rsp_code %02X, but got %02X",
- T3T_MSG_OPC_CHECK_RSP,
- p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE]);
+ LOG(ERROR) << StringPrintf(
+ "Response error: expecting rsp_code %02X, but got %02X",
+ T3T_MSG_OPC_CHECK_RSP, p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE]);
evt_data.status = NFC_STATUS_FAILED;
}
/* Validate status code and NFCID2 response from tag */
@@ -1282,7 +1270,7 @@
NFC_STATUS_FAILED; /* only ok or failed passed to the app. can be
boolean*/
- RW_TRACE_ERROR0("RW_T3tDetectNDEF checksum failed");
+ LOG(ERROR) << StringPrintf("RW_T3tDetectNDEF checksum failed");
} else {
p_cb->ndef_attrib.status = NFC_STATUS_OK;
@@ -1293,7 +1281,7 @@
T3T_GET_MAJOR_VERSION(p_cb->ndef_attrib.version)) {
/* Remote tag's MajorVer is newer than our's. Reject NDEF as per T3TOP
* RQ_T3T_NDA_024 */
- RW_TRACE_ERROR2(
+ LOG(ERROR) << StringPrintf(
"RW_T3tDetectNDEF: incompatible NDEF version. Local=0x%02x, "
"Remote=0x%02x",
T3T_MSG_NDEF_VERSION, p_cb->ndef_attrib.version);
@@ -1327,8 +1315,9 @@
BE_STREAM_TO_UINT16(p_cb->ndef_attrib.ln, p); /* Ln: lo-word */
p_cb->ndef_attrib.ln += (temp << 16);
- RW_TRACE_DEBUG1("Detected NDEF Ver: 0x%02x", p_cb->ndef_attrib.version);
- RW_TRACE_DEBUG6(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Detected NDEF Ver: 0x%02x", p_cb->ndef_attrib.version);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"Detected NDEF Attributes: Nbr=%i, Nbw=%i, Nmaxb=%i, WriteF=%i, "
"RWFlag=%i, Ln=%i",
p_cb->ndef_attrib.nbr, p_cb->ndef_attrib.nbw,
@@ -1347,7 +1336,8 @@
}
}
- RW_TRACE_DEBUG1("RW_T3tDetectNDEF response: %i", evt_data.status);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("RW_T3tDetectNDEF response: %i", evt_data.status);
p_cb->rw_state = RW_T3T_STATE_IDLE;
rw_t3t_update_ndef_flag(&evt_data.flags);
@@ -1382,9 +1372,9 @@
nfc_status = NFC_STATUS_FAILED;
GKI_freebuf(p_msg_rsp);
} else if (p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE] != T3T_MSG_OPC_CHECK_RSP) {
- RW_TRACE_ERROR2("Response error: expecting rsp_code %02X, but got %02X",
- T3T_MSG_OPC_CHECK_RSP,
- p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE]);
+ LOG(ERROR) << StringPrintf(
+ "Response error: expecting rsp_code %02X, but got %02X",
+ T3T_MSG_OPC_CHECK_RSP, p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE]);
nfc_status = NFC_STATUS_FAILED;
GKI_freebuf(p_msg_rsp);
} else {
@@ -1427,9 +1417,9 @@
{
evt_data.status = NFC_STATUS_FAILED;
} else if (p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE] != T3T_MSG_OPC_UPDATE_RSP) {
- RW_TRACE_ERROR2("Response error: expecting rsp_code %02X, but got %02X",
- T3T_MSG_OPC_UPDATE_RSP,
- p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE]);
+ LOG(ERROR) << StringPrintf(
+ "Response error: expecting rsp_code %02X, but got %02X",
+ T3T_MSG_OPC_UPDATE_RSP, p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE]);
evt_data.status = NFC_STATUS_FAILED;
} else {
/* Copy incoming data into buffer */
@@ -1459,13 +1449,9 @@
tRW_READ_DATA evt_data;
NFC_HDR* p_pkt = p_data->p_data;
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_DEBUG2("RW T3T Raw Frame: Len [0x%X] Status [%s]", &p_pkt->len,
- NFC_GetStatusName(p_data->status).c_str());
-#else
- RW_TRACE_DEBUG2("RW T3T Raw Frame: Len [0x%X] Status [0x%X]", &p_pkt->len,
- p_data->status);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("RW T3T Raw Frame: Len [0x%X] Status [%s]", p_pkt->len,
+ NFC_GetStatusName(p_data->status).c_str());
/* Copy incoming data into buffer */
evt_data.status = p_data->status;
@@ -1501,15 +1487,16 @@
|| (p_t3t_rsp[T3T_MSG_RSP_OFFSET_NUMBLOCKS] !=
((p_cb->ndef_rx_readlen + 15) >> 4))) /* verify length of response */
{
- RW_TRACE_ERROR2("Response error: bad status, nfcid2, or invalid len: %i %i",
- p_t3t_rsp[T3T_MSG_RSP_OFFSET_NUMBLOCKS],
- ((p_cb->ndef_rx_readlen + 15) >> 4));
+ LOG(ERROR) << StringPrintf(
+ "Response error: bad status, nfcid2, or invalid len: %i %i",
+ p_t3t_rsp[T3T_MSG_RSP_OFFSET_NUMBLOCKS],
+ ((p_cb->ndef_rx_readlen + 15) >> 4));
nfc_status = NFC_STATUS_FAILED;
GKI_freebuf(p_msg_rsp);
} else if (p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE] != T3T_MSG_OPC_CHECK_RSP) {
- RW_TRACE_ERROR2("Response error: expecting rsp_code %02X, but got %02X",
- T3T_MSG_OPC_CHECK_RSP,
- p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE]);
+ LOG(ERROR) << StringPrintf(
+ "Response error: expecting rsp_code %02X, but got %02X",
+ T3T_MSG_OPC_CHECK_RSP, p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE]);
nfc_status = NFC_STATUS_FAILED;
GKI_freebuf(p_msg_rsp);
} else {
@@ -1525,7 +1512,7 @@
/* Verify that the bytes received is really the amount indicated in the
* check-response header */
if (rsp_num_bytes_rx > p_msg_rsp->len) {
- RW_TRACE_ERROR2(
+ LOG(ERROR) << StringPrintf(
"Response error: CHECK rsp header indicates %i bytes, but only "
"received %i bytes",
rsp_num_bytes_rx, p_msg_rsp->len);
@@ -1591,9 +1578,9 @@
}
/* Validate response opcode */
else if (p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE] != T3T_MSG_OPC_UPDATE_RSP) {
- RW_TRACE_ERROR2("Response error: expecting rsp_code %02X, but got %02X",
- T3T_MSG_OPC_UPDATE_RSP,
- p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE]);
+ LOG(ERROR) << StringPrintf(
+ "Response error: expecting rsp_code %02X, but got %02X",
+ T3T_MSG_OPC_UPDATE_RSP, p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE]);
nfc_status = NFC_STATUS_FAILED;
}
/* If this is response to final UPDATE, then update NDEF local size */
@@ -1657,7 +1644,8 @@
p = &p_sensf_res_buf[RW_T3T_SENSF_RES_RD_OFFSET];
BE_STREAM_TO_UINT16(sc, p);
- RW_TRACE_DEBUG1("FeliCa detected (RD, system code %04X)", sc);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("FeliCa detected (RD, system code %04X)", sc);
p_cb->system_codes[p_cb->num_system_codes++] = sc;
}
@@ -1810,14 +1798,15 @@
if ((nci_status == NCI_STATUS_OK) && (num_responses > 0)) {
/* Tag responded for Felica-Lite poll */
/* Get MemoryControl block */
- RW_TRACE_DEBUG0("Felica-Lite tag detected...getting Memory Control block.");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "Felica-Lite tag detected...getting Memory Control block.");
p_cb->rw_substate = RW_T3T_FMT_SST_CHECK_MC_BLK;
/* Send command to check Memory Configuration block */
evt_data.status = rw_t3t_check_mc_block(p_cb);
} else {
- RW_TRACE_ERROR0("Felica-Lite tag not detected");
+ LOG(ERROR) << StringPrintf("Felica-Lite tag not detected");
evt_data.status = NFC_STATUS_FAILED;
}
@@ -1847,9 +1836,9 @@
if (p_cb->rw_substate == RW_T3T_FMT_SST_CHECK_MC_BLK) {
/* Validate response opcode */
if (p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE] != T3T_MSG_OPC_CHECK_RSP) {
- RW_TRACE_ERROR2("Response error: expecting rsp_code %02X, but got %02X",
- T3T_MSG_OPC_CHECK_RSP,
- p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE]);
+ LOG(ERROR) << StringPrintf(
+ "Response error: expecting rsp_code %02X, but got %02X",
+ T3T_MSG_OPC_CHECK_RSP, p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE]);
evt_data.status = NFC_STATUS_FAILED;
}
/* Validate status code and NFCID2 response from tag */
@@ -1898,9 +1887,9 @@
(p_t3t_rsp[T3T_MSG_RSP_OFFSET_STATUS1] != T3T_MSG_RSP_STATUS_OK))
{
- RW_TRACE_ERROR2("Response error: rsp_code=%02X, status=%02X",
- p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE],
- p_t3t_rsp[T3T_MSG_RSP_OFFSET_STATUS1]);
+ LOG(ERROR) << StringPrintf("Response error: rsp_code=%02X, status=%02X",
+ p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE],
+ p_t3t_rsp[T3T_MSG_RSP_OFFSET_STATUS1]);
evt_data.status = NFC_STATUS_FAILED;
} else {
/* SYS_OP=1: ndef already enabled. Just need to update attribute
@@ -1920,9 +1909,9 @@
(p_t3t_rsp[T3T_MSG_RSP_OFFSET_STATUS1] != T3T_MSG_RSP_STATUS_OK))
{
- RW_TRACE_ERROR2("Response error: rsp_code=%02X, status=%02X",
- p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE],
- p_t3t_rsp[T3T_MSG_RSP_OFFSET_STATUS1]);
+ LOG(ERROR) << StringPrintf("Response error: rsp_code=%02X, status=%02X",
+ p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE],
+ p_t3t_rsp[T3T_MSG_RSP_OFFSET_STATUS1]);
evt_data.status = NFC_STATUS_FAILED;
}
@@ -1959,7 +1948,7 @@
/* Tag responded for Felica-Lite poll */
if (p_cb->ndef_attrib.rwflag != T3T_MSG_NDEF_RWFLAG_RO) {
/* First update attribute information block */
- RW_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"Felica-Lite tag detected...update NDef attribution block.");
p_cb->rw_substate = RW_T3T_SRO_SST_UPDATE_NDEF_ATTRIB;
@@ -2001,7 +1990,7 @@
rw_t3t_update_block(p_cb, 0, (uint8_t*)rw_t3t_ndef_attrib_info);
} else if (p_cb->cur_cmd == RW_T3T_CMD_SET_READ_ONLY_HARD) {
/* NDEF is already read only, Read and update MemoryControl block */
- RW_TRACE_DEBUG0(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"Felica-Lite tag detected...getting Memory Control block.");
p_cb->rw_substate = RW_T3T_SRO_SST_CHECK_MC_BLK;
@@ -2009,7 +1998,7 @@
evt_data.status = rw_t3t_check_mc_block(p_cb);
}
} else {
- RW_TRACE_ERROR0("Felica-Lite tag not detected");
+ LOG(ERROR) << StringPrintf("Felica-Lite tag not detected");
evt_data.status = NFC_STATUS_FAILED;
}
@@ -2041,9 +2030,9 @@
(p_t3t_rsp[T3T_MSG_RSP_OFFSET_STATUS1] != T3T_MSG_RSP_STATUS_OK))
{
- RW_TRACE_ERROR2("Response error: rsp_code=%02X, status=%02X",
- p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE],
- p_t3t_rsp[T3T_MSG_RSP_OFFSET_STATUS1]);
+ LOG(ERROR) << StringPrintf("Response error: rsp_code=%02X, status=%02X",
+ p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE],
+ p_t3t_rsp[T3T_MSG_RSP_OFFSET_STATUS1]);
evt_data.status = NFC_STATUS_FAILED;
} else {
p_cb->ndef_attrib.rwflag = T3T_MSG_NDEF_RWFLAG_RO;
@@ -2060,9 +2049,9 @@
/* Check tags's response for reading MemoryControl block, Validate response
* opcode */
if (p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE] != T3T_MSG_OPC_CHECK_RSP) {
- RW_TRACE_ERROR2("Response error: expecting rsp_code %02X, but got %02X",
- T3T_MSG_OPC_CHECK_RSP,
- p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE]);
+ LOG(ERROR) << StringPrintf(
+ "Response error: expecting rsp_code %02X, but got %02X",
+ T3T_MSG_OPC_CHECK_RSP, p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE]);
evt_data.status = NFC_STATUS_FAILED;
}
/* Validate status code and NFCID2 response from tag */
@@ -2104,9 +2093,9 @@
(p_t3t_rsp[T3T_MSG_RSP_OFFSET_STATUS1] != T3T_MSG_RSP_STATUS_OK))
{
- RW_TRACE_ERROR2("Response error: rsp_code=%02X, status=%02X",
- p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE],
- p_t3t_rsp[T3T_MSG_RSP_OFFSET_STATUS1]);
+ LOG(ERROR) << StringPrintf("Response error: rsp_code=%02X, status=%02X",
+ p_t3t_rsp[T3T_MSG_RSP_OFFSET_RSPCODE],
+ p_t3t_rsp[T3T_MSG_RSP_OFFSET_STATUS1]);
evt_data.status = NFC_STATUS_FAILED;
} else {
rw_t3t_set_readonly_cplt(evt_data.status);
@@ -2154,8 +2143,8 @@
}
/* Sanity check: verify msg len is big enough to contain t3t header */
else if (p_msg->len < T3T_MSG_RSP_COMMON_HDR_LEN) {
- RW_TRACE_ERROR1("T3T: invalid Type3 Tag Message (invalid len: %i)",
- p_msg->len);
+ LOG(ERROR) << StringPrintf(
+ "T3T: invalid Type3 Tag Message (invalid len: %i)", p_msg->len);
free_msg = true;
rw_t3t_process_frame_error();
@@ -2164,16 +2153,14 @@
p = (uint8_t*)(p_msg + 1) + p_msg->offset;
sod = p[0];
if (p[sod] != NCI_STATUS_OK) {
- RW_TRACE_ERROR1("T3T: rf frame error (crc status=%i)", p[sod]);
+ LOG(ERROR) << StringPrintf("T3T: rf frame error (crc status=%i)", p[sod]);
GKI_freebuf(p_msg);
rw_t3t_process_frame_error();
return;
}
-#if (BT_TRACE_PROTOCOL == TRUE)
DispT3TagMessage(p_msg, true);
-#endif
/* Skip over SoD */
p_msg->offset++;
@@ -2237,7 +2224,8 @@
void rw_t3t_conn_cback(uint8_t conn_id, tNFC_CONN_EVT event,
tNFC_CONN* p_data) {
tRW_T3T_CB* p_cb = &rw_cb.tcb.t3t;
- RW_TRACE_DEBUG2("rw_t3t_conn_cback: conn_id=%i, evt=0x%02x", conn_id, event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "rw_t3t_conn_cback: conn_id=%i, evt=0x%02x", conn_id, event);
/* Only handle NFC_RF_CONN_ID conn_id */
if (conn_id != NFC_RF_CONN_ID) {
@@ -2315,7 +2303,7 @@
uint8_t mrti_check, uint8_t mrti_update) {
tRW_T3T_CB* p_cb = &rw_cb.tcb.t3t;
- RW_TRACE_API0("rw_t3t_select");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
memcpy(p_cb->peer_nfcid2, peer_nfcid2,
NCI_NFCID2_LEN); /* Store tag's NFCID2 */
@@ -2331,7 +2319,7 @@
if (p_cb->p_cur_cmd_buf == NULL) {
p_cb->p_cur_cmd_buf = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (p_cb->p_cur_cmd_buf == NULL) {
- RW_TRACE_ERROR0(
+ LOG(ERROR) << StringPrintf(
"rw_t3t_select: unable to allocate buffer for retransmission");
p_cb->rw_state = RW_T3T_STATE_NOT_ACTIVATED;
return (NFC_STATUS_FAILED);
@@ -2397,7 +2385,6 @@
}
}
-#if (BT_TRACE_VERBOSE == TRUE)
/*******************************************************************************
**
** Function rw_t3t_cmd_str
@@ -2449,7 +2436,6 @@
return "Unknown";
}
}
-#endif
/*****************************************************************************
** Type3 Tag API Functions
@@ -2477,12 +2463,12 @@
tRW_T3T_CB* p_cb = &rw_cb.tcb.t3t;
tNFC_STATUS retval = NFC_STATUS_OK;
- RW_TRACE_API0("RW_T3tDetectNDef");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* Check if we are in valid state to handle this API */
if (p_cb->rw_state != RW_T3T_STATE_IDLE) {
- RW_TRACE_ERROR1("Error: invalid state to handle API (0x%x)",
- p_cb->rw_state);
+ LOG(ERROR) << StringPrintf("Error: invalid state to handle API (0x%x)",
+ p_cb->rw_state);
return (NFC_STATUS_FAILED);
}
@@ -2530,20 +2516,20 @@
tNFC_STATUS retval = NFC_STATUS_OK;
tRW_T3T_CB* p_cb = &rw_cb.tcb.t3t;
- RW_TRACE_API0("RW_T3tCheckNDef");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* Check if we are in valid state to handle this API */
if (p_cb->rw_state != RW_T3T_STATE_IDLE) {
- RW_TRACE_ERROR1("Error: invalid state to handle API (0x%x)",
- p_cb->rw_state);
+ LOG(ERROR) << StringPrintf("Error: invalid state to handle API (0x%x)",
+ p_cb->rw_state);
return (NFC_STATUS_FAILED);
} else if (p_cb->ndef_attrib.status !=
NFC_STATUS_OK) /* NDEF detection not performed yet? */
{
- RW_TRACE_ERROR0("Error: NDEF detection not performed yet");
+ LOG(ERROR) << StringPrintf("Error: NDEF detection not performed yet");
return (NFC_STATUS_NOT_INITIALIZED);
} else if (p_cb->ndef_attrib.ln == 0) {
- RW_TRACE_ERROR0("Type 3 tag contains empty NDEF message");
+ LOG(ERROR) << StringPrintf("Type 3 tag contains empty NDEF message");
return (NFC_STATUS_FAILED);
}
@@ -2585,17 +2571,18 @@
tNFC_STATUS retval = NFC_STATUS_OK;
tRW_T3T_CB* p_cb = &rw_cb.tcb.t3t;
- RW_TRACE_API1("RW_T3tUpdateNDef (len=%i)", len);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("RW_T3tUpdateNDef (len=%i)", len);
/* Check if we are in valid state to handle this API */
if (p_cb->rw_state != RW_T3T_STATE_IDLE) {
- RW_TRACE_ERROR1("Error: invalid state to handle API (0x%x)",
- p_cb->rw_state);
+ LOG(ERROR) << StringPrintf("Error: invalid state to handle API (0x%x)",
+ p_cb->rw_state);
return (NFC_STATUS_FAILED);
} else if (p_cb->ndef_attrib.status !=
NFC_STATUS_OK) /* NDEF detection not performed yet? */
{
- RW_TRACE_ERROR0("Error: NDEF detection not performed yet");
+ LOG(ERROR) << StringPrintf("Error: NDEF detection not performed yet");
return (NFC_STATUS_NOT_INITIALIZED);
} else if (len > (((uint32_t)p_cb->ndef_attrib.nmaxb) *
16)) /* Len exceed's tag's NDEF memory? */
@@ -2644,12 +2631,13 @@
tNFC_STATUS retval = NFC_STATUS_OK;
tRW_T3T_CB* p_cb = &rw_cb.tcb.t3t;
- RW_TRACE_API1("RW_T3tCheck (num_blocks = %i)", num_blocks);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("RW_T3tCheck (num_blocks = %i)", num_blocks);
/* Check if we are in valid state to handle this API */
if (p_cb->rw_state != RW_T3T_STATE_IDLE) {
- RW_TRACE_ERROR1("Error: invalid state to handle API (0x%x)",
- p_cb->rw_state);
+ LOG(ERROR) << StringPrintf("Error: invalid state to handle API (0x%x)",
+ p_cb->rw_state);
return (NFC_STATUS_FAILED);
}
@@ -2684,12 +2672,13 @@
tNFC_STATUS retval = NFC_STATUS_OK;
tRW_T3T_CB* p_cb = &rw_cb.tcb.t3t;
- RW_TRACE_API1("RW_T3tUpdate (num_blocks = %i)", num_blocks);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("RW_T3tUpdate (num_blocks = %i)", num_blocks);
/* Check if we are in valid state to handle this API */
if (p_cb->rw_state != RW_T3T_STATE_IDLE) {
- RW_TRACE_ERROR1("Error: invalid state to handle API (0x%x)",
- p_cb->rw_state);
+ LOG(ERROR) << StringPrintf("Error: invalid state to handle API (0x%x)",
+ p_cb->rw_state);
return (NFC_STATUS_FAILED);
}
@@ -2720,7 +2709,7 @@
tRW_DATA evt_data;
tRW_CB* p_rw_cb = &rw_cb;
- RW_TRACE_API0("RW_T3tPresenceCheck");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* If RW_SelectTagType was not called (no conn_callback) return failure */
if (!(p_rw_cb->p_cback)) {
@@ -2735,7 +2724,8 @@
else if (p_rw_cb->tcb.t3t.rw_state == RW_T3T_STATE_COMMAND_PENDING) {
/* If already performing presence check, return error */
if (p_rw_cb->tcb.t3t.flags & RW_T3T_FL_W4_PRESENCE_CHECK_POLL_RSP) {
- RW_TRACE_DEBUG0("RW_T3tPresenceCheck already in progress");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("RW_T3tPresenceCheck already in progress");
retval = NFC_STATUS_FAILED;
}
/* If busy with any other command, assume that the tag is present */
@@ -2754,7 +2744,7 @@
/* start timer for waiting for responses */
rw_t3t_start_poll_timer(&p_rw_cb->tcb.t3t);
} else {
- RW_TRACE_DEBUG1(
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
"RW_T3tPresenceCheck error sending NCI_RF_T3T_POLLING cmd (status = "
"0x%0x)",
retval);
@@ -2781,12 +2771,12 @@
tNFC_STATUS retval = NFC_STATUS_OK;
tRW_T3T_CB* p_cb = &rw_cb.tcb.t3t;
- RW_TRACE_API0("RW_T3tPoll");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* Check if we are in valid state to handle this API */
if (p_cb->rw_state != RW_T3T_STATE_IDLE) {
- RW_TRACE_ERROR1("Error: invalid state to handle API (0x%x)",
- p_cb->rw_state);
+ LOG(ERROR) << StringPrintf("Error: invalid state to handle API (0x%x)",
+ p_cb->rw_state);
return (NFC_STATUS_FAILED);
}
@@ -2825,12 +2815,13 @@
tNFC_STATUS retval = NFC_STATUS_OK;
tRW_T3T_CB* p_cb = &rw_cb.tcb.t3t;
- RW_TRACE_API1("RW_T3tSendRawFrame (len = %i)", len);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("RW_T3tSendRawFrame (len = %i)", len);
/* Check if we are in valid state to handle this API */
if (p_cb->rw_state != RW_T3T_STATE_IDLE) {
- RW_TRACE_ERROR1("Error: invalid state to handle API (0x%x)",
- p_cb->rw_state);
+ LOG(ERROR) << StringPrintf("Error: invalid state to handle API (0x%x)",
+ p_cb->rw_state);
return (NFC_STATUS_FAILED);
}
@@ -2861,12 +2852,12 @@
tNFC_STATUS retval = NFC_STATUS_OK;
tRW_T3T_CB* p_cb = &rw_cb.tcb.t3t;
- RW_TRACE_API0("RW_T3tGetSystemCodes");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* Check if we are in valid state to handle this API */
if (p_cb->rw_state != RW_T3T_STATE_IDLE) {
- RW_TRACE_ERROR1("Error: invalid state to handle API (0x%x)",
- p_cb->rw_state);
+ LOG(ERROR) << StringPrintf("Error: invalid state to handle API (0x%x)",
+ p_cb->rw_state);
return (NFC_STATUS_FAILED);
} else {
retval = (tNFC_STATUS)nci_snd_t3t_polling(0xFFFF, T3T_POLL_RC_SC, 0);
@@ -2906,12 +2897,12 @@
tNFC_STATUS retval = NFC_STATUS_OK;
tRW_T3T_CB* p_cb = &rw_cb.tcb.t3t;
- RW_TRACE_API0("RW_T3tFormatNDef");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
/* Check if we are in valid state to handle this API */
if (p_cb->rw_state != RW_T3T_STATE_IDLE) {
- RW_TRACE_ERROR1("Error: invalid state to handle API (0x%x)",
- p_cb->rw_state);
+ LOG(ERROR) << StringPrintf("Error: invalid state to handle API (0x%x)",
+ p_cb->rw_state);
return (NFC_STATUS_FAILED);
} else {
/* Poll tag, to see if Felica-Lite system is supported */
@@ -2952,19 +2943,20 @@
tRW_T3T_CB* p_cb = &rw_cb.tcb.t3t;
tRW_DATA evt_data;
- RW_TRACE_API1("RW_T3tSetReadOnly (): b_hard_lock=%d", b_hard_lock);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("b_hard_lock=%d", b_hard_lock);
/* Check if we are in valid state to handle this API */
if (p_cb->rw_state != RW_T3T_STATE_IDLE) {
- RW_TRACE_ERROR1("Error: invalid state to handle API (0x%x)",
- p_cb->rw_state);
+ LOG(ERROR) << StringPrintf("Error: invalid state to handle API (0x%x)",
+ p_cb->rw_state);
return (NFC_STATUS_FAILED);
}
if (p_cb->ndef_attrib.status !=
NFC_STATUS_OK) /* NDEF detection not performed yet? */
{
- RW_TRACE_ERROR0("Error: NDEF detection not performed yet");
+ LOG(ERROR) << StringPrintf("Error: NDEF detection not performed yet");
return (NFC_STATUS_NOT_INITIALIZED);
}
diff --git a/src/nfc/tags/rw_t4t.cc b/src/nfc/tags/rw_t4t.cc
index 18d900c..298d71a 100644
--- a/src/nfc/tags/rw_t4t.cc
+++ b/src/nfc/tags/rw_t4t.cc
@@ -82,10 +82,8 @@
#define RW_T4T_SUBSTATE_WAIT_WRITE_CC 0x0F
#define RW_T4T_SUBSTATE_WAIT_WRITE_NDEF 0x10
-#if (BT_TRACE_VERBOSE == TRUE)
static std::string rw_t4t_get_state_name(uint8_t state);
static std::string rw_t4t_get_sub_state_name(uint8_t sub_state);
-#endif
static bool rw_t4t_send_to_lower(NFC_HDR* p_c_apdu);
static bool rw_t4t_select_file(uint16_t file_id);
@@ -124,12 +122,10 @@
**
*******************************************************************************/
static bool rw_t4t_send_to_lower(NFC_HDR* p_c_apdu) {
-#if (BT_TRACE_PROTOCOL == TRUE)
DispRWT4Tags(p_c_apdu, false);
-#endif
if (NFC_SendData(NFC_RF_CONN_ID, p_c_apdu) != NFC_STATUS_OK) {
- RW_TRACE_ERROR0("rw_t4t_send_to_lower (): NFC_SendData () failed");
+ LOG(ERROR) << StringPrintf("failed");
return false;
}
@@ -155,7 +151,7 @@
p_c_apdu = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_c_apdu) {
- RW_TRACE_ERROR0("rw_t4t_get_hw_version (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return false;
}
@@ -192,7 +188,7 @@
p_c_apdu = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_c_apdu) {
- RW_TRACE_ERROR0("rw_t4t_get_sw_version (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return false;
}
@@ -272,7 +268,7 @@
p_c_apdu = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_c_apdu) {
- RW_TRACE_ERROR0("rw_t4t_get_uid_details (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return false;
}
@@ -311,7 +307,7 @@
p_c_apdu = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_c_apdu) {
- RW_TRACE_ERROR0("rw_t4t_create_app (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return false;
}
@@ -361,7 +357,7 @@
p_c_apdu = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_c_apdu) {
- RW_TRACE_ERROR0("rw_t4t_select_app (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return false;
}
@@ -406,7 +402,7 @@
p_c_apdu = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_c_apdu) {
- RW_TRACE_ERROR0("rw_t4t_create_ccfile (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return false;
}
@@ -456,7 +452,7 @@
p_c_apdu = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_c_apdu) {
- RW_TRACE_ERROR0("rw_t4t_create_ndef (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return false;
}
@@ -509,7 +505,7 @@
p_c_apdu = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_c_apdu) {
- RW_TRACE_ERROR0("rw_t4t_write_cc (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return false;
}
@@ -560,7 +556,7 @@
p_c_apdu = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_c_apdu) {
- RW_TRACE_ERROR0("rw_t4t_write_ndef (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return false;
}
@@ -604,12 +600,12 @@
NFC_HDR* p_c_apdu;
uint8_t* p;
- RW_TRACE_DEBUG1("rw_t4t_select_file (): File ID:0x%04X", file_id);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("File ID:0x%04X", file_id);
p_c_apdu = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_c_apdu) {
- RW_TRACE_ERROR0("rw_t4t_select_file (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return false;
}
@@ -655,13 +651,13 @@
NFC_HDR* p_c_apdu;
uint8_t* p;
- RW_TRACE_DEBUG3("rw_t4t_read_file () offset:%d, length:%d, is_continue:%d, ",
- offset, length, is_continue);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "offset:%d, length:%d, is_continue:%d, ", offset, length, is_continue);
p_c_apdu = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_c_apdu) {
- RW_TRACE_ERROR0("rw_t4t_read_file (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return false;
}
@@ -709,12 +705,12 @@
NFC_HDR* p_c_apdu;
uint8_t* p;
- RW_TRACE_DEBUG1("rw_t4t_update_nlen () NLEN:%d", ndef_len);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("NLEN:%d", ndef_len);
p_c_apdu = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_c_apdu) {
- RW_TRACE_ERROR0("rw_t4t_update_nlen (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return false;
}
@@ -751,13 +747,13 @@
uint8_t* p;
uint16_t length;
- RW_TRACE_DEBUG2("rw_t4t_update_file () rw_offset:%d, rw_length:%d",
- p_t4t->rw_offset, p_t4t->rw_length);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "rw_offset:%d, rw_length:%d", p_t4t->rw_offset, p_t4t->rw_length);
p_c_apdu = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_c_apdu) {
- RW_TRACE_ERROR0("rw_t4t_write_file (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return false;
}
@@ -807,13 +803,13 @@
NFC_HDR* p_c_apdu;
uint8_t* p;
- RW_TRACE_DEBUG0(
- "rw_t4t_update_cc_to_readonly (): Remove Write access from CC");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Remove Write access from CC");
p_c_apdu = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_c_apdu) {
- RW_TRACE_ERROR0("rw_t4t_update_cc_to_readonly (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return false;
}
@@ -861,12 +857,12 @@
NFC_HDR* p_c_apdu;
uint8_t* p;
- RW_TRACE_DEBUG1("rw_t4t_select_application () version:0x%X", version);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("version:0x%X", version);
p_c_apdu = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (!p_c_apdu) {
- RW_TRACE_ERROR0("rw_t4t_select_application (): Cannot allocate buffer");
+ LOG(ERROR) << StringPrintf("Cannot allocate buffer");
return false;
}
@@ -918,32 +914,31 @@
static bool rw_t4t_validate_cc_file(void) {
tRW_T4T_CB* p_t4t = &rw_cb.tcb.t4t;
- RW_TRACE_DEBUG0("rw_t4t_validate_cc_file ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (p_t4t->cc_file.cclen < T4T_CC_FILE_MIN_LEN) {
- RW_TRACE_ERROR1("rw_t4t_validate_cc_file (): CCLEN (%d) is too short",
- p_t4t->cc_file.cclen);
+ LOG(ERROR) << StringPrintf("CCLEN (%d) is too short", p_t4t->cc_file.cclen);
return false;
}
if (T4T_GET_MAJOR_VERSION(p_t4t->cc_file.version) !=
T4T_GET_MAJOR_VERSION(p_t4t->version)) {
- RW_TRACE_ERROR2(
- "rw_t4t_validate_cc_file (): Peer version (0x%02X) is matched to ours "
+ LOG(ERROR) << StringPrintf(
+ "Peer version (0x%02X) is matched to ours "
"(0x%02X)",
p_t4t->cc_file.version, p_t4t->version);
return false;
}
if (p_t4t->cc_file.max_le < 0x000F) {
- RW_TRACE_ERROR1("rw_t4t_validate_cc_file (): MaxLe (%d) is too small",
- p_t4t->cc_file.max_le);
+ LOG(ERROR) << StringPrintf("MaxLe (%d) is too small",
+ p_t4t->cc_file.max_le);
return false;
}
if (p_t4t->cc_file.max_lc < 0x0001) {
- RW_TRACE_ERROR1("rw_t4t_validate_cc_file (): MaxLc (%d) is too small",
- p_t4t->cc_file.max_lc);
+ LOG(ERROR) << StringPrintf("MaxLc (%d) is too small",
+ p_t4t->cc_file.max_lc);
return false;
}
@@ -955,31 +950,28 @@
(p_t4t->cc_file.ndef_fc.file_id == 0x3F00) ||
(p_t4t->cc_file.ndef_fc.file_id == 0x3FFF) ||
(p_t4t->cc_file.ndef_fc.file_id == 0xFFFF)) {
- RW_TRACE_ERROR1("rw_t4t_validate_cc_file (): File ID (0x%04X) is invalid",
- p_t4t->cc_file.ndef_fc.file_id);
+ LOG(ERROR) << StringPrintf("File ID (0x%04X) is invalid",
+ p_t4t->cc_file.ndef_fc.file_id);
return false;
}
if ((p_t4t->cc_file.ndef_fc.max_file_size < 0x0005) ||
(p_t4t->cc_file.ndef_fc.max_file_size == 0xFFFF)) {
- RW_TRACE_ERROR1(
- "rw_t4t_validate_cc_file (): max_file_size (%d) is reserved",
- p_t4t->cc_file.ndef_fc.max_file_size);
+ LOG(ERROR) << StringPrintf("max_file_size (%d) is reserved",
+ p_t4t->cc_file.ndef_fc.max_file_size);
return false;
}
if (p_t4t->cc_file.ndef_fc.read_access != T4T_FC_READ_ACCESS) {
- RW_TRACE_ERROR1(
- "rw_t4t_validate_cc_file (): Read Access (0x%02X) is invalid",
- p_t4t->cc_file.ndef_fc.read_access);
+ LOG(ERROR) << StringPrintf("Read Access (0x%02X) is invalid",
+ p_t4t->cc_file.ndef_fc.read_access);
return false;
}
if ((p_t4t->cc_file.ndef_fc.write_access != T4T_FC_WRITE_ACCESS) &&
(p_t4t->cc_file.ndef_fc.write_access < T4T_FC_WRITE_ACCESS_PROP_START)) {
- RW_TRACE_ERROR1(
- "rw_t4t_validate_cc_file (): Write Access (0x%02X) is invalid",
- p_t4t->cc_file.ndef_fc.write_access);
+ LOG(ERROR) << StringPrintf("Write Access (0x%02X) is invalid",
+ p_t4t->cc_file.ndef_fc.write_access);
return false;
}
@@ -1000,8 +992,8 @@
tRW_DATA rw_data;
tRW_EVENT event;
- RW_TRACE_DEBUG4(
- "rw_t4t_handle_error (): status:0x%02X, sw1:0x%02X, sw2:0x%02X, "
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "status:0x%02X, sw1:0x%02X, sw2:0x%02X, "
"state:0x%X",
status, sw1, sw2, p_t4t->state);
@@ -1071,13 +1063,9 @@
uint16_t status_words, nlen;
tRW_DATA rw_data;
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_DEBUG2("rw_t4t_sm_ndef_format (): sub_state:%s (%d)",
- rw_t4t_get_sub_state_name(p_t4t->sub_state).c_str(),
- p_t4t->sub_state);
-#else
- RW_TRACE_DEBUG1("rw_t4t_sm_ndef_format (): sub_state=%d", p_t4t->sub_state);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "sub_state:%s (%d)", rw_t4t_get_sub_state_name(p_t4t->sub_state).c_str(),
+ p_t4t->sub_state);
/* get status words */
p = (uint8_t*)(p_r_apdu + 1) + p_r_apdu->offset;
@@ -1227,15 +1215,14 @@
(*(rw_cb.p_cback))(RW_T4T_NDEF_FORMAT_CPLT_EVT, &rw_data);
- RW_TRACE_DEBUG0(
- "rw_t4t_ndef_format (): Sent RW_T4T_NDEF_FORMAT_CPLT_EVT");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Sent RW_T4T_NDEF_FORMAT_CPLT_EVT");
}
}
break;
default:
- RW_TRACE_ERROR1("rw_t4t_sm_ndef_format (): unknown sub_state=%d",
- p_t4t->sub_state);
+ LOG(ERROR) << StringPrintf("unknown sub_state=%d", p_t4t->sub_state);
rw_t4t_handle_error(NFC_STATUS_FAILED, 0, 0);
break;
}
@@ -1256,13 +1243,9 @@
uint16_t status_words, nlen;
tRW_DATA rw_data;
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_DEBUG2("rw_t4t_sm_detect_ndef (): sub_state:%s (%d)",
- rw_t4t_get_sub_state_name(p_t4t->sub_state).c_str(),
- p_t4t->sub_state);
-#else
- RW_TRACE_DEBUG1("rw_t4t_sm_detect_ndef (): sub_state=%d", p_t4t->sub_state);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "sub_state:%s (%d)", rw_t4t_get_sub_state_name(p_t4t->sub_state).c_str(),
+ p_t4t->sub_state);
/* get status words */
p = (uint8_t*)(p_r_apdu + 1) + p_r_apdu->offset;
@@ -1275,8 +1258,8 @@
(p_t4t->version == T4T_VERSION_2_0)) {
p_t4t->version = T4T_VERSION_1_0;
- RW_TRACE_DEBUG1("rw_t4t_sm_detect_ndef (): retry with version=0x%02X",
- p_t4t->version);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("retry with version=0x%02X", p_t4t->version);
if (!rw_t4t_select_application(T4T_VERSION_1_0)) {
rw_t4t_handle_error(NFC_STATUS_FAILED, 0, 0);
@@ -1331,22 +1314,26 @@
BE_STREAM_TO_UINT8(p_t4t->cc_file.ndef_fc.read_access, p);
BE_STREAM_TO_UINT8(p_t4t->cc_file.ndef_fc.write_access, p);
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_DEBUG0("Capability Container (CC) file");
- RW_TRACE_DEBUG1(" CCLEN: 0x%04X", p_t4t->cc_file.cclen);
- RW_TRACE_DEBUG1(" Version:0x%02X", p_t4t->cc_file.version);
- RW_TRACE_DEBUG1(" MaxLe: 0x%04X", p_t4t->cc_file.max_le);
- RW_TRACE_DEBUG1(" MaxLc: 0x%04X", p_t4t->cc_file.max_lc);
- RW_TRACE_DEBUG0(" NDEF File Control TLV");
- RW_TRACE_DEBUG1(" FileID: 0x%04X",
- p_t4t->cc_file.ndef_fc.file_id);
- RW_TRACE_DEBUG1(" MaxFileSize: 0x%04X",
- p_t4t->cc_file.ndef_fc.max_file_size);
- RW_TRACE_DEBUG1(" ReadAccess: 0x%02X",
- p_t4t->cc_file.ndef_fc.read_access);
- RW_TRACE_DEBUG1(" WriteAccess: 0x%02X",
- p_t4t->cc_file.ndef_fc.write_access);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Capability Container (CC) file");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf(" CCLEN: 0x%04X", p_t4t->cc_file.cclen);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf(" Version:0x%02X", p_t4t->cc_file.version);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf(" MaxLe: 0x%04X", p_t4t->cc_file.max_le);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf(" MaxLc: 0x%04X", p_t4t->cc_file.max_lc);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf(" NDEF File Control TLV");
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ " FileID: 0x%04X", p_t4t->cc_file.ndef_fc.file_id);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ " MaxFileSize: 0x%04X", p_t4t->cc_file.ndef_fc.max_file_size);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ " ReadAccess: 0x%02X", p_t4t->cc_file.ndef_fc.read_access);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ " WriteAccess: 0x%02X", p_t4t->cc_file.ndef_fc.write_access);
if (rw_t4t_validate_cc_file()) {
if (!rw_t4t_select_file(p_t4t->cc_file.ndef_fc.file_id)) {
@@ -1431,13 +1418,13 @@
(*(rw_cb.p_cback))(RW_T4T_NDEF_DETECT_EVT, &rw_data);
- RW_TRACE_DEBUG0(
- "rw_t4t_sm_detect_ndef (): Sent RW_T4T_NDEF_DETECT_EVT");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Sent RW_T4T_NDEF_DETECT_EVT");
}
} else {
/* NLEN should be less than max file size */
- RW_TRACE_ERROR2(
- "rw_t4t_sm_detect_ndef (): NLEN (%d) + 2 must be <= max file "
+ LOG(ERROR) << StringPrintf(
+ "NLEN (%d) + 2 must be <= max file "
"size (%d)",
nlen, p_t4t->cc_file.ndef_fc.max_file_size);
@@ -1446,9 +1433,9 @@
}
} else {
/* response payload size should be T4T_FILE_LENGTH_SIZE */
- RW_TRACE_ERROR2(
- "rw_t4t_sm_detect_ndef (): Length (%d) of R-APDU must be %d",
- p_r_apdu->len, T4T_FILE_LENGTH_SIZE + T4T_RSP_STATUS_WORDS_SIZE);
+ LOG(ERROR) << StringPrintf(
+ "Length (%d) of R-APDU must be %d", p_r_apdu->len,
+ T4T_FILE_LENGTH_SIZE + T4T_RSP_STATUS_WORDS_SIZE);
p_t4t->ndef_status &= ~(RW_T4T_NDEF_STATUS_NDEF_DETECTED);
rw_t4t_handle_error(NFC_STATUS_BAD_RESP, 0, 0);
@@ -1456,8 +1443,7 @@
break;
default:
- RW_TRACE_ERROR1("rw_t4t_sm_detect_ndef (): unknown sub_state=%d",
- p_t4t->sub_state);
+ LOG(ERROR) << StringPrintf("unknown sub_state=%d", p_t4t->sub_state);
rw_t4t_handle_error(NFC_STATUS_FAILED, 0, 0);
break;
}
@@ -1478,13 +1464,9 @@
uint16_t status_words;
tRW_DATA rw_data;
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_DEBUG2("rw_t4t_sm_read_ndef (): sub_state:%s (%d)",
- rw_t4t_get_sub_state_name(p_t4t->sub_state).c_str(),
- p_t4t->sub_state);
-#else
- RW_TRACE_DEBUG1("rw_t4t_sm_read_ndef (): sub_state=%d", p_t4t->sub_state);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "sub_state:%s (%d)", rw_t4t_get_sub_state_name(p_t4t->sub_state).c_str(),
+ p_t4t->sub_state);
/* get status words */
p = (uint8_t*)(p_r_apdu + 1) + p_r_apdu->offset;
@@ -1523,8 +1505,8 @@
(*(rw_cb.p_cback))(RW_T4T_NDEF_READ_CPLT_EVT, &rw_data);
- RW_TRACE_DEBUG0(
- "rw_t4t_sm_read_ndef (): Sent RW_T4T_NDEF_READ_CPLT_EVT");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Sent RW_T4T_NDEF_READ_CPLT_EVT");
}
p_r_apdu = NULL;
@@ -1533,8 +1515,8 @@
p_t4t->state = RW_T4T_STATE_IDLE;
}
} else {
- RW_TRACE_ERROR2(
- "rw_t4t_sm_read_ndef (): invalid payload length (%d), rw_length "
+ LOG(ERROR) << StringPrintf(
+ "invalid payload length (%d), rw_length "
"(%d)",
p_r_apdu->len, p_t4t->rw_length);
rw_t4t_handle_error(NFC_STATUS_BAD_RESP, 0, 0);
@@ -1542,8 +1524,7 @@
break;
default:
- RW_TRACE_ERROR1("rw_t4t_sm_read_ndef (): unknown sub_state = %d",
- p_t4t->sub_state);
+ LOG(ERROR) << StringPrintf("unknown sub_state = %d", p_t4t->sub_state);
rw_t4t_handle_error(NFC_STATUS_FAILED, 0, 0);
break;
}
@@ -1566,13 +1547,9 @@
uint16_t status_words;
tRW_DATA rw_data;
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_DEBUG2("rw_t4t_sm_update_ndef (): sub_state:%s (%d)",
- rw_t4t_get_sub_state_name(p_t4t->sub_state).c_str(),
- p_t4t->sub_state);
-#else
- RW_TRACE_DEBUG1("rw_t4t_sm_update_ndef (): sub_state=%d", p_t4t->sub_state);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "sub_state:%s (%d)", rw_t4t_get_sub_state_name(p_t4t->sub_state).c_str(),
+ p_t4t->sub_state);
/* Get status words */
p = (uint8_t*)(p_r_apdu + 1) + p_r_apdu->offset;
@@ -1604,8 +1581,8 @@
rw_data.status = NFC_STATUS_OK;
(*(rw_cb.p_cback))(RW_T4T_NDEF_UPDATE_CPLT_EVT, &rw_data);
- RW_TRACE_DEBUG0(
- "rw_t4t_sm_update_ndef (): Sent RW_T4T_NDEF_UPDATE_CPLT_EVT");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Sent RW_T4T_NDEF_UPDATE_CPLT_EVT");
}
}
break;
@@ -1631,8 +1608,7 @@
break;
default:
- RW_TRACE_ERROR1("rw_t4t_sm_update_ndef (): unknown sub_state = %d",
- p_t4t->sub_state);
+ LOG(ERROR) << StringPrintf("unknown sub_state = %d", p_t4t->sub_state);
rw_t4t_handle_error(NFC_STATUS_FAILED, 0, 0);
break;
}
@@ -1653,13 +1629,9 @@
uint16_t status_words;
tRW_DATA rw_data;
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_DEBUG2("rw_t4t_sm_set_readonly (): sub_state:%s (%d)",
- rw_t4t_get_sub_state_name(p_t4t->sub_state).c_str(),
- p_t4t->sub_state);
-#else
- RW_TRACE_DEBUG1("rw_t4t_sm_set_readonly (): sub_state=%d", p_t4t->sub_state);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "sub_state:%s (%d)", rw_t4t_get_sub_state_name(p_t4t->sub_state).c_str(),
+ p_t4t->sub_state);
/* Get status words */
p = (uint8_t*)(p_r_apdu + 1) + p_r_apdu->offset;
@@ -1702,14 +1674,14 @@
if (rw_cb.p_cback) {
rw_data.status = NFC_STATUS_OK;
- RW_TRACE_DEBUG0("rw_t4t_sm_set_readonly (): Sent RW_T4T_SET_TO_RO_EVT");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("Sent RW_T4T_SET_TO_RO_EVT");
(*(rw_cb.p_cback))(RW_T4T_SET_TO_RO_EVT, &rw_data);
}
break;
default:
- RW_TRACE_ERROR1("rw_t4t_sm_set_readonly (): unknown sub_state = %d",
- p_t4t->sub_state);
+ LOG(ERROR) << StringPrintf("unknown sub_state = %d", p_t4t->sub_state);
rw_t4t_handle_error(NFC_STATUS_FAILED, 0, 0);
break;
}
@@ -1725,12 +1697,12 @@
**
*******************************************************************************/
void rw_t4t_process_timeout(TIMER_LIST_ENT* p_tle) {
- RW_TRACE_DEBUG1("rw_t4t_process_timeout () event=%d", p_tle->event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("event=%d", p_tle->event);
if (p_tle->event == NFC_TTYPE_RW_T4T_RESPONSE) {
rw_t4t_handle_error(NFC_STATUS_TIMEOUT, 0, 0);
} else {
- RW_TRACE_ERROR1("rw_t4t_process_timeout () unknown event=%d", p_tle->event);
+ LOG(ERROR) << StringPrintf("unknown event=%d", p_tle->event);
}
}
@@ -1746,7 +1718,8 @@
void rw_t4t_handle_isodep_nak_rsp(uint8_t status, bool is_ntf) {
tRW_DATA rw_data;
tRW_T4T_CB* p_t4t = &rw_cb.tcb.t4t;
- RW_TRACE_DEBUG1("rw_t4t_handle_isodep_nak_rsp %d", status);
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("rw_t4t_handle_isodep_nak_rsp %d", status);
if (is_ntf || (status != NFC_STATUS_OK)) {
rw_data.status = status;
nfc_stop_quick_timer(&p_t4t->timer);
@@ -1770,11 +1743,9 @@
NFC_HDR* p_r_apdu;
tRW_DATA rw_data;
-#if (BT_TRACE_VERBOSE == TRUE)
uint8_t begin_state = p_t4t->state;
-#endif
- RW_TRACE_DEBUG1("rw_t4t_data_cback () event = 0x%X", event);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("event = 0x%X", event);
nfc_stop_quick_timer(&p_t4t->timer);
switch (event) {
@@ -1810,34 +1781,24 @@
return;
}
-#if (BT_TRACE_PROTOCOL == TRUE)
if (p_t4t->state != RW_T4T_STATE_IDLE) DispRWT4Tags(p_r_apdu, true);
-#endif
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_DEBUG2("RW T4T state: <%s (%d)>",
- rw_t4t_get_state_name(p_t4t->state).c_str(), p_t4t->state);
-#else
- RW_TRACE_DEBUG1("RW T4T state: %d", p_t4t->state);
-#endif
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "RW T4T state: <%s (%d)>", rw_t4t_get_state_name(p_t4t->state).c_str(),
+ p_t4t->state);
switch (p_t4t->state) {
case RW_T4T_STATE_IDLE:
/* Unexpected R-APDU, it should be raw frame response */
/* forward to upper layer without parsing */
-#if (BT_TRACE_VERBOSE == TRUE)
- RW_TRACE_DEBUG2("RW T4T Raw Frame: Len [0x%X] Status [%s]",
- &p_r_apdu->len,
- NFC_GetStatusName(p_data->data.status).c_str());
-#else
- RW_TRACE_DEBUG2("RW T4T Raw Frame: Len [0x%X] Status [0x%X]",
- &p_r_apdu->len, p_data->data.status);
-#endif
- if (rw_cb.p_cback) {
- rw_data.raw_frame.status = p_data->data.status;
- rw_data.raw_frame.p_data = p_r_apdu;
- (*(rw_cb.p_cback))(RW_T4T_RAW_FRAME_EVT, &rw_data);
- p_r_apdu = NULL;
+DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("RW T4T Raw Frame: Len [0x%X] Status [%s]", p_r_apdu->len,
+ NFC_GetStatusName(p_data->data.status).c_str());
+if (rw_cb.p_cback) {
+ rw_data.raw_frame.status = p_data->data.status;
+ rw_data.raw_frame.p_data = p_r_apdu;
+ (*(rw_cb.p_cback))(RW_T4T_RAW_FRAME_EVT, &rw_data);
+ p_r_apdu = NULL;
} else {
GKI_freebuf(p_r_apdu);
}
@@ -1870,18 +1831,17 @@
GKI_freebuf(p_r_apdu);
break;
default:
- RW_TRACE_ERROR1("rw_t4t_data_cback (): invalid state=%d", p_t4t->state);
+ LOG(ERROR) << StringPrintf("invalid state=%d", p_t4t->state);
GKI_freebuf(p_r_apdu);
break;
}
-#if (BT_TRACE_VERBOSE == TRUE)
if (begin_state != p_t4t->state) {
- RW_TRACE_DEBUG2("RW T4T state changed:<%s> -> <%s>",
- rw_t4t_get_state_name(begin_state).c_str(),
- rw_t4t_get_state_name(p_t4t->state).c_str());
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("RW T4T state changed:<%s> -> <%s>",
+ rw_t4t_get_state_name(begin_state).c_str(),
+ rw_t4t_get_state_name(p_t4t->state).c_str());
}
-#endif
}
/*******************************************************************************
@@ -1894,12 +1854,11 @@
**
*******************************************************************************/
tNFC_STATUS RW_T4tFormatNDef(void) {
- RW_TRACE_API0("RW_T4tFormatNDef ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.t4t.state != RW_T4T_STATE_IDLE) {
- RW_TRACE_ERROR1(
- "RW_T4tFormatNDef ():Unable to start command at state (0x%X)",
- rw_cb.tcb.t4t.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.t4t.state);
return NFC_STATUS_FAILED;
}
@@ -1927,7 +1886,7 @@
tNFC_STATUS rw_t4t_select(void) {
tRW_T4T_CB* p_t4t = &rw_cb.tcb.t4t;
- RW_TRACE_DEBUG0("rw_t4t_select ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
NFC_SetStaticRfCback(rw_t4t_data_cback);
@@ -1957,12 +1916,11 @@
**
*******************************************************************************/
tNFC_STATUS RW_T4tDetectNDef(void) {
- RW_TRACE_API0("RW_T4tDetectNDef ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.t4t.state != RW_T4T_STATE_IDLE) {
- RW_TRACE_ERROR1(
- "RW_T4tDetectNDef ():Unable to start command at state (0x%X)",
- rw_cb.tcb.t4t.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.t4t.state);
return NFC_STATUS_FAILED;
}
@@ -2003,11 +1961,11 @@
**
*******************************************************************************/
tNFC_STATUS RW_T4tReadNDef(void) {
- RW_TRACE_API0("RW_T4tReadNDef ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.t4t.state != RW_T4T_STATE_IDLE) {
- RW_TRACE_ERROR1("RW_T4tReadNDef ():Unable to start command at state (0x%X)",
- rw_cb.tcb.t4t.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.t4t.state);
return NFC_STATUS_FAILED;
}
@@ -2024,7 +1982,7 @@
return NFC_STATUS_OK;
} else {
- RW_TRACE_ERROR0("RW_T4tReadNDef ():No NDEF detected");
+ LOG(ERROR) << StringPrintf("No NDEF detected");
return NFC_STATUS_FAILED;
}
}
@@ -2047,12 +2005,11 @@
**
*******************************************************************************/
tNFC_STATUS RW_T4tUpdateNDef(uint16_t length, uint8_t* p_data) {
- RW_TRACE_API1("RW_T4tUpdateNDef () length:%d", length);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("length:%d", length);
if (rw_cb.tcb.t4t.state != RW_T4T_STATE_IDLE) {
- RW_TRACE_ERROR1(
- "RW_T4tUpdateNDef ():Unable to start command at state (0x%X)",
- rw_cb.tcb.t4t.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.t4t.state);
return NFC_STATUS_FAILED;
}
@@ -2060,14 +2017,14 @@
if (rw_cb.tcb.t4t.ndef_status & RW_T4T_NDEF_STATUS_NDEF_DETECTED) {
/* if read-only */
if (rw_cb.tcb.t4t.ndef_status & RW_T4T_NDEF_STATUS_NDEF_READ_ONLY) {
- RW_TRACE_ERROR0("RW_T4tUpdateNDef ():NDEF is read-only");
+ LOG(ERROR) << StringPrintf("NDEF is read-only");
return NFC_STATUS_FAILED;
}
if (rw_cb.tcb.t4t.cc_file.ndef_fc.max_file_size <
length + T4T_FILE_LENGTH_SIZE) {
- RW_TRACE_ERROR2(
- "RW_T4tUpdateNDef ():data (%d bytes) plus NLEN is more than max file "
+ LOG(ERROR) << StringPrintf(
+ "data (%d bytes) plus NLEN is more than max file "
"size (%d)",
length, rw_cb.tcb.t4t.cc_file.ndef_fc.max_file_size);
return NFC_STATUS_FAILED;
@@ -2090,7 +2047,7 @@
return NFC_STATUS_OK;
} else {
- RW_TRACE_ERROR0("RW_T4tUpdateNDef ():No NDEF detected");
+ LOG(ERROR) << StringPrintf("No NDEF detected");
return NFC_STATUS_FAILED;
}
}
@@ -2119,7 +2076,7 @@
bool status;
NFC_HDR* p_data;
- RW_TRACE_API1("RW_T4tPresenceCheck () %d", option);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%d", option);
/* If RW_SelectTagType was not called (no conn_callback) return failure */
if (!rw_cb.p_cback) {
@@ -2183,12 +2140,11 @@
tNFC_STATUS retval = NFC_STATUS_OK;
tRW_DATA evt_data;
- RW_TRACE_API0("RW_T4tSetNDefReadOnly ()");
+ DLOG_IF(INFO, nfc_debug_enabled) << __func__;
if (rw_cb.tcb.t4t.state != RW_T4T_STATE_IDLE) {
- RW_TRACE_ERROR1(
- "RW_T4tSetNDefReadOnly ():Unable to start command at state (0x%X)",
- rw_cb.tcb.t4t.state);
+ LOG(ERROR) << StringPrintf("Unable to start command at state (0x%X)",
+ rw_cb.tcb.t4t.state);
return NFC_STATUS_FAILED;
}
@@ -2196,7 +2152,8 @@
if (rw_cb.tcb.t4t.ndef_status & RW_T4T_NDEF_STATUS_NDEF_DETECTED) {
/* if read-only */
if (rw_cb.tcb.t4t.ndef_status & RW_T4T_NDEF_STATUS_NDEF_READ_ONLY) {
- RW_TRACE_API0("RW_T4tSetNDefReadOnly (): NDEF is already read-only");
+ DLOG_IF(INFO, nfc_debug_enabled)
+ << StringPrintf("NDEF is already read-only");
evt_data.status = NFC_STATUS_OK;
(*rw_cb.p_cback)(RW_T4T_SET_TO_RO_EVT, &evt_data);
@@ -2213,13 +2170,12 @@
return NFC_STATUS_OK;
} else {
- RW_TRACE_ERROR0("RW_T4tSetNDefReadOnly ():No NDEF detected");
+ LOG(ERROR) << StringPrintf("No NDEF detected");
return NFC_STATUS_FAILED;
}
return (retval);
}
-#if (BT_TRACE_VERBOSE == TRUE)
/*******************************************************************************
**
** Function rw_t4t_get_state_name
@@ -2301,4 +2257,3 @@
return "???? UNKNOWN SUBSTATE";
}
}
-#endif
diff --git a/src/nfc/tags/tags_int.cc b/src/nfc/tags/tags_int.cc
index b99d63d..47c07c6 100644
--- a/src/nfc/tags/tags_int.cc
+++ b/src/nfc/tags/tags_int.cc
@@ -88,14 +88,12 @@
const uint8_t t4t_v20_ndef_tag_aid[T4T_V20_NDEF_TAG_AID_LEN] = {
0xD2, 0x76, 0x00, 0x00, 0x85, 0x01, 0x01};
-#if (BT_TRACE_PROTOCOL == TRUE)
const char* const t1t_cmd_str[] = {
"T1T_RID", "T1T_RALL", "T1T_READ", "T1T_WRITE_E", "T1T_WRITE_NE",
"T1T_RSEG", "T1T_READ8", "T1T_WRITE_E8", "T1T_WRITE_NE8"};
const char* const t2t_cmd_str[] = {"T2T_CMD_READ", "T2T_CMD_WRITE",
"T2T_CMD_SEC_SEL"};
-#endif
static unsigned int tags_ones32(register unsigned int x);
@@ -225,7 +223,6 @@
return ((uint8_t)(p_info - t2t_cmd_rsp_infos) + RW_T2T_FIRST_EVT);
}
-#if (BT_TRACE_PROTOCOL == TRUE)
/*******************************************************************************
**
** Function t1t_info_to_str
@@ -261,7 +258,6 @@
else
return "";
}
-#endif
/*******************************************************************************
**