modify files according to coding rule 78/55278/1
authorWonnam Jang <wn.jang@samsung.com>
Tue, 22 Dec 2015 23:45:24 +0000 (08:45 +0900)
committerWonnam Jang <wn.jang@samsung.com>
Tue, 22 Dec 2015 23:45:24 +0000 (08:45 +0900)
Change-Id: Icfb0f788c52e4d35e7cec37150bb7748545adc4f
Signed-off-by: Wonnam Jang <wn.jang@samsung.com>
12 files changed:
client/tts.c
client/tts_client.c
client/tts_dbus.c
client/tts_setting.c
common/tts_config_mgr.c
server/ttsd_dbus.c
server/ttsd_dbus_server.c
server/ttsd_engine_agent.c
server/ttsd_network.c
server/ttsd_player.c
server/ttsd_server.c
test/test_main.c

index 0157301..7e327cb 100644 (file)
@@ -1,5 +1,5 @@
 /*
-*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
@@ -15,7 +15,7 @@
 #include <Ecore.h>
 #include <iconv.h>
 #include <sys/stat.h>
-#include <sys/types.h> 
+#include <sys/types.h>
 #include <sys/wait.h>
 #include <system_info.h>
 #include <vconf.h>
@@ -42,7 +42,7 @@ const char* tts_tag()
 
 static const char* __tts_get_error_code(tts_error_e err)
 {
-       switch(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";
@@ -79,8 +79,8 @@ static int __tts_convert_config_error_code(tts_config_error_e code)
 
 void __tts_config_voice_changed_cb(const char* before_lang, int before_voice_type, const char* language, int voice_type, bool auto_voice, void* user_data)
 {
-       SLOG(LOG_DEBUG, TAG_TTSC, "Voice changed : Before lang(%s) type(%d) , Current lang(%s), type(%d)", 
-               before_lang, before_voice_type, language, voice_type);
+       SLOG(LOG_DEBUG, TAG_TTSC, "Voice changed : Before lang(%s) type(%d) , Current lang(%s), type(%d)",
+                before_lang, before_voice_type, language, voice_type);
 
        GList* client_list = NULL;
        client_list = tts_client_get_client_list();
@@ -105,7 +105,7 @@ void __tts_config_voice_changed_cb(const char* before_lang, int before_voice_typ
                }
        }
 
-       return; 
+       return;
 }
 
 int tts_create(tts_h* tts)
@@ -119,7 +119,7 @@ int tts_create(tts_h* tts)
        }
 
        SLOG(LOG_DEBUG, TAG_TTSC, "===== Create TTS");
-       
+
        /* check param */
        if (NULL == tts) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Input handle is null");
@@ -244,7 +244,7 @@ int tts_destroy(tts_h tts)
        default:
                break;
        }
+
        if (0 == tts_client_get_size()) {
                if (0 != tts_dbus_close_connection()) {
                        SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to close connection");
@@ -288,7 +288,7 @@ int tts_set_mode(tts_h tts, tts_mode_e mode)
 
        /* check state */
        if (client->current_state != TTS_STATE_CREATED) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Invalid State: Current state is not 'CREATED'"); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Invalid State: Current state is not 'CREATED'");
                SLOG(LOG_DEBUG, TAG_TTSC, "=====");
                SLOG(LOG_DEBUG, TAG_TTSC, " ");
                return TTS_ERROR_INVALID_STATE;
@@ -347,7 +347,7 @@ int tts_get_mode(tts_h tts, tts_mode_e* mode)
 
        /* check state */
        if (client->current_state != TTS_STATE_CREATED) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Invalid State: Current state is not 'CREATED'"); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Invalid State: Current state is not 'CREATED'");
                SLOG(LOG_DEBUG, TAG_TTSC, "=====");
                SLOG(LOG_DEBUG, TAG_TTSC, " ");
                return TTS_ERROR_INVALID_STATE;
@@ -356,10 +356,10 @@ int tts_get_mode(tts_h tts, tts_mode_e* mode)
        if (NULL == mode) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Input parameter(mode) is NULL");
                return TTS_ERROR_INVALID_PARAMETER;
-       } 
+       }
 
        *mode = client->mode;
-       
+
        SLOG(LOG_DEBUG, TAG_TTSC, "=====");
        SLOG(LOG_DEBUG, TAG_TTSC, " ");
 
@@ -391,7 +391,7 @@ static Eina_Bool __tts_connect_daemon(void *data)
 
        if (TTS_ERROR_ENGINE_NOT_FOUND == ret) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to initialize : %s", __tts_get_error_code(ret));
-               
+
                client->reason = TTS_ERROR_ENGINE_NOT_FOUND;
                client->utt_id = -1;
 
@@ -421,7 +421,7 @@ static Eina_Bool __tts_connect_daemon(void *data)
 
        if (NULL != client->state_changed_cb) {
                tts_client_use_callback(client);
-               client->state_changed_cb(client->tts, client->before_state, client->current_state, client->state_changed_user_data); 
+               client->state_changed_cb(client->tts, client->before_state, client->current_state, client->state_changed_user_data);
                tts_client_not_use_callback(client);
        } else {
                SLOG(LOG_WARN, TAG_TTSC, "State changed callback is NULL");
@@ -457,7 +457,7 @@ int tts_prepare(tts_h tts)
 
        /* check state */
        if (client->current_state != TTS_STATE_CREATED) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Invalid State: Current state is not 'CREATED'"); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Invalid State: Current state is not 'CREATED'");
                SLOG(LOG_DEBUG, TAG_TTSC, "=====");
                SLOG(LOG_DEBUG, TAG_TTSC, " ");
                return TTS_ERROR_INVALID_STATE;
@@ -493,7 +493,7 @@ int tts_unprepare(tts_h tts)
 
        /* check state */
        if (client->current_state != TTS_STATE_READY) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Invalid State: Current state is not 'READY'"); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Invalid State: Current state is not 'READY'");
                return TTS_ERROR_INVALID_STATE;
        }
 
@@ -526,7 +526,7 @@ int tts_unprepare(tts_h tts)
 
        if (NULL != client->state_changed_cb) {
                tts_client_use_callback(client);
-               client->state_changed_cb(client->tts, client->before_state, client->current_state, client->state_changed_user_data); 
+               client->state_changed_cb(client->tts, client->before_state, client->current_state, client->state_changed_user_data);
                tts_client_not_use_callback(client);
                SLOG(LOG_DEBUG, TAG_TTSC, "State changed callback is called");
        }
@@ -608,7 +608,7 @@ int tts_foreach_supported_voices(tts_h tts, tts_supported_voice_cb callback, voi
        if (0 != ret) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Result : %d", ret);
                ret = TTS_ERROR_OPERATION_FAILED;
-       }    
+       }
 
        SLOG(LOG_DEBUG, TAG_TTSC, "=====");
        SLOG(LOG_DEBUG, TAG_TTSC, " ");
@@ -647,13 +647,13 @@ int tts_get_default_voice(tts_h tts, char** lang, int* vctype)
        /* Request call remote method */
        int ret = 0;
        ret = tts_config_mgr_get_voice(lang, vctype);
-       if (0 != ret) {
+       if (0 != ret) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] result : %d", ret);
                return __tts_convert_config_error_code(ret);
        } else {
                SLOG(LOG_DEBUG, TAG_TTSC, "[DEBUG] Default language(%s), type(%d)", *lang, *vctype);
        }
-       
+
        SLOG(LOG_DEBUG, TAG_TTSC, "=====");
        SLOG(LOG_DEBUG, TAG_TTSC, " ");
 
@@ -681,9 +681,9 @@ int tts_get_max_text_size(tts_h tts, unsigned int* size)
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Get max text count : A handle is not valid");
                return TTS_ERROR_INVALID_PARAMETER;
        }
-       
+
        if (TTS_STATE_READY != client->current_state) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Get max text count : Current state is NOT 'READY'."); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Get max text count : Current state is NOT 'READY'.");
                return TTS_ERROR_INVALID_STATE;
        }
 
@@ -717,7 +717,7 @@ int tts_get_state(tts_h tts, tts_state_e* state)
 
        *state = client->current_state;
 
-       switch(*state) {
+       switch (*state) {
                case TTS_STATE_CREATED: SLOG(LOG_DEBUG, TAG_TTSC, "Current state is 'Created'");        break;
                case TTS_STATE_READY:   SLOG(LOG_DEBUG, TAG_TTSC, "Current state is 'Ready'");          break;
                case TTS_STATE_PLAYING: SLOG(LOG_DEBUG, TAG_TTSC, "Current state is 'Playing'");        break;
@@ -786,7 +786,7 @@ int tts_add_text(tts_h tts, const char* text, const char* language, int voice_ty
        }
 
        if (TTS_STATE_CREATED == client->current_state) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Current state is 'CREATED'."); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Current state is 'CREATED'.");
                return TTS_ERROR_INVALID_STATE;
        }
 
@@ -846,10 +846,10 @@ int tts_add_text(tts_h tts, const char* text, const char* language, int voice_ty
 
        if (NULL == language)
                temp = strdup("default");
-       else 
+       else
                temp = strdup(language);
 
-       client->current_utt_id ++;
+       client->current_utt_id++;
        if (client->current_utt_id == 10000) {
                client->current_utt_id = 1;
        }
@@ -914,7 +914,7 @@ int tts_play(tts_h tts)
        }
 
        if (TTS_STATE_PLAYING == client->current_state || TTS_STATE_CREATED == client->current_state) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] The current state is invalid."); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] The current state is invalid.");
                return TTS_ERROR_INVALID_STATE;
        }
 
@@ -948,7 +948,7 @@ int tts_play(tts_h tts)
 
        if (NULL != client->state_changed_cb) {
                tts_client_use_callback(client);
-               client->state_changed_cb(client->tts, client->before_state, client->current_state, client->state_changed_user_data); 
+               client->state_changed_cb(client->tts, client->before_state, client->current_state, client->state_changed_user_data);
                tts_client_not_use_callback(client);
                SLOG(LOG_DEBUG, TAG_TTSC, "State changed callback is called");
        }
@@ -989,7 +989,7 @@ int tts_stop(tts_h tts)
        }
 
        if (TTS_STATE_CREATED == client->current_state) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Current state is 'CREATED'."); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Current state is 'CREATED'.");
                return TTS_ERROR_INVALID_STATE;
        }
 
@@ -1023,7 +1023,7 @@ int tts_stop(tts_h tts)
 
        if (NULL != client->state_changed_cb) {
                tts_client_use_callback(client);
-               client->state_changed_cb(client->tts, client->before_state, client->current_state, client->state_changed_user_data); 
+               client->state_changed_cb(client->tts, client->before_state, client->current_state, client->state_changed_user_data);
                tts_client_not_use_callback(client);
                SLOG(LOG_DEBUG, TAG_TTSC, "State changed callback is called");
        }
@@ -1064,7 +1064,7 @@ int tts_pause(tts_h tts)
        }
 
        if (TTS_STATE_PLAYING != client->current_state) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[Error] The Current state is NOT 'playing'. So this request should be not running.");    
+               SLOG(LOG_ERROR, TAG_TTSC, "[Error] The Current state is NOT 'playing'. So this request should be not running.");
                SLOG(LOG_DEBUG, TAG_TTSC, "=====");
                SLOG(LOG_DEBUG, TAG_TTSC, " ");
                return TTS_ERROR_INVALID_STATE;
@@ -1094,13 +1094,13 @@ int tts_pause(tts_h tts)
                        }
                }
        }
-       
+
        client->before_state = client->current_state;
        client->current_state = TTS_STATE_PAUSED;
 
        if (NULL != client->state_changed_cb) {
                tts_client_use_callback(client);
-               client->state_changed_cb(client->tts, client->before_state, client->current_state, client->state_changed_user_data); 
+               client->state_changed_cb(client->tts, client->before_state, client->current_state, client->state_changed_user_data);
                tts_client_not_use_callback(client);
                SLOG(LOG_DEBUG, TAG_TTSC, "State changed callback is called");
        }
@@ -1128,7 +1128,7 @@ static Eina_Bool __tts_notify_error(void *data)
        if (NULL != client->error_cb) {
                SLOG(LOG_DEBUG, TAG_TTSC, "Call callback function of error");
                tts_client_use_callback(client);
-               client->error_cb(client->tts, client->utt_id, client->reason, client->error_user_data );
+               client->error_cb(client->tts, client->utt_id, client->reason, client->error_user_data);
                tts_client_not_use_callback(client);
        } else {
                SLOG(LOG_WARN, TAG_TTSC, "No registered callback function of error ");
@@ -1155,7 +1155,7 @@ int __tts_cb_error(int uid, tts_error_e reason, int utt_id)
        } else {
                SLOG(LOG_WARN, TAG_TTSC, "No registered callback function of error ");
        }
-       
+
        return 0;
 }
 
@@ -1173,7 +1173,7 @@ static Eina_Bool __tts_notify_state_changed(void *data)
 
        if (NULL != client->state_changed_cb) {
                tts_client_use_callback(client);
-               client->state_changed_cb(client->tts, client->before_state, client->current_state, client->state_changed_user_data); 
+               client->state_changed_cb(client->tts, client->before_state, client->current_state, client->state_changed_user_data);
                tts_client_not_use_callback(client);
                SLOG(LOG_DEBUG, TAG_TTSC, "State changed callback is called : pre(%d) cur(%d)", client->before_state, client->current_state);
        } else {
@@ -1186,7 +1186,7 @@ static Eina_Bool __tts_notify_state_changed(void *data)
 int __tts_cb_set_state(int uid, int state)
 {
        tts_client_s* client = tts_client_get_by_uid(uid);
-       if( NULL == client ) {
+       if (NULL == client) {
                SLOG(LOG_WARN, TAG_TTSC, "[WARNING] The handle is not valid");
                return -1;
        }
@@ -1221,7 +1221,7 @@ static Eina_Bool __tts_notify_utt_started(void *data)
                SLOG(LOG_WARN, TAG_TTSC, "[WARNING] Fail to notify utt started : A handle is not valid");
                return EINA_FALSE;
        }
-       
+
        if (NULL != client->utt_started_cb) {
                SLOG(LOG_DEBUG, TAG_TTSC, "Call callback function of utterance started ");
                tts_client_use_callback(client);
@@ -1327,7 +1327,7 @@ int tts_set_state_changed_cb(tts_h tts, tts_state_changed_cb callback, void* use
        }
 
        if (TTS_STATE_CREATED != client->current_state) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set state changed cb : Current state is not 'Created'."); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set state changed cb : Current state is not 'Created'.");
                return TTS_ERROR_INVALID_STATE;
        }
 
@@ -1362,7 +1362,7 @@ int tts_unset_state_changed_cb(tts_h tts)
        }
 
        if (TTS_STATE_CREATED != client->current_state) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset state changed cb : Current state is not 'Created'."); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset state changed cb : Current state is not 'Created'.");
                return TTS_ERROR_INVALID_STATE;
        }
 
@@ -1397,7 +1397,7 @@ int tts_set_utterance_started_cb(tts_h tts, tts_utterance_started_cb callback, v
        }
 
        if (TTS_STATE_CREATED != client->current_state) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set utt started cb : Current state is not 'Created'."); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set utt started cb : Current state is not 'Created'.");
                return TTS_ERROR_INVALID_STATE;
        }
 
@@ -1405,7 +1405,7 @@ int tts_set_utterance_started_cb(tts_h tts, tts_utterance_started_cb callback, v
        client->utt_started_user_data = user_data;
 
        SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Set utt started cb");
-       
+
        return 0;
 }
 
@@ -1432,7 +1432,7 @@ int tts_unset_utterance_started_cb(tts_h tts)
        }
 
        if (TTS_STATE_CREATED != client->current_state) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset utt started cb : Current state is not 'Created'."); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset utt started cb : Current state is not 'Created'.");
                return TTS_ERROR_INVALID_STATE;
        }
 
@@ -1440,7 +1440,7 @@ int tts_unset_utterance_started_cb(tts_h tts)
        client->utt_started_user_data = NULL;
 
        SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Unset utt started cb");
-       
+
        return 0;
 }
 
@@ -1467,7 +1467,7 @@ int tts_set_utterance_completed_cb(tts_h tts, tts_utterance_completed_cb callbac
        }
 
        if (TTS_STATE_CREATED != client->current_state) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set utt completed cb : Current state is not 'Created'."); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set utt completed cb : Current state is not 'Created'.");
                return TTS_ERROR_INVALID_STATE;
        }
 
@@ -1475,7 +1475,7 @@ int tts_set_utterance_completed_cb(tts_h tts, tts_utterance_completed_cb callbac
        client->utt_completed_user_data = user_data;
 
        SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Set utt completed cb");
-       
+
        return 0;
 }
 
@@ -1502,7 +1502,7 @@ int tts_unset_utterance_completed_cb(tts_h tts)
        }
 
        if (TTS_STATE_CREATED != client->current_state) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset utt completed cb : Current state is not 'Created'."); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset utt completed cb : Current state is not 'Created'.");
                return TTS_ERROR_INVALID_STATE;
        }
 
@@ -1536,7 +1536,7 @@ int tts_set_error_cb(tts_h tts, tts_error_cb callback, void* user_data)
        }
 
        if (TTS_STATE_CREATED != client->current_state) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set error cb : Current state is not 'Created'."); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set error cb : Current state is not 'Created'.");
                return TTS_ERROR_INVALID_STATE;
        }
 
@@ -1544,7 +1544,7 @@ int tts_set_error_cb(tts_h tts, tts_error_cb callback, void* user_data)
        client->error_user_data = user_data;
 
        SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Set error cb");
-       
+
        return 0;
 }
 
@@ -1569,9 +1569,9 @@ int tts_unset_error_cb(tts_h tts)
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset error cb : A handle is not valid");
                return TTS_ERROR_INVALID_PARAMETER;
        }
-       
+
        if (TTS_STATE_CREATED != client->current_state) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset error cb : Current state is not 'Created'."); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset error cb : Current state is not 'Created'.");
                return TTS_ERROR_INVALID_STATE;
        }
 
@@ -1606,7 +1606,7 @@ int tts_set_default_voice_changed_cb(tts_h tts, tts_default_voice_changed_cb cal
        }
 
        if (TTS_STATE_CREATED != client->current_state) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set default voice changed cb : Current state is not 'Created'."); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set default voice changed cb : Current state is not 'Created'.");
                return TTS_ERROR_INVALID_STATE;
        }
 
@@ -1641,7 +1641,7 @@ int tts_unset_default_voice_changed_cb(tts_h tts)
        }
 
        if (TTS_STATE_CREATED != client->current_state) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset default voice changed cb : Current state is not 'Created'."); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset default voice changed cb : Current state is not 'Created'.");
                return TTS_ERROR_INVALID_STATE;
        }
 
index 56c5972..bd03627 100644 (file)
@@ -106,8 +106,7 @@ int tts_client_destroy(tts_h tts)
                        if (tts->handle == data->tts->handle) {
                                g_client_list = g_list_remove_link(g_client_list, iter);
 
-                               while (0 != data->cb_ref_count)
-                               {
+                               while (0 != data->cb_ref_count) {
                                        /* wait for release callback function */
                                }
                                free(data);
index 3357625..16c5eea 100644 (file)
@@ -1,5 +1,5 @@
 /*
-*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
@@ -56,13 +56,13 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
        }
 
        /* loop again if we haven't read a message */
-       if (NULL == msg) { 
+       if (NULL == msg) {
                return ECORE_CALLBACK_RENEW;
        }
 
        DBusError err;
        dbus_error_init(&err);
-       
+
        char if_name[64] = {0, };
        snprintf(if_name, 64, "%s", TTS_CLIENT_SERVICE_INTERFACE);
 
@@ -126,7 +126,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
                        SLOG(LOG_ERROR, TAG_TTSC, "<<<< Get Error message - Get arguments error (%s)", err.message);
                        dbus_error_free(&err);
                }
-               
+
                if (0 == __tts_cb_error(uid, reason, uttid)) {
                        SLOG(LOG_ERROR, TAG_TTSC, "<<<< Get Error message : uid(%d), error(%d), uttid(%d)", uid, reason, uttid);
                }
@@ -152,14 +152,14 @@ int tts_dbus_open_connection()
 
        /* connect to the DBUS system bus, and check for errors */
        g_conn_sender = dbus_bus_get_private(DBUS_BUS_SYSTEM, &err);
-       if (dbus_error_is_set(&err)) { 
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Dbus Connection Error (%s)", err.message); 
-               dbus_error_free(&err); 
+       if (dbus_error_is_set(&err)) {
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Dbus Connection Error (%s)", err.message);
+               dbus_error_free(&err);
        }
 
        if (NULL == g_conn_sender) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] fail to get dbus connection");
-               return TTS_ERROR_OPERATION_FAILED; 
+               return TTS_ERROR_OPERATION_FAILED;
        }
 
        dbus_connection_set_exit_on_disconnect(g_conn_sender, false);
@@ -208,7 +208,7 @@ int tts_dbus_open_connection()
        }
 
        g_dbus_fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, (Ecore_Fd_Cb)listener_event_callback, NULL, NULL, NULL);
-       if (NULL == g_dbus_fd_handler) { 
+       if (NULL == g_dbus_fd_handler) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to get fd handler from ecore");
                return TTS_ERROR_OPERATION_FAILED;
        }
@@ -249,27 +249,27 @@ int tts_dbus_reconnect()
 {
        bool sender_connected = dbus_connection_get_is_connected(g_conn_sender);
        bool listener_connected = dbus_connection_get_is_connected(g_conn_listener);
-       SLOG(LOG_DEBUG, TAG_TTSC, "[DBUS] Sender(%s) Listener(%s)", 
-               sender_connected ? "Connected" : "Not connected", listener_connected ? "Connected" : "Not connected");
+       SLOG(LOG_DEBUG, TAG_TTSC, "[DBUS] Sender(%s) Listener(%s)",
+                sender_connected ? "Connected" : "Not connected", listener_connected ? "Connected" : "Not connected");
 
        if (false == sender_connected || false == listener_connected) {
                tts_dbus_close_connection();
 
-               if(0 != tts_dbus_open_connection()) {
+               if (0 != tts_dbus_open_connection()) {
                        SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to reconnect");
                        return -1;
-               } 
+               }
 
                SLOG(LOG_DEBUG, TAG_TTSC, "[DBUS] Reconnect");
        }
-       
+
        return 0;
 }
 
 DBusMessage* __tts_dbus_make_message(int uid, const char* method)
 {
        if (NULL == method) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Input method is NULL"); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Input method is NULL");
                return NULL;
        }
 
@@ -302,7 +302,7 @@ DBusMessage* __tts_dbus_make_message(int uid, const char* method)
                        TTS_SR_SERVER_SERVICE_INTERFACE, 
                        method);
        } else {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Input mode is not available"); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Input mode is not available");
                return NULL;
        }
 
@@ -316,16 +316,16 @@ int tts_dbus_request_hello(int uid)
        DBusMessage* msg;
 
        msg = __tts_dbus_make_message(uid, TTS_METHOD_HELLO);
-       
+
        if (dbus_error_is_set(&err)) {
                SLOG(LOG_DEBUG, TAG_TTSC, "<<<< tts dbus log : %s", err);
                dbus_error_free(&err);
        }
 
-       if (NULL == msg) { 
+       if (NULL == msg) {
                SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts hello : Fail to make message");
                return TTS_ERROR_OPERATION_FAILED;
-       } 
+       }
 
        DBusMessage* result_msg = NULL;
        int result = 0;
@@ -357,7 +357,7 @@ int tts_dbus_request_initialize(int uid)
 
        msg = __tts_dbus_make_message(uid, TTS_METHOD_INITIALIZE);
 
-       if (NULL == msg) { 
+       if (NULL == msg) {
                SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts initialize : Fail to make message");
                return TTS_ERROR_OPERATION_FAILED;
        } else {
@@ -367,7 +367,7 @@ int tts_dbus_request_initialize(int uid)
        int pid = getpid();
        if (true != dbus_message_append_args(msg, DBUS_TYPE_INT32, &pid, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID)) {
                dbus_message_unref(msg);
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to append args"); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to append args");
 
                return TTS_ERROR_OPERATION_FAILED;
        }
@@ -387,9 +387,9 @@ int tts_dbus_request_initialize(int uid)
                                  DBUS_TYPE_INT32, &result,
                                  DBUS_TYPE_INVALID);
 
-               if (dbus_error_is_set(&err)) { 
+               if (dbus_error_is_set(&err)) {
                        SLOG(LOG_ERROR, TAG_TTSC, "<<<< Get arguments error (%s)", err.message);
-                       dbus_error_free(&err); 
+                       dbus_error_free(&err);
                        result = TTS_ERROR_OPERATION_FAILED;
                }
 
@@ -418,8 +418,8 @@ int tts_dbus_request_finalize(int uid)
 
        msg = __tts_dbus_make_message(uid, TTS_METHOD_FINALIZE);
 
-       if (NULL == msg) { 
-               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts finalize : Fail to make message"); 
+       if (NULL == msg) {
+               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts finalize : Fail to make message");
                return TTS_ERROR_OPERATION_FAILED;
        } else {
                SLOG(LOG_DEBUG, TAG_TTSC, ">>>> Request tts finalize : uid(%d)", uid);
@@ -427,7 +427,7 @@ int tts_dbus_request_finalize(int uid)
 
        if (true != dbus_message_append_args(msg, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID)) {
                dbus_message_unref(msg);
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to append args"); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to append args");
 
                return TTS_ERROR_OPERATION_FAILED;
        }
@@ -445,9 +445,9 @@ int tts_dbus_request_finalize(int uid)
        if (NULL != result_msg) {
                dbus_message_get_args(result_msg, &err, DBUS_TYPE_INT32, &result, DBUS_TYPE_INVALID);
 
-               if (dbus_error_is_set(&err)) { 
+               if (dbus_error_is_set(&err)) {
                        SLOG(LOG_ERROR, TAG_TTSC, "<<<< Get arguments error (%s)", err.message);
-                       dbus_error_free(&err); 
+                       dbus_error_free(&err);
                        result = TTS_ERROR_OPERATION_FAILED;
                }
 
@@ -480,15 +480,15 @@ int tts_dbus_request_add_text(int uid, const char* text, const char* lang, int v
 
        msg = __tts_dbus_make_message(uid, TTS_METHOD_ADD_QUEUE);
 
-       if (NULL == msg) { 
-               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts add text : Fail to make message"); 
+       if (NULL == msg) {
+               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts add text : Fail to make message");
                return TTS_ERROR_OPERATION_FAILED;
        } else {
-               SLOG(LOG_DEBUG, TAG_TTSC, ">>>> Request tts add text : uid(%d), text(%s), lang(%s), type(%d), speed(%d), id(%d)", 
-                       uid, text, lang, vctype, speed, uttid);
+               SLOG(LOG_DEBUG, TAG_TTSC, ">>>> Request tts add text : uid(%d), text(%s), lang(%s), type(%d), speed(%d), id(%d)",
+                        uid, text, lang, vctype, speed, uttid);
        }
 
-       if (true != dbus_message_append_args( msg, 
+       if (true != dbus_message_append_args(msg,
                DBUS_TYPE_INT32, &uid,
                DBUS_TYPE_STRING, &text,
                DBUS_TYPE_STRING, &lang,
@@ -497,7 +497,7 @@ int tts_dbus_request_add_text(int uid, const char* text, const char* lang, int v
                DBUS_TYPE_INT32, &uttid,
                DBUS_TYPE_INVALID)) {
                dbus_message_unref(msg);
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to append args"); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to append args");
 
                return TTS_ERROR_OPERATION_FAILED;
        }
@@ -517,18 +517,18 @@ int tts_dbus_request_add_text(int uid, const char* text, const char* lang, int v
                        DBUS_TYPE_INT32, &result,
                        DBUS_TYPE_INVALID);
 
-               if (dbus_error_is_set(&err)) { 
+               if (dbus_error_is_set(&err)) {
                        SLOG(LOG_ERROR, TAG_TTSC, "<<<< tts add text : Get arguments error (%s)", err.message);
-                       dbus_error_free(&err); 
+                       dbus_error_free(&err);
                        result = TTS_ERROR_OPERATION_FAILED;
                }
                dbus_message_unref(result_msg);
-               
+
                if (0 == result) {
                        SLOG(LOG_DEBUG, TAG_TTSC, "<<<< tts add text : result(%d)", result);
                } else {
                        SLOG(LOG_ERROR, TAG_TTSC, "<<<< tts add text : result(%d)", result);
-               }       
+               }
        } else {
                SLOG(LOG_ERROR, TAG_TTSC, "<<<< Result message is NULL ");
                tts_dbus_reconnect();
@@ -538,7 +538,7 @@ int tts_dbus_request_add_text(int uid, const char* text, const char* lang, int v
        return result;
 }
 
-int tts_dbus_request_play(int uid) 
+int tts_dbus_request_play(int uid)
 {
        DBusMessage* msg;
        DBusError err;
@@ -546,16 +546,16 @@ int tts_dbus_request_play(int uid)
 
        msg = __tts_dbus_make_message(uid, TTS_METHOD_PLAY);
 
-       if (NULL == msg) { 
-               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts play : Fail to make message"); 
+       if (NULL == msg) {
+               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts play : Fail to make message");
                return TTS_ERROR_OPERATION_FAILED;
        } else {
                SLOG(LOG_DEBUG, TAG_TTSC, ">>>> Request tts play : uid(%d)", uid);
        }
-       
+
        if (true != dbus_message_append_args(msg, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID)) {
                dbus_message_unref(msg);
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to append args"); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to append args");
 
                return TTS_ERROR_OPERATION_FAILED;
        }
@@ -575,9 +575,9 @@ int tts_dbus_request_play(int uid)
                        DBUS_TYPE_INT32, &result,
                        DBUS_TYPE_INVALID);
 
-               if (dbus_error_is_set(&err)) { 
+               if (dbus_error_is_set(&err)) {
                        SLOG(LOG_ERROR, TAG_TTSC, "<<<< tts play : Get arguments error (%s)", err.message);
-                       dbus_error_free(&err); 
+                       dbus_error_free(&err);
                        result = TTS_ERROR_OPERATION_FAILED;
                }
                dbus_message_unref(result_msg);
@@ -604,8 +604,8 @@ int tts_dbus_request_stop(int uid)
 
        msg = __tts_dbus_make_message(uid, TTS_METHOD_STOP);
 
-       if (NULL == msg) { 
-               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts stop : Fail to make message"); 
+       if (NULL == msg) {
+               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts stop : Fail to make message");
                return TTS_ERROR_OPERATION_FAILED;
        } else {
                SLOG(LOG_DEBUG, TAG_TTSC, ">>>> Request tts stop : uid(%d)", uid);
@@ -616,7 +616,7 @@ int tts_dbus_request_stop(int uid)
 
        if (true != dbus_message_append_args(msg, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID)) {
                dbus_message_unref(msg);
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to append args"); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to append args");
 
                return TTS_ERROR_OPERATION_FAILED;
        }
@@ -633,9 +633,9 @@ int tts_dbus_request_stop(int uid)
                        DBUS_TYPE_INT32, &result,
                        DBUS_TYPE_INVALID);
 
-               if (dbus_error_is_set(&err)) { 
+               if (dbus_error_is_set(&err)) {
                        SLOG(LOG_ERROR, TAG_TTSC, "<<<< tts stop : Get arguments error (%s)", err.message);
-                       dbus_error_free(&err); 
+                       dbus_error_free(&err);
                        result = TTS_ERROR_OPERATION_FAILED;
                }
                dbus_message_unref(result_msg);
@@ -662,8 +662,8 @@ int tts_dbus_request_pause(int uid)
 
        msg = __tts_dbus_make_message(uid, TTS_METHOD_PAUSE);
 
-       if (NULL == msg) { 
-               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts pause : Fail to make message"); 
+       if (NULL == msg) {
+               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts pause : Fail to make message");
                return TTS_ERROR_OPERATION_FAILED;
        } else {
                SLOG(LOG_DEBUG, TAG_TTSC, ">>>> Request tts pause : uid(%d)", uid);
@@ -674,7 +674,7 @@ int tts_dbus_request_pause(int uid)
 
        if (true != dbus_message_append_args(msg, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID)) {
                dbus_message_unref(msg);
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to append args"); 
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to append args");
 
                return TTS_ERROR_OPERATION_FAILED;
        }
@@ -691,9 +691,9 @@ int tts_dbus_request_pause(int uid)
                        DBUS_TYPE_INT32, &result,
                        DBUS_TYPE_INVALID);
 
-               if (dbus_error_is_set(&err)) { 
+               if (dbus_error_is_set(&err)) {
                        SLOG(LOG_ERROR, TAG_TTSC, "<<<< tts pause : Get arguments error (%s)", err.message);
-                       dbus_error_free(&err); 
+                       dbus_error_free(&err);
                        result = TTS_ERROR_OPERATION_FAILED;
                }
                dbus_message_unref(result_msg);
index 911e17b..4dc9b14 100644 (file)
@@ -1,5 +1,5 @@
 /*
-*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 #include "tts_main.h"
 #include "tts_setting.h"
 
-/** 
+/**
 * @brief Enumerations of setting state.
 */
 typedef enum {
        TTS_SETTING_STATE_NONE = 0,
        TTS_SETTING_STATE_READY
-}tts_setting_state_e;
+} tts_setting_state_e;
 
 
 static tts_setting_state_e g_state = TTS_SETTING_STATE_NONE;
@@ -70,8 +70,8 @@ static int __setting_convert_config_error_code(tts_config_error_e code)
 
 void __setting_config_engine_changed_cb(const char* engine_id, const char* setting, const char* language, int voice_type, bool auto_voice, void* user_data)
 {
-       SLOG(LOG_DEBUG, TAG_TTSC, "Engine chagned : engine(%s) setting(%s) lang(%s) type(%d)", 
-               engine_id, setting, language, language, voice_type);
+       SLOG(LOG_DEBUG, TAG_TTSC, "Engine chagned : engine(%s) setting(%s) lang(%s) type(%d)",
+                engine_id, setting, language, language, voice_type);
 
        if (NULL != g_engine_changed_cb)
                g_engine_changed_cb(engine_id, g_engine_changed_user_data);
@@ -172,7 +172,7 @@ bool __tts_config_mgr_get_engine_list(const char* engine_id, const char* engine_
 }
 
 int tts_setting_foreach_supported_engines(tts_setting_supported_engine_cb callback, void* user_data)
-{    
+{
        SLOG(LOG_DEBUG, TAG_TTSC, "===== Foreach supported engines");
 
        if (TTS_SETTING_STATE_NONE == g_state) {
@@ -255,10 +255,10 @@ int tts_setting_set_engine(const char* engine_id)
        } else {
                SECURE_SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Set current engine : %s", engine_id);
        }
-       
+
        SLOG(LOG_DEBUG, TAG_TTSC, "=====");
        SLOG(LOG_DEBUG, TAG_TTSC, " ");
-    
+
        return __setting_convert_config_error_code(ret);
 }
 
@@ -350,12 +350,12 @@ int tts_setting_set_voice(const char* language, int voice_type)
        if (0 != ret) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Result : %d", ret);
        } else {
-               SECURE_SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Set default voice : lang(%s) type(%d)",language, voice_type);
+               SECURE_SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Set default voice : lang(%s) type(%d)", language, voice_type);
        }
 
        SLOG(LOG_DEBUG, TAG_TTSC, "=====");
        SLOG(LOG_DEBUG, TAG_TTSC, " ");
-    
+
        return __setting_convert_config_error_code(ret);
 }
 
@@ -488,7 +488,7 @@ int tts_setting_set_speed(int speed)
        } else {
                SECURE_SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Set default speed, %d", speed);
        }
-       
+
        SLOG(LOG_DEBUG, TAG_TTSC, "=====");
        SLOG(LOG_DEBUG, TAG_TTSC, " ");
 
index 3f4575d..371cdbf 100644 (file)
@@ -1,5 +1,5 @@
 /*
-*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
@@ -33,7 +33,7 @@ typedef struct {
        tts_config_screen_reader_changed_cb     screen_cb;
        tts_config_pitch_changed_cb             pitch_cb;
        void*   user_data;
-}tts_config_client_s;
+} tts_config_client_s;
 
 extern char* tts_tag();
 
@@ -91,7 +91,7 @@ int __tts_config_mgr_check_engine_is_valid(const char* engine_id)
        /* Change default engine */
        iter = g_slist_nth(g_engine_list, 0);
        engine_info = iter->data;
-       
+
        if (NULL != g_config_info->engine_id)   free(g_config_info->engine_id);
        if (NULL != g_config_info->setting)     free(g_config_info->setting);
 
@@ -111,7 +111,7 @@ int __tts_config_mgr_check_engine_is_valid(const char* engine_id)
        while (NULL != iter_voice) {
                /*Get handle data from list*/
                voice = iter_voice->data;
-               
+
                if (NULL != voice && NULL != g_config_info) {
                        if (NULL != voice->language && NULL != g_config_info->language) {
                                if (0 == strcmp(voice->language, g_config_info->language)) {
@@ -147,7 +147,7 @@ int __tts_config_mgr_check_engine_is_valid(const char* engine_id)
                }
        }
 
-       if ( 0 != tts_parser_set_engine(g_config_info->engine_id, g_config_info->setting, 
+       if (0 != tts_parser_set_engine(g_config_info->engine_id, g_config_info->setting, 
                g_config_info->language, g_config_info->type)) {
                SLOG(LOG_ERROR, tts_tag(), " Fail to save config");
                return TTS_CONFIG_ERROR_OPERATION_FAILED;
@@ -195,7 +195,7 @@ bool __tts_config_mgr_check_lang_is_valid(const char* engine_id, const char* lan
                        iter = g_slist_next(iter);
                        return false;
                }
-               
+
                /* Get a first item */
                iter_voice = g_slist_nth(engine_info->voices, 0);
 
@@ -211,7 +211,7 @@ bool __tts_config_mgr_check_lang_is_valid(const char* engine_id, const char* lan
                                        }
                                }
                        }
-                       
+
                        /*Get next item*/
                        iter_voice = g_slist_next(iter_voice);
                        i++;
@@ -237,7 +237,7 @@ int __tts_config_mgr_select_lang(const char* engine_id, char** language, int* ty
                SLOG(LOG_ERROR, tts_tag(), "There is no engine!!");
                return false;
        }
-       
+
        /* Get a first item */
        iter = g_slist_nth(g_engine_list, 0);
 
@@ -248,7 +248,7 @@ int __tts_config_mgr_select_lang(const char* engine_id, char** language, int* ty
                        SLOG(LOG_ERROR, tts_tag(), "engine info is NULL");
                        return false;
                }
-               
+
                if (0 != strcmp(engine_id, engine_info->uuid)) {
                        iter = g_slist_next(iter);
                        continue;
@@ -402,7 +402,7 @@ Eina_Bool tts_config_mgr_inotify_event_cb(void* data, Ecore_Fd_Handler *fd_handl
 
                                iter = g_slist_next(iter);
                        }
-                       
+
                        if (NULL != before_lang) {
                                free(before_lang);
                        }
@@ -481,8 +481,8 @@ int __tts_config_mgr_register_config_event()
        wd = inotify_add_watch(fd, TTS_CONFIG, IN_CLOSE_WRITE);
        g_config_wd_noti = wd;
 
-       g_config_fd_handler_noti = ecore_main_fd_handler_add(fd, ECORE_FD_READ, 
-               (Ecore_Fd_Cb)tts_config_mgr_inotify_event_cb, NULL, NULL, NULL);                
+       g_config_fd_handler_noti = ecore_main_fd_handler_add(fd, ECORE_FD_READ,
+               (Ecore_Fd_Cb)tts_config_mgr_inotify_event_cb, NULL, NULL, NULL);
        if (NULL == g_config_fd_handler_noti) {
                SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to get handler_noti");
                return -1;
@@ -492,7 +492,7 @@ int __tts_config_mgr_register_config_event()
        int value;
        value = fcntl(fd, F_GETFL, 0);
        value |= O_NONBLOCK;
-       
+
        if (0 > fcntl(fd, F_SETFL, value)) {
                SLOG(LOG_WARN, tts_tag(), "[WARNING] Fail to set non-block mode");
        }
@@ -860,7 +860,7 @@ static Eina_Bool __tts_config_mgr_engine_config_inotify_event_callback(void* dat
                        if (0 != ret) {
                                SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to get voice");
                        }
-                       
+
                        ret = tts_config_mgr_set_voice(temp_lang, temp_type);
                        if (0 != ret) {
                                SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to set voice");
@@ -904,7 +904,7 @@ static int __tts_config_mgr_register_engine_config_updated_event()
        int value;
        value = fcntl(g_dir_fd, F_GETFL, 0);
        value |= O_NONBLOCK;
-       
+
        if (0 > fcntl(g_dir_fd, F_SETFL, value)) {
                SLOG(LOG_WARN, tts_tag(), "[WARNING] Fail to set non-block mode");
        }
@@ -979,9 +979,9 @@ int tts_config_mgr_initialize(int uid)
                SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to parse configure information");
                __tts_config_release_client(uid);
                __tts_config_release_engine();
-               return TTS_CONFIG_ERROR_OPERATION_FAILED; 
+               return TTS_CONFIG_ERROR_OPERATION_FAILED;
        }
-       
+
        /* Check whether engine id is valid */
        if (0 != __tts_config_mgr_check_engine_is_valid(g_config_info->engine_id)) {
                SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to get default engine");
@@ -990,7 +990,7 @@ int tts_config_mgr_initialize(int uid)
                tts_parser_unload_config(g_config_info);
                return TTS_CONFIG_ERROR_ENGINE_NOT_FOUND;
        }
-       
+
        if (true == g_config_info->auto_voice) {
                /* Check language with display language */
                __tts_config_set_auto_language();
@@ -1263,7 +1263,7 @@ int tts_config_mgr_get_engine(char** engine)
                        }
                        iter = g_slist_next(iter);
                }
-               
+
                SLOG(LOG_ERROR, tts_tag(), "[ERROR] Current engine id is not valid");
        } else {
                SLOG(LOG_ERROR, tts_tag(), "[ERROR] Engine id is NULL");
@@ -1283,7 +1283,7 @@ int tts_config_mgr_set_engine(const char* engine)
                return TTS_CONFIG_ERROR_INVALID_PARAMETER;
 
        /* Check current engine id with new engine id */
-       if (0 == strcmp(g_config_info->engine_id, engine)) 
+       if (0 == strcmp(g_config_info->engine_id, engine))
                return 0;
 
        if (0 >= g_slist_length(g_engine_list)) {
@@ -1337,7 +1337,7 @@ int tts_config_mgr_set_engine(const char* engine)
                while (NULL != iter_voice) {
                        /*Get handle data from list*/
                        voice = iter_voice->data;
-                       
+
                        if (NULL != voice) {
                                if (NULL == voice->language)
                                        continue;
@@ -1389,8 +1389,8 @@ int tts_config_mgr_set_engine(const char* engine)
                SECURE_SLOG(LOG_DEBUG, tts_tag(), "  Setting : %s", g_config_info->setting);
                SECURE_SLOG(LOG_DEBUG, tts_tag(), "  Language : %s", g_config_info->language);
                SECURE_SLOG(LOG_DEBUG, tts_tag(), "  Type : %d", g_config_info->type);
-               
-               if ( 0 != tts_parser_set_engine(g_config_info->engine_id, g_config_info->setting, 
+
+               if (0 != tts_parser_set_engine(g_config_info->engine_id, g_config_info->setting,
                        g_config_info->language, g_config_info->type)) {
                                SLOG(LOG_ERROR, tts_tag(), " Fail to save config");
                                return TTS_CONFIG_ERROR_OPERATION_FAILED;
@@ -1436,7 +1436,7 @@ int tts_config_mgr_get_voice_list(const char* engine_id, tts_config_supported_vo
 
                GSList *iter_voice = NULL;
                tts_config_voice_s* voice = NULL;
-               
+
                /* Get a first item */
                iter_voice = g_slist_nth(engine_info->voices, 0);
 
@@ -1449,7 +1449,7 @@ int tts_config_mgr_get_voice_list(const char* engine_id, tts_config_supported_vo
                                if (false == callback(engine_info->uuid, voice->language, voice->type, user_data))
                                        break;
                        }
-                       
+
                        /*Get next item*/
                        iter_voice = g_slist_next(iter_voice);
                }
@@ -1564,7 +1564,7 @@ int tts_config_mgr_get_speech_rate(int* value)
                SLOG(LOG_ERROR, tts_tag(), "Not initialized");
                return TTS_CONFIG_ERROR_INVALID_PARAMETER;
        }
-       
+
        if (NULL == value) {
                return TTS_CONFIG_ERROR_INVALID_PARAMETER;
        }
@@ -1592,7 +1592,7 @@ int tts_config_mgr_set_speech_rate(int value)
        } else {
                SLOG(LOG_ERROR, tts_tag(), "[Config ERROR] Speech rate is invalid : %d", value);
        }
-       
+
        return 0;
 }
 
@@ -1625,7 +1625,7 @@ int tts_config_mgr_get_pitch(int* value)
                        SLOG(LOG_ERROR, tts_tag(), "engine info is NULL");
                        return TTS_CONFIG_ERROR_OPERATION_FAILED;
                }
-               
+
                if (0 != strcmp(g_config_info->engine_id, engine_info->uuid)) {
                        iter = g_slist_next(iter);
                        continue;
@@ -1657,7 +1657,7 @@ int tts_config_mgr_set_pitch(int value)
                SLOG(LOG_ERROR, tts_tag(), "[ERROR] There is no engine!!");
                return TTS_CONFIG_ERROR_ENGINE_NOT_FOUND;
        }
-       
+
        /* Get a first item */
        iter = g_slist_nth(g_engine_list, 0);
 
@@ -1668,7 +1668,7 @@ int tts_config_mgr_set_pitch(int value)
                        SLOG(LOG_ERROR, tts_tag(), "engine info is NULL");
                        return TTS_CONFIG_ERROR_OPERATION_FAILED;
                }
-               
+
                if (0 != strcmp(g_config_info->engine_id, engine_info->uuid)) {
                        iter = g_slist_next(iter);
                        continue;
@@ -1685,7 +1685,7 @@ int tts_config_mgr_set_pitch(int value)
                SLOG(LOG_ERROR, tts_tag(), "Fail to save speech rate");
                return TTS_CONFIG_ERROR_OPERATION_FAILED;
        }
-       
+
        g_config_info->pitch = value;
 
        return 0;
@@ -1701,7 +1701,7 @@ bool tts_config_check_default_engine_is_valid(const char* engine)
        if (NULL == engine)
                return false;
 
-       if (0 >= g_slist_length(g_engine_list)) 
+       if (0 >= g_slist_length(g_engine_list))
                return false;
 
        GSList *iter = NULL;
@@ -1739,7 +1739,7 @@ bool tts_config_check_default_voice_is_valid(const char* language, int type)
                return false;
        }
 
-       if (0 >= g_slist_length(g_engine_list)) 
+       if (0 >= g_slist_length(g_engine_list))
                return false;
 
        GSList *iter = NULL;
@@ -1770,7 +1770,7 @@ bool tts_config_check_default_voice_is_valid(const char* language, int type)
 
                while (NULL != iter_voice) {
                        voice = iter_voice->data;
-                       
+
                        if (0 == strcmp(language, voice->language) && voice->type == type)
                                return true;
 
@@ -1802,7 +1802,7 @@ int __tts_config_mgr_print_engine_info()
 
        SLOG(LOG_DEBUG, tts_tag(), "--------------- engine list -----------------");
 
-       int i = 1;      
+       int i = 1;
        while (NULL != iter) {
                engine_info = iter->data;
 
index 37fc2b4..f15c6d4 100644 (file)
@@ -1,5 +1,5 @@
 /*
-*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
@@ -35,7 +35,7 @@ static char *g_service_interface = NULL;
 
 const char* __ttsd_get_error_code(ttsd_error_e err)
 {
-       switch(err) {
+       switch (err) {
        case TTSD_ERROR_NONE:                   return "TTS_ERROR_NONE";
        case TTSD_ERROR_OUT_OF_MEMORY:          return "TTS_ERROR_OUT_OF_MEMORY";
        case TTSD_ERROR_IO_ERROR:               return "TTS_ERROR_IO_ERROR";
@@ -58,17 +58,17 @@ int ttsdc_send_hello(int pid, int uid)
 {
 #if 0
        if (NULL == g_conn_sender) {
-               SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] Dbus connection is not available" );
+               SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] Dbus connection is not available");
                return -1;
        }
 
        char service_name[64];
        memset(service_name, 0, 64);
-       //snprintf(service_name, 64, "%s%d", TTS_CLIENT_SERVICE_NAME, pid);
+       /*snprintf(service_name, 64, "%s%d", TTS_CLIENT_SERVICE_NAME, pid); */
        snprintf(service_name, 64, "%s", TTS_CLIENT_SERVICE_NAME);
 
        char target_if_name[64];
-       //snprintf(target_if_name, sizeof(target_if_name), "%s%d", TTS_CLIENT_SERVICE_INTERFACE, pid);
+       /*snprintf(target_if_name, sizeof(target_if_name), "%s%d", TTS_CLIENT_SERVICE_INTERFACE, pid); */
        snprintf(target_if_name, sizeof(target_if_name), "%s", TTS_CLIENT_SERVICE_INTERFACE);
 
        DBusMessage* msg;
@@ -166,7 +166,7 @@ int ttsdc_send_utt_start_message(int pid, int uid, int uttid)
        return ttsdc_send_message(pid, uid, uttid, TTSD_METHOD_UTTERANCE_STARTED);
 }
 
-int ttsdc_send_utt_finish_message(int pid, int uid, int uttid) 
+int ttsdc_send_utt_finish_message(int pid, int uid, int uttid)
 {
        return ttsdc_send_message(pid, uid, uttid, TTSD_METHOD_UTTERANCE_COMPLETED);
 }
@@ -179,7 +179,7 @@ int ttsdc_send_set_state_message(int pid, int uid, int state)
 int ttsdc_send_error_message(int pid, int uid, int uttid, int reason)
 {
        if (NULL == g_conn_sender) {
-               SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] Dbus connection is not available" );
+               SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] Dbus connection is not available");
                return -1;
        }
 
@@ -203,7 +203,7 @@ int ttsdc_send_error_message(int pid, int uid, int uttid, int reason)
                return -1;
        }
 
-       dbus_message_append_args( msg, 
+       dbus_message_append_args(msg,
                DBUS_TYPE_INT32, &uid, 
                DBUS_TYPE_INT32, &uttid, 
                DBUS_TYPE_INT32, &reason, 
@@ -214,8 +214,8 @@ int ttsdc_send_error_message(int pid, int uid, int uttid, int reason)
        if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
                SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] <<<< error message : Out Of Memory !");
        } else {
-               SLOG(LOG_DEBUG, get_tag(), "<<<< Send error message : uid(%d), reason(%s), uttid(%d)", 
-                       uid, __ttsd_get_error_code(reason), uttid);
+               SLOG(LOG_DEBUG, get_tag(), "<<<< Send error message : uid(%d), reason(%s), uttid(%d)",
+                        uid, __ttsd_get_error_code(reason), uttid);
                dbus_connection_flush(g_conn_sender);
        }
 
@@ -249,10 +249,10 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
 
        } else if (dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_INITIALIZE)) {
                ttsd_dbus_server_initialize(g_conn_listener, msg);
-       
+
        } else if (dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_FINALIZE)) {
                ttsd_dbus_server_finalize(g_conn_listener, msg);
-       
+
        } else if (dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_GET_SUPPORT_VOICES)) {
                ttsd_dbus_server_get_support_voices(g_conn_listener, msg);
 
@@ -264,7 +264,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
 
        } else if (dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_PLAY)) {
                ttsd_dbus_server_play(g_conn_listener, msg);
-       
+
        } else if (dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_STOP)) {
                ttsd_dbus_server_stop(g_conn_listener, msg);
 
@@ -335,7 +335,7 @@ int ttsd_dbus_open_connection()
 
                snprintf(g_service_name, strlen(TTS_SERVER_SERVICE_NAME) + 1, "%s", TTS_SERVER_SERVICE_NAME);
                snprintf(g_service_object, strlen(TTS_SERVER_SERVICE_OBJECT_PATH) + 1, "%s", TTS_SERVER_SERVICE_OBJECT_PATH);
-               snprintf(g_service_interface, strlen(TTS_SERVER_SERVICE_INTERFACE)+ 1, "%s", TTS_SERVER_SERVICE_INTERFACE);
+               snprintf(g_service_interface, strlen(TTS_SERVER_SERVICE_INTERFACE) + 1, "%s", TTS_SERVER_SERVICE_INTERFACE);
        }
 
        /* request our name on the bus and check for errors */
@@ -386,7 +386,7 @@ int ttsd_dbus_close_connection()
                g_dbus_fd_handler = NULL;
        }
 
-       dbus_bus_release_name (g_conn_listener, g_service_name, &err);
+       dbus_bus_release_name(g_conn_listener, g_service_name, &err);
        if (dbus_error_is_set(&err)) {
                SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] dbus_bus_release_name() : %s", err.message);
                dbus_error_free(&err);
index ee875cb..c720e1d 100644 (file)
@@ -1,5 +1,5 @@
 /*
-*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
@@ -37,7 +37,7 @@ int ttsd_dbus_server_hello(DBusConnection* conn, DBusMessage* msg)
                dbus_connection_flush(conn);
                dbus_message_unref(reply);
        } else {
-               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] Fail to create reply message!!"); 
+               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] Fail to create reply message!!");
        }
 
        return 0;
@@ -49,7 +49,7 @@ int ttsd_dbus_server_initialize(DBusConnection* conn, DBusMessage* msg)
        dbus_error_init(&err);
 
        int pid, uid;
-       int ret = 0; 
+       int ret = 0;
 
        dbus_message_get_args(msg, &err,
                DBUS_TYPE_INT32, &pid,
@@ -58,13 +58,13 @@ int ttsd_dbus_server_initialize(DBusConnection* conn, DBusMessage* msg)
 
        SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS INITIALIZE");
 
-       if (dbus_error_is_set(&err)) { 
+       if (dbus_error_is_set(&err)) {
                SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts initialize : get arguments error (%s)", err.message);
-               dbus_error_free(&err); 
+               dbus_error_free(&err);
                ret = TTSD_ERROR_OPERATION_FAILED;
        } else {
 
-               SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts initialize : pid(%d), uid(%d)", pid , uid); 
+               SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts initialize : pid(%d), uid(%d)", pid , uid);
                ret =  ttsd_server_initialize(pid, uid);
        }
 
@@ -75,9 +75,9 @@ int ttsd_dbus_server_initialize(DBusConnection* conn, DBusMessage* msg)
                dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
 
                if (0 == ret) {
-                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts initialize : result(%d)", ret); 
+                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts initialize : result(%d)", ret);
                } else {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts initialize : result(%d)", ret); 
+                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts initialize : result(%d)", ret);
                }
 
                if (!dbus_connection_send(conn, reply, NULL)) {
@@ -87,7 +87,7 @@ int ttsd_dbus_server_initialize(DBusConnection* conn, DBusMessage* msg)
                dbus_connection_flush(conn);
                dbus_message_unref(reply);
        } else {
-               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts initialize : Fail to create reply message!!"); 
+               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts initialize : Fail to create reply message!!");
        }
 
        return 0;
@@ -99,18 +99,18 @@ int ttsd_dbus_server_finalize(DBusConnection* conn, DBusMessage* msg)
        dbus_error_init(&err);
 
        int uid;
-       int ret = 0; 
+       int ret = 0;
 
        dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
 
        SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS FINALIZE");
 
-       if (dbus_error_is_set(&err)) { 
+       if (dbus_error_is_set(&err)) {
                SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts finalize : get arguments error (%s)", err.message);
-               dbus_error_free(&err); 
+               dbus_error_free(&err);
                ret = TTSD_ERROR_OPERATION_FAILED;
        } else {
-               SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts finalize : uid(%d)", uid); 
+               SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts finalize : uid(%d)", uid);
                ret =  ttsd_server_finalize(uid);
        }
 
@@ -121,9 +121,9 @@ int ttsd_dbus_server_finalize(DBusConnection* conn, DBusMessage* msg)
                dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
 
                if (0 == ret) {
-                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts finalize : result(%d)", ret); 
+                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts finalize : result(%d)", ret);
                } else {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts finalize : result(%d)", ret); 
+                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts finalize : result(%d)", ret);
                }
 
                if (!dbus_connection_send(conn, reply, NULL)) {
@@ -133,7 +133,7 @@ int ttsd_dbus_server_finalize(DBusConnection* conn, DBusMessage* msg)
                dbus_connection_flush(conn);
                dbus_message_unref(reply);
        } else {
-               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts finalize : Fail to create reply message!!"); 
+               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts finalize : Fail to create reply message!!");
        }
 
        return 0;
@@ -152,12 +152,12 @@ int ttsd_dbus_server_get_support_voices(DBusConnection* conn, DBusMessage* msg)
 
        SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS GET VOICES");
 
-       if (dbus_error_is_set(&err)) { 
+       if (dbus_error_is_set(&err)) {
                SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts get supported voices : get arguments error (%s)", err.message);
-               dbus_error_free(&err); 
+               dbus_error_free(&err);
                ret = TTSD_ERROR_OPERATION_FAILED;
        } else {
-               SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] get supported voices : uid(%d)", uid ); 
+               SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] get supported voices : uid(%d)", uid);
                ret = ttsd_server_get_support_voices(uid, &voice_list);
        }
 
@@ -174,9 +174,9 @@ int ttsd_dbus_server_get_support_voices(DBusConnection* conn, DBusMessage* msg)
                if (0 == ret) {
                        /* Append voice size */
                        int size = g_list_length(voice_list);
-                       
+
                        if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(size))) {
-                               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts supported voices : Fail to append type"); 
+                               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts supported voices : Fail to append type");
                                ret = TTSD_ERROR_OPERATION_FAILED;
                        } else {
 
@@ -189,23 +189,23 @@ int ttsd_dbus_server_get_support_voices(DBusConnection* conn, DBusMessage* msg)
                                        voice = iter->data;
 
                                        if (NULL != voice) {
-                                               dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &(voice->language) );
-                                               dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(voice->type) );
+                                               dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &(voice->language));
+                                               dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(voice->type));
 
                                                if (NULL != voice->language)
                                                        g_free(voice->language);
-                                               
+
                                                g_free(voice);
                                        }
-                                       
+
                                        voice_list = g_list_remove_link(voice_list, iter);
 
                                        iter = g_list_first(voice_list);
-                               } 
+                               }
                        }
-                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts supported voices : result(%d)", ret); 
+                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts supported voices : result(%d)", ret);
                } else {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts supported voices : result(%d)", ret); 
+                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts supported voices : result(%d)", ret);
                }
 
                if (!dbus_connection_send(conn, reply, NULL)) {
@@ -215,7 +215,7 @@ int ttsd_dbus_server_get_support_voices(DBusConnection* conn, DBusMessage* msg)
                dbus_connection_flush(conn);
                dbus_message_unref(reply);
        } else {
-               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts supported voices : Fail to create reply message!!");                
+               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts supported voices : Fail to create reply message!!");
        }
 
        return 0;
@@ -235,12 +235,12 @@ int ttsd_dbus_server_get_current_voice(DBusConnection* conn, DBusMessage* msg)
 
        SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS GET DEFAULT VOICE");
 
-       if (dbus_error_is_set(&err)) { 
+       if (dbus_error_is_set(&err)) {
                SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts get default voice : Get arguments error (%s)", err.message);
                dbus_error_free(&err);
                ret = TTSD_ERROR_OPERATION_FAILED;
        } else {
-               SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts get default voice : uid(%d)", uid); 
+               SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts get default voice : uid(%d)", uid);
                ret = ttsd_server_get_current_voice(uid, &lang, &voice_type);
        }
 
@@ -248,16 +248,16 @@ int ttsd_dbus_server_get_current_voice(DBusConnection* conn, DBusMessage* msg)
        reply = dbus_message_new_method_return(msg);
 
        if (NULL != reply) {
-               if (0 == ret) { 
+               if (0 == ret) {
                        /* Append result and voice */
-                       dbus_message_append_args( reply, 
+                       dbus_message_append_args(reply,
                                DBUS_TYPE_INT32, &ret,
                                DBUS_TYPE_STRING, &lang,
                                DBUS_TYPE_INT32, &voice_type,
                                DBUS_TYPE_INVALID);
-                       SECURE_SLOG(LOG_DEBUG, get_tag(), "[OUT] tts default voice : lang(%s), vctype(%d)", lang, voice_type );
+                       SECURE_SLOG(LOG_DEBUG, get_tag(), "[OUT] tts default voice : lang(%s), vctype(%d)", lang, voice_type);
                } else {
-                       dbus_message_append_args( reply, 
+                       dbus_message_append_args(reply,
                                DBUS_TYPE_INT32, &ret,
                                DBUS_TYPE_INVALID);
                        SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts default voice : result(%d)", ret); 
@@ -270,7 +270,7 @@ int ttsd_dbus_server_get_current_voice(DBusConnection* conn, DBusMessage* msg)
                dbus_connection_flush(conn);
                dbus_message_unref(reply);
        } else {
-               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts default voice : Fail to create reply message!!"); 
+               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts default voice : Fail to create reply message!!");
        }
 
        if (NULL != lang)       free(lang);
@@ -297,9 +297,9 @@ int ttsd_dbus_server_add_text(DBusConnection* conn, DBusMessage* msg)
 
        SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS ADD TEXT");
 
-       if (dbus_error_is_set(&err)) { 
+       if (dbus_error_is_set(&err)) {
                SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts add text : Get arguments error (%s)", err.message);
-               dbus_error_free(&err); 
+               dbus_error_free(&err);
                ret = TTSD_ERROR_OPERATION_FAILED;
        } else {
                
@@ -315,9 +315,9 @@ int ttsd_dbus_server_add_text(DBusConnection* conn, DBusMessage* msg)
                dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
 
                if (0 == ret) {
-                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts add text : result(%d)", ret); 
+                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts add text : result(%d)", ret);
                } else {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts add text : result(%d)", ret); 
+                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts add text : result(%d)", ret);
                }
 
                if (!dbus_connection_send(conn, reply, NULL)) {
@@ -327,9 +327,9 @@ int ttsd_dbus_server_add_text(DBusConnection* conn, DBusMessage* msg)
                dbus_connection_flush(conn);
                dbus_message_unref(reply);
        } else {
-               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts add text : Fail to create reply message!!"); 
+               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts add text : Fail to create reply message!!");
        }
-       
+
        SLOG(LOG_DEBUG, get_tag(), "<<<<<");
        SLOG(LOG_DEBUG, get_tag(), "  ");
 
@@ -348,12 +348,12 @@ int ttsd_dbus_server_play(DBusConnection* conn, DBusMessage* msg)
 
        SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS PLAY");
 
-       if (dbus_error_is_set(&err)) { 
+       if (dbus_error_is_set(&err)) {
                SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts play : Get arguments error (%s)", err.message);
-               dbus_error_free(&err); 
+               dbus_error_free(&err);
                ret = TTSD_ERROR_OPERATION_FAILED;
        } else {
-               SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts play : uid(%d)", uid ); 
+               SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts play : uid(%d)", uid);
                ret =  ttsd_server_play(uid);
        }
 
@@ -364,11 +364,11 @@ int ttsd_dbus_server_play(DBusConnection* conn, DBusMessage* msg)
                dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
 
                if (0 == ret) {
-                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts play : result(%d)", ret); 
+                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts play : result(%d)", ret);
                } else {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts play : result(%d)", ret); 
+                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts play : result(%d)", ret);
                }
-       
+
                if (!dbus_connection_send(conn, reply, NULL)) {
                        SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts play : Out Of Memory!");
                }
@@ -376,7 +376,7 @@ int ttsd_dbus_server_play(DBusConnection* conn, DBusMessage* msg)
                dbus_connection_flush(conn);
                dbus_message_unref(reply);
        } else {
-               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts play : Fail to create reply message!!"); 
+               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts play : Fail to create reply message!!");
        }
 
        SLOG(LOG_DEBUG, get_tag(), "<<<<<");
@@ -398,9 +398,9 @@ int ttsd_dbus_server_stop(DBusConnection* conn, DBusMessage* msg)
 
        SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS STOP");
 
-       if (dbus_error_is_set(&err)) { 
+       if (dbus_error_is_set(&err)) {
                SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts stop : Get arguments error (%s)", err.message);
-               dbus_error_free(&err); 
+               dbus_error_free(&err);
                ret = TTSD_ERROR_OPERATION_FAILED;
        } else {
                SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts stop : uid(%d)", uid);
@@ -416,9 +416,9 @@ int ttsd_dbus_server_stop(DBusConnection* conn, DBusMessage* msg)
                        DBUS_TYPE_INVALID);
 
                if (0 == ret) {
-                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts stop : result(%d)", ret); 
+                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts stop : result(%d)", ret);
                } else {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts stop : result(%d)", ret); 
+                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts stop : result(%d)", ret);
                }
 
                if (!dbus_connection_send(conn, reply, NULL)) {
@@ -428,7 +428,7 @@ int ttsd_dbus_server_stop(DBusConnection* conn, DBusMessage* msg)
                dbus_connection_flush(conn);
                dbus_message_unref(reply);
        } else {
-               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts stop : Fail to create reply message!!"); 
+               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts stop : Fail to create reply message!!");
        }
 
        SLOG(LOG_DEBUG, get_tag(), "<<<<<");
@@ -451,9 +451,9 @@ int ttsd_dbus_server_pause(DBusConnection* conn, DBusMessage* msg)
 
        SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS PAUSE");
 
-       if (dbus_error_is_set(&err)) { 
+       if (dbus_error_is_set(&err)) {
                SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts pause : Get arguments error (%s)", err.message);
-               dbus_error_free(&err); 
+               dbus_error_free(&err);
                ret = TTSD_ERROR_OPERATION_FAILED;
        } else {
                SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts pause : uid(%d)", uid);
@@ -469,9 +469,9 @@ int ttsd_dbus_server_pause(DBusConnection* conn, DBusMessage* msg)
                        DBUS_TYPE_INVALID);
 
                if (0 == ret) {
-                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts pause : result(%d)", ret); 
+                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts pause : result(%d)", ret);
                } else {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts pause : result(%d)", ret); 
+                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts pause : result(%d)", ret);
                }
 
                if (!dbus_connection_send(conn, reply, NULL)) {
@@ -481,7 +481,7 @@ int ttsd_dbus_server_pause(DBusConnection* conn, DBusMessage* msg)
                dbus_connection_flush(conn);
                dbus_message_unref(reply);
        } else {
-               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts pause : Fail to create reply message!!"); 
+               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts pause : Fail to create reply message!!");
        }
 
        SLOG(LOG_DEBUG, get_tag(), "<<<<<");
index 9f0312e..77f7a95 100644 (file)
@@ -1,5 +1,5 @@
 /*
-*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 typedef struct {
        /* base info */
        char*   engine_uuid;
-       char*   engine_name; 
+       char*   engine_name;
        char*   engine_path;
 
        /* info for using engine load */
        bool    is_set;
-       bool    is_loaded;              
+       bool    is_loaded;
        bool    need_network;
        void    *handle;
 
@@ -48,7 +48,7 @@ typedef struct {
 
        int (*ttsp_load_engine)(const ttspd_funcs_s* pdfuncs, ttspe_funcs_s* pefuncs);
        int (*ttsp_unload_engine)();
-}ttsengine_s;
+} ttsengine_s;
 
 typedef struct {
        char*   engine_uuid;
@@ -56,17 +56,16 @@ typedef struct {
        char*   engine_name;
        char*   setting_ug_path;
        bool    use_network;
-}ttsengine_info_s;
+} ttsengine_info_s;
 
-typedef struct 
-{
+typedef struct {
        bool    is_default;
        bool    is_loaded;
        int     client_ref_count;
 
        char*   lang;
        int     type;
-}ttsvoice_s;
+} ttsvoice_s;
 
 
 /** Init flag */
@@ -122,7 +121,7 @@ int ttsd_print_voicelist();
 
 static const char* __ttsd_get_engine_error_code(ttsp_error_e err)
 {
-       switch(err) {
+       switch (err) {
        case TTSP_ERROR_NONE:                   return "TTSP_ERROR_NONE";
        case TTSP_ERROR_OUT_OF_MEMORY:          return "TTSP_ERROR_OUT_OF_MEMORY";
        case TTSP_ERROR_IO_ERROR:               return "TTSP_ERROR_IO_ERROR";
@@ -158,19 +157,19 @@ int ttsd_engine_agent_init(synth_result_callback result_cb)
        g_agent_init = true;
 
        if (0 != ttsd_config_get_default_voice(&(g_cur_engine.default_lang), &(g_cur_engine.default_vctype))) {
-               SLOG(LOG_WARN, get_tag(), "[Server WARNING] There is No default voice in config"); 
+               SLOG(LOG_WARN, get_tag(), "[Server WARNING] There is No default voice in config");
                /* Set default voice */
                g_cur_engine.default_lang = strdup(TTS_BASE_LANGUAGE);
                g_cur_engine.default_vctype = TTSP_VOICE_TYPE_FEMALE;
        }
 
        if (0 != ttsd_config_get_default_speed(&(g_cur_engine.default_speed))) {
-               SLOG(LOG_WARN, get_tag(), "[Server WARNING] There is No default speed in config"); 
+               SLOG(LOG_WARN, get_tag(), "[Server WARNING] There is No default speed in config");
                g_cur_engine.default_speed = TTS_SPEED_NORMAL;
        }
 
        if (0 != ttsd_config_get_default_pitch(&(g_cur_engine.default_pitch))) {
-               SLOG(LOG_WARN, get_tag(), "[Server WARNING] There is No default pitch in config"); 
+               SLOG(LOG_WARN, get_tag(), "[Server WARNING] There is No default pitch in config");
                g_cur_engine.default_pitch = TTS_PITCH_NORMAL;
        }
 
@@ -231,7 +230,7 @@ int ttsd_engine_agent_release()
 int ttsd_engine_agent_initialize_current_engine()
 {
        if (false == g_agent_init) {
-               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
+               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized");
                return TTSD_ERROR_OPERATION_FAILED;
        }
 
@@ -266,17 +265,17 @@ int ttsd_engine_agent_initialize_current_engine()
                        }
                } else {
                        SLOG(LOG_WARN, get_tag(), "[Engine Agent WARNING] Fail to set a engine of engine list");
-                       return TTSD_ERROR_OPERATION_FAILED;     
+                       return TTSD_ERROR_OPERATION_FAILED;
                }
-               
+
                is_get_engineid_from_config = false;
        } else {
                is_get_engineid_from_config = true;
        }
 
        if (NULL == cur_engine_uuid) {
-                       SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Current engine id is NULL");
-                       return TTSD_ERROR_OPERATION_FAILED;
+               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Current engine id is NULL");
+               return TTSD_ERROR_OPERATION_FAILED;
        }
 
        /* check whether cur engine uuid is valid or not. */
@@ -284,13 +283,13 @@ int ttsd_engine_agent_initialize_current_engine()
                SLOG(LOG_WARN, get_tag(), "[Engine Agent WARNING] It is not valid engine id from config");
 
                GList *iter = NULL;
-               
-               if (g_list_length(g_engine_list) > 0) 
+
+               if (g_list_length(g_engine_list) > 0)
                        iter = g_list_first(g_engine_list);
                else {
                        SLOG(LOG_WARN, get_tag(), "[Engine Agent ERROR] NO TTS Engine !!");
                        if (NULL != cur_engine_uuid)    free(cur_engine_uuid);
-                       return TTSD_ERROR_OPERATION_FAILED;     
+                       return TTSD_ERROR_OPERATION_FAILED;
                }
 
                if (cur_engine_uuid != NULL)    free(cur_engine_uuid);
@@ -302,9 +301,9 @@ int ttsd_engine_agent_initialize_current_engine()
                is_get_engineid_from_config = false;
        }
 
-       if (NULL != cur_engine_uuid) 
+       if (NULL != cur_engine_uuid)
                SECURE_SLOG(LOG_DEBUG, get_tag(), "[Engine Agent] Current Engine Id : %s", cur_engine_uuid);
-       else 
+       else
                return TTSD_ERROR_OPERATION_FAILED;
 
        /* set current engine */
@@ -312,7 +311,7 @@ int ttsd_engine_agent_initialize_current_engine()
                SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail to set current engine ");
                if (NULL != cur_engine_uuid)    free(cur_engine_uuid);
                return TTSD_ERROR_OPERATION_FAILED;
-       } 
+       }
 
        if (false == is_get_engineid_from_config) {
                if (0 != ttsd_config_set_default_engine(cur_engine_uuid)) {
@@ -322,7 +321,7 @@ int ttsd_engine_agent_initialize_current_engine()
 
        if (NULL != cur_engine_uuid)    free(cur_engine_uuid);
 
-       SLOG(LOG_DEBUG, get_tag(), "[Engine Agent SUCCESS] Set current engine"); 
+       SLOG(LOG_DEBUG, get_tag(), "[Engine Agent SUCCESS] Set current engine");
 
        return 0;
 }
@@ -338,9 +337,9 @@ int __internal_check_engine_id(const char* engine_uuid)
                while (NULL != iter) {
                        data = iter->data;
 
-                       if (0 == strncmp(engine_uuid, data->engine_uuid, strlen(data->engine_uuid))) 
+                       if (0 == strncmp(engine_uuid, data->engine_uuid, strlen(data->engine_uuid)))
                                return 0;
-       
+
                        iter = g_list_next(iter);
                }
        }
@@ -351,11 +350,11 @@ int __internal_check_engine_id(const char* engine_uuid)
 void __engine_info_cb(const char* engine_uuid, const char* engine_name, const char* setting_ug_name, 
                             bool use_network, void* user_data)
 {
-       ttsengine_info_s* temp = (ttsengine_info_s*)user_data; 
+       ttsengine_info_s* temp = (ttsengine_info_s*)user_data;
 
        if (NULL != engine_uuid)
                temp->engine_uuid = strdup(engine_uuid);
-       
+
        if (NULL != engine_name)
                temp->engine_name = strdup(engine_name);
 
@@ -374,7 +373,7 @@ int __internal_get_engine_info(const char* filepath, ttsengine_info_s** info)
        handle = dlopen(filepath, RTLD_LAZY);
 
        if (!handle) {
-               SECURE_SLOG(LOG_WARN, get_tag(), "[Engine Agent] Invalid engine : %s", filepath); 
+               SECURE_SLOG(LOG_WARN, get_tag(), "[Engine Agent] Invalid engine : %s", filepath);
                return TTSD_ERROR_OPERATION_FAILED;
        }
 
@@ -431,13 +430,13 @@ int __internal_get_engine_info(const char* filepath, ttsengine_info_s** info)
        }
 
        temp->engine_path = strdup(filepath);
-       
+
        SLOG(LOG_DEBUG, get_tag(), "----- Valid engine");
        SECURE_SLOG(LOG_DEBUG, get_tag(), "Engine uuid : %s", temp->engine_uuid);
        SECURE_SLOG(LOG_DEBUG, get_tag(), "Engine name : %s", temp->engine_name);
        SECURE_SLOG(LOG_DEBUG, get_tag(), "Setting path : %s", temp->setting_ug_path);
        SECURE_SLOG(LOG_DEBUG, get_tag(), "Engine path : %s", temp->engine_path);
-       SECURE_SLOG(LOG_DEBUG, get_tag(), "Use network : %s", temp->use_network ? "true":"false");
+       SECURE_SLOG(LOG_DEBUG, get_tag(), "Use network : %s", temp->use_network ? "true" : "false");
        SLOG(LOG_DEBUG, get_tag(), "-----");
        SLOG(LOG_DEBUG, get_tag(), "  ");
 
@@ -478,11 +477,11 @@ int __internal_update_engine_list()
                        file_size = strlen(TTS_DEFAULT_ENGINE) + strlen(dirp->d_name) + 5;
                        filepath = (char*)calloc(file_size, sizeof(char));
 
-                       if (NULL != filepath) { 
+                       if (NULL != filepath) {
                                snprintf(filepath, file_size, "%s/%s", TTS_DEFAULT_ENGINE, dirp->d_name);
                        } else {
-                               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not enough memory!!" );
-                               continue;       
+                               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not enough memory!!");
+                               continue;
                        }
 
                        /* get its info and update engine list */
@@ -511,8 +510,8 @@ int __internal_update_engine_list()
                        if (NULL != filepath) {
                                snprintf(filepath, file_size, "%s/%s", TTS_DOWNLOAD_ENGINE, dirp->d_name);
                        } else {
-                               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not enough memory!!" );
-                               continue;       
+                               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not enough memory!!");
+                               continue;
                        }
 
                        /* get its info and update engine list */
@@ -529,7 +528,7 @@ int __internal_update_engine_list()
 
        if (g_list_length(g_engine_list) <= 0) {
                SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] No Engine");
-               return TTSD_ERROR_OPERATION_FAILED;     
+               return TTSD_ERROR_OPERATION_FAILED;
        }
 
 #ifdef ENGINE_AGENT_DEBUG
@@ -650,7 +649,7 @@ int __update_voice_list()
 int ttsd_engine_agent_load_current_engine()
 {
        if (false == g_agent_init) {
-               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
+               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized");
                return TTSD_ERROR_OPERATION_FAILED;
        }
 
@@ -660,8 +659,8 @@ int ttsd_engine_agent_load_current_engine()
        }
 
        /* check whether current engine is loaded or not */
-       if (true == g_cur_engine.is_loaded ) {
-               SLOG(LOG_ERROR, get_tag(), "[Engine Agent] Engine has already been loaded " );
+       if (true == g_cur_engine.is_loaded) {
+               SLOG(LOG_ERROR, get_tag(), "[Engine Agent] Engine has already been loaded ");
                return 0;
        }
 
@@ -680,7 +679,7 @@ int ttsd_engine_agent_load_current_engine()
                return -3;
        }
 
-       g_cur_engine.ttsp_load_engine = (int (*)(const ttspd_funcs_s* , ttspe_funcs_s*) )dlsym(g_cur_engine.handle, "ttsp_load_engine");
+       g_cur_engine.ttsp_load_engine = (int (*)(const ttspd_funcs_s* , ttspe_funcs_s*))dlsym(g_cur_engine.handle, "ttsp_load_engine");
        if (NULL != (error = dlerror()) || NULL == g_cur_engine.ttsp_load_engine) {
                SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Fail to link daemon to ttsp_load_engine() : %s", error);
                return -3;
@@ -691,10 +690,10 @@ int ttsd_engine_agent_load_current_engine()
        g_cur_engine.pdfuncs->size = sizeof(ttspd_funcs_s);
 
        int ret = 0;
-       ret = g_cur_engine.ttsp_load_engine(g_cur_engine.pdfuncs, g_cur_engine.pefuncs); 
+       ret = g_cur_engine.ttsp_load_engine(g_cur_engine.pdfuncs, g_cur_engine.pefuncs);
        if (0 != ret) {
-               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail to load engine - %s : result(%s)", 
-                       g_cur_engine.engine_path, __ttsd_get_engine_error_code(ret));
+               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail to load engine - %s : result(%s)",
+                        g_cur_engine.engine_path, __ttsd_get_engine_error_code(ret));
                return TTSD_ERROR_OPERATION_FAILED;
        }
 
@@ -710,7 +709,7 @@ int ttsd_engine_agent_load_current_engine()
                NULL == g_cur_engine.pefuncs->start_synth ||
                NULL == g_cur_engine.pefuncs->cancel_synth) {
                SLOG(LOG_ERROR, get_tag(), "[Engine ERROR] The engine functions are NOT valid");
-               return TTSD_ERROR_OPERATION_FAILED; 
+               return TTSD_ERROR_OPERATION_FAILED;
        }
 
        ret = g_cur_engine.pefuncs->initialize(__result_cb);
@@ -729,11 +728,11 @@ int ttsd_engine_agent_load_current_engine()
        /* Select default voice */
        if (NULL != g_cur_engine.default_lang) {
                if (true == g_cur_engine.pefuncs->is_valid_voice(g_cur_engine.default_lang, g_cur_engine.default_vctype)) {
-                       SLOG(LOG_DEBUG, get_tag(), "[Engine Agent SUCCESS] Set origin default voice to current engine : lang(%s), type(%d)", 
-                               g_cur_engine.default_lang,  g_cur_engine.default_vctype);
+                       SLOG(LOG_DEBUG, get_tag(), "[Engine Agent SUCCESS] Set origin default voice to current engine : lang(%s), type(%d)",
+                                g_cur_engine.default_lang,  g_cur_engine.default_vctype);
                } else {
                        SLOG(LOG_WARN, get_tag(), "[Engine Agent WARNING] Fail set origin default voice : lang(%s), type(%d)",
-                               g_cur_engine.default_lang, g_cur_engine.default_vctype);
+                                g_cur_engine.default_lang, g_cur_engine.default_vctype);
 
                        return TTSD_ERROR_OPERATION_FAILED;
                }
@@ -743,11 +742,11 @@ int ttsd_engine_agent_load_current_engine()
        if (NULL != g_cur_engine.pefuncs->load_voice) {
                ret = g_cur_engine.pefuncs->load_voice(g_cur_engine.default_lang, g_cur_engine.default_vctype);
                if (0 == ret) {
-                       SLOG(LOG_DEBUG, get_tag(), "[Engine Agent SUCCESS] Load default voice : lang(%s), type(%d)", 
-                               g_cur_engine.default_lang,  g_cur_engine.default_vctype);
+                       SLOG(LOG_DEBUG, get_tag(), "[Engine Agent SUCCESS] Load default voice : lang(%s), type(%d)",
+                                g_cur_engine.default_lang,  g_cur_engine.default_vctype);
                } else {
                        SLOG(LOG_WARN, get_tag(), "[Engine Agent ERROR] Fail to load default voice : lang(%s), type(%d) result(%s)",
-                               g_cur_engine.default_lang, g_cur_engine.default_vctype, __ttsd_get_engine_error_code(ret));
+                                g_cur_engine.default_lang, g_cur_engine.default_vctype, __ttsd_get_engine_error_code(ret));
 
                        return TTSD_ERROR_OPERATION_FAILED;
                }
@@ -764,7 +763,7 @@ int ttsd_engine_agent_load_current_engine()
                if (0 == ret && 0 < g_list_length(voice_list)) {
                        GList *iter = NULL;
                        voice_s* voice = NULL;
-                       
+
                        iter = g_list_first(voice_list);
 
                        /* check english */
@@ -772,7 +771,7 @@ int ttsd_engine_agent_load_current_engine()
                                voice = iter->data;
 
                                if (NULL != voice) {
-                                       if (0 == strcmp("en_US", voice->language)) 
+                                       if (0 == strcmp("en_US", voice->language))
                                                break;
                                }
 
@@ -782,7 +781,7 @@ int ttsd_engine_agent_load_current_engine()
                                SLOG(LOG_ERROR, get_tag(), "[Engine ERROR] Fail to find voice in list");
                                return TTSD_ERROR_OPERATION_FAILED;
                        }
-       
+
                        /* Set selected language and type */
                        if (true != g_cur_engine.pefuncs->is_valid_voice(voice->language, voice->type)) {
                                SLOG(LOG_ERROR, get_tag(), "[Engine ERROR] Fail voice is NOT valid");
@@ -790,12 +789,12 @@ int ttsd_engine_agent_load_current_engine()
                        }
 
                        ttsd_config_set_default_voice(voice->language, (int)voice->type);
-                       
+
                        g_cur_engine.default_lang = strdup(voice->language);
                        g_cur_engine.default_vctype = voice->type;
 
-                       SLOG(LOG_DEBUG, get_tag(), "[Engine Agent SUCCESS] Select default voice : lang(%s), type(%d)", 
-                               voice->language,  voice->type);
+                       SLOG(LOG_DEBUG, get_tag(), "[Engine Agent SUCCESS] Select default voice : lang(%s), type(%d)",
+                                voice->language,  voice->type);
 
                        __free_voice_list(voice_list);
                } else {
@@ -812,7 +811,7 @@ int ttsd_engine_agent_load_current_engine()
 int ttsd_engine_agent_unload_current_engine()
 {
        if (false == g_agent_init) {
-               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
+               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized");
                return TTSD_ERROR_OPERATION_FAILED;
        }
 
@@ -822,7 +821,7 @@ int ttsd_engine_agent_unload_current_engine()
        }
 
        if (false == g_cur_engine.is_loaded) {
-               SLOG(LOG_DEBUG, get_tag(), "[Engine Agent] Engine has already been unloaded " );
+               SLOG(LOG_DEBUG, get_tag(), "[Engine Agent] Engine has already been unloaded ");
                return 0;
        }
 
@@ -835,7 +834,7 @@ int ttsd_engine_agent_unload_current_engine()
 
        /* unload engine */
        g_cur_engine.ttsp_unload_engine();
-       
+
        dlclose(g_cur_engine.handle);
 
        /* reset current engine data */
@@ -865,7 +864,7 @@ int ttsd_engine_agent_unload_current_engine()
 bool ttsd_engine_agent_need_network()
 {
        if (false == g_agent_init) {
-               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
+               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized");
                return TTSD_ERROR_OPERATION_FAILED;
        }
 
@@ -891,14 +890,13 @@ bool ttsd_engine_select_valid_voice(const char* lang, int type, char** out_lang,
        SECURE_SLOG(LOG_DEBUG, get_tag(), "[Engine Agent] Select voice : input lang(%s), input type(%d), default lang(%s), default type(%d)", 
                lang, type, g_cur_engine.default_lang, g_cur_engine.default_vctype);
 
-       
        /* case 1 : Both are default */
        if (0 == strncmp(lang, "default", strlen("default")) && 0 == type) {
                *out_lang = strdup(g_cur_engine.default_lang);
                *out_type = g_cur_engine.default_vctype;
                return true;
        }
-       
+
        /* Get voice list */
        GList* voice_list = NULL;
        int ret = 0;
@@ -975,7 +973,7 @@ bool ttsd_engine_select_valid_voice(const char* lang, int type, char** out_lang,
                                /* Get handle data from list */
                                voice = iter->data;
 
-                               if (0 == strncmp(voice->language, g_cur_engine.default_lang, strlen(g_cur_engine.default_lang)) ) {
+                               if (0 == strncmp(voice->language, g_cur_engine.default_lang, strlen(g_cur_engine.default_lang))) {
                                        voice_selected = voice;
                                        if (voice->type == type) {
                                                voice_selected = voice;
@@ -1005,7 +1003,7 @@ bool ttsd_engine_select_valid_voice(const char* lang, int type, char** out_lang,
 bool ttsd_engine_agent_is_same_engine(const char* engine_id)
 {
        if (false == g_agent_init) {
-               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
+               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized");
                return false;
        }
 
@@ -1025,7 +1023,7 @@ bool ttsd_engine_agent_is_same_engine(const char* engine_id)
 int ttsd_engine_agent_set_default_engine(const char* engine_id)
 {
        if (false == g_agent_init) {
-               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
+               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized");
                return TTSD_ERROR_OPERATION_FAILED;
        }
 
@@ -1035,7 +1033,7 @@ int ttsd_engine_agent_set_default_engine(const char* engine_id)
                return 0;
        }
 
-       bool is_engine_loaded = false; 
+       bool is_engine_loaded = false;
        char* tmp_uuid = NULL;
        tmp_uuid = strdup(g_cur_engine.engine_uuid);
        if (NULL == tmp_uuid) {
@@ -1061,7 +1059,7 @@ int ttsd_engine_agent_set_default_engine(const char* engine_id)
                if (true == is_engine_loaded) {
                        ttsd_engine_agent_load_current_engine();
                }
-               
+
                if (tmp_uuid != NULL)   free(tmp_uuid);
                return TTSD_ERROR_OPERATION_FAILED;
        }
@@ -1070,7 +1068,7 @@ int ttsd_engine_agent_set_default_engine(const char* engine_id)
                /* load engine */
                if (0 != ttsd_engine_agent_load_current_engine()) {
                        SLOG(LOG_ERROR, get_tag(), "[Engine Agent Error] Fail to load new engine. Recovery origin engine");
-                       
+
                        /* roll back to old current engine. */
                        __internal_set_current_engine(tmp_uuid);
                        if (true == is_engine_loaded) {
@@ -1091,7 +1089,7 @@ int ttsd_engine_agent_set_default_engine(const char* engine_id)
 int ttsd_engine_agent_set_default_voice(const char* language, int vctype)
 {
        if (false == g_agent_init) {
-               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
+               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized");
                return TTSD_ERROR_OPERATION_FAILED;
        }
 
@@ -1140,7 +1138,7 @@ int ttsd_engine_agent_set_default_voice(const char* language, int vctype)
                        }
                        break;
                }
-               
+
                /*Get next item*/
                iter = g_slist_next(iter);
        }
@@ -1180,7 +1178,7 @@ int ttsd_engine_agent_set_default_voice(const char* language, int vctype)
                        }
                        break;
                }
-               
+
                /*Get next item*/
                iter = g_slist_next(iter);
        }
@@ -1203,7 +1201,7 @@ int ttsd_engine_agent_set_default_voice(const char* language, int vctype)
 int ttsd_engine_agent_set_default_speed(int speed)
 {
        if (false == g_agent_init) {
-               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
+               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized");
                return TTSD_ERROR_OPERATION_FAILED;
        }
 
@@ -1215,7 +1213,7 @@ int ttsd_engine_agent_set_default_speed(int speed)
 int ttsd_engine_agent_set_default_pitch(int pitch)
 {
        if (false == g_agent_init) {
-               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
+               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized");
                return TTSD_ERROR_OPERATION_FAILED;
        }
 
@@ -1231,8 +1229,8 @@ int ttsd_engine_agent_set_default_pitch(int pitch)
 
        int ret = g_cur_engine.pefuncs->set_pitch(pitch);
        if (0 != ret) {
-               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Fail to set pitch : pitch(%d), result(%s)", 
-                       pitch, __ttsd_get_engine_error_code(ret));
+               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Fail to set pitch : pitch(%d), result(%s)",
+                        pitch, __ttsd_get_engine_error_code(ret));
                return TTSD_ERROR_OPERATION_FAILED;
        }
 
@@ -1259,12 +1257,12 @@ int ttsd_engine_load_voice(const char* lang, const int vctype)
 
                if (NULL != data) {
                        if (0 == strcmp(data->lang, lang) && data->type == vctype) {
-                               SLOG(LOG_DEBUG, get_tag(), "[Engine Agent] Find voice : default(%d) loaded(%d) ref(%d) lang(%s) type(%d)", 
-                                       data->is_default, data->is_loaded,  data->client_ref_count, data->lang, data->type);
+                               SLOG(LOG_DEBUG, get_tag(), "[Engine Agent] Find voice : default(%d) loaded(%d) ref(%d) lang(%s) type(%d)",
+                                        data->is_default, data->is_loaded,  data->client_ref_count, data->lang, data->type);
                                break;
                        }
                }
-               
+
                /*Get next item*/
                iter = g_slist_next(iter);
                data = NULL;
@@ -1322,12 +1320,12 @@ int ttsd_engine_unload_voice(const char* lang, const int vctype)
 
                if (NULL != data) {
                        if (0 == strcmp(data->lang, lang) && data->type == vctype) {
-                               SLOG(LOG_DEBUG, get_tag(), "[Engine Agent] Find voice : default(%d) loaded(%d) ref(%d) lang(%s) type(%d)", 
-                                       data->is_default, data->is_loaded,  data->client_ref_count, data->lang, data->type);
+                               SLOG(LOG_DEBUG, get_tag(), "[Engine Agent] Find voice : default(%d) loaded(%d) ref(%d) lang(%s) type(%d)",
+                                        data->is_default, data->is_loaded,  data->client_ref_count, data->lang, data->type);
                                break;
                        }
                }
-               
+
                /*Get next item*/
                iter = g_slist_next(iter);
                data = NULL;
@@ -1373,7 +1371,7 @@ int ttsd_engine_unload_voice(const char* lang, const int vctype)
 int ttsd_engine_start_synthesis(const char* lang, int vctype, const char* text, int speed, void* user_param)
 {
        if (false == g_agent_init) {
-               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
+               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized");
                return TTSD_ERROR_OPERATION_FAILED;
        }
 
@@ -1426,7 +1424,7 @@ int ttsd_engine_start_synthesis(const char* lang, int vctype, const char* text,
 int ttsd_engine_cancel_synthesis()
 {
        if (false == g_agent_init) {
-               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
+               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized");
                return TTSD_ERROR_OPERATION_FAILED;
        }
 
@@ -1434,7 +1432,7 @@ int ttsd_engine_cancel_synthesis()
                SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not loaded engine");
                return TTSD_ERROR_OPERATION_FAILED;
        }
-       
+
        if (NULL == g_cur_engine.pefuncs->cancel_synth) {
                SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] cancel_synth() of engine is NULL!!");
                return TTSD_ERROR_OPERATION_FAILED;
@@ -1472,7 +1470,7 @@ bool __supported_voice_cb(const char* language, int type, void* user_data)
 int ttsd_engine_get_voice_list(GList** voice_list)
 {
        if (false == g_agent_init) {
-               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
+               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized");
                return TTSD_ERROR_OPERATION_FAILED;
        }
 
@@ -1494,7 +1492,7 @@ int ttsd_engine_get_voice_list(GList** voice_list)
 int ttsd_engine_get_default_voice(char** lang, int* vctype)
 {
        if (false == g_agent_init) {
-               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
+               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized");
                return TTSD_ERROR_OPERATION_FAILED;
        }
 
@@ -1504,7 +1502,7 @@ int ttsd_engine_get_default_voice(char** lang, int* vctype)
        }
 
        if (NULL == lang || NULL == vctype) {
-               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] BAD Parameter"); 
+               SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] BAD Parameter");
                return TTSD_ERROR_INVALID_PARAMETER;
        }
 
@@ -1517,7 +1515,7 @@ int ttsd_engine_get_default_voice(char** lang, int* vctype)
                SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Default voice is NULL");
                return TTSD_ERROR_OPERATION_FAILED;
        }
-       
+
        return 0;
 }
 
@@ -1533,14 +1531,14 @@ void __free_voice_list(GList* voice_list)
 
                while (NULL != iter) {
                        data = iter->data;
-                       
+
                        if (NULL != data) {
                                if (NULL != data->language)     free(data->language);
                                free(data);
                        }
-                       
+
                        voice_list = g_list_remove_link(voice_list, iter);
-                       
+
                        iter = g_list_first(voice_list);
                }
        }
@@ -1566,7 +1564,7 @@ int ttsd_print_enginelist()
 
                SLOG(LOG_DEBUG, get_tag(), "----- engine list -----");
 
-               int i = 1;      
+               int i = 1;
                while (NULL != iter) {
                        data = iter->data;
 
@@ -1602,7 +1600,7 @@ int ttsd_print_voicelist()
                /* Get a first item */
                iter = g_slist_nth(g_cur_voices, 0);
 
-               int i = 1;      
+               int i = 1;
                while (NULL != iter) {
                        /*Get handle data from list*/
                        data = iter->data;
@@ -1612,9 +1610,9 @@ int ttsd_print_voicelist()
                                return 0;
                        }
 
-                       SLOG(LOG_DEBUG, get_tag(), "[%dth] default(%d) loaded(%d) ref(%d) lang(%s) type(%d)", 
-                               i, data->is_default, data->is_loaded,  data->client_ref_count, data->lang, data->type);
-                       
+                       SLOG(LOG_DEBUG, get_tag(), "[%dth] default(%d) loaded(%d) ref(%d) lang(%s) type(%d)",
+                                i, data->is_default, data->is_loaded,  data->client_ref_count, data->lang, data->type);
+
                        /*Get next item*/
                        iter = g_slist_next(iter);
                        i++;
index 0af3329..dfc8263 100644 (file)
@@ -1,5 +1,5 @@
 /*
-*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
@@ -34,11 +34,11 @@ bool ttsd_network_is_connected()
        int network_status = 0;
        vconf_get_int(VCONFKEY_NETWORK_STATUS, &network_status);
 
-       if(network_status == VCONFKEY_NETWORK_OFF){
+       if (network_status == VCONFKEY_NETWORK_OFF) {
                SLOG(LOG_WARN, get_tag(), "[Network] Current network connection is OFF.");
                return false;
        }
-       
+
        SLOG(LOG_DEBUG, get_tag(), "[Network] Network status is %d", network_status);
 
        return true;
index 405d5d7..0839fbc 100644 (file)
@@ -1,5 +1,5 @@
 /*
-*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
@@ -28,7 +28,7 @@ typedef enum {
        AUDIO_STATE_NONE = 0,
        AUDIO_STATE_READY,
        AUDIO_STATE_PLAY
-}audio_state_e;
+} audio_state_e;
 
 typedef struct {
        int                     uid;    /** client id */
@@ -40,7 +40,7 @@ typedef struct {
        bool                    is_paused_data;
        int                     idx;
        sound_data_s            paused_data;
-}player_s;
+} player_s;
 
 #define SOUND_BUFFER_LENGTH    2048
 
@@ -63,7 +63,7 @@ static int g_sampling_rate;
 static audio_out_h g_audio_h;
 
 /*
-* Internal Interfaces 
+* Internal Interfaces
 */
 
 player_s* __player_get_item(int uid)
@@ -112,7 +112,7 @@ void __player_audio_io_interrupted_cb(audio_io_interrupted_code_e code, void *us
                int pid = ttsd_data_get_pid(g_playing_info->uid);
 
                /* send message to client about changing state */
-               ttsdc_send_set_state_message (pid, g_playing_info->uid, APP_STATE_PAUSED);
+               ttsdc_send_set_state_message(pid, g_playing_info->uid, APP_STATE_PAUSED);
        }
 
        SLOG(LOG_DEBUG, get_tag(), "=====");
@@ -183,7 +183,7 @@ static int __destroy_audio_out()
        } else {
                SLOG(LOG_DEBUG, get_tag(), "[Player SUCCESS] Destroy audio");
        }
-       
+
        g_audio_type = 0;
        g_sampling_rate = 0;
 
@@ -247,10 +247,10 @@ static void __play_thread(void *data, Ecore_Thread *thread)
                                return;
                        }
 
-                       /* If wdata's event is 'start', current wdata is first data of engine for synthesis. 
+                       /* If wdata's event is 'start', current wdata is first data of engine for synthesis.
                         * If wdata's event is 'finish', player should check previous event to know whether this wdata is first or not.
-                        * When previous wdata's event is 'finish' and current wdata's event is 'finish', 
-                        * the player should send utt started event. 
+                        * When previous wdata's event is 'finish' and current wdata's event is 'finish',
+                        * the player should send utt started event.
                         */
                        if (TTSP_RESULT_EVENT_START == wdata.event ||
                           (TTSP_RESULT_EVENT_FINISH == player->event && TTSP_RESULT_EVENT_FINISH == wdata.event)) {
@@ -403,14 +403,14 @@ static void __play_thread(void *data, Ecore_Thread *thread)
 }
 
 /*
-* Player Interfaces 
+* Player Interfaces
 */
 int ttsd_player_init()
 {
        g_playing_info = NULL;
        g_audio_state = AUDIO_STATE_NONE;
        g_audio_h = NULL;
-       
+
        int ret;
 
        if (TTSD_MODE_DEFAULT == ttsd_get_mode()) {
@@ -418,17 +418,17 @@ int ttsd_player_init()
                if (0 != ret) {
                        SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Fail to set session type");
                }
-               
+
                ret = sound_manager_set_media_session_option(SOUND_SESSION_OPTION_PAUSE_OTHERS_WHEN_START, SOUND_SESSION_OPTION_INTERRUPTIBLE_DURING_PLAY);
                if (0 != ret) {
-                       SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Fail set media session option");     
+                       SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Fail set media session option");
                } else {
-                       SLOG(LOG_DEBUG, get_tag(), "[Player SUCCESS] set media session option");        
+                       SLOG(LOG_DEBUG, get_tag(), "[Player SUCCESS] set media session option");
                }
        }
 
        ecore_thread_max_set(1);
-               
+
        ret = __create_audio_out(TTSP_AUDIO_TYPE_RAW_S16, 16000);
        if (0 != ret)
                return -1;
@@ -482,13 +482,13 @@ int ttsd_player_release(void)
 int ttsd_player_create_instance(int uid)
 {
        if (false == g_player_init) {
-               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized" );
+               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized");
                return -1;
        }
-       
+
        /* Check uid is duplicated */
        if (NULL != __player_get_item(uid)) {
-               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] uid(%d) is already registered", uid); 
+               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] uid(%d) is already registered", uid);
                return -1;
        }
 
@@ -500,7 +500,7 @@ int ttsd_player_create_instance(int uid)
        new_client->is_paused_data = false;
        new_client->idx = 0;
        new_client->paused_data.data = NULL;
-       
+
        SLOG(LOG_DEBUG, get_tag(), "[Player] Create player : uid(%d)", uid);
 
        g_player_list = g_list_append(g_player_list, new_client);
@@ -511,14 +511,14 @@ int ttsd_player_create_instance(int uid)
 int ttsd_player_destroy_instance(int uid)
 {
        if (false == g_player_init) {
-               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized" );
+               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized");
                return -1;
        }
 
        player_s* current;
        current = __player_get_item(uid);
        if (NULL == current) {
-               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] uid(%d) is not valid", uid); 
+               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] uid(%d) is not valid", uid);
                return -1;
        }
 
@@ -542,12 +542,12 @@ int ttsd_player_destroy_instance(int uid)
                        if (NULL != data) {
                                /* compare uid */
                                if (uid == data->uid) {
-                                       g_player_list = g_list_remove_link(g_player_list, iter);                                
+                                       g_player_list = g_list_remove_link(g_player_list, iter);
                                        free(data);
                                        break;
                                }
                        }
-                               
+
                        /* Get next item */
                        iter = g_list_next(iter);
                }
@@ -561,7 +561,7 @@ int ttsd_player_destroy_instance(int uid)
 int ttsd_player_play(int uid)
 {
        if (false == g_player_init) {
-               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized" );
+               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized");
                return -1;
        }
 
@@ -572,11 +572,11 @@ int ttsd_player_play(int uid)
                }
        }
 
-       SLOG(LOG_DEBUG, get_tag(), "[Player] start play : uid(%d)", uid );
+       SLOG(LOG_DEBUG, get_tag(), "[Player] start play : uid(%d)", uid);
 
        /* Check sound queue size */
        if (0 == ttsd_data_get_sound_data_size(uid)) {
-               SLOG(LOG_WARN, get_tag(), "[Player WARNING] A sound queue of current player(%d) is empty", uid); 
+               SLOG(LOG_WARN, get_tag(), "[Player WARNING] A sound queue of current player(%d) is empty", uid);
                return -1;
        }
 
@@ -584,12 +584,12 @@ int ttsd_player_play(int uid)
        player_s* current;
        current = __player_get_item(uid);
        if (NULL == current) {
-               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] uid(%d) is not valid", uid); 
+               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] uid(%d) is not valid", uid);
                return -1;
        }
 
        current->state = APP_STATE_PLAYING;
-       
+
        g_playing_info = current;
 
        SLOG(LOG_DEBUG, get_tag(), "[Player DEBUG] Active thread count : %d", ecore_thread_active_get());
@@ -613,7 +613,7 @@ int ttsd_player_stop(int uid)
        player_s* current;
        current = __player_get_item(uid);
        if (NULL == current) {
-               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] uid(%d) is not valid", uid); 
+               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] uid(%d) is not valid", uid);
                return -1;
        }
 
@@ -624,7 +624,7 @@ int ttsd_player_stop(int uid)
                        g_playing_info = NULL;
                }
        } else {
-               SLOG(LOG_DEBUG, get_tag(), "[Player] No current playing"); 
+               SLOG(LOG_DEBUG, get_tag(), "[Player] No current playing");
        }
 
        if (true == current->is_paused_data) {
@@ -646,10 +646,10 @@ int ttsd_player_stop(int uid)
 
 int ttsd_player_pause(int uid)
 {
-       SLOG(LOG_DEBUG, get_tag(), "[Player] pause player : uid(%d)", uid );
+       SLOG(LOG_DEBUG, get_tag(), "[Player] pause player : uid(%d)", uid);
 
        if (false == g_player_init) {
-               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized" );
+               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized");
                return -1;
        }
 
@@ -657,7 +657,7 @@ int ttsd_player_pause(int uid)
        player_s* current;
        current = __player_get_item(uid);
        if (NULL == current) {
-               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] ttsd_player_pause() : uid(%d) is not valid", uid); 
+               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] ttsd_player_pause() : uid(%d) is not valid", uid);
                return -1;
        }
 
@@ -678,10 +678,10 @@ int ttsd_player_pause(int uid)
 
 int ttsd_player_resume(int uid)
 {
-       SLOG(LOG_DEBUG, get_tag(), "[Player] Resume player : uid(%d)", uid );
+       SLOG(LOG_DEBUG, get_tag(), "[Player] Resume player : uid(%d)", uid);
 
        if (false == g_player_init) {
-               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized" );
+               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized");
                return -1;
        }
 
@@ -689,7 +689,7 @@ int ttsd_player_resume(int uid)
        player_s* current;
        current = __player_get_item(uid);
        if (NULL == current) {
-               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] uid(%d) is not valid", uid); 
+               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] uid(%d) is not valid", uid);
                return -1;
        }
 
@@ -709,7 +709,7 @@ int ttsd_player_resume(int uid)
 int ttsd_player_all_stop()
 {
        if (false == g_player_init) {
-               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized" );
+               SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized");
                return -1;
        }
 
@@ -744,11 +744,11 @@ int ttsd_player_all_stop()
                                                data->paused_data.data = NULL;
                                        }
                                }
-                               
+
                                data->is_paused_data = false;
                                data->idx = 0;
                        }
-                       
+
                        /* Get next item */
                        iter = g_list_next(iter);
                }
index 34fedfe..7b452fe 100644 (file)
@@ -1,5 +1,5 @@
 /*
-*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
@@ -30,12 +30,12 @@ typedef enum {
        TTSD_SYNTHESIS_CONTROL_DOING    = 0,
        TTSD_SYNTHESIS_CONTROL_DONE     = 1,
        TTSD_SYNTHESIS_CONTROL_EXPIRED  = 2
-}ttsd_synthesis_control_e;
+} ttsd_synthesis_control_e;
 
 typedef struct {
        int uid;
        int uttid;
-}utterance_t;
+} utterance_t;
 
 /* If current engine exist */
 static bool    g_is_engine;
@@ -76,7 +76,7 @@ static Eina_Bool __wait_synthesis(void *data)
                                /* Start next synthesis */
                                __synthesis(uid);
                        }
-               }       
+               }
        } else {
                g_wait_timer = NULL;
        }
@@ -94,12 +94,12 @@ static int __synthesis(int uid)
                if (NULL == sdata.lang || NULL == sdata.text) {
                        SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Current data is NOT valid");
                        ttsd_server_stop(uid);
-                       
+
                        int pid = ttsd_data_get_pid(uid);
                        ttsdc_send_set_state_message(pid, uid, APP_STATE_READY);
 
                        if (NULL != sdata.lang) free(sdata.lang);
-                       
+
                        return 0;
                }
 
@@ -139,7 +139,7 @@ static int __synthesis(int uid)
 }
 
 /*
-* TTS Server Callback Functions        
+* TTS Server Callback Functions
 */
 int __synthesis_result_callback(ttsp_result_event_e event, const void* data, unsigned int data_size, 
                                ttsp_audio_type_e audio_type, int rate, void *user_data)
@@ -151,7 +151,7 @@ int __synthesis_result_callback(ttsp_result_event_e event, const void* data, uns
 
        /* Synthesis is success */
        if (TTSP_RESULT_EVENT_START == event || TTSP_RESULT_EVENT_CONTINUE == event || TTSP_RESULT_EVENT_FINISH == event) {
-               
+
                if (TTSP_RESULT_EVENT_START == event)           SLOG(LOG_DEBUG, get_tag(), "[SERVER] Event : TTSP_RESULT_EVENT_START");
                if (TTSP_RESULT_EVENT_CONTINUE == event)        SLOG(LOG_DEBUG, get_tag(), "[SERVER] Event : TTSP_RESULT_EVENT_CONTINUE");
                if (TTSP_RESULT_EVENT_FINISH == event)          SLOG(LOG_DEBUG, get_tag(), "[SERVER] Event : TTSP_RESULT_EVENT_FINISH");
@@ -164,8 +164,8 @@ int __synthesis_result_callback(ttsp_result_event_e event, const void* data, uns
                        return 0;
                }
 
-               SLOG(LOG_DEBUG, get_tag(), "[SERVER] Result Info : uid(%d), utt(%d), data(%p), data size(%d) audiotype(%d) rate(%d)", 
-                       uid, uttid, data, data_size, audio_type, rate);
+               SLOG(LOG_DEBUG, get_tag(), "[SERVER] Result Info : uid(%d), utt(%d), data(%p), data size(%d) audiotype(%d) rate(%d)",
+                        uid, uttid, data, data_size, audio_type, rate);
 
                if (rate <= 0 || audio_type < 0 || audio_type > TTSP_AUDIO_TYPE_MAX) {
                        __server_set_synth_control(TTSD_SYNTHESIS_CONTROL_DONE);
@@ -193,7 +193,7 @@ int __synthesis_result_callback(ttsp_result_event_e event, const void* data, uns
                temp_data.event = event;
                temp_data.audio_type = audio_type;
                temp_data.rate = rate;
-               
+
                if (0 != ttsd_data_add_sound_data(uid, temp_data)) {
                        SLOG(LOG_ERROR, get_tag(), "[SERVER ERROR] Fail to add sound data : uid(%d)", uid);
                }
@@ -215,7 +215,7 @@ int __synthesis_result_callback(ttsp_result_event_e event, const void* data, uns
        } else {
                SLOG(LOG_DEBUG, get_tag(), "[SERVER] Event : TTSP_RESULT_EVENT_ERROR");
                __server_set_synth_control(TTSD_SYNTHESIS_CONTROL_EXPIRED);
-       } 
+       }
 
 
        SLOG(LOG_DEBUG, get_tag(), "===== SYNTHESIS RESULT CALLBACK END");
@@ -227,21 +227,21 @@ int __synthesis_result_callback(ttsp_result_event_e event, const void* data, uns
 bool __get_client_cb(int pid, int uid, app_state_e state, void* user_data)
 {
        /* clear client data */
-       ttsd_data_clear_data(uid);                      
+       ttsd_data_clear_data(uid);
        ttsd_data_set_client_state(uid, APP_STATE_READY);
 
        /* send message */
-       if ( 0 != ttsdc_send_set_state_message(pid, uid, APP_STATE_READY)) {
+       if (0 != ttsdc_send_set_state_message(pid, uid, APP_STATE_READY)) {
                /* remove client */
                ttsd_data_delete_client(uid);
-       } 
+       }
 
        return true;
 }
 
 void __config_changed_cb(tts_config_type_e type, const char* str_param, int int_param)
 {
-       switch(type) {
+       switch (type) {
        case TTS_CONFIG_TYPE_ENGINE:
        {
                if (NULL == str_param) {
@@ -386,11 +386,11 @@ int ttsd_initialize()
 
        /* set current engine */
        if (0 != ttsd_engine_agent_initialize_current_engine()) {
-               SLOG(LOG_WARN, get_tag(), "[Server WARNING] No Engine !!!" );
+               SLOG(LOG_WARN, get_tag(), "[Server WARNING] No Engine !!!");
                g_is_engine = false;
-       } else 
+       } else
                g_is_engine = true;
-       
+
        __server_set_synth_control(TTSD_SYNTHESIS_CONTROL_EXPIRED);
 
        if (TTSD_MODE_SCREEN_READER == ttsd_get_mode()) {
@@ -403,7 +403,7 @@ int ttsd_initialize()
 int ttsd_finalize()
 {
        ttsd_config_finalize();
-       
+
        ttsd_player_release();
 
        ttsd_engine_agent_release();
@@ -427,10 +427,10 @@ bool __get_client_for_clean_up(int pid, int uid, app_state_e state, void* user_d
                result = ttsdc_send_hello(pid, uid);
 
                if (0 == result) {
-                       SLOG(LOG_DEBUG, get_tag(), "[Server] uid(%d) should be removed.", uid); 
+                       SLOG(LOG_DEBUG, get_tag(), "[Server] uid(%d) should be removed.", uid);
                        ttsd_server_finalize(uid);
                } else if (-1 == result) {
-                       SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Hello result has error"); 
+                       SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Hello result has error");
                }
        }
        return true;
@@ -511,7 +511,7 @@ int ttsd_server_finalize(int uid)
        }
 
        ttsd_server_stop(uid);
-       
+
        ttsd_player_destroy_instance(uid);
 
        /* Need to unload voice when used voice is unregistered */
@@ -552,7 +552,7 @@ int ttsd_server_add_queue(int uid, const char* text, const char* lang, int voice
                SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Fail to select valid voice : result lang is NULL");
                return TTSD_ERROR_INVALID_VOICE;
        }
-       
+
        speak_data_s data;
 
        data.lang = strdup(lang);
@@ -603,14 +603,14 @@ int ttsd_server_add_queue(int uid, const char* text, const char* lang, int voice
 Eina_Bool __send_interrupt_client(void *data)
 {
        int uid = (int)data;
-       
+
        int pid = ttsd_data_get_pid(uid);
 
        if (TTSD_MODE_DEFAULT != ttsd_get_mode()) {
                /* send message to client about changing state */
-               ttsdc_send_set_state_message (pid, uid, APP_STATE_READY);
+               ttsdc_send_set_state_message(pid, uid, APP_STATE_READY);
        } else {
-               ttsdc_send_set_state_message (pid, uid, APP_STATE_PAUSED);
+               ttsdc_send_set_state_message(pid, uid, APP_STATE_PAUSED);
        }
 
        return EINA_FALSE;
@@ -623,7 +623,7 @@ int ttsd_server_play(int uid)
                SLOG(LOG_ERROR, get_tag(), "[Server ERROR] uid(%d) is NOT valid  ", uid);
                return TTSD_ERROR_INVALID_PARAMETER;
        }
-       
+
        if (APP_STATE_PLAYING == state) {
                SLOG(LOG_WARN, get_tag(), "[Server WARNING] Current state(%d) is 'play' ", uid);
                return TTSD_ERROR_NONE;
@@ -647,8 +647,8 @@ int ttsd_server_play(int uid)
                        /* pause player */
                        if (0 != ttsd_server_stop(current_uid)) {
                                SLOG(LOG_WARN, get_tag(), "[Server ERROR] Fail to stop : uid (%d)", current_uid);
-                       } 
-                       
+                       }
+
                        ecore_timer_add(0, __send_interrupt_client, (void*)current_uid);
                } else {
                        /* Default mode policy of interrupt is "Pause" */
@@ -776,7 +776,7 @@ int ttsd_server_get_current_voice(int uid, char** language, int* voice_type)
        if (0 > ttsd_data_get_client_state(uid, &state)) {
                SLOG(LOG_ERROR, get_tag(), "[Server ERROR] ttsd_server_get_current_voice : uid is not valid");
                return TTSD_ERROR_INVALID_PARAMETER;
-       }               
+       }
 
        /* get current voice */
        int ret = ttsd_engine_get_default_voice(language, voice_type);
@@ -785,7 +785,7 @@ int ttsd_server_get_current_voice(int uid, char** language, int* voice_type)
                return ret;
        }
 
-       SLOG(LOG_DEBUG, get_tag(), "[Server] Get default language (%s), voice type(%d) ", *language, *voice_type); 
+       SLOG(LOG_DEBUG, get_tag(), "[Server] Get default language (%s), voice type(%d) ", *language, *voice_type);
 
        return TTSD_ERROR_NONE;
 }
index c39a146..0c04033 100644 (file)
@@ -1,5 +1,5 @@
 /*
-*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
@@ -17,7 +17,7 @@
 #include <tts.h>
 #include <dlog.h>
 
-#define TTS_STRDUP(src)                ((src != NULL) ? strdup(src) : NULL )
+#define TTS_STRDUP(src)                ((src != NULL) ? strdup(src) : NULL)
 
 static tts_h g_tts;
 static char* g_text = NULL;
@@ -31,18 +31,18 @@ Eina_Bool __tts_test_destroy(void *data);
 
 static bool __tts_test_get_text_from_file(const char* path, char** text)
 {
-       if(!path) return 0;
-       if(!text) return 0;
+       if (!path) return 0;
+       if (!text) return 0;
 
        FILE *fp = NULL;
 
-       if((fp = fopen(path, "rb")) == NULL ) {
+       if ((fp = fopen(path, "rb")) == NULL) {
                SLOG(LOG_ERROR, tts_tag(), "Fail to open file (%s)", path);
                return 0;
        }
 
-       fseek(fp , 0 , SEEK_END);  
-       
+       fseek(fp , 0 , SEEK_END);
+
        int text_len = ftell(fp);
        if (0 >= text_len) {
                SLOG(LOG_ERROR, tts_tag(), "File has no contents\n");
@@ -59,7 +59,7 @@ static bool __tts_test_get_text_from_file(const char* path, char** text)
                fclose(fp);
                return 0;
        }
-       
+
        int result_len = 1;
        while (!feof(fp)) {
                result_len = fread(*text, sizeof(char), text_len, fp);
@@ -83,7 +83,7 @@ Eina_Bool __tts_test_play(void *data)
        char* lang = NULL;
 
        lang = (char*)data;
-       
+
        ret = tts_add_text(g_tts, g_text, lang, TTS_VOICE_TYPE_AUTO, TTS_SPEED_AUTO, &utt_id);
        if (TTS_ERROR_NONE != ret) {
                SLOG(LOG_ERROR, tts_tag(), "Fail to add text\n");
@@ -153,7 +153,7 @@ static void __tts_test_utt_completed_cb(tts_h tts, int utt_id, void* user_data)
        return;
 }
 
-int main (int argc, char *argv[])
+int main(int argc, char *argv[])
 {
        if (1 == argc || 5 < argc) {
                SLOG(LOG_DEBUG, tts_tag(), "Please check parameter\n");
@@ -167,9 +167,9 @@ int main (int argc, char *argv[])
 
        int n = 0;
 
-       while(NULL != argv[n]) {
+       while (NULL != argv[n]) {
 
-               if(!strcmp("-h", argv[n])) {
+               if (!strcmp("-h", argv[n])) {
                        SLOG(LOG_DEBUG, tts_tag(), "\n");
                        SLOG(LOG_DEBUG, tts_tag(), " ==========================================\n");
                        SLOG(LOG_DEBUG, tts_tag(), "  TTS test usage\n");
@@ -183,34 +183,34 @@ int main (int argc, char *argv[])
                        SLOG(LOG_DEBUG, tts_tag(), "\n");
                        return 0;
                }
-               
-               // check langage option
-               if(!strcmp("-l", argv[n])) {
+
+               /* check langage option */
+               if (!strcmp("-l", argv[n])) {
                        lang = TTS_STRDUP(argv[n+1]);
                        SLOG(LOG_ERROR, tts_tag(), "Language : %s\n", lang);
                }
-               // check text to synthesize
+               /* check text to synthesize */
                else if (!strcmp("-t", argv[n])) {
                        g_text = TTS_STRDUP(argv[n+1]);
                        SLOG(LOG_ERROR, tts_tag(), "Text : %s\n", g_text);
                }
-               // check file path to synthesize
+               /* check file path to synthesize */
                else if (!strcmp("-f", argv[n])) {
                        src_path = TTS_STRDUP(argv[n+1]);
                        SLOG(LOG_ERROR, tts_tag(), "File path : %s\n", src_path);
-                       if(!__tts_test_get_text_from_file(src_path, &g_text)) {
+                       if (!__tts_test_get_text_from_file(src_path, &g_text)) {
                                return 0;
                        }
                }
                n++;
        }
-       
-       if(!g_text && !src_path) {
+
+       if (!g_text && !src_path) {
                SLOG(LOG_ERROR, tts_tag(), "Invalid parameter, check help with command tts-test -h");
                return 0;
        }
 
-//===================================
+       /*=================================== */
 
        tts_mode_e mode = TTS_MODE_DEFAULT;
 
@@ -278,9 +278,9 @@ int main (int argc, char *argv[])
 
        ecore_shutdown();
 
-       if(src_path) free(src_path);
-       if(lang) free(lang);
-       if(g_text) free(g_text);
+       if (src_path) free(src_path);
+       if (lang) free(lang);
+       if (g_text) free(g_text);
 
        SLOG(LOG_DEBUG, tts_tag(), "===== TTS END =====\n\n\n");