Remove duplicated function 11/260511/1
authorSuyeon Hwang <stom.hwang@samsung.com>
Mon, 28 Jun 2021 05:08:25 +0000 (14:08 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Mon, 28 Jun 2021 05:08:25 +0000 (14:08 +0900)
Change-Id: I8f48778e4d67d8e4c2baae185dc06a6c786a24ee
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
client/tts.c
client/tts_core.c
client/tts_core.h
client/tts_dbus.c
client/tts_tidl.c

index b5521d62da521adb63aa3f434812295d417e373d..87bb1cbf78a7afaa59f35e707a4dd8be06f29104 100644 (file)
@@ -59,31 +59,6 @@ static int __tts_get_feature_enabled()
        return 0;
 }
 
-// TODO: move into tts_core to make common function
-static const char* __tts_get_error_code(tts_error_e err)
-{
-       switch (err) {
-       case TTS_ERROR_NONE:                    return "TTS_ERROR_NONE";
-       case TTS_ERROR_OUT_OF_MEMORY:           return "TTS_ERROR_OUT_OF_MEMORY";
-       case TTS_ERROR_IO_ERROR:                return "TTS_ERROR_IO_ERROR";
-       case TTS_ERROR_INVALID_PARAMETER:       return "TTS_ERROR_INVALID_PARAMETER";
-       case TTS_ERROR_OUT_OF_NETWORK:          return "TTS_ERROR_OUT_OF_NETWORK";
-       case TTS_ERROR_TIMED_OUT:               return "TTS_ERROR_TIMED_OUT";
-       case TTS_ERROR_PERMISSION_DENIED:       return "TTS_ERROR_PERMISSION_DENIED";
-       case TTS_ERROR_NOT_SUPPORTED:           return "TTS_ERROR_NOT_SUPPORTED";
-       case TTS_ERROR_INVALID_STATE:           return "TTS_ERROR_INVALID_STATE";
-       case TTS_ERROR_INVALID_VOICE:           return "TTS_ERROR_INVALID_VOICE";
-       case TTS_ERROR_ENGINE_NOT_FOUND:        return "TTS_ERROR_ENGINE_NOT_FOUND";
-       case TTS_ERROR_OPERATION_FAILED:        return "TTS_ERROR_OPERATION_FAILED";
-       case TTS_ERROR_AUDIO_POLICY_BLOCKED:    return "TTS_ERROR_AUDIO_POLICY_BLOCKED";
-       case TTS_ERROR_NOT_SUPPORTED_FEATURE:   return "TTS_ERROR_NOT_SUPPORTED_FEATURE";
-       case TTS_ERROR_SERVICE_RESET:           return "TTS_ERROR_SERVICE_RESET";
-       default:
-               return "Invalid error code";
-       }
-       return NULL;
-}
-
 // TODO: move into tts_core to make common function
 static int __tts_convert_config_error_code(tts_config_error_e code)
 {
@@ -581,7 +556,7 @@ int tts_prepare(tts_h tts)
        SLOG(LOG_INFO, TAG_TTSC, "@@@ Prepare TTS");
        int ret = tts_core_prepare(client);
        if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] tts_core_prepare failed. (%s)", __tts_get_error_code(ret));
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] tts_core_prepare failed. (%s)", tts_core_covert_error_code(ret));
                return ret;
        }
 
@@ -611,7 +586,7 @@ int tts_prepare_sync(tts_h tts)
        SLOG(LOG_INFO, TAG_TTSC, "@@@ Prepare TTS synchronously");
        int ret = tts_core_prepare_sync(client);
        if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] tts_core_prepare_sync failed. (%s)", __tts_get_error_code(ret));
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] tts_core_prepare_sync failed. (%s)", tts_core_covert_error_code(ret));
                return ret;
        }
 
@@ -641,7 +616,7 @@ int tts_unprepare(tts_h tts)
        SLOG(LOG_INFO, TAG_TTSC, "@@@ Unprepare TTS");
        int ret = tts_core_unprepare(client);
        if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] tts_core_unprepare is failed(%s)", __tts_get_error_code(ret));
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] tts_core_unprepare is failed(%s)", tts_core_covert_error_code(ret));
                return ret;
        }
 
@@ -893,7 +868,7 @@ int tts_add_text(tts_h tts, const char* text, const char* language, int voice_ty
 
        int ret = tts_core_add_text(client, text, language, voice_type, speed, utt_id);
        if (TTS_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request add text. ret(%s)", __tts_get_error_code(ret));
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request add text. ret(%s)", tts_core_covert_error_code(ret));
                return ret;
        }
 
@@ -914,7 +889,7 @@ static void __tts_play_async(void *data)
 
        int ret = tts_core_play(client);
        if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to play tts : %s", __tts_get_error_code(ret));
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to play tts : %s", tts_core_covert_error_code(ret));
                tts_core_notify_error_async(client, ret, -1, NULL);
                return;
        }
@@ -993,7 +968,7 @@ int tts_play(tts_h tts)
 
        int ret = tts_core_play(client);
        if (TTS_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request play. ret(%s)", __tts_get_error_code(ret));
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request play. ret(%s)", tts_core_covert_error_code(ret));
                return ret;
        }
 
@@ -1014,7 +989,7 @@ static void __tts_stop_async(void *data)
 
        int ret = tts_core_stop(client);
        if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to stop tts : %s", __tts_get_error_code(ret));
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to stop tts : %s", tts_core_covert_error_code(ret));
                tts_core_notify_error_async(client, ret, -1, NULL);
                return;
        }
@@ -1082,7 +1057,7 @@ int tts_stop(tts_h tts)
 
        int ret = tts_core_stop(client);
        if (TTS_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request stop. ret(%s)", __tts_get_error_code(ret));
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request stop. ret(%s)", tts_core_covert_error_code(ret));
                return ret;
        }
 
@@ -1103,7 +1078,7 @@ static void __tts_pause_async(void *data)
 
        int ret = tts_core_pause(client);
        if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to pause tts : %s", __tts_get_error_code(ret));
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to pause tts : %s", tts_core_covert_error_code(ret));
                tts_core_notify_error_async(client, ret, -1, NULL);
                return;
        }
@@ -1170,7 +1145,7 @@ int tts_pause(tts_h tts)
 
        int ret = tts_core_pause(client);
        if (TTS_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request pause. ret(%s)", __tts_get_error_code(ret));
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request pause. ret(%s)", tts_core_covert_error_code(ret));
                return ret;
        }
 
@@ -1210,7 +1185,7 @@ int tts_set_private_data(tts_h tts, const char* key, const char* data)
 
        int ret = tts_core_set_private_data(client, key, data);
        if (TTS_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request set private data. ret(%s)", __tts_get_error_code(ret));
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request set private data. ret(%s)", tts_core_covert_error_code(ret));
                return ret;
        }
 
@@ -1245,7 +1220,7 @@ int tts_get_private_data(tts_h tts, const char* key, char** data)
 
        int ret = tts_core_get_private_data(client, key, data);
        if (TTS_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request get private data. ret(%s)", __tts_get_error_code(ret));
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request get private data. ret(%s)", tts_core_covert_error_code(ret));
                return ret;
        }
 
@@ -1608,7 +1583,7 @@ int tts_add_pcm(tts_h tts, int event, const void* data, unsigned int data_size,
 
        int ret = tts_core_add_pcm(client, event, data, data_size, audio_type, rate);
        if (TTS_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request add_pcm. ret(%s)", __tts_get_error_code(ret));
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request add_pcm. ret(%s)", tts_core_covert_error_code(ret));
                return ret;
        }
 
@@ -1643,7 +1618,7 @@ int tts_play_pcm(tts_h tts)
 
        int ret = tts_core_play_pcm(client);
        if (TTS_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request play_pcm. ret(%s)", __tts_get_error_code(ret));
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request play_pcm. ret(%s)", tts_core_covert_error_code(ret));
                return ret;
        }
 
@@ -1678,7 +1653,7 @@ int tts_stop_pcm(tts_h tts)
 
        int ret = tts_core_stop_pcm(client);
        if (TTS_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request stop_pcm. ret(%s)", __tts_get_error_code(ret));
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request stop_pcm. ret(%s)", tts_core_covert_error_code(ret));
                return ret;
        }
 
@@ -1727,7 +1702,7 @@ int tts_repeat(tts_h tts, char** text_repeat, int* utt_id)
 
        int ret = tts_core_repeat(client, text_repeat, utt_id);
        if (TTS_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request stop. ret(%s)", __tts_get_error_code(ret));
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request stop. ret(%s)", tts_core_covert_error_code(ret));
                return ret;
        }
 
index b6a93ad6142ab4716c157be7417986d52c39a750..be0e247ab7165966430d7078dffaf2a50fcb2fe0 100644 (file)
@@ -41,30 +41,6 @@ static int g_speed = -1;
 
 
 /* Static functions */
-static const char* __tts_get_error_code(tts_error_e err)
-{
-       switch (err) {
-       case TTS_ERROR_NONE:                    return "TTS_ERROR_NONE";
-       case TTS_ERROR_OUT_OF_MEMORY:           return "TTS_ERROR_OUT_OF_MEMORY";
-       case TTS_ERROR_IO_ERROR:                return "TTS_ERROR_IO_ERROR";
-       case TTS_ERROR_INVALID_PARAMETER:       return "TTS_ERROR_INVALID_PARAMETER";
-       case TTS_ERROR_OUT_OF_NETWORK:          return "TTS_ERROR_OUT_OF_NETWORK";
-       case TTS_ERROR_TIMED_OUT:               return "TTS_ERROR_TIMED_OUT";
-       case TTS_ERROR_PERMISSION_DENIED:       return "TTS_ERROR_PERMISSION_DENIED";
-       case TTS_ERROR_NOT_SUPPORTED:           return "TTS_ERROR_NOT_SUPPORTED";
-       case TTS_ERROR_INVALID_STATE:           return "TTS_ERROR_INVALID_STATE";
-       case TTS_ERROR_INVALID_VOICE:           return "TTS_ERROR_INVALID_VOICE";
-       case TTS_ERROR_ENGINE_NOT_FOUND:        return "TTS_ERROR_ENGINE_NOT_FOUND";
-       case TTS_ERROR_OPERATION_FAILED:        return "TTS_ERROR_OPERATION_FAILED";
-       case TTS_ERROR_AUDIO_POLICY_BLOCKED:    return "TTS_ERROR_AUDIO_POLICY_BLOCKED";
-       case TTS_ERROR_NOT_SUPPORTED_FEATURE:   return "TTS_ERROR_NOT_SUPPORTED_FEATURE";
-       case TTS_ERROR_SERVICE_RESET:           return "TTS_ERROR_SERVICE_RESET";
-       default:
-               return "Invalid error code";
-       }
-       return NULL;
-}
-
 // TODO: make tts_util? or tts_log?
 static const char* __convert_state(tts_state_e state)
 {
@@ -544,12 +520,12 @@ static Eina_Bool __prepare_sync_cb(tts_client_s* client)
 
        ret = tts_ipc_request_initialize(uid, &credential_needed);
        if (TTS_ERROR_ENGINE_NOT_FOUND == ret || TTS_ERROR_PERMISSION_DENIED == ret) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to initialize : %s", __tts_get_error_code(ret));
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to initialize : %s", tts_core_covert_error_code(ret));
                tts_core_notify_error_async(client, ret, -1, NULL);
 
                return EINA_FALSE;
        } else if (TTS_ERROR_NONE != ret) {
-               SLOG(LOG_WARN, TAG_TTSC, "[WARNING] Fail to connection. Retry to connect : %s", __tts_get_error_code(ret));
+               SLOG(LOG_WARN, TAG_TTSC, "[WARNING] Fail to connection. Retry to connect : %s", tts_core_covert_error_code(ret));
                return EINA_TRUE;
        } else {
                /* success to connect tts-daemon */
@@ -622,10 +598,10 @@ static inline bool __handle_dbus_request_result(tts_client_s* client, tts_error_
                        SLOG(LOG_INFO, TAG_TTSC, "[INFO] Success tts_prepare_sync");
                }
        } else if (TTS_ERROR_TIMED_OUT != ret) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] result : %s", __tts_get_error_code(ret));
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] result : %s", tts_core_covert_error_code(ret));
                return false;
        } else {
-               SLOG(LOG_WARN, TAG_TTSC, "[WARNING] retry play : %s", __tts_get_error_code(ret));
+               SLOG(LOG_WARN, TAG_TTSC, "[WARNING] retry play : %s", tts_core_covert_error_code(ret));
                usleep(10000);
        }
 
@@ -765,6 +741,12 @@ int tts_core_notify_state_changed_async(tts_client_s* client, tts_state_e curren
                return TTS_ERROR_INVALID_PARAMETER;
        }
 
+       tts_state_e before_state = tts_client_get_current_state(client);
+       if (before_state == current_state) {
+               SLOG(LOG_INFO, TAG_TTSC, "[INFO] State is not changed. before(%s), current(%s)", __convert_state(before_state), __convert_state(current_state));
+               return TTS_ERROR_NONE;
+       }
+
        SLOG(LOG_DEBUG, TAG_TTSC, "Notify state changed asynchronously");
        tts_client_set_current_state(client, current_state);
        if (NULL != client->notify_state_timer) {
@@ -784,6 +766,7 @@ int tts_core_notify_utt_started(tts_client_s* client, int utt_id)
                return TTS_ERROR_INVALID_PARAMETER;
        }
 
+       client->utt_id = utt_id;
        SLOG(LOG_DEBUG, TAG_TTSC, "Utterance started data : utt_id(%d)", client->utt_id);
 
        tts_utterance_started_cb callback = tts_client_get_utterance_started_cb(client);
@@ -808,6 +791,7 @@ int tts_core_notify_utt_completeted(tts_client_s* client, int utt_id)
                return TTS_ERROR_INVALID_PARAMETER;
        }
 
+       client->utt_id = utt_id;
        SLOG(LOG_DEBUG, TAG_TTSC, "Utterance completed data : utt_id(%d)", utt_id);
 
        tts_utterance_completed_cb callback = tts_client_get_utterance_completed_cb(client);
@@ -832,7 +816,7 @@ int tts_core_notify_error_async(tts_client_s* client, tts_error_e reason, int ut
                return TTS_ERROR_INVALID_PARAMETER;
        }
 
-       SLOG(LOG_DEBUG, TAG_TTSC, "Error data : utt_id(%d) reason(%s)", utt_id, __tts_get_error_code(reason));
+       SLOG(LOG_DEBUG, TAG_TTSC, "Error data : utt_id(%d) reason(%s)", utt_id, tts_core_covert_error_code(reason));
        client->utt_id = utt_id;
        client->reason = reason;
        tts_client_set_error_message(client, err_msg);
@@ -955,6 +939,30 @@ bool tts_core_check_screen_reader(tts_client_s* client)
        return true;
 }
 
+const char* tts_core_covert_error_code(tts_error_e err)
+{
+       switch (err) {
+       case TTS_ERROR_NONE:                    return "TTS_ERROR_NONE";
+       case TTS_ERROR_OUT_OF_MEMORY:           return "TTS_ERROR_OUT_OF_MEMORY";
+       case TTS_ERROR_IO_ERROR:                return "TTS_ERROR_IO_ERROR";
+       case TTS_ERROR_INVALID_PARAMETER:       return "TTS_ERROR_INVALID_PARAMETER";
+       case TTS_ERROR_OUT_OF_NETWORK:          return "TTS_ERROR_OUT_OF_NETWORK";
+       case TTS_ERROR_TIMED_OUT:               return "TTS_ERROR_TIMED_OUT";
+       case TTS_ERROR_PERMISSION_DENIED:       return "TTS_ERROR_PERMISSION_DENIED";
+       case TTS_ERROR_NOT_SUPPORTED:           return "TTS_ERROR_NOT_SUPPORTED";
+       case TTS_ERROR_INVALID_STATE:           return "TTS_ERROR_INVALID_STATE";
+       case TTS_ERROR_INVALID_VOICE:           return "TTS_ERROR_INVALID_VOICE";
+       case TTS_ERROR_ENGINE_NOT_FOUND:        return "TTS_ERROR_ENGINE_NOT_FOUND";
+       case TTS_ERROR_OPERATION_FAILED:        return "TTS_ERROR_OPERATION_FAILED";
+       case TTS_ERROR_AUDIO_POLICY_BLOCKED:    return "TTS_ERROR_AUDIO_POLICY_BLOCKED";
+       case TTS_ERROR_NOT_SUPPORTED_FEATURE:   return "TTS_ERROR_NOT_SUPPORTED_FEATURE";
+       case TTS_ERROR_SERVICE_RESET:           return "TTS_ERROR_SERVICE_RESET";
+       default:
+               return "Invalid error code";
+       }
+       return NULL;
+}
+
 int tts_core_receive_hello(int uid, int ret, int credential_needed)
 {
        tts_client_s* client = tts_client_get_by_uid(uid);
@@ -975,12 +983,12 @@ int tts_core_receive_hello(int uid, int ret, int credential_needed)
        }
 
        if (TTS_ERROR_ENGINE_NOT_FOUND == ret || TTS_ERROR_PERMISSION_DENIED == ret) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to initialize : %s", __tts_get_error_code(ret));
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to initialize : %s", tts_core_covert_error_code(ret));
                tts_core_notify_error_async(client, ret, -1, NULL);
 
                return TTS_ERROR_OPERATION_FAILED;
        } else if (TTS_ERROR_NONE != ret) {
-               SLOG(LOG_WARN, TAG_TTSC, "[WARNING] Fail to connection. Retry to connect : %s", __tts_get_error_code(ret));
+               SLOG(LOG_WARN, TAG_TTSC, "[WARNING] Fail to connection. Retry to connect : %s", tts_core_covert_error_code(ret));
                return TTS_ERROR_OPERATION_FAILED;
        } else {
                /* success to connect tts-daemon */
@@ -1065,7 +1073,7 @@ int tts_core_unprepare(tts_client_s* client)
 
                ret = tts_ipc_stop_listening(uid);
                if (0 != ret) {
-                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to remove match : %s", __tts_get_error_code(ret));
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to remove match : %s", tts_core_covert_error_code(ret));
                }
        } else {
                SLOG(LOG_INFO, TAG_TTSC, "[INFO] Request finalize");
index fb33d9cd5bd69ef1a6e6ba826ec04cb9bbace547..ecf75f3d4cb3c7e71f7399db665ad61390e9dbe2 100644 (file)
@@ -33,6 +33,8 @@ int tts_core_notify_engine_changed(tts_client_s* client, const char* engine_id,
 bool tts_core_is_valid_text(const char* text);
 bool tts_core_check_screen_reader(tts_client_s* client);
 
+const char* tts_core_covert_error_code(tts_error_e err);
+
 // called by tts.c
 int tts_core_initialize();
 int tts_core_deinitialize();
index 4613acfdecdeeb59dc1a98938e1b456798519922..ea9058a79923cf693cbb49e1c78e5c720a1e79f7 100644 (file)
@@ -35,55 +35,6 @@ static Ecore_Fd_Handler* g_dbus_fd_handler = NULL;
 static volatile int g_connected_client = 0;
 
 
-static int __tts_cb_set_state(int uid, int state)
-{
-       tts_client_s* client = tts_client_get_by_uid(uid);
-       if (NULL == client) {
-               SLOG(LOG_WARN, TAG_TTSC, "[WARNING] The handle is not valid");
-               return -1;
-       }
-
-       tts_state_e state_from_daemon = (tts_state_e)state;
-       tts_state_e current_state = tts_client_get_current_state(client);
-       if (current_state == state_from_daemon) {
-               SLOG(LOG_DEBUG, TAG_TTSC, "Current state has already been %d", current_state);
-               return 0;
-       }
-
-       tts_core_notify_state_changed_async(client, state_from_daemon);
-       return 0;
-}
-
-static int __tts_cb_utt_started(int uid, int utt_id)
-{
-       tts_client_s* client = tts_client_get_by_uid(uid);
-       if (NULL == client) {
-               SLOG(LOG_WARN, TAG_TTSC, "[WARNING] A handle is not valid");
-               return TTS_ERROR_INVALID_PARAMETER;
-       }
-
-       client->utt_id = utt_id;
-       tts_core_notify_utt_started(client, client->utt_id);
-
-       return 0;
-}
-
-static int __tts_cb_utt_completed(int uid, int utt_id)
-{
-       tts_client_s* client = tts_client_get_by_uid(uid);
-       if (NULL == client) {
-               SLOG(LOG_WARN, TAG_TTSC, "[WARNING] A handle is not valid");
-               return TTS_ERROR_INVALID_PARAMETER;
-       }
-
-       SLOG(LOG_INFO, TAG_TTSC, "utterance completed : uttid(%d) ", utt_id);
-
-       client->utt_id = utt_id;
-       tts_core_notify_utt_completeted(client, client->utt_id);
-
-       return 0;
-}
-
 static int __tts_dbus_add_match(int uid)
 {
        /* add a rule for daemon error */
@@ -217,7 +168,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
                                dbus_error_free(&err);
                        }
 
-                       if (0 == __tts_cb_utt_started(uid, uttid)) {
+                       if (0 == tts_core_notify_utt_started(tts_client_get_by_uid(uid), uttid)) {
                                SLOG(LOG_DEBUG, TAG_TTSC, "<<<< tts utterance started : uid(%d) uttid(%d)", uid, uttid);
                        }
                } /* TTSD_METHOD_UTTERANCE_STARTED */
@@ -232,7 +183,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
                                dbus_error_free(&err);
                        }
 
-                       if (0 == __tts_cb_utt_completed(uid, uttid)) {
+                       if (0 == tts_core_notify_utt_completeted(tts_client_get_by_uid(uid), uttid)) {
                                SLOG(LOG_DEBUG, TAG_TTSC, "<<<< tts utterance completed : uid(%d) uttid(%d)", uid, uttid);
                        }
                } /* TTS_SIGNAL_UTTERANCE_STARTED */
@@ -247,7 +198,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
                                dbus_error_free(&err);
                        }
 
-                       if (0 == __tts_cb_set_state(uid, state)) {
+                       if (0 == tts_core_notify_state_changed_async(tts_client_get_by_uid(uid), (tts_state_e)state)) {
                                SLOG(LOG_DEBUG, TAG_TTSC, "<<<< tts state changed : uid(%d) state(%d)", uid, state);
                        }
                } /* TTSD_SIGNAL_SET_STATE */
index 0dd73f05bb8e48c637b19a81aee1f30f5fdabd8a..214976d877099a5e55f0103717f8a84455acdfc7 100644 (file)
@@ -55,55 +55,6 @@ static tts_tidl_info_s* __get_tidl_info_s(int uid)
        return NULL;
 }
 
-static int __tts_cb_set_state(int uid, int state)
-{
-       tts_client_s* client = tts_client_get_by_uid(uid);
-       if (NULL == client) {
-               SLOG(LOG_WARN, TAG_TTSC, "[WARNING] The handle is not valid");
-               return -1;
-       }
-
-       tts_state_e state_from_daemon = (tts_state_e)state;
-       tts_state_e current_state = tts_client_get_current_state(client);
-       if (current_state == state_from_daemon) {
-               SLOG(LOG_DEBUG, TAG_TTSC, "Current state has already been %d", current_state);
-               return 0;
-       }
-
-       tts_core_notify_state_changed_async(client, state_from_daemon);
-       return 0;
-}
-
-static int __tts_cb_utt_started(int uid, int utt_id)
-{
-       tts_client_s* client = tts_client_get_by_uid(uid);
-       if (NULL == client) {
-               SLOG(LOG_WARN, TAG_TTSC, "[WARNING] A handle is not valid");
-               return TTS_ERROR_INVALID_PARAMETER;
-       }
-
-       client->utt_id = utt_id;
-       tts_core_notify_utt_started(client, client->utt_id);
-
-       return 0;
-}
-
-static int __tts_cb_utt_completed(int uid, int utt_id)
-{
-       tts_client_s* client = tts_client_get_by_uid(uid);
-       if (NULL == client) {
-               SLOG(LOG_WARN, TAG_TTSC, "[WARNING] A handle is not valid");
-               return TTS_ERROR_INVALID_PARAMETER;
-       }
-
-       SLOG(LOG_INFO, TAG_TTSC, "utterance completed : uttid(%d) ", utt_id);
-
-       client->utt_id = utt_id;
-       tts_core_notify_utt_completeted(client, client->utt_id);
-
-       return 0;
-}
-
 static void __reconnect(void *data)
 {
        int uid = (intptr_t)data;
@@ -153,17 +104,17 @@ static void __notify_cb(void *user_data, int pid, int uid, bundle *msg)
        } else if (0 == strncmp(TTSD_METHOD_UTTERANCE_STARTED, method, strlen(TTSD_METHOD_UTTERANCE_STARTED))) {
                bundle_get_str(msg, TTS_BUNDLE_UTTID, &val);
                if (val) {
-                       __tts_cb_utt_started(uid, atoi(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);
                if (val) {
-                       __tts_cb_utt_completed(uid, atoi(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);
                if (val) {
-                       __tts_cb_set_state(uid, atoi(val));
+                       tts_core_notify_state_changed_async(client, (tts_state_e)atoi(val));
                }
        } else if (0 == strncmp(TTSD_METHOD_ERROR, method, strlen(TTSD_METHOD_ERROR))) {
                char *uttid = NULL;