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 dbus_error_init(&err);
34 dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &pid, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
36 if (dbus_error_is_set(&err)) {
37 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] ttsd Hello : get arguments error (%s)", err.message);
38 dbus_error_free(&err);
40 SLOG(LOG_INFO, tts_tag(), "[IN] ttsd hello : pid(%d), uid(%d)", pid, uid);
41 bool is_initialized = false;
42 ttsd_server_is_already_initialized(pid, uid, &is_initialized);
43 if (false == is_initialized) {
44 bool credential_needed = 0;
45 int ret = ttsd_server_initialize(pid, uid, &credential_needed);
47 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] ttsd Hello : server initialize, ret(%d)", ret);
49 ttsdc_send_hello(pid, uid, ret, (int)credential_needed);
56 int ttsd_dbus_server_hello_sync(DBusConnection* conn, DBusMessage* msg)
58 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS Hello");
61 reply = dbus_message_new_method_return(msg);
64 if (!dbus_connection_send(conn, reply, NULL)) {
65 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] Out Of Memory!");
68 dbus_connection_flush(conn);
69 dbus_message_unref(reply);
71 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] Fail to create reply message!!");
77 int ttsd_dbus_server_initialize(DBusConnection* conn, DBusMessage* msg)
80 dbus_error_init(&err);
83 bool credential_needed = 0;
86 dbus_message_get_args(msg, &err,
87 DBUS_TYPE_INT32, &pid,
88 DBUS_TYPE_INT32, &uid,
91 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS INITIALIZE");
93 if (dbus_error_is_set(&err)) {
94 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts initialize : get arguments error (%s)", err.message);
95 dbus_error_free(&err);
96 ret = TTSD_ERROR_OPERATION_FAILED;
99 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts initialize : pid(%d), uid(%d)", pid , uid);
100 ret = ttsd_server_initialize(pid, uid, &credential_needed);
104 reply = dbus_message_new_method_return(msg);
106 int temp = (int)credential_needed;
107 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts initialize : result(%d), credential_needed(%d)", ret, (int)credential_needed);
109 dbus_message_append_args(reply,
110 DBUS_TYPE_INT32, &ret,
111 DBUS_TYPE_INT32, &temp,
115 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts initialize : result(%d), credential_needed(%d)", ret, credential_needed);
117 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts initialize : result(%d)", ret);
120 if (!dbus_connection_send(conn, reply, NULL)) {
121 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts initialize : Out Of Memory!");
124 dbus_connection_flush(conn);
125 dbus_message_unref(reply);
127 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts initialize : Fail to create reply message!!");
133 int ttsd_dbus_server_finalize(DBusConnection* conn, DBusMessage* msg)
136 dbus_error_init(&err);
141 dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
143 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS FINALIZE");
145 if (dbus_error_is_set(&err)) {
146 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts finalize : get arguments error (%s)", err.message);
147 dbus_error_free(&err);
148 ret = TTSD_ERROR_OPERATION_FAILED;
150 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts finalize : uid(%d)", uid);
151 ret = ttsd_server_finalize(uid);
155 reply = dbus_message_new_method_return(msg);
158 dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
161 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts finalize : result(%d)", ret);
163 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts finalize : result(%d)", ret);
166 if (!dbus_connection_send(conn, reply, NULL)) {
167 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts finalize : Out Of Memory!");
170 dbus_connection_flush(conn);
171 dbus_message_unref(reply);
173 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts finalize : Fail to create reply message!!");
179 int ttsd_dbus_server_get_support_voices(DBusConnection* conn, DBusMessage* msg)
182 dbus_error_init(&err);
186 GList* voice_list = NULL;
188 dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
190 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS GET VOICES");
192 if (dbus_error_is_set(&err)) {
193 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts get supported voices : get arguments error (%s)", err.message);
194 dbus_error_free(&err);
195 ret = TTSD_ERROR_OPERATION_FAILED;
197 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] get supported voices : uid(%d)", uid);
198 ret = ttsd_server_get_support_voices(uid, &voice_list);
202 reply = dbus_message_new_method_return(msg);
205 DBusMessageIter args;
206 dbus_message_iter_init_append(reply, &args);
209 dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(ret));
212 /* Append voice size */
213 int size = g_list_length(voice_list);
215 if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(size))) {
216 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts supported voices : Fail to append type");
217 ret = TTSD_ERROR_OPERATION_FAILED;
223 iter = g_list_first(voice_list);
225 while (NULL != iter) {
229 dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &(voice->language));
230 dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(voice->type));
232 if (NULL != voice->language)
233 g_free(voice->language);
238 voice_list = g_list_remove_link(voice_list, iter);
240 iter = g_list_first(voice_list);
243 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts supported voices : result(%d)", ret);
245 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts supported voices : result(%d)", ret);
248 if (!dbus_connection_send(conn, reply, NULL)) {
249 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] error : Out Of Memory!");
252 dbus_connection_flush(conn);
253 dbus_message_unref(reply);
255 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts supported voices : Fail to create reply message!!");
261 int ttsd_dbus_server_get_current_voice(DBusConnection* conn, DBusMessage* msg)
264 dbus_error_init(&err);
271 dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
273 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS GET DEFAULT VOICE");
275 if (dbus_error_is_set(&err)) {
276 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts get default voice : Get arguments error (%s)", err.message);
277 dbus_error_free(&err);
278 ret = TTSD_ERROR_OPERATION_FAILED;
280 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts get default voice : uid(%d)", uid);
281 ret = ttsd_server_get_current_voice(uid, &lang, &voice_type);
285 reply = dbus_message_new_method_return(msg);
289 /* Append result and voice */
290 dbus_message_append_args(reply,
291 DBUS_TYPE_INT32, &ret,
292 DBUS_TYPE_STRING, &lang,
293 DBUS_TYPE_INT32, &voice_type,
295 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts default voice : lang(%s), vctype(%d)", lang, voice_type);
297 dbus_message_append_args(reply,
298 DBUS_TYPE_INT32, &ret,
300 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts default voice : result(%d)", ret);
303 if (!dbus_connection_send(conn, reply, NULL)) {
304 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts default voice : Out Of Memory!");
307 dbus_connection_flush(conn);
308 dbus_message_unref(reply);
310 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts default voice : Fail to create reply message!!");
313 if (NULL != lang) free(lang);
317 int ttsd_dbus_server_add_text(DBusConnection* conn, DBusMessage* msg)
320 dbus_error_init(&err);
322 int uid, voicetype, speed, uttid;
323 char *text, *lang, *credential;
326 dbus_message_get_args(msg, &err,
327 DBUS_TYPE_INT32, &uid,
328 DBUS_TYPE_STRING, &text,
329 DBUS_TYPE_STRING, &lang,
330 DBUS_TYPE_INT32, &voicetype,
331 DBUS_TYPE_INT32, &speed,
332 DBUS_TYPE_INT32, &uttid,
333 DBUS_TYPE_STRING, &credential,
336 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS ADD TEXT");
338 if (dbus_error_is_set(&err)) {
339 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts add text : Get arguments error (%s)", err.message);
340 dbus_error_free(&err);
341 ret = TTSD_ERROR_OPERATION_FAILED;
343 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts add text : uid(%d), text(%s), lang(%s), type(%d), speed(%d), uttid(%d), credential(%s)",
344 uid, (NULL == text) ? "NULL" : text, (NULL == lang) ? "NULL" : lang, voicetype, speed, uttid, (NULL == credential) ? "NULL" : credential);
345 ret = ttsd_server_add_queue(uid, text, lang, voicetype, speed, uttid, credential);
349 reply = dbus_message_new_method_return(msg);
352 dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
355 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts add text : result(%d)", ret);
357 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add text : result(%d)", ret);
360 if (!dbus_connection_send(conn, reply, NULL)) {
361 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add text : Out Of Memory!");
364 dbus_connection_flush(conn);
365 dbus_message_unref(reply);
367 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add text : Fail to create reply message!!");
370 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
371 SLOG(LOG_DEBUG, tts_tag(), " ");
376 int ttsd_dbus_server_play(DBusConnection* conn, DBusMessage* msg)
379 dbus_error_init(&err);
385 dbus_message_get_args(msg, &err,
386 DBUS_TYPE_INT32, &uid,
387 DBUS_TYPE_STRING, &credential,
390 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS PLAY");
392 if (dbus_error_is_set(&err)) {
393 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts play : Get arguments error (%s)", err.message);
394 dbus_error_free(&err);
395 ret = TTSD_ERROR_OPERATION_FAILED;
397 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts play : uid(%d), credential(%s)", uid, (NULL == credential) ? "NULL" : credential);
398 ret = ttsd_server_play(uid, credential);
402 reply = dbus_message_new_method_return(msg);
405 dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
408 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts play : result(%d)", ret);
410 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play : result(%d)", ret);
413 if (!dbus_connection_send(conn, reply, NULL)) {
414 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play : Out Of Memory!");
417 dbus_connection_flush(conn);
418 dbus_message_unref(reply);
420 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play : Fail to create reply message!!");
423 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
424 SLOG(LOG_DEBUG, tts_tag(), " ");
429 int ttsd_dbus_server_stop(DBusConnection* conn, DBusMessage* msg)
432 dbus_error_init(&err);
436 dbus_message_get_args(msg, &err,
437 DBUS_TYPE_INT32, &uid,
440 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS STOP");
442 if (dbus_error_is_set(&err)) {
443 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts stop : Get arguments error (%s)", err.message);
444 dbus_error_free(&err);
445 ret = TTSD_ERROR_OPERATION_FAILED;
447 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts stop : uid(%d)", uid);
448 ret = ttsd_server_stop(uid);
452 reply = dbus_message_new_method_return(msg);
455 dbus_message_append_args(reply,
456 DBUS_TYPE_INT32, &ret,
460 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts stop : result(%d)", ret);
462 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop : result(%d)", ret);
465 if (!dbus_connection_send(conn, reply, NULL)) {
466 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop : Out Of Memory!");
469 dbus_connection_flush(conn);
470 dbus_message_unref(reply);
472 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop : Fail to create reply message!!");
475 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
476 SLOG(LOG_DEBUG, tts_tag(), " ");
481 int ttsd_dbus_server_pause(DBusConnection* conn, DBusMessage* msg)
484 dbus_error_init(&err);
489 dbus_message_get_args(msg, &err,
490 DBUS_TYPE_INT32, &uid,
493 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS PAUSE");
495 if (dbus_error_is_set(&err)) {
496 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts pause : Get arguments error (%s)", err.message);
497 dbus_error_free(&err);
498 ret = TTSD_ERROR_OPERATION_FAILED;
500 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts pause : uid(%d)", uid);
501 ret = ttsd_server_pause(uid, &uttid);
505 reply = dbus_message_new_method_return(msg);
508 dbus_message_append_args(reply,
509 DBUS_TYPE_INT32, &ret,
513 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts pause : result(%d)", ret);
515 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts pause : result(%d)", ret);
518 if (!dbus_connection_send(conn, reply, NULL)) {
519 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts pause : Out Of Memory!");
522 dbus_connection_flush(conn);
523 dbus_message_unref(reply);
525 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts pause : Fail to create reply message!!");
528 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
529 SLOG(LOG_DEBUG, tts_tag(), " ");
534 int ttsd_dbus_server_set_private_data(DBusConnection* conn, DBusMessage* msg)
537 dbus_error_init(&err);
543 dbus_message_get_args(msg, &err,
544 DBUS_TYPE_INT32, &uid,
545 DBUS_TYPE_STRING, &key,
546 DBUS_TYPE_STRING, &data,
549 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS set private data");
551 if (dbus_error_is_set(&err)) {
552 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] Fail to get arguments (%s)", err.message);
553 dbus_error_free(&err);
554 ret = TTSD_ERROR_OPERATION_FAILED;
556 SLOG(LOG_DEBUG, tts_tag(), "[IN] tts set private data(%d)", uid);
557 ret = ttsd_server_set_private_data(uid, key, data);
561 reply = dbus_message_new_method_return(msg);
564 dbus_message_append_args(reply,
565 DBUS_TYPE_INT32, &ret,
569 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts set private data : (%d)", ret);
571 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts set private data : (%d)", ret);
574 if (!dbus_connection_send(conn, reply, NULL)) {
575 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] Fail to send reply");
578 dbus_connection_flush(conn);
579 dbus_message_unref(reply);
581 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] Fail to create reply message");
584 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
585 SLOG(LOG_DEBUG, tts_tag(), "");
590 int ttsd_dbus_server_get_private_data(DBusConnection* conn, DBusMessage* msg)
593 dbus_error_init(&err);
599 dbus_message_get_args(msg, &err,
600 DBUS_TYPE_INT32, &uid,
601 DBUS_TYPE_STRING, &key,
604 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS get private data");
606 if (dbus_error_is_set(&err)) {
607 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] Fail to get arguments (%s)", err.message);
608 dbus_error_free(&err);
609 ret = TTSD_ERROR_OPERATION_FAILED;
611 SLOG(LOG_DEBUG, tts_tag(), "[IN] tts get private data(%d)", uid);
612 ret = ttsd_server_get_private_data(uid, key, &data);
616 reply = dbus_message_new_method_return(msg);
619 dbus_message_append_args(reply,
620 DBUS_TYPE_INT32, &ret,
621 DBUS_TYPE_STRING, &data,
625 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts get private data : Result(%d), data(%s)", ret, (NULL == data) ? "NULL" : data);
627 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts get private data : (%d)", ret);
630 if (!dbus_connection_send(conn, reply, NULL)) {
631 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] Fail to send reply");
634 dbus_connection_flush(conn);
635 dbus_message_unref(reply);
637 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] Fail to create reply message");
640 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
641 SLOG(LOG_DEBUG, tts_tag(), "");
651 int ttsd_dbus_server_play_pcm(DBusConnection* conn, DBusMessage* msg)
654 dbus_error_init(&err);
659 dbus_message_get_args(msg, &err,
660 DBUS_TYPE_INT32, &uid,
663 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS PLAY PCM");
665 if (dbus_error_is_set(&err)) {
666 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts play pcm : Get arguments error (%s)", err.message);
667 dbus_error_free(&err);
668 ret = TTSD_ERROR_OPERATION_FAILED;
670 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts play pcm : uid(%d)", uid);
671 ret = ttsd_server_play_pcm(uid);
675 reply = dbus_message_new_method_return(msg);
678 dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
681 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts play pcm : result(%d)", ret);
683 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play pcm : result(%d)", ret);
686 if (!dbus_connection_send(conn, reply, NULL)) {
687 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play pcm : Out Of Memory!");
690 dbus_connection_flush(conn);
691 dbus_message_unref(reply);
693 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play pcm : Fail to create reply message!!");
696 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
697 SLOG(LOG_DEBUG, tts_tag(), " ");
702 int ttsd_dbus_server_stop_pcm(DBusConnection* conn, DBusMessage* msg)
705 dbus_error_init(&err);
710 dbus_message_get_args(msg, &err,
711 DBUS_TYPE_INT32, &uid,
714 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS STOP PCM");
716 if (dbus_error_is_set(&err)) {
717 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts stop pcm : Get arguments error (%s)", err.message);
718 dbus_error_free(&err);
719 ret = TTSD_ERROR_OPERATION_FAILED;
721 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts stop pcm : uid(%d)", uid);
722 ret = ttsd_server_stop_pcm(uid);
726 reply = dbus_message_new_method_return(msg);
729 dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
732 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts stop pcm : result(%d)", ret);
734 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop pcm : result(%d)", ret);
737 if (!dbus_connection_send(conn, reply, NULL)) {
738 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop pcm : Out Of Memory!");
741 dbus_connection_flush(conn);
742 dbus_message_unref(reply);
744 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop pcm : Fail to create reply message!!");
747 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
748 SLOG(LOG_DEBUG, tts_tag(), " ");
753 int ttsd_dbus_server_add_pcm(DBusConnection* conn, DBusMessage* msg)
756 dbus_error_init(&err);
766 dbus_message_get_args(msg, &err,
767 DBUS_TYPE_INT32, &uid,
768 DBUS_TYPE_INT32, &event,
769 DBUS_TYPE_INT32, &audio_type,
770 DBUS_TYPE_INT32, &rate,
771 //DBUS_TYPE_STRING, &data,
772 //DBUS_TYPE_INT32, &data_size,
773 DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
777 SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS ADD PCM");
779 if (dbus_error_is_set(&err)) {
780 SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts add pcm : Get arguments error (%s)", err.message);
781 dbus_error_free(&err);
782 ret = TTSD_ERROR_OPERATION_FAILED;
784 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts add pcm : uid(%d)", uid);
785 ret = ttsd_server_add_pcm(uid, event, (void*)data, data_size, audio_type, rate);
789 reply = dbus_message_new_method_return(msg);
792 dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
795 SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts add pcm : result(%d)", ret);
797 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add pcm : result(%d)", ret);
800 if (!dbus_connection_send(conn, reply, NULL)) {
801 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add pcm : Out Of Memory!");
804 dbus_connection_flush(conn);
805 dbus_message_unref(reply);
807 SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add pcm : Fail to create reply message!!");
810 SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
811 SLOG(LOG_DEBUG, tts_tag(), " ");