+++ /dev/null
-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
--- /dev/null
+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
/*
-* 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
#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();
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, "=====");
}
/* do request initialize */
- int i = 0;
+ int i = 1;
while(1) {
ret = tts_dbus_request_initialize((*tts)->handle);
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;
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");
}
while(fgets(buff, 255, fp)) {
- if (0 == i) {
- i++;
- continue;
- }
-
sscanf(buff, "%s", cmd);
if (0 == strncmp(cmd, "[tts-daemon]", strlen("[tts-daemon]")) ||
fclose(fp);
return TRUE;
}
-
- i++;
}
+
fclose(fp);
+ SLOG(LOG_DEBUG, TAG_TTSC, "THERE IS NO tts-daemon !! \n");
+
return FALSE;
}
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;
/*
-* 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__
* @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
/*
-* 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
/*
-* 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
/*
-* 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
#include "tts_dbus.h"
#include "tts_defs.h"
+#define WAITING_TIME 1000
static Ecore_Fd_Handler* g_fd_handler = NULL;
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,
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,
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;
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;
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 */
return TTS_ERROR_OPERATION_FAILED;
}
+ dbus_connection_set_exit_on_disconnect(g_conn, false);
+
int pid = getpid();
char service_name[64];
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");
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,
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,
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_ERROR, TAG_TTSC, "<<<< tts initialize : result = %d \n", result);
}
- dbus_message_unref(msg);
-
return result;
}
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,
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);
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_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,
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)) {
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;
}
}
DBusMessage* msg;
+ DBusError err;
+ dbus_error_init(&err);
msg = dbus_message_new_method_call(
TTS_SERVER_SERVICE_NAME,
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,
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_ERROR, TAG_TTSC, "<<<< tts get default voice : result(%d) \n", result);
}
- dbus_message_unref(msg);
-
return result;
}
}
DBusMessage* msg;
+ DBusError err;
+ dbus_error_init(&err);
msg = dbus_message_new_method_call(
TTS_SERVER_SERVICE_NAME,
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,
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;
}
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,
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,
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) {
} else {
SLOG(LOG_ERROR, TAG_TTSC, "<<<< tts play : result(%d) \n", result);
}
-
- dbus_message_unref(msg);
return result;
}
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,
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,
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_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,
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,
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_ERROR, TAG_TTSC, "<<<< tts pause : result(%d) \n", result);
}
- dbus_message_unref(msg);
-
return result;
}
/*
-* 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
int tts_dbus_close_connection();
+
+int tts_dbus_request_hello();
+
int tts_dbus_request_initialize(int uid);
int tts_dbus_request_finalize(int uid);
/*
-* 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
/*
-* 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
#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();
{
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() ) {
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();
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;
}
}
- if (0 == ret) {
+ if (TTS_SETTING_ERROR_NONE == ret) {
g_is_setting_initialized = true;
SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Initialize");
}
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();
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");
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")) ||
return TRUE;
}
- i++;
}
fclose(fp);
+ SLOG(LOG_DEBUG, TAG_TTSC, "THERE IS NO tts-daemon !! \n");
+
return FALSE;
}
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;
/*
-* 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
* 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);
*
* @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.
/*
-* 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
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()
{
/*
-* 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
int tts_setting_dbus_close_connection();
+int tts_setting_dbus_request_hello();
int tts_setting_dbus_request_initialize();
* 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"
#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"
* 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
}
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
+
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)
BuildRequires: pkgconfig(mm-common)
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(vconf)
-BuildRequires: pkgconfig(ecore-input)
+BuildRequires: pkgconfig(ecore)
BuildRequires: pkgconfig(openssl)
BuildRequires: cmake
/*
-* 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
/*
-* 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
/*
-* 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
/*
-* 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
/*
-* 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;
}
/* 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);
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);
}
return 0;
}
+
static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handler)
{
DBusConnection* conn = (DBusConnection*)data;
}
/* 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) )
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);
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);
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'");
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");
/*
-* 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
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
}
/*
-* 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
* 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;
/*
-* 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
extern "C" {
#endif
+int ttsd_dbus_server_hello(DBusConnection* conn, DBusMessage* msg);
+
/*
* Dbus Server functions for APIs
*/
/*
-* 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
/* 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;
/*
-* 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
/*
-* 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
/*
-* 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
/* 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
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 */
/*
-* 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
/*
-* 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
/*
-* 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
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);
/* 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, " ");
/*
-* 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
/*
-* 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
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);
}
}
/* 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);
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");
}
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");
}
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");
}
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;
}
}
/* 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)) {
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);
__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");
}
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);
}
/*
-* 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
/*
-* 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