yy1717
2020-03-09 bab1e388712597cfd16e9b47c5dc8d9840ea91e8
更新地图
4个文件已修改
44 ■■■■■ 已修改文件
lib/src/main/cpp/native-lib.cpp 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/src/main/cpp/native-lib.h 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/src/main/cpp/rtk_module/rtk.cpp 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/src/main/cpp/rtk_platform/platform.cpp 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/src/main/cpp/native-lib.cpp
@@ -225,9 +225,36 @@
    }
}
void DisplayText(const char *string)
void PlayTTS(const char *string)
{
    DEBUG("DisplayText: %s", string);
    DEBUG("PlayTTS: %s", string);
    JNIEnv *env;
    bool ready_in_java_env = false;
    if (sg_jvm->GetEnv((void **)&env, JNI_VERSION_1_6) != JNI_OK) {
        // Attach主线程
        if (sg_jvm->AttachCurrentThread(&env, NULL) != JNI_OK) {
            LOGE("%s: AttachCurrentThread() failed", __FUNCTION__);
            return;
        }
    } else {
        ready_in_java_env = true;
    }
    jclass cls = env->GetObjectClass(sg_obj);
    jmethodID fun = env->GetMethodID(cls, "TextSpeak", "(Ljava/lang/String;)V");
    env->CallVoidMethod(sg_obj, fun, env->NewStringUTF(string));
    env->DeleteLocalRef(cls);
    if (!ready_in_java_env) {
        //Detach主线程
        if (sg_jvm->DetachCurrentThread() != JNI_OK) {
            LOGE("%s: DetachCurrentThread() failed", __FUNCTION__);
        }
    }
}
extern "C"
lib/src/main/cpp/native-lib.h
@@ -14,15 +14,10 @@
               const uint8_t *plaintext, int plaintext_length,
               uint8_t **ciphertext);
void SetPlatformKey(const uint8_t *key, int length);
void DelPlatformKey(void);
int GetPlatformKey(uint8_t *pkey);
void SetSharedValue(const char *key, int value);
int GetSharedValue(const char *key);
void TextSpeak(const char *text);
void TextOsd(int type, const char *text);
void DrawScreen(const Polygon *map, const Polygon *car);
void SendMsgToMainProc(int cmd, const char *value);
void DisplayText(const char *string);
void PlayTTS(const char *string);
#endif //RTKBASESTATION_NATIVE_LIB_H
lib/src/main/cpp/rtk_module/rtk.cpp
@@ -137,8 +137,6 @@
void SetAYFactoryParam(int freq)
{
    DisplayText("配置RTK模块");
    WriteSerialPort(RTK_MODULE_UART, UNLOGALL, strlen(UNLOGALL));
    WriteSerialPort(RTK_MODULE_UART, IFCOM2, strlen(IFCOM2));
lib/src/main/cpp/rtk_platform/platform.cpp
@@ -259,10 +259,6 @@
    pthread_attr_init(&attr);
    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);//detached
    pthread_create(&platform_pid, &attr, PlatformDataListenThread, ptr);
    char out[64];
    sprintf(out, "连接平台 %s:%d...", domain_name, port);
    DisplayText(out);
}
static void ConnectPlatformLater(union sigval sig) {