From 8ebe83a59e982317a746e8dd61d87c4a2359b40d Mon Sep 17 00:00:00 2001
From: yy1717 <fctom1215@outlook.com>
Date: 星期三, 08 一月 2020 14:42:36 +0800
Subject: [PATCH] 实现rtk平台基础配置

---
 lib/src/main/cpp/test_items/park_bottom.cpp             |    2 ++
 lib/src/main/cpp/test_items/turn_a90.cpp                |    2 ++
 lib/src/main/cpp/rtk_platform/parse_net.cpp             |    2 ++
 lib/src/main/cpp/driver_test.cpp                        |    2 ++
 lib/src/main/cpp/jni_log.h                              |    8 --------
 lib/src/main/cpp/native-lib.cpp                         |    2 ++
 lib/src/main/cpp/rtk_module/parse_gps.cpp               |    2 ++
 lib/src/main/cpp/rtk_module/rtk.cpp                     |    2 ++
 lib/src/main/cpp/mcu/mcu_if.cpp                         |    2 ++
 lib/src/main/cpp/rtk_platform/platform.cpp              |    9 ++++++---
 lib/src/main/java/com/anyun/exam/lib/RemoteService.java |    1 +
 11 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/lib/src/main/cpp/driver_test.cpp b/lib/src/main/cpp/driver_test.cpp
index a2259d3..2f3d191 100644
--- a/lib/src/main/cpp/driver_test.cpp
+++ b/lib/src/main/cpp/driver_test.cpp
@@ -25,6 +25,8 @@
 #include "test_items/driving_curve.h"
 #include "test_items/stop_and_start.h"
 
+#define DEBUG(fmt, args...)     LOGD("<driver_test> <%s>: " fmt, __func__, ##args)
+
 using namespace std;
 
 #define RTK_INVALID         0
diff --git a/lib/src/main/cpp/jni_log.h b/lib/src/main/cpp/jni_log.h
index 85b3dc2..bdd8a08 100644
--- a/lib/src/main/cpp/jni_log.h
+++ b/lib/src/main/cpp/jni_log.h
@@ -17,12 +17,4 @@
 
 #define LOGMCUD(...)  __android_log_print(ANDROID_LOG_DEBUG,"MCU_DEBUG",__VA_ARGS__) // 瀹氫箟LOGD绫诲瀷
 
-#define ENABLE_DEBUG_PROTOCOL
-
-#ifdef ENABLE_DEBUG_PROTOCOL
-#define DEBUG(...)                      LOGD(__VA_ARGS__)
-#else
-#define DEBUG(...)
-#endif
-
 #endif //JNI_LOG_H
diff --git a/lib/src/main/cpp/mcu/mcu_if.cpp b/lib/src/main/cpp/mcu/mcu_if.cpp
index 585503c..454eb73 100644
--- a/lib/src/main/cpp/mcu/mcu_if.cpp
+++ b/lib/src/main/cpp/mcu/mcu_if.cpp
@@ -11,6 +11,8 @@
 #include "../jni_log.h"
 #include "../common/serial_port.h"
 
+#define DEBUG(fmt, args...)     LOGD("<mcu_if> <%s>: " fmt, __func__, ##args)
+
 #define MCU_UART            UART_1
 
 enum parse_status_t {
diff --git a/lib/src/main/cpp/native-lib.cpp b/lib/src/main/cpp/native-lib.cpp
index fad1480..45a0531 100644
--- a/lib/src/main/cpp/native-lib.cpp
+++ b/lib/src/main/cpp/native-lib.cpp
@@ -15,6 +15,8 @@
 #include "driver_test.h"
 #include "master/comm_if.h"
 
+#define DEBUG(fmt, args...)     LOGD("<native-lib> <%s>: " fmt, __func__, ##args)
+
 static JavaVM *sg_jvm = NULL;
 static jobject sg_obj = NULL;
 
diff --git a/lib/src/main/cpp/rtk_module/parse_gps.cpp b/lib/src/main/cpp/rtk_module/parse_gps.cpp
index 43ec7ba..b81dab3 100644
--- a/lib/src/main/cpp/rtk_module/parse_gps.cpp
+++ b/lib/src/main/cpp/rtk_module/parse_gps.cpp
@@ -10,6 +10,8 @@
 #include <stdlib.h>
 #include <string.h>
 
+#define DEBUG(fmt, args...)     LOGD("<parse_gps> <%s>: " fmt, __func__, ##args)
+
 typedef const uint8_t *ptr;
 
 static ptr skip1(ptr s, ptr e)
diff --git a/lib/src/main/cpp/rtk_module/rtk.cpp b/lib/src/main/cpp/rtk_module/rtk.cpp
index dcf3cb0..6a2c6fe 100644
--- a/lib/src/main/cpp/rtk_module/rtk.cpp
+++ b/lib/src/main/cpp/rtk_module/rtk.cpp
@@ -19,6 +19,8 @@
 #include "../rtk_platform/platform.h"
 #include "../native-lib.h"
 
+#define DEBUG(fmt, args...)     LOGD("<rtk> <%s>: " fmt, __func__, ##args)
+
 #define RTK_MODULE_UART         UART_0
 
 #define PARSE_BUFF_SIZE         4096
diff --git a/lib/src/main/cpp/rtk_platform/parse_net.cpp b/lib/src/main/cpp/rtk_platform/parse_net.cpp
index c6ab56d..352886d 100644
--- a/lib/src/main/cpp/rtk_platform/parse_net.cpp
+++ b/lib/src/main/cpp/rtk_platform/parse_net.cpp
@@ -19,6 +19,8 @@
 #include "../mcu/mcu_if.h"
 #include "../utils/xconvert.h"
 
+#define DEBUG(fmt, args...)     LOGD("<parse_net> <%s>: " fmt, __func__, ##args)
+
 using namespace std;
 
 #define PKT_HEAD_CHAR           0x7E
diff --git a/lib/src/main/cpp/rtk_platform/platform.cpp b/lib/src/main/cpp/rtk_platform/platform.cpp
index e0072ab..5811569 100644
--- a/lib/src/main/cpp/rtk_platform/platform.cpp
+++ b/lib/src/main/cpp/rtk_platform/platform.cpp
@@ -22,7 +22,7 @@
 
 #define PARSE_BUFF_SIZE         4096
 
-const char *VK_REG = "platform_register";
+#define DEBUG(fmt, args...)     LOGD("<platform> <%s>: " fmt, __func__, ##args)
 
 struct platformSocket {
     char domain_name[32];
@@ -84,6 +84,8 @@
 
 void InitPlatform(const uint8_t *phone, const char *domain_name, int port)
 {
+    DEBUG("InitPlatform");
+
     pthread_mutex_init(&platform_tx_mutex, NULL);
     pthread_mutex_init(&events_mutex, NULL);
 
@@ -105,15 +107,16 @@
     pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);//detached
     pthread_create(&pid, &attr, StatusListenThread, NULL);
 
-    MA_ReqRtkPlatformConfig();
     AppTimer_add(ReqRtkPlatformConfigTimeout, D_SEC(2));
+    MA_ReqRtkPlatformConfig();
 }
 
 static void ReqRtkPlatformConfigTimeout(union sigval sig)
 {
     AppTimer_delete(ReqRtkPlatformConfigTimeout);
-    MA_ReqRtkPlatformConfig();
+
     AppTimer_add(ReqRtkPlatformConfigTimeout, D_SEC(2));
+    MA_ReqRtkPlatformConfig();
 }
 
 void ConfigPlatform(const rtk_platform_cfg_t *p)
diff --git a/lib/src/main/cpp/test_items/park_bottom.cpp b/lib/src/main/cpp/test_items/park_bottom.cpp
index d7f1422..39d7111 100644
--- a/lib/src/main/cpp/test_items/park_bottom.cpp
+++ b/lib/src/main/cpp/test_items/park_bottom.cpp
@@ -10,6 +10,8 @@
 #include "../driver_test.h"
 #include <vector>
 
+#define DEBUG(fmt, args...)     LOGD("<park_bottom> <%s>: " fmt, __func__, ##args)
+
 using namespace std;
 
 enum {
diff --git a/lib/src/main/cpp/test_items/turn_a90.cpp b/lib/src/main/cpp/test_items/turn_a90.cpp
index 5c17947..9d031a6 100644
--- a/lib/src/main/cpp/test_items/turn_a90.cpp
+++ b/lib/src/main/cpp/test_items/turn_a90.cpp
@@ -10,6 +10,8 @@
 
 #include <vector>
 
+#define DEBUG(fmt, args...)     LOGD("<turn_a90> <%s>: " fmt, __func__, ##args)
+
 using namespace std;
 
 enum {
diff --git a/lib/src/main/java/com/anyun/exam/lib/RemoteService.java b/lib/src/main/java/com/anyun/exam/lib/RemoteService.java
index 2b2893e..8e5a18d 100644
--- a/lib/src/main/java/com/anyun/exam/lib/RemoteService.java
+++ b/lib/src/main/java/com/anyun/exam/lib/RemoteService.java
@@ -51,6 +51,7 @@
 
         @Override
         public void SendCmd(int cmd, String value) throws RemoteException {
+            Log.d(TAG, "RecvMsgFromMainProc cmd = " + String.format(" %04X ", cmd) + " value " + value);
             MainProcMsgEntry(cmd, value);
         }
     };

--
Gitblit v1.8.0