yy1717
2020-09-18 03a05501800d2c02bca1c05ca6f7080d715aba23
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));
    }
}