From 03a05501800d2c02bca1c05ca6f7080d715aba23 Mon Sep 17 00:00:00 2001
From: yy1717 <fctom1215@outlook.com>
Date: 星期五, 18 九月 2020 15:41:50 +0800
Subject: [PATCH] 坐标

---
 lib/src/main/cpp/native-lib.cpp |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/lib/src/main/cpp/native-lib.cpp b/lib/src/main/cpp/native-lib.cpp
index b8e44e1..6eedb68 100644
--- a/lib/src/main/cpp/native-lib.cpp
+++ b/lib/src/main/cpp/native-lib.cpp
@@ -17,6 +17,7 @@
 #include "driver_test.h"
 #include "master/comm_if.h"
 #include "rtk_module/virtual_rtk.h"
+#include "defs.h"
 
 #define DEBUG(fmt, args...)     LOGD("<native-lib> <%s>: " fmt, __func__, ##args)
 
@@ -322,12 +323,32 @@
 Java_com_anyun_exam_lib_RemoteService_MainProcMsgEntry(JNIEnv *env, jobject thiz, jint cmd,
                                                        jstring value) {
     // TODO: implement MainProcMsgEntry()
+    union {
+        int a;
+        uint8_t b[sizeof(int)];
+    } c;
+
+    c.a = cmd;
+
     if (value != NULL) {
         const char *str = env->GetStringUTFChars(value, 0);
-        MA_MainProcMsgEntry(cmd, str);
+
+        uint8_t *data = new uint8_t[4 + strlen(str) + 1];
+
+        data[0] = c.b[0];
+        data[1] = c.b[1];
+        data[2] = c.b[2];
+        data[3] = c.b[3];
+
+        strcpy((char *)data + 4, str);
+//        MA_MainProcMsgEntry(cmd, str);
+        PlatformStatusChanged(MASTER_COMM_EVT, data, 4 + strlen(str) + 1);
         env->ReleaseStringUTFChars(value, str);
+
+        delete []data;
     } else {
-        MA_MainProcMsgEntry(cmd, NULL);
+        //MA_MainProcMsgEntry(cmd, NULL);
+        PlatformStatusChanged(MASTER_COMM_EVT, c.b, sizeof(int));
     }
 }
 

--
Gitblit v1.8.0