Fix to remove timer when daemon is destroyed 44/17844/1
authorLee Dongyeol <dy3.lee@samsung.com>
Mon, 10 Jun 2013 03:56:36 +0000 (12:56 +0900)
committerLee Dongyeol <dy3.lee@samsung.com>
Tue, 11 Mar 2014 10:56:22 +0000 (19:56 +0900)
Change-Id: I6799e7bd8380f8036f2a1e5d2ca5bf5c60a8dbe1

14 files changed:
changelog
client/tts_dbus.c [changed mode: 0755->0644]
client/tts_setting_dbus.c
packaging/tts.spec [changed mode: 0755->0644]
server/ttsd_config.c
server/ttsd_config_noti.c [changed mode: 0755->0644]
server/ttsd_data.cpp
server/ttsd_dbus.c
server/ttsd_engine_agent.c
server/ttsd_main.c
server/ttsd_main_noti.c
server/ttsd_main_sr.c
server/ttsd_player.c
server/ttsd_server.c

index 9011fc5..fa6d72c 100644 (file)
--- a/changelog
+++ b/changelog
@@ -1,3 +1,27 @@
+tts (0.1.62) -- Tue, 14 May 2013
+
+  * Release version 0.1.62 (Kwangyoun Kim <ky85.kim@samsung.com>)
+
+tts (0.1.61-2) -- Tue, 14 May 2013
+
+  * Initialize default language from display language (Dongyeol Lee <dy3.lee@samsung.com>)
+
+tts (0.1.61-1) -- Tue, 07 May 2013
+
+  * Delete code about print (Kwangyoun Kim <ky85.kim@samsung.com>)
+
+tts (0.1.61) -- Thu, 02 May 2013
+
+  * Release version 0.1.61 (Dongyeol Lee <dy3.lee@samsung.com>)
+
+tts (0.1.60-2) -- Thu, 02 May 2013
+
+  * Add to remove timer when daemon is destroyed (Dongyeol Lee <dy3.lee@samsung.com>)
+
+tts (0.1.60-1) -- Fri, 19 Apr 2013
+
+  * Update interrupt scheduling of Screen reader (Dongyeol Lee <dy3.lee@samsung.com>)
+
 tts (0.1.60) -- Tue, 16 Apr 2013
 
   * Release version 0.1.60 (Kwangyoun Kim <ky85.kim@samsung.com>)
old mode 100755 (executable)
new mode 100644 (file)
index 50319d1..6d1607e
@@ -552,7 +552,7 @@ int tts_dbus_request_get_support_voice(int uid, tts_h tts, tts_supported_voice_c
 
        if (dbus_error_is_set(&err)) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
-               printf("result message : %p\n", result_msg);
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] result message : %p", result_msg);
        }
 
        if (NULL != result_msg) {
@@ -649,7 +649,7 @@ int tts_dbus_request_get_default_voice(int uid , char** lang, tts_voice_type_e*
 
        if (dbus_error_is_set(&err)) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
-               printf("result message : %p\n", result_msg);
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] result message : %p", result_msg);
        }
 
        if (NULL != result_msg) {
index eaf6f93..093f376 100644 (file)
@@ -62,7 +62,7 @@ int tts_setting_dbus_open_connection()
        }
 
        if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) {
-               printf("fail dbus_bus_request_name()\n");
+               SLOG(LOG_ERROR, TAG_TTSC, "[Dbus ERROR] fail to be primary owner \n");
                return TTS_SETTING_ERROR_OPERATION_FAILED;
        }
 
old mode 100755 (executable)
new mode 100644 (file)
index af137b2..901943d
@@ -1,6 +1,6 @@
 Name:       tts
 Summary:    Text To Speech client library and daemon
-Version:    0.1.60
+Version:    0.1.62
 Release:    1
 Group:      libs
 License:    Samsung
index 1ba3164..d79b3dc 100644 (file)
@@ -13,6 +13,8 @@
 
 #include <Ecore_File.h>
 #include <runtime_info.h>
+#include <vconf.h>
+
 #include "ttsd_main.h"
 #include "ttsd_config.h"
 #include "ttsd_engine_agent.h"
@@ -124,6 +126,22 @@ int __ttsd_config_load()
                }
        }
        
+       if (true == is_default_open) {
+               /* Change default language to display language */
+               char* value;
+               value = vconf_get_str(VCONFKEY_LANGSET);
+
+               if (NULL != value) {
+                       SLOG(LOG_DEBUG, get_tag(), "[Config] System language : %s", value);
+                       strncpy(g_language, value, strlen(g_language));
+                       SLOG(LOG_DEBUG, get_tag(), "[Config] Default language : %s", g_language);
+
+                       free(value);
+               } else {
+                       SLOG(LOG_ERROR, get_tag(), "[Config ERROR] Fail to get system language");
+               }
+       }
+
        /* Read speed */
        if (EOF == fscanf(config_fp, "%s %d", buf_id, &int_param)) {
                fclose(config_fp);
old mode 100755 (executable)
new mode 100644 (file)
index 510af1d..d36bc44
@@ -15,6 +15,8 @@
 #include <Ecore_File.h>
 #include <runtime_info.h>
 #include <sys/inotify.h>
+#include <vconf.h>
+
 #include "ttsd_main.h"
 #include "ttsd_config.h"
 #include "ttsd_engine_agent.h"
@@ -233,6 +235,22 @@ int __ttsd_config_load()
                }
        }
 
+       if (true == is_default_open) {
+               /* Change default language to display language */
+               char* value;
+               value = vconf_get_str(VCONFKEY_LANGSET);
+
+               if (NULL != value) {
+                       SLOG(LOG_DEBUG, get_tag(), "[Config] System language : %s", value);
+                       strncpy(g_language, value, strlen(g_language));
+                       SLOG(LOG_DEBUG, get_tag(), "[Config] Default language : %s", g_language);
+
+                       free(value);
+               } else {
+                       SLOG(LOG_ERROR, get_tag(), "[Config ERROR] Fail to get system language");
+               }
+       }
+
        /* Read speed */
        if (EOF == fscanf(config_fp, "%s %d", buf_id, &int_param)) {
                fclose(config_fp);
index 7979d98..3a42c15 100644 (file)
@@ -560,7 +560,7 @@ int ttsd_data_save_error_log(int uid, FILE* fp)
        fprintf(fp, "----- Sound list -----\n");
        
        for (i=0 ; i < g_app_list[index].m_wav_data.size() ; i++) {
-               fprintf(fp, "[%dth] data size(%ld), uttid(%d), type(%d) \n", 
+               fprintf(fp, "[%dth] data size(%d), uttid(%d), type(%d) \n", 
                        i+1, g_app_list[index].m_wav_data[i].data_size, g_app_list[index].m_wav_data[i].utt_id, g_app_list[index].m_wav_data[i].audio_type );
        }
        fprintf(fp, "----------------------\n");
index 8bcd52c..4866ab7 100644 (file)
@@ -390,7 +390,6 @@ int ttsd_dbus_open_connection()
        ret = dbus_bus_request_name(g_conn, g_service_name, DBUS_NAME_FLAG_REPLACE_EXISTING , &err);
 
        if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) {
-               printf("Fail to be primary owner in dbus request. \n");
                SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] fail to be primary owner \n");
                return -1;
        }
index d8c807b..0301d64 100644 (file)
@@ -603,8 +603,7 @@ int ttsd_engine_agent_load_current_engine()
        int ret = 0;
        ret = g_cur_engine.ttsp_load_engine(g_cur_engine.pdfuncs, g_cur_engine.pefuncs); 
        if (0 != ret) {
-               printf("Fail load '%s' engine", g_cur_engine.engine_path);
-               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail to load engine : result(%d)");
+               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail to load engine - %s : result(%d)", g_cur_engine.engine_path, ret);
                return TTSD_ERROR_OPERATION_FAILED;
        }
 
@@ -660,7 +659,7 @@ int ttsd_engine_agent_load_current_engine()
 
                if (0 == ret && 0 < g_list_length(voice_list)) {
                        GList *iter = NULL;
-                       voice_s* voice;
+                       voice_s* voice = NULL;
                        
                        iter = g_list_first(voice_list);
 
index 57bd998..06b534b 100644 (file)
@@ -21,6 +21,8 @@
 
 #define CLIENT_CLEAN_UP_TIME 500
 
+static Ecore_Timer* g_check_client_timer = NULL;
+
 char* get_tag()
 {
        return "ttsd";
@@ -38,40 +40,43 @@ int main()
        SLOG(LOG_DEBUG, get_tag(), "  ");
        SLOG(LOG_DEBUG, get_tag(), "===== TTS DAEMON DEFAULT INITIALIZE");
        if (!ecore_init()) {
-               SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail ecore_init() \n");
+               SLOG(LOG_ERROR, get_tag(), "[Main ERROR] Fail ecore_init()");
                return -1;
        }
 
        if (0 != ttsd_initialize()) {
-               printf("Fail to initialize tts-daemon \n");
-               SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail to initialize tts-daemon"); 
+               SLOG(LOG_ERROR, get_tag(), "[Main ERROR] Fail to initialize tts-daemon"); 
                return EXIT_FAILURE;
        }
        
        if (0 != ttsd_dbus_open_connection()) {
-               printf("Fail to initialize IPC connection \n");
-               SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail to open dbus connection");
+               SLOG(LOG_ERROR, get_tag(), "[Main ERROR] Fail to open dbus connection");
                return EXIT_FAILURE;
        }
 
        if (0 != ttsd_network_initialize()) {
-               SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail to initialize network");
+               SLOG(LOG_ERROR, get_tag(), "[Main ERROR] Fail to initialize network");
                return EXIT_FAILURE;
        }
 
-       ecore_timer_add(CLIENT_CLEAN_UP_TIME, ttsd_cleanup_client, NULL);
+       g_check_client_timer = ecore_timer_add(CLIENT_CLEAN_UP_TIME, ttsd_cleanup_client, NULL);
+       if (NULL == g_check_client_timer) {
+               SLOG(LOG_WARN, get_tag(), "[Main Warning] Fail to create timer of client check");
+       }
 
        SLOG(LOG_DEBUG, get_tag(), "[Main] tts-daemon start...\n"); 
        SLOG(LOG_DEBUG, get_tag(), "=====");
        SLOG(LOG_DEBUG, get_tag(), "  ");
        SLOG(LOG_DEBUG, get_tag(), "  ");
-
-       printf("Start tts-daemon ...\n");
        
        ecore_main_loop_begin();
 
        SLOG(LOG_DEBUG, get_tag(), "===== TTS DAEMON DEFAULT FINALIZE");
        
+       if (NULL != g_check_client_timer) {
+               ecore_timer_del(g_check_client_timer);
+       }
+
        ttsd_network_finalize();
 
        ttsd_dbus_close_connection();
index 9186ee0..267fd92 100644 (file)
@@ -21,6 +21,8 @@
 
 #define CLIENT_CLEAN_UP_TIME 500
 
+static Ecore_Timer* g_check_client_timer = NULL;
+
 char* get_tag()
 {
        return "ttsdnoti";
@@ -43,13 +45,11 @@ int main()
        }
 
        if (0 != ttsd_initialize()) {
-               printf("Fail to initialize tts-daemon-noti \n");
                SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail to initialize tts-daemon-noti"); 
                return EXIT_FAILURE;
        }
 
        if (0 != ttsd_dbus_open_connection()) {
-               printf("Fail to initialize IPC connection \n");
                SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail to open dbus connection");
                return EXIT_FAILURE;
        }
@@ -59,19 +59,24 @@ int main()
                return EXIT_FAILURE;
        }
 
-       ecore_timer_add(CLIENT_CLEAN_UP_TIME, ttsd_cleanup_client, NULL);
+       g_check_client_timer = ecore_timer_add(CLIENT_CLEAN_UP_TIME, ttsd_cleanup_client, NULL);
+       if (NULL == g_check_client_timer) {
+               SLOG(LOG_WARN, get_tag(), "[Main Warning] Fail to create timer of client check");
+       }
 
        SLOG(LOG_DEBUG, get_tag(), "[Main] start tts-daemon-noti start..."); 
        SLOG(LOG_DEBUG, get_tag(), "=====");
        SLOG(LOG_DEBUG, get_tag(), "  ");
        SLOG(LOG_DEBUG, get_tag(), "  ");
-
-       printf("Start tts-daemon-noti ...\n");
        
        ecore_main_loop_begin();
 
        SLOG(LOG_DEBUG, get_tag(), "===== TTS DAEMON NOTI FINALIZE");
 
+       if (NULL != g_check_client_timer) {
+               ecore_timer_del(g_check_client_timer);
+       }
+
        ttsd_network_finalize();
 
        ttsd_dbus_close_connection();
index 3442e60..a970765 100644 (file)
@@ -20,6 +20,8 @@
 
 #define CLIENT_CLEAN_UP_TIME 500
 
+static Ecore_Timer* g_check_client_timer = NULL;
+
 char* get_tag()
 {
        return "ttsdsr";
@@ -42,13 +44,11 @@ int main()
        }
 
        if (0 != ttsd_initialize()) {
-               printf("Fail to initialize tts-daemon-sr \n");
                SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail to initialize tts-daemon-sr"); 
                return EXIT_FAILURE;
        }
 
        if (0 != ttsd_dbus_open_connection()) {
-               printf("Fail to initialize IPC connection \n");
                SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail to open dbus connection");
                return EXIT_FAILURE;
        }
@@ -58,19 +58,24 @@ int main()
                return EXIT_FAILURE;
        }
 
-       ecore_timer_add(CLIENT_CLEAN_UP_TIME, ttsd_cleanup_client, NULL);
+       g_check_client_timer = ecore_timer_add(CLIENT_CLEAN_UP_TIME, ttsd_cleanup_client, NULL);
+       if (NULL == g_check_client_timer) {
+               SLOG(LOG_WARN, get_tag(), "[Main Warning] Fail to create timer of client check");
+       }
 
        SLOG(LOG_DEBUG, get_tag(), "[Main] tts-daemon-sr start...\n"); 
        SLOG(LOG_DEBUG, get_tag(), "=====");
        SLOG(LOG_DEBUG, get_tag(), "  ");
        SLOG(LOG_DEBUG, get_tag(), "  ");
-
-       printf("Start tts-daemon-sr...\n");
        
        ecore_main_loop_begin();
 
        SLOG(LOG_DEBUG, get_tag(), "===== TTS DAEMON SR FINALIZE");
 
+       if (NULL != g_check_client_timer) {
+               ecore_timer_del(g_check_client_timer);
+       }
+
        ttsd_network_finalize();
 
        ttsd_dbus_close_connection();
index dcd3cbb..c1a2768 100644 (file)
@@ -582,7 +582,6 @@ int ttsd_player_get_state(int uid, ttsd_player_state_e* state)
 
        SLOG(LOG_DEBUG, get_tag(), "[PLAYER] State changed : state(%d)", player_state);
 
-       int ret = -1;
        /* destroy player */
        switch (player_state) {
                case MM_PLAYER_STATE_PLAYING:
index 3b71ddf..4603af3 100644 (file)
@@ -626,10 +626,15 @@ Eina_Bool __send_interrupt_client(void *data)
        
        if (NULL != uid) {
                int pid = ttsd_data_get_pid(*uid);
-               /* send message to client about changing state */
-               ttsdc_send_set_state_message (pid, *uid, APP_STATE_PAUSED);
+
+               if (TTSD_MODE_SCREEN_READER == ttsd_get_mode()) {
+                       /* send message to client about changing state */
+                       ttsdc_send_set_state_message (pid, *uid, APP_STATE_READY);
+               } else {
+                       ttsdc_send_set_state_message (pid, *uid, APP_STATE_PAUSED);
+               }
                free(uid);
-       }
+       }       
        return EINA_FALSE;
 }
 
@@ -657,20 +662,34 @@ int ttsd_server_play(int uid)
        int current_uid = ttsd_data_get_current_playing();
 
        if (uid != current_uid && -1 != current_uid) {
-               /* Send interrupt message */
-               SLOG(LOG_DEBUG, get_tag(), "[Server] Old uid(%d) will be interrupted into 'Pause' state ", current_uid);
+               if (TTSD_MODE_SCREEN_READER == ttsd_get_mode()) {
+                       /* Send interrupt message */
+                       SLOG(LOG_DEBUG, get_tag(), "[Server] Old uid(%d) will be interrupted into 'Stop' state ", current_uid);
+
+                       /* pause player */
+                       if (0 != ttsd_server_stop(current_uid)) {
+                               SLOG(LOG_WARN, get_tag(), "[Server ERROR] fail to stop : uid (%d)", current_uid);
+                       } 
+                       
+                       int* temp_uid = (int*)malloc(sizeof(int));
+                       *temp_uid = current_uid;
+                       ecore_timer_add(0, __send_interrupt_client, temp_uid);
+               } else {
+                       /* Send interrupt message */
+                       SLOG(LOG_DEBUG, get_tag(), "[Server] Old uid(%d) will be interrupted into 'Pause' state ", current_uid);
 
-               /* pause player */
-               if (0 != ttsd_player_pause(current_uid)) {
-                       SLOG(LOG_WARN, get_tag(), "[Server ERROR] fail to ttsd_player_pause() : uid (%d)", current_uid);
-               } 
+                       /* pause player */
+                       if (0 != ttsd_player_pause(current_uid)) {
+                               SLOG(LOG_WARN, get_tag(), "[Server ERROR] fail to ttsd_player_pause() : uid (%d)", current_uid);
+                       
 
-               /* change state */
-               ttsd_data_set_client_state(current_uid, APP_STATE_PAUSED);
+                       /* change state */
+                       ttsd_data_set_client_state(current_uid, APP_STATE_PAUSED);
 
-               int* temp_uid = (int*)malloc(sizeof(int));
-               *temp_uid = current_uid;
-               ecore_timer_add(0, __send_interrupt_client, temp_uid);
+                       int* temp_uid = (int*)malloc(sizeof(int));
+                       *temp_uid = current_uid;
+                       ecore_timer_add(0, __send_interrupt_client, temp_uid);
+               }
        }
        
        /* Change current play */