[ACR-1216][tts][Add tts_repeat()]
[platform/core/uifw/tts.git] / server / ttsd_dbus_server.c
index ed11f5f..e750048 100644 (file)
@@ -1,5 +1,5 @@
 /*
-*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+*  Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
@@ -24,20 +24,20 @@ extern int ttsd_data_get_pid(const int uid);
 */
 int ttsd_dbus_server_hello(DBusConnection* conn, DBusMessage* msg)
 {
-       SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS Hello");
+       SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS Hello");
 
        DBusMessage* reply;
        reply = dbus_message_new_method_return(msg);
 
        if (NULL != reply) {
                if (!dbus_connection_send(conn, reply, NULL)) {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] Out Of Memory!");
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] Out Of Memory!");
                }
 
                dbus_connection_flush(conn);
                dbus_message_unref(reply);
        } else {
-               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] Fail to create reply message!!");
+               SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] Fail to create reply message!!");
        }
 
        return 0;
@@ -49,6 +49,7 @@ int ttsd_dbus_server_initialize(DBusConnection* conn, DBusMessage* msg)
        dbus_error_init(&err);
 
        int pid, uid;
+       bool credential_needed = 0;
        int ret = 0;
 
        dbus_message_get_args(msg, &err,
@@ -56,38 +57,43 @@ int ttsd_dbus_server_initialize(DBusConnection* conn, DBusMessage* msg)
                DBUS_TYPE_INT32, &uid,
                DBUS_TYPE_INVALID);
 
-       SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS INITIALIZE");
+       SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS INITIALIZE");
 
        if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts initialize : get arguments error (%s)", err.message);
+               SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts initialize : get arguments error (%s)", err.message);
                dbus_error_free(&err);
                ret = TTSD_ERROR_OPERATION_FAILED;
        } else {
 
-               SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts initialize : pid(%d), uid(%d)", pid , uid);
-               ret =  ttsd_server_initialize(pid, uid);
+               SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts initialize : pid(%d), uid(%d)", pid , uid);
+               ret =  ttsd_server_initialize(pid, uid, &credential_needed);
        }
 
        DBusMessage* reply;
        reply = dbus_message_new_method_return(msg);
 
+       int temp = (int)credential_needed;
+       SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts initialize : result(%d), credential_needed(%d)", ret, (int)credential_needed);
        if (NULL != reply) {
-               dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
+               dbus_message_append_args(reply,
+                       DBUS_TYPE_INT32, &ret,
+                       DBUS_TYPE_INT32, &temp,
+                       DBUS_TYPE_INVALID);
 
                if (0 == ret) {
-                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts initialize : result(%d)", ret);
+                       SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts initialize : result(%d), credential_needed(%d)", ret, credential_needed);
                } else {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts initialize : result(%d)", ret);
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts initialize : result(%d)", ret);
                }
 
                if (!dbus_connection_send(conn, reply, NULL)) {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts initialize : Out Of Memory!");
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts initialize : Out Of Memory!");
                }
 
                dbus_connection_flush(conn);
                dbus_message_unref(reply);
        } else {
-               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts initialize : Fail to create reply message!!");
+               SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts initialize : Fail to create reply message!!");
        }
 
        return 0;
@@ -103,14 +109,14 @@ int ttsd_dbus_server_finalize(DBusConnection* conn, DBusMessage* msg)
 
        dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
 
-       SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS FINALIZE");
+       SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS FINALIZE");
 
        if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts finalize : get arguments error (%s)", err.message);
+               SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts finalize : get arguments error (%s)", err.message);
                dbus_error_free(&err);
                ret = TTSD_ERROR_OPERATION_FAILED;
        } else {
-               SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts finalize : uid(%d)", uid);
+               SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts finalize : uid(%d)", uid);
                ret =  ttsd_server_finalize(uid);
        }
 
@@ -121,19 +127,19 @@ int ttsd_dbus_server_finalize(DBusConnection* conn, DBusMessage* msg)
                dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
 
                if (0 == ret) {
-                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts finalize : result(%d)", ret);
+                       SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts finalize : result(%d)", ret);
                } else {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts finalize : result(%d)", ret);
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts finalize : result(%d)", ret);
                }
 
                if (!dbus_connection_send(conn, reply, NULL)) {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts finalize : Out Of Memory!");
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts finalize : Out Of Memory!");
                }
 
                dbus_connection_flush(conn);
                dbus_message_unref(reply);
        } else {
-               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts finalize : Fail to create reply message!!");
+               SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts finalize : Fail to create reply message!!");
        }
 
        return 0;
@@ -150,14 +156,14 @@ int ttsd_dbus_server_get_support_voices(DBusConnection* conn, DBusMessage* msg)
 
        dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
 
-       SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS GET VOICES");
+       SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS GET VOICES");
 
        if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts get supported voices : get arguments error (%s)", err.message);
+               SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts get supported voices : get arguments error (%s)", err.message);
                dbus_error_free(&err);
                ret = TTSD_ERROR_OPERATION_FAILED;
        } else {
-               SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] get supported voices : uid(%d)", uid);
+               SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] get supported voices : uid(%d)", uid);
                ret = ttsd_server_get_support_voices(uid, &voice_list);
        }
 
@@ -176,7 +182,7 @@ int ttsd_dbus_server_get_support_voices(DBusConnection* conn, DBusMessage* msg)
                        int size = g_list_length(voice_list);
 
                        if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(size))) {
-                               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts supported voices : Fail to append type");
+                               SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts supported voices : Fail to append type");
                                ret = TTSD_ERROR_OPERATION_FAILED;
                        } else {
 
@@ -203,19 +209,19 @@ int ttsd_dbus_server_get_support_voices(DBusConnection* conn, DBusMessage* msg)
                                        iter = g_list_first(voice_list);
                                }
                        }
-                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts supported voices : result(%d)", ret);
+                       SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts supported voices : result(%d)", ret);
                } else {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts supported voices : result(%d)", ret);
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts supported voices : result(%d)", ret);
                }
 
                if (!dbus_connection_send(conn, reply, NULL)) {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] error : Out Of Memory!");
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] error : Out Of Memory!");
                }
 
                dbus_connection_flush(conn);
                dbus_message_unref(reply);
        } else {
-               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts supported voices : Fail to create reply message!!");
+               SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts supported voices : Fail to create reply message!!");
        }
 
        return 0;
@@ -233,14 +239,14 @@ int ttsd_dbus_server_get_current_voice(DBusConnection* conn, DBusMessage* msg)
 
        dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
 
-       SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS GET DEFAULT VOICE");
+       SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS GET DEFAULT VOICE");
 
        if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts get default voice : Get arguments error (%s)", err.message);
+               SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts get default voice : Get arguments error (%s)", err.message);
                dbus_error_free(&err);
                ret = TTSD_ERROR_OPERATION_FAILED;
        } else {
-               SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts get default voice : uid(%d)", uid);
+               SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts get default voice : uid(%d)", uid);
                ret = ttsd_server_get_current_voice(uid, &lang, &voice_type);
        }
 
@@ -255,22 +261,22 @@ int ttsd_dbus_server_get_current_voice(DBusConnection* conn, DBusMessage* msg)
                                DBUS_TYPE_STRING, &lang,
                                DBUS_TYPE_INT32, &voice_type,
                                DBUS_TYPE_INVALID);
-                       SECURE_SLOG(LOG_DEBUG, get_tag(), "[OUT] tts default voice : lang(%s), vctype(%d)", lang, voice_type);
+                       SECURE_SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts default voice : lang(%s), vctype(%d)", lang, voice_type);
                } else {
                        dbus_message_append_args(reply,
                                DBUS_TYPE_INT32, &ret,
                                DBUS_TYPE_INVALID);
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts default voice : result(%d)", ret); 
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts default voice : result(%d)", ret);
                }
 
                if (!dbus_connection_send(conn, reply, NULL)) {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts default voice : Out Of Memory!");
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts default voice : Out Of Memory!");
                }
 
                dbus_connection_flush(conn);
                dbus_message_unref(reply);
        } else {
-               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts default voice : Fail to create reply message!!");
+               SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts default voice : Fail to create reply message!!");
        }
 
        if (NULL != lang)       free(lang);
@@ -283,7 +289,7 @@ int ttsd_dbus_server_add_text(DBusConnection* conn, DBusMessage* msg)
        dbus_error_init(&err);
 
        int uid, voicetype, speed, uttid;
-       char *text, *lang;
+       char *text, *lang, *credential;
        int ret = 0;
 
        dbus_message_get_args(msg, &err,
@@ -293,19 +299,19 @@ int ttsd_dbus_server_add_text(DBusConnection* conn, DBusMessage* msg)
                DBUS_TYPE_INT32, &voicetype,
                DBUS_TYPE_INT32, &speed,
                DBUS_TYPE_INT32, &uttid,
+               DBUS_TYPE_STRING, &credential,
                DBUS_TYPE_INVALID);
 
-       SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS ADD TEXT");
+       SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS ADD TEXT");
 
        if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts add text : Get arguments error (%s)", err.message);
+               SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts add text : Get arguments error (%s)", err.message);
                dbus_error_free(&err);
                ret = TTSD_ERROR_OPERATION_FAILED;
        } else {
-               
-               SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts add text : uid(%d), text(%s), lang(%s), type(%d), speed(%d), uttid(%d)", 
-                       uid, text, lang, voicetype, speed, uttid); 
-               ret =  ttsd_server_add_queue(uid, text, lang, voicetype, speed, uttid);
+               SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts add text : uid(%d), text(%s), lang(%s), type(%d), speed(%d), uttid(%d), credential(%s)", 
+                       uid, (NULL == text) ? "NULL" : text, (NULL == lang) ? "NULL" : lang, voicetype, speed, uttid, (NULL == credential) ? "NULL" : credential);
+               ret =  ttsd_server_add_queue(uid, text, lang, voicetype, speed, uttid, credential);
        }
 
        DBusMessage* reply;
@@ -315,23 +321,23 @@ int ttsd_dbus_server_add_text(DBusConnection* conn, DBusMessage* msg)
                dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
 
                if (0 == ret) {
-                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts add text : result(%d)", ret);
+                       SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts add text : result(%d)", ret);
                } else {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts add text : result(%d)", ret);
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add text : result(%d)", ret);
                }
 
                if (!dbus_connection_send(conn, reply, NULL)) {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts add text : Out Of Memory!");
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add text : Out Of Memory!");
                }
 
                dbus_connection_flush(conn);
                dbus_message_unref(reply);
        } else {
-               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts add text : Fail to create reply message!!");
+               SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add text : Fail to create reply message!!");
        }
 
-       SLOG(LOG_DEBUG, get_tag(), "<<<<<");
-       SLOG(LOG_DEBUG, get_tag(), "  ");
+       SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
+       SLOG(LOG_DEBUG, tts_tag(), "  ");
 
        return 0;
 }
@@ -342,19 +348,23 @@ int ttsd_dbus_server_play(DBusConnection* conn, DBusMessage* msg)
        dbus_error_init(&err);
 
        int uid;
+       char* credential;
        int ret = 0;
 
-       dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
+       dbus_message_get_args(msg, &err,
+               DBUS_TYPE_INT32, &uid,
+               DBUS_TYPE_STRING, &credential,
+               DBUS_TYPE_INVALID);
 
-       SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS PLAY");
+       SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS PLAY");
 
        if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts play : Get arguments error (%s)", err.message);
+               SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts play : Get arguments error (%s)", err.message);
                dbus_error_free(&err);
                ret = TTSD_ERROR_OPERATION_FAILED;
        } else {
-               SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts play : uid(%d)", uid);
-               ret =  ttsd_server_play(uid);
+               SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts play : uid(%d), credential(%s)", uid, (NULL == credential) ? "NULL" : credential);
+               ret =  ttsd_server_play(uid, credential);
        }
 
        DBusMessage* reply;
@@ -364,23 +374,23 @@ int ttsd_dbus_server_play(DBusConnection* conn, DBusMessage* msg)
                dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
 
                if (0 == ret) {
-                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts play : result(%d)", ret);
+                       SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts play : result(%d)", ret);
                } else {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts play : result(%d)", ret);
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play : result(%d)", ret);
                }
 
                if (!dbus_connection_send(conn, reply, NULL)) {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts play : Out Of Memory!");
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play : Out Of Memory!");
                }
 
                dbus_connection_flush(conn);
                dbus_message_unref(reply);
        } else {
-               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts play : Fail to create reply message!!");
+               SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play : Fail to create reply message!!");
        }
 
-       SLOG(LOG_DEBUG, get_tag(), "<<<<<");
-       SLOG(LOG_DEBUG, get_tag(), "  ");
+       SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
+       SLOG(LOG_DEBUG, tts_tag(), "  ");
 
        return 0;
 }
@@ -396,14 +406,14 @@ int ttsd_dbus_server_stop(DBusConnection* conn, DBusMessage* msg)
                DBUS_TYPE_INT32, &uid, 
                DBUS_TYPE_INVALID);
 
-       SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS STOP");
+       SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS STOP");
 
        if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts stop : Get arguments error (%s)", err.message);
+               SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts stop : Get arguments error (%s)", err.message);
                dbus_error_free(&err);
                ret = TTSD_ERROR_OPERATION_FAILED;
        } else {
-               SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts stop : uid(%d)", uid);
+               SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts stop : uid(%d)", uid);
                ret = ttsd_server_stop(uid);
        }
 
@@ -416,23 +426,23 @@ int ttsd_dbus_server_stop(DBusConnection* conn, DBusMessage* msg)
                        DBUS_TYPE_INVALID);
 
                if (0 == ret) {
-                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts stop : result(%d)", ret);
+                       SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts stop : result(%d)", ret);
                } else {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts stop : result(%d)", ret);
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop : result(%d)", ret);
                }
 
                if (!dbus_connection_send(conn, reply, NULL)) {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts stop : Out Of Memory!");
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop : Out Of Memory!");
                }
 
                dbus_connection_flush(conn);
                dbus_message_unref(reply);
        } else {
-               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts stop : Fail to create reply message!!");
+               SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop : Fail to create reply message!!");
        }
 
-       SLOG(LOG_DEBUG, get_tag(), "<<<<<");
-       SLOG(LOG_DEBUG, get_tag(), "  ");
+       SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
+       SLOG(LOG_DEBUG, tts_tag(), "  ");
 
        return 0;
 }
@@ -449,14 +459,14 @@ int ttsd_dbus_server_pause(DBusConnection* conn, DBusMessage* msg)
                DBUS_TYPE_INT32, &uid, 
                DBUS_TYPE_INVALID);
 
-       SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS PAUSE");
+       SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS PAUSE");
 
        if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts pause : Get arguments error (%s)", err.message);
+               SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts pause : Get arguments error (%s)", err.message);
                dbus_error_free(&err);
                ret = TTSD_ERROR_OPERATION_FAILED;
        } else {
-               SECURE_SLOG(LOG_DEBUG, get_tag(), "[IN] tts pause : uid(%d)", uid);
+               SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts pause : uid(%d)", uid);
                ret = ttsd_server_pause(uid, &uttid);
        }
 
@@ -469,23 +479,23 @@ int ttsd_dbus_server_pause(DBusConnection* conn, DBusMessage* msg)
                        DBUS_TYPE_INVALID);
 
                if (0 == ret) {
-                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts pause : result(%d)", ret);
+                       SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts pause : result(%d)", ret);
                } else {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts pause : result(%d)", ret);
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts pause : result(%d)", ret);
                }
 
                if (!dbus_connection_send(conn, reply, NULL)) {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts pause : Out Of Memory!");
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts pause : Out Of Memory!");
                }
 
                dbus_connection_flush(conn);
                dbus_message_unref(reply);
        } else {
-               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts pause : Fail to create reply message!!");
+               SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts pause : Fail to create reply message!!");
        }
 
-       SLOG(LOG_DEBUG, get_tag(), "<<<<<");
-       SLOG(LOG_DEBUG, get_tag(), "  ");
+       SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
+       SLOG(LOG_DEBUG, tts_tag(), "  ");
 
        return 0;
 }
@@ -505,14 +515,14 @@ int ttsd_dbus_server_set_private_data(DBusConnection* conn, DBusMessage* msg)
                DBUS_TYPE_STRING, &data,
                DBUS_TYPE_INVALID);
 
-       SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS set private data");
+       SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS set private data");
 
        if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, get_tag(), "[IN ERROR] Fail to get arguments (%s)", err.message);
+               SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] Fail to get arguments (%s)", err.message);
                dbus_error_free(&err);
                ret = TTSD_ERROR_OPERATION_FAILED;
        } else {
-               SLOG(LOG_DEBUG, get_tag(), "[IN] tts set private data(%d)", uid);
+               SLOG(LOG_DEBUG, tts_tag(), "[IN] tts set private data(%d)", uid);
                ret = ttsd_server_set_private_data(uid, key, data);
        }
 
@@ -525,23 +535,23 @@ int ttsd_dbus_server_set_private_data(DBusConnection* conn, DBusMessage* msg)
                        DBUS_TYPE_INVALID);
 
                if (0 == ret) {
-                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts set private data : (%d)", ret);
+                       SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts set private data : (%d)", ret);
                } else {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts set private data : (%d)", ret);
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts set private data : (%d)", ret);
                }
 
                if (!dbus_connection_send(conn, reply, NULL)) {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] Fail to send reply");
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] Fail to send reply");
                }
 
                dbus_connection_flush(conn);
                dbus_message_unref(reply);
        } else {
-               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] Fail to create reply message");
+               SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] Fail to create reply message");
        }
 
-       SLOG(LOG_DEBUG, get_tag(), "<<<<<");
-       SLOG(LOG_DEBUG, get_tag(), "");
+       SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
+       SLOG(LOG_DEBUG, tts_tag(), "");
 
        return 0;
 }
@@ -552,22 +562,22 @@ int ttsd_dbus_server_get_private_data(DBusConnection* conn, DBusMessage* msg)
        dbus_error_init(&err);
 
        int uid;
-       char* key;
-       char* data;
+       char* key = NULL;
+       char* data = NULL;
        int ret = 0;
        dbus_message_get_args(msg, &err,
                DBUS_TYPE_INT32, &uid,
                DBUS_TYPE_STRING, &key,
                DBUS_TYPE_INVALID);
 
-       SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS get private data");
+       SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS get private data");
 
        if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, get_tag(), "[IN ERROR] Fail to get arguments (%s)", err.message);
+               SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] Fail to get arguments (%s)", err.message);
                dbus_error_free(&err);
                ret = TTSD_ERROR_OPERATION_FAILED;
        } else {
-               SLOG(LOG_DEBUG, get_tag(), "[IN] tts get private data(%d)", uid);
+               SLOG(LOG_DEBUG, tts_tag(), "[IN] tts get private data(%d)", uid);
                ret = ttsd_server_get_private_data(uid, key, &data);
        }
 
@@ -577,26 +587,197 @@ int ttsd_dbus_server_get_private_data(DBusConnection* conn, DBusMessage* msg)
        if (NULL != reply) {
                dbus_message_append_args(reply,
                        DBUS_TYPE_INT32, &ret,
+                       DBUS_TYPE_STRING, &data,
                        DBUS_TYPE_INVALID);
 
                if (0 == ret) {
-                       SLOG(LOG_DEBUG, get_tag(), "[OUT] tts get private data : (%d)", ret);
+                       SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts get private data : Result(%d), data(%s)", ret, (NULL == data) ? "NULL" : data);
+               } else {
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts get private data : (%d)", ret);
+               }
+
+               if (!dbus_connection_send(conn, reply, NULL)) {
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] Fail to send reply");
+               }
+
+               dbus_connection_flush(conn);
+               dbus_message_unref(reply);
+       } else {
+               SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] Fail to create reply message");
+       }
+
+       SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
+       SLOG(LOG_DEBUG, tts_tag(), "");
+
+       if (NULL != data) {
+               free(data);
+               data = NULL;
+       }
+
+       return 0;
+}
+
+int ttsd_dbus_server_play_pcm(DBusConnection* conn, DBusMessage* msg)
+{
+       DBusError err;
+       dbus_error_init(&err);
+
+       int uid;
+       int ret = 0;
+
+       dbus_message_get_args(msg, &err,
+               DBUS_TYPE_INT32, &uid,
+               DBUS_TYPE_INVALID);
+
+       SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS PLAY PCM");
+
+       if (dbus_error_is_set(&err)) {
+               SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts play pcm : Get arguments error (%s)", err.message);
+               dbus_error_free(&err);
+               ret = TTSD_ERROR_OPERATION_FAILED;
+       } else {
+               SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts play pcm : uid(%d)", uid);
+               ret =  ttsd_server_play_pcm(uid);
+       }
+
+       DBusMessage* reply;
+       reply = dbus_message_new_method_return(msg);
+
+       if (NULL != reply) {
+               dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
+
+               if (0 == ret) {
+                       SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts play pcm : result(%d)", ret);
+               } else {
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play pcm : result(%d)", ret);
+               }
+
+               if (!dbus_connection_send(conn, reply, NULL)) {
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play pcm : Out Of Memory!");
+               }
+
+               dbus_connection_flush(conn);
+               dbus_message_unref(reply);
+       } else {
+               SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts play pcm : Fail to create reply message!!");
+       }
+
+       SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
+       SLOG(LOG_DEBUG, tts_tag(), "  ");
+
+       return 0;
+}
+
+int ttsd_dbus_server_stop_pcm(DBusConnection* conn, DBusMessage* msg)
+{
+       DBusError err;
+       dbus_error_init(&err);
+
+       int uid;
+       int ret = 0;
+
+       dbus_message_get_args(msg, &err,
+               DBUS_TYPE_INT32, &uid,
+               DBUS_TYPE_INVALID);
+
+       SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS STOP PCM");
+
+       if (dbus_error_is_set(&err)) {
+               SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts stop pcm : Get arguments error (%s)", err.message);
+               dbus_error_free(&err);
+               ret = TTSD_ERROR_OPERATION_FAILED;
+       } else {
+               SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts stop pcm : uid(%d)", uid);
+               ret =  ttsd_server_stop_pcm(uid);
+       }
+
+       DBusMessage* reply;
+       reply = dbus_message_new_method_return(msg);
+
+       if (NULL != reply) {
+               dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
+
+               if (0 == ret) {
+                       SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts stop pcm : result(%d)", ret);
+               } else {
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop pcm : result(%d)", ret);
+               }
+
+               if (!dbus_connection_send(conn, reply, NULL)) {
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop pcm : Out Of Memory!");
+               }
+
+               dbus_connection_flush(conn);
+               dbus_message_unref(reply);
+       } else {
+               SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts stop pcm : Fail to create reply message!!");
+       }
+
+       SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
+       SLOG(LOG_DEBUG, tts_tag(), "  ");
+
+       return 0;
+}
+
+int ttsd_dbus_server_add_pcm(DBusConnection* conn, DBusMessage* msg)
+{
+       DBusError err;
+       dbus_error_init(&err);
+
+       int uid;
+       int event;
+       int audio_type;
+       int rate;
+       char* data = NULL;
+       int data_size;
+       int ret = 0;
+
+       dbus_message_get_args(msg, &err,
+               DBUS_TYPE_INT32, &uid,
+               DBUS_TYPE_INT32, &event,
+               DBUS_TYPE_INT32, &audio_type,
+               DBUS_TYPE_INT32, &rate,
+               //DBUS_TYPE_STRING, &data,
+               //DBUS_TYPE_INT32, &data_size,
+               DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
+               &data, &data_size,
+               DBUS_TYPE_INVALID);
+
+       SLOG(LOG_DEBUG, tts_tag(), ">>>>> TTS ADD PCM");
+
+       if (dbus_error_is_set(&err)) {
+               SLOG(LOG_ERROR, tts_tag(), "[IN ERROR] tts add pcm : Get arguments error (%s)", err.message);
+               dbus_error_free(&err);
+               ret = TTSD_ERROR_OPERATION_FAILED;
+       } else {
+               SECURE_SLOG(LOG_DEBUG, tts_tag(), "[IN] tts add pcm : uid(%d)", uid);
+               ret =  ttsd_server_add_pcm(uid, event, (void*)data, data_size, audio_type, rate);
+       }
+
+       DBusMessage* reply;
+       reply = dbus_message_new_method_return(msg);
+
+       if (NULL != reply) {
+               dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
+
+               if (0 == ret) {
+                       SLOG(LOG_DEBUG, tts_tag(), "[OUT] tts add pcm : result(%d)", ret);
                } else {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts get private data : (%d)", ret);
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add pcm : result(%d)", ret);
                }
 
                if (!dbus_connection_send(conn, reply, NULL)) {
-                       SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] Fail to send reply");
+                       SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add pcm : Out Of Memory!");
                }
 
                dbus_connection_flush(conn);
                dbus_message_unref(reply);
        } else {
-               SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] Fail to create reply message");
+               SLOG(LOG_ERROR, tts_tag(), "[OUT ERROR] tts add pcm : Fail to create reply message!!");
        }
 
-       SLOG(LOG_DEBUG, get_tag(), "<<<<<");
-       SLOG(LOG_DEBUG, get_tag(), "");
+       SLOG(LOG_DEBUG, tts_tag(), "<<<<<");
+       SLOG(LOG_DEBUG, tts_tag(), "  ");
 
        return 0;
 }