Make new function for tidl to match ttsd_ipc interface 24/264724/2
authorSuyeon Hwang <stom.hwang@samsung.com>
Wed, 29 Sep 2021 02:42:07 +0000 (11:42 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Wed, 29 Sep 2021 04:36:28 +0000 (13:36 +0900)
Change-Id: I2bc1ea73f5f3041cebe7c833a2ae38d4b8775eaf
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
client/tts_tidl.c
common/tts_defs.h
server/ttsd_ipc.c
server/ttsd_tidl.c
server/ttsd_tidl.h

index 122f2f2ca280eb85bdad629211c7f099a191f74e..1f47365c5136fbede00e6164ef2292fa5d15c8da 100644 (file)
@@ -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));
                }
index 828adb4e4ecfbca3cb43130140fee18cd81e5811..385bad84a1632c2727838e5643becbf4769d115b 100644 (file)
@@ -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"
index cf7741414c78c5de4017754905b850b6e27d1ed0..7fc877ad63cf5def05aadc5021997533bce83331 100644 (file)
@@ -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");
index a9e5109e0db391bbab744ffc2cab53175cf41059..9362074849778e62d94e142030795ebf39b7d204 100644 (file)
@@ -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");
index 152c2ab2fa9bc63b2dcfe1ee7e88c559a6c26a0f..abe58de2b0fa93892b0c9c85f79d56fca44eafb0 100644 (file)
@@ -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);