Initial refactoring merge
[platform/core/telephony/tel-plugin-vmodem.git] / src / vdpram_dump.c
index 7befabd..d44836e 100644 (file)
@@ -1,9 +1,7 @@
 /*\r
  * tel-plugin-vmodem\r
  *\r
- * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Contact: Junhwan An <jh48.an@samsung.com>\r
+ * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.\r
  *\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
 #include <string.h>\r
 #include <stdlib.h>\r
 #include <stdio.h>\r
-#include <log.h>\r
-\r
-#include "vdpram_dump.h"\r
-\r
-static void hex_dump(char *pad, int size, const void *data)\r
-{\r
-       char buf[255] = {0, };\r
-       char hex[4] = {0, };\r
-       int i;\r
-       unsigned char *p;\r
-\r
-       if (size <= 0) {\r
-               msg("%sno data", pad);\r
-               return;\r
-       }\r
-\r
-       p = (unsigned char *)data;\r
 \r
-       snprintf(buf, 255, "%s%04X: ", pad, 0);\r
-       for (i = 0; i<size; i++) {\r
-               snprintf(hex, 4, "%02X ", p[i]);\r
-               strcat(buf, hex);\r
+#include <glib.h>\r
 \r
-               if ((i + 1) % 8 == 0) {\r
-                       if ((i + 1) % 16 == 0) {\r
-                               msg("%s", buf);\r
-                               memset(buf, 0, 255);\r
-                               snprintf(buf, 255, "%s%04X: ", pad, i + 1);\r
-                       }\r
-                       else {\r
-                               strcat(buf, "  ");\r
-                       }\r
-               }\r
-       }\r
+#include <tcore.h>\r
+#include <util.h>\r
+#include <log.h>\r
 \r
-       msg("%s", buf);\r
-}\r
+#include "vdpram_dump.h"\r
 \r
-void vdpram_hex_dump(int dir, unsigned short data_len, void *data)\r
+void vdpram_hex_dump(gboolean tx, gushort data_len, void *data)\r
 {\r
        char *d;\r
 \r
        if(!data)\r
                return;\r
 \r
-       if (dir == RX)
-               d = "[RX]";\r
-       else\r
+       if (tx == TRUE)
                d = "[TX]";\r
+       else\r
+               d = "[RX]";\r
 \r
-       msg("");\r
-       msg("  %s\tlen=%d\t%s", d, data_len, (char *)data);\r
-       hex_dump("        ", data_len, data);\r
+       msg("\n====== Data DUMP ======\n");\r
 \r
-       msg("");\r
-}\r
+       msg("  %s\tData length: [%d] -", d, data_len);\r
+       tcore_util_hex_dump("        ", (gint)data_len, data);\r
 \r
+       msg("\n====== Data DUMP ======\n");\r
+}\r