From: Suyeon Hwang Date: Wed, 29 Sep 2021 02:42:07 +0000 (+0900) Subject: Make new function for tidl to match ttsd_ipc interface X-Git-Tag: submit/tizen/20210929.093305~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=875db46de2121c2618d2c5ca43d8194d1212a900;p=platform%2Fcore%2Fuifw%2Ftts.git Make new function for tidl to match ttsd_ipc interface Change-Id: I2bc1ea73f5f3041cebe7c833a2ae38d4b8775eaf Signed-off-by: Suyeon Hwang --- diff --git a/client/tts_tidl.c b/client/tts_tidl.c index 122f2f2c..1f47365c 100644 --- a/client/tts_tidl.c +++ b/client/tts_tidl.c @@ -102,17 +102,17 @@ static void __notify_cb(void *user_data, int pid, int uid, bundle *msg) SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to get message(TTSD_METHOD_HELLO). pid(%d) uid(%d)", pid, uid); } } else if (0 == strncmp(TTSD_METHOD_UTTERANCE_STARTED, method, strlen(TTSD_METHOD_UTTERANCE_STARTED))) { - bundle_get_str(msg, TTS_BUNDLE_UTTID, &val); + bundle_get_str(msg, TTS_BUNDLE_MESSAGE, &val); if (val) { tts_core_notify_utt_started(client, atoi(val)); } } else if (0 == strncmp(TTSD_METHOD_UTTERANCE_COMPLETED, method, strlen(TTSD_METHOD_UTTERANCE_COMPLETED))) { - bundle_get_str(msg, TTS_BUNDLE_UTTID, &val); + bundle_get_str(msg, TTS_BUNDLE_MESSAGE, &val); if (val) { tts_core_notify_utt_completeted(client, atoi(val)); } } else if (0 == strncmp(TTSD_METHOD_SET_STATE, method, strlen(TTSD_METHOD_SET_STATE))) { - bundle_get_str(msg, TTS_BUNDLE_STATE, &val); + bundle_get_str(msg, TTS_BUNDLE_MESSAGE, &val); if (val) { tts_core_notify_state_changed_async(client, (tts_state_e)atoi(val)); } diff --git a/common/tts_defs.h b/common/tts_defs.h index 828adb4e..385bad84 100644 --- a/common/tts_defs.h +++ b/common/tts_defs.h @@ -55,7 +55,7 @@ extern "C" { * Message Definition for APIs *******************************************************************************************/ #define TTS_BUNDLE_METHOD "method" -#define TTS_BUNDLE_STATE "state" +#define TTS_BUNDLE_MESSAGE "message" #define TTS_BUNDLE_UTTID "uttid" #define TTS_BUNDLE_REASON "reason" #define TTS_BUNDLE_ERR_MSG "err_msg" diff --git a/server/ttsd_ipc.c b/server/ttsd_ipc.c index cf774141..7fc877ad 100644 --- a/server/ttsd_ipc.c +++ b/server/ttsd_ipc.c @@ -19,8 +19,8 @@ int(*ttsd_dbus_vtable[])() = {&ttsd_dbus_open_connection, &ttsd_dbus_close_connection, &ttsdc_dbus_send_utt_start_message, &ttsdc_dbus_send_utt_finish_message, &ttsdc_dbus_send_set_state_message, &ttsdc_dbus_send_error_message}; -int(*ttsd_tidl_vtable[])() = {&ttsd_tidl_open_connection, &ttsd_tidl_close_connection, &ttsdc_tidl_send_message, - &ttsdc_tidl_send_message, &ttsdc_tidl_send_message, &ttsdc_tidl_send_error_message}; +int(*ttsd_tidl_vtable[])() = {&ttsd_tidl_open_connection, &ttsd_tidl_close_connection, &ttsdc_tidl_send_utt_start_message, + &ttsdc_tidl_send_utt_finish_message, &ttsdc_tidl_send_set_state_message, &ttsdc_tidl_send_error_message}; int ttsd_ipc_open_connection() { @@ -73,7 +73,7 @@ int ttsdc_ipc_send_utt_start_message(int pid, int uid, int uttid) case TTS_IPC_METHOD_TIDL: SLOG(LOG_DEBUG, tts_tag(), "[IPC] ipc method : tidl"); - return ttsd_tidl_vtable[SEND_UTTERANCE_START](pid, uid, uttid, TTSD_METHOD_UTTERANCE_STARTED); + return ttsd_tidl_vtable[SEND_UTTERANCE_START](pid, uid, uttid); default: SLOG(LOG_ERROR, tts_tag(), "[ERROR] method is not valid"); @@ -99,7 +99,7 @@ int ttsdc_ipc_send_utt_finish_message(int pid, int uid, int uttid) case TTS_IPC_METHOD_TIDL: SLOG(LOG_DEBUG, tts_tag(), "[IPC] ipc method : tidl"); - return ttsd_tidl_vtable[SEND_UTTERANCE_FINISH](pid, uid, uttid, TTSD_METHOD_UTTERANCE_COMPLETED); + return ttsd_tidl_vtable[SEND_UTTERANCE_FINISH](pid, uid, uttid); default: SLOG(LOG_ERROR, tts_tag(), "[ERROR] method is not valid"); @@ -125,7 +125,7 @@ int ttsdc_ipc_send_set_state_message(int pid, int uid, int state) case TTS_IPC_METHOD_TIDL: SLOG(LOG_DEBUG, tts_tag(), "[IPC] ipc method : tidl"); - return ttsd_tidl_vtable[SEND_SET_STATE] (pid, uid, state, TTSD_METHOD_SET_STATE); + return ttsd_tidl_vtable[SEND_SET_STATE] (pid, uid, state); default: SLOG(LOG_ERROR, tts_tag(), "[ERROR] method is not valid"); diff --git a/server/ttsd_tidl.c b/server/ttsd_tidl.c index a9e5109e..93620748 100644 --- a/server/ttsd_tidl.c +++ b/server/ttsd_tidl.c @@ -469,16 +469,16 @@ int ttsd_tidl_close_connection() return TTSE_ERROR_NONE; } -int ttsdc_tidl_send_message(int pid, int uid, int uttid, const char *method) +static int __send_message(int pid, int uid, int data, const char *method) { SLOG(LOG_DEBUG, tts_tag(), "[TIDL] ttsdc_tidl_send_message"); - char tmp_uttid[10] = {0, }; + char tmp_msg[10] = {0, }; bundle* msg = bundle_create(); - snprintf(tmp_uttid, 10, "%d", uttid); + snprintf(tmp_msg, 10, "%d", data); bundle_add_str(msg, TTS_BUNDLE_METHOD, method); - bundle_add_str(msg, TTS_BUNDLE_UTTID, tmp_uttid); + bundle_add_str(msg, TTS_BUNDLE_MESSAGE, tmp_msg); SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTSD SEND MSG"); __send_msg(pid, uid, msg); @@ -487,6 +487,21 @@ int ttsdc_tidl_send_message(int pid, int uid, int uttid, const char *method) return TTSE_ERROR_NONE; } +int ttsdc_tidl_send_utt_start_message(int pid, int uid, int uttid) +{ + return __send_message(pid, uid, uttid, TTSD_METHOD_UTTERANCE_STARTED); +} + +int ttsdc_tidl_send_utt_finish_message(int pid, int uid, int uttid) +{ + return __send_message(pid, uid, uttid, TTSD_METHOD_UTTERANCE_COMPLETED); +} + +int ttsdc_tidl_send_set_state_message(int pid, int uid, int state) +{ + return __send_message(pid, uid, state, TTSD_METHOD_SET_STATE); +} + int ttsdc_tidl_send_error_message(int pid, int uid, int uttid, int reason, char* err_msg) { SLOG(LOG_DEBUG, tts_tag(), "[TIDL] ttsdc_tidl_send_error_message"); diff --git a/server/ttsd_tidl.h b/server/ttsd_tidl.h index 152c2ab2..abe58de2 100644 --- a/server/ttsd_tidl.h +++ b/server/ttsd_tidl.h @@ -25,7 +25,11 @@ int ttsd_tidl_close_connection(); int ttsdc_tidl_send_hello(int pid, int uid, int ret, int credential_needed); -int ttsdc_tidl_send_message(int pid, int uid, int data, const char *method); +int ttsdc_tidl_send_utt_start_message(int pid, int uid, int uttid); + +int ttsdc_tidl_send_utt_finish_message(int pid, int uid, int uttid); + +int ttsdc_tidl_send_set_state_message(int pid, int uid, int state); int ttsdc_tidl_send_error_message(int pid, int uid, int uttid, int reason, char* err_msg);