Replace IPC between widget and server from dbus to tidl 51/273451/5
authorulgal-park <ulgal.park@samsung.com>
Tue, 15 Mar 2022 03:04:27 +0000 (12:04 +0900)
committerulgal-park <ulgal.park@samsung.com>
Fri, 15 Apr 2022 08:42:52 +0000 (17:42 +0900)
Change-Id: I08d104ed3511cfb0b251062e5521664105ae2cb3

20 files changed:
client/CMakeLists.txt
client/vc_mgr.c
client/vc_mgr_tidl.c
client/vc_widget.c
client/vc_widget_dbus.c [deleted file]
client/vc_widget_dbus.h [deleted file]
client/vc_widget_tidl.c [new file with mode: 0644]
client/vc_widget_tidl.h [new file with mode: 0644]
common/vc_defs.h
packaging/voice-control.spec
server/CMakeLists.txt
server/vcd_client_data.c
server/vcd_client_data.h
server/vcd_dbus.c
server/vcd_dbus.h
server/vcd_server.c
server/vcd_tidl.c
server/vcd_tidl.h
tidl/vc_widget.tidl [new file with mode: 0644]
tidl/vcd_widget.tidl [new file with mode: 0644]

index 5815fa0..ab5f35f 100644 (file)
@@ -22,7 +22,9 @@ SET(SETTING_SRCS
 SET(WIDGET_SRCS
        vc_widget.c
        vc_widget_client.c
-       vc_widget_dbus.c
+       vc_widget_tidl.c
+       vc_widget_proxy.c
+       vc_widget_stub.c
        ../common/vc_cmd_db.c
        ../common/vc_command.c
        ../common/vc_command_util.c
index c02b61b..9fd7862 100755 (executable)
@@ -557,6 +557,7 @@ static Eina_Bool __send_hello_message(void *data)
                        g_send_hello_timer = NULL;
                        return EINA_FALSE;
                } else {
+                       // TODO: discuss when updating connect/reconnect
                        g_tidl_send_hello_count++;
                        return EINA_TRUE;
                }
index fc9781f..27154fc 100755 (executable)
@@ -582,6 +582,8 @@ int vc_mgr_tidl_open_connection()
        char* engine_app_id = vconf_get_str(VC_ENGINE_DB_DEFAULT);
        if (NULL == engine_app_id) {
                SLOG(LOG_ERROR, TAG_VCM, "[TIDL] vconf not found");
+               free(g_proxy_tidl_info);
+               g_proxy_tidl_info = NULL;
                pthread_mutex_unlock(&g_tidl_mutex);
                return VC_ERROR_ENGINE_NOT_FOUND;
        }
index 92e0951..c0d1b1e 100644 (file)
@@ -23,7 +23,7 @@
 #include "vc_info_parser.h"
 #include "vc_main.h"
 #include "vc_widget_client.h"
-#include "vc_widget_dbus.h"
+#include "vc_widget_tidl.h"
 #include "voice_control_command.h"
 #include "voice_control_command_expand.h"
 #include "voice_control_internal.h"
@@ -174,7 +174,7 @@ int vc_widget_initialize(vc_h* vc_w)
        }
 
        if (0 == vc_widget_client_get_count()) {
-               if (0 != vc_widget_dbus_open_connection()) {
+               if (0 != vc_widget_tidl_open_connection()) {
                        SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to open connection");
                        return VC_ERROR_OPERATION_FAILED;
                }
@@ -216,7 +216,7 @@ int vc_widget_initialize(vc_h* vc_w)
 
 static void __vc_widget_internal_unprepare(vc_h vc_w)
 {
-       int ret = vc_widget_dbus_request_finalize(getpid());
+       int ret = vc_widget_tidl_request_finalize(getpid());
        if (0 != ret) {
                SLOG(LOG_WARN, TAG_VCW, "[ERROR] Fail to request finalize : %s", __vc_widget_get_error_code(ret));
        }
@@ -333,8 +333,7 @@ int vc_widget_deinitialize(vc_h vc_w)
                if (0 != ret) {
                        SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to finalize DB, ret(%d)", ret);
                }
-
-               if (0 != vc_widget_dbus_close_connection()) {
+               if (0 != vc_widget_tidl_close_connection()) {
                        SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to close connection");
                }
        }
@@ -352,13 +351,13 @@ static Eina_Bool __focus_changed_cb(void *data, int type, void *event)
        int ret;
        if (ECORE_WL2_EVENT_FOCUS_IN == type) {
                SLOG(LOG_DEBUG, TAG_VCW, "@@@ Set foreground");
-               ret = vc_widget_dbus_set_foreground(getpid(), true);
+               ret = vc_widget_tidl_set_foreground(getpid(), true);
                if (0 != ret) {
                        SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to set foreground (true) : %d", ret);
                }
        } else if (ECORE_WL2_EVENT_FOCUS_OUT == type) {
                SLOG(LOG_DEBUG, TAG_VCW, "@@@ Set background");
-               ret = vc_widget_dbus_set_foreground(getpid(), false);
+               ret = vc_widget_tidl_set_foreground(getpid(), false);
                if (0 != ret) {
                        SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to set foreground (false) : %d", ret);
                }
@@ -421,7 +420,7 @@ static Eina_Bool __vc_widget_connect_daemon(void *data)
 
        /* request initialization */
        int service_state = 0;
-       ret = vc_widget_dbus_request_initialize(getpid(), &service_state, &g_daemon_pid);
+       ret = vc_widget_tidl_request_initialize(getpid(), &service_state, &g_daemon_pid);
 
        if (VC_ERROR_ENGINE_NOT_FOUND == ret) {
                SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to initialize : %s", __vc_widget_get_error_code(ret));
@@ -481,7 +480,7 @@ static Eina_Bool __vc_widget_connect_daemon(void *data)
        int status = aul_app_get_status(appid);
        if (status == STATUS_FOCUS) {
                SLOG(LOG_DEBUG, TAG_VCW, "@@@ Set foreground");
-               ret = vc_widget_dbus_set_foreground(getpid(), true);
+               ret = vc_widget_tidl_set_foreground(getpid(), true);
                if (0 != ret) {
                        SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to set foreground (true) : %d", ret);
                }
@@ -535,12 +534,15 @@ static void __start_prepare_thread(void *data, Ecore_Thread *thread)
                        return;
                }
 
-               ret = vc_widget_dbus_request_hello();
+               ret = vc_widget_tidl_request_hello();
                if (ret == 0) {
                        SLOG(LOG_DEBUG, TAG_VCW, "Success to request hello. retry count(%d)", retry_count);
                        break;
                } else {
                        retry_count++;
+                       // TODO: discuss when updating connect/reconnect
+                       SLOG(LOG_DEBUG, TAG_VCW, "Fail to request TIDL hello. failed(%d)", retry_count);
+                       usleep(200000);
                }
        }
 
@@ -703,7 +705,7 @@ int vc_widget_enable_asr_result(vc_h vc_w, bool enable)
        int ret = -1;
 
        do {
-               ret = vc_widget_dbus_request_enable_asr_result(getpid(), enable);
+               ret = vc_widget_tidl_request_enable_asr_result(getpid(), enable);
                if (0 != ret) {
                        if (VC_ERROR_TIMED_OUT != ret) {
                                SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to enable asr result : %s", __vc_widget_get_error_code(ret));
@@ -903,7 +905,7 @@ int vc_widget_set_foreground(vc_h vc_w, bool value)
        }
 
        SLOG(LOG_DEBUG, TAG_VCW, "Set foreground : pid(%d) value(%s)", getpid(), value ? "true" : "false");
-       int ret = vc_widget_dbus_set_foreground(getpid(), value);
+       int ret = vc_widget_tidl_set_foreground(getpid(), value);
        if (0 != ret) {
                ret = vc_config_convert_error_code((vc_config_error_e)ret);
                SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to set foreground : %s", __vc_widget_get_error_code(ret));
@@ -1013,7 +1015,7 @@ int vc_widget_start(bool stop_by_silence, vc_cmd_group_h vc_group)
        } else {
                int count = 0;
                do {
-                       ret = vc_widget_dbus_request_start(getpid(), stop_by_silence);
+                       ret = vc_widget_tidl_request_start(getpid(), stop_by_silence);
                        if (0 != ret) {
                                if (VC_ERROR_TIMED_OUT != ret) {
                                        SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to request start : %s", __vc_widget_get_error_code(ret));
@@ -1095,7 +1097,7 @@ int vc_widget_stop()
 
        int count = 0;
        do {
-               ret = vc_widget_dbus_request_stop(getpid());
+               ret = vc_widget_tidl_request_stop(getpid());
                if (0 != ret) {
                        if (VC_ERROR_TIMED_OUT != ret) {
                                SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to request stop : %s", __vc_widget_get_error_code(ret));
@@ -1152,7 +1154,7 @@ int vc_widget_cancel(vc_h vc_w)
        int ret = -1;
 
        do {
-               ret = vc_widget_dbus_request_cancel(getpid());
+               ret = vc_widget_tidl_request_cancel(getpid());
                if (0 != ret) {
                        if (VC_ERROR_TIMED_OUT != ret) {
                                SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to request cancel : %s", __vc_widget_get_error_code(ret));
@@ -1311,7 +1313,7 @@ static Eina_Bool __vc_widget_start_recording(void *data)
        ret = -1;
        count = 0;
        while (0 != ret) {
-               ret = vc_widget_dbus_request_start_recording(getpid(), widget_command);
+               ret = vc_widget_tidl_request_start_recording(getpid(), widget_command);
                if (0 != ret) {
                        if (VC_ERROR_TIMED_OUT != ret) {
                                SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to request start recording to daemon : %s", __vc_widget_get_error_code(ret));
diff --git a/client/vc_widget_dbus.c b/client/vc_widget_dbus.c
deleted file mode 100644 (file)
index a6f2769..0000000
+++ /dev/null
@@ -1,1126 +0,0 @@
-/*
-* Copyright (c) 2011-2015 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.
-*/
-
-
-#include <pthread.h>
-
-#include "vc_main.h"
-#include "vc_widget_client.h"
-#include "vc_widget_dbus.h"
-
-
-static pthread_mutex_t g_w_dbus_mutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t g_w_init_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-static int g_w_waiting_time = 3000;
-static int g_w_waiting_short_time = 200;
-static bool g_is_connection_opened = false;
-
-static Ecore_Fd_Handler* g_w_fd_handler = NULL;
-
-static DBusConnection* g_w_conn_sender = NULL;
-static DBusConnection* g_w_conn_listener = NULL;
-
-extern int __vc_widget_cb_error(int reason, int daemon_pid, char* msg);
-
-extern void __vc_widget_cb_show_tooltip(int pid, bool show);
-
-extern void __vc_widget_cb_result();
-
-extern bool __vc_widget_cb_asr_result(int event, const char* asr_result);
-
-extern int __vc_widget_cb_service_state(int state);
-
-
-static Eina_Bool widget_listener_event_callback(void* data, Ecore_Fd_Handler *fd_handler)
-{
-       if (NULL == g_w_conn_listener)  return ECORE_CALLBACK_RENEW;
-
-       dbus_connection_read_write_dispatch(g_w_conn_listener, 50);
-
-       while (1) {
-               DBusMessage* msg = NULL;
-               msg = dbus_connection_pop_message(g_w_conn_listener);
-
-               /* loop again if we haven't read a message */
-               if (NULL == msg) {
-                       break;
-               }
-
-               SLOG(LOG_DEBUG, TAG_VCW, "[DEBUG] Message is arrived");
-
-               DBusError err;
-               dbus_error_init(&err);
-
-               char if_name[64] = {0, };
-               snprintf(if_name, 64, "%s", VC_WIDGET_SERVICE_INTERFACE);
-
-               if (dbus_message_is_method_call(msg, if_name, VCD_WIDGET_METHOD_HELLO)) {
-                       SLOG(LOG_DEBUG, TAG_VCW, "@@@ Get widget hello");
-                       int pid = 0;
-                       int response = -1;
-
-                       dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID);
-
-                       if (dbus_error_is_set(&err)) {
-                               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Dbus Error (%s)", err.message);
-                               dbus_error_free(&err);
-                       }
-
-                       if (pid > 0) {
-                               SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget get hello : pid(%d) ", pid);
-                               response = 1;
-                       } else {
-                               SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget get hello : invalid pid ");
-                       }
-
-                       DBusMessage* reply = NULL;
-                       reply = dbus_message_new_method_return(msg);
-
-                       if (NULL != reply) {
-                               dbus_message_append_args(reply, DBUS_TYPE_INT32, &response, DBUS_TYPE_INVALID);
-
-                               if (!dbus_connection_send(g_w_conn_listener, reply, NULL))
-                                       SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget get hello : fail to send reply");
-                               else
-                                       SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget get hello : result(%d)", response);
-
-                               dbus_connection_flush(g_w_conn_listener);
-                               dbus_message_unref(reply);
-                       } else {
-                               SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget get hello : fail to create reply message");
-                       }
-
-                       SLOG(LOG_DEBUG, TAG_VCW, "@@@");
-               } /* VCD_WIDGET_METHOD_HELLO */
-
-               else if (dbus_message_is_signal(msg, if_name, VCD_WIDGET_METHOD_SET_SERVICE_STATE)) {
-                       int state = 0;
-
-                       dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &state, DBUS_TYPE_INVALID);
-                       if (dbus_error_is_set(&err)) {
-                               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Get arguments error (%s)", err.message);
-                               dbus_error_free(&err);
-                       }
-
-                       SLOG(LOG_DEBUG, TAG_VCW, "@@ service state changed : %d", state);
-
-                       __vc_widget_cb_service_state(state);
-
-               } /* VCD_WIDGET_METHOD_SET_SERVICE_STATE */
-
-               else if (dbus_message_is_method_call(msg, if_name, VCD_WIDGET_METHOD_SHOW_TOOLTIP)) {
-                       SLOG(LOG_DEBUG, TAG_VCW, "@@@ Show / Hide tooltip");
-                       int pid = 0;
-                       int show = 0;
-
-                       dbus_message_get_args(msg, &err,
-                                       DBUS_TYPE_INT32, &pid,
-                                       DBUS_TYPE_INT32, &show,
-                                       DBUS_TYPE_INVALID);
-
-                       if (dbus_error_is_set(&err)) {
-                               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Dbus Error (%s)", err.message);
-                               dbus_error_free(&err);
-                       }
-
-                       if (pid > 0) {
-                               SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget show tooltip : pid(%d), show(%d)", pid, show);
-                               __vc_widget_cb_show_tooltip(pid, (bool)show);
-                       } else {
-                               SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget show tooltip : invalid pid");
-                       }
-
-                       SLOG(LOG_DEBUG, TAG_VCW, "@@@");
-               } /* VCD_WIDGET_METHOD_SHOW_TOOLTIP */
-
-               else if (dbus_message_is_method_call(msg, if_name, VCD_WIDGET_METHOD_RESULT)) {
-                       SLOG(LOG_DEBUG, TAG_VCW, "@@@ Get widget result");
-
-                       __vc_widget_cb_result();
-
-                       SLOG(LOG_DEBUG, TAG_VCW, "@@@");
-
-               } /* VCD_WIDGET_METHOD_RESULT */
-
-               else if (dbus_message_is_method_call(msg, if_name, VCD_WIDGET_METHOD_ASR_RESULT)) {
-                       SLOG(LOG_DEBUG, TAG_VCW, "@@@ Get widget asr result");
-                       int ret = 0;
-                       int event = -1;
-                       char* asr_result = NULL;
-
-                       dbus_message_get_args(msg, &err,
-                               DBUS_TYPE_INT32, &event,
-                               DBUS_TYPE_STRING, &asr_result,
-                               DBUS_TYPE_INVALID);
-
-                       if (false == __vc_widget_cb_asr_result(event, asr_result))
-                               ret = 0;
-                       else
-                               ret = 1;
-
-                       DBusMessage* reply = dbus_message_new_method_return(msg);
-                       if (NULL != reply) {
-                               dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
-                               if (!dbus_connection_send(g_w_conn_listener, reply, NULL))
-                                       SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget get asr result : fail to send reply");
-                               else
-                                       SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget get asr result, event(%d), asr_result(%s), consumed(%d)", event, asr_result, ret);
-
-                               dbus_connection_flush(g_w_conn_listener);
-                               dbus_message_unref(reply);
-                       } else {
-                               SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget asr get result : fail to create reply message");
-                       }
-
-                       SLOG(LOG_DEBUG, TAG_VCW, "@@@");
-
-               } /* VCD_WIDGET_METHOD_ASR_RESULT */
-
-               else if (dbus_message_is_signal(msg, if_name, VCD_WIDGET_METHOD_ERROR)) {
-                       SLOG(LOG_DEBUG, TAG_VCW, "@@@ Get widget error");
-                       int reason;
-                       int daemon_pid;
-                       char* err_msg;
-
-                       dbus_message_get_args(msg, &err,
-                               DBUS_TYPE_INT32, &reason,
-                               DBUS_TYPE_INT32, &daemon_pid,
-                               DBUS_TYPE_STRING, &err_msg,
-                               DBUS_TYPE_INVALID);
-
-                       if (dbus_error_is_set(&err)) {
-                               SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget get error message : Get arguments error (%s)", err.message);
-                               dbus_error_free(&err);
-                       } else {
-                               SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget get error message : reason(%d), daemon_pid(%d), msg(%s)", reason, daemon_pid, err_msg);
-                               __vc_widget_cb_error(reason, daemon_pid, err_msg);
-                       }
-
-                       /*
-                       reply = dbus_message_new_method_return(msg);
-
-                       if (NULL != reply) {
-                               if (!dbus_connection_send(g_w_conn_listener, reply, NULL))
-                                       SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget error message : fail to send reply");
-                               else
-                                       SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget error message");
-
-                               dbus_connection_flush(g_w_conn_listener);
-                               dbus_message_unref(reply);
-                       } else {
-                               SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget error message : fail to create reply message");
-                       }
-                       */
-
-                       SLOG(LOG_DEBUG, TAG_VCW, "@@@");
-               } /* VCD_WIDGET_METHOD_ERROR */
-
-               else if (dbus_message_is_signal(msg, "org.freedesktop.DBus", "NameOwnerChanged")) {
-                       SLOG(LOG_DEBUG, TAG_VCW, "@@@ Owner Changed");
-                       DBusError err;
-                       dbus_error_init(&err);
-
-                       /* remove a rule for daemon error */
-                       char rule_err[256] = {0, };
-                       snprintf(rule_err, 256, "sender='org.freedesktop.DBus',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',type='signal',arg0='%s'", VC_SERVER_SERVICE_INTERFACE);
-                       dbus_bus_remove_match(g_w_conn_listener, rule_err, &err);
-                       dbus_connection_flush(g_w_conn_listener);
-
-                       if (dbus_error_is_set(&err)) {
-                               SLOG(LOG_ERROR, TAG_VCW, "Match Error (%s)", err.message);
-                               dbus_error_free(&err);
-                       }
-                       __vc_widget_cb_error(VC_ERROR_SERVICE_RESET, -1, "Daemon Reset");
-                       SLOG(LOG_DEBUG, TAG_VCW, "@@@");
-               } /* NameOwnerChanged */
-
-               else {
-                       const char* sender = dbus_message_get_sender(msg);
-                       const char* destination = dbus_message_get_destination(msg);
-                       const char* path = dbus_message_get_path(msg);
-                       const char* interf = dbus_message_get_interface(msg);
-                       const char* member = dbus_message_get_member(msg);
-                       int type = dbus_message_get_type(msg);
-                       SLOG(LOG_ERROR, TAG_VCW, "[INFO] Message is NOT valid, sender(%s), destination(%s), path(%s), interface(%s), member(%s), type(%d)", sender, destination, path, interf, member, type);
-                       dbus_message_unref(msg);
-                       break;
-               }
-
-               /* free the message */
-               dbus_message_unref(msg);
-       } /* while(1) */
-
-       return ECORE_CALLBACK_PASS_ON;
-}
-
-static void __vc_widget_dbus_connection_free()
-{
-       if (NULL != g_w_conn_listener) {
-               dbus_connection_close(g_w_conn_listener);
-               dbus_connection_unref(g_w_conn_listener);
-               g_w_conn_listener = NULL;
-       }
-       if (NULL != g_w_conn_sender) {
-               dbus_connection_close(g_w_conn_sender);
-               dbus_connection_unref(g_w_conn_sender);
-               g_w_conn_sender = NULL;
-       }
-}
-
-int vc_widget_dbus_open_connection()
-{
-       pthread_mutex_lock(&g_w_dbus_mutex);
-
-       if (NULL != g_w_conn_sender && NULL != g_w_conn_listener) {
-               SLOG(LOG_WARN, TAG_VCW, "Already existed connection ");
-               pthread_mutex_unlock(&g_w_dbus_mutex);
-               return VC_ERROR_NONE;
-       }
-
-       DBusError err;
-       int ret;
-
-       /* initialize the error value */
-       dbus_error_init(&err);
-
-       /* connect to the DBUS system bus, and check for errors */
-       g_w_conn_sender = dbus_bus_get_private(DBUS_BUS_SESSION, &err);
-
-       if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, TAG_VCW, "Dbus Connection Error (%s)", err.message);
-               dbus_error_free(&err);
-       }
-
-       if (NULL == g_w_conn_sender) {
-               SLOG(LOG_ERROR, TAG_VCW, "Fail to get dbus connection ");
-               pthread_mutex_unlock(&g_w_dbus_mutex);
-               return VC_ERROR_OPERATION_FAILED;
-       }
-
-       dbus_connection_set_exit_on_disconnect(g_w_conn_sender, false);
-
-       g_w_conn_listener = dbus_bus_get_private(DBUS_BUS_SESSION, &err);
-
-       if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, TAG_VCW, "Dbus Connection Error (%s)", err.message);
-               dbus_error_free(&err);
-       }
-
-       if (NULL == g_w_conn_listener) {
-               SLOG(LOG_ERROR, TAG_VCW, "Fail to get dbus connection ");
-               __vc_widget_dbus_connection_free();
-               pthread_mutex_unlock(&g_w_dbus_mutex);
-               return VC_ERROR_OPERATION_FAILED;
-       }
-
-       dbus_connection_set_exit_on_disconnect(g_w_conn_listener, false);
-
-       int pid = getpid();
-
-       char service_name[64];
-       memset(service_name, '\0', 64);
-       snprintf(service_name, 64, "%s%d", VC_WIDGET_SERVICE_NAME, pid);
-
-       SLOG(LOG_DEBUG, TAG_VCW, "service name is %s", service_name);
-
-       /* register our name on the bus, and check for errors */
-       ret = dbus_bus_request_name(g_w_conn_listener, service_name, DBUS_NAME_FLAG_REPLACE_EXISTING , &err);
-
-       if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, TAG_VCW, "Name Error (%s)", err.message);
-               dbus_error_free(&err);
-       }
-
-       if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) {
-               SLOG(LOG_ERROR, TAG_VCW, "fail dbus_bus_request_name()");
-               __vc_widget_dbus_connection_free();
-               pthread_mutex_unlock(&g_w_dbus_mutex);
-               return -2;
-       }
-
-       if (NULL != g_w_fd_handler) {
-               SLOG(LOG_WARN, TAG_VCW, "The handler already exists.");
-               __vc_widget_dbus_connection_free();
-               pthread_mutex_unlock(&g_w_dbus_mutex);
-               return 0;
-       }
-
-       char rule[128] = {0, };
-       snprintf(rule, 128, "type='signal',interface='%s'", VC_WIDGET_SERVICE_INTERFACE);
-
-       /* add a rule for which messages we want to see */
-       dbus_bus_add_match(g_w_conn_listener, rule, &err);
-
-       if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, TAG_VCW, "Match Error (%s)", err.message);
-               dbus_error_free(&err);
-               __vc_widget_dbus_connection_free();
-               pthread_mutex_unlock(&g_w_dbus_mutex);
-               return VC_ERROR_OPERATION_FAILED;
-       }
-
-       int fd = 0;
-       if (1 != dbus_connection_get_unix_fd(g_w_conn_listener, &fd)) {
-               SLOG(LOG_ERROR, TAG_VCW, "fail to get fd from dbus ");
-               __vc_widget_dbus_connection_free();
-               pthread_mutex_unlock(&g_w_dbus_mutex);
-               return VC_ERROR_OPERATION_FAILED;
-       } else {
-               SLOG(LOG_DEBUG, TAG_VCW, "Get fd from dbus : %d", fd);
-       }
-
-       g_w_fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, (Ecore_Fd_Cb)widget_listener_event_callback, g_w_conn_listener, NULL, NULL);
-
-       if (NULL == g_w_fd_handler) {
-               SLOG(LOG_ERROR, TAG_VCW, "fail to get fd handler from ecore ");
-               __vc_widget_dbus_connection_free();
-               pthread_mutex_unlock(&g_w_dbus_mutex);
-               return VC_ERROR_OPERATION_FAILED;
-       }
-
-       g_is_connection_opened = true;
-
-       pthread_mutex_unlock(&g_w_dbus_mutex);
-
-       SLOG(LOG_INFO, TAG_VCW, "[INFO] widget dbus connection is opened");
-
-       return 0;
-}
-
-int vc_widget_dbus_close_connection()
-{
-       pthread_mutex_lock(&g_w_dbus_mutex);
-
-       DBusError err;
-       dbus_error_init(&err);
-
-       if (NULL != g_w_fd_handler) {
-               ecore_main_fd_handler_del(g_w_fd_handler);
-               g_w_fd_handler = NULL;
-       }
-
-       if (NULL != g_w_conn_listener) {
-               int pid = getpid();
-
-               char service_name[64];
-               memset(service_name, '\0', 64);
-               snprintf(service_name, 64, "%s%d", VC_WIDGET_SERVICE_NAME, pid);
-
-               dbus_bus_release_name(g_w_conn_listener, service_name, &err);
-
-               if (dbus_error_is_set(&err)) {
-                       SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Dbus Error (%s)", err.message);
-                       dbus_error_free(&err);
-               }
-       }
-
-       __vc_widget_dbus_connection_free();
-
-       g_is_connection_opened = false;
-
-       pthread_mutex_unlock(&g_w_dbus_mutex);
-
-       SLOG(LOG_INFO, TAG_VCW, "[INFO] widget dbus connection is closed");
-
-       return 0;
-}
-
-int vc_widget_dbus_reconnect()
-{
-       if (!g_w_conn_sender || !g_w_conn_listener) {
-               vc_widget_dbus_close_connection();
-
-               if (0 != vc_widget_dbus_open_connection()) {
-                       SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to reconnect");
-                       return -1;
-               }
-
-               SLOG(LOG_DEBUG, TAG_VCW, "[DBUS] Reconnect");
-               return 0;
-       }
-
-       bool sender_connected = dbus_connection_get_is_connected(g_w_conn_sender);
-       bool listener_connected = dbus_connection_get_is_connected(g_w_conn_listener);
-       SLOG(LOG_DEBUG, TAG_VCW, "[DBUS] Sender(%s) Listener(%s)",
-                sender_connected ? "Connected" : "Not connected", listener_connected ? "Connected" : "Not connected");
-
-       if (false == sender_connected || false == listener_connected) {
-               vc_widget_dbus_close_connection();
-
-               if (0 != vc_widget_dbus_open_connection()) {
-                       SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to reconnect");
-                       return -1;
-               }
-
-               SLOG(LOG_DEBUG, TAG_VCW, "[DBUS] Reconnect");
-       }
-
-       return 0;
-}
-
-static int __dbus_check()
-{
-       if (NULL == g_w_conn_sender || NULL == g_w_conn_listener) {
-               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] NULL connection");
-               return vc_widget_dbus_reconnect();
-       }
-       return 0;
-}
-
-int vc_widget_dbus_request_hello()
-{
-       if (0 != __dbus_check()) {
-               return VC_ERROR_OPERATION_FAILED;
-       }
-
-       DBusMessage* msg;
-
-       msg = dbus_message_new_method_call(
-                         VC_SERVER_SERVICE_NAME,
-                         VC_SERVER_SERVICE_OBJECT_PATH,
-                         VC_SERVER_SERVICE_INTERFACE,
-                         VC_METHOD_HELLO);
-
-       if (NULL == msg) {
-               SLOG(LOG_ERROR, TAG_VCW, "@@ Request vc hello : Fail to make message");
-               return VC_ERROR_OPERATION_FAILED;
-       }
-
-       DBusError err;
-       dbus_error_init(&err);
-
-       DBusMessage* result_msg = NULL;
-       int result = 0;
-
-       result_msg = dbus_connection_send_with_reply_and_block(g_w_conn_sender, msg, g_w_waiting_short_time, &err);
-
-       if (dbus_error_is_set(&err)) {
-               if (!strncmp(err.name, DBUS_ERROR_SERVICE_UNKNOWN, strlen(err.name)))
-                       usleep(500000);
-               dbus_error_free(&err);
-       }
-
-       dbus_message_unref(msg);
-
-       if (NULL != result_msg) {
-               dbus_message_unref(result_msg);
-               result = 0;
-       } else {
-               result = VC_ERROR_TIMED_OUT;
-       }
-
-       return result;
-}
-
-
-int vc_widget_dbus_request_initialize(int pid, int* service_state, int* daemon_pid)
-{
-       pthread_mutex_lock(&g_w_init_mutex);
-       if (0 != __dbus_check()) {
-               pthread_mutex_unlock(&g_w_init_mutex);
-               return VC_ERROR_OPERATION_FAILED;
-       }
-
-       DBusMessage* msg;
-
-       msg = dbus_message_new_method_call(
-                         VC_SERVER_SERVICE_NAME,
-                         VC_SERVER_SERVICE_OBJECT_PATH,
-                         VC_SERVER_SERVICE_INTERFACE,
-                         VC_WIDGET_METHOD_INITIALIZE);
-
-       if (NULL == msg) {
-               SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget initialize : Fail to make message ");
-               pthread_mutex_unlock(&g_w_init_mutex);
-               return VC_ERROR_OPERATION_FAILED;
-       } else {
-               SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget initialize : pid(%d)", pid);
-       }
-
-       dbus_message_append_args(msg,
-                                                        DBUS_TYPE_INT32, &pid,
-                                                        DBUS_TYPE_INVALID);
-
-       DBusError err;
-       dbus_error_init(&err);
-
-       DBusMessage* result_msg;
-       int result = VC_ERROR_OPERATION_FAILED;
-
-       result_msg = dbus_connection_send_with_reply_and_block(g_w_conn_sender, msg, g_w_waiting_time, &err);
-       dbus_message_unref(msg);
-
-       if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Dbus Error (%s)", err.message);
-               dbus_error_free(&err);
-       }
-
-       if (NULL != result_msg) {
-               int tmp_service_state = 0;
-               int tmp_daemon_pid = 0;
-               dbus_message_get_args(result_msg, &err,
-                       DBUS_TYPE_INT32, &result,
-                       DBUS_TYPE_INT32, &tmp_service_state,
-                       DBUS_TYPE_INT32, &tmp_daemon_pid,
-                       DBUS_TYPE_INVALID);
-
-               if (dbus_error_is_set(&err)) {
-                       SLOG(LOG_ERROR, TAG_VCW, "@@ Get arguments error (%s)", err.message);
-                       dbus_error_free(&err);
-                       result = VC_ERROR_OPERATION_FAILED;
-               }
-
-               dbus_message_unref(result_msg);
-
-               if (0 == result) {
-                       *service_state = tmp_service_state;
-                       *daemon_pid = tmp_daemon_pid;
-
-                       /* add a rule for daemon error */
-                       char rule_err[256] = {0, };
-                       snprintf(rule_err, 256, "sender='org.freedesktop.DBus',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',type='signal',arg0='%s'", VC_SERVER_SERVICE_INTERFACE);
-                       if (NULL == g_w_conn_listener) {
-                               if (g_is_connection_opened) {
-                                       SLOG(LOG_ERROR, TAG_VCW, "[ERROR] g_w_conn_listener is NULL abnormally");
-                                       pthread_mutex_unlock(&g_w_init_mutex);
-                                       return VC_ERROR_OPERATION_FAILED;
-                               } else {
-                                       SLOG(LOG_INFO, TAG_VCW, "[INFO] g_w_conn_listener is NULL and DBUS connection was closed");
-                                       pthread_mutex_unlock(&g_w_init_mutex);
-                                       return VC_ERROR_NONE;
-                               }
-                       }
-
-                       dbus_bus_add_match(g_w_conn_listener, rule_err, NULL);
-
-                       SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget initialize : result = %d service = %d daemon_pid = %d", result, *service_state, *daemon_pid);
-               } else {
-                       SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget initialize : result = %d", result);
-               }
-       } else {
-               SLOG(LOG_ERROR, TAG_VCW, "@@ Result message is NULL ");
-               vc_widget_dbus_reconnect();
-               result = VC_ERROR_TIMED_OUT;
-       }
-
-       pthread_mutex_unlock(&g_w_init_mutex);
-       return result;
-}
-
-int vc_widget_dbus_request_finalize(int pid)
-{
-       pthread_mutex_lock(&g_w_init_mutex);
-       if (0 != __dbus_check()) {
-               pthread_mutex_unlock(&g_w_init_mutex);
-               return VC_ERROR_OPERATION_FAILED;
-       }
-
-       if (NULL == g_w_conn_listener) {
-               if (g_is_connection_opened) {
-                       SLOG(LOG_ERROR, TAG_VCW, "[ERROR] g_w_conn_listener is NULL abnormally");
-                       pthread_mutex_unlock(&g_w_init_mutex);
-                       return VC_ERROR_OPERATION_FAILED;
-               } else {
-                       SLOG(LOG_INFO, TAG_VCW, "[INFO] g_w_conn_listener is NULL and DBUS connection was closed");
-                       pthread_mutex_unlock(&g_w_init_mutex);
-                       return VC_ERROR_NONE;
-               }
-       }
-
-       DBusError err;
-       dbus_error_init(&err);
-
-       /* remove a rule for daemon error */
-       char rule_err[256] = {0, };
-       snprintf(rule_err, 256, "sender='org.freedesktop.DBus',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',type='signal',arg0='%s'", VC_SERVER_SERVICE_INTERFACE);
-       dbus_bus_remove_match(g_w_conn_listener, rule_err, &err);
-       dbus_connection_flush(g_w_conn_listener);
-
-       if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, TAG_VCW, "Match Error (%s)", err.message);
-               dbus_error_free(&err);
-               pthread_mutex_unlock(&g_w_init_mutex);
-               return VC_ERROR_OPERATION_FAILED;
-       }
-
-       DBusMessage* msg;
-
-       msg = dbus_message_new_method_call(
-                         VC_SERVER_SERVICE_NAME,
-                         VC_SERVER_SERVICE_OBJECT_PATH,
-                         VC_SERVER_SERVICE_INTERFACE,
-                         VC_WIDGET_METHOD_FINALIZE);
-
-       if (NULL == msg) {
-               SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget finalize : Fail to make message ");
-               pthread_mutex_unlock(&g_w_init_mutex);
-               return VC_ERROR_OPERATION_FAILED;
-       } else {
-               SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget finalize : pid(%d)", pid);
-       }
-
-       dbus_message_append_args(msg, DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID);
-
-       DBusMessage* result_msg;
-       int result = VC_ERROR_OPERATION_FAILED;
-
-       result_msg = dbus_connection_send_with_reply_and_block(g_w_conn_sender, msg, g_w_waiting_time, &err);
-       dbus_message_unref(msg);
-
-       if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Dbus Error (%s)", err.message);
-               dbus_error_free(&err);
-       }
-
-       if (NULL != result_msg) {
-               dbus_message_get_args(result_msg, &err,
-                                                         DBUS_TYPE_INT32, &result,
-                                                         DBUS_TYPE_INVALID);
-
-               if (dbus_error_is_set(&err)) {
-                       SLOG(LOG_ERROR, TAG_VCW, "@@ Get arguments error (%s)", err.message);
-                       dbus_error_free(&err);
-                       result = VC_ERROR_OPERATION_FAILED;
-               }
-
-               dbus_message_unref(result_msg);
-
-               if (0 == result) {
-                       SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget finalize : result = %d", result);
-               } else {
-                       SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget finalize : result = %d", result);
-               }
-       } else {
-               SLOG(LOG_ERROR, TAG_VCW, "@@ Result message is NULL ");
-               vc_widget_dbus_reconnect();
-               result = VC_ERROR_TIMED_OUT;
-       }
-
-       pthread_mutex_unlock(&g_w_init_mutex);
-       return result;
-}
-
-int vc_widget_dbus_request_start_recording(int pid, bool command)
-{
-       if (0 != __dbus_check()) {
-               return VC_ERROR_OPERATION_FAILED;
-       }
-
-       DBusMessage* msg;
-
-       msg = dbus_message_new_method_call(
-                         VC_SERVER_SERVICE_NAME,
-                         VC_SERVER_SERVICE_OBJECT_PATH,
-                         VC_SERVER_SERVICE_INTERFACE,
-                         VC_WIDGET_METHOD_START_RECORDING);
-
-       if (NULL == msg) {
-               SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget start recording : Fail to make message");
-               return VC_ERROR_OPERATION_FAILED;
-       } else {
-               SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget start recording : pid(%d)", pid);
-       }
-
-       int temp = (int)command;
-
-       dbus_message_append_args(msg,
-                                                        DBUS_TYPE_INT32, &pid,
-                                                        DBUS_TYPE_INT32, &temp,
-                                                        DBUS_TYPE_INVALID);
-
-       DBusError err;
-       dbus_error_init(&err);
-
-       DBusMessage* result_msg;
-       int result = VC_ERROR_OPERATION_FAILED;
-
-       result_msg = dbus_connection_send_with_reply_and_block(g_w_conn_sender, msg, g_w_waiting_time, &err);
-       dbus_message_unref(msg);
-
-       if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Dbus Error (%s)", err.message);
-               dbus_error_free(&err);
-       }
-
-       if (NULL != result_msg) {
-               dbus_message_get_args(result_msg, &err, DBUS_TYPE_INT32, &result, DBUS_TYPE_INVALID);
-
-               if (dbus_error_is_set(&err)) {
-                       SLOG(LOG_ERROR, TAG_VCW, "@@ Get arguments error (%s)", err.message);
-                       dbus_error_free(&err);
-                       result = VC_ERROR_OPERATION_FAILED;
-               }
-               dbus_message_unref(result_msg);
-
-               if (0 == result) {
-                       SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget start recording : result = %d", result);
-               } else {
-                       SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget start recording : result = %d", result);
-               }
-       } else {
-               SLOG(LOG_ERROR, TAG_VCW, "@@ Result message is NULL");
-               vc_widget_dbus_reconnect();
-               result = VC_ERROR_TIMED_OUT;
-       }
-
-       return result;
-}
-
-int vc_widget_dbus_set_foreground(int pid, bool value)
-{
-       if (0 != __dbus_check()) {
-               return VC_ERROR_OPERATION_FAILED;
-       }
-
-       DBusMessage* msg = NULL;
-       int tmp_value = 0;
-
-       tmp_value = (int)value;
-
-       msg = dbus_message_new_signal(
-               VC_MANAGER_SERVICE_OBJECT_PATH,
-               VC_MANAGER_SERVICE_INTERFACE,
-               VCC_MANAGER_METHOD_SET_FOREGROUND);
-
-       if (NULL == msg) {
-               SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget set foreground to manager : Fail to make message");
-               return VC_ERROR_OPERATION_FAILED;
-       } else {
-               SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget set foreground to manager : client pid(%d), value(%s)", pid, tmp_value ? "true" : "false");
-       }
-
-       dbus_message_append_args(msg,
-               DBUS_TYPE_INT32, &pid,
-               DBUS_TYPE_INT32, &tmp_value,
-               DBUS_TYPE_INVALID);
-
-       if (1 != dbus_connection_send(g_w_conn_sender, msg, NULL)) {
-               SLOG(LOG_ERROR, TAG_VCW, "[Dbus ERROR] Fail to Send");
-               dbus_message_unref(msg);
-               return VC_ERROR_OPERATION_FAILED;
-       }
-
-       dbus_message_unref(msg);
-
-       msg = NULL;
-       msg = dbus_message_new_method_call(
-               VC_SERVER_SERVICE_NAME,
-               VC_SERVER_SERVICE_OBJECT_PATH,
-               VC_SERVER_SERVICE_INTERFACE,
-               VC_METHOD_SET_FOREGROUND);
-
-       if (NULL == msg) {
-               SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget set foreground to daemon : Fail to make message");
-               return VC_ERROR_OPERATION_FAILED;
-       } else {
-               SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget set foreground to daemon : client pid(%d), value(%s)", pid, tmp_value ? "true" : "false");
-       }
-
-       dbus_message_append_args(msg,
-               DBUS_TYPE_INT32, &pid,
-               DBUS_TYPE_INT32, &tmp_value,
-               DBUS_TYPE_INVALID);
-
-       dbus_message_set_no_reply(msg, TRUE);
-
-       /* send the message and flush the connection */
-       if (1 != dbus_connection_send(g_w_conn_sender, msg, NULL)) {
-               SLOG(LOG_ERROR, TAG_VCW, "[Dbus ERROR] Fail to Send");
-               dbus_message_unref(msg);
-               return VC_ERROR_OPERATION_FAILED;
-       } else {
-               SLOG(LOG_INFO, TAG_VCW, "[Dbus] SUCCESS Send");
-               dbus_connection_flush(g_w_conn_sender);
-       }
-
-       dbus_message_unref(msg);
-
-       return 0;
-}
-
-int vc_widget_dbus_request_enable_asr_result(int pid, bool enable)
-{
-       if (0 != __dbus_check()) {
-               return VC_ERROR_OPERATION_FAILED;
-       }
-
-       DBusMessage* msg;
-
-       /* create a signal & check for errors */
-       msg = dbus_message_new_method_call(
-                         VC_SERVER_SERVICE_NAME,
-                         VC_SERVER_SERVICE_OBJECT_PATH,
-                         VC_SERVER_SERVICE_INTERFACE,
-                         VC_WIDGET_METHOD_ENABLE_ASR_RESULT);
-
-       if (NULL == msg) {
-               SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget enable asr result : Fail to make message ");
-               return VC_ERROR_OPERATION_FAILED;
-       } else {
-               SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget enable asr result : pid(%d), enable(%d)", pid, enable);
-       }
-
-       DBusMessageIter args;
-       dbus_message_iter_init_append(msg, &args);
-
-       /* Append result*/
-       int temp;
-       if (false == enable)    temp = 0;
-       else                    temp = 1;
-       dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(pid));
-       dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(temp));
-
-       DBusError err;
-       dbus_error_init(&err);
-
-       DBusMessage* result_msg;
-       int result = VC_ERROR_OPERATION_FAILED;
-
-       result_msg = dbus_connection_send_with_reply_and_block(g_w_conn_sender, msg, g_w_waiting_time, &err);
-       dbus_message_unref(msg);
-
-       if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Dbus Error (%s)", err.message);
-               dbus_error_free(&err);
-       }
-
-       if (NULL != result_msg) {
-               dbus_message_get_args(result_msg, &err,
-                                                         DBUS_TYPE_INT32, &result,
-                                                         DBUS_TYPE_INVALID);
-
-               if (dbus_error_is_set(&err)) {
-                       SLOG(LOG_ERROR, TAG_VCW, "@@ Get arguments error (%s)", err.message);
-                       dbus_error_free(&err);
-                       result = VC_ERROR_OPERATION_FAILED;
-               }
-               dbus_message_unref(result_msg);
-
-               if (0 == result) {
-                       SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget enable asr result : result = %d", result);
-               } else {
-                       SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget enable asr result : result = %d", result);
-               }
-       } else {
-               SLOG(LOG_DEBUG, TAG_VCW, "@@ Result Message is NULL");
-               vc_widget_dbus_reconnect();
-               result = VC_ERROR_TIMED_OUT;
-       }
-
-       return result;
-}
-
-int vc_widget_dbus_request_start(int pid, int silence)
-{
-       if (0 != __dbus_check()) {
-               return VC_ERROR_OPERATION_FAILED;
-       }
-
-       DBusMessage* msg;
-
-       /* create a signal & check for errors */
-       msg = dbus_message_new_method_call(
-                         VC_SERVER_SERVICE_NAME,
-                         VC_SERVER_SERVICE_OBJECT_PATH,
-                         VC_SERVER_SERVICE_INTERFACE,
-                         VC_WIDGET_METHOD_START);
-
-       if (NULL == msg) {
-               SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget start : Fail to make message ");
-               return VC_ERROR_OPERATION_FAILED;
-       } else {
-               SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget start : pid(%d), silence(%d)", pid, silence);
-       }
-
-       DBusMessageIter args;
-       dbus_message_iter_init_append(msg, &args);
-
-       /* Append result*/
-       dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(pid));
-       dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(silence));
-
-       DBusError err;
-       dbus_error_init(&err);
-
-       DBusMessage* result_msg;
-       int result = VC_ERROR_OPERATION_FAILED;
-
-       result_msg = dbus_connection_send_with_reply_and_block(g_w_conn_sender, msg, g_w_waiting_time, &err);
-       dbus_message_unref(msg);
-
-       if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Dbus Error (%s)", err.message);
-               dbus_error_free(&err);
-       }
-
-       if (NULL != result_msg) {
-               dbus_message_get_args(result_msg, &err,
-                                                         DBUS_TYPE_INT32, &result,
-                                                         DBUS_TYPE_INVALID);
-
-               if (dbus_error_is_set(&err)) {
-                       SLOG(LOG_ERROR, TAG_VCW, "@@ Get arguments error (%s)", err.message);
-                       dbus_error_free(&err);
-                       result = VC_ERROR_OPERATION_FAILED;
-               }
-               dbus_message_unref(result_msg);
-
-               if (0 == result) {
-                       SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget start : result = %d", result);
-               } else {
-                       SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget start : result = %d", result);
-               }
-       } else {
-               SLOG(LOG_DEBUG, TAG_VCW, "@@ Result Message is NULL");
-               vc_widget_dbus_reconnect();
-               result = VC_ERROR_TIMED_OUT;
-       }
-
-       return result;
-}
-
-int vc_widget_dbus_request_stop(int pid)
-{
-       if (0 != __dbus_check()) {
-               return VC_ERROR_OPERATION_FAILED;
-       }
-
-       DBusMessage* msg;
-
-       /* create a signal & check for errors */
-       msg = dbus_message_new_method_call(
-                         VC_SERVER_SERVICE_NAME,
-                         VC_SERVER_SERVICE_OBJECT_PATH,
-                         VC_SERVER_SERVICE_INTERFACE,
-                         VC_WIDGET_METHOD_STOP);
-
-       if (NULL == msg) {
-               SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget stop : Fail to make message ");
-               return VC_ERROR_OPERATION_FAILED;
-       } else {
-               SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget stop : pid(%d)", pid);
-       }
-
-       dbus_message_append_args(msg,
-                                                        DBUS_TYPE_INT32, &pid,
-                                                        DBUS_TYPE_INVALID);
-
-       DBusError err;
-       dbus_error_init(&err);
-
-       DBusMessage* result_msg;
-       int result = VC_ERROR_OPERATION_FAILED;
-
-       result_msg = dbus_connection_send_with_reply_and_block(g_w_conn_sender, msg, g_w_waiting_time, &err);
-       dbus_message_unref(msg);
-
-       if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Dbus Error (%s)", err.message);
-               dbus_error_free(&err);
-       }
-
-       if (NULL != result_msg) {
-               dbus_message_get_args(result_msg, &err,
-                                                         DBUS_TYPE_INT32, &result,
-                                                         DBUS_TYPE_INVALID);
-
-               if (dbus_error_is_set(&err)) {
-                       SLOG(LOG_ERROR, TAG_VCW, "@@ Get arguments error (%s)", err.message);
-                       dbus_error_free(&err);
-                       result = VC_ERROR_OPERATION_FAILED;
-               }
-               dbus_message_unref(result_msg);
-
-               if (0 == result) {
-                       SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget stop : result = %d", result);
-               } else {
-                       SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget stop : result = %d", result);
-               }
-       } else {
-               SLOG(LOG_DEBUG, TAG_VCW, "@@ Result Message is NULL");
-               vc_widget_dbus_reconnect();
-               result = VC_ERROR_TIMED_OUT;
-       }
-
-       return result;
-}
-
-int vc_widget_dbus_request_cancel(int pid)
-{
-       if (0 != __dbus_check()) {
-               return VC_ERROR_OPERATION_FAILED;
-       }
-
-       DBusMessage* msg;
-
-       /* create a signal & check for errors */
-       msg = dbus_message_new_method_call(
-                         VC_SERVER_SERVICE_NAME,
-                         VC_SERVER_SERVICE_OBJECT_PATH,        /* object name of the signal */
-                         VC_SERVER_SERVICE_INTERFACE,  /* interface name of the signal */
-                         VC_WIDGET_METHOD_CANCEL);     /* name of the signal */
-
-       if (NULL == msg) {
-               SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget cancel : Fail to make message ");
-               return VC_ERROR_OPERATION_FAILED;
-       } else {
-               SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget cancel : pid(%d)", pid);
-       }
-
-       dbus_message_append_args(msg,
-                                                        DBUS_TYPE_INT32, &pid,
-                                                        DBUS_TYPE_INVALID);
-
-       DBusError err;
-       dbus_error_init(&err);
-
-       DBusMessage* result_msg;
-       int result = VC_ERROR_OPERATION_FAILED;
-
-       result_msg = dbus_connection_send_with_reply_and_block(g_w_conn_sender, msg, g_w_waiting_time, &err);
-       dbus_message_unref(msg);
-
-       if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Dbus Error (%s)", err.message);
-               dbus_error_free(&err);
-       }
-
-       if (NULL != result_msg) {
-               dbus_message_get_args(result_msg, &err,
-                                                         DBUS_TYPE_INT32, &result,
-                                                         DBUS_TYPE_INVALID);
-
-               if (dbus_error_is_set(&err)) {
-                       SLOG(LOG_ERROR, TAG_VCW, "@@ Get arguments error (%s)", err.message);
-                       dbus_error_free(&err);
-                       result = VC_ERROR_OPERATION_FAILED;
-               }
-               dbus_message_unref(result_msg);
-
-               if (0 == result) {
-                       SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget cancel : result = %d", result);
-               } else {
-                       SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget cancel : result = %d", result);
-               }
-       } else {
-               SLOG(LOG_DEBUG, TAG_VCW, "@@ Result Message is NULL");
-               vc_widget_dbus_reconnect();
-               result = VC_ERROR_TIMED_OUT;
-       }
-
-       return result;
-}
diff --git a/client/vc_widget_dbus.h b/client/vc_widget_dbus.h
deleted file mode 100644 (file)
index 01fba7a..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-* Copyright (c) 2011-2015 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 __VC_WIDGET_DBUS_H_
-#define __VC_WIDGET_DBUS_H_
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int vc_widget_dbus_open_connection();
-
-int vc_widget_dbus_close_connection();
-
-
-int vc_widget_dbus_request_hello();
-
-int vc_widget_dbus_request_initialize(int pid, int* service_state, int* daemon_pid);
-
-int vc_widget_dbus_request_finalize(int pid);
-
-int vc_widget_dbus_request_start_recording(int pid, bool command);
-
-int vc_widget_dbus_set_foreground(int pid, bool value);
-
-int vc_widget_dbus_request_enable_asr_result(int pid, bool enable);
-
-int vc_widget_dbus_request_start(int pid, int silence);
-
-int vc_widget_dbus_request_stop(int pid);
-
-int vc_widget_dbus_request_cancel(int pid);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __VC_WIDGET_DBUS_H_ */
diff --git a/client/vc_widget_tidl.c b/client/vc_widget_tidl.c
new file mode 100644 (file)
index 0000000..3002bf5
--- /dev/null
@@ -0,0 +1,621 @@
+/*
+* Copyright (c) 2022 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.
+*/
+
+#include <pthread.h>
+#include <rpc-port.h>
+
+#include "vc_main.h"
+#include "vc_widget_client.h"
+#include "vc_widget_tidl.h"
+#include "vc_widget_proxy.h"
+#include "vc_widget_stub.h"
+
+typedef struct {
+       bool connected;
+       bool connection_requesting;
+       bool register_callback_invoked;
+       rpc_port_proxy_vc_widget_h rpc_h;
+       rpc_port_proxy_vc_widget_notify_cb_h notify_cb_h;
+} vc_widget_tidl_info_s;
+
+typedef struct {
+       bool connected;
+       bool register_callback_requesting;
+} vcd_widget_tidl_info_s;
+
+static vc_widget_tidl_info_s* g_proxy_tidl_info = NULL;
+
+static vcd_widget_tidl_info_s* g_stub_tidl_info = NULL;
+
+static pthread_mutex_t g_w_tidl_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t g_w_init_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+static rpc_port_stub_vcd_widget_callback_s g_widget_callback;
+
+extern int __vc_widget_cb_error(int reason, int daemon_pid, char* msg);
+
+extern void __vc_widget_cb_show_tooltip(int pid, bool show);
+
+extern void __vc_widget_cb_result();
+
+extern bool __vc_widget_cb_asr_result(int event, const char* asr_result);
+
+extern int __vc_widget_cb_service_state(int state);
+
+static void __notify_cb(void *user_data, bundle *msg)
+{
+       char* method = NULL;
+       char* val = NULL;
+       SLOG(LOG_DEBUG, TAG_VCW, "__notify_cb is invoked");
+
+       bundle_get_str(msg, VC_WIDGET_BUNDLE_METHOD, &method);
+
+       if (0 == strncmp(VCD_WIDGET_METHOD_HELLO, method, strlen(VCD_WIDGET_METHOD_HELLO))) {
+               SLOG(LOG_INFO, TAG_VCW, "@@@ Get widget hello");
+               bundle_get_str(msg, VC_WIDGET_BUNDLE_MESSAGE, &val);
+               if (val) {
+                       SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget get hello : pid(%d) ", atoi(val));
+               } else {
+                       SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget get hello : invalid pid ");
+               }
+               SLOG(LOG_DEBUG, TAG_VCW, "@@@");
+       } /* VCD_METHOD_HELLO */
+
+       else if (0 == strncmp(VCD_WIDGET_METHOD_SET_SERVICE_STATE, method, strlen(VCD_WIDGET_METHOD_SET_SERVICE_STATE))) {
+               bundle_get_str(msg, VC_WIDGET_BUNDLE_MESSAGE, &val);
+               int state = 0;
+               if (val) {
+                       state = atoi(val);
+                       SLOG(LOG_INFO, TAG_VCW, "@@ service state changed : %d", state);
+                       __vc_widget_cb_service_state(state);
+               }
+       } /* VCD_WIDGET_METHOD_SET_SERVICE_STATE */
+
+       else if (0 == strncmp(VCD_WIDGET_METHOD_SHOW_TOOLTIP, method, strlen(VCD_WIDGET_METHOD_SHOW_TOOLTIP))) {
+               SLOG(LOG_DEBUG, TAG_VCW, "@@@ Show / Hide tooltip");
+               char* temp_show = NULL;
+               bundle_get_str(msg, VC_WIDGET_BUNDLE_MESSAGE, &val);
+               bundle_get_str(msg, VC_WIDGET_BUNDLE_SHOW, &temp_show);
+               int pid = 0;
+               int show = 0;
+
+               if (val) {
+                       pid = atoi(val);
+               }
+               if (temp_show) {
+                       show = atoi(temp_show);
+               }
+
+               if(pid > 0){
+                       SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget show tooltip : pid(%d), show(%d)", pid, show);
+                       __vc_widget_cb_show_tooltip(pid, (bool)show);
+               } else {
+                       SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget show tooltip : invalid pid");
+               }
+               SLOG(LOG_DEBUG, TAG_VCW, "@@@");
+       } /* VCD_WIDGET_METHOD_SHOW_TOOLTIP */
+
+       else if (0 == strncmp(VCD_WIDGET_METHOD_RESULT, method, strlen(VCD_WIDGET_METHOD_RESULT))) {
+               SLOG(LOG_DEBUG, TAG_VCW, "@@@ Get widget result");
+
+               __vc_widget_cb_result();
+
+               SLOG(LOG_DEBUG, TAG_VCW, "@@@");
+       } /* VCD_WIDGET_METHOD_RESULT */
+
+       else if (0 == strncmp(VCD_WIDGET_METHOD_ERROR, method, strlen(VCD_WIDGET_METHOD_ERROR))) {
+               SLOG(LOG_INFO, TAG_VCW, "@@@ Get Pre Result");
+               char* temp_reason = NULL;
+               char* temp_daemon_pid = NULL;
+               char* err_msg = NULL;
+
+               bundle_get_str(msg, VC_WIDGET_BUNDLE_REASON, &temp_reason);
+               bundle_get_str(msg, VC_WIDGET_BUNDLE_DAEMON_PID, &temp_daemon_pid);
+               bundle_get_str(msg, VC_WIDGET_BUNDLE_ERROR_MESSAGE, &err_msg);
+               int reason = 0;
+               int daemon_pid = 0;
+
+               if (NULL != temp_reason) {
+                       reason = atoi(temp_reason);
+               }
+               if (NULL != temp_daemon_pid) {
+                       daemon_pid = atoi(temp_daemon_pid);
+               }
+
+               SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget get error message : reason(%d), daemon_pid(%d), msg(%s)", reason, daemon_pid, err_msg);
+               __vc_widget_cb_error(reason, daemon_pid, err_msg);
+
+               SLOG(LOG_DEBUG, TAG_VCW, "@@@");
+       } /* VCD_WIDGET_METHOD_ERROR */
+
+       else {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Invalid msg");
+       }
+}
+
+static void __on_connected(rpc_port_proxy_vc_widget_h h, void *user_data)
+{
+       g_proxy_tidl_info->connected = true;
+       g_proxy_tidl_info->connection_requesting = false;
+       g_proxy_tidl_info->register_callback_invoked = false;
+
+       SLOG(LOG_INFO, TAG_VCW, "Connected to server");
+}
+
+static void __on_disconnected(rpc_port_proxy_vc_widget_h h, void *user_data)
+{
+       g_proxy_tidl_info->connected = false;
+       g_proxy_tidl_info->connection_requesting = false;
+       g_proxy_tidl_info->register_callback_invoked = false;
+
+       SLOG(LOG_INFO, TAG_VCW, "Disonnected to server");
+}
+
+static void __on_rejected(rpc_port_proxy_vc_widget_h h, void *user_data)
+{
+       g_proxy_tidl_info->connection_requesting = false;
+       g_proxy_tidl_info->register_callback_invoked = false;
+
+       SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Rejected from server");
+}
+
+
+static rpc_port_proxy_vc_widget_h __create_rpc_port(const char* engine_app_id)
+{
+       SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] __create_rpc_port");
+       rpc_port_proxy_vc_widget_callback_s rpc_callback = {
+               .connected = __on_connected,
+               .disconnected = __on_disconnected,
+               .rejected = __on_rejected
+       };
+
+       rpc_port_proxy_vc_widget_h handle = NULL;
+       if (0 != rpc_port_proxy_vc_widget_create(engine_app_id, &rpc_callback, NULL, &handle)) {
+               SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Fail to create proxy");
+               return NULL;
+       }
+
+       return handle;
+}
+
+static void __vcd_widget_create_cb(rpc_port_stub_vcd_widget_context_h context, void *user_data)
+{
+       g_stub_tidl_info->connected = true;
+       g_stub_tidl_info->register_callback_requesting = false;
+
+       SLOG(LOG_DEBUG, TAG_VCW, "Connected to server");
+
+       char *sender = NULL;
+
+       rpc_port_stub_vcd_widget_context_get_sender(context, &sender);
+       if (!sender) {
+               SLOG(LOG_ERROR, TAG_VCW, "@@@ Sender is NULL");
+               return;
+       }
+
+       SLOG(LOG_DEBUG, TAG_VCW, "@@@ Server connect. appid(%s)", sender);
+       free(sender);
+}
+
+static void __vcd_widget_terminate_cb(rpc_port_stub_vcd_widget_context_h context, void *user_data)
+{
+       g_stub_tidl_info->connected = false;
+       g_stub_tidl_info->register_callback_requesting = false;
+
+       rpc_port_stub_vcd_widget_context_set_tag(context, NULL);
+
+       char *sender = NULL;
+       rpc_port_stub_vcd_widget_context_get_sender(context, &sender);
+       if (!sender)
+               return;
+
+       SLOG(LOG_INFO, TAG_VCW, "@@@ Server disconnect. appid(%s)", sender);
+       free(sender);
+}
+
+static int __vcd_widget_asr_result_cb(rpc_port_stub_vcd_widget_context_h context, int pid, int event, const char *asr_result, bool *is_consumed, void *user_data)
+{
+       SLOG(LOG_DEBUG, TAG_VCW, "@@@ Get widget asr result");
+
+       bool result = false;
+       result = __vc_widget_cb_asr_result(event, asr_result);
+       *is_consumed = result;
+
+       return VC_ERROR_NONE;
+}
+
+static void __register_stub_callback()
+{
+       if (g_stub_tidl_info->register_callback_requesting) {
+               return;
+       }
+
+       SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] __register_stub_callback");
+
+       g_widget_callback.create = __vcd_widget_create_cb;
+       g_widget_callback.terminate = __vcd_widget_terminate_cb;
+       g_widget_callback.send_asr_result = __vcd_widget_asr_result_cb;
+
+       int ret = -1;
+       ret = rpc_port_stub_vcd_widget_register(&g_widget_callback, NULL);
+       if (0 == ret) {
+               SLOG(LOG_DEBUG, TAG_VCW, "register callback");
+               g_stub_tidl_info->register_callback_requesting = true;
+               return;
+       }
+
+       SLOG(LOG_ERROR, TAG_VCW, "Fail to rister callback(%d)", ret);
+       return;
+}
+
+int vc_widget_tidl_open_connection()
+{
+       SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_open_connection");
+       pthread_mutex_lock(&g_w_tidl_mutex);
+
+       if (NULL != g_proxy_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] g_proxy_tidl_info already created");
+               pthread_mutex_unlock(&g_w_tidl_mutex);
+               return VC_ERROR_NONE;
+       }
+
+       g_proxy_tidl_info = (vc_widget_tidl_info_s*)calloc(1, sizeof(vc_widget_tidl_info_s));
+
+       if (NULL == g_proxy_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Fail to create vc_widget_tidl_info_s");
+               pthread_mutex_unlock(&g_w_tidl_mutex);
+               return VC_ERROR_OUT_OF_MEMORY;
+       }
+
+       char* engine_app_id = vconf_get_str(VC_ENGINE_DB_DEFAULT);
+       if (NULL == engine_app_id) {
+               SLOG(LOG_ERROR, TAG_VCW, "[TIDL] vconf not found");
+               free(g_proxy_tidl_info);
+               g_proxy_tidl_info = NULL;
+               pthread_mutex_unlock(&g_w_tidl_mutex);
+               return VC_ERROR_ENGINE_NOT_FOUND;
+       }
+
+       g_proxy_tidl_info->rpc_h = __create_rpc_port(engine_app_id);
+       if (NULL == g_proxy_tidl_info->rpc_h) {
+               SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Fail to create proxy");
+               free(engine_app_id);
+               free(g_proxy_tidl_info);
+               g_proxy_tidl_info = NULL;
+               pthread_mutex_unlock(&g_w_tidl_mutex);
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       SLOG(LOG_INFO, TAG_VCW, "[TIDL] rpc_h(%p), engine_app_id(%s)", g_proxy_tidl_info->rpc_h, engine_app_id);
+       free(engine_app_id);
+
+       g_stub_tidl_info = (vcd_widget_tidl_info_s*)calloc(1, sizeof(vcd_widget_tidl_info_s));
+
+       if (NULL == g_stub_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Fail to create vcd_widget_tidl_info_s");
+               pthread_mutex_unlock(&g_w_tidl_mutex);
+               return VC_ERROR_OUT_OF_MEMORY;
+       }
+
+       __register_stub_callback();
+
+       pthread_mutex_unlock(&g_w_tidl_mutex);
+
+       return VC_ERROR_NONE;
+}
+
+int vc_widget_tidl_close_connection()
+{
+       SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_close_connection");
+       pthread_mutex_lock(&g_w_tidl_mutex);
+
+       if (NULL == g_proxy_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
+               pthread_mutex_unlock(&g_w_tidl_mutex);
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (0 != rpc_port_proxy_vc_widget_destroy(g_proxy_tidl_info->rpc_h)) {
+               SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Fail to destroy tidl handle");
+               pthread_mutex_unlock(&g_w_tidl_mutex);
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       g_proxy_tidl_info->rpc_h = NULL;
+       g_proxy_tidl_info->notify_cb_h = NULL;
+
+       free(g_proxy_tidl_info);
+       g_proxy_tidl_info = NULL;
+
+       free(g_stub_tidl_info);
+       g_stub_tidl_info = NULL;
+
+       pthread_mutex_unlock(&g_w_tidl_mutex);
+
+       return VC_ERROR_NONE;
+}
+
+static void __request_tidl_connect()
+{
+       if (g_proxy_tidl_info->connection_requesting) {
+               return;
+       }
+
+       int ret = rpc_port_proxy_vc_widget_connect(g_proxy_tidl_info->rpc_h);
+       SLOG(LOG_INFO, TAG_VCW, "[INFO] Request connection to stub. ret(%d)", ret);
+
+       if (0 == ret) {
+               g_proxy_tidl_info->connection_requesting = true;
+       }
+}
+
+static int __create_callback_handles()
+{
+       if (NULL != g_proxy_tidl_info->notify_cb_h) {
+               rpc_port_proxy_vc_widget_notify_cb_dispose(g_proxy_tidl_info->rpc_h, g_proxy_tidl_info->notify_cb_h);
+               g_proxy_tidl_info->notify_cb_h = NULL;
+       }
+
+       if (RPC_PORT_ERROR_NONE != rpc_port_proxy_vc_widget_notify_cb_create(&g_proxy_tidl_info->notify_cb_h)) {
+               return VC_ERROR_OUT_OF_MEMORY;
+       }
+
+       rpc_port_proxy_vc_widget_notify_cb_set_callback(g_proxy_tidl_info->notify_cb_h, __notify_cb, NULL);
+
+       rpc_port_proxy_vc_widget_notify_cb_set_once(g_proxy_tidl_info->notify_cb_h, false);
+
+       return VC_ERROR_NONE;
+}
+
+static int __invoke_register_callback()
+{
+       if (g_proxy_tidl_info->register_callback_invoked) {
+               SLOG(LOG_ERROR, TAG_VCW, "[INFO] Already register callback is invoked");
+               return VC_ERROR_NONE;
+       }
+
+       int ret = __create_callback_handles(g_proxy_tidl_info);
+       if (VC_ERROR_NONE != ret) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to create callback handle. ret(%d)", ret);
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       rpc_port_proxy_vc_widget_invoke_register_cb(g_proxy_tidl_info->rpc_h, getpid(), g_proxy_tidl_info->notify_cb_h);
+       g_proxy_tidl_info->register_callback_invoked = true;
+       return VC_ERROR_NONE;
+}
+
+int vc_widget_tidl_request_hello()
+{
+       SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_hello");
+
+       if (NULL == g_proxy_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get proxy tidl info");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (!g_proxy_tidl_info->connected) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Proxy Not Connected");
+               __request_tidl_connect();
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (VC_ERROR_NONE != __invoke_register_callback()) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to invoke register callback");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (NULL == g_stub_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get stub tidl info");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (!g_stub_tidl_info->connected) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Stub Not Connected");
+               __register_stub_callback();
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       SLOG(LOG_DEBUG, TAG_VCW, ">>>>> VCW Hello");
+
+       SLOG(LOG_DEBUG, TAG_VCW, "<<<<");
+
+       return VC_ERROR_NONE;
+}
+
+int vc_widget_tidl_request_initialize(int pid, int* service_state, int* daemon_pid)
+{
+       pthread_mutex_lock(&g_w_init_mutex);
+       SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_initialize");
+
+       if (NULL == g_proxy_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
+               pthread_mutex_unlock(&g_w_init_mutex);
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       int temp_service_state = 0;
+       int temp_daemon_pid = 0;
+       if (0 != rpc_port_proxy_vc_widget_invoke_initialize(g_proxy_tidl_info->rpc_h, pid, &temp_service_state, &temp_daemon_pid)) {
+               SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget initialize : Fail to invoke message");
+               pthread_mutex_unlock(&g_w_init_mutex);
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       *service_state = temp_service_state;
+       *daemon_pid = temp_daemon_pid;
+
+       pthread_mutex_unlock(&g_w_init_mutex);
+       SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc widget initialize: service_state(%d), daemon_pid(%d)", *service_state, *daemon_pid);
+
+       return VC_ERROR_NONE;
+}
+
+int vc_widget_tidl_request_finalize(int pid)
+{
+       pthread_mutex_lock(&g_w_init_mutex);
+       SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_finalize");
+
+       if (NULL == g_proxy_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
+               pthread_mutex_unlock(&g_w_init_mutex);
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (!g_proxy_tidl_info->connected) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
+               pthread_mutex_unlock(&g_w_init_mutex);
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (0 != rpc_port_proxy_vc_widget_invoke_finalize(g_proxy_tidl_info->rpc_h, pid)) {
+               SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget finalize : Fail to invoke message");
+               pthread_mutex_unlock(&g_w_init_mutex);
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       pthread_mutex_unlock(&g_w_init_mutex);
+       return VC_ERROR_NONE;
+}
+
+int vc_widget_tidl_request_start_recording(int pid, bool command)
+{
+       SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_start_recording");
+
+       if (NULL == g_proxy_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (!g_proxy_tidl_info->connected) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (0 != rpc_port_proxy_vc_widget_invoke_start_recording(g_proxy_tidl_info->rpc_h, pid, (int)command)) {
+               SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget start recording : Fail to invoke message");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       return VC_ERROR_NONE;
+}
+
+int vc_widget_tidl_set_foreground(int pid, bool value)
+{
+       SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_set_foreground");
+
+       if (NULL == g_proxy_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (!g_proxy_tidl_info->connected) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       rpc_port_proxy_vc_widget_invoke_set_foreground(g_proxy_tidl_info->rpc_h, pid, (int)value);
+
+       return VC_ERROR_NONE;
+}
+
+int vc_widget_tidl_request_enable_asr_result(int pid, bool enable)
+{
+       SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_enable_asr_result");
+
+       if (NULL == g_proxy_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (!g_proxy_tidl_info->connected) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (0 != rpc_port_proxy_vc_widget_invoke_enable_asr_result(g_proxy_tidl_info->rpc_h, pid, (int)enable)) {
+               SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget enable asr result : Fail to invoke message");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       return VC_ERROR_NONE;
+}
+
+int vc_widget_tidl_request_start(int pid, int silence)
+{
+       SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_start");
+
+       if (NULL == g_proxy_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (!g_proxy_tidl_info->connected) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (0 != rpc_port_proxy_vc_widget_invoke_start(g_proxy_tidl_info->rpc_h, pid, silence)) {
+               SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget start : Fail to invoke message");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       return VC_ERROR_NONE;
+}
+
+int vc_widget_tidl_request_stop(int pid)
+{
+       SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_stop");
+
+       if (NULL == g_proxy_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (!g_proxy_tidl_info->connected) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (0 != rpc_port_proxy_vc_widget_invoke_stop(g_proxy_tidl_info->rpc_h, pid)) {
+               SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget stop : Fail to invoke message");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       return VC_ERROR_NONE;
+}
+
+int vc_widget_tidl_request_cancel(int pid)
+{
+       SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_cancel");
+
+       if (NULL == g_proxy_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (!g_proxy_tidl_info->connected) {
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (0 != rpc_port_proxy_vc_widget_invoke_cancel(g_proxy_tidl_info->rpc_h, pid)) {
+               SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget cancel : Fail to invoke message");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       return VC_ERROR_NONE;
+}
diff --git a/client/vc_widget_tidl.h b/client/vc_widget_tidl.h
new file mode 100644 (file)
index 0000000..7b00320
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2022 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 __VC_WIDGET_TIDL_H_
+#define __VC_WIDGET_TIDL_H_
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int vc_widget_tidl_open_connection();
+
+int vc_widget_tidl_close_connection();
+
+
+int vc_widget_tidl_request_hello();
+
+int vc_widget_tidl_request_initialize(int pid, int* service_state, int* daemon_pid);
+
+int vc_widget_tidl_request_finalize(int pid);
+
+int vc_widget_tidl_request_start_recording(int pid, bool command);
+
+int vc_widget_tidl_set_foreground(int pid, bool value);
+
+int vc_widget_tidl_request_enable_asr_result(int pid, bool enable);
+
+int vc_widget_tidl_request_start(int pid, int silence);
+
+int vc_widget_tidl_request_stop(int pid);
+
+int vc_widget_tidl_request_cancel(int pid);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __VC_WIDGET_TIDL_H_ */
\ No newline at end of file
index 0f906d6..3ba15c5 100644 (file)
@@ -130,6 +130,14 @@ extern "C" {
 #define VCD_WIDGET_METHOD_SHOW_TOOLTIP         "vcd_widget_method_show_tooltip"
 #define VCD_WIDGET_METHOD_SET_SERVICE_STATE    "vcd_widget_method_set_service_state"
 
+#define VC_WIDGET_BUNDLE_METHOD "vc_widget_bundle_method"
+#define VC_WIDGET_BUNDLE_MESSAGE "vc_widget_bundle_message"
+#define VC_WIDGET_BUNDLE_SERVICE_STATE "vc_widget_bundle_service_state"
+#define VC_WIDGET_BUNDLE_DAEMON_PID "vc_widget_bundle_daemon_pid"
+#define VC_WIDGET_BUNDLE_SHOW "vc_widget_bundle_show"
+#define VC_WIDGET_BUNDLE_REASON "vc_widget_bundle_reason"
+#define VC_WIDGET_BUNDLE_ERROR_MESSAGE "vc_widget_bundle_error_message"
+
 
 /******************************************************************************************
 * Message Definitions for manager
index d776104..63b9aa4 100644 (file)
@@ -119,6 +119,11 @@ tidlc -s -l C -i tidl/vc_mgr.tidl -o vcd_mgr_stub
 tidlc -s -l C -i tidl/vcd_mgr.tidl -o vc_mgr_stub
 tidlc -p -l C -i tidl/vcd_mgr.tidl -o vcd_mgr_proxy
 
+tidlc -p -l C -i tidl/vc_widget.tidl -o vc_widget_proxy
+tidlc -s -l C -i tidl/vc_widget.tidl -o vcd_widget_stub
+tidlc -s -l C -i tidl/vcd_widget.tidl -o vc_widget_stub
+tidlc -p -l C -i tidl/vcd_widget.tidl -o vcd_widget_proxy
+
 mv vc_* client
 mv vcd_* server
 
index c557c71..5fe0268 100644 (file)
@@ -14,6 +14,8 @@ SET(SRCS
        vcd_tidl.c
        vcd_mgr_stub.c
        vcd_mgr_proxy.c
+       vcd_widget_stub.c
+       vcd_widget_proxy.c
        vcd_engine_agent.c
 #      vcd_main.c
        vcd_recorder.c
index ddb298b..f9bdec8 100644 (file)
@@ -34,6 +34,9 @@ static manager_info_s g_manager;
 /* Manager IPC info */
 static manager_tidl_info_s* g_mgr_tidl_info = NULL;
 
+/* Widget IPC info */
+static GSList* g_widget_tidl_info_list = NULL;
+
 /* Command list */
 static current_commands_list_s g_cur_cmd_list;
 
@@ -256,7 +259,7 @@ char* vcd_client_manager_get_result_text()
        return g_result_text;
 }
 
-int vcd_client_manger_create_tidl_info(int pid)
+int vcd_client_manager_create_tidl_info(int pid)
 {
        /*Check already created*/
        if (NULL != g_mgr_tidl_info) {
@@ -1664,6 +1667,184 @@ int vcd_client_widget_get_waiting_for_recording(int pid, bool* waiting)
        return 0;
 }
 
+GSList* __get_widget_tidl_info_item(const int pid)
+{
+       GSList *iter = NULL;
+       widget_tidl_info_s *data = NULL;
+
+       int count = g_slist_length(g_widget_tidl_info_list);
+       int i;
+
+       if (0 < count) {
+               iter = g_slist_nth(g_widget_tidl_info_list, 0);
+               for (i = 0; i < count; i++) {
+                       if (NULL == iter)
+                               break;
+
+                       data = iter->data;
+                       if (NULL != data) {
+                               if (pid == data->pid)
+                                       return iter;
+                       }
+
+                       iter = g_slist_next(iter);
+               }
+       }
+
+       return NULL;
+}
+
+widget_tidl_info_s* __get_widget_tidl_info_element(int pid)
+{
+       GSList *iter = NULL;
+       widget_tidl_info_s *data = NULL;
+
+       int count = g_slist_length(g_widget_tidl_info_list);
+       int i;
+
+       if (0 < count) {
+               iter = g_slist_nth(g_widget_tidl_info_list, 0);
+               for (i = 0; i < count; i++) {
+                       if (NULL == iter)
+                               break;
+
+                       data = iter->data;
+
+                       if (NULL != data) {
+                               if (pid == data->pid)
+                                       return data;
+                       }
+
+                       iter = g_slist_next(iter);
+               }
+       }
+
+       return NULL;
+}
+
+int vcd_client_widget_add_tidl_info(int pid)
+{
+       /*Check pid is duplicated*/
+       widget_tidl_info_s* info = NULL;
+       info = __get_widget_tidl_info_element(pid);
+
+       if (NULL != info) {
+               SLOG(LOG_WARN, TAG_VCD, "[Client Data] Widget tidl info pid is already registered");
+               return VCD_ERROR_NONE;
+       }
+
+       SLOG(LOG_INFO, TAG_VCD, "[Client Data] There is no tidl info of pid(%d). Create new one.", pid);
+       info = (widget_tidl_info_s*)calloc(1, sizeof(widget_tidl_info_s));
+       if (NULL == info) {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to allocate memory");
+               return VCD_ERROR_OUT_OF_MEMORY;
+       }
+
+       info->pid = pid;
+       info->notify_cb = NULL;
+       info->notify_cb_user_data = NULL;
+
+       info->connected = false;
+       info->connection_requesting = false;
+       info->rpc_h = NULL;
+
+       g_widget_tidl_info_list = g_slist_append(g_widget_tidl_info_list, info);
+       if (NULL == g_widget_tidl_info_list) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to add new widget tidl info");
+
+               free(info);
+               info = NULL;
+
+               return -1;
+       } else {
+               SLOG(LOG_INFO, TAG_VCD, "[Client Data SUCCESS] Add new widget tidl info. pid(%d)", pid);
+       }
+
+       return VCD_ERROR_NONE;
+}
+
+int vcd_client_widget_set_tidl_notify_cb(int pid, rpc_port_stub_vc_widget_notify_cb_h callback, void* user_data)
+{
+       /*Check pid*/
+       widget_tidl_info_s* info = NULL;
+       info = __get_widget_tidl_info_element(pid);
+
+       if (NULL == info) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] There is no tidl info in the list. pid(%d)", pid);
+               return VCD_ERROR_INVALID_PARAMETER;
+       }
+
+       int ret = -1;
+       ret = rpc_port_stub_vc_widget_notify_cb_clone(callback, &(info->notify_cb));
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to clone notify callback. ret(%d)", ret);
+       } else {
+               SLOG(LOG_INFO, TAG_VCD, "[Client Data] Succeed to clone notify callback. ret(%d)", ret);
+       }
+       info->notify_cb_user_data = user_data;
+
+       return VCD_ERROR_NONE;
+}
+
+int vcd_client_widget_unset_tidl_notify_cb(int pid)
+{
+       /*Check pid*/
+       widget_tidl_info_s* info = NULL;
+       info = __get_widget_tidl_info_element(pid);
+
+       if (NULL == info) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] There is no tidl info in the list. pid(%d)", pid);
+               return VCD_ERROR_INVALID_PARAMETER;
+       }
+
+       int ret = -1;
+       ret = rpc_port_stub_vc_widget_notify_cb_destroy(info->notify_cb);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to destroy notify callback. ret(%d)", ret);
+       } else {
+               SLOG(LOG_INFO, TAG_VCD, "[Client Data] Succeed to destroy notify callback. ret(%d)", ret);
+       }
+       info->notify_cb = NULL;
+       info->notify_cb_user_data = NULL;
+
+       return VCD_ERROR_NONE;
+}
+
+int vcd_client_widget_delete_tidl_info(int pid)
+{
+       GSList *tmp = NULL;
+       widget_tidl_info_s* widget_tidl_info = NULL;
+
+       /*Get handle*/
+       tmp = __get_widget_tidl_info_item(pid);
+       if (NULL == tmp) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] pid(%d) is NOT valid", pid);
+               return VCD_ERROR_INVALID_PARAMETER;
+       }
+
+       /*Free widget structure*/
+       widget_tidl_info = tmp->data;
+       if (NULL != widget_tidl_info) {
+               free(widget_tidl_info);
+       }
+
+       /*Remove handle from list*/
+       g_widget_tidl_info_list = g_slist_remove_link(g_widget_tidl_info_list, tmp);
+
+       return 0;
+}
+
+widget_tidl_info_s* vcd_client_widget_get_tidl_info(int pid)
+{
+       return __get_widget_tidl_info_element(pid);
+}
+
+GSList* vcd_client_widget_get_tidl_info_list()
+{
+       return g_widget_tidl_info_list;
+}
+
+
 void vcd_client_update_foreground_pid()
 {
        int tmp_pid = VC_RUNTIME_INFO_NO_FOREGROUND;
index 260c984..317e1d5 100644 (file)
@@ -23,6 +23,8 @@
 #include "vc_info_parser.h"
 #include "vcd_mgr_stub.h"
 #include "vcd_mgr_proxy.h"
+#include "vcd_widget_stub.h"
+#include "vcd_widget_proxy.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -81,6 +83,18 @@ typedef struct {
        rpc_port_proxy_vcd_mgr_h rpc_h;
 } manager_tidl_info_s;
 
+typedef struct {
+       int pid;
+
+       rpc_port_stub_vc_widget_notify_cb_h notify_cb;
+       void*   notify_cb_user_data;
+
+       bool connected;
+       bool connection_requesting;
+
+       rpc_port_proxy_vcd_widget_h rpc_h;
+} widget_tidl_info_s;
+
 typedef enum {
        VCD_RECOGNITION_MODE_STOP_BY_SILENCE,           /**< Default mode */
        VCD_RECOGNITION_MODE_RESTART_AFTER_REJECT,      /**< Restart recognition after rejected result */
@@ -147,7 +161,7 @@ char* vcd_client_manager_get_result_text();
 
 bool vcd_client_manager_is_system_command_valid(int pid);
 
-int vcd_client_manger_create_tidl_info(int pid);
+int vcd_client_manager_create_tidl_info(int pid);
 
 int vcd_client_manager_set_tidl_notify_cb(rpc_port_stub_vc_mgr_notify_cb_h callback, void* user_data);
 
@@ -215,6 +229,17 @@ int vcd_client_widget_set_waiting_for_recording(int pid, bool waiting);
 
 int vcd_client_widget_get_waiting_for_recording(int pid, bool* waiting);
 
+int vcd_client_widget_add_tidl_info(int pid);
+
+int vcd_client_widget_set_tidl_notify_cb(int pid, rpc_port_stub_vc_widget_notify_cb_h callback, void* user_data);
+
+int vcd_client_widget_unset_tidl_notify_cb(int pid);
+
+int vcd_client_widget_delete_tidl_info(int pid);
+
+widget_tidl_info_s* vcd_client_widget_get_tidl_info(int pid);
+
+GSList* vcd_client_widget_get_tidl_info_list();
 
 #ifdef __cplusplus
 }
index b37e486..54bf596 100755 (executable)
@@ -119,7 +119,9 @@ int vcdc_send_hello(int pid, vcd_client_type_e type)
        if (VCD_CLIENT_TYPE_NORMAL == type) {
                msg = __get_message(pid, VCD_METHOD_HELLO, VCD_CLIENT_TYPE_NORMAL);
        } else if (VCD_CLIENT_TYPE_WIDGET == type) {
-               msg = __get_message(pid, VCD_WIDGET_METHOD_HELLO, VCD_CLIENT_TYPE_WIDGET);
+               // msg = __get_message(pid, VCD_WIDGET_METHOD_HELLO, VCD_CLIENT_TYPE_WIDGET);
+               vcdc_tidl_send_hello(pid, type);
+               return VCD_ERROR_NONE;
        } else if (VCD_CLIENT_TYPE_MANAGER == type) {
                vcdc_tidl_send_hello(pid, type);
                return VCD_ERROR_NONE;
@@ -173,63 +175,6 @@ int vcdc_send_hello(int pid, vcd_client_type_e type)
        return result;
 }
 
-int vcdc_send_show_tooltip(int pid, bool show)
-{
-       if (0 != __dbus_check()) {
-               return VCD_ERROR_OPERATION_FAILED;
-       }
-
-       if (0 > pid) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] widget pid is NOT valid");
-               return -1;
-       }
-
-       char service_name[64] = {0, };
-       memset(service_name, 0, 64);
-       snprintf(service_name, 64, "%s%d", VC_WIDGET_SERVICE_NAME, pid);
-
-       char target_if_name[128] = {0, };
-       snprintf(target_if_name, sizeof(target_if_name), "%s", VC_WIDGET_SERVICE_INTERFACE);
-
-       DBusMessage* msg;
-
-       SLOG(LOG_INFO, TAG_VCD, "[Dbus] send widget show tooltip signal : pid(%d) show(%d)", pid, show);
-
-       msg = dbus_message_new_method_call(
-                         service_name,
-                         VC_WIDGET_SERVICE_OBJECT_PATH,
-                         target_if_name,
-                         VCD_WIDGET_METHOD_SHOW_TOOLTIP);
-
-       if (NULL == msg) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Fail to create message");
-               return VCD_ERROR_OUT_OF_MEMORY;
-       }
-
-       int temp = (int)show;
-
-       DBusMessageIter args;
-       dbus_message_iter_init_append(msg, &args);
-
-       /* Append pid & type */
-       dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &pid);
-       dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(temp));
-
-       dbus_message_set_no_reply(msg, TRUE);
-
-       if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Fail to Send");
-               return VCD_ERROR_OPERATION_FAILED;
-       } else {
-               SLOG(LOG_INFO, TAG_VCD, "[Dbus] SUCCESS Send");
-               dbus_connection_flush(g_conn_sender);
-       }
-
-       dbus_message_unref(msg);
-
-       return 0;
-}
-
 int vcdc_send_result(int pid, int manager_pid, int cmd_type)
 {
        if (0 != __dbus_check()) {
@@ -245,21 +190,23 @@ int vcdc_send_result(int pid, int manager_pid, int cmd_type)
        case VC_COMMAND_TYPE_BACKGROUND:
                if (pid == manager_pid) {
                        // msg = __get_message(pid, VCD_MANAGER_METHOD_RESULT, VCD_CLIENT_TYPE_MANAGER);
-                       vcdc_tidl_send_result(pid, manager_pid, cmd_type);
+                       vcdc_tidl_send_result(pid, manager_pid, VCD_CLIENT_TYPE_MANAGER);
                        return 0;
                } else {
                        msg = __get_message(pid, VCD_METHOD_RESULT, VCD_CLIENT_TYPE_NORMAL);
                }
                break;
        case VC_COMMAND_TYPE_WIDGET:
-               msg = __get_message(pid, VCD_WIDGET_METHOD_RESULT, VCD_CLIENT_TYPE_WIDGET);
-               break;
+               // msg = __get_message(pid, VCD_WIDGET_METHOD_RESULT, VCD_CLIENT_TYPE_WIDGET);
+               // break;
+               vcdc_tidl_send_result(pid, manager_pid, VCD_CLIENT_TYPE_WIDGET);
+               return 0;
        case VC_COMMAND_TYPE_SYSTEM:
        case VC_COMMAND_TYPE_SYSTEM_BACKGROUND:
        case VC_COMMAND_TYPE_EXCLUSIVE:
                // msg = __get_message(pid, VCD_MANAGER_METHOD_RESULT, VCD_CLIENT_TYPE_MANAGER);
                // break;
-               vcdc_tidl_send_result(pid, manager_pid, cmd_type);
+               vcdc_tidl_send_result(pid, manager_pid, VCD_CLIENT_TYPE_MANAGER);
                return 0;
 
        default:
@@ -287,67 +234,6 @@ int vcdc_send_result(int pid, int manager_pid, int cmd_type)
        return 0;
 }
 
-int vcdc_send_asr_result(int pid, int event, const char* asr_result, int cmd_type, bool* is_consumed)
-{
-       if (0 != __dbus_check()) {
-               return VCD_ERROR_OPERATION_FAILED;
-       }
-
-       DBusMessage* msg = NULL;
-
-       SLOG(LOG_INFO, TAG_VCD, "[Dbus] Result command type(%d)", cmd_type);
-
-       switch (cmd_type) {
-       case VC_COMMAND_TYPE_WIDGET:
-               msg = __get_message(pid, VCD_WIDGET_METHOD_ASR_RESULT, VCD_CLIENT_TYPE_WIDGET);
-               break;
-       default:
-               SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Command type is NOT valid(%d)", cmd_type);
-               return VCD_ERROR_INVALID_PARAMETER;
-       }
-
-       if (NULL == msg) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Message is NULL");
-               return VCD_ERROR_OUT_OF_MEMORY;
-       }
-
-       dbus_message_append_args(msg, DBUS_TYPE_INT32, &event, DBUS_TYPE_STRING, &asr_result, DBUS_TYPE_INVALID);
-
-       DBusError err;
-       dbus_error_init(&err);
-
-       DBusMessage* result_msg;
-
-       int result = 0;
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, 5000, &err);
-       dbus_message_unref(msg);
-
-       if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Dbus Error (%s)", err.message);
-               dbus_error_free(&err);
-       }
-
-       if (NULL != result_msg) {
-               dbus_message_get_args(result_msg, &err,
-                       DBUS_TYPE_INT32, &result,
-                       DBUS_TYPE_INVALID);
-
-               if (dbus_error_is_set(&err)) {
-                       SLOG(LOG_ERROR, TAG_VCD, "@@ Get arguments error (%s)", err.message);
-                       dbus_error_free(&err);
-                       result = VCD_ERROR_OPERATION_FAILED;
-               }
-
-               dbus_message_unref(result_msg);
-               SLOG(LOG_INFO, TAG_VCD, "@@ vc send asr result : result = %d", result);
-               *is_consumed = result;
-               return VCD_ERROR_NONE;
-       } else {
-               SLOG(LOG_ERROR, TAG_VCD, "@@ Result message is NULL ");
-               return VCD_ERROR_OPERATION_FAILED;
-       }
-}
-
 int vcdc_send_manager_pid(int manager_pid)
 {
        DBusError err;
@@ -482,6 +368,7 @@ int vcdc_send_error_signal(int reason, char *err_msg)
        // msg = NULL;
 
        vcdc_tidl_send_error(reason, err_msg);
+
        msg = dbus_message_new_signal(
                VC_CLIENT_SERVICE_OBJECT_PATH,
                VC_CLIENT_SERVICE_INTERFACE,
@@ -504,28 +391,28 @@ int vcdc_send_error_signal(int reason, char *err_msg)
 
        dbus_message_unref(msg);
 
-       msg = NULL;
-       msg = dbus_message_new_signal(
-               VC_WIDGET_SERVICE_OBJECT_PATH,
-               VC_WIDGET_SERVICE_INTERFACE,
-               VCD_WIDGET_METHOD_ERROR);
+       // msg = NULL;
+       // msg = dbus_message_new_signal(
+       //      VC_WIDGET_SERVICE_OBJECT_PATH,
+       //      VC_WIDGET_SERVICE_INTERFACE,
+       //      VCD_WIDGET_METHOD_ERROR);
 
-       if (NULL == msg) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Message is NULL");
-               return VCD_ERROR_OUT_OF_MEMORY;
-       }
+       // if (NULL == msg) {
+       //      SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Message is NULL");
+       //      return VCD_ERROR_OUT_OF_MEMORY;
+       // }
 
-       dbus_message_append_args(msg, DBUS_TYPE_INT32, &reason, DBUS_TYPE_INT32, &daemon_pid, DBUS_TYPE_STRING, &err_msg, DBUS_TYPE_INVALID);
+       // dbus_message_append_args(msg, DBUS_TYPE_INT32, &reason, DBUS_TYPE_INT32, &daemon_pid, DBUS_TYPE_STRING, &err_msg, DBUS_TYPE_INVALID);
 
-       if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Fail to Send");
-               return VCD_ERROR_OPERATION_FAILED;
-       } else {
-               SLOG(LOG_INFO, TAG_VCD, "@@ Send error signal to widget : reason(%d), daemon_pid(%d), Error Msg(%s)", reason, daemon_pid, err_msg);
-               dbus_connection_flush(g_conn_sender);
-       }
+       // if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
+       //      SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Fail to Send");
+       //      return VCD_ERROR_OPERATION_FAILED;
+       // } else {
+       //      SLOG(LOG_INFO, TAG_VCD, "@@ Send error signal to widget : reason(%d), daemon_pid(%d), Error Msg(%s)", reason, daemon_pid, err_msg);
+       //      dbus_connection_flush(g_conn_sender);
+       // }
 
-       dbus_message_unref(msg);
+       // dbus_message_unref(msg);
 
        return 0;
 }
@@ -671,27 +558,6 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
                else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_METHOD_REQUEST_CANCEL))
                        vcd_dbus_server_cancel_request(g_conn_listener, msg);
 #endif
-               /* widget event */
-               else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_WIDGET_METHOD_INITIALIZE))
-                       vcd_dbus_server_widget_initialize(g_conn_listener, msg);
-
-               else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_WIDGET_METHOD_FINALIZE))
-                       vcd_dbus_server_widget_finalize(g_conn_listener, msg);
-
-               else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_WIDGET_METHOD_START_RECORDING))
-                       vcd_dbus_server_widget_start_recording(g_conn_listener, msg);
-
-               else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_WIDGET_METHOD_START))
-                       vcd_dbus_server_widget_start(g_conn_listener, msg);
-
-               else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_WIDGET_METHOD_STOP))
-                       vcd_dbus_server_widget_stop(g_conn_listener, msg);
-
-               else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_WIDGET_METHOD_CANCEL))
-                       vcd_dbus_server_widget_cancel(g_conn_listener, msg);
-
-               else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_WIDGET_METHOD_ENABLE_ASR_RESULT))
-                       vcd_dbus_server_widget_enable_asr_result(g_conn_listener, msg);
 
                else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_SETTING_METHOD_SET_LANGUAGE))
                        vcd_dbus_server_set_language(g_conn_listener, msg);
index 7f07726..fcfaad3 100644 (file)
@@ -32,25 +32,17 @@ int vcd_check_dbus_connection();
 
 int vcdc_send_hello(int pid, vcd_client_type_e type);
 
-int vcdc_send_show_tooltip(int pid, bool show);
-
 int vcdc_send_result(int pid, int manager_pid, int cmd_type);
 
-int vcdc_send_asr_result(int pid, int event, const char* asr_result, int cmd_type, bool* is_consumed);
-
 int vcdc_send_error_signal(int reason, char *err_msg);
 
 int vcdc_send_error_signal_to_app(int pid, int reason, char *err_msg);
 
 int vcdc_send_manager_pid(int manager_pid);
 
-// int vcdc_send_request_get_private_data(int pid, const char* key, char** data);
-
 /* for TTS feedback */
 int vcdc_send_feedback_streaming(int pid, int utt_id, vc_feedback_event_e event, char* buffer, int len);
 
-// int vcdc_send_feedback_streaming_to_manager(int manager_pid, int pid, int utt_id, vc_feedback_event_e event, char* buffer, int len);
-
 #ifdef __cplusplus
 }
 #endif
index 7f0d713..ae36531 100644 (file)
@@ -1350,7 +1350,7 @@ int vcd_initialize(vce_request_callback_s *callback)
                }
 
                /* Open tidl connection */
-               if (0 != vcd_mgr_tidl_open_connection()) {
+               if (0 != vcd_tidl_open_connection()) {
                        SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to open tidl connection");
                        if (TRUE != vcd_finalize()) {
                                SLOG(LOG_ERROR, TAG_VCD, "[Server Error] Fail to finalize");
@@ -1442,7 +1442,7 @@ bool vcd_finalize()
        }
 
        /* Close tidl connection */
-       if (0 != vcd_mgr_tidl_close_connection()) {
+       if (0 != vcd_tidl_close_connection()) {
                SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to close connection");
        }
 
index d5917a5..3ed737c 100644 (file)
 #include "vcd_tidl.h"
 #include "vcd_mgr_stub.h"
 #include "vcd_mgr_proxy.h"
+#include "vcd_widget_stub.h"
+#include "vcd_widget_proxy.h"
 
 static rpc_port_stub_vc_mgr_callback_s g_mgr_callback;
 
 static pthread_mutex_t g_mgr_tidl_info_mutex = PTHREAD_MUTEX_INITIALIZER;
 
-static int g_volume_count = 0;
-
-static void __on_connected(rpc_port_proxy_vcd_mgr_h h, void *user_data)
-{
-       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
-
-       if (NULL == mgr_tidl_info) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated");
-               return;
-       }
-
-       mgr_tidl_info->connected = true;
-       mgr_tidl_info->connection_requesting = false;
-
-       SLOG(LOG_INFO, TAG_VCD, "Connected to manager");
-}
-
-static void __on_disconnected(rpc_port_proxy_vcd_mgr_h h, void *user_data)
-{
-       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+static rpc_port_stub_vc_widget_callback_s g_widget_callback;
 
-       if (NULL == mgr_tidl_info) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated");
-               return;
-       }
+static pthread_mutex_t g_widget_tidl_info_mutex = PTHREAD_MUTEX_INITIALIZER;
 
-       mgr_tidl_info->connected = false;
-       mgr_tidl_info->connection_requesting = false;
+static int g_volume_count = 0;
 
-       SLOG(LOG_INFO, TAG_VCD, "Disonnected to manager");
-}
+int vcd_mgr_tidl_open_connection();
+int vcd_mgr_tidl_close_connection();
+int vcd_widget_tidl_open_connection();
+int vcd_widget_tidl_close_connection();
 
-static void __on_rejected(rpc_port_proxy_vcd_mgr_h h, void *user_data)
+/* for common request */
+static void __request_tidl_connect(vcd_client_type_e type, int pid)
 {
-       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+       char* type_str = NULL;
+       int ret = -1;
 
-       if (NULL == mgr_tidl_info) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated");
-               return;
-       }
+       if (VCD_CLIENT_TYPE_MANAGER == type) {
+               manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+               if (NULL == mgr_tidl_info) {
+                       SLOG(LOG_ERROR, TAG_VCD, "[TIDL] manager tidl info not allocated");
+                       return;
+               }
 
-       mgr_tidl_info->connection_requesting = false;
+               if (mgr_tidl_info->connection_requesting) {
+                       return;
+               }
 
-       SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Rejected from manager");
-}
+               ret = rpc_port_proxy_vcd_mgr_connect(mgr_tidl_info->rpc_h);
 
-static rpc_port_proxy_vcd_mgr_h __create_rpc_port(const char* engine_app_id, manager_tidl_info_s* mgr_tidl_info)
-{
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] __create_rpc_port");
-       rpc_port_proxy_vcd_mgr_callback_s rpc_callback = {
-               .connected = __on_connected,
-               .disconnected = __on_disconnected,
-               .rejected = __on_rejected
-       };
+               if (0 == ret) {
+                       mgr_tidl_info->connection_requesting = true;
+               }
+               type_str = "manager";
+       // TODO: uncomment after client done
+       // } else if (VCD_CLIENT_TYPE_NORMAL == type) {
+       //      client_tidl_info_s* client_tidl_info = vcd_client_client_get_tidl_info(pid);
+       //      if (NULL == client_tidl_info) {
+       //              SLOG(LOG_ERROR, TAG_VCD, "[TIDL] client tidl info not allocated");
+       //              return;
+       //      }
+
+       //      if (client_tidl_info->connection_requesting) {
+       //              return;
+       //      }
+
+       //      ret = rpc_port_proxy_vcd_client_connect(client_tidl_info->rpc_h);
+
+       //      if (0 == ret) {
+       //      SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated");
+       //              client_tidl_info->connection_requesting = true;
+       //      }
+       //      type_str = "client";
+       } else if (VCD_CLIENT_TYPE_WIDGET == type) {
+               widget_tidl_info_s* widget_tidl_info = vcd_client_widget_get_tidl_info(pid);
+               if (NULL == widget_tidl_info) {
+                       SLOG(LOG_ERROR, TAG_VCD, "[TIDL] widget tidl info not allocated");
+                       return;
+               }
 
-       rpc_port_proxy_vcd_mgr_h handle = NULL;
-       if (0 != rpc_port_proxy_vcd_mgr_create(engine_app_id, &rpc_callback, NULL, &handle)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create proxy");
-               return NULL;
-       }
+               if (widget_tidl_info->connection_requesting) {
+                       return;
+               }
 
-       return handle;
-}
+               ret = rpc_port_proxy_vcd_widget_connect(widget_tidl_info->rpc_h);
 
-static void __request_tidl_connect_sync(manager_tidl_info_s* mgr_tidl_info)
-{
-       if (NULL == mgr_tidl_info) {
+               if (0 == ret) {
                SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated");
+                       widget_tidl_info->connection_requesting = true;
+               }
+               type_str = "widget";
+       } else {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] client type is NOT valid(%d)", type);
                return;
        }
 
-       if (mgr_tidl_info->connection_requesting) {
-               return;
-       }
-
-       int ret = rpc_port_proxy_vcd_mgr_connect_sync(mgr_tidl_info->rpc_h);
-       SLOG(LOG_INFO, TAG_VCD, "[INFO] Request connection to stub. ret(%d)", ret);
-
-       if (0 == ret) {
-               mgr_tidl_info->connection_requesting = true;
+       if (RPC_PORT_ERROR_NONE != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Request connection to %s stub. ret(%d)", type_str, ret);
+       } else {
+               SLOG(LOG_INFO, TAG_VCD, "[INFO] Request connection to %s stub. ret(%d)", type_str, ret);
        }
 }
 
-void __send_msg(bundle* msg, vcd_client_type_e type)
+void __send_msg(bundle* msg, vcd_client_type_e type, int pid)
 {
        SLOG(LOG_INFO, TAG_VCD, "[TIDL] send msg start");
 
@@ -138,1067 +140,1805 @@ void __send_msg(bundle* msg, vcd_client_type_e type)
                        return;
                }
                pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
-       }
-
-       SLOG(LOG_INFO, TAG_VCD, "[TIDL] send msg end");
-}
+       // TODO: uncomment after client done
+       // } else if (VCD_CLIENT_TYPE_NORMAL == type) {
+       //      pthread_mutex_lock(&g_client_tidl_info_mutex);
+
+       //      SLOG(LOG_INFO, TAG_VCD, "[TIDL] message to client");
+       //      client_tidl_info_s* client_tidl_info = vcd_client_client_get_tidl_info(pid);
+       //      if (NULL == client_tidl_info) {
+       //              SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated");
+       //              pthread_mutex_unlock(&g_client_tidl_info_mutex);
+       //              return;
+       //      }
+
+       //      rpc_port_stub_vc_client_notify_cb_h handle = client_tidl_info->notify_cb;
+       //      if (NULL == handle) {
+       //              SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null");
+       //              pthread_mutex_unlock(&g_client_tidl_info_mutex);
+       //              return;
+       //      }
+
+       //      if (0 != rpc_port_stub_vc_client_notify_cb_invoke(handle, msg)) {
+       //              SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg");
+       //              pthread_mutex_unlock(&g_client_tidl_info_mutex);
+       //              return;
+       //      }
+       //      pthread_mutex_unlock(&g_client_tidl_info_mutex);
+       } else if (VCD_CLIENT_TYPE_WIDGET == type) {
+               pthread_mutex_lock(&g_widget_tidl_info_mutex);
+
+               SLOG(LOG_INFO, TAG_VCD, "[TIDL] message to widget");
+               widget_tidl_info_s* widget_tidl_info = vcd_client_widget_get_tidl_info(pid);
+               if (NULL == widget_tidl_info) {
+                       SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated");
+                       pthread_mutex_unlock(&g_widget_tidl_info_mutex);
+                       return;
+               }
 
-static void __vc_mgr_create_cb(rpc_port_stub_vc_mgr_context_h context, void *user_data)
-{
-       char *sender = NULL;
+               rpc_port_stub_vc_widget_notify_cb_h handle = widget_tidl_info->notify_cb;
+               if (NULL == handle) {
+                       SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null");
+                       pthread_mutex_unlock(&g_widget_tidl_info_mutex);
+                       return;
+               }
 
-       rpc_port_stub_vc_mgr_context_get_sender(context, &sender);
-       if (!sender){
-               SLOG(LOG_ERROR, TAG_VCD, "Sender is NULL");
+               if (0 != rpc_port_stub_vc_widget_notify_cb_invoke(handle, msg)) {
+                       SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg");
+                       pthread_mutex_unlock(&g_widget_tidl_info_mutex);
+                       return;
+               }
+               pthread_mutex_unlock(&g_widget_tidl_info_mutex);
+       } else {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] client type is NOT valid(%d)", type);
                return;
        }
-
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ Manager connect. appid(%s)", sender);
-
-       free(sender);
 }
 
-static void __vc_mgr_terminate_cb(rpc_port_stub_vc_mgr_context_h context, void *user_data)
+void __send_signal(bundle* msg)
 {
+       SLOG(LOG_INFO, TAG_VCD, "[TIDL] send signal start");
+
        pthread_mutex_lock(&g_mgr_tidl_info_mutex);
+
+       SLOG(LOG_INFO, TAG_VCD, "[TIDL] message to manager");
        manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
        if (NULL == mgr_tidl_info) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get manager tidl info.");
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated");
                pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
                return;
        }
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VC MANAGER FINALIZE. pid(%u)", mgr_tidl_info->pid);
-
-       if (0 != vcd_client_manager_unset_tidl_notify_cb()) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to unset notify callback");
+       rpc_port_stub_vc_mgr_notify_cb_h handle = mgr_tidl_info->notify_cb;
+       if (NULL == handle) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null");
+               pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
+               return;
        }
 
-       if (0 != vcd_client_manager_unset_tidl_send_buffer_cb()) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to unset send buffer callback");
+       if (0 != rpc_port_stub_vc_mgr_notify_cb_invoke(handle, msg)) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg");
+               pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
+               return;
        }
+       pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
 
-       if (0 != vcd_client_manager_delete_tidl_info()) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to delete manager tidl info");
-       }
-       mgr_tidl_info = NULL;
+       GSList *iter = NULL;
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+       // TODO: uncomment after client done
+       // pthread_mutex_lock(&g_client_tidl_info_mutex);
+       // GSList* client_list = vcd_client_client_get_tidl_info_list();
 
-       pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
+       // int count = g_slist_length(g_client_ipc_info_list);
+       // int i;
 
+       // client_tidl_info_s *client_tidl_info = NULL;
 
-       char *sender = NULL;
-       rpc_port_stub_vc_mgr_context_get_sender(context, &sender);
-       if (!sender)
-               return;
+       // if (0 < count) {
+       //      iter = g_slist_nth(client_list, 0);
+       //      for (i = 0; i < count; i++) {
+       //              if (NULL == iter) {
+       //                      SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] client list iterator broken");
+       //                      break;
+       //              }
 
-       SLOG(LOG_INFO, TAG_VCD, "@@@ Manager disconnect. appid(%s)", sender);
+       //              client_tidl_info = iter->data;
 
-       free(sender);
-}
+       //              if (NULL == client_tidl_info) {
+       //                      SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] client list data broken");             
+       //                      break;
+       //              }
 
-static void  __vc_mgr_register_cb_cb(rpc_port_stub_vc_mgr_context_h context, int pid, rpc_port_stub_vc_mgr_notify_cb_h notify_callback, rpc_port_stub_vc_mgr_send_buffer_cb_h send_buffer_callback, void *user_data)
-{
-       pthread_mutex_lock(&g_mgr_tidl_info_mutex);
-       SLOG(LOG_INFO, TAG_VCD, "@@@ VC MANAGER REGISTER CALLBACK");
+       //              SLOG(LOG_INFO, TAG_VCD, "[TIDL] message to client");
 
-       int ret = -1;
-       ret = vcd_client_manger_create_tidl_info(pid);
+       //              rpc_port_stub_vc_client_notify_cb_h handle = client_tidl_info->notify_cb;
+       //              if (NULL == handle) {
+       //                      SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null");
+       //                      break;
+       //              }
 
-       if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create manager tidl info.");
-               pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
-        return;
-       }
+       //              if (0 != rpc_port_stub_vc_client_notify_cb_invoke(handle, msg)) {
+       //                      SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg");
+       //                      break;
+       //              }
 
-       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+       //              iter = g_slist_next(iter);
+       //      }
+       // }    
+       // pthread_mutex_unlock(&g_client_tidl_info_mutex);
+       
+       pthread_mutex_lock(&g_widget_tidl_info_mutex);
+       GSList* widget_list = vcd_client_widget_get_tidl_info_list();
 
-       if (NULL == mgr_tidl_info) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get manager tidl info. pid(%d)", pid);
-               pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
-        return;
-       }
+       int count = g_slist_length(widget_list);
+       int i;
 
-       char *sender = NULL;
-       rpc_port_stub_vc_mgr_context_get_sender(context, &sender);
+       widget_tidl_info_s *widget_tidl_info = NULL;
 
-       if (!sender){
-               SLOG(LOG_ERROR, TAG_VCD, "Sender is NULL");
-               pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
-               return;
-       }
+       if (0 < count) {
+               iter = g_slist_nth(widget_list, 0);
+               for (i = 0; i < count; i++) {
+                       if (NULL == iter) {
+                               SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] widget list iterator broken");
+                               break;
+                       }
 
-       mgr_tidl_info->rpc_h = __create_rpc_port(sender, mgr_tidl_info);
+                       widget_tidl_info = iter->data;
 
-       if (NULL == mgr_tidl_info->rpc_h) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create server proxy");
-       } else {
-               SLOG(LOG_INFO, TAG_VCD, "[TIDL] rpc_h(%p), engine_app_id(%s)", mgr_tidl_info->rpc_h, sender);
-       }
+                       if (NULL == widget_tidl_info) {
+                               SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] widget list data broken");             
+                               break;
+                       }
 
-       free(sender);
+                       SLOG(LOG_INFO, TAG_VCD, "[TIDL] message to widget");
 
-       if (0 != vcd_client_manager_set_tidl_notify_cb(notify_callback, user_data)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback");
-       } else {
-               SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set notify callback.");
-       }
+                       rpc_port_stub_vc_widget_notify_cb_h handle = widget_tidl_info->notify_cb;
+                       if (NULL == handle) {
+                               SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null");
+                               break;
+                       }
 
-       if (0 != vcd_client_manager_set_tidl_send_buffer_cb(send_buffer_callback, user_data)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set send buffer callback");
+                       if (0 != rpc_port_stub_vc_widget_notify_cb_invoke(handle, msg)) {
+                               SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg");
+                               break;
+                       }
+
+                       iter = g_slist_next(iter);
+               }
+       }       
+       pthread_mutex_unlock(&g_widget_tidl_info_mutex);
+}
+
+// TODO: remove _tidl after all dbus removed
+int vcdc_tidl_send_hello(int pid, vcd_client_type_e type)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send hello");
+
+       char tmp_pid[10] = {0, };
+
+       bundle* msg = bundle_create();
+       snprintf(tmp_pid, 10, "%d", pid);
+
+       if (VCD_CLIENT_TYPE_NORMAL == type) {
+               // bundle_add_str(msg, VC_CLIENT_BUNDLE_METHOD, VCD_CLIENT_METHOD_HELLO);
+               // bundle_add_str(msg, VC_CLIENT_BUNDLE_MESSAGE, tmp_pid);
+       } else if (VCD_CLIENT_TYPE_MANAGER == type) {
+               bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_HELLO);
+               bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_pid);
+       } else if (VCD_CLIENT_TYPE_WIDGET == type) {
+               bundle_add_str(msg, VC_WIDGET_BUNDLE_METHOD, VCD_WIDGET_METHOD_HELLO);
+               bundle_add_str(msg, VC_WIDGET_BUNDLE_MESSAGE, tmp_pid);
        } else {
-               SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set send buffer callback.");
+               SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Client type is NOT valid");
+               bundle_free(msg);
+               return VCD_ERROR_INVALID_PARAMETER;
        }
 
-       pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] VCD SEND MESSAGE");
 
-       __request_tidl_connect_sync(mgr_tidl_info);
+       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER, pid);
+       bundle_free(msg);
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+       return VCD_ERROR_NONE;
 }
 
-static int  __vc_mgr_initialize_cb(rpc_port_stub_vc_mgr_context_h context, int pid, int audio_streaming_mode, int *service_state, int *foreground, int *daemon_pid, void *user_data)
+int vcd_tidl_open_connection()
 {
-       SLOG(LOG_INFO, TAG_VCD, "@@@ VCD Manager Initialize");
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] vcd_tidl_open_connection");
 
-       int ret = -1;
+       if (0 != vcd_mgr_tidl_open_connection()) {
+               SLOG(LOG_ERROR, TAG_VCD, "Fail to open connection to manager");
+               return VCD_ERROR_OPERATION_FAILED;
+       }
 
-       vcd_config_set_audio_streaming_mode((vcd_audio_streaming_mode_e)audio_streaming_mode);
-       ret = vcd_server_mgr_initialize(pid, audio_streaming_mode);
-       if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
-               return ret;
+       // TODO: uncomment after client done
+       // if (0 != vcd_client_tidl_open_connection()) {
+       //      SLOG(LOG_ERROR, TAG_VCD, "Fail to open connection to client");
+       //      return VCD_ERROR_OPERATION_FAILED;
+       // }
+
+       if (0 != vcd_widget_tidl_open_connection()) {
+               SLOG(LOG_ERROR, TAG_VCD, "Fail to open connection to widget");
+               return VCD_ERROR_OPERATION_FAILED;
        }
-       *service_state = vcd_server_get_service_state();
-       *foreground = vcd_server_get_foreground();
-       *daemon_pid = getpid();
 
-       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr initialize : pid(%d) service state(%d) foreground(%d) daemon_pid(%d)", pid, *service_state, *foreground, *daemon_pid);
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
-       return ret;
+       return VCD_ERROR_NONE;
 }
 
-static int  __vc_mgr_finalize_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data)
+int vcd_tidl_close_connection()
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager Finalize");
-       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr finalize : pid(%d)", pid);
-
-       int ret = -1;
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] vcd_tidl_close_connection");
 
-       ret = vcd_server_mgr_finalize(pid);
-       if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+       if (0 != vcd_mgr_tidl_close_connection()) {
+               SLOG(LOG_ERROR, TAG_VCD, "Fail to close connection to manager");
+               return VCD_ERROR_OPERATION_FAILED;
        }
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+       // TODO: uncomment after client done
+       // if (0 != vcd_client_tidl_close_connection()) {
+       //      SLOG(LOG_ERROR, TAG_VCD, "Fail to close connection to client");
+       //      return VCD_ERROR_OPERATION_FAILED;
+       // }
 
-       return ret;
+       if (0 != vcd_widget_tidl_close_connection()) {
+               SLOG(LOG_ERROR, TAG_VCD, "Fail to close connection to widget");
+               return VCD_ERROR_OPERATION_FAILED;
+       }
+
+       return VCD_ERROR_NONE;
 }
 
-static int  __vc_mgr_set_command_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data)
+int vcdc_send_set_volume(int manager_pid, float volume)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager Set command");
-       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set command : pid(%d)", pid);
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Set volume");
 
-       int ret = -1;
+       char tmp_volume[20] = {0, };
 
-       ret = vcd_server_mgr_set_command(pid);
-       if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
-               return ret;
+       bundle* msg = bundle_create();
+
+       snprintf(tmp_volume, 20, "%.6f", volume);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_SET_VOLUME);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_volume);
+
+
+       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
+       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER, manager_pid);
+       if (20 == g_volume_count) {
+               SLOG(LOG_INFO, TAG_VCD, "@@ Send set volume : pid(%d), volume(%f)", manager_pid, volume);
+               g_volume_count = 0;
        }
+       g_volume_count++;
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+       bundle_free(msg);
 
-       return ret;
+       return VCD_ERROR_NONE;
 }
 
-static int  __vc_mgr_unset_command_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data)
+int vcdc_send_show_tooltip(int pid, bool show)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager unset command");
-       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr unset command : pid(%d)", pid);
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send pre result to manager");
 
-       int ret = -1;
+       char tmp_pid[10] = {0, };
+       char tmp_show[10] = {0, };
 
-       ret = vcd_server_mgr_unset_command(pid);
-       if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
-               return ret;
-       }
-
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
-
-       return ret;
-}
+       bundle* msg = bundle_create();
 
-static int  __vc_mgr_set_demandable_client_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data)
-{
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager Set demandable client");
-       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set demandable client : pid(%d)", pid);
+       snprintf(tmp_pid, 10, "%d", pid);
+       snprintf(tmp_show, 10, "%d", (int)show);
 
-       int ret = -1;
+       bundle_add_str(msg, VC_WIDGET_BUNDLE_METHOD, VCD_WIDGET_METHOD_SHOW_TOOLTIP);
+       bundle_add_str(msg, VC_WIDGET_BUNDLE_MESSAGE, tmp_pid);
+       bundle_add_str(msg, VC_WIDGET_BUNDLE_SHOW, tmp_show);
 
-       ret = vcd_server_mgr_set_demandable_client(pid);
-       if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
-               return ret;
-       }
+       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+       __send_msg(msg, VCD_CLIENT_TYPE_WIDGET, pid);
+       bundle_free(msg);
 
-       return ret;
+       return VCD_ERROR_NONE;
 }
 
-static int  __vc_mgr_set_audio_type_cb(rpc_port_stub_vc_mgr_context_h context, int pid, const char *audio_type, void *user_data)
+// TODO: remove tidl after all dbus migrate to tidl
+int vcdc_tidl_send_result(int pid, int manager_pid, vcd_client_type_e type)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager set audio type");
-       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set audio type : pid(%d), audio type(%s)", pid, audio_type);
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send result");
 
-       int ret = -1;
+       bundle* msg = bundle_create();
 
-       ret = vcd_server_mgr_set_audio_type(pid, audio_type);
-       if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
-               return ret;
+       if (VCD_CLIENT_TYPE_MANAGER == type) {
+               bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_RESULT);
+       // TODO: uncomment after client done
+       // } else if (VCD_CLIENT_TYPE_NORMAL == type) {
+       //      // bundle_add_str(msg, VC_CLIENT_BUNDLE_METHOD, VCD_METHOD_RESULT);
+       } else if (VCD_CLIENT_TYPE_WIDGET == type) {
+               bundle_add_str(msg, VC_WIDGET_BUNDLE_METHOD, VCD_WIDGET_METHOD_RESULT);
+       } else {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] client type is NOT valid(%d)", type);
+               bundle_free(msg);
+               return VCD_ERROR_INVALID_PARAMETER;
        }
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
 
-       return ret;
+       __send_msg(msg, type, pid);
+       bundle_free(msg);
+
+       return VCD_ERROR_NONE;
 }
 
-static int  __vc_mgr_get_audio_type_cb(rpc_port_stub_vc_mgr_context_h context, int pid, char **audio_type, void *user_data)
+int vcdc_send_pre_result_to_manager(int manager_pid, int event, const char* pre_result)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager get audio type");
-       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set audio type : pid(%d)", pid);
-
-       int ret = -1;
-       char* tmp_audio_type = NULL;
-
-       ret = vcd_server_mgr_get_audio_type(pid, &tmp_audio_type);
-       if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
-               free(tmp_audio_type);
-               return ret;
-       }
-
-       *audio_type = strdup(tmp_audio_type);
-       free(tmp_audio_type);
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send pre result to manager");
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+       char tmp_event[10] = {0, };
 
-       return ret;
-}
+       bundle* msg = bundle_create();
+       snprintf(tmp_event, 10, "%d", event);
 
-static void  __vc_mgr_set_private_data_cb(rpc_port_stub_vc_mgr_context_h context, int pid, const char *key, const char *data, void *user_data)
-{
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager set private data");
-       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set domain : pid(%d), key(%s), data(%s)", pid, key, data);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_PRE_RESULT);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_EVENT, tmp_event);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_PRE_RESULT, pre_result);
 
-       int ret = -1;
+       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
 
-       ret = vcd_server_mgr_set_private_data(pid, key, data);
-       if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to set private data");
-               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
-       }
+       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER, manager_pid);
+       bundle_free(msg);
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+       return VCD_ERROR_NONE;
 }
 
-static int  __vc_mgr_get_private_data_cb(rpc_port_stub_vc_mgr_context_h context, int pid, const char *key, char **data, void *user_data)
+int vcdc_send_specific_engine_result_to_manager(int manager_pid, const char* engine_app_id, const char* event, const char* result)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager get private data");
-       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr get private data : pid(%d), key(%s)", pid, key);
-
-       int ret = -1;
-       char *temp_data = NULL;
-
-       ret = vcd_server_mgr_get_private_data(pid, key, &temp_data);
-       if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
-               return ret;
-       }
-       if (NULL == temp_data) {
-               SLOG(LOG_INFO, TAG_VCD, "data parameter is NULL");
-               temp_data = strdup("#NULL");
-       }
-
-       *data = strdup(temp_data);
-       free(temp_data);
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send specific engine result to manager");
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+       bundle* msg = bundle_create();
 
-       return ret;
-}
+       gchar *gEncodedResult = g_base64_encode((const guchar*)result, strlen(result));
 
-static int  __vc_mgr_set_client_info_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data)
-{
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager set client info");
-       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set client info : pid(%d)", pid);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_SPECIFIC_ENGINE_RESULT);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_ENGINE_APP_ID, engine_app_id);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_EVENT, event);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_RESULT, gEncodedResult);
 
-       int ret = -1;
+       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
 
-       ret = vcd_server_mgr_set_client_info(pid);
-       if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
-               return ret;
-       }
+       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER, manager_pid);
+       bundle_free(msg);
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+       if (gEncodedResult)
+               g_free(gEncodedResult);
 
-       return ret;
+       return VCD_ERROR_NONE;
 }
 
-static int  __vc_mgr_set_domain_cb(rpc_port_stub_vc_mgr_context_h context, int pid, const char *domain, void *user_data)
+int vcdc_send_result_to_manager(int manager_pid, int result_type)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager set domain type");
-       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set domain : pid(%d), domain(%s)", pid, domain);
-
-       int ret = -1;
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send result to manager");
 
-       ret = vcd_server_mgr_set_domain(pid, domain);
-       if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
-               return ret;
-       }
+       char tmp_result[10] = {0, };
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+       bundle* msg = bundle_create();
+       snprintf(tmp_result, 10, "%d", result_type);
 
-       return ret;
-}
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_ALL_RESULT);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_result);
 
-static void  __vc_mgr_do_action_cb(rpc_port_stub_vc_mgr_context_h context, int pid, int type, const char *send_event, void *user_data)
-{
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager request to do action");
-       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr request to do action : pid(%d), type(%d) send_event(%s)", pid, type, send_event);
 
-       int ret = -1;
+       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
 
-       ret = vcd_server_mgr_do_action(pid, type, send_event);
-       if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
-       }
+       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER, manager_pid);
+       bundle_free(msg);
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+       return VCD_ERROR_NONE;
 }
 
-static int  __vc_mgr_start_cb(rpc_port_stub_vc_mgr_context_h context, int pid, int recognition_mode, bool exclusive_command_option, bool start_by_client, int disabled_cmd_type, void *user_data)
+int vcdc_send_speech_detected(int manager_pid)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager start");
-       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd check enabled or disabled command types. disabled cmd type(%d)", disabled_cmd_type);
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send speech detected");
 
-       int ret = -1;
+       bundle* msg = bundle_create();
 
-       vcd_server_mgr_set_disabled_command_type(pid, disabled_cmd_type);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_SPEECH_DETECTED);
 
-       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr start : pid(%d) recognition_mode(%d) exclusive(%d) start by client(%d)", pid, recognition_mode, exclusive_command_option, start_by_client);
-       ret = vcd_server_mgr_start((vcd_recognition_mode_e)recognition_mode, exclusive_command_option, start_by_client);
-       if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
-               return ret;
-       }
+       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER, manager_pid);
+       bundle_free(msg);
 
-       return ret;
+       return VCD_ERROR_NONE;
 }
 
-static int  __vc_mgr_stop_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data)
+int vcdc_send_service_state(vcd_state_e state)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager stop");
-       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr stop : pid(%d)", pid);
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send service state");
 
-       int ret = -1;
+       char tmp_state[10] = {0, };
 
-       ret = vcd_server_mgr_stop();
+       bundle* msg = bundle_create();
+       snprintf(tmp_state, 10, "%d", (int)state);
 
-       if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
-               return ret;
-       }
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_SET_SERVICE_STATE);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_state);
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+       // TODO: uncomment after client done
+       // bundle_add_str(msg, VC_CLIENT_BUNDLE_METHOD, VCD_METHOD_SET_SERVICE_STATE);
+       // bundle_add_str(msg, VC_CLIENT_BUNDLE_MESSAGE, tmp_state);
 
-       return ret;
+       bundle_add_str(msg, VC_WIDGET_BUNDLE_METHOD, VCD_WIDGET_METHOD_SET_SERVICE_STATE);
+       bundle_add_str(msg, VC_WIDGET_BUNDLE_MESSAGE, tmp_state);
+
+       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND SIGNAL");
+       __send_signal(msg);
+       bundle_free(msg);
+
+       return VCD_ERROR_NONE;
 }
 
-static int  __vc_mgr_cancel_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data)
+int vcdc_send_dialog(int manager_pid, int pid, const char* disp_text, const char* utt_text, int continuous)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager cancel");
-       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr cancel : pid(%d)", pid);
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send dialog");
 
-       int ret = -1;
+       char tmp_pid[10] = {0, };
+       char tmp_continuous[10] = {0, };
+       char* tmp_disp_text = NULL;
+       char* tmp_utt_text = NULL;
+       bundle* msg = bundle_create();
+       snprintf(tmp_pid, 10, "%d", pid);
+       snprintf(tmp_continuous, 10, "%d", continuous);
 
-       ret = vcd_server_mgr_cancel();
-       if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
-               return ret;
+       if (NULL == disp_text) {
+               tmp_disp_text = strdup("#NULL");
+       } else {
+               tmp_disp_text = strdup(disp_text);
        }
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+       if (NULL == utt_text) {
+               tmp_utt_text = strdup("#NULL");
+       } else {
+               tmp_utt_text = strdup(utt_text);
+       }
 
-       return ret;
-}
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_DIALOG);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_pid);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_DISP_TEXT, tmp_disp_text);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_UTT_TEXT, tmp_utt_text);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_CONTINUOUS, tmp_continuous);
 
-static void  __vc_mgr_set_audio_streaming_mode_cb(rpc_port_stub_vc_mgr_context_h context, int pid, int mode, void *user_data)
-{
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager set audio streaming mode");
-       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set audio streaming mode : pid(%d) mode(%d)", pid, mode);
+       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
 
-       vcd_config_set_audio_streaming_mode((vcd_audio_streaming_mode_e)mode);
+       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER, manager_pid);
+       bundle_free(msg);
+       free(tmp_disp_text);
+       free(tmp_utt_text);
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+       return VCD_ERROR_NONE;
 }
 
-static void  __vc_mgr_send_specific_engine_request_cb(rpc_port_stub_vc_mgr_context_h context, int pid, const char *engine_app_id, const char *event, const char *request, void *user_data)
+int vcdc_tidl_send_error_to_manager(int manager_pid, int reason, char *err_msg)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager specific engine request");
+       SLOG(LOG_ERROR, TAG_VCD, "[TIDL] Send error signal to manager");
 
-       int ret = -1;
-       gsize decodingSize = 0;
-       gchar *gDecodedRequest = (gchar *)g_base64_decode((const gchar *)request, &decodingSize);
-
-       if (gDecodedRequest) {
-               ret = vcd_server_mgr_send_specific_engine_request(pid, engine_app_id, event, gDecodedRequest);
-               if (0 != ret) {
-                       SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
-               }
+       char tmp_reason[10] = {0, };
+       char tmp_daemon_pid[10] = {0, };
+       char *temp_msg = NULL;
 
-               SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr specific engine request : pid(%d), engine_app_id(%s), event(%s), request(%s), ret(%d)", pid, engine_app_id, event, gDecodedRequest, ret);
-               g_free(gDecodedRequest);
+       if (NULL == err_msg) {
+               SLOG(LOG_WARN, TAG_VCD, "[TIDL ERROR] Input parameter is NULL");
+               temp_msg = strdup("#NULL");
+       } else {
+               temp_msg = strdup(err_msg);
        }
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
-}
+       bundle* msg = bundle_create();
+       snprintf(tmp_reason, 10, "%d", reason);
+       snprintf(tmp_daemon_pid, 10, "%d", getpid());
 
-static void  __vc_mgr_send_result_selection_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data)
-{
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager result selection");
-       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr result selection : pid(%d)", pid);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_ERROR);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_REASON, tmp_reason);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_DAEMON_PID, tmp_daemon_pid);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_ERROR_MESSAGE, temp_msg);
 
-       vcd_server_mgr_result_select();
+       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
-}
+       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER, manager_pid);
+       bundle_free(msg);
 
-static void  __vc_mgr_send_utterance_status_cb(rpc_port_stub_vc_mgr_context_h context, int utt_id, int utt_status, void *user_data)
-{
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager send utterance status");
-       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr send utterance status : utt_id(%d), utt_status(%d)", utt_id, utt_status);
-       // TODO: send parameter to client
+       free(temp_msg);
+       temp_msg = NULL;
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+       return VCD_ERROR_NONE;
 }
 
-static void  __vc_mgr_send_audio_streaming_cb(rpc_port_stub_vc_mgr_context_h context, int pid, int event, rpc_port_stub_array_char_h data, void *user_data)
+// TODO: remove _tidl after remove dbus
+// TODO: make client, widget error signal
+int vcdc_tidl_send_error(int reason, char *err_msg)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager send audio streaming");
-
-       char* buffer = NULL;
-       int len = 0;
-       int ret = -1;
-       rpc_port_stub_array_char_get(data, &buffer, &len);
+       SLOG(LOG_ERROR, TAG_VCD, "[TIDL] Send error signal");
 
-       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr send audio streaming : pid(%d), event(%d), buffer(%p), len(%d)", pid, event, buffer, len);
+       char tmp_reason[10] = {0, };
+       char tmp_daemon_pid[10] = {0, };
+       char *temp_msg = NULL;
 
-       ret = vcd_server_mgr_send_audio_streaming(pid, event, buffer, (unsigned int)len);
-       if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+       if (NULL == err_msg) {
+               SLOG(LOG_WARN, TAG_VCD, "[TIDL ERROR] Input parameter is NULL");
+               temp_msg = strdup("#NULL");
+       } else {
+               temp_msg = strdup(err_msg);
        }
 
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
-}
+       bundle* msg = bundle_create();
+       snprintf(tmp_reason, 10, "%d", reason);
+       snprintf(tmp_daemon_pid, 10, "%d", getpid());
 
-int vcd_mgr_tidl_open_connection()
-{
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] vcd_tidl_open_connection");
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_ERROR);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_REASON, tmp_reason);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_DAEMON_PID, tmp_daemon_pid);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_ERROR_MESSAGE, temp_msg);
+       
+       bundle_add_str(msg, VC_WIDGET_BUNDLE_METHOD, VCD_MANAGER_METHOD_ERROR);
+       bundle_add_str(msg, VC_WIDGET_BUNDLE_REASON, tmp_reason);
+       bundle_add_str(msg, VC_WIDGET_BUNDLE_DAEMON_PID, tmp_daemon_pid);
+       bundle_add_str(msg, VC_WIDGET_BUNDLE_ERROR_MESSAGE, temp_msg);
 
-       g_mgr_callback.create = __vc_mgr_create_cb;
-       g_mgr_callback.terminate = __vc_mgr_terminate_cb;
-       g_mgr_callback.register_cb = __vc_mgr_register_cb_cb;
-       g_mgr_callback.initialize = __vc_mgr_initialize_cb;
-       g_mgr_callback.finalize = __vc_mgr_finalize_cb;
-       g_mgr_callback.set_command = __vc_mgr_set_command_cb;
-       g_mgr_callback.unset_command = __vc_mgr_unset_command_cb;
-       g_mgr_callback.demandable_client = __vc_mgr_set_demandable_client_cb;
-       g_mgr_callback.set_audio_type = __vc_mgr_set_audio_type_cb;
-       g_mgr_callback.get_audio_type = __vc_mgr_get_audio_type_cb;
-       g_mgr_callback.set_private_data = __vc_mgr_set_private_data_cb;
-       g_mgr_callback.get_private_data = __vc_mgr_get_private_data_cb;
-       g_mgr_callback.set_client_info = __vc_mgr_set_client_info_cb;
-       g_mgr_callback.set_domain = __vc_mgr_set_domain_cb;
-       g_mgr_callback.do_action = __vc_mgr_do_action_cb;
-       g_mgr_callback.start = __vc_mgr_start_cb;
-       g_mgr_callback.stop = __vc_mgr_stop_cb;
-       g_mgr_callback.cancel = __vc_mgr_cancel_cb;
-       g_mgr_callback.set_audio_streaming_mode = __vc_mgr_set_audio_streaming_mode_cb;
-       g_mgr_callback.send_specific_engine_request = __vc_mgr_send_specific_engine_request_cb;
-       g_mgr_callback.send_result_selection = __vc_mgr_send_result_selection_cb;
-       g_mgr_callback.send_utterance_status = __vc_mgr_send_utterance_status_cb;
-       g_mgr_callback.send_audio_streaming = __vc_mgr_send_audio_streaming_cb;
+       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND SIGNAL");
 
-       int ret = -1;
-       int count = 0;
-       while (VC_RETRY_MIN_COUNT >= count) {
-               ret = rpc_port_stub_vc_mgr_register(&g_mgr_callback, NULL);
-               if (0 == ret) {
-                       SLOG(LOG_DEBUG, TAG_VCD, "register callback");
-                       return VCD_ERROR_NONE;
-               }
-               usleep(100000);
-               count++;
-       }
+       __send_signal(msg);
 
-       SLOG(LOG_ERROR, TAG_VCD, "Fail to register callback(%d)", ret);
-       return VCD_ERROR_OPERATION_FAILED;
-}
+       bundle_free(msg);
 
-int vcd_mgr_tidl_close_connection()
-{
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Close connection");
-       rpc_port_stub_vc_mgr_unregister();
+       free(temp_msg);
+       temp_msg = NULL;
 
        return VCD_ERROR_NONE;
 }
 
-// TODO: remove _tidl after all dbus removed
-int vcdc_tidl_send_hello(int pid, vcd_client_type_e type)
+int vcdc_send_request_set_private_data(int pid, const char* key, const char* data)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send hello");
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Set private data");
 
-       char tmp_pid[10] = {0, };
+       char tmp_pid[10] = { 0, };
 
        bundle* msg = bundle_create();
        snprintf(tmp_pid, 10, "%d", pid);
 
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_HELLO);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_SET_PRIVATE_DATA);
        bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_pid);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_KEY, key);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_PRIVATE_DATA, data);
 
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] VCD SEND MESSAGE");
+       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
 
-       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER);
+       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER, pid);
        bundle_free(msg);
 
        return VCD_ERROR_NONE;
 }
 
-int vcdc_send_set_volume(int manager_pid, float volume)
+int vcdc_send_feedback_audio_format_to_manager(int manager_pid, int rate, vc_audio_channel_e channel, vce_audio_type_e audio_type)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Set volume");
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send feedback audio format to manager");
 
-       char tmp_volume[20] = {0, };
+       char tmp_rate[10] = {0, };
+       char tmp_channel[10] = {0, };
+       char tmp_audio_type[10] = {0, };
 
        bundle* msg = bundle_create();
-
-       snprintf(tmp_volume, 20, "%.6f", volume);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_SET_VOLUME);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_volume);
-
+       snprintf(tmp_rate, 10, "%d", rate);
+       snprintf(tmp_channel, 10, "%d", (int)channel);
+       snprintf(tmp_audio_type, 10, "%d", (int)audio_type);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_FEEDBACK_AUDIO_FORMAT);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_AUDIO_RATE, tmp_rate);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_AUDIO_CHANNEL, tmp_channel);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_AUDIO_TYPE, tmp_audio_type);
 
        SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
-       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER);
-       if (20 == g_volume_count) {
-               SLOG(LOG_INFO, TAG_VCD, "@@ Send set volume : pid(%d), volume(%f)", manager_pid, volume);
-               g_volume_count = 0;
-       }
-       g_volume_count++;
 
+       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER, manager_pid);
        bundle_free(msg);
 
        return VCD_ERROR_NONE;
 }
-// TODO: remove tidl after all dbus migrate to tidl
-int vcdc_tidl_send_result(int pid, int manager_pid, int cmd_type)
+
+int vcdc_send_feedback_streaming_to_manager(int manager_pid, int pid, int utt_id, vc_feedback_event_e event, char* buffer, int len)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send result");
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send feedback streaming to manager");
+
+       char tmp_pid[10] = {0, };
+       char tmp_utt_id[10] = {0, };
+       char tmp_event[10] = {0, };
 
        bundle* msg = bundle_create();
+       snprintf(tmp_pid, 10, "%d", pid);
+       snprintf(tmp_utt_id, 10, "%d", utt_id);
+       snprintf(tmp_event, 10, "%d", (int)event);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_FEEDBACK_STREAMING);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_pid);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_UTTID, tmp_utt_id);
+       bundle_add_str(msg, VC_MANAGER_BUNDLE_EVENT, tmp_event);
 
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_RESULT);
+       rpc_port_stub_array_char_h streaming_data = NULL;
+       rpc_port_stub_array_char_create(&streaming_data);
+       if (NULL == streaming_data) {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to create data handle");
+               return VCD_ERROR_OUT_OF_MEMORY;
+       }
+
+       if (NULL != buffer && 0 < len) {
+               rpc_port_stub_array_char_set(streaming_data, (char*)buffer, len);
+       } else {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL] buffer is empty");
+       }
 
        SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
 
-       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER);
+       pthread_mutex_lock(&g_mgr_tidl_info_mutex);
+       SLOG(LOG_INFO, TAG_VCD, "[TIDL] message to manager");
+       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+
+       if (NULL == mgr_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get manager tidl info. pid(%d)", pid);
+               pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
+               rpc_port_stub_array_char_destroy(streaming_data);
+               bundle_free(msg);
+               return VCD_ERROR_OPERATION_FAILED;
+       }
+
+       rpc_port_stub_vc_mgr_send_buffer_cb_h handle = mgr_tidl_info->send_buffer_cb;
+       if (NULL == handle) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null");
+               pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
+               rpc_port_stub_array_char_destroy(streaming_data);
+               bundle_free(msg);
+               return VCD_ERROR_OPERATION_FAILED;
+       }
+
+       if (0 != rpc_port_stub_vc_mgr_send_buffer_cb_invoke(handle, streaming_data, msg)) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg");
+               pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
+               rpc_port_stub_array_char_destroy(streaming_data);
+               bundle_free(msg);
+               return VCD_ERROR_OPERATION_FAILED;
+       }
+       pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
+       rpc_port_stub_array_char_destroy(streaming_data);
        bundle_free(msg);
 
        return VCD_ERROR_NONE;
 }
 
-int vcdc_send_pre_result_to_manager(int manager_pid, int event, const char* pre_result)
+void vcdc_send_request_set_foreground(int pid, int value)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send pre result to manager");
-
-       char tmp_event[10] = {0, };
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Set foreground");
 
-       bundle* msg = bundle_create();
-       snprintf(tmp_event, 10, "%d", event);
+       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
 
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_PRE_RESULT);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_EVENT, tmp_event);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_PRE_RESULT, pre_result);
+       if (NULL == mgr_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to get tidl info");
+               return;
+       }
 
-       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
+       if (!mgr_tidl_info->connected) {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Not Connected");
+               return;
+       }
 
-       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER);
-       bundle_free(msg);
+       rpc_port_proxy_vcd_mgr_invoke_set_foreground(mgr_tidl_info->rpc_h, pid, value);
 
-       return VCD_ERROR_NONE;
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Request set foreground");
 }
 
-int vcdc_send_specific_engine_result_to_manager(int manager_pid, const char* engine_app_id, const char* event, const char* result)
+int vcdc_send_request_get_private_data(int pid, const char* key, char** data)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send specific engine result to manager");
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Get private data");
 
-       bundle* msg = bundle_create();
+       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
 
-       gchar *gEncodedResult = g_base64_encode((const guchar*)result, strlen(result));
+       if (NULL == mgr_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to get tidl info");
+               return VC_ERROR_OPERATION_FAILED;
+       }
 
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_SPECIFIC_ENGINE_RESULT);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_ENGINE_APP_ID, engine_app_id);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_EVENT, event);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_RESULT, gEncodedResult);
+       if (!mgr_tidl_info->connected) {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Not Connected");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       char *tmp = NULL;
+       if (0 != rpc_port_proxy_vcd_mgr_invoke_get_private_data(mgr_tidl_info->rpc_h, pid, key, &tmp)) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request vcd manager get private data : Fail to invoke message");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Request vcd manager get private data : Success");
+
+       *data = tmp;
+
+       return VC_ERROR_NONE;
+}
+
+int vcdc_send_request_auth_enable(int pid)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] auth enable");
+
+       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+
+       if (NULL == mgr_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to get tidl info");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (!mgr_tidl_info->connected) {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Not Connected");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (0 != rpc_port_proxy_vcd_mgr_invoke_auth_enable(mgr_tidl_info->rpc_h, pid)) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request auth enable : Fail to invoke message");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Request auth enable : Success");
+
+       return VC_ERROR_NONE;
+}
+
+int vcdc_send_request_auth_disable(int pid)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] auth disable");
+
+       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+
+       if (NULL == mgr_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to get tidl info");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (!mgr_tidl_info->connected) {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Not Connected");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (0 != rpc_port_proxy_vcd_mgr_invoke_auth_disable(mgr_tidl_info->rpc_h, pid)) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request auth disable : Fail to invoke message");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Request auth disable : Success");
+
+       return VC_ERROR_NONE;
+}
+
+int vcdc_send_request_auth_start(int pid)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] auth start");
+
+       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+
+       if (NULL == mgr_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to get tidl info");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (!mgr_tidl_info->connected) {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Not Connected");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (0 != rpc_port_proxy_vcd_mgr_invoke_auth_start(mgr_tidl_info->rpc_h, pid)) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request auth start : Fail to invoke message");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Request auth start : Success");
+
+       return VC_ERROR_NONE;
+}
+
+int vcdc_send_request_auth_stop(int pid)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] auth stop");
+
+       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+
+       if (NULL == mgr_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to get tidl info");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (!mgr_tidl_info->connected) {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Not Connected");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (0 != rpc_port_proxy_vcd_mgr_invoke_auth_stop(mgr_tidl_info->rpc_h, pid)) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request auth stop : Fail to invoke message");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Request auth stop : Success");
+
+       return VC_ERROR_NONE;
+}
+
+int vcdc_send_request_auth_cancel(int pid)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] auth cancel");
+
+       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+
+       if (NULL == mgr_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to get tidl info");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (!mgr_tidl_info->connected) {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Not Connected");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (0 != rpc_port_proxy_vcd_mgr_invoke_auth_cancel(mgr_tidl_info->rpc_h, pid)) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request auth cancel : Fail to invoke message");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Request auth cancel : Success");
+
+       return VC_ERROR_NONE;
+}
+
+int vcdc_send_asr_result(int pid, int event, const char* asr_result, int cmd_type, bool* is_consumed)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send asr result");
+
+       widget_tidl_info_s* widget_tidl_info = vcd_client_widget_get_tidl_info(pid);
+       
+       if (NULL == widget_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to get tidl info");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       if (!widget_tidl_info->connected) {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Not Connected");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+
+       bool temp;
+       if (0 != rpc_port_proxy_vcd_widget_invoke_send_asr_result(widget_tidl_info->rpc_h, pid, event, asr_result, &temp)) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request vcd widget send asr result : Fail to invoke message");
+               return VC_ERROR_OPERATION_FAILED;
+       }
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Request vcd widget send asr result : Success");
+
+       *is_consumed = temp;
+
+       return VC_ERROR_NONE;
+}
+
+/*
+* Tidl for manager
+*/
+static void __mgr_on_connected(rpc_port_proxy_vcd_mgr_h h, void *user_data)
+{
+       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+
+       if (NULL == mgr_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated");
+               return;
+       }
+
+       mgr_tidl_info->connected = true;
+       mgr_tidl_info->connection_requesting = false;
+
+       SLOG(LOG_INFO, TAG_VCD, "Connected to manager");
+}
+
+static void __mgr_on_disconnected(rpc_port_proxy_vcd_mgr_h h, void *user_data)
+{
+       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+
+       if (NULL == mgr_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated");
+               return;
+       }
+
+       mgr_tidl_info->connected = false;
+       mgr_tidl_info->connection_requesting = false;
+
+       SLOG(LOG_INFO, TAG_VCD, "Disonnected to manager");
+}
+
+static void __mgr_on_rejected(rpc_port_proxy_vcd_mgr_h h, void *user_data)
+{
+       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+
+       if (NULL == mgr_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated");
+               return;
+       }
+
+       mgr_tidl_info->connection_requesting = false;
+
+       SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Rejected from manager");
+}
+
+static rpc_port_proxy_vcd_mgr_h __mgr_create_rpc_port(const char* engine_app_id)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] __mgr_create_rpc_port");
+       rpc_port_proxy_vcd_mgr_callback_s rpc_callback = {
+               .connected = __mgr_on_connected,
+               .disconnected = __mgr_on_disconnected,
+               .rejected = __mgr_on_rejected
+       };
+
+       rpc_port_proxy_vcd_mgr_h handle = NULL;
+       if (0 != rpc_port_proxy_vcd_mgr_create(engine_app_id, &rpc_callback, NULL, &handle)) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create proxy");
+               return NULL;
+       }
+
+       return handle;
+}
+
+static void __vc_mgr_create_cb(rpc_port_stub_vc_mgr_context_h context, void *user_data)
+{
+       char *sender = NULL;
+
+       rpc_port_stub_vc_mgr_context_get_sender(context, &sender);
+       if (!sender){
+               SLOG(LOG_ERROR, TAG_VCD, "Sender is NULL");
+               return;
+       }
+
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ Manager connect. appid(%s)", sender);
+
+       free(sender);
+}
+
+static void __vc_mgr_terminate_cb(rpc_port_stub_vc_mgr_context_h context, void *user_data)
+{
+       pthread_mutex_lock(&g_mgr_tidl_info_mutex);
+       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+       if (NULL == mgr_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get manager tidl info.");
+               pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
+               return;
+       }
+
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VC MANAGER FINALIZE. pid(%u)", mgr_tidl_info->pid);
+
+       if (0 != vcd_client_manager_unset_tidl_notify_cb()) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to unset notify callback");
+       }
+
+       if (0 != vcd_client_manager_unset_tidl_send_buffer_cb()) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to unset send buffer callback");
+       }
+
+       if (0 != vcd_client_manager_delete_tidl_info()) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to delete manager tidl info");
+       }
+       mgr_tidl_info = NULL;
+
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+
+       pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
+
+
+       char *sender = NULL;
+       rpc_port_stub_vc_mgr_context_get_sender(context, &sender);
+       if (!sender)
+               return;
+
+       SLOG(LOG_INFO, TAG_VCD, "@@@ Manager disconnect. appid(%s)", sender);
+
+       free(sender);
+}
+
+static void  __vc_mgr_register_cb_cb(rpc_port_stub_vc_mgr_context_h context, int pid, rpc_port_stub_vc_mgr_notify_cb_h notify_callback, rpc_port_stub_vc_mgr_send_buffer_cb_h send_buffer_callback, void *user_data)
+{
+       pthread_mutex_lock(&g_mgr_tidl_info_mutex);
+       SLOG(LOG_INFO, TAG_VCD, "@@@ VC MANAGER REGISTER CALLBACK");
+
+       int ret = -1;
+       ret = vcd_client_manager_create_tidl_info(pid);
+
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create manager tidl info.");
+               pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
+        return;
+       }
+
+       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+
+       if (NULL == mgr_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get manager tidl info. pid(%d)", pid);
+               pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
+        return;
+       }
+
+       char *sender = NULL;
+       rpc_port_stub_vc_mgr_context_get_sender(context, &sender);
+
+       if (!sender){
+               SLOG(LOG_ERROR, TAG_VCD, "Sender is NULL");
+               pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
+               return;
+       }
+
+       mgr_tidl_info->rpc_h = __mgr_create_rpc_port(sender);
+
+       if (NULL == mgr_tidl_info->rpc_h) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create server proxy");
+       } else {
+               SLOG(LOG_INFO, TAG_VCD, "[TIDL] rpc_h(%p), engine_app_id(%s)", mgr_tidl_info->rpc_h, sender);
+       }
 
-       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
+       free(sender);
 
-       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER);
-       bundle_free(msg);
+       if (0 != vcd_client_manager_set_tidl_notify_cb(notify_callback, user_data)) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback");
+       } else {
+               SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set notify callback.");
+       }
 
-       if (gEncodedResult)
-               g_free(gEncodedResult);
+       if (0 != vcd_client_manager_set_tidl_send_buffer_cb(send_buffer_callback, user_data)) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set send buffer callback");
+       } else {
+               SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set send buffer callback.");
+       }
 
-       return VCD_ERROR_NONE;
+       pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
+
+       __request_tidl_connect(VCD_CLIENT_TYPE_MANAGER, pid);
+
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
 }
 
-int vcdc_send_result_to_manager(int manager_pid, int result_type)
+static int  __vc_mgr_initialize_cb(rpc_port_stub_vc_mgr_context_h context, int pid, int audio_streaming_mode, int *service_state, int *foreground, int *daemon_pid, void *user_data)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send result to manager");
+       SLOG(LOG_INFO, TAG_VCD, "@@@ VCD Manager Initialize");
 
-       char tmp_result[10] = {0, };
+       int ret = -1;
 
-       bundle* msg = bundle_create();
-       snprintf(tmp_result, 10, "%d", result_type);
+       vcd_config_set_audio_streaming_mode((vcd_audio_streaming_mode_e)audio_streaming_mode);
+       ret = vcd_server_mgr_initialize(pid, audio_streaming_mode);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               return ret;
+       }
+       *service_state = vcd_server_get_service_state();
+       *foreground = vcd_server_get_foreground();
+       *daemon_pid = getpid();
 
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_ALL_RESULT);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_result);
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr initialize : pid(%d) service state(%d) foreground(%d) daemon_pid(%d)", pid, *service_state, *foreground, *daemon_pid);
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+       return ret;
+}
+
+static int  __vc_mgr_finalize_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager Finalize");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr finalize : pid(%d)", pid);
+
+       int ret = -1;
+
+       ret = vcd_server_mgr_finalize(pid);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+       }
+
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+
+       return ret;
+}
+
+static int  __vc_mgr_set_command_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager Set command");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set command : pid(%d)", pid);
+
+       int ret = -1;
+
+       ret = vcd_server_mgr_set_command(pid);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               return ret;
+       }
+
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+
+       return ret;
+}
+
+static int  __vc_mgr_unset_command_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager unset command");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr unset command : pid(%d)", pid);
+
+       int ret = -1;
+
+       ret = vcd_server_mgr_unset_command(pid);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               return ret;
+       }
+
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+
+       return ret;
+}
+
+static int  __vc_mgr_set_demandable_client_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager Set demandable client");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set demandable client : pid(%d)", pid);
+
+       int ret = -1;
+
+       ret = vcd_server_mgr_set_demandable_client(pid);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               return ret;
+       }
+
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+
+       return ret;
+}
+
+static int  __vc_mgr_set_audio_type_cb(rpc_port_stub_vc_mgr_context_h context, int pid, const char *audio_type, void *user_data)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager set audio type");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set audio type : pid(%d), audio type(%s)", pid, audio_type);
+
+       int ret = -1;
+
+       ret = vcd_server_mgr_set_audio_type(pid, audio_type);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               return ret;
+       }
+
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+
+       return ret;
+}
+
+static int  __vc_mgr_get_audio_type_cb(rpc_port_stub_vc_mgr_context_h context, int pid, char **audio_type, void *user_data)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager get audio type");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set audio type : pid(%d)", pid);
+
+       int ret = -1;
+       char* tmp_audio_type = NULL;
+
+       ret = vcd_server_mgr_get_audio_type(pid, &tmp_audio_type);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               free(tmp_audio_type);
+               return ret;
+       }
+
+       *audio_type = strdup(tmp_audio_type);
+       free(tmp_audio_type);
+
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+
+       return ret;
+}
+
+static void  __vc_mgr_set_private_data_cb(rpc_port_stub_vc_mgr_context_h context, int pid, const char *key, const char *data, void *user_data)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager set private data");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set domain : pid(%d), key(%s), data(%s)", pid, key, data);
+
+       int ret = -1;
+
+       ret = vcd_server_mgr_set_private_data(pid, key, data);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to set private data");
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+       }
+
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+}
+
+static int  __vc_mgr_get_private_data_cb(rpc_port_stub_vc_mgr_context_h context, int pid, const char *key, char **data, void *user_data)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager get private data");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr get private data : pid(%d), key(%s)", pid, key);
+
+       int ret = -1;
+       char *temp_data = NULL;
+
+       ret = vcd_server_mgr_get_private_data(pid, key, &temp_data);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               return ret;
+       }
+       if (NULL == temp_data) {
+               SLOG(LOG_INFO, TAG_VCD, "data parameter is NULL");
+               temp_data = strdup("#NULL");
+       }
+
+       *data = strdup(temp_data);
+       free(temp_data);
 
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+
+       return ret;
+}
+
+static int  __vc_mgr_set_client_info_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager set client info");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set client info : pid(%d)", pid);
+
+       int ret = -1;
+
+       ret = vcd_server_mgr_set_client_info(pid);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               return ret;
+       }
+
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+
+       return ret;
+}
+
+static int  __vc_mgr_set_domain_cb(rpc_port_stub_vc_mgr_context_h context, int pid, const char *domain, void *user_data)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager set domain type");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set domain : pid(%d), domain(%s)", pid, domain);
+
+       int ret = -1;
+
+       ret = vcd_server_mgr_set_domain(pid, domain);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               return ret;
+       }
+
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+
+       return ret;
+}
+
+static void  __vc_mgr_do_action_cb(rpc_port_stub_vc_mgr_context_h context, int pid, int type, const char *send_event, void *user_data)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager request to do action");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr request to do action : pid(%d), type(%d) send_event(%s)", pid, type, send_event);
+
+       int ret = -1;
+
+       ret = vcd_server_mgr_do_action(pid, type, send_event);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+       }
+
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+}
+
+static int  __vc_mgr_start_cb(rpc_port_stub_vc_mgr_context_h context, int pid, int recognition_mode, bool exclusive_command_option, bool start_by_client, int disabled_cmd_type, void *user_data)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager start");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd check enabled or disabled command types. disabled cmd type(%d)", disabled_cmd_type);
+
+       int ret = -1;
+
+       vcd_server_mgr_set_disabled_command_type(pid, disabled_cmd_type);
 
-       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr start : pid(%d) recognition_mode(%d) exclusive(%d) start by client(%d)", pid, recognition_mode, exclusive_command_option, start_by_client);
+       ret = vcd_server_mgr_start((vcd_recognition_mode_e)recognition_mode, exclusive_command_option, start_by_client);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               return ret;
+       }
 
-       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER);
-       bundle_free(msg);
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
 
-       return VCD_ERROR_NONE;
+       return ret;
 }
 
-int vcdc_send_speech_detected(int manager_pid)
+static int  __vc_mgr_stop_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send speech detected");
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager stop");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr stop : pid(%d)", pid);
 
-       bundle* msg = bundle_create();
+       int ret = -1;
 
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_SPEECH_DETECTED);
+       ret = vcd_server_mgr_stop();
 
-       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               return ret;
+       }
 
-       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER);
-       bundle_free(msg);
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
 
-       return VCD_ERROR_NONE;
+       return ret;
 }
 
-int vcdc_send_service_state(vcd_state_e state)
+static int  __vc_mgr_cancel_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send service state");
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager cancel");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr cancel : pid(%d)", pid);
 
-       char tmp_state[10] = {0, };
+       int ret = -1;
 
-       bundle* msg = bundle_create();
-       snprintf(tmp_state, 10, "%d", (int)state);
+       ret = vcd_server_mgr_cancel();
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               return ret;
+       }
 
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_SET_SERVICE_STATE);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_state);
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
 
-       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
+       return ret;
+}
 
-       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER);
-       bundle_free(msg);
+static void  __vc_mgr_set_audio_streaming_mode_cb(rpc_port_stub_vc_mgr_context_h context, int pid, int mode, void *user_data)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager set audio streaming mode");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set audio streaming mode : pid(%d) mode(%d)", pid, mode);
 
-       return VCD_ERROR_NONE;
+       vcd_config_set_audio_streaming_mode((vcd_audio_streaming_mode_e)mode);
+
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
 }
 
-int vcdc_send_dialog(int manager_pid, int pid, const char* disp_text, const char* utt_text, int continuous)
+static void  __vc_mgr_send_specific_engine_request_cb(rpc_port_stub_vc_mgr_context_h context, int pid, const char *engine_app_id, const char *event, const char *request, void *user_data)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send dialog");
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager specific engine request");
 
-       char tmp_pid[10] = {0, };
-       char tmp_continuous[10] = {0, };
-       char* tmp_disp_text = NULL;
-       char* tmp_utt_text = NULL;
-       bundle* msg = bundle_create();
-       snprintf(tmp_pid, 10, "%d", pid);
-       snprintf(tmp_continuous, 10, "%d", continuous);
+       int ret = -1;
+       gsize decodingSize = 0;
+       gchar *gDecodedRequest = (gchar *)g_base64_decode((const gchar *)request, &decodingSize);
 
-       if (NULL == disp_text) {
-               tmp_disp_text = strdup("#NULL");
-       } else {
-               tmp_disp_text = strdup(disp_text);
-       }
+       if (gDecodedRequest) {
+               ret = vcd_server_mgr_send_specific_engine_request(pid, engine_app_id, event, gDecodedRequest);
+               if (0 != ret) {
+                       SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               }
 
-       if (NULL == utt_text) {
-               tmp_utt_text = strdup("#NULL");
-       } else {
-               tmp_utt_text = strdup(utt_text);
+               SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr specific engine request : pid(%d), engine_app_id(%s), event(%s), request(%s), ret(%d)", pid, engine_app_id, event, gDecodedRequest, ret);
+               g_free(gDecodedRequest);
        }
 
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_DIALOG);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_pid);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_DISP_TEXT, tmp_disp_text);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_UTT_TEXT, tmp_utt_text);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_CONTINUOUS, tmp_continuous);
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+}
 
-       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
+static void  __vc_mgr_send_result_selection_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager result selection");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr result selection : pid(%d)", pid);
 
-       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER);
-       bundle_free(msg);
-       free(tmp_disp_text);
-       free(tmp_utt_text);
+       vcd_server_mgr_result_select();
 
-       return VCD_ERROR_NONE;
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
 }
 
-int vcdc_tidl_send_error_to_manager(int manager_pid, int reason, char *err_msg)
+static void  __vc_mgr_send_utterance_status_cb(rpc_port_stub_vc_mgr_context_h context, int utt_id, int utt_status, void *user_data)
 {
-       SLOG(LOG_ERROR, TAG_VCD, "[TIDL] Send error signal to manager");
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager send utterance status");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr send utterance status : utt_id(%d), utt_status(%d)", utt_id, utt_status);
+       // TODO: send parameter to client
 
-       char tmp_reason[10] = {0, };
-       char tmp_daemon_pid[10] = {0, };
-       char *temp_msg = NULL;
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+}
 
-       if (NULL == err_msg) {
-               SLOG(LOG_WARN, TAG_VCD, "[TIDL ERROR] Input parameter is NULL");
-               temp_msg = strdup("#NULL");
-       } else {
-               temp_msg = strdup(err_msg);
-       }
+static void  __vc_mgr_send_audio_streaming_cb(rpc_port_stub_vc_mgr_context_h context, int pid, int event, rpc_port_stub_array_char_h data, void *user_data)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager send audio streaming");
 
-       bundle* msg = bundle_create();
-       snprintf(tmp_reason, 10, "%d", reason);
-       snprintf(tmp_daemon_pid, 10, "%d", getpid());
+       char* buffer = NULL;
+       int len = 0;
+       int ret = -1;
+       rpc_port_stub_array_char_get(data, &buffer, &len);
 
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_ERROR);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_REASON, tmp_reason);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_DAEMON_PID, tmp_daemon_pid);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_ERROR_MESSAGE, temp_msg);
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr send audio streaming : pid(%d), event(%d), buffer(%p), len(%d)", pid, event, buffer, len);
 
-       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
+       ret = vcd_server_mgr_send_audio_streaming(pid, event, buffer, (unsigned int)len);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+       }
 
-       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER);
-       bundle_free(msg);
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+}
 
-       free(temp_msg);
-       temp_msg = NULL;
+int vcd_mgr_tidl_open_connection()
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] vcd_mgr_tidl_open_connection");
 
-       return VCD_ERROR_NONE;
+       g_mgr_callback.create = __vc_mgr_create_cb;
+       g_mgr_callback.terminate = __vc_mgr_terminate_cb;
+       g_mgr_callback.register_cb = __vc_mgr_register_cb_cb;
+       g_mgr_callback.initialize = __vc_mgr_initialize_cb;
+       g_mgr_callback.finalize = __vc_mgr_finalize_cb;
+       g_mgr_callback.set_command = __vc_mgr_set_command_cb;
+       g_mgr_callback.unset_command = __vc_mgr_unset_command_cb;
+       g_mgr_callback.demandable_client = __vc_mgr_set_demandable_client_cb;
+       g_mgr_callback.set_audio_type = __vc_mgr_set_audio_type_cb;
+       g_mgr_callback.get_audio_type = __vc_mgr_get_audio_type_cb;
+       g_mgr_callback.set_private_data = __vc_mgr_set_private_data_cb;
+       g_mgr_callback.get_private_data = __vc_mgr_get_private_data_cb;
+       g_mgr_callback.set_client_info = __vc_mgr_set_client_info_cb;
+       g_mgr_callback.set_domain = __vc_mgr_set_domain_cb;
+       g_mgr_callback.do_action = __vc_mgr_do_action_cb;
+       g_mgr_callback.start = __vc_mgr_start_cb;
+       g_mgr_callback.stop = __vc_mgr_stop_cb;
+       g_mgr_callback.cancel = __vc_mgr_cancel_cb;
+       g_mgr_callback.set_audio_streaming_mode = __vc_mgr_set_audio_streaming_mode_cb;
+       g_mgr_callback.send_specific_engine_request = __vc_mgr_send_specific_engine_request_cb;
+       g_mgr_callback.send_result_selection = __vc_mgr_send_result_selection_cb;
+       g_mgr_callback.send_utterance_status = __vc_mgr_send_utterance_status_cb;
+       g_mgr_callback.send_audio_streaming = __vc_mgr_send_audio_streaming_cb;
+
+       int ret = -1;
+       int count = 0;
+       while (VC_RETRY_MIN_COUNT >= count) {
+               ret = rpc_port_stub_vc_mgr_register(&g_mgr_callback, NULL);
+               if (0 == ret) {
+                       SLOG(LOG_DEBUG, TAG_VCD, "register callback");
+                       return VCD_ERROR_NONE;
+               }
+               usleep(100000);
+               count++;
+       }
+
+       SLOG(LOG_ERROR, TAG_VCD, "Fail to register callback(%d)", ret);
+       return VCD_ERROR_OPERATION_FAILED;
 }
 
-// TODO: remove _tidl after remove dbus
-// TODO: make client, widget error signal
-int vcdc_tidl_send_error(int reason, char *err_msg)
+int vcd_mgr_tidl_close_connection()
 {
-       SLOG(LOG_ERROR, TAG_VCD, "[TIDL] Send error signal");
-
-       vcdc_tidl_send_error_to_manager(vcd_client_manager_get_pid(), reason, err_msg);
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Close connection");
+       rpc_port_stub_vc_mgr_unregister();
 
        return VCD_ERROR_NONE;
 }
 
-int vcdc_send_request_set_private_data(int pid, const char* key, const char* data)
+/*
+* Tidl for widget
+*/
+static void __widget_on_connected(rpc_port_proxy_vcd_widget_h h, void *user_data)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Set private data");
+       widget_tidl_info_s* widget_tidl_info = vcd_client_widget_get_tidl_info((int)user_data);
+       
+       widget_tidl_info->connected = true;
+       widget_tidl_info->connection_requesting = false;
 
-       char tmp_pid[10] = { 0, };
+       SLOG(LOG_INFO, TAG_VCD, "Connected to widget");
+}
 
-       bundle* msg = bundle_create();
-       snprintf(tmp_pid, 10, "%d", pid);
+static void __widget_on_disconnected(rpc_port_proxy_vcd_widget_h h, void *user_data)
+{
+       widget_tidl_info_s* widget_tidl_info = vcd_client_widget_get_tidl_info((int)user_data);
 
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_SET_PRIVATE_DATA);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_pid);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_KEY, key);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_PRIVATE_DATA, data);
+       widget_tidl_info->connected = false;
+       widget_tidl_info->connection_requesting = false;
 
+       SLOG(LOG_INFO, TAG_VCD, "Disonnected to widget");
+}
 
-       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
+static void __widget_on_rejected(rpc_port_proxy_vcd_widget_h h, void *user_data)
+{
+       widget_tidl_info_s* widget_tidl_info = vcd_client_widget_get_tidl_info((int)user_data);
 
-       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER);
-       bundle_free(msg);
+       widget_tidl_info->connection_requesting = false;
 
-       return VCD_ERROR_NONE;
+       SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Rejected from widget");
 }
 
-int vcdc_send_feedback_audio_format_to_manager(int manager_pid, int rate, vc_audio_channel_e channel, vce_audio_type_e audio_type)
+static rpc_port_proxy_vcd_widget_h __widget_create_rpc_port(const char* engine_app_id, int pid)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send feedback audio format to manager");
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] __widget_create_rpc_port");
+       rpc_port_proxy_vcd_widget_callback_s rpc_callback = {
+               .connected = __widget_on_connected,
+               .disconnected = __widget_on_disconnected,
+               .rejected = __widget_on_rejected
+       };
 
-       char tmp_rate[10] = {0, };
-       char tmp_channel[10] = {0, };
-       char tmp_audio_type[10] = {0, };
+       rpc_port_proxy_vcd_widget_h handle = NULL;
+       if (0 != rpc_port_proxy_vcd_widget_create(engine_app_id, &rpc_callback, (void *)pid, &handle)) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create proxy");
+               return NULL;
+       }
 
-       bundle* msg = bundle_create();
-       snprintf(tmp_rate, 10, "%d", rate);
-       snprintf(tmp_channel, 10, "%d", (int)channel);
-       snprintf(tmp_audio_type, 10, "%d", (int)audio_type);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_FEEDBACK_AUDIO_FORMAT);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_AUDIO_RATE, tmp_rate);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_AUDIO_CHANNEL, tmp_channel);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_AUDIO_TYPE, tmp_audio_type);
+       return handle;
+}
 
-       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
+static void __vc_widget_create_cb(rpc_port_stub_vc_widget_context_h context, void *user_data)
+{
+       char *sender = NULL;
 
-       __send_msg(msg, VCD_CLIENT_TYPE_MANAGER);
-       bundle_free(msg);
+       rpc_port_stub_vc_widget_context_get_sender(context, &sender);
+       if (!sender) {
+               SLOG(LOG_ERROR, TAG_VCD, "Sender is NULL");
+               return;
+       }
 
-       return VCD_ERROR_NONE;
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ Widget connect. appid(%s)", sender);
+       free(sender);
 }
 
-int vcdc_send_feedback_streaming_to_manager(int manager_pid, int pid, int utt_id, vc_feedback_event_e event, char* buffer, int len)
+static void __vc_widget_terminate_cb(rpc_port_stub_vc_widget_context_h context, void *user_data)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send feedback streaming to manager");
+       void* tag = NULL;
+       rpc_port_stub_vc_widget_context_get_tag(context, &tag);
+
+       if (NULL != tag) {
+               int pid = (intptr_t)tag;
+               SLOG(LOG_DEBUG, TAG_VCD, "@@@ VC WIDGET FINALIZE. pid(%u)", pid);
+
+               pthread_mutex_lock(&g_widget_tidl_info_mutex);
+               widget_tidl_info_s* widget_tidl_info = vcd_client_widget_get_tidl_info(pid);
+               if (NULL == widget_tidl_info) {
+                       SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get widget tidl info.");
+                       pthread_mutex_unlock(&g_widget_tidl_info_mutex);
+                       return;
+               }
 
-       char tmp_pid[10] = {0, };
-       char tmp_utt_id[10] = {0, };
-       char tmp_event[10] = {0, };
+               if (0 != vcd_client_widget_unset_tidl_notify_cb(pid)) {
+                       SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to unset notify callback");
+               }
+
+               if (0 != vcd_client_widget_delete_tidl_info(pid)) {
+                       SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to delete widget tidl info");
+               }
+               widget_tidl_info = NULL;
+
+               SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+
+               pthread_mutex_unlock(&g_widget_tidl_info_mutex);
+
+               char *sender = NULL;
+               rpc_port_stub_vc_widget_context_get_sender(context, &sender);
+               if (!sender)
+                       return;
 
-       bundle* msg = bundle_create();
-       snprintf(tmp_pid, 10, "%d", pid);
-       snprintf(tmp_utt_id, 10, "%d", utt_id);
-       snprintf(tmp_event, 10, "%d", (int)event);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_FEEDBACK_STREAMING);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_pid);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_UTTID, tmp_utt_id);
-       bundle_add_str(msg, VC_MANAGER_BUNDLE_EVENT, tmp_event);
+               SLOG(LOG_INFO, TAG_VCD, "@@@ Manager disconnect. appid(%s)", sender);
 
-       rpc_port_stub_array_char_h streaming_data = NULL;
-       rpc_port_stub_array_char_create(&streaming_data);
-       if (NULL == streaming_data) {
-               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to create data handle");
-               return VCD_ERROR_OUT_OF_MEMORY;
+               free(sender);
        }
+       rpc_port_stub_vc_widget_context_set_tag(context, NULL);
+}
 
-       if (NULL != buffer && 0 < len) {
-               rpc_port_stub_array_char_set(streaming_data, (char*)buffer, len);
-       } else {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL] buffer is empty");
+static void  __vc_widget_register_cb_cb(rpc_port_stub_vc_widget_context_h context, int pid, rpc_port_stub_vc_widget_notify_cb_h notify_callback, void *user_data)
+{
+       pthread_mutex_lock(&g_widget_tidl_info_mutex);
+       SLOG(LOG_INFO, TAG_VCD, "@@@ VC WIDGET REGISTER CALLBACK");
+
+       int ret = -1;
+       ret = vcd_client_widget_add_tidl_info(pid);
+
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add widget tidl info.");
+               pthread_mutex_unlock(&g_widget_tidl_info_mutex);
+        return;
        }
+       widget_tidl_info_s* widget_tidl_info = vcd_client_widget_get_tidl_info(pid);
 
-       SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
+       if (NULL == widget_tidl_info) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get widget tidl info. pid(%d)", pid);
+               pthread_mutex_unlock(&g_widget_tidl_info_mutex);
+        return;
+       }
 
-       pthread_mutex_lock(&g_mgr_tidl_info_mutex);
-       SLOG(LOG_INFO, TAG_VCD, "[TIDL] message to manager");
-       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+       char *sender = NULL;
+       rpc_port_stub_vc_widget_context_get_sender(context, &sender);
 
-       if (NULL == mgr_tidl_info) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get manager tidl info. pid(%d)", pid);
-               pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
-               rpc_port_stub_array_char_destroy(streaming_data);
-               bundle_free(msg);
-               return VCD_ERROR_OPERATION_FAILED;
+       if (!sender){
+               SLOG(LOG_ERROR, TAG_VCD, "Sender is NULL");
+               pthread_mutex_unlock(&g_widget_tidl_info_mutex);
+               return;
        }
 
-       rpc_port_stub_vc_mgr_send_buffer_cb_h handle = mgr_tidl_info->send_buffer_cb;
-       if (NULL == handle) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null");
-               pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
-               rpc_port_stub_array_char_destroy(streaming_data);
-               bundle_free(msg);
-               return VCD_ERROR_OPERATION_FAILED;
+       widget_tidl_info->rpc_h = __widget_create_rpc_port(sender, pid);
+
+       if (NULL == widget_tidl_info->rpc_h) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create server proxy");
+       } else {
+               SLOG(LOG_INFO, TAG_VCD, "[TIDL] rpc_h(%p), engine_app_id(%s)", widget_tidl_info->rpc_h, sender);
        }
 
-       if (0 != rpc_port_stub_vc_mgr_send_buffer_cb_invoke(handle, streaming_data, msg)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg");
-               pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
-               rpc_port_stub_array_char_destroy(streaming_data);
-               bundle_free(msg);
-               return VCD_ERROR_OPERATION_FAILED;
+       free(sender);
+
+       if (0 != vcd_client_widget_set_tidl_notify_cb(pid, notify_callback, user_data)) {
+               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback");
+       } else {
+               SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set notify callback.");
        }
-       pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
-       rpc_port_stub_array_char_destroy(streaming_data);
-       bundle_free(msg);
 
-       return VCD_ERROR_NONE;
+       pthread_mutex_unlock(&g_widget_tidl_info_mutex);
+
+       __request_tidl_connect(VCD_CLIENT_TYPE_WIDGET, pid);
+
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
 }
 
-void vcdc_send_request_set_foreground(int pid, int value)
+static int  __vc_widget_initialize_cb(rpc_port_stub_vc_widget_context_h context, int pid, int *service_state, int *daemon_pid, void *user_data)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Set foreground");
+       SLOG(LOG_INFO, TAG_VCD, "@@@ VCD Widget Initialize");
 
-       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+       uintptr_t ptr_pid = pid;
+       int ret = -1;
 
-       if (NULL == mgr_tidl_info) {
-               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to get tidl info");
-               return;
-       }
+       rpc_port_stub_vc_widget_context_set_tag(context, (void*)ptr_pid);
 
-       if (!mgr_tidl_info->connected) {
-               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Not Connected");
-               return;
+       ret = vcd_server_widget_initialize(pid);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               return ret;
        }
+       *service_state = vcd_server_get_service_state();
+       *daemon_pid = getpid();
 
-       rpc_port_proxy_vcd_mgr_invoke_set_foreground(mgr_tidl_info->rpc_h, pid, value);
-
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Request set foreground");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd widget initialize : pid(%d) service state(%d) daemon_pid(%d)", pid, *service_state, *daemon_pid);
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+       return ret;
 }
 
-int vcdc_send_request_get_private_data(int pid, const char* key, char** data)
+static int  __vc_widget_finalize_cb(rpc_port_stub_vc_widget_context_h context, int pid, void *user_data)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Get private data");
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Widget Finalize");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd widget finalize : pid(%d)", pid);
 
-       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+       int ret = -1;
 
-       if (NULL == mgr_tidl_info) {
-               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to get tidl info");
-               return VC_ERROR_OPERATION_FAILED;
+       ret = vcd_server_widget_finalize(pid);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               return ret;
        }
 
-       if (!mgr_tidl_info->connected) {
-               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Not Connected");
-               return VC_ERROR_OPERATION_FAILED;
-       }
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
 
-       char *tmp = NULL;
-       if (0 != rpc_port_proxy_vcd_mgr_invoke_get_private_data(mgr_tidl_info->rpc_h, pid, key, &tmp)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request vcd manager get private data : Fail to invoke message");
-               return VC_ERROR_OPERATION_FAILED;
+       return ret;
+}
+
+static int __vc_widget_start_recording_cb(rpc_port_stub_vc_widget_context_h context, int pid, int command, void *user_data)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Widget Start Recording");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd widget start recording : pid(%d) command(%d)", pid, command);
+
+       int ret = -1;
+
+       ret = vcd_server_widget_start_recording(pid, command);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               return ret;
        }
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Request vcd manager get private data : Success");
 
-       *data = tmp;
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
 
-       return VC_ERROR_NONE;
+       return ret;
 }
 
-int vcdc_send_request_auth_enable(int pid)
+static int __vc_widget_start_cb(rpc_port_stub_vc_widget_context_h context, int pid, int silence, void *user_data)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] auth enable");
-
-       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Widget Start");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd widget start : pid(%d) silence(%d)", pid, silence);
 
-       if (NULL == mgr_tidl_info) {
-               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to get tidl info");
-               return VC_ERROR_OPERATION_FAILED;
-       }
+       int ret = -1;
 
-       if (!mgr_tidl_info->connected) {
-               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Not Connected");
-               return VC_ERROR_OPERATION_FAILED;
+       ret = vcd_server_widget_start(pid, (bool)silence);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               return ret;
        }
 
-       if (0 != rpc_port_proxy_vcd_mgr_invoke_auth_enable(mgr_tidl_info->rpc_h, pid)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request auth enable : Fail to invoke message");
-               return VC_ERROR_OPERATION_FAILED;
-       }
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Request auth enable : Success");
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
 
-       return VC_ERROR_NONE;
+       return ret;
 }
 
-int vcdc_send_request_auth_disable(int pid)
+static int __vc_widget_stop_cb(rpc_port_stub_vc_widget_context_h context, int pid, void *user_data)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] auth disable");
-
-       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Widget Stop");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd widget stop : pid(%d)", pid);
 
-       if (NULL == mgr_tidl_info) {
-               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to get tidl info");
-               return VC_ERROR_OPERATION_FAILED;
-       }
+       int ret = -1;
 
-       if (!mgr_tidl_info->connected) {
-               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Not Connected");
-               return VC_ERROR_OPERATION_FAILED;
+       ret = vcd_server_widget_stop(pid);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               return ret;
        }
 
-       if (0 != rpc_port_proxy_vcd_mgr_invoke_auth_disable(mgr_tidl_info->rpc_h, pid)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request auth disable : Fail to invoke message");
-               return VC_ERROR_OPERATION_FAILED;
-       }
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Request auth disable : Success");
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
 
-       return VC_ERROR_NONE;
+       return ret;
 }
 
-int vcdc_send_request_auth_start(int pid)
+static int __vc_widget_cancel_cb(rpc_port_stub_vc_widget_context_h context, int pid, void *user_data)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] auth start");
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Widget Cancel");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd widget cancel : pid(%d)", pid);
 
-       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+       int ret = -1;
 
-       if (NULL == mgr_tidl_info) {
-               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to get tidl info");
-               return VC_ERROR_OPERATION_FAILED;
+       ret = vcd_server_widget_cancel(pid);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               return ret;
        }
 
-       if (!mgr_tidl_info->connected) {
-               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Not Connected");
-               return VC_ERROR_OPERATION_FAILED;
-       }
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
 
-       if (0 != rpc_port_proxy_vcd_mgr_invoke_auth_start(mgr_tidl_info->rpc_h, pid)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request auth start : Fail to invoke message");
-               return VC_ERROR_OPERATION_FAILED;
+       return ret;
+}
+
+static int __vc_widget_enable_asr_result_cb(rpc_port_stub_vc_widget_context_h context, int pid, int enable, void *user_data)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Widget Enable Asr Result");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd widget enable asr result : pid(%d) enable(%d)", pid, enable);
+
+       int ret = -1;
+
+       ret = vcd_server_widget_enable_asr_result(pid, enable);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               return ret;
        }
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Request auth start : Success");
 
-       return VC_ERROR_NONE;
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
+
+       return ret;
 }
 
-int vcdc_send_request_auth_stop(int pid)
+static void __vc_widget_set_foreground_cb(rpc_port_stub_vc_widget_context_h context, int pid, int value, void *user_data)
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] auth stop");
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Widget Set Foreground");
+       SLOG(LOG_INFO, TAG_VCD, "[IN] vcd widget set foreground : pid(%d) value(%d)", pid, value);
 
-       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+       int ret = -1;
 
-       if (NULL == mgr_tidl_info) {
-               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to get tidl info");
-               return VC_ERROR_OPERATION_FAILED;
+       ret = vcd_server_set_foreground(pid, value);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
+               return;
        }
 
-       if (!mgr_tidl_info->connected) {
-               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Not Connected");
-               return VC_ERROR_OPERATION_FAILED;
-       }
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ send request set foreground to manager");
+       vcdc_send_request_set_foreground(pid, value);
 
-       if (0 != rpc_port_proxy_vcd_mgr_invoke_auth_stop(mgr_tidl_info->rpc_h, pid)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request auth stop : Fail to invoke message");
-               return VC_ERROR_OPERATION_FAILED;
-       }
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Request auth stop : Success");
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
 
-       return VC_ERROR_NONE;
+       return;
 }
 
-int vcdc_send_request_auth_cancel(int pid)
+int vcd_widget_tidl_open_connection()
 {
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] auth cancel");
-
-       manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] vcd_widget_tidl_open_connection");
+
+       g_widget_callback.create = __vc_widget_create_cb;
+       g_widget_callback.terminate = __vc_widget_terminate_cb;
+       g_widget_callback.register_cb = __vc_widget_register_cb_cb;
+       g_widget_callback.initialize = __vc_widget_initialize_cb;
+       g_widget_callback.finalize = __vc_widget_finalize_cb;
+       g_widget_callback.start_recording = __vc_widget_start_recording_cb;
+       g_widget_callback.start = __vc_widget_start_cb;
+       g_widget_callback.stop = __vc_widget_stop_cb;
+       g_widget_callback.cancel = __vc_widget_cancel_cb;
+       g_widget_callback.enable_asr_result = __vc_widget_enable_asr_result_cb;
+       g_widget_callback.set_foreground = __vc_widget_set_foreground_cb;
 
-       if (NULL == mgr_tidl_info) {
-               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to get tidl info");
-               return VC_ERROR_OPERATION_FAILED;
+       int ret = -1;
+       int count = 0;
+       while (VC_RETRY_MIN_COUNT >= count) {
+               ret = rpc_port_stub_vc_widget_register(&g_widget_callback, NULL);
+               if (0 == ret) {
+                       SLOG(LOG_DEBUG, TAG_VCD, "register callback");
+                       return VCD_ERROR_NONE;
+               }
+               usleep(100000);
+               count++;
        }
 
-       if (!mgr_tidl_info->connected) {
-               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Not Connected");
-               return VC_ERROR_OPERATION_FAILED;
-       }
+       SLOG(LOG_ERROR, TAG_VCD, "Fail to register callback(%d)", ret);
+       return VCD_ERROR_OPERATION_FAILED;
+}
 
-       if (0 != rpc_port_proxy_vcd_mgr_invoke_auth_cancel(mgr_tidl_info->rpc_h, pid)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request auth cancel : Fail to invoke message");
-               return VC_ERROR_OPERATION_FAILED;
-       }
-       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Request auth cancel : Success");
+int vcd_widget_tidl_close_connection()
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Close connection");
+       rpc_port_stub_vc_widget_unregister();
 
-       return VC_ERROR_NONE;
+       return VCD_ERROR_NONE;
 }
index 6f339dc..84e61f8 100644 (file)
@@ -30,23 +30,25 @@ extern "C" {
 //     VCD_CLIENT_TYPE_MANAGER
 // } vcd_client_type_e;
 
-int vcd_mgr_tidl_open_connection();
+int vcd_tidl_open_connection();
 
-int vcd_mgr_tidl_close_connection();
+int vcd_tidl_close_connection();
 
 int vcdc_tidl_send_hello(int pid, vcd_client_type_e type);
 
-int vcdc_send_set_volume(int manager_pid, float volume);
+int vcdc_send_set_volume(int manger_pid, float volume);
 
-int vcdc_tidl_send_result(int pid, int manager_pid, int cmd_type);
+int vcdc_send_show_tooltip(int pid, bool show);
+
+int vcdc_tidl_send_result(int pid, int manager_pid, vcd_client_type_e type);
 
 int vcdc_send_pre_result_to_manager(int manager_pid, int event, const char* pre_result);
 
 int vcdc_send_specific_engine_result_to_manager(int manager_pid, const char* engine_app_id, const char* event, const char* result);
 
-int vcdc_send_result_to_manager(int manager_pid, int result_type);
+int vcdc_send_result_to_manager(int manger_pid, int result_type);
 
-int vcdc_send_speech_detected(int manager_pid);
+int vcdc_send_speech_detected(int manger_pid);
 
 int vcdc_tidl_send_error(int reason, char *err_msg);
 
@@ -54,17 +56,20 @@ int vcdc_tidl_send_error_to_manager(int manager_pid, int reason, char *err_msg);
 
 int vcdc_send_service_state(vcd_state_e state);
 
-int vcdc_send_dialog(int manager_pid, int pid, const char* disp_text, const char* utt_text, int continuous);
+int vcdc_send_dialog(int manger_pid, int pid, const char* disp_text, const char* utt_text, int continuous);
 
 int vcdc_send_request_set_private_data(int pid, const char* key, const char* data);
 
 int vcdc_send_request_get_private_data(int pid, const char* key, char** data);
 
+int vcdc_send_asr_result(int pid, int event, const char* asr_result, int cmd_type, bool* is_consumed);
+
 /* for TTS feedback */
 int vcdc_send_feedback_audio_format_to_manager(int manager_pid, int rate, vc_audio_channel_e channel, vce_audio_type_e audio_type);
 
 int vcdc_send_feedback_streaming_to_manager(int manager_pid, int pid, int utt_id, vc_feedback_event_e event, char* buffer, int len);
 
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/tidl/vc_widget.tidl b/tidl/vc_widget.tidl
new file mode 100644 (file)
index 0000000..662afc5
--- /dev/null
@@ -0,0 +1,14 @@
+interface vc_widget {
+       void notify_cb(bundle msg) delegate;
+       void register_cb(int pid, notify_cb notify_callback) async;
+
+       int initialize(in int pid, out int service_state, out int daemon_pid);
+       int finalize(in int pid);
+       int start_recording(in int pid, in int command);
+       int start(in int pid, in int silence);
+       int stop(in int pid);
+       int cancel(in int pid);
+       int enable_asr_result(in int pid, in int enable);
+
+       void set_foreground(in int pid, in int value) async;
+}
\ No newline at end of file
diff --git a/tidl/vcd_widget.tidl b/tidl/vcd_widget.tidl
new file mode 100644 (file)
index 0000000..9dfcefa
--- /dev/null
@@ -0,0 +1,3 @@
+interface vcd_widget {
+       int send_asr_result(in int pid, in int event, string asr_result, out bool is_consumed);
+}
\ No newline at end of file