2 * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 * http://www.apache.org/licenses/LICENSE-2.0
7 * Unless required by applicable law or agreed to in writing, software
8 * distributed under the License is distributed on an "AS IS" BASIS,
9 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 * See the License for the specific language governing permissions and
11 * limitations under the License.
15 #include "ttsd_main.h"
16 #include "ttsd_dbus.h"
17 #include "ttsd_dbus_server.h"
18 #include "ttsd_server.h"
20 extern int ttsd_data_get_pid(const int uid);
23 * Dbus Client-Daemon Server
25 int ttsd_dbus_server_hello(DBusConnection* conn, DBusMessage* msg)
27 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS Hello");
30 reply = dbus_message_new_method_return(msg);
33 if (!dbus_connection_send(conn, reply, NULL)) {
34 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] Out Of Memory!");
37 dbus_connection_flush(conn);
38 dbus_message_unref(reply);
40 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] Fail to create reply message!!");
46 int ttsd_dbus_server_initialize(DBusConnection* conn, DBusMessage* msg)
49 dbus_error_init(&err);
52 bool credential_needed = 0;
55 dbus_message_get_args(msg, &err,
56 DBUS_TYPE_INT32, &pid,
57 DBUS_TYPE_INT32, &uid,
60 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS INITIALIZE");
62 if (dbus_error_is_set(&err)) {
63 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts initialize : get arguments error (%s)", err.message);
64 dbus_error_free(&err);
65 ret = TTSD_ERROR_OPERATION_FAILED;
68 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts initialize : pid(%d), uid(%d)", pid , uid);
69 ret = ttsd_server_initialize(pid, uid, &credential_needed);
73 reply = dbus_message_new_method_return(msg);
75 int temp = (int)credential_needed;
76 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts initialize : result(%d), credential_needed(%d)", ret, (int)credential_needed);
78 dbus_message_append_args(reply,
79 DBUS_TYPE_INT32, &ret,
80 DBUS_TYPE_INT32, &temp,
84 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts initialize : result(%d), credential_needed(%d)", ret, credential_needed);
86 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts initialize : result(%d)", ret);
89 if (!dbus_connection_send(conn, reply, NULL)) {
90 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts initialize : Out Of Memory!");
93 dbus_connection_flush(conn);
94 dbus_message_unref(reply);
96 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts initialize : Fail to create reply message!!");
102 int ttsd_dbus_server_finalize(DBusConnection* conn, DBusMessage* msg)
105 dbus_error_init(&err);
110 dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
112 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS FINALIZE");
114 if (dbus_error_is_set(&err)) {
115 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts finalize : get arguments error (%s)", err.message);
116 dbus_error_free(&err);
117 ret = TTSD_ERROR_OPERATION_FAILED;
119 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts finalize : uid(%d)", uid);
120 ret = ttsd_server_finalize(uid);
124 reply = dbus_message_new_method_return(msg);
127 dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
130 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts finalize : result(%d)", ret);
132 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts finalize : result(%d)", ret);
135 if (!dbus_connection_send(conn, reply, NULL)) {
136 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts finalize : Out Of Memory!");
139 dbus_connection_flush(conn);
140 dbus_message_unref(reply);
142 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts finalize : Fail to create reply message!!");
148 int ttsd_dbus_server_get_support_voices(DBusConnection* conn, DBusMessage* msg)
151 dbus_error_init(&err);
155 GList* voice_list = NULL;
157 dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
159 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS GET VOICES");
161 if (dbus_error_is_set(&err)) {
162 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts get supported voices : get arguments error (%s)", err.message);
163 dbus_error_free(&err);
164 ret = TTSD_ERROR_OPERATION_FAILED;
166 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] get supported voices : uid(%d)", uid);
167 ret = ttsd_server_get_support_voices(uid, &voice_list);
171 reply = dbus_message_new_method_return(msg);
174 DBusMessageIter args;
175 dbus_message_iter_init_append(reply, &args);
178 dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(ret));
181 /* Append voice size */
182 int size = g_list_length(voice_list);
184 if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(size))) {
185 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts supported voices : Fail to append type");
186 ret = TTSD_ERROR_OPERATION_FAILED;
192 iter = g_list_first(voice_list);
194 while (NULL != iter) {
198 dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &(voice->language));
199 dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(voice->type));
201 if (NULL != voice->language)
202 g_free(voice->language);
207 voice_list = g_list_remove_link(voice_list, iter);
209 iter = g_list_first(voice_list);
212 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts supported voices : result(%d)", ret);
214 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts supported voices : result(%d)", ret);
217 if (!dbus_connection_send(conn, reply, NULL)) {
218 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] error : Out Of Memory!");
221 dbus_connection_flush(conn);
222 dbus_message_unref(reply);
224 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts supported voices : Fail to create reply message!!");
230 int ttsd_dbus_server_get_current_voice(DBusConnection* conn, DBusMessage* msg)
233 dbus_error_init(&err);
240 dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
242 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS GET DEFAULT VOICE");
244 if (dbus_error_is_set(&err)) {
245 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts get default voice : Get arguments error (%s)", err.message);
246 dbus_error_free(&err);
247 ret = TTSD_ERROR_OPERATION_FAILED;
249 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts get default voice : uid(%d)", uid);
250 ret = ttsd_server_get_current_voice(uid, &lang, &voice_type);
254 reply = dbus_message_new_method_return(msg);
258 /* Append result and voice */
259 dbus_message_append_args(reply,
260 DBUS_TYPE_INT32, &ret,
261 DBUS_TYPE_STRING, &lang,
262 DBUS_TYPE_INT32, &voice_type,
264 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts default voice : lang(%s), vctype(%d)", lang, voice_type);
266 dbus_message_append_args(reply,
267 DBUS_TYPE_INT32, &ret,
269 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts default voice : result(%d)", ret);
272 if (!dbus_connection_send(conn, reply, NULL)) {
273 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts default voice : Out Of Memory!");
276 dbus_connection_flush(conn);
277 dbus_message_unref(reply);
279 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts default voice : Fail to create reply message!!");
282 if (NULL != lang) free(lang);
286 int ttsd_dbus_server_add_text(DBusConnection* conn, DBusMessage* msg)
289 dbus_error_init(&err);
291 int uid, voicetype, speed, uttid;
292 char *text, *lang, *credential;
295 dbus_message_get_args(msg, &err,
296 DBUS_TYPE_INT32, &uid,
297 DBUS_TYPE_STRING, &text,
298 DBUS_TYPE_STRING, &lang,
299 DBUS_TYPE_INT32, &voicetype,
300 DBUS_TYPE_INT32, &speed,
301 DBUS_TYPE_INT32, &uttid,
302 DBUS_TYPE_STRING, &credential,
305 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS ADD TEXT");
307 if (dbus_error_is_set(&err)) {
308 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts add text : Get arguments error (%s)", err.message);
309 dbus_error_free(&err);
310 ret = TTSD_ERROR_OPERATION_FAILED;
312 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts add text : uid(%d), text(%s), lang(%s), type(%d), speed(%d), uttid(%d), credential(%s)",
313 uid, (NULL == text) ? "NULL" : text, (NULL == lang) ? "NULL" : lang, voicetype, speed, uttid, (NULL == credential) ? "NULL" : credential);
314 ret = ttsd_server_add_queue(uid, text, lang, voicetype, speed, uttid, credential);
318 reply = dbus_message_new_method_return(msg);
321 dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
324 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts add text : result(%d)", ret);
326 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add text : result(%d)", ret);
329 if (!dbus_connection_send(conn, reply, NULL)) {
330 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add text : Out Of Memory!");
333 dbus_connection_flush(conn);
334 dbus_message_unref(reply);
336 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add text : Fail to create reply message!!");
339 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
340 SLOG(LOG_DEBUG, tts_tag(), " ");
345 int ttsd_dbus_server_play(DBusConnection* conn, DBusMessage* msg)
348 dbus_error_init(&err);
354 dbus_message_get_args(msg, &err,
355 DBUS_TYPE_INT32, &uid,
356 DBUS_TYPE_STRING, &credential,
359 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS PLAY");
361 if (dbus_error_is_set(&err)) {
362 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts play : Get arguments error (%s)", err.message);
363 dbus_error_free(&err);
364 ret = TTSD_ERROR_OPERATION_FAILED;
366 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts play : uid(%d), credential(%s)", uid, (NULL == credential) ? "NULL" : credential);
367 ret = ttsd_server_play(uid, credential);
371 reply = dbus_message_new_method_return(msg);
374 dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
377 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts play : result(%d)", ret);
379 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play : result(%d)", ret);
382 if (!dbus_connection_send(conn, reply, NULL)) {
383 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play : Out Of Memory!");
386 dbus_connection_flush(conn);
387 dbus_message_unref(reply);
389 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play : Fail to create reply message!!");
392 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
393 SLOG(LOG_DEBUG, tts_tag(), " ");
398 int ttsd_dbus_server_stop(DBusConnection* conn, DBusMessage* msg)
401 dbus_error_init(&err);
405 dbus_message_get_args(msg, &err,
406 DBUS_TYPE_INT32, &uid,
409 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS STOP");
411 if (dbus_error_is_set(&err)) {
412 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts stop : Get arguments error (%s)", err.message);
413 dbus_error_free(&err);
414 ret = TTSD_ERROR_OPERATION_FAILED;
416 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts stop : uid(%d)", uid);
417 ret = ttsd_server_stop(uid);
421 reply = dbus_message_new_method_return(msg);
424 dbus_message_append_args(reply,
425 DBUS_TYPE_INT32, &ret,
429 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts stop : result(%d)", ret);
431 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop : result(%d)", ret);
434 if (!dbus_connection_send(conn, reply, NULL)) {
435 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop : Out Of Memory!");
438 dbus_connection_flush(conn);
439 dbus_message_unref(reply);
441 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop : Fail to create reply message!!");
444 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
445 SLOG(LOG_DEBUG, tts_tag(), " ");
450 int ttsd_dbus_server_pause(DBusConnection* conn, DBusMessage* msg)
453 dbus_error_init(&err);
458 dbus_message_get_args(msg, &err,
459 DBUS_TYPE_INT32, &uid,
462 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS PAUSE");
464 if (dbus_error_is_set(&err)) {
465 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts pause : Get arguments error (%s)", err.message);
466 dbus_error_free(&err);
467 ret = TTSD_ERROR_OPERATION_FAILED;
469 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts pause : uid(%d)", uid);
470 ret = ttsd_server_pause(uid, &uttid);
474 reply = dbus_message_new_method_return(msg);
477 dbus_message_append_args(reply,
478 DBUS_TYPE_INT32, &ret,
482 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts pause : result(%d)", ret);
484 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts pause : result(%d)", ret);
487 if (!dbus_connection_send(conn, reply, NULL)) {
488 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts pause : Out Of Memory!");
491 dbus_connection_flush(conn);
492 dbus_message_unref(reply);
494 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts pause : Fail to create reply message!!");
497 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
498 SLOG(LOG_DEBUG, tts_tag(), " ");
503 int ttsd_dbus_server_set_private_data(DBusConnection* conn, DBusMessage* msg)
506 dbus_error_init(&err);
512 dbus_message_get_args(msg, &err,
513 DBUS_TYPE_INT32, &uid,
514 DBUS_TYPE_STRING, &key,
515 DBUS_TYPE_STRING, &data,
518 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS set private data");
520 if (dbus_error_is_set(&err)) {
521 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] Fail to get arguments (%s)", err.message);
522 dbus_error_free(&err);
523 ret = TTSD_ERROR_OPERATION_FAILED;
525 SLOG(LOG_DEBUG, tts_tag(), "[IN] tts set private data(%d)", uid);
526 ret = ttsd_server_set_private_data(uid, key, data);
530 reply = dbus_message_new_method_return(msg);
533 dbus_message_append_args(reply,
534 DBUS_TYPE_INT32, &ret,
538 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts set private data : (%d)", ret);
540 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts set private data : (%d)", ret);
543 if (!dbus_connection_send(conn, reply, NULL)) {
544 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] Fail to send reply");
547 dbus_connection_flush(conn);
548 dbus_message_unref(reply);
550 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] Fail to create reply message");
553 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
554 SLOG(LOG_DEBUG, tts_tag(), "");
559 int ttsd_dbus_server_get_private_data(DBusConnection* conn, DBusMessage* msg)
562 dbus_error_init(&err);
568 dbus_message_get_args(msg, &err,
569 DBUS_TYPE_INT32, &uid,
570 DBUS_TYPE_STRING, &key,
573 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS get private data");
575 if (dbus_error_is_set(&err)) {
576 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] Fail to get arguments (%s)", err.message);
577 dbus_error_free(&err);
578 ret = TTSD_ERROR_OPERATION_FAILED;
580 SLOG(LOG_DEBUG, tts_tag(), "[IN] tts get private data(%d)", uid);
581 ret = ttsd_server_get_private_data(uid, key, &data);
585 reply = dbus_message_new_method_return(msg);
588 dbus_message_append_args(reply,
589 DBUS_TYPE_INT32, &ret,
590 DBUS_TYPE_STRING, &data,
594 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts get private data : Result(%d), data(%s)", ret, (NULL == data) ? "NULL" : data);
596 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts get private data : (%d)", ret);
599 if (!dbus_connection_send(conn, reply, NULL)) {
600 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] Fail to send reply");
603 dbus_connection_flush(conn);
604 dbus_message_unref(reply);
606 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] Fail to create reply message");
609 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
610 SLOG(LOG_DEBUG, tts_tag(), "");
620 int ttsd_dbus_server_play_pcm(DBusConnection* conn, DBusMessage* msg)
623 dbus_error_init(&err);
628 dbus_message_get_args(msg, &err,
629 DBUS_TYPE_INT32, &uid,
632 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS PLAY PCM");
634 if (dbus_error_is_set(&err)) {
635 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts play pcm : Get arguments error (%s)", err.message);
636 dbus_error_free(&err);
637 ret = TTSD_ERROR_OPERATION_FAILED;
639 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts play pcm : uid(%d)", uid);
640 ret = ttsd_server_play_pcm(uid);
644 reply = dbus_message_new_method_return(msg);
647 dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
650 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts play pcm : result(%d)", ret);
652 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play pcm : result(%d)", ret);
655 if (!dbus_connection_send(conn, reply, NULL)) {
656 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play pcm : Out Of Memory!");
659 dbus_connection_flush(conn);
660 dbus_message_unref(reply);
662 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play pcm : Fail to create reply message!!");
665 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
666 SLOG(LOG_DEBUG, tts_tag(), " ");
671 int ttsd_dbus_server_stop_pcm(DBusConnection* conn, DBusMessage* msg)
674 dbus_error_init(&err);
679 dbus_message_get_args(msg, &err,
680 DBUS_TYPE_INT32, &uid,
683 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS STOP PCM");
685 if (dbus_error_is_set(&err)) {
686 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts stop pcm : Get arguments error (%s)", err.message);
687 dbus_error_free(&err);
688 ret = TTSD_ERROR_OPERATION_FAILED;
690 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts stop pcm : uid(%d)", uid);
691 ret = ttsd_server_stop_pcm(uid);
695 reply = dbus_message_new_method_return(msg);
698 dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
701 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts stop pcm : result(%d)", ret);
703 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop pcm : result(%d)", ret);
706 if (!dbus_connection_send(conn, reply, NULL)) {
707 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop pcm : Out Of Memory!");
710 dbus_connection_flush(conn);
711 dbus_message_unref(reply);
713 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop pcm : Fail to create reply message!!");
716 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
717 SLOG(LOG_DEBUG, tts_tag(), " ");
722 int ttsd_dbus_server_add_pcm(DBusConnection* conn, DBusMessage* msg)
725 dbus_error_init(&err);
735 dbus_message_get_args(msg, &err,
736 DBUS_TYPE_INT32, &uid,
737 DBUS_TYPE_INT32, &event,
738 DBUS_TYPE_INT32, &audio_type,
739 DBUS_TYPE_INT32, &rate,
740 //DBUS_TYPE_STRING, &data,
741 //DBUS_TYPE_INT32, &data_size,
742 DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
746 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS ADD PCM");
748 if (dbus_error_is_set(&err)) {
749 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts add pcm : Get arguments error (%s)", err.message);
750 dbus_error_free(&err);
751 ret = TTSD_ERROR_OPERATION_FAILED;
753 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts add pcm : uid(%d)", uid);
754 ret = ttsd_server_add_pcm(uid, event, (void*)data, data_size, audio_type, rate);
758 reply = dbus_message_new_method_return(msg);
761 dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
764 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts add pcm : result(%d)", ret);
766 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add pcm : result(%d)", ret);
769 if (!dbus_connection_send(conn, reply, NULL)) {
770 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add pcm : Out Of Memory!");
773 dbus_connection_flush(conn);
774 dbus_message_unref(reply);
776 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add pcm : Fail to create reply message!!");
779 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
780 SLOG(LOG_DEBUG, tts_tag(), " ");