nfc plugin emul Version up 61/83061/1 accepted/tizen/common/20160831.161636 accepted/tizen/mobile/20160831.050632 accepted/tizen/wearable/20160831.050704 submit/tizen/20160831.022125
authorJihoon Jung <jh8801.jung@samsung.com>
Tue, 9 Aug 2016 04:20:57 +0000 (13:20 +0900)
committerJihoon Jung <jh8801.jung@samsung.com>
Tue, 9 Aug 2016 04:32:28 +0000 (13:32 +0900)
- change log implementation
- change implentation about make ndef message

Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
Change-Id: I2775cd531555807e8bd0c285b150888238cbf597

packaging/nfc-plugin-emul.spec
src/nfc_debug_private.h
src/oem/oem_emul.c

index 10c49cb..9a11b55 100644 (file)
@@ -1,6 +1,6 @@
 Name:       nfc-plugin-emul
 Summary:    NFC emul plugin
-Version:    0.0.18
+Version:    0.0.19
 Release:    0
 Group:      TO_BE/FILLED_IN
 License:    Apache-2.0
index 6c3ff12..022504b 100755 (executable)
 #define DEBUG_MSG_PRINT_BUFFER(buffer,length) \
 do {\
        int i = 0;\
-       LOGD(LOG_COLOR_BLUE"BUFFER =>"LOG_COLOR_END);\
+       LOGE(LOG_COLOR_BLUE"BUFFER =>"LOG_COLOR_END);\
        for(; i < length; i++)\
        {\
-               LOGD(LOG_COLOR_BLUE" [0x%x] "LOG_COLOR_END,buffer[i]);\
+               LOGE(LOG_COLOR_BLUE" [0x%x] "LOG_COLOR_END,buffer[i]);\
        }\
-       LOGD(LOG_COLOR_BLUE""LOG_COLOR_END);\
+       LOGE(LOG_COLOR_BLUE""LOG_COLOR_END);\
 }while(0)
 
 #define DEBUG_MSG_PRINT_BUFFER_CHAR(buffer,length) \
 do {\
        int i = 0;\
-       LOGD(LOG_COLOR_BLUE"BUFFER =>"LOG_COLOR_END);\
+       LOGE(LOG_COLOR_BLUE"BUFFER =>"LOG_COLOR_END);\
        for(; i < length; i++)\
        {\
-               LOGD(LOG_COLOR_BLUE" [%c] "LOG_COLOR_END,buffer[i]);\
+               LOGE(LOG_COLOR_BLUE" [%c] "LOG_COLOR_END,buffer[i]);\
        }\
-       LOGD(LOG_COLOR_BLUE""LOG_COLOR_END);\
+       LOGE(LOG_COLOR_BLUE""LOG_COLOR_END);\
 }while(0)
 
 #define DEBUG_MSG(format,args...) \
 do {\
-       LOGD(LOG_COLOR_CYAN" "format""LOG_COLOR_END, ##args);\
+       LOGE(LOG_COLOR_CYAN" "format""LOG_COLOR_END, ##args);\
 }while(0)
 
 #define DEBUG_ERR_MSG(format,args...) \
 do {\
-       LOGD(LOG_COLOR_RED" "format""LOG_COLOR_END, ##args);\
+       LOGE(LOG_COLOR_RED" "format""LOG_COLOR_END, ##args);\
 }while(0)
 
 #define DEBUG_EMUL_BEGIN() \
        do\
     {\
-               LOGD(LOG_COLOR_CYAN" BEGIN >>>>"LOG_COLOR_END); \
+               LOGE(LOG_COLOR_CYAN" BEGIN >>>>"LOG_COLOR_END); \
     } while( 0 )
 
 #define DEBUG_EMUL_END() \
        do\
     {\
-               LOGD(LOG_COLOR_CYAN" END >>>>"LOG_COLOR_END); \
+               LOGE(LOG_COLOR_CYAN" END >>>>"LOG_COLOR_END); \
     } \
     while( 0 )
 
@@ -92,8 +92,8 @@ do{ \
        gettimeofday(&mytime, NULL);\
        char time_string[128] = {0,};\
        sprintf(time_string, "%d.%4d", mytime.tv_sec, mytime.tv_usec);\
-       LOGD(str); \
-       LOGD("\t time = [%s]", time_string);\
+       LOGE(str); \
+       LOGE("\t time = [%s]", time_string);\
 }while(0)
 
 #endif
index 63e277c..22612d0 100644 (file)
@@ -319,7 +319,7 @@ void __nfc_emul_util_free_mem (void** mem, char * filename, unsigned int line)
 {
        if (mem == NULL || *mem == NULL)
        {
-               SECURE_LOGD ("FILE: %s, LINE:%d, Invalid parameter in mem free util (pinter is NULL)", filename, line);
+               LOGE ("FILE: %s, LINE:%d, Invalid parameter in mem free util (pinter is NULL)", filename, line);
                return;
        }
        free(*mem);
@@ -330,7 +330,7 @@ void __nfc_emul_util_alloc_mem(void** mem, int size, char * filename, unsigned i
 {
        if (mem == NULL || size <= 0)
        {
-               SECURE_LOGD ("FILE: %s, LINE:%d, Invalid parameter in mem alloc util", filename, line);
+               LOGE ("FILE: %s, LINE:%d, Invalid parameter in mem alloc util", filename, line);
                return;
        }
 
@@ -338,7 +338,7 @@ void __nfc_emul_util_alloc_mem(void** mem, int size, char * filename, unsigned i
 
        if (*mem != NULL)
        {
-               SECURE_LOGD("FILE: %s, LINE:%d, WARNING: Pointer is already allocated or it was not initialized with NULL", filename, line);
+               LOGE("FILE: %s, LINE:%d, WARNING: Pointer is already allocated or it was not initialized with NULL", filename, line);
        }
 
        *mem = malloc (size);
@@ -349,7 +349,7 @@ void __nfc_emul_util_alloc_mem(void** mem, int size, char * filename, unsigned i
        }
        else
        {
-               SECURE_LOGD("FILE: %s, LINE:%d, Allocation is failed", filename, line);
+               LOGE("FILE: %s, LINE:%d, Allocation is failed", filename, line);
        }
 }
 
@@ -678,50 +678,44 @@ static int _net_nfc_create_records_from_emulMsg(emulMsg_s *emul_msg, ndef_messag
                /* assign data to record structure */
                record.tnf = _net_nfc_get_tnf_type(atoi(name_format));
 
-               if (strcmp(type_name, "Null")) {
-                       DEBUG_MSG("Data : type_name ");
+               DEBUG_MSG("Data : type_name ");
 
-                       record.typeName.length = strlen(type_name);
-                       _nfc_emul_util_alloc_mem(record.typeName.buffer, record.typeName.length);
+               record.typeName.length = strlen(type_name);
+               _nfc_emul_util_alloc_mem(record.typeName.buffer, record.typeName.length);
 
-                       if (record.typeName.buffer == NULL) {
-                               DEBUG_MSG("_nfc_emul_util_alloc_mem failed");
-                               goto ERROR;
-                       }
-                       memcpy(record.typeName.buffer, type_name, record.typeName.length);
+               if (record.typeName.buffer == NULL) {
+                       DEBUG_MSG("_nfc_emul_util_alloc_mem failed");
+                       goto ERROR;
                }
+               memcpy(record.typeName.buffer, type_name, record.typeName.length);
 
-               if (strcmp(record_id, "Null")) {
-                       DEBUG_MSG("Data : record_id ");
+               DEBUG_MSG("Data : record_id ");
 
-                       record.id.length = strlen(record_id);
-                       _nfc_emul_util_alloc_mem(record.id.buffer, record.id.length);
+               record.id.length = strlen(record_id);
+               _nfc_emul_util_alloc_mem(record.id.buffer, record.id.length);
 
-                       if (record.id.buffer == NULL) {
-                               DEBUG_MSG("_nfc_emul_util_alloc_mem failed");
-                               goto ERROR;
-                       }
-                       memcpy(record.id.buffer, record_id, record.id.length);
+               if (record.id.buffer == NULL) {
+                       DEBUG_MSG("_nfc_emul_util_alloc_mem failed");
+                       goto ERROR;
                }
+               memcpy(record.id.buffer, record_id, record.id.length);
 
-               if (strcmp(record_payload, "Null")) {
-                       DEBUG_MSG("Data : record_payload ");
+               DEBUG_MSG("Data : record_payload ");
 
-                       record.payload.length = strlen(record_payload);
-                       _nfc_emul_util_alloc_mem(record.payload.buffer, record.payload.length);
+               record.payload.length = strlen(record_payload);
+               _nfc_emul_util_alloc_mem(record.payload.buffer, record.payload.length);
 
-                       if (record.payload.buffer == NULL) {
-                               DEBUG_MSG("_nfc_emul_util_alloc_mem failed");
-                               goto ERROR;
-                       }
-                       memcpy(record.payload.buffer, record_payload, record.payload.length);
+               if (record.payload.buffer == NULL) {
+                       DEBUG_MSG("_nfc_emul_util_alloc_mem failed");
+                       goto ERROR;
                }
+               memcpy(record.payload.buffer, record_payload, record.payload.length);
 
 #ifndef __EMUL_DEBUG__
                DEBUG_ERR_MSG("RECORD DATA START >>>>>>>>>>>>>>>>>>>>>>>>");
                DEBUG_MSG("TNF >>>>[%d]", record.tnf);
-               SECURE_LOGD("type_name >>>>[%s]", type_name);
-               SECURE_LOGD("record_id >>>>[%s]", record_id);
+               LOGE("type_name >>>>[%s]", type_name);
+               LOGE("record_id >>>>[%s]", record_id);
                DEBUG_MSG("record_payload >>>>[%s]", record_payload);
                DEBUG_ERR_MSG("RECORD DATA END >>>>>>>>>>>>>>>>>>>>>>>>");
 #endif
@@ -1648,7 +1642,7 @@ static void emul_ReaderThread(void * pArg)
 
        /* make file name */
        snprintf(file_name, sizeof(file_name), "%s/%s", NET_NFC_EMUL_DATA_PATH, NET_NFC_EMUL_MESSAGE_FILE_NAME );
-       SECURE_LOGD("file path : %s", file_name);
+       LOGE("file path : %s", file_name);
 
        /* open file for poll */
        emulMsg_file_fd = open(file_name, O_RDONLY|O_NONBLOCK);
@@ -1777,7 +1771,7 @@ static void emul_ReaderThread(void * pArg)
 
        /* make file name */
        snprintf(file_name, sizeof(file_name), "%s/%s", NET_NFC_EMUL_DATA_PATH, NET_NFC_EMUL_MESSAGE_FILE_NAME );
-       SECURE_LOGD("file path : %s", file_name);
+       LOGE("file path : %s", file_name);
 
        time(&curTime);
        DEBUG_MSG("Start Current Time [%ld]", (unsigned long) curTime);