upload tizen1.0 source
authorKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 08:02:06 +0000 (17:02 +0900)
committerKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 08:02:06 +0000 (17:02 +0900)
35 files changed:
COPYING [deleted file]
LICENSE [new file with mode: 0644]
client/tts.c
client/tts.h
client/tts_client.c
client/tts_client.h
client/tts_dbus.c
client/tts_dbus.h
client/tts_main.h
client/tts_setting.c
client/tts_setting.h
client/tts_setting_dbus.c
client/tts_setting_dbus.h
common/tts_defs.h
debian/changelog
packaging/tts.spec
server/ttsd_config.c
server/ttsd_config.h
server/ttsd_data.cpp
server/ttsd_data.h
server/ttsd_dbus.c
server/ttsd_dbus.h
server/ttsd_dbus_server.c
server/ttsd_dbus_server.h
server/ttsd_engine_agent.c
server/ttsd_engine_agent.h
server/ttsd_main.c
server/ttsd_main.h
server/ttsd_network.c
server/ttsd_network.h
server/ttsd_player.cpp
server/ttsd_player.h
server/ttsd_server.cpp
server/ttsd_server.h
server/ttsp.h

diff --git a/COPYING b/COPYING
deleted file mode 100644 (file)
index bf8fbd7..0000000
--- a/COPYING
+++ /dev/null
@@ -1,10 +0,0 @@
-Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved \r
-   Licensed under the Apache License, Version 2.0 (the "License");\r
-   you may not use this file except in compliance with the License.\r
-   You may obtain a copy of the License at\r
-       http://www.apache.org/licenses/LICENSE-2.0\r
-   Unless required by applicable law or agreed to in writing, software\r
-   distributed under the License is distributed on an "AS IS" BASIS,\r
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-   See the License for the specific language governing permissions and\r
-   limitations under the License.\r
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..bbe9d02
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,206 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+\r
+                                 Apache License\r
+                           Version 2.0, January 2004\r
+                        http://www.apache.org/licenses/\r
+\r
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+   1. Definitions.\r
+\r
+      "License" shall mean the terms and conditions for use, reproduction,\r
+      and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+      "Licensor" shall mean the copyright owner or entity authorized by\r
+      the copyright owner that is granting the License.\r
+\r
+      "Legal Entity" shall mean the union of the acting entity and all\r
+      other entities that control, are controlled by, or are under common\r
+      control with that entity. For the purposes of this definition,\r
+      "control" means (i) the power, direct or indirect, to cause the\r
+      direction or management of such entity, whether by contract or\r
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+      outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+      "You" (or "Your") shall mean an individual or Legal Entity\r
+      exercising permissions granted by this License.\r
+\r
+      "Source" form shall mean the preferred form for making modifications,\r
+      including but not limited to software source code, documentation\r
+      source, and configuration files.\r
+\r
+      "Object" form shall mean any form resulting from mechanical\r
+      transformation or translation of a Source form, including but\r
+      not limited to compiled object code, generated documentation,\r
+      and conversions to other media types.\r
+\r
+      "Work" shall mean the work of authorship, whether in Source or\r
+      Object form, made available under the License, as indicated by a\r
+      copyright notice that is included in or attached to the work\r
+      (an example is provided in the Appendix below).\r
+\r
+      "Derivative Works" shall mean any work, whether in Source or Object\r
+      form, that is based on (or derived from) the Work and for which the\r
+      editorial revisions, annotations, elaborations, or other modifications\r
+      represent, as a whole, an original work of authorship. For the purposes\r
+      of this License, Derivative Works shall not include works that remain\r
+      separable from, or merely link (or bind by name) to the interfaces of,\r
+      the Work and Derivative Works thereof.\r
+\r
+      "Contribution" shall mean any work of authorship, including\r
+      the original version of the Work and any modifications or additions\r
+      to that Work or Derivative Works thereof, that is intentionally\r
+      submitted to Licensor for inclusion in the Work by the copyright owner\r
+      or by an individual or Legal Entity authorized to submit on behalf of\r
+      the copyright owner. For the purposes of this definition, "submitted"\r
+      means any form of electronic, verbal, or written communication sent\r
+      to the Licensor or its representatives, including but not limited to\r
+      communication on electronic mailing lists, source code control systems,\r
+      and issue tracking systems that are managed by, or on behalf of, the\r
+      Licensor for the purpose of discussing and improving the Work, but\r
+      excluding communication that is conspicuously marked or otherwise\r
+      designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+      "Contributor" shall mean Licensor and any individual or Legal Entity\r
+      on behalf of whom a Contribution has been received by Licensor and\r
+      subsequently incorporated within the Work.\r
+\r
+   2. Grant of Copyright License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      copyright license to reproduce, prepare Derivative Works of,\r
+      publicly display, publicly perform, sublicense, and distribute the\r
+      Work and such Derivative Works in Source or Object form.\r
+\r
+   3. Grant of Patent License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      (except as stated in this section) patent license to make, have made,\r
+      use, offer to sell, sell, import, and otherwise transfer the Work,\r
+      where such license applies only to those patent claims licensable\r
+      by such Contributor that are necessarily infringed by their\r
+      Contribution(s) alone or by combination of their Contribution(s)\r
+      with the Work to which such Contribution(s) was submitted. If You\r
+      institute patent litigation against any entity (including a\r
+      cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+      or a Contribution incorporated within the Work constitutes direct\r
+      or contributory patent infringement, then any patent licenses\r
+      granted to You under this License for that Work shall terminate\r
+      as of the date such litigation is filed.\r
+\r
+   4. Redistribution. You may reproduce and distribute copies of the\r
+      Work or Derivative Works thereof in any medium, with or without\r
+      modifications, and in Source or Object form, provided that You\r
+      meet the following conditions:\r
+\r
+      (a) You must give any other recipients of the Work or\r
+          Derivative Works a copy of this License; and\r
+\r
+      (b) You must cause any modified files to carry prominent notices\r
+          stating that You changed the files; and\r
+\r
+      (c) You must retain, in the Source form of any Derivative Works\r
+          that You distribute, all copyright, patent, trademark, and\r
+          attribution notices from the Source form of the Work,\r
+          excluding those notices that do not pertain to any part of\r
+          the Derivative Works; and\r
+\r
+      (d) If the Work includes a "NOTICE" text file as part of its\r
+          distribution, then any Derivative Works that You distribute must\r
+          include a readable copy of the attribution notices contained\r
+          within such NOTICE file, excluding those notices that do not\r
+          pertain to any part of the Derivative Works, in at least one\r
+          of the following places: within a NOTICE text file distributed\r
+          as part of the Derivative Works; within the Source form or\r
+          documentation, if provided along with the Derivative Works; or,\r
+          within a display generated by the Derivative Works, if and\r
+          wherever such third-party notices normally appear. The contents\r
+          of the NOTICE file are for informational purposes only and\r
+          do not modify the License. You may add Your own attribution\r
+          notices within Derivative Works that You distribute, alongside\r
+          or as an addendum to the NOTICE text from the Work, provided\r
+          that such additional attribution notices cannot be construed\r
+          as modifying the License.\r
+\r
+      You may add Your own copyright statement to Your modifications and\r
+      may provide additional or different license terms and conditions\r
+      for use, reproduction, or distribution of Your modifications, or\r
+      for any such Derivative Works as a whole, provided Your use,\r
+      reproduction, and distribution of the Work otherwise complies with\r
+      the conditions stated in this License.\r
+\r
+   5. Submission of Contributions. Unless You explicitly state otherwise,\r
+      any Contribution intentionally submitted for inclusion in the Work\r
+      by You to the Licensor shall be under the terms and conditions of\r
+      this License, without any additional terms or conditions.\r
+      Notwithstanding the above, nothing herein shall supersede or modify\r
+      the terms of any separate license agreement you may have executed\r
+      with Licensor regarding such Contributions.\r
+\r
+   6. Trademarks. This License does not grant permission to use the trade\r
+      names, trademarks, service marks, or product names of the Licensor,\r
+      except as required for reasonable and customary use in describing the\r
+      origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+   7. Disclaimer of Warranty. Unless required by applicable law or\r
+      agreed to in writing, Licensor provides the Work (and each\r
+      Contributor provides its Contributions) on an "AS IS" BASIS,\r
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+      implied, including, without limitation, any warranties or conditions\r
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+      PARTICULAR PURPOSE. You are solely responsible for determining the\r
+      appropriateness of using or redistributing the Work and assume any\r
+      risks associated with Your exercise of permissions under this License.\r
+\r
+   8. Limitation of Liability. In no event and under no legal theory,\r
+      whether in tort (including negligence), contract, or otherwise,\r
+      unless required by applicable law (such as deliberate and grossly\r
+      negligent acts) or agreed to in writing, shall any Contributor be\r
+      liable to You for damages, including any direct, indirect, special,\r
+      incidental, or consequential damages of any character arising as a\r
+      result of this License or out of the use or inability to use the\r
+      Work (including but not limited to damages for loss of goodwill,\r
+      work stoppage, computer failure or malfunction, or any and all\r
+      other commercial damages or losses), even if such Contributor\r
+      has been advised of the possibility of such damages.\r
+\r
+   9. Accepting Warranty or Additional Liability. While redistributing\r
+      the Work or Derivative Works thereof, You may choose to offer,\r
+      and charge a fee for, acceptance of support, warranty, indemnity,\r
+      or other liability obligations and/or rights consistent with this\r
+      License. However, in accepting such obligations, You may act only\r
+      on Your own behalf and on Your sole responsibility, not on behalf\r
+      of any other Contributor, and only if You agree to indemnify,\r
+      defend, and hold each Contributor harmless for any liability\r
+      incurred by, or claims asserted against, such Contributor by reason\r
+      of your accepting any such warranty or additional liability.\r
+\r
+   END OF TERMS AND CONDITIONS\r
+\r
+   APPENDIX: How to apply the Apache License to your work.\r
+\r
+      To apply the Apache License to your work, attach the following\r
+      boilerplate notice, with the fields enclosed by brackets "[]"\r
+      replaced with your own identifying information. (Don't include\r
+      the brackets!)  The text should be enclosed in the appropriate\r
+      comment syntax for the file format. We also recommend that a\r
+      file or class name and description of purpose be included on the\r
+      same "printed page" as the copyright notice for easier\r
+      identification within third-party archives.\r
+\r
+   Copyright [yyyy] [name of copyright owner]\r
+\r
+   Licensed under the Apache License, Version 2.0 (the "License");\r
+   you may not use this file except in compliance with the License.\r
+   You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
+\r
+\r
index 1ff157668b787727fe315270adb342ca0d350164..9c1d5e7f7e68f65617182ce5eea53e62484a61ee 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
@@ -19,7 +19,7 @@
 #include "tts_dbus.h"
 
 #define MAX_TEXT_COUNT 1000
-#define CONNECTION_RETRY_COUNT 3
+#define CONNECTION_RETRY_COUNT 2
 
 /* Function definition */
 int __tts_check_tts_daemon();
@@ -38,18 +38,20 @@ int tts_create(tts_h* tts)
                return TTS_ERROR_INVALID_PARAMETER;
        }       
 
-       /* Check daemon is running */
-       __tts_check_tts_daemon();
-
        if (0 == tts_client_get_size()) {
                if (0 != tts_dbus_open_connection()) {
-                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to open dbus connection\n ");
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to open dbus connection");
                        SLOG(LOG_DEBUG, TAG_TTSC, "=====");
                        SLOG(LOG_DEBUG, TAG_TTSC, " ");
                        return TTS_ERROR_OPERATION_FAILED;
                }
        }
 
+       /* Send hello */
+       if (0 != tts_dbus_request_hello()) {
+               __tts_check_tts_daemon();
+       }
+
        if (0 != tts_client_new(tts)) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to create client!!!!!");
                SLOG(LOG_DEBUG, TAG_TTSC, "=====");
@@ -58,7 +60,7 @@ int tts_create(tts_h* tts)
        }
 
        /* do request initialize */
-       int i = 0;
+       int i = 1;
        while(1) {
                ret = tts_dbus_request_initialize((*tts)->handle);
 
@@ -68,11 +70,10 @@ int tts_create(tts_h* tts)
                        SLOG(LOG_DEBUG, TAG_TTSC, "=====");
                        SLOG(LOG_DEBUG, TAG_TTSC, " ");
                        return ret;
-               } else if( ret ) {
-                       sleep(1);
+               } else if (TTS_ERROR_NONE != ret) {
+                       usleep(1);
                        if (i == CONNECTION_RETRY_COUNT) {
-                           tts_client_destroy(*tts);
-                           SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Connection Time out");
+                           SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to connection");
                            SLOG(LOG_DEBUG, TAG_TTSC, "=====");
                            SLOG(LOG_DEBUG, TAG_TTSC, " ");
                            return TTS_ERROR_TIMED_OUT;                     
@@ -767,10 +768,9 @@ static bool _tts_is_alive()
        FILE *fp = NULL;
        char buff[256];
        char cmd[256];
-       int i=0;
 
-       memset(buff, 0, sizeof(char));
-       memset(cmd, 0, sizeof(char));
+       memset(buff, '\0', sizeof(char) * 256);
+       memset(cmd, '\0', sizeof(char) * 256);
 
        if ((fp = popen("ps -eo \"cmd\"", "r")) == NULL) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] popen error \n");
@@ -778,11 +778,6 @@ static bool _tts_is_alive()
        }
 
        while(fgets(buff, 255, fp)) {
-               if (0 == i) {
-                       i++;
-                       continue;
-               }
-
                sscanf(buff, "%s", cmd);
 
                if (0 == strncmp(cmd, "[tts-daemon]", strlen("[tts-daemon]")) ||
@@ -792,11 +787,12 @@ static bool _tts_is_alive()
                        fclose(fp);
                        return TRUE;
                }
-
-               i++;
        }
+
        fclose(fp);
 
+       SLOG(LOG_DEBUG, TAG_TTSC, "THERE IS NO tts-daemon !! \n");
+
        return FALSE;
 }
 
@@ -823,9 +819,6 @@ int __tts_check_tts_daemon()
                return 0;
        
        /* fork-exec tts-daemom */
-       SLOG(LOG_DEBUG, TAG_TTSC, "THERE IS NO tts-daemon \n");
-       SLOG(LOG_DEBUG, TAG_TTSC, "START TTS-DAEMON \n");
-
        int pid, i;
        struct sigaction act, dummy;
 
index 6ce02b7900bed77ccaed53feb8a5d3e4f89ff98a..084f95621b1529f8e7dff94ecf3755784ec77be4 100644 (file)
@@ -1,15 +1,18 @@
 /*
-* Copyright (c) 2011 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
-*  http://www.apache.org/licenses/LICENSE-2.0
-*  Unless required by applicable law or agreed to in writing, software
-*  distributed under the License is distributed on an "AS IS" BASIS,
-*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*  See the License for the specific language governing permissions and
-*  limitations under the License.
-*/
+ * Copyright (c) 2011 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
 
 
 #ifndef __TTS_H__
@@ -281,7 +284,7 @@ int tts_get_state(tts_h tts, tts_state_e* state);
 * @param[in] language The language selected from the foreach function
 * @param[in] voice_type The voice type selected from the foreach function
 * @param[in] speed A speaking speed
-* @param[out] utt_id The utterance ID passed to the callback function.
+* @param[out] utt_id The utterance ID passed to the callback function
 *
 * @return 0 on success, otherwise a negative error value
 * @retval #TTS_ERROR_NONE Successful
index 450a30ac7e8e1e582d7210e96d91eab787de14ab..5b348fc6f04a09f287d4b501e9d583b7d0453025 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
index ad0a60c8710aa1c7fcd817ef00be27b34ea9dcc3..494327e1ed2c7614d1313714422f341708c7b876 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
index 41a2cd2030dec4e6eb35d8ba9a2767b9c6b8e906..d0c65380d0d2191540edcc671bc23fe47094375b 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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,6 +17,7 @@
 #include "tts_dbus.h"
 #include "tts_defs.h"
 
+#define WAITING_TIME 1000
 
 static Ecore_Fd_Handler* g_fd_handler = NULL;
 
@@ -50,12 +51,14 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
 
        DBusError err;
        dbus_error_init(&err);
+
+       DBusMessage *reply = NULL; 
        
        char if_name[64];
        snprintf(if_name, 64, "%s%d", TTS_CLIENT_SERVICE_INTERFACE, getpid());
 
        /* check if the message is a signal from the correct interface and with the correct name */
-       if (dbus_message_is_signal(msg, if_name, TTS_SIGNAL_UTTERANCE_STARTED)) {
+       if (dbus_message_is_method_call(msg, if_name, TTS_METHOD_UTTERANCE_STARTED)) {
                SLOG(LOG_DEBUG, TAG_TTSC, "===== Get utterance started");
                int uid, uttid;
                dbus_message_get_args(msg, &err,
@@ -70,11 +73,16 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
                        SLOG(LOG_DEBUG, TAG_TTSC, "<<<< Get Utterance started signal : uid(%d), uttid(%d) \n", uid, uttid);
                        __tts_cb_utt_started(uid, uttid);
                }
+               reply = dbus_message_new_method_return(msg);
+               dbus_connection_send(conn, reply, NULL);
+               dbus_connection_flush(conn);
+               dbus_message_unref(reply); 
+
                SLOG(LOG_DEBUG, TAG_TTSC, "=====");
                SLOG(LOG_DEBUG, TAG_TTSC, " ");
        }/* TTS_SIGNAL_UTTERANCE_STARTED */
 
-       else if (dbus_message_is_signal(msg, if_name, TTS_SIGNAL_UTTERANCE_COMPLETED)) {
+       else if (dbus_message_is_method_call(msg, if_name, TTS_METHOD_UTTERANCE_COMPLETED)) {
                SLOG(LOG_DEBUG, TAG_TTSC, "===== Get utterance completed");
                int uid, uttid;
                dbus_message_get_args(msg, &err,
@@ -89,11 +97,17 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
                        SLOG(LOG_DEBUG, TAG_TTSC, "<<<< Get Utterance completed signal : uid(%d), uttid(%d) \n", uid, uttid);
                        __tts_cb_utt_completed(uid, uttid);
                }
+
+               reply = dbus_message_new_method_return(msg);
+               dbus_connection_send(conn, reply, NULL);
+               dbus_connection_flush(conn);
+               dbus_message_unref(reply);
+
                SLOG(LOG_DEBUG, TAG_TTSC, "=====");
                SLOG(LOG_DEBUG, TAG_TTSC, " ");
        }/* TTS_SIGNAL_UTTERANCE_COMPLETED */
 
-       else if (dbus_message_is_signal(msg, if_name, TTS_SIGNAL_INTERRUPT)) {
+       else if (dbus_message_is_method_call(msg, if_name, TTS_METHOD_INTERRUPT)) {
                SLOG(LOG_DEBUG, TAG_TTSC, "===== Get interrupt callback");
                int uid;
                int code;
@@ -109,11 +123,17 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
                        SLOG(LOG_DEBUG, TAG_TTSC, "<<<< Get Interrupt signal : uid(%d) , interrupt code(%d)\n", uid, code);
                        __tts_cb_interrupt(uid, (tts_interrupted_code_e)code);
                }
+
+               reply = dbus_message_new_method_return(msg);
+               dbus_connection_send(conn, reply, NULL);
+               dbus_connection_flush(conn);
+               dbus_message_unref(reply);
+
                SLOG(LOG_DEBUG, TAG_TTSC, "=====");
                SLOG(LOG_DEBUG, TAG_TTSC, " ");
        } /* TTS_SIGNAL_INTERRUPT */
 
-       else if (dbus_message_is_signal(msg, if_name, TTS_SIGNAL_ERROR)) {
+       else if (dbus_message_is_method_call(msg, if_name, TTS_METHOD_ERROR)) {
                SLOG(LOG_DEBUG, TAG_TTSC, "===== Get error callback");
 
                int uid;
@@ -133,6 +153,12 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
                        SLOG(LOG_DEBUG, TAG_TTSC, "<<<< Get Error signal : uid(%d), error(%d), uttid(%d)\n", uid, reason, uttid);
                        __tts_cb_error(uid, reason, uttid);
                }
+
+               reply = dbus_message_new_method_return(msg);
+               dbus_connection_send(conn, reply, NULL);
+               dbus_connection_flush(conn);
+               dbus_message_unref(reply);
+
                SLOG(LOG_DEBUG, TAG_TTSC, "=====");
                SLOG(LOG_DEBUG, TAG_TTSC, " ");
        }/* TTS_SIGNAL_ERROR */
@@ -170,6 +196,8 @@ int tts_dbus_open_connection()
                return TTS_ERROR_OPERATION_FAILED; 
        }
 
+       dbus_connection_set_exit_on_disconnect(g_conn, false);
+
        int pid = getpid();
 
        char service_name[64];
@@ -206,7 +234,7 @@ int tts_dbus_open_connection()
        int fd = 0;
        dbus_connection_get_unix_fd(g_conn, &fd);
 
-       g_fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, (Ecore_Fd_Cb)listener_event_callback, g_conn, NULL, NULL);
+       g_fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ | ECORE_FD_ERROR | ECORE_FD_WRITE, (Ecore_Fd_Cb)listener_event_callback, g_conn, NULL, NULL);
 
        if (NULL == g_fd_handler) { 
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to get fd handler from ecore \n");
@@ -230,15 +258,79 @@ int tts_dbus_close_connection()
 
        dbus_bus_release_name (g_conn, service_name, &err);
 
+       dbus_connection_close(g_conn);
+
        g_conn = NULL;
 
        return 0;
 }
 
 
+int tts_dbus_reconnect()
+{
+       bool connected = dbus_connection_get_is_connected(g_conn);
+       SLOG(LOG_DEBUG, "[DBUS] %s\n", connected ? "Connected" : "Not connected");
+
+       if (false == connected) {
+               tts_dbus_close_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;
+}
+
+
+int tts_dbus_request_hello()
+{
+       DBusMessage* msg;
+
+       msg = dbus_message_new_method_call(
+               TTS_SERVER_SERVICE_NAME, 
+               TTS_SERVER_SERVICE_OBJECT_PATH, 
+               TTS_SERVER_SERVICE_INTERFACE, 
+               TTS_METHOD_HELLO);
+
+       if (NULL == msg) { 
+               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts hello : Fail to make message \n"); 
+               return TTS_ERROR_OPERATION_FAILED;
+       } else {
+               SLOG(LOG_DEBUG, TAG_TTSC, ">>>> Request tts hello");
+       }
+
+       DBusError err;
+       dbus_error_init(&err);
+
+       DBusMessage* result_msg = NULL;
+       int result = 0;
+
+       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 500, &err);
+
+       dbus_message_unref(msg);
+
+       if (NULL != result_msg) {
+               dbus_message_unref(result_msg);
+
+               SLOG(LOG_DEBUG, TAG_TTSC, "<<<< tts hello");
+               result = 0;
+       } else {
+               SLOG(LOG_ERROR, TAG_TTSC, "<<<< tts hello : no response");
+               result = TTS_ERROR_OPERATION_FAILED;
+       }
+
+       return result;
+}
+
 int tts_dbus_request_initialize(int uid)
 {
        DBusMessage* msg;
+       DBusError err;
+       dbus_error_init(&err);
 
        msg = dbus_message_new_method_call(
                TTS_SERVER_SERVICE_NAME, 
@@ -247,25 +339,31 @@ int tts_dbus_request_initialize(int uid)
                TTS_METHOD_INITIALIZE);
 
        if (NULL == msg) { 
-               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts initialize : Fail to make message \n"); 
+               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts initialize : Fail to make message \n");
+               if (dbus_error_is_set(&err))  
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
+       
                return TTS_ERROR_OPERATION_FAILED;
        } else {
                SLOG(LOG_DEBUG, TAG_TTSC, ">>>> Request tts initialize : uid(%d)", uid);
        }
 
        int pid = getpid();
-       dbus_message_append_args( msg, 
-               DBUS_TYPE_INT32, &pid,
-               DBUS_TYPE_INT32, &uid,
-               DBUS_TYPE_INVALID);
+       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"); 
 
-       DBusError err;
-       dbus_error_init(&err);
+               return TTS_ERROR_OPERATION_FAILED;
+       }
 
        DBusMessage* result_msg;
        int result = TTS_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, WAITING_TIME, &err);
+       dbus_message_unref(msg);
+
+       if (dbus_error_is_set(&err))  
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
 
        if (NULL != result_msg) {
                dbus_message_get_args(result_msg, &err,
@@ -281,6 +379,9 @@ int tts_dbus_request_initialize(int uid)
                dbus_message_unref(result_msg);
        } else {
                SLOG(LOG_ERROR, TAG_TTSC, "<<<< Result message is NULL ");
+               if (dbus_error_is_set(&err))  
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
+               tts_dbus_reconnect();
        }
 
        if (0 == result) {
@@ -289,8 +390,6 @@ int tts_dbus_request_initialize(int uid)
                SLOG(LOG_ERROR, TAG_TTSC, "<<<< tts initialize : result = %d \n", result);
        }
        
-       dbus_message_unref(msg);
-
        return result;
 }
 
@@ -298,6 +397,8 @@ int tts_dbus_request_initialize(int uid)
 int tts_dbus_request_finalize(int uid)
 {
        DBusMessage* msg;
+       DBusError err;
+       dbus_error_init(&err);
 
        msg = dbus_message_new_method_call(
                TTS_SERVER_SERVICE_NAME, 
@@ -306,21 +407,30 @@ int tts_dbus_request_finalize(int uid)
                TTS_METHOD_FINALIZE);
 
        if (NULL == msg) { 
-               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts finalize : Fail to make message \n"); 
+               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts finalize : Fail to make message"); 
+               if (dbus_error_is_set(&err))  
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
+
                return TTS_ERROR_OPERATION_FAILED;
        } else {
                SLOG(LOG_DEBUG, TAG_TTSC, ">>>> Request tts finalize : uid(%d)", uid);
        }
 
-       dbus_message_append_args(msg, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
+       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"); 
 
-       DBusError err;
-       dbus_error_init(&err);
+               return TTS_ERROR_OPERATION_FAILED;
+       }
 
        DBusMessage* result_msg;
        int result = TTS_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, WAITING_TIME, &err);
+       dbus_message_unref(msg);
+
+       if (dbus_error_is_set(&err))  
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
 
        if (NULL != result_msg) {
                dbus_message_get_args(result_msg, &err, DBUS_TYPE_INT32, &result, DBUS_TYPE_INVALID);
@@ -334,6 +444,9 @@ int tts_dbus_request_finalize(int uid)
                dbus_message_unref(result_msg);
        } else {
                SLOG(LOG_ERROR, TAG_TTSC, "<<<< Result message is NULL ");
+               if (dbus_error_is_set(&err))  
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
+               tts_dbus_reconnect();
        }
 
        if (0 == result) {
@@ -342,14 +455,14 @@ int tts_dbus_request_finalize(int uid)
                SLOG(LOG_ERROR, TAG_TTSC, "<<<< tts finalize : result = %d \n", result);
        }
 
-       dbus_message_unref(msg);
-
        return result;
 }
 
 int tts_dbus_request_get_support_voice(int uid, tts_h tts, tts_supported_voice_cb callback, void* user_data)
 {
        DBusMessage* msg;
+       DBusError err;
+       dbus_error_init(&err);
 
        msg = dbus_message_new_method_call(
                TTS_SERVER_SERVICE_NAME, 
@@ -358,24 +471,33 @@ int tts_dbus_request_get_support_voice(int uid, tts_h tts, tts_supported_voice_c
                TTS_METHOD_GET_SUPPORT_VOICES);
 
        if (NULL == msg) { 
-               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts get supported voices : Fail to make message \n"); 
+               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts get supported voices : Fail to make message"); 
+               if (dbus_error_is_set(&err))  
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
+
                return TTS_ERROR_OPERATION_FAILED;
        } else {
                SLOG(LOG_DEBUG, TAG_TTSC, ">>>> Request tts get supported voices : uid(%d)", uid);
        }
 
-       dbus_message_append_args( msg, 
-               DBUS_TYPE_INT32, &uid,
-               DBUS_TYPE_INVALID);
+       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"); 
 
-       DBusError err;
-       dbus_error_init(&err);
+               return TTS_ERROR_OPERATION_FAILED;
+       }
 
        DBusMessage* result_msg;
        DBusMessageIter args;
        int result = TTS_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err );
+       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, WAITING_TIME, &err );
+       dbus_message_unref(msg);
+
+       if (dbus_error_is_set(&err)) {
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
+               printf("result message : %p\n", result_msg);
+       }
 
        if (NULL != result_msg) {
                if (dbus_message_iter_init(result_msg, &args)) {
@@ -423,10 +545,11 @@ int tts_dbus_request_get_support_voice(int uid, tts_h tts, tts_supported_voice_c
                dbus_message_unref(result_msg);
        } else {
                SLOG(LOG_ERROR, TAG_TTSC, "<<<< Result message is NULL");
+               if (dbus_error_is_set(&err))  
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
+               tts_dbus_reconnect();
        }
 
-       dbus_message_unref(msg);
-
        return result;
 }
 
@@ -438,6 +561,8 @@ int tts_dbus_request_get_default_voice(int uid , char** lang, tts_voice_type_e*
        }
 
        DBusMessage* msg;
+       DBusError err;
+       dbus_error_init(&err);
 
        msg = dbus_message_new_method_call(
                TTS_SERVER_SERVICE_NAME, 
@@ -446,25 +571,34 @@ int tts_dbus_request_get_default_voice(int uid , char** lang, tts_voice_type_e*
                TTS_METHOD_GET_CURRENT_VOICE);
 
        if (NULL == msg) { 
-               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts get default voice : Fail to make message \n"); 
+               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts get default voice : Fail to make message"); 
+               if (dbus_error_is_set(&err))  
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
+
                return TTS_ERROR_OPERATION_FAILED;
        } else {
                SLOG(LOG_DEBUG, TAG_TTSC, ">>>> Request tts get default voice : uid(%d)", uid);
        }
 
-       dbus_message_append_args( msg, 
-               DBUS_TYPE_INT32, &uid,
-               DBUS_TYPE_INVALID);
+       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"); 
 
-       DBusError err;
-       dbus_error_init(&err);
+               return TTS_ERROR_OPERATION_FAILED;
+       }
 
        DBusMessage* result_msg;
        int result = TTS_ERROR_OPERATION_FAILED;
        char* temp_lang;
        int voice_type;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, WAITING_TIME, &err);
+       dbus_message_unref(msg);
+
+       if (dbus_error_is_set(&err)) {
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
+               printf("result message : %p\n", result_msg);
+       }
 
        if (NULL != result_msg) {
                dbus_message_get_args(result_msg, &err,
@@ -481,6 +615,9 @@ int tts_dbus_request_get_default_voice(int uid , char** lang, tts_voice_type_e*
                dbus_message_unref(result_msg);
        } else {
                SLOG(LOG_ERROR, TAG_TTSC, "<<<< Result message is NULL ");
+               if (dbus_error_is_set(&err))  
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
+               tts_dbus_reconnect();
        }
 
        if (0 == result) {
@@ -497,8 +634,6 @@ int tts_dbus_request_get_default_voice(int uid , char** lang, tts_voice_type_e*
                SLOG(LOG_ERROR, TAG_TTSC, "<<<< tts get default voice : result(%d) \n", result);
        }
 
-       dbus_message_unref(msg);
-
        return result;
 }
 
@@ -511,6 +646,8 @@ int tts_dbus_request_add_text(int uid, const char* text, const char* lang, int v
        }
 
        DBusMessage* msg;
+       DBusError err;
+       dbus_error_init(&err);
 
        msg = dbus_message_new_method_call(
                TTS_SERVER_SERVICE_NAME, 
@@ -519,29 +656,38 @@ int tts_dbus_request_add_text(int uid, const char* text, const char* lang, int v
                TTS_METHOD_ADD_QUEUE);
 
        if (NULL == msg) { 
-               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts add text : Fail to make message \n"); 
+               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts add text : Fail to make message"); 
+               if (dbus_error_is_set(&err))  
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.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);
        }
 
-       dbus_message_append_args( msg, 
+       if (true != dbus_message_append_args( msg, 
                DBUS_TYPE_INT32, &uid,
                DBUS_TYPE_STRING, &text,
                DBUS_TYPE_STRING, &lang,
                DBUS_TYPE_INT32, &vctype,
                DBUS_TYPE_INT32, &speed,
                DBUS_TYPE_INT32, &uttid,
-               DBUS_TYPE_INVALID);
+               DBUS_TYPE_INVALID)) {
+               dbus_message_unref(msg);
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to append args"); 
 
-       DBusError err;
-       dbus_error_init(&err);
+               return TTS_ERROR_OPERATION_FAILED;
+       }
 
        DBusMessage* result_msg;
        int result = TTS_ERROR_OPERATION_FAILED;
 
        result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 5000, &err);
+       dbus_message_unref(msg);
+
+       if (dbus_error_is_set(&err))  
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
 
        if (NULL != result_msg) {
                dbus_message_get_args(result_msg, &err,
@@ -556,15 +702,16 @@ int tts_dbus_request_add_text(int uid, const char* text, const char* lang, int v
                dbus_message_unref(result_msg);
        } else {
                SLOG(LOG_ERROR, TAG_TTSC, "<<<< Result message is NULL ");
+               if (dbus_error_is_set(&err))  
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
+               tts_dbus_reconnect();
        }
 
        if (0 == result) {
                SLOG(LOG_DEBUG, TAG_TTSC, "<<<< tts add text : result(%d) \n", result);
        } else {
                SLOG(LOG_ERROR, TAG_TTSC, "<<<< tts add text : result(%d) \n", result);
-       }
-
-       dbus_message_unref(msg);
+       }       
 
        return result;
 }
@@ -572,6 +719,8 @@ int tts_dbus_request_add_text(int uid, const char* text, const char* lang, int v
 int tts_dbus_request_play(int uid) 
 {
        DBusMessage* msg;
+       DBusError err;
+       dbus_error_init(&err);
 
        msg = dbus_message_new_method_call(
                TTS_SERVER_SERVICE_NAME,
@@ -580,23 +729,30 @@ int tts_dbus_request_play(int uid)
                TTS_METHOD_PLAY );               
 
        if (NULL == msg) { 
-               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts play : Fail to make message \n"); 
+               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts play : Fail to make message"); 
+               if (dbus_error_is_set(&err))  
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
+
                return TTS_ERROR_OPERATION_FAILED;
        } else {
                SLOG(LOG_DEBUG, TAG_TTSC, ">>>> Request tts play : uid(%d)", uid);
        }
        
-       dbus_message_append_args( msg, 
-               DBUS_TYPE_INT32, &uid,
-               DBUS_TYPE_INVALID);
+       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"); 
 
-       DBusError err;
-       dbus_error_init(&err);
+               return TTS_ERROR_OPERATION_FAILED;
+       }
 
        DBusMessage* result_msg;
        int result = TTS_ERROR_OPERATION_FAILED;
 
        result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 5000, &err);
+       dbus_message_unref(msg);
+
+       if (dbus_error_is_set(&err))  
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
 
        if (NULL != result_msg) {
                dbus_message_get_args(result_msg, &err,
@@ -611,6 +767,9 @@ int tts_dbus_request_play(int uid)
                dbus_message_unref(result_msg);
        } else {
                SLOG(LOG_ERROR, TAG_TTSC, "<<<< Result message is NULL ");
+               if (dbus_error_is_set(&err))  
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
+               tts_dbus_reconnect();
        }
 
        if (0 == result) {
@@ -618,8 +777,6 @@ int tts_dbus_request_play(int uid)
        } else {
                SLOG(LOG_ERROR, TAG_TTSC, "<<<< tts play : result(%d) \n", result);
        }
-
-       dbus_message_unref(msg);
        
        return result;
 }
@@ -628,6 +785,8 @@ int tts_dbus_request_play(int uid)
 int tts_dbus_request_stop(int uid)
 {
        DBusMessage* msg;
+       DBusError err;
+       dbus_error_init(&err);
 
        msg = dbus_message_new_method_call(
                TTS_SERVER_SERVICE_NAME, 
@@ -636,21 +795,30 @@ int tts_dbus_request_stop(int uid)
                TTS_METHOD_STOP);
 
        if (NULL == msg) { 
-               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts stop : Fail to make message \n"); 
+               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts stop : Fail to make message"); 
+               if (dbus_error_is_set(&err))  
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
+
                return TTS_ERROR_OPERATION_FAILED;
        } else {
                SLOG(LOG_DEBUG, TAG_TTSC, ">>>> Request tts stop : uid(%d)", uid);
        }
 
-       DBusError err;
-       dbus_error_init(&err);
-
        DBusMessage* result_msg;
        int result = TTS_ERROR_OPERATION_FAILED;
 
-       dbus_message_append_args(msg, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
+       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"); 
+
+               return TTS_ERROR_OPERATION_FAILED;
+       }
 
        result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 5000, &err);
+       dbus_message_unref(msg);
+
+       if (dbus_error_is_set(&err))  
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
 
        if (NULL != result_msg) {
                dbus_message_get_args(result_msg, &err,
@@ -665,6 +833,9 @@ int tts_dbus_request_stop(int uid)
                dbus_message_unref(result_msg);
        } else {
                SLOG(LOG_ERROR, TAG_TTSC, "<<<< Result message is NULL ");
+               if (dbus_error_is_set(&err))  
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
+               tts_dbus_reconnect();
        }
 
        if (0 == result) {
@@ -673,14 +844,14 @@ int tts_dbus_request_stop(int uid)
                SLOG(LOG_ERROR, TAG_TTSC, "<<<< tts stop : result(%d) \n", result);
        }
 
-       dbus_message_unref(msg);
-
        return result;
 }
 
 int tts_dbus_request_pause(int uid)
 {
        DBusMessage* msg;
+       DBusError err;
+       dbus_error_init(&err);
 
        msg = dbus_message_new_method_call(
                TTS_SERVER_SERVICE_NAME, 
@@ -689,21 +860,30 @@ int tts_dbus_request_pause(int uid)
                TTS_METHOD_PAUSE);
 
        if (NULL == msg) { 
-               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts pause : Fail to make message \n"); 
+               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts pause : Fail to make message"); 
+               if (dbus_error_is_set(&err))  
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
+
                return TTS_ERROR_OPERATION_FAILED;
        } else {
                SLOG(LOG_DEBUG, TAG_TTSC, ">>>> Request tts pause : uid(%d)", uid);
        }
 
-       DBusError err;
-       dbus_error_init(&err);
-
        DBusMessage* result_msg;
        int result = TTS_ERROR_OPERATION_FAILED;
 
-       dbus_message_append_args(msg, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
+       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"); 
+
+               return TTS_ERROR_OPERATION_FAILED;
+       }
 
        result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 5000, &err);
+       dbus_message_unref(msg);
+
+       if (dbus_error_is_set(&err))  
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
 
        if (NULL != result_msg) {
                dbus_message_get_args(result_msg, &err,
@@ -718,6 +898,9 @@ int tts_dbus_request_pause(int uid)
                dbus_message_unref(result_msg);
        } else {
                SLOG(LOG_ERROR, TAG_TTSC, "<<<< Result message is NULL ");
+               if (dbus_error_is_set(&err))  
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] %s", err.message);
+               tts_dbus_reconnect();
        }
 
        if (0 == result) {
@@ -726,7 +909,5 @@ int tts_dbus_request_pause(int uid)
                SLOG(LOG_ERROR, TAG_TTSC, "<<<< tts pause : result(%d) \n", result);
        }
 
-       dbus_message_unref(msg);
-
        return result;
 }
index c252fc27727a131458205ca0271eb1231981cf74..89ce20eccb0dcd8d21c76a9a927cedd2b37f57ba 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
@@ -25,6 +25,9 @@ int tts_dbus_open_connection();
 
 int tts_dbus_close_connection();
 
+
+int tts_dbus_request_hello();
+
 int tts_dbus_request_initialize(int uid);
 
 int tts_dbus_request_finalize(int uid);
index e2cd33106573f29b5a1d4236a4c25eb224a21ed8..9198a802a99144d0867242e2a09714d8665b5710 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
index e8ecf9e51b36e7580bcee4ad6c03781c49f0d62b..86a38e3a228bff5525a9fa1b4fa80a44fb5a0491 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
@@ -18,6 +18,8 @@
 #include "tts_setting.h"
 #include "tts_setting_dbus.h"
 
+#define CONNECTION_RETRY_COUNT 2
+
 static bool g_is_setting_initialized = false;
 
 static int __check_tts_daemon();
@@ -28,14 +30,11 @@ int tts_setting_initialize()
 {
        SLOG(LOG_DEBUG, TAG_TTSC, "===== Initialize TTS Setting");
 
-       /* Check daemon */
-       __check_tts_daemon();
-
        if (true == g_is_setting_initialized) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] TTS Setting has already been initialized. \n");
+               SLOG(LOG_WARN, TAG_TTSC, "[WARNING] TTS Setting has already been initialized. \n");
                SLOG(LOG_DEBUG, TAG_TTSC, "=====");
                SLOG(LOG_DEBUG, TAG_TTSC, " ");
-               return TTS_SETTING_ERROR_INVALID_STATE;
+               return TTS_SETTING_ERROR_NONE;
        }
 
        if( 0 != tts_setting_dbus_open_connection() ) {
@@ -45,8 +44,13 @@ int tts_setting_initialize()
                return TTS_SETTING_ERROR_OPERATION_FAILED;
        }
        
+       /* Send hello */
+       if (0 != tts_setting_dbus_request_hello()) {
+               __check_tts_daemon();
+       }
+
        /* do request */
-       int i = 0;
+       int i = 1;
        int ret = 0;
        while(1) {
                ret = tts_setting_dbus_request_initialize();
@@ -55,8 +59,8 @@ int tts_setting_initialize()
                        SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Engine not found");
                        break;
                } else if(ret) {
-                       sleep(1);
-                       if (i == 10) {
+                       usleep(1);
+                       if (i == CONNECTION_RETRY_COUNT) {
                                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Connection Time out");
                                ret = TTS_SETTING_ERROR_TIMED_OUT;                          
                                break;
@@ -68,7 +72,7 @@ int tts_setting_initialize()
                }
        }
 
-       if (0 == ret) {
+       if (TTS_SETTING_ERROR_NONE == ret) {
                g_is_setting_initialized = true;
                SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Initialize");
        }
@@ -85,10 +89,10 @@ int tts_setting_finalize()
        SLOG(LOG_DEBUG, TAG_TTSC, "===== Finalize TTS Setting");
 
        if (false == g_is_setting_initialized) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Not initialized");
+               SLOG(LOG_WARN, TAG_TTSC, "[WARNING] Not initialized");
                SLOG(LOG_DEBUG, TAG_TTSC, "=====");
                SLOG(LOG_DEBUG, TAG_TTSC, " ");
-               return TTS_SETTING_ERROR_INVALID_STATE;
+               return TTS_SETTING_ERROR_NONE;
        }
 
        int ret = tts_setting_dbus_request_finalilze(); 
@@ -207,7 +211,7 @@ int tts_setting_set_engine(const char* engine_id)
        return ret;
 }
 
-int tts_setting_foreach_surppoted_voices(tts_setting_supported_voice_cb callback, void* user_data)
+int tts_setting_foreach_surpported_voices(tts_setting_supported_voice_cb callback, void* user_data)
 {
        SLOG(LOG_DEBUG, TAG_TTSC, "===== Foreach supported voices");
 
@@ -447,23 +451,18 @@ static bool __tts_is_alive()
        FILE *fp = NULL;
        char buff[256];
        char cmd[256];
-       int i=0;
 
-       memset(buff, 0, sizeof(char));
-       memset(cmd, 0, sizeof(char));
+       memset(buff, '\0', sizeof(char) * 256);
+       memset(cmd, '\0', sizeof(char) * 256);
 
-       if ((fp = popen("ps -eo \"cmd\"", "r")) == NULL) {
-               SLOG(LOG_DEBUG, TAG_TTSC, "[TTS ERROR] popen error ");
+       fp = popen("ps", "r");
+       if (NULL == fp) {
+               SLOG(LOG_DEBUG, TAG_TTSC, "[TTS SETTING ERROR] popen error \n");
                return FALSE;
        }
 
        while (fgets(buff, 255, fp)) {
-               if (i == 0) {
-                       i++;
-                       continue;
-               }
-
-               sscanf(buff, "%s", cmd);
+               strcpy(cmd, buff + 26);
 
                if( 0 == strncmp(cmd, "[tts-daemon]", strlen("[tts-daemon]")) ||
                        0 == strncmp(cmd, "tts-daemon", strlen("tts-daemon")) ||
@@ -474,10 +473,11 @@ static bool __tts_is_alive()
                        return TRUE;
                }
 
-               i++;
        }
        fclose(fp);
 
+       SLOG(LOG_DEBUG, TAG_TTSC, "THERE IS NO tts-daemon !! \n");
+
        return FALSE;
 }
 
@@ -503,8 +503,6 @@ static int __check_tts_daemon()
                return 0;
 
        /* fork-exec tts-daemom */
-       SLOG(LOG_DEBUG, TAG_TTSC, "tts-daemon is NOT alive. start tts-daemon.");
-
        int pid, i;
        struct sigaction act, dummy;
 
index a13f1432a911be9dc25fa7842d1cb4a951018bf9..06e221914b1865be569075c18b6d721a7e92a252 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
@@ -90,12 +90,12 @@ typedef bool(*tts_setting_supported_engine_cb)(const char* engine_id, const char
 *              followed by ISO 639-1 for the two-letter language code. 
 *              For example, "ko_KR" for Korean, "en_US" for American English..
 * @param[in] voice_type Voice type.
-* @param[in] user_data User data passed from the tts_setting_foreach_surppoted_voices().
+* @param[in] user_data User data passed from the tts_setting_foreach_surpported_voices().
 *
 * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop.
-* @pre tts_setting_foreach_surppoted_voices() will invoke this callback. 
+* @pre tts_setting_foreach_surpported_voices() will invoke this callback. 
 *
-* @see tts_setting_foreach_surppoted_voices()
+* @see tts_setting_foreach_surpported_voices()
 */
 typedef bool(*tts_setting_supported_voice_cb)(const char* engine_id, const char* language, tts_setting_voice_type_e voice_type, void* user_data);
 
@@ -205,7 +205,7 @@ int tts_setting_set_engine(const char* engine_id);
 *
 * @see tts_setting_supported_voice_cb()
 */
-int tts_setting_foreach_surppoted_voices(tts_setting_supported_voice_cb callback, void* user_data);
+int tts_setting_foreach_surpported_voices(tts_setting_supported_voice_cb callback, void* user_data);
 
 /**
 * @brief Get a default voice of current engine.
index b56c099e4dbf715bdb8793f521bd5cc1d151e9ab..c8c57a55ef52d39c9c8c2e3677b8ddbff78e7652 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
@@ -87,6 +87,45 @@ int tts_setting_dbus_close_connection()
        return 0;
 }
 
+int tts_setting_dbus_request_hello()
+{
+       DBusMessage* msg;
+
+       msg = dbus_message_new_method_call(
+               TTS_SERVER_SERVICE_NAME, 
+               TTS_SERVER_SERVICE_OBJECT_PATH, 
+               TTS_SERVER_SERVICE_INTERFACE, 
+               TTS_SETTING_METHOD_HELLO);
+
+       if (NULL == msg) { 
+               SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request setting hello : Fail to make message \n"); 
+               return TTS_SETTING_ERROR_OPERATION_FAILED;
+       } else {
+               SLOG(LOG_DEBUG, TAG_TTSC, ">>>> Request setting hello");
+       }
+
+       DBusError err;
+       dbus_error_init(&err);
+
+       DBusMessage* result_msg = NULL;
+       int result = 0;
+
+       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 500, &err);
+
+       dbus_message_unref(msg);
+
+       if (NULL != result_msg) {
+               dbus_message_unref(result_msg);
+
+               SLOG(LOG_DEBUG, TAG_TTSC, "<<<< setting hello");
+               result = 0;
+       } else {
+               SLOG(LOG_ERROR, TAG_TTSC, "<<<< setting hello : no response");
+               result = -1;
+       }
+
+       return result;
+}
 
 int tts_setting_dbus_request_initialize()
 {
index 5894afcdcbaaf39a47edf99d2868bd04b91aca13..3f979ac659b76652fc37d60750446581d37d2c6b 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
@@ -26,6 +26,7 @@ int tts_setting_dbus_open_connection();
 
 int tts_setting_dbus_close_connection();
 
+int tts_setting_dbus_request_hello();
 
 int tts_setting_dbus_request_initialize();
 
index 520b6e57741831bd446cc8adfaba070a0c39a10b..eae80bb8303a14c0a1b04af97ae20680522fc412 100644 (file)
@@ -40,6 +40,7 @@ extern "C" {
 * Message Definition for APIs
 *******************************************************************************************/
 
+#define TTS_METHOD_HELLO               "tts_method_hello"
 #define TTS_METHOD_INITIALIZE          "tts_method_initialize"
 #define TTS_METHOD_FINALIZE            "tts_method_finalilze"
 #define TTS_METHOD_GET_SUPPORT_VOICES  "tts_method_get_support_voices"
@@ -49,16 +50,17 @@ extern "C" {
 #define TTS_METHOD_STOP                        "tts_method_stop"
 #define TTS_METHOD_PAUSE               "tts_method_pause"
 
-#define TTS_SIGNAL_INTERRUPT           "tts_signal_interrupt"
-#define TTS_SIGNAL_UTTERANCE_STARTED   "tts_utterance_started"
-#define TTS_SIGNAL_UTTERANCE_COMPLETED "tts_utterance_completed"
-#define TTS_SIGNAL_ERROR               "tts_signal_error"
+#define TTS_METHOD_INTERRUPT           "tts_method_interrupt"
+#define TTS_METHOD_UTTERANCE_STARTED   "tts_method_utterance_started"
+#define TTS_METHOD_UTTERANCE_COMPLETED "tts_method_utterance_completed"
+#define TTS_METHOD_ERROR               "tts_method_error"
 
 
 /******************************************************************************************
 * Message Definition for Setting
 *******************************************************************************************/
 
+#define TTS_SETTING_METHOD_HELLO               "tts_setting_method_hello"
 #define TTS_SETTING_METHOD_INITIALIZE          "tts_setting_method_initialize"
 #define TTS_SETTING_METHOD_FINALIZE            "tts_setting_method_finalilze"
 #define TTS_SETTING_METHOD_GET_ENGINE_LIST     "tts_setting_method_get_engine_list"
@@ -76,8 +78,9 @@ extern "C" {
 * Message Definition for tts-daemon internal
 *******************************************************************************************/
 
-#define TTS_SIGNAL_NEXT_PLAY           "tts_signal_start_play"
-#define TTS_SIGNAL_NEXT_SYNTHESIS      "tts_signal_start_synthesis"
+#define TTS_METHOD_NEXT_PLAY           "tts_method_start_play"
+#define TTS_METHOD_NEXT_SYNTHESIS      "tts_method_start_synthesis"
+
 
 #ifdef __cplusplus
 }
index ce8316b40a0c577d3b298034b8e3e4a0d31967a5..5c6c90e03c35051c23e2d6f8daaaea41fbfb2c58 100644 (file)
@@ -1,7 +1,8 @@
 tts (0.1.1-1) unstable; urgency=low
 
-  * beta release
-  * Git: tizen2/pkgs/t/tts
+  * 1.0 release.
+  * Git: pkgs/t/tts
   * Tag: tts_0.1.1-1
 
- -- Dongyeol Lee <dy3.lee@samsung.com>  Fri, 17 Feb 2012 14:48:00 +0900
+ -- Dongyeol Lee <dy3.lee@samsung.com>  Mon, 19 Mar 2012 11:37:32 +0900
+
index af0e45f4c65b761db6e89ec8df67e3a95998090e..3331343ec60c19f8e8034b656fb6eb3e1a844f58 100644 (file)
@@ -1,10 +1,10 @@
 Name:       tts
 Summary:    Text To Speech client library and daemon
 Version:    0.1.1
-Release:    2.1
+Release:    1
 Group:      libs
-License:    Apache-2.0
-Source0:    tts-%{version}.tar.bz2
+License:    Samsung
+Source0:    tts-0.1.1.tar.gz
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 BuildRequires:  pkgconfig(glib-2.0)
@@ -13,7 +13,7 @@ BuildRequires:  pkgconfig(mm-player)
 BuildRequires:  pkgconfig(mm-common)
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(vconf)
-BuildRequires:  pkgconfig(ecore-input)
+BuildRequires:  pkgconfig(ecore)
 BuildRequires:  pkgconfig(openssl)
 
 BuildRequires:  cmake
index ee2a08b646237b56d9fa59a1400e793754e6f959..83dce1c8cb25bc94904efe855bc0df1ad331a2f7 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
index fca7d60dedf6e2f2e4a790aaa9cbccdc0a602520..45e9b897d42414c9cc246fb7f5affad14142fca9 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
index e2f7fb7a7e251d8d142d2dc23e1d2e296f1fc2bb..2d59d888b28d30474554861a959c159466c75e92 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
index 2fb2bbc7aec9e9c5ffe1474ad5788e274c0d67a4..d115db63aff8fa8d9333372c1505aef886958c8f 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
index 20b5b28aea7825b7d8fad5174878a37431290a67..a6fc6738e483c6e9283c5b73e5300998d54c15be 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
 
 static DBusConnection* g_conn;
 
-int ttsdc_send_signal(int pid, int uid, int uttid, char *signal)
+int ttsdc_send_message(int pid, int uid, int uttid, char *method)
 {   
+       char service_name[64];
+       memset(service_name, 0, 64);
+       snprintf(service_name, 64, "%s%d", TTS_CLIENT_SERVICE_NAME, pid);
+
        char target_if_name[64];
        snprintf(target_if_name, sizeof(target_if_name), "%s%d", TTS_CLIENT_SERVICE_INTERFACE, pid);
 
        DBusMessage* msg;
 
-       /* create a signal & check for errors */
-       msg = dbus_message_new_signal(
-               TTS_CLIENT_SERVICE_OBJECT_PATH, /* object name of the signal */
-               target_if_name,                 /* interface name of the signal */
-               signal);                        /* name of the signal */
+       /* create a message & check for errors */
+       msg = dbus_message_new_method_call(
+               service_name, 
+               TTS_CLIENT_SERVICE_OBJECT_PATH, 
+               target_if_name, 
+               method);
 
        if (NULL == msg) { 
-               SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] Fail to create signal message : type(%s), uid(%d)\n", signal, uid); 
+               SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] Fail to create message : type(%s), uid(%d)\n", method, uid); 
                return -1;
        }
 
@@ -45,42 +50,49 @@ int ttsdc_send_signal(int pid, int uid, int uttid, char *signal)
 
        /* send the message and flush the connection */
        if (!dbus_connection_send(g_conn, msg, NULL)) {
-               SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] <<<< send signal : Out Of Memory, type(%s), ifname(%s), uid(%d), uttid(%d) \n",signal, target_if_name, uid, uttid); 
+               SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] <<<< send message : Out Of Memory, type(%s), ifname(%s), uid(%d), uttid(%d)", method, target_if_name, uid, uttid); 
        } else {
-               SLOG(LOG_DEBUG, TAG_TTSD, "<<<< send signal : type(%s), uid(%d), uttid(%d) \n", signal, uid, uttid);
+               SLOG(LOG_DEBUG, TAG_TTSD, "<<<< send message : type(%s), uid(%d), uttid(%d)", method, uid, uttid);
 
                dbus_connection_flush(g_conn);
        }
+
        dbus_message_unref(msg);
 
        return 0;
 }
 
-int ttsdc_send_utt_start_signal(int pid, int uid, int uttid)
+int ttsdc_send_utt_start_message(int pid, int uid, int uttid)
 {
-       return ttsdc_send_signal(pid, uid, uttid, TTS_SIGNAL_UTTERANCE_STARTED);
+       return ttsdc_send_message(pid, uid, uttid, TTS_METHOD_UTTERANCE_STARTED);
 }
 
-int ttsdc_send_utt_finish_signal(int pid, int uid, int uttid) 
+int ttsdc_send_utt_finish_message(int pid, int uid, int uttid) 
 {
-       return ttsdc_send_signal(pid, uid, uttid, TTS_SIGNAL_UTTERANCE_COMPLETED);
+       return ttsdc_send_message(pid, uid, uttid, TTS_METHOD_UTTERANCE_COMPLETED);
 }
 
-int ttsdc_send_interrupt_signal(int pid, int uid, ttsd_interrupted_code_e code)
+int ttsdc_send_interrupt_message(int pid, int uid, ttsd_interrupted_code_e code)
 {
-       return ttsdc_send_signal(pid, uid, (int)code, TTS_SIGNAL_INTERRUPT);
+       return ttsdc_send_message(pid, uid, (int)code, TTS_METHOD_INTERRUPT);
 }
 
-int ttsdc_send_error_signal(int pid, int uid, int uttid, int reason)
+int ttsdc_send_error_message(int pid, int uid, int uttid, int reason)
 {
+       char service_name[64];
+       memset(service_name, 0, 64);
+       snprintf(service_name, 64, "%s%d", TTS_CLIENT_SERVICE_NAME, pid);
+
        char target_if_name[128];
        snprintf(target_if_name, sizeof(target_if_name), "%s%d", TTS_CLIENT_SERVICE_INTERFACE, pid);
 
        DBusMessage* msg;
-       msg = dbus_message_new_signal(
-               TTS_CLIENT_SERVICE_OBJECT_PATH,  /* object name of the signal   */
-               target_if_name,                  /* interface name of the signal */
-               TTS_SIGNAL_ERROR );              /* name of the signal  */
+
+       msg = dbus_message_new_method_call(
+               service_name, 
+               TTS_CLIENT_SERVICE_OBJECT_PATH, 
+               target_if_name, 
+               TTS_METHOD_ERROR);
 
        if (NULL == msg) { 
                SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] Fail to create error message : uid(%d)\n", uid); 
@@ -94,9 +106,9 @@ int ttsdc_send_error_signal(int pid, int uid, int uttid, int reason)
                DBUS_TYPE_INVALID);
        
        if (!dbus_connection_send(g_conn, msg, NULL)) {
-               SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] <<<< Send error signal : Out Of Memory !\n"); 
+               SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] <<<< error message : Out Of Memory !\n"); 
        } else {
-               SLOG(LOG_DEBUG, TAG_TTSD, "<<<< Send error signal : reason(%d), uttid(%d)", reason, uttid);
+               SLOG(LOG_DEBUG, TAG_TTSD, "<<<< Send error signal : uid(%d), reason(%d), uttid(%d)", uid, reason, uttid);
                dbus_connection_flush(g_conn);
        }
 
@@ -105,6 +117,7 @@ int ttsdc_send_error_signal(int pid, int uid, int uttid, int reason)
        return 0;
 }
 
+
 static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handler)
 {
        DBusConnection* conn = (DBusConnection*)data;
@@ -122,7 +135,10 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
        }
        
        /* client event */
-       if( dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_METHOD_INITIALIZE) )
+       if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_METHOD_HELLO))
+               ttsd_dbus_server_hello(conn, msg);
+
+       else if( dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_METHOD_INITIALIZE) )
                ttsd_dbus_server_initialize(conn, msg);
        
        else if( dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_METHOD_FINALIZE) )
@@ -147,6 +163,9 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
                ttsd_dbus_server_pause(conn, msg);
 
        /* setting event */
+       else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_SETTING_METHOD_HELLO))
+               ttsd_dbus_server_hello(conn, msg);
+
        else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_SETTING_METHOD_INITIALIZE) )
                ttsd_dbus_server_setting_initialize(conn, msg);
 
@@ -183,12 +202,13 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
        else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_SETTING_METHOD_SET_ENGINE_SETTING) )
                ttsd_dbus_server_setting_set_engine_setting(conn, msg);
 
-       /* daemon internal event*/
-       else if (dbus_message_is_signal(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_SIGNAL_NEXT_PLAY)) 
+
+       else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_METHOD_NEXT_PLAY)) 
                ttsd_dbus_server_start_next_play(msg);
 
-       else if (dbus_message_is_signal(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_SIGNAL_NEXT_SYNTHESIS)) 
+       else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_METHOD_NEXT_SYNTHESIS)) 
                ttsd_dbus_server_start_next_synthesis(msg);
+       
 
        /* free the message */
        dbus_message_unref(msg);
@@ -278,14 +298,15 @@ int ttsd_dbus_close_connection()
        return 0;
 }
 
-int ttsd_send_start_next_play(int uid)
+int ttsd_send_start_next_play_message(int uid)
 {
        DBusMessage* msg;
 
-       msg = dbus_message_new_signal(
-               TTS_SERVER_SERVICE_OBJECT_PATH, /* object name of the signal */
-               TTS_SERVER_SERVICE_INTERFACE,   /* interface name of the signal */
-               TTS_SIGNAL_NEXT_PLAY ); /* name of the signal */
+       msg = dbus_message_new_method_call(
+               TTS_SERVER_SERVICE_NAME, 
+               TTS_SERVER_SERVICE_OBJECT_PATH, 
+               TTS_SERVER_SERVICE_INTERFACE, 
+               TTS_METHOD_NEXT_PLAY);
 
        if (NULL == msg) { 
                SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] >>>> Fail to make message for 'start next play'"); 
@@ -305,14 +326,15 @@ int ttsd_send_start_next_play(int uid)
        return 0;
 }
 
-int ttsd_send_start_next_synthesis(int uid)
+int ttsd_send_start_next_synthesis_message(int uid)
 {
        DBusMessage* msg;
 
-       msg = dbus_message_new_signal(
-               TTS_SERVER_SERVICE_OBJECT_PATH, /* object name of the signal */
-               TTS_SERVER_SERVICE_INTERFACE,   /* interface name of the signal */
-               TTS_SIGNAL_NEXT_SYNTHESIS );    /* name of the signal */
+       msg = dbus_message_new_method_call(
+               TTS_SERVER_SERVICE_NAME, 
+               TTS_SERVER_SERVICE_OBJECT_PATH, 
+               TTS_SERVER_SERVICE_INTERFACE, 
+               TTS_METHOD_NEXT_SYNTHESIS);
 
        if (NULL == msg) { 
                SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] >>>> Fail to make message for 'start next synthesis'\n"); 
index 18716cfe53b806a7158c347054acec5dbfff53d8..a176bcfc20051d681df98046ecbe55542c1673ea 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
@@ -24,17 +24,17 @@ int ttsd_dbus_open_connection();
 int ttsd_dbus_close_connection();
 
 
-int ttsdc_send_utt_start_signal(int pid, int uid, int uttid);
+int ttsdc_send_utt_start_message(int pid, int uid, int uttid);
 
-int ttsdc_send_utt_finish_signal(int pid, int uid, int uttid);
+int ttsdc_send_utt_finish_message(int pid, int uid, int uttid);
 
-int ttsdc_send_error_signal(int pid, int uid, int uttid, int reason);
+int ttsdc_send_error_message(int pid, int uid, int uttid, int reason);
 
-int ttsdc_send_interrupt_signal(int pid, int uid, ttsd_interrupted_code_e code);
+int ttsdc_send_interrupt_message(int pid, int uid, ttsd_interrupted_code_e code);
 
-int ttsd_send_start_next_play(int uid);
+int ttsd_send_start_next_play_message(int uid);
 
-int ttsd_send_start_next_synthesis(int uid);
+int ttsd_send_start_next_synthesis_message(int uid);
 
 #ifdef __cplusplus
 }
index 0cc9066b35b3c4caa6923bd180ce99a92c457734..4837fcceeed75d08aa824efdc17e5317a7b3b4f6 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
@@ -23,6 +23,30 @@ extern int ttsd_data_get_pid(const int uid);
 * Dbus Client-Daemon Server
 */ 
 
+int ttsd_dbus_server_hello(DBusConnection* conn, DBusMessage* msg)
+{
+       SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> TTS Hello");
+
+       DBusMessage* reply;
+       reply = dbus_message_new_method_return(msg);
+
+       if (NULL != reply) {
+               if (!dbus_connection_send(conn, reply, NULL)) {
+                       SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] Out Of Memory!");
+               }
+
+               dbus_connection_flush(conn);
+               dbus_message_unref(reply);
+       } else {
+               SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] Fail to create reply message!!"); 
+       }
+
+       SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
+       SLOG(LOG_DEBUG, TAG_TTSD, "  ");
+
+       return 0;
+}
+
 int ttsd_dbus_server_initialize(DBusConnection* conn, DBusMessage* msg)
 {
        DBusError err;
index 76a74109d66d1a5c185b91e6fb0e4339fbd49822..f96bc4a4438ce27ca0e960d549a45ecd6129f838 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
@@ -21,6 +21,8 @@
 extern "C" {
 #endif
 
+int ttsd_dbus_server_hello(DBusConnection* conn, DBusMessage* msg);
+
 /*
 * Dbus Server functions for APIs
 */ 
index 08ac5c8ab1bc3bbae787e7c5d05db8faed4b51ec..c7f9361eeec254172293474f65f8029c4216b4ac 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
@@ -406,44 +406,72 @@ int __internal_update_engine_list()
        /* get file name from engine directory and get engine information from each filename */
        DIR *dp;
        struct dirent *dirp;
-       dp = opendir(ENGINE_DIRECTORY);
+       dp = opendir(ENGINE_DIRECTORY_DEFAULT);
 
-       if (dp == NULL) {
-               SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] __internal_update_engine_list : error opendir \n");
-               return TTSD_ERROR_OPERATION_FAILED;
-       }
+       if (dp != NULL) {
+               while ((dirp = readdir(dp)) != NULL) {
+                       ttsengine_info_s* info;
+                       char* filepath = NULL;
+                       int file_size;
 
-       SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent] Search TTS Engines");
+                       file_size = strlen(ENGINE_DIRECTORY_DEFAULT) + strlen(dirp->d_name) + 5;
+                       filepath = (char*)g_malloc0( sizeof(char) * file_size);
 
-       while ((dirp = readdir(dp)) != NULL) {
-               ttsengine_info_s* info;
-               char* filepath = NULL;
-               int file_size;
+                       if (NULL != filepath) { 
+                               strncpy(filepath, ENGINE_DIRECTORY_DEFAULT, strlen(ENGINE_DIRECTORY_DEFAULT) );
+                               strncat(filepath, "/", strlen("/") );
+                               strncat(filepath, dirp->d_name, strlen(dirp->d_name) );
+                       } else {
+                               SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not enough memory!! \n" );
+                               continue;       
+                       }
 
-               file_size = strlen(ENGINE_DIRECTORY) + strlen(dirp->d_name) + 5;
-               filepath = (char*)g_malloc0( sizeof(char) * file_size);
+                       /* get its info and update engine list */
+                       if (0 == __internal_get_engine_info(filepath, &info)) {
+                               /* add engine info to g_engine_list */
+                               g_engine_list = g_list_append(g_engine_list, info);
+                       }
 
-               if (NULL != filepath) { 
-                       strncpy(filepath, ENGINE_DIRECTORY, strlen(ENGINE_DIRECTORY) );
-                       strncat(filepath, "/", strlen("/") );
-                       strncat(filepath, dirp->d_name, strlen(dirp->d_name) );
-               } else {
-                       SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not enough memory!! \n" );
-                       continue;       
+                       if (NULL != filepath)
+                               g_free(filepath);
                }
 
-               /* get its info and update engine list */
-               if (0 == __internal_get_engine_info(filepath, &info)) {
-                       /* add engine info to g_engine_list */
-                       g_engine_list = g_list_append(g_engine_list, info);
+               closedir(dp);
+       }
+
+       dp = opendir(ENGINE_DIRECTORY_DOWNLOAD);
+
+       if (dp != NULL) {
+               while ((dirp = readdir(dp)) != NULL) {
+                       ttsengine_info_s* info;
+                       char* filepath = NULL;
+                       int file_size;
+
+                       file_size = strlen(ENGINE_DIRECTORY_DOWNLOAD) + strlen(dirp->d_name) + 5;
+                       filepath = (char*)g_malloc0( sizeof(char) * file_size);
+
+                       if (NULL != filepath) { 
+                               strncpy(filepath, ENGINE_DIRECTORY_DOWNLOAD, strlen(ENGINE_DIRECTORY_DOWNLOAD) );
+                               strncat(filepath, "/", strlen("/") );
+                               strncat(filepath, dirp->d_name, strlen(dirp->d_name) );
+                       } else {
+                               SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not enough memory!! \n" );
+                               continue;       
+                       }
+
+                       /* get its info and update engine list */
+                       if (0 == __internal_get_engine_info(filepath, &info)) {
+                               /* add engine info to g_engine_list */
+                               g_engine_list = g_list_append(g_engine_list, info);
+                       }
+
+                       if (NULL != filepath)
+                               g_free(filepath);
                }
 
-               if (NULL != filepath)
-                       g_free(filepath);
+               closedir(dp);
        }
 
-       closedir(dp);
-
        if (g_list_length(g_engine_list) <= 0) {
                SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] No Engine\n");
                return TTSD_ERROR_OPERATION_FAILED;     
index dfccf3362bf0bca04da20c7ca15757f0690402bb..fccc8c3af9655893045944a239467005a3f91141 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
index 015776062f41b360c63d9854eba7aeca2f5a8422..6411921ffc253ae9a7cdf25ce8677e153fe70a77 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
index 1d0df3564a75d71db2522179aa6d40380e738589..78becd1fb66bc24954cc2335eb34737966f713da 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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,12 @@ extern "C" {
 
 /* TTS Daemon Define */ 
 #define TAG_TTSD "ttsd"
-#define ENGINE_DIRECTORY "/usr/lib/voice/tts/1.0/engine"
+
+#define ENGINE_DIRECTORY_DEFAULT               "/usr/lib/voice/tts/1.0/engine"
+#define ENGINE_DIRECTORY_DEFAULT_SETTING       "/usr/lib/voice/tts/1.0/setting"
+
+#define ENGINE_DIRECTORY_DOWNLOAD              "/opt/apps/voice/tts/1.0/engine"
+#define ENGINE_DIRECTORY_DOWNLOAD_SETTING      "/opt/apps/voice/tts/1.0/setting"
 
 /* for debug message */
 #define DATA_DEBUG
@@ -43,6 +48,7 @@ typedef enum {
        TTSD_ERROR_OUT_OF_MEMORY        = -ENOMEM,      /**< Out of Memory */
        TTSD_ERROR_IO_ERROR             = -EIO,         /**< I/O error */
        TTSD_ERROR_INVALID_PARAMETER    = -EINVAL,      /**< Invalid parameter */
+       TTSD_ERROR_OUT_OF_NETWORK       = -ENETDOWN,    /**< Out of network */
        TTSD_ERROR_INVALID_STATE        = -0x0100021,   /**< Invalid state */
        TTSD_ERROR_INVALID_VOICE        = -0x0100022,   /**< Invalid voice */
        TTSD_ERROR_ENGINE_NOT_FOUND     = -0x0100023,   /**< No available TTS-engine  */
index cc1febf09ef57b384803db30aace69fee7995d7c..ae46d1fd7b9d109af4c2304ee8fe45773fd0c88e 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
index a1eaf921c718bbbc186d442c15107df1f39e38f5..f5db05166eed2791299a4f08cbec4d54fa97759e 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
index 02a825cc18cf8be10dcdf1f33f7d5125c4f71d62..01bafd1a1848b6cfeb5bc4df7e06283234de834d 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
@@ -696,7 +696,7 @@ static int msg_callback(int message, void *data, void *user_param)
                                pid = ttsd_data_get_pid(uid);
 
                                /* send utterance start message */
-                               if (0 == ttsdc_send_utt_start_signal(pid, uid, utt_id)) {
+                               if (0 == ttsdc_send_utt_start_message(pid, uid, utt_id)) {
                                        SLOG(LOG_DEBUG, TAG_TTSD, "[Send SUCCESS] Send Utterance Start Signal : pid(%d), uid(%d), uttid(%d)", pid, uid, utt_id);
                                } else 
                                        SLOG(LOG_ERROR, TAG_TTSD, "[Send ERROR] Fail to send Utterance Start Signal : pid(%d), uid(%d), uttid(%d)", pid, uid, utt_id);
@@ -763,13 +763,13 @@ static int msg_callback(int message, void *data, void *user_param)
 
                        /* send utterence finish signal */
                        if (TTSP_RESULT_EVENT_FINISH == current->event) {
-                               if (0 == ttsdc_send_utt_finish_signal(pid, uid, utt_id))
+                               if (0 == ttsdc_send_utt_finish_message(pid, uid, utt_id))
                                        SLOG(LOG_DEBUG, TAG_TTSD, "[Send SUCCESS] Send Utterance Completed Signal : pid(%d), uid(%d), uttid(%d)", pid, uid, utt_id);
                                else 
                                        SLOG(LOG_ERROR, TAG_TTSD, "[Send ERROR] Fail to send Utterance Completed Signal : pid(%d), uid(%d), uttid(%d)", pid, uid, utt_id);
                        }
 
-                       ttsd_send_start_next_play(uid);
+                       ttsd_send_start_next_play_message(uid);
 
                        SLOG(LOG_DEBUG, TAG_TTSD, "=====");
                        SLOG(LOG_DEBUG, TAG_TTSD, "  ");
index 66af29385e42519aeedda2d7f2be894b281b41e2..c77dca8c56ee3c9e9782186986954ee57aed7124 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
index 5de3618f9ee8571ac0fa3ca22d8878f60463381d..60ae8ecd82c20262aec5130bc2d84b914c0b49c2 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
@@ -51,7 +51,7 @@ int __server_send_error(int uid, int utt_id, int error_code)
        int pid = ttsd_data_get_pid(uid);
 
        /* send error */
-       if ( 0 != ttsdc_send_error_signal(pid, uid, utt_id, error_code)) {
+       if ( 0 != ttsdc_send_error_message(pid, uid, utt_id, error_code)) {
                ttsd_data_delete_client(uid);                   
        } 
        
@@ -68,7 +68,7 @@ int __server_interrupt_client(int org_uid)
        } 
 
        /* send message to client about changing state */
-       ttsdc_send_interrupt_signal (pid, org_uid, TTSD_INTERRUPTED_PAUSED);
+       ttsdc_send_interrupt_message (pid, org_uid, TTSD_INTERRUPTED_PAUSED);
 
        /* change state */
        ttsd_data_set_client_state(org_uid, APP_STATE_PAUSED);
@@ -330,7 +330,7 @@ int __synthesis_result_callback(ttsp_result_event_e event, const void* data, uns
                if (event == TTSP_RESULT_EVENT_FINISH) {
                        __server_set_is_synthesizing(false);
                        
-                       if (0 != ttsd_send_start_next_synthesis(uid)) {
+                       if (0 != ttsd_send_start_next_synthesis_message(uid)) {
                                /* critical error */
                                SLOG(LOG_ERROR, TAG_TTSD, "[SERVER ERROR] IPC ERROR FOR NEXT SYNTHESIS \n");
                        }
@@ -341,7 +341,7 @@ int __synthesis_result_callback(ttsp_result_event_e event, const void* data, uns
                SLOG(LOG_DEBUG, TAG_TTSD, "[SERVER] Event : TTSP_RESULT_EVENT_CANCEL");
                __server_set_is_synthesizing(false);
 
-               if (0 != ttsd_send_start_next_synthesis(uid)) {
+               if (0 != ttsd_send_start_next_synthesis_message(uid)) {
                        /* critical error */
                        SLOG(LOG_ERROR, TAG_TTSD, "[SERVER ERROR] IPC ERROR FOR NEXT SYNTHESIS \n");
                }
@@ -351,7 +351,7 @@ int __synthesis_result_callback(ttsp_result_event_e event, const void* data, uns
                SLOG(LOG_DEBUG, TAG_TTSD, "[SERVER] Event : TTSP_RESULT_EVENT_CANCEL");
                
                __server_set_is_synthesizing(false);
-               if (0 != ttsd_send_start_next_synthesis(uid)) {
+               if (0 != ttsd_send_start_next_synthesis_message(uid)) {
                        /* critical error */
                        SLOG(LOG_ERROR, TAG_TTSD, "[SERVER ERROR] IPC ERROR FOR NEXT SYNTHESIS \n");
                }
@@ -536,7 +536,7 @@ int ttsd_server_play(int uid)
        if (ttsd_engine_agent_need_network()) {
                if (false == ttsd_network_is_connected()) {
                        SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Disconnect network. Current engine needs network service!!!.\n");
-                       return TTSD_ERROR_OPERATION_FAILED;
+                       return TTSD_ERROR_OUT_OF_NETWORK;
                }
        }
 
@@ -550,8 +550,8 @@ int ttsd_server_play(int uid)
        
        /* Change current play */
        if (0 != ttsd_data_set_client_state(uid, APP_STATE_PLAYING)) {
-               SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Current play has already existed \n");
-               return 0;
+               SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Fail to set state : uid(%d)\n", uid);
+               return TTSD_ERROR_OPERATION_FAILED;
        }
 
        if (0 != __server_play_internal(uid, state)) {
@@ -571,6 +571,9 @@ int ttsd_server_stop(int uid)
                return TTSD_ERROR_INVALID_PARAMETER;
        }
 
+       /* Reset all data */
+       ttsd_data_clear_data(uid);
+
        if (APP_STATE_PLAYING == state || APP_STATE_PAUSED == state) {
                ttsd_data_set_client_state(uid, APP_STATE_READY);
 
@@ -587,9 +590,6 @@ int ttsd_server_stop(int uid)
 
                        __server_set_is_synthesizing(false);
                } 
-
-               /* Reset all data */
-               ttsd_data_clear_data(uid);
        } else {
                SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] Current state is 'ready' \n");
        }
@@ -765,7 +765,7 @@ bool __get_client_cb(int pid, int uid, app_state_e state, void* user_data)
        ttsd_data_set_client_state(uid, APP_STATE_READY);
 
        /* send message */
-       if ( 0 != ttsdc_send_interrupt_signal(pid, uid, TTSD_INTERRUPTED_STOPPED)) {
+       if ( 0 != ttsdc_send_interrupt_message(pid, uid, TTSD_INTERRUPTED_STOPPED)) {
                /* remove client */
                ttsd_data_delete_client(uid);
        } 
index 7e1f40f89e333e7dfeeef06496d16075de36c1f2..7b283ceabd1a1c4fbcc57bcc4c8e6de3f791398c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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
index 4a49a26c6a2f58b23ccac8213c846a311646f00c..74c987545807bf40f9701093660ac637f614eedc 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011 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