| | |
| | | const char *VIRTUAL_RTK_IP = "192.168.16.100"; |
| | | const int VIRTUAL_RTK_PORT = 9001; |
| | | |
| | | static pthread_mutex_t tts_mutex = PTHREAD_MUTEX_INITIALIZER; |
| | | |
| | | static int ttsSeq = 0; |
| | | |
| | | static void SendBootIndicate(union sigval sig); |
| | | |
| | | int DESEncrypt(const uint8_t *key, int key_length, |
| | |
| | | } |
| | | } |
| | | |
| | | void PlayTTS(const char *string, int id) |
| | | static int GetTtsSeq(void) |
| | | { |
| | | int seq = 0; |
| | | |
| | | pthread_mutex_lock(&tts_mutex); |
| | | seq = ttsSeq++; |
| | | pthread_mutex_unlock(&tts_mutex); |
| | | |
| | | return seq; |
| | | } |
| | | |
| | | int PlayTTS(const char *string) |
| | | { |
| | | DEBUG("PlayTTS: %s", string); |
| | | |
| | |
| | | // Attach主线程 |
| | | if (sg_jvm->AttachCurrentThread(&env, NULL) != JNI_OK) { |
| | | LOGE("%s: AttachCurrentThread() failed", __FUNCTION__); |
| | | return; |
| | | return -1; |
| | | } |
| | | } else { |
| | | ready_in_java_env = true; |
| | |
| | | |
| | | jclass cls = env->GetObjectClass(sg_obj); |
| | | jmethodID fun = env->GetMethodID(cls, "TextSpeak", "(Ljava/lang/String;I)V"); |
| | | |
| | | int id = GetTtsSeq(); |
| | | |
| | | env->CallVoidMethod(sg_obj, fun, env->NewStringUTF(string), id); |
| | | |
| | |
| | | LOGE("%s: DetachCurrentThread() failed", __FUNCTION__); |
| | | } |
| | | } |
| | | |
| | | return id; |
| | | } |
| | | |
| | | extern "C" |
| | |
| | | AppTimer_add(SendBootIndicate, 500); |
| | | |
| | | InitVirtualDevice(VIRTUAL_RTK_IP, VIRTUAL_RTK_PORT); |
| | | |
| | | pthread_mutex_init(&tts_mutex, NULL); |
| | | } |
| | | |
| | | static void SendBootIndicate(union sigval sig) { |