From bab1e388712597cfd16e9b47c5dc8d9840ea91e8 Mon Sep 17 00:00:00 2001
From: yy1717 <fctom1215@outlook.com>
Date: 星期一, 09 三月 2020 17:39:09 +0800
Subject: [PATCH] 更新地图
---
lib/src/main/cpp/native-lib.h | 7 +------
lib/src/main/cpp/native-lib.cpp | 31 +++++++++++++++++++++++++++++--
lib/src/main/cpp/rtk_module/rtk.cpp | 2 --
lib/src/main/cpp/rtk_platform/platform.cpp | 4 ----
4 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/lib/src/main/cpp/native-lib.cpp b/lib/src/main/cpp/native-lib.cpp
index 8f18adf..69ef30e 100644
--- a/lib/src/main/cpp/native-lib.cpp
+++ b/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"
diff --git a/lib/src/main/cpp/native-lib.h b/lib/src/main/cpp/native-lib.h
index 5dad97c..c5133de 100644
--- a/lib/src/main/cpp/native-lib.h
+++ b/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
diff --git a/lib/src/main/cpp/rtk_module/rtk.cpp b/lib/src/main/cpp/rtk_module/rtk.cpp
index cda71de..1a32349 100644
--- a/lib/src/main/cpp/rtk_module/rtk.cpp
+++ b/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));
diff --git a/lib/src/main/cpp/rtk_platform/platform.cpp b/lib/src/main/cpp/rtk_platform/platform.cpp
index 89a15cf..71b79ba 100644
--- a/lib/src/main/cpp/rtk_platform/platform.cpp
+++ b/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) {
--
Gitblit v1.8.0