| | |
| | | } |
| | | } |
| | | |
| | | 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" |
| | |
| | | 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 |
| | |
| | | |
| | | void SetAYFactoryParam(int freq) |
| | | { |
| | | DisplayText("配置RTK模块"); |
| | | |
| | | WriteSerialPort(RTK_MODULE_UART, UNLOGALL, strlen(UNLOGALL)); |
| | | WriteSerialPort(RTK_MODULE_UART, IFCOM2, strlen(IFCOM2)); |
| | | |
| | |
| | | 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) { |