Add document in vce.h
[platform/core/uifw/voice-control.git] / server / vcd_engine_agent.c
index 0863583..cd861bc 100644 (file)
@@ -1,18 +1,18 @@
 /*
-* 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.
-*/
+ * 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 <dlfcn.h>
 #include "vcd_engine_agent.h"
 #include "vcd_main.h"
 #include "vcd_recorder.h"
+#include "vcd_dbus.h"
 
 /*
-* Internal data structure
-*/
+ * Internal data structure
+ */
 typedef struct {
        /* engine info */
        char*   engine_uuid;
        char*   engine_name;
        char*   engine_path;
+       char*   engine_setting_path;
 
        /* engine load info */
        bool    is_set;
        bool    is_loaded;
        bool    is_command_ready;
+       bool    use_network;
        void    *handle;
 
-       vcpe_funcs_s*   pefuncs;
-       vcpd_funcs_s*   pdfuncs;
-
-       int (*vcp_load_engine)(vcpd_funcs_s* pdfuncs, vcpe_funcs_s* pefuncs);
-       int (*vcp_unload_engine)();
+       vc_engine_callback_s* callbacks;
 } vcengine_s;
 
 typedef struct _vcengine_info {
@@ -54,67 +53,34 @@ typedef struct _vcengine_info {
 
 
 /*
-* static data
-*/
+ * static data
+ */
 
 /** vc engine agent init */
 static bool g_agent_init;
 
-/** vc engine list */
-static GList *g_engine_list;
-
 /** current engine information */
 static vcengine_s g_dynamic_engine;
 
 static char* g_default_lang;
 
-/** callback functions */
-static result_callback g_result_cb = NULL;
-
-static asr_result_callback g_asr_result_cb = NULL;
-
-#if 0
-static pre_result_callback g_pre_result_cb = NULL;
-
-static nlu_result_callback g_nlu_result_cb = NULL;
-#endif
-
-static error_callback g_error_cb = NULL;
-
 bool __supported_language_cb(const char* language, void* user_data);
 
-void __engine_info_cb(const char* engine_uuid, const char* engine_name, const char* engine_setting, bool use_network, void* user_data);
-
-bool __engine_setting_cb(const char* key, const char* value, void* user_data);
-
-/** Free voice list */
-void __free_language_list(GList* lang_list);
-
-
 /*
-* Internal Interfaces
-*/
-
-/** check engine id */
-int __internal_check_engine_id(const char* engine_uuid);
-
-/** update engine list */
-int __internal_update_engine_list();
+ * Internal Interfaces
+ */
 
 /** get engine info */
-int __internal_get_engine_info(const char* filepath, vcengine_info_s** info);
-
-int __log_enginelist();
+int __internal_get_engine_info(vce_request_callback_s* callback);
 
 /*
-* VCS Engine Agent Interfaces
-*/
-//int vcd_engine_agent_init(pre_result_callback pre_result_cb, result_callback result_cb, nlu_result_callback nlu_result_cb, error_callback error_cb)
-int vcd_engine_agent_init(asr_result_callback asr_result_cb, result_callback result_cb, error_callback error_cb)
+ * VCS Engine Agent Interfaces
+ */
+int vcd_engine_agent_init()
 {
-       if (/*NULL == pre_result_cb*/ NULL == asr_result_cb || NULL == result_cb /*|| NULL == nlu_result_cb*/ || NULL == error_cb) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Input parameter is NULL");
-               return VCD_ERROR_OPERATION_FAILED;
+       if (true == g_agent_init) {
+               SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent] Already initialized");
+               return VCD_ERROR_NONE;
        }
 
        /* init dynamic engine */
@@ -126,21 +92,23 @@ int vcd_engine_agent_init(asr_result_callback asr_result_cb, result_callback res
        g_dynamic_engine.is_loaded = false;
        g_dynamic_engine.handle = NULL;
        g_dynamic_engine.is_command_ready = false;
-       g_dynamic_engine.pefuncs = (vcpe_funcs_s*)calloc(1, sizeof(vcpe_funcs_s));
-       g_dynamic_engine.pdfuncs = (vcpd_funcs_s*)calloc(1, sizeof(vcpd_funcs_s));
 
-       g_agent_init = true;
+       g_dynamic_engine.callbacks = (vc_engine_callback_s*)calloc(1, sizeof(vc_engine_callback_s));
+       if (NULL == g_dynamic_engine.callbacks) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent] Fail to allocate memory");
+               return VCD_ERROR_OUT_OF_MEMORY;
+       }
 
-       //g_pre_result_cb = pre_result_cb;
-       g_asr_result_cb = asr_result_cb;
-       g_result_cb = result_cb;
-       //g_nlu_result_cb = nlu_result_cb;
-       g_error_cb = error_cb;
+       g_agent_init = true;
 
        if (0 != vcd_config_get_default_language(&g_default_lang)) {
                SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] There is No default voice in config");
                /* Set default voice */
                g_default_lang = strdup(VC_BASE_LANGUAGE);
+               if (NULL == g_default_lang) {
+                       SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent] Fail to allocate memory");
+                       return VCD_ERROR_OUT_OF_MEMORY;
+               }
        }
 
        SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent SUCCESS] Engine Agent Initialize");
@@ -156,43 +124,19 @@ int vcd_engine_agent_release()
        }
 
        /* unload current engine */
-       vcd_engine_agent_unload_current_engine();
-
-       /* release engine list */
-       GList *iter = NULL;
-       vcengine_s *data = NULL;
-
-       if (g_list_length(g_engine_list) > 0) {
-               /* Get a first item */
-               iter = g_list_first(g_engine_list);
-
-               while (NULL != iter) {
-                       /* Get handle data from list */
-                       data = iter->data;
-                       iter = g_list_remove(iter, data);
-               }
+       if (0 != vcd_engine_agent_unload_current_engine()) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to deinitialize");
+               return VCD_ERROR_OPERATION_FAILED;
        }
 
-       g_list_free(iter);
-
        /* release current engine data */
-       if (NULL != g_dynamic_engine.pefuncs) {
-               free(g_dynamic_engine.pefuncs);
-               g_dynamic_engine.pefuncs = NULL;
-       }
-       if (NULL != g_dynamic_engine.pdfuncs) {
-               free(g_dynamic_engine.pdfuncs);
-               g_dynamic_engine.pdfuncs = NULL;
+       if (NULL != g_dynamic_engine.callbacks) {
+               free(g_dynamic_engine.callbacks);
+               g_dynamic_engine.callbacks = NULL;
        }
 
        g_agent_init = false;
 
-       //g_pre_result_cb = NULL;
-       g_asr_result_cb = NULL;
-       g_result_cb = NULL;
-       //g_nlu_result_cb = NULL;
-       g_error_cb = NULL;
-
        SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent SUCCESS] Engine Agent release");
 
        return 0;
@@ -206,496 +150,173 @@ bool vcd_engine_is_available_engine()
        return false;
 }
 
-int vcd_engine_agent_initialize_current_engine()
+int __internal_get_engine_info(vce_request_callback_s* callback)
 {
-       /* check agent init */
-       if (false == g_agent_init) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Not Initialized");
-               return VCD_ERROR_OPERATION_FAILED;
-       }
+       SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent] inside __internal_get_engine_info");
 
-       /* update engine list */
-       if (0 != __internal_update_engine_list()) {
-               SLOG(LOG_ERROR, TAG_VCD, "[engine agent] vcd_engine_agent_init : __internal_update_engine_list : no engine error");
+       if (NULL == callback) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Invalid engine");
                return VCD_ERROR_ENGINE_NOT_FOUND;
        }
 
-       /* check whether engine id is valid or not.*/
-       GList *iter = NULL;
-       vcengine_info_s *dynamic_engine = NULL;
-
-       if (g_list_length(g_engine_list) > 0) {
-               /*Get a first item*/
-               iter = g_list_first(g_engine_list);
-
-               while (NULL != iter) {
-                       /*Get handle data from list*/
-                       dynamic_engine = iter->data;
-                       if (NULL != dynamic_engine) {
-                               break;
-                       }
-
-                       /*Get next item*/
-                       iter = g_list_next(iter);
-               }
-       } else {
+       if (NULL == callback->get_info) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Invalid engine");
                return VCD_ERROR_ENGINE_NOT_FOUND;
        }
 
-       if (NULL == dynamic_engine) {
+       if (0 != callback->get_info(&(g_dynamic_engine.engine_uuid), &(g_dynamic_engine.engine_name), &(g_dynamic_engine.engine_setting_path), &(g_dynamic_engine.use_network))) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to get engine info");
                return VCD_ERROR_ENGINE_NOT_FOUND;
-       } else {
-               if (NULL != g_dynamic_engine.engine_uuid) {
-                       /* set data from g_engine_list */
-                       if (g_dynamic_engine.engine_uuid != NULL)       free(g_dynamic_engine.engine_uuid);
-                       if (g_dynamic_engine.engine_name != NULL)       free(g_dynamic_engine.engine_name);
-                       if (g_dynamic_engine.engine_path != NULL)       free(g_dynamic_engine.engine_path);
-               }
-
-               g_dynamic_engine.engine_uuid = g_strdup(dynamic_engine->engine_uuid);
-               g_dynamic_engine.engine_name = g_strdup(dynamic_engine->engine_name);
-               g_dynamic_engine.engine_path = g_strdup(dynamic_engine->engine_path);
-
-               g_dynamic_engine.handle = NULL;
-               g_dynamic_engine.is_loaded = false;
-               g_dynamic_engine.is_set = true;
-
-               SLOG(LOG_DEBUG, TAG_VCD, "-----");
-               SLOG(LOG_DEBUG, TAG_VCD, " Dynamic engine uuid : %s", g_dynamic_engine.engine_uuid);
-               SLOG(LOG_DEBUG, TAG_VCD, " Dynamic engine name : %s", g_dynamic_engine.engine_name);
-               SLOG(LOG_DEBUG, TAG_VCD, " Dynamic engine path : %s", g_dynamic_engine.engine_path);
-               SLOG(LOG_DEBUG, TAG_VCD, "-----");
-
-       }
-
-       return 0;
-}
-
-int __internal_check_engine_id(const char* engine_uuid)
-{
-       if (NULL == engine_uuid) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Invalid Parameter");
-               return VCD_ERROR_INVALID_PARAMETER;
-       }
-
-       GList *iter = NULL;
-       vcengine_s *data = NULL;
-
-       if (0 < g_list_length(g_engine_list)) {
-               /*Get a first item*/
-               iter = g_list_first(g_engine_list);
-
-               while (NULL != iter) {
-                       data = iter->data;
-
-                       if (0 == strncmp(engine_uuid, data->engine_uuid, strlen(data->engine_uuid))) {
-                               return 0;
-                       }
-
-                       iter = g_list_next(iter);
-               }
-       }
-
-       return -1;
-}
-
-void __engine_info_cb(const char* engine_uuid, const char* engine_name, const char* engine_setting, bool use_network, void* user_data)
-{
-       vcengine_info_s* temp = (vcengine_info_s*)user_data;
-
-       temp->engine_uuid = g_strdup(engine_uuid);
-       temp->engine_name = g_strdup(engine_name);
-}
-
-
-int __internal_get_engine_info(const char* filepath, vcengine_info_s** info)
-{
-       if (NULL == filepath || NULL == info) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Invalid Parameter");
-               return VCD_ERROR_INVALID_PARAMETER;
-       }
-
-       /* load engine */
-       char *error;
-       void* handle;
-
-       handle = dlopen(filepath, RTLD_LAZY);
-       if (!handle) {
-               SLOG(LOG_WARN, TAG_VCD, "[Engine Agent] Invalid engine : %s", filepath);
-               if ((error = dlerror()) != NULL) {
-                       SLOG(LOG_ERROR, TAG_VCD, "[ERROR] %s", error);
-               }
-               return -1;
-       }
-
-       /* link engine to daemon */
-       dlsym(handle, "vcp_load_engine");
-       if ((error = dlerror()) != NULL) {
-               SLOG(LOG_WARN, TAG_VCD, "[Engine Agent] Invalid engine. Fail to open vcp_load_engine : %s", filepath);
-               dlclose(handle);
-               return -1;
-       }
-
-       dlsym(handle, "vcp_unload_engine");
-       if ((error = dlerror()) != NULL) {
-               SLOG(LOG_WARN, TAG_VCD, "[Engine Agent] Invalid engine. Fail to open vcp_unload_engine : %s", filepath);
-               dlclose(handle);
-               return -1;
        }
 
-       int (*get_engine_info)(vcpe_engine_info_cb callback, void* user_data);
-
-       get_engine_info = (int (*)(vcpe_engine_info_cb, void*))dlsym(handle, "vcp_get_engine_info");
-       if (NULL != (error = dlerror()) || NULL == get_engine_info) {
-               SLOG(LOG_WARN, TAG_VCD, "[Engine Agent WARNING] Invalid engine. Fail to open vcp_get_engine_info : %s", filepath);
-               dlclose(handle);
-               return -1;
+       if (NULL != g_dynamic_engine.callbacks) {
+               free(g_dynamic_engine.callbacks);
+               g_dynamic_engine.callbacks = NULL;
        }
-
-       vcengine_info_s* temp;
-       temp = (vcengine_info_s*)calloc(1, sizeof(vcengine_info_s));
-       if (NULL == temp) {
-               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to allocate memory");
-               dlclose(handle);
+       g_dynamic_engine.callbacks = (vc_engine_callback_s*)calloc(1, sizeof(vc_engine_callback_s));
+       if (NULL == g_dynamic_engine.callbacks) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to allocate memory");
                return VCD_ERROR_OUT_OF_MEMORY;
        }
 
-       /* get engine info */
-       if (0 != get_engine_info(__engine_info_cb, (void*)temp)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to get engine info from engine");
-               dlclose(handle);
-               free(temp);
-               return -1;
-       }
-
-       /* close engine */
-       dlclose(handle);
-
-       temp->engine_path = g_strdup(filepath);
-
-       SLOG(LOG_DEBUG, TAG_VCD, "----- Valid Engine");
-       SLOG(LOG_DEBUG, TAG_VCD, "Engine uuid : %s", temp->engine_uuid);
-       SLOG(LOG_DEBUG, TAG_VCD, "Engine name : %s", temp->engine_name);
-       SLOG(LOG_DEBUG, TAG_VCD, "Engine path : %s", temp->engine_path);
-       SLOG(LOG_DEBUG, TAG_VCD, "-----");
-       SLOG(LOG_DEBUG, TAG_VCD, "  ");
-
-       *info = temp;
-
-       return 0;
-}
-
-int __internal_update_engine_list()
-{
-       /* relsease engine list */
-       GList *iter = NULL;
-       vcengine_info_s *data = NULL;
-
-       if (0 < g_list_length(g_engine_list)) {
-               /* Get a first item */
-               iter = g_list_first(g_engine_list);
-
-               while (NULL != iter) {
-                       /* Get handle data from list */
-                       data = iter->data;
-
-                       if (NULL != data) {
-                               if (NULL != data->engine_uuid)          free(data->engine_uuid);
-                               if (NULL != data->engine_path)          free(data->engine_path);
-                               if (NULL != data->engine_name)          free(data->engine_name);
-
-                               free(data);
-                       }
-
-                       g_engine_list = g_list_remove_link(g_engine_list, iter);
-                       iter = g_list_first(g_engine_list);
-               }
-       }
-
-       /* Get file name from default engine directory */
-       DIR *dp = NULL;
-       int ret = -1;
-       struct dirent entry;
-       struct dirent *dirp = NULL;
-
-       dp  = opendir(VC_DEFAULT_ENGINE);
-       if (NULL != dp) {
-               do {
-                       ret = readdir_r(dp, &entry, &dirp);
-                       if (0 != ret) {
-                               SLOG(LOG_ERROR, TAG_VCD, "[File ERROR] Fail to read directory");
-                               break;
-                       }
-
-                       if (NULL != dirp) {
-                               vcengine_info_s* info = NULL;
-                               char* filepath = NULL;
-                               int filesize = 0;
-
-                               filesize = strlen(VC_DEFAULT_ENGINE) + strlen(dirp->d_name) + 5;
-                               filepath = (char*)calloc(filesize, sizeof(char));
-
-                               if (NULL != filepath) {
-                                       snprintf(filepath, filesize, "%s/%s", VC_DEFAULT_ENGINE, dirp->d_name);
-                               } else {
-                                       SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Memory not enough!!");
-                                       continue;
-                               }
-
-                               /* get its info and update engine list */
-                               if (0 == __internal_get_engine_info(filepath, &info)) {
-                                       /* add engine info to g_engine_list */
-                                       g_engine_list = g_list_append(g_engine_list, info);
-                               }
-
-                               if (NULL != filepath) {
-                                       free(filepath);
-                                       filepath = NULL;
-                               }
-                       }
-               } while (NULL != dirp);
-
-               closedir(dp);
-       } else {
-               SLOG(LOG_WARN, TAG_VCD, "[Engine Agent WARNING] Fail to open default directory");
-       }
-
-       if (0 >= g_list_length(g_engine_list)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] No Engine");
-               return VCD_ERROR_ENGINE_NOT_FOUND;
-       }
-
-       __log_enginelist();
+       g_dynamic_engine.callbacks->get_info = callback->get_info;
+       g_dynamic_engine.callbacks->get_recording_format = callback->get_recording_format;
+       g_dynamic_engine.callbacks->foreach_langs = callback->foreach_langs;
+       g_dynamic_engine.callbacks->is_lang_supported = callback->is_lang_supported;
+       g_dynamic_engine.callbacks->initialize = callback->initialize;
+       g_dynamic_engine.callbacks->deinitialize = callback->deinitialize;
+       g_dynamic_engine.callbacks->set_language = callback->set_language;
+       g_dynamic_engine.callbacks->set_commands = callback->set_commands;
+       g_dynamic_engine.callbacks->unset_commands = callback->unset_commands;
+
+       g_dynamic_engine.callbacks->start = callback->start;
+       g_dynamic_engine.callbacks->set_recording = callback->set_recording;
+       g_dynamic_engine.callbacks->stop = callback->stop;
+       g_dynamic_engine.callbacks->cancel = callback->cancel;
+       g_dynamic_engine.callbacks->set_domain = callback->set_domain;
+       g_dynamic_engine.callbacks->set_audio_type = callback->set_audio_type;
+       g_dynamic_engine.callbacks->process_text = callback->process_text;
+       g_dynamic_engine.callbacks->process_list_event = callback->process_list_event;
+       g_dynamic_engine.callbacks->process_haptic_event = callback->process_haptic_event;
+
+       g_dynamic_engine.callbacks->private_data_set = NULL;
+       g_dynamic_engine.callbacks->private_data_request = NULL;
+       g_dynamic_engine.callbacks->nlu_base_info_request = NULL;
+
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@ Valid Engine");
+       SLOG(LOG_DEBUG, TAG_VCD, "Engine uuid : %s", g_dynamic_engine.engine_uuid);
+       SLOG(LOG_DEBUG, TAG_VCD, "Engine name : %s", g_dynamic_engine.engine_name);
+       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
 
        return 0;
 }
 
-
-int __foreach_command(vcp_cmd_h vc_command, vcpd_foreach_command_cb callback, void* user_data)
-{
-       SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent] Request foreach command from engine");
-       return vcd_client_foreach_command((client_foreach_command_cb)callback, user_data);
-}
-
-int __command_get_length(vcp_cmd_h vc_command)
-{
-       SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent] Request command length from engine");
-       return vcd_client_get_length();
-}
-
-int __get_audio_type(char** audio_type)
-{
-       SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent] Request audio type");
-
-       return vcd_recorder_get(audio_type);
-}
-
-void __result_cb(vcp_result_event_e event, int* result_id, int count, const char* all_result, const char* non_fixed, const char* nlu_result, const char* msg, void *user_data)
-{
-       SLOG(LOG_DEBUG, TAG_VCD, "[Engine agent] Event(%d), Count(%d) Text(%s) Nonfixed(%s) NLU result(%s) Msg(%s)", event, count, all_result, non_fixed, nlu_result, msg);
-
-       if (NULL != g_result_cb) {
-               g_result_cb(event, result_id, count, all_result, non_fixed, nlu_result, msg, user_data);
-       } else {
-               SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent ERROR] Result callback function is NOT valid");
-       }
-
-       return;
-}
-
-void __asr_result_cb(vcp_asr_result_event_e event, const char* asr_result, void *user_data)
-{
-       SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent] ASR result -  Event(%d), Result(%s)", event, asr_result);
-
-       if (NULL != g_asr_result_cb) {
-               g_asr_result_cb(event, asr_result, user_data);
-       } else {
-               SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent ERROR] ASR result callback function is NOT valid");
-       }
-
-       return;
-}
-
-void __error_cb(vcp_error_e error, const char* msg, void *user_data)
+int vcd_engine_agent_load_current_engine(vce_request_callback_s* callback)
 {
-       SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent] ERROR(%d)", error);
+       SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent] load current engine START");
 
-       if (NULL != g_error_cb) {
-               g_error_cb(error, msg, user_data);
-       } else {
-               SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent ERROR] Error callback function is NOT vaild");
-       }
-
-       return;
-}
-
-int __load_engine(vcengine_s* engine)
-{
-       /* check whether current engine is loaded or not */
-       if (true == engine->is_loaded) {
-               SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent] Engine has already been loaded ");
-               return 0;
-       }
-
-       SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent] Current engine path : %s", engine->engine_path);
-
-       /* open engine */
-       char *error;
-       engine->handle = dlopen(engine->engine_path, RTLD_LAZY);
-
-       if ((error = dlerror()) != NULL || !engine->handle) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to get engine handle");
-               return VCD_ERROR_OPERATION_FAILED;
-       }
-
-       engine->vcp_unload_engine = (int (*)())dlsym(engine->handle, "vcp_unload_engine");
-       if ((error = dlerror()) != NULL) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to link daemon to vcp_unload_engine()");
-               dlclose(engine->handle);
+       if (false == g_agent_init) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Not Initialized");
                return VCD_ERROR_OPERATION_FAILED;
        }
 
-       engine->vcp_load_engine = (int (*)(vcpd_funcs_s*, vcpe_funcs_s*))dlsym(engine->handle, "vcp_load_engine");
-       if (NULL != (error = dlerror()) || NULL == engine->vcp_load_engine) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to link daemon to vcp_load_engine()");
-               dlclose(engine->handle);
-               return VCD_ERROR_OPERATION_FAILED;
+       if (true == g_dynamic_engine.is_loaded) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent] Engine has already been loaded");
+               return 0;
        }
 
-       /* load engine */
-       engine->pdfuncs->version = 1;
-       engine->pdfuncs->size = sizeof(vcpd_funcs_s);
-
-       engine->pdfuncs->foreach_command = __foreach_command;
-       engine->pdfuncs->get_command_count = __command_get_length;
-       engine->pdfuncs->get_audio_type = __get_audio_type;
-
-       if (0 != engine->vcp_load_engine(engine->pdfuncs, engine->pefuncs)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail vcp_load_engine()");
-               dlclose(engine->handle);
-               return VCD_ERROR_OPERATION_FAILED;
+       if (NULL == callback) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Invalid engine");
+               return VCD_ERROR_ENGINE_NOT_FOUND;
        }
 
-       SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent] engine info : version(%d), size(%d)", engine->pefuncs->version, engine->pefuncs->size);
-
-       /* engine error check */
-       if (engine->pefuncs->size != sizeof(vcpe_funcs_s)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Engine is not valid");
-               return VCD_ERROR_OPERATION_FAILED;
+       /* Get current engine info */
+       int ret = __internal_get_engine_info(callback);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to get engine info");
+               return ret;
        }
 
        /* Check all engine functions */
-       if (NULL == engine->pefuncs->initialize ||
-               NULL == engine->pefuncs->deinitialize ||
-               NULL == engine->pefuncs->get_recording_format ||
-               NULL == engine->pefuncs->foreach_langs ||
-               NULL == engine->pefuncs->is_lang_supported ||
-               NULL == engine->pefuncs->set_result_cb ||
-               NULL == engine->pefuncs->set_language ||
-               NULL == engine->pefuncs->set_commands ||
-               NULL == engine->pefuncs->unset_commands ||
-               NULL == engine->pefuncs->start ||
-               NULL == engine->pefuncs->set_recording ||
-               NULL == engine->pefuncs->stop ||
-               NULL == engine->pefuncs->cancel ||
-               NULL == engine->pefuncs->set_asr_result_cb ||
-               //NULL == engine->pefuncs->set_pre_result_cb ||
-               NULL == engine->pefuncs->set_error_cb ||
-               NULL == engine->pefuncs->set_domain ||
-               NULL == engine->pefuncs->get_nlu_base_info ||
-               //NULL == engine->pefuncs->set_nlu_result_cb ||
-               NULL == engine->pefuncs->set_private_data ||
-               NULL == engine->pefuncs->get_private_data ||
-               NULL == engine->pefuncs->process_text ||
-               NULL == engine->pefuncs->process_list_event ||
-               NULL == engine->pefuncs->process_haptic_event) {
+       if (NULL == g_dynamic_engine.callbacks->get_info ||
+                       NULL == g_dynamic_engine.callbacks->get_recording_format ||
+                       NULL == g_dynamic_engine.callbacks->foreach_langs ||
+                       NULL == g_dynamic_engine.callbacks->is_lang_supported ||
+                       NULL == g_dynamic_engine.callbacks->initialize ||
+                       NULL == g_dynamic_engine.callbacks->deinitialize ||
+                       NULL == g_dynamic_engine.callbacks->set_language ||
+                       NULL == g_dynamic_engine.callbacks->set_commands ||
+                       NULL == g_dynamic_engine.callbacks->unset_commands ||
+                       NULL == g_dynamic_engine.callbacks->start ||
+                       NULL == g_dynamic_engine.callbacks->set_recording ||
+                       NULL == g_dynamic_engine.callbacks->stop ||
+                       NULL == g_dynamic_engine.callbacks->cancel ||
+                       NULL == g_dynamic_engine.callbacks->set_audio_type ||
+                       NULL == g_dynamic_engine.callbacks->set_domain ||
+                       NULL == g_dynamic_engine.callbacks->process_text ||
+                       NULL == g_dynamic_engine.callbacks->process_list_event ||
+                       NULL == g_dynamic_engine.callbacks->process_haptic_event) {
                SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] The current engine is NOT valid");
-               return VCD_ERROR_OPERATION_FAILED;
+               return VCD_ERROR_ENGINE_NOT_FOUND;
        }
 
        /* initalize engine */
-       if (0 != engine->pefuncs->initialize()) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to initialize vc-engine");
-               return VCD_ERROR_OPERATION_FAILED;
-       }
-
-       if (0 != engine->pefuncs->set_result_cb(__result_cb, NULL)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to set result callback of vc-engine");
-               return VCD_ERROR_OPERATION_FAILED;
+       ret = g_dynamic_engine.callbacks->initialize();
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to initialize vc engine service");
+               return ret;
        }
 
-       if (0 != engine->pefuncs->set_asr_result_cb(__asr_result_cb, NULL)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to set asr result callback of vc-engine");
-               return VCD_ERROR_OPERATION_FAILED;
-       }
+       /* set the supported language */
+       if (true == g_dynamic_engine.callbacks->is_lang_supported(g_default_lang)) {
+               ret = g_dynamic_engine.callbacks->set_language(g_default_lang);
+               if (0 != ret) {
+                       SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to set the supported language");
+                       return ret;
+               }
 
-       if (0 != engine->pefuncs->set_error_cb(__error_cb, NULL)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to set error callback of vc-engine");
+               SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent SUCCESS] The %s has been loaded!!!", g_dynamic_engine.engine_name);
+               g_dynamic_engine.is_loaded = true;
+       } else {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent WARNING] This engine do not support default language : lang(%s)", g_default_lang);
+               g_dynamic_engine.is_loaded = false;
                return VCD_ERROR_OPERATION_FAILED;
        }
 
-       /* load engine */
-       if (true == engine->pefuncs->is_lang_supported(g_default_lang)) {
-               if (0 != engine->pefuncs->set_language(g_default_lang)) {
-                       SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to load current engine");
-                       return VCD_ERROR_OPERATION_FAILED;
-               }
-               SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent SUCCESS] The %s has been loaded !!!", engine->engine_name);
-               engine->is_loaded = true;
-       } else {
-               SLOG(LOG_WARN, TAG_VCD, "[Engine Agent WARNING] This engine do not support default language : lang(%s)", g_default_lang);
-               engine->is_loaded = false;
-       }
+       SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent] load current engine FINISH");
 
        return 0;
 }
 
-int vcd_engine_agent_load_current_engine()
+int vcd_engine_agent_unload_current_engine()
 {
        if (false == g_agent_init) {
                SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Not Initialized");
                return VCD_ERROR_OPERATION_FAILED;
        }
 
-       if (true == g_dynamic_engine.is_set) {
-               if (0 != __load_engine(&g_dynamic_engine)) {
-                       SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to load dynamic engine");
-
-                       /* need to initialize dynamic engine data */
-                       g_dynamic_engine.is_loaded = false;
-               } else {
-                       SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent SUCCESS] Load dynamic engine");
-               }
+       if (false == g_dynamic_engine.is_loaded) {
+               SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent] Engine has already been unloaded");
+               return VCD_ERROR_NONE;
        }
 
-       return 0;
-}
-
-int vcd_engine_agent_unload_current_engine()
-{
-       if (false == g_agent_init) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Not Initialized ");
-               return VCD_ERROR_OPERATION_FAILED;
+       /* shut down engine */
+       int ret = 0;
+       ret = g_dynamic_engine.callbacks->deinitialize();
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to deinitialize");
        }
 
-       if (true == g_dynamic_engine.is_set) {
-               /* unload dynamic engine */
-               if (true == g_dynamic_engine.is_loaded) {
-                       /* shutdown engine */
-                       g_dynamic_engine.pefuncs->deinitialize();
-                       g_dynamic_engine.vcp_unload_engine();
-                       dlclose(g_dynamic_engine.handle);
-                       g_dynamic_engine.handle = NULL;
-                       g_dynamic_engine.is_loaded = false;
-               }
-       }
+       /* reset current engine data */
+       g_dynamic_engine.is_loaded = false;
+
        return 0;
 }
 
 
 /*
-* VCS Engine Interfaces for client
-*/
+ * VCS Engine Interfaces for client
+ */
 
 int vcd_engine_set_commands()
 {
@@ -708,7 +329,7 @@ int vcd_engine_set_commands()
 
        if (true == g_dynamic_engine.is_loaded) {
                /* Set dynamic command */
-               ret = g_dynamic_engine.pefuncs->set_commands((vcp_cmd_h)0);
+               ret = g_dynamic_engine.callbacks->set_commands((vce_cmd_h)0);
                if (0 != ret) {
                        SLOG(LOG_WARN, TAG_VCD, "[Engine Agent ERROR] Fail to set command of dynamic engine : error(%d)", ret);
                        g_dynamic_engine.is_command_ready = false;
@@ -735,7 +356,7 @@ int vcd_engine_recognize_start(bool silence)
        SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent] silence is %s", silence ? "true" : "false");
 
        if (true == g_dynamic_engine.is_loaded && true == g_dynamic_engine.is_command_ready) {
-               ret = g_dynamic_engine.pefuncs->start(silence);
+               ret = g_dynamic_engine.callbacks->start(silence);
                if (0 != ret) {
                        SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent] Fail to start engine error(%d)", ret);
                        return VCD_ERROR_OPERATION_FAILED;
@@ -749,7 +370,7 @@ int vcd_engine_recognize_start(bool silence)
        return 0;
 }
 
-int vcd_engine_recognize_audio(const void* data, unsigned int length, vcp_speech_detect_e* speech_detected)
+int vcd_engine_recognize_audio(const void* data, unsigned int length, vce_speech_detect_e* speech_detected)
 {
        if (false == g_agent_init) {
                SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Not Initialized");
@@ -764,10 +385,10 @@ int vcd_engine_recognize_audio(const void* data, unsigned int length, vcp_speech
        int ret = -1;
 
        if (true == g_dynamic_engine.is_loaded) {
-               ret = g_dynamic_engine.pefuncs->set_recording(data, length, speech_detected);
+               ret = g_dynamic_engine.callbacks->set_recording(data, length, speech_detected);
                if (0 != ret) {
                        SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to set recording dynamic engine error(%d)", ret);
-                       if (VCP_ERROR_OUT_OF_NETWORK == ret) {
+                       if (VCE_ERROR_OUT_OF_NETWORK == ret) {
                                return VCD_ERROR_TIMED_OUT;
                        }
                        return VCD_ERROR_OPERATION_FAILED;
@@ -786,7 +407,7 @@ int vcd_engine_recognize_stop()
 
        if (true == g_dynamic_engine.is_loaded) {
                int ret = -1;
-               ret = g_dynamic_engine.pefuncs->stop();
+               ret = g_dynamic_engine.callbacks->stop();
                if (0 != ret) {
                        SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to stop dynamic engine error(%d)", ret);
                        return VCD_ERROR_OPERATION_FAILED;
@@ -808,7 +429,7 @@ int vcd_engine_recognize_cancel()
 
        int ret = -1;
        if (true == g_dynamic_engine.is_loaded) {
-               ret = g_dynamic_engine.pefuncs->cancel();
+               ret = g_dynamic_engine.callbacks->cancel();
                if (0 != ret) {
                        SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to cancel dynamic engine error(%d)", ret);
                        return VCD_ERROR_OPERATION_FAILED;
@@ -818,6 +439,25 @@ int vcd_engine_recognize_cancel()
        return 0;
 }
 
+int vcd_engine_set_audio_type(const char* audio)
+{
+       if (false == g_agent_init) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Not Initialized");
+               return VCD_ERROR_OPERATION_FAILED;
+       }
+
+       int ret = -1;
+       if (true == g_dynamic_engine.is_loaded) {
+               ret = g_dynamic_engine.callbacks->set_audio_type(audio);
+               if (0 != ret) {
+                       SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to set audio type(%d)", ret);
+                       return VCD_ERROR_OPERATION_FAILED;
+               }
+       }
+
+       return 0;
+}
+
 int vcd_engine_set_domain(int pid, const char* domain)
 {
        if (false == g_agent_init) {
@@ -827,7 +467,7 @@ int vcd_engine_set_domain(int pid, const char* domain)
 
        int ret = -1;
        if (true == g_dynamic_engine.is_loaded) {
-               ret = g_dynamic_engine.pefuncs->set_domain(domain);
+               ret = g_dynamic_engine.callbacks->set_domain(domain);
                if (0 != ret) {
                        SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to set domain (%d)", ret);
                        return VCD_ERROR_OPERATION_FAILED;
@@ -850,12 +490,15 @@ int vcd_engine_get_nlu_base_info(int pid, const char* key, char** value)
        }
 
        int ret = -1;
-       if (true == g_dynamic_engine.is_loaded) {
-               ret = g_dynamic_engine.pefuncs->get_nlu_base_info(key, value);
+       if (true == g_dynamic_engine.is_loaded && NULL != g_dynamic_engine.callbacks->nlu_base_info_request) {
+               ret = g_dynamic_engine.callbacks->nlu_base_info_request(key, value);
                if (0 != ret) {
                        SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to get nlu base info (%d)", ret);
                        return VCD_ERROR_OPERATION_FAILED;
                }
+       } else {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Engine is not loaded or There is no nlu_base_info_request callback");
+               return VCD_ERROR_OPERATION_FAILED;
        }
 
        return 0;
@@ -869,12 +512,15 @@ int vcd_engine_set_private_data(int pid, const char* key, const char* data)
        }
 
        int ret = -1;
-       if (true == g_dynamic_engine.is_loaded) {
-               ret = g_dynamic_engine.pefuncs->set_private_data(key, data);
+       if (true == g_dynamic_engine.is_loaded && NULL != g_dynamic_engine.callbacks->private_data_set) {
+               ret = g_dynamic_engine.callbacks->private_data_set(key, data);
                if (0 != ret) {
                        SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to set private data (%d)", ret);
                        return VCD_ERROR_OPERATION_FAILED;
                }
+       } else {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Engine is not loaded or There is no private_data_set callback");
+               return VCD_ERROR_OPERATION_FAILED;
        }
 
        return 0;
@@ -893,12 +539,15 @@ int vcd_engine_get_private_data(int pid, const char* key, char** data)
        }
 
        int ret = -1;
-       if (true == g_dynamic_engine.is_loaded) {
-               ret = g_dynamic_engine.pefuncs->get_private_data(key, data);
+       if (true == g_dynamic_engine.is_loaded && NULL != g_dynamic_engine.callbacks->private_data_request) {
+               ret = g_dynamic_engine.callbacks->private_data_request(key, data);
                if (0 != ret) {
                        SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to get private data (%d)", ret);
                        return VCD_ERROR_OPERATION_FAILED;
                }
+       } else {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Engine is not loaded or There is no private_data_request callback");
+               return VCD_ERROR_OPERATION_FAILED;
        }
 
        return 0;
@@ -913,7 +562,7 @@ int vcd_engine_process_text(int pid, const char* text)
 
        int ret = -1;
        if (true == g_dynamic_engine.is_loaded) {
-               ret = g_dynamic_engine.pefuncs->process_text(text);
+               ret = g_dynamic_engine.callbacks->process_text(text);
                if (0 != ret) {
                        SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to process text (%d)", ret);
                        return VCD_ERROR_OPERATION_FAILED;
@@ -932,7 +581,7 @@ int vcd_engine_process_list_event(int pid, const char* event)
 
        int ret = -1;
        if (true == g_dynamic_engine.is_loaded) {
-               ret = g_dynamic_engine.pefuncs->process_list_event(event);
+               ret = g_dynamic_engine.callbacks->process_list_event(event);
                if (0 != ret) {
                        SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to process list event (%d)", ret);
                        return VCD_ERROR_OPERATION_FAILED;
@@ -951,7 +600,7 @@ int vcd_engine_process_haptic_event(int pid, const char* event)
 
        int ret = -1;
        if (true == g_dynamic_engine.is_loaded) {
-               ret = g_dynamic_engine.pefuncs->process_haptic_event(event);
+               ret = g_dynamic_engine.callbacks->process_haptic_event(event);
                if (0 != ret) {
                        SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to process haptic event (%d)", ret);
                        return VCD_ERROR_OPERATION_FAILED;
@@ -962,10 +611,10 @@ int vcd_engine_process_haptic_event(int pid, const char* event)
 }
 
 /*
-* VCS Engine Interfaces for client and setting
-*/
+ * VCS Engine Interfaces for client and setting
+ */
 
-int vcd_engine_get_audio_format(const char* audio_id, vcp_audio_type_e* types, int* rate, int* channels)
+int vcd_engine_get_audio_format(const char* audio_id, vce_audio_type_e* types, int* rate, int* channels)
 {
        if (false == g_agent_init) {
                SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Not Initialized");
@@ -976,12 +625,7 @@ int vcd_engine_get_audio_format(const char* audio_id, vcp_audio_type_e* types, i
                SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Engine is not loaded");
        }
 
-       if (NULL == g_dynamic_engine.pefuncs->get_recording_format) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] The function of engine is NULL!!");
-               return VCD_ERROR_OPERATION_FAILED;
-       }
-
-       int ret = g_dynamic_engine.pefuncs->get_recording_format(audio_id, types, rate, channels);
+       int ret = g_dynamic_engine.callbacks->get_recording_format(audio_id, types, rate, channels);
        if (0 != ret) {
                SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] get recording format(%d)", ret);
                return VCD_ERROR_OPERATION_FAILED;
@@ -1019,12 +663,7 @@ int vcd_engine_supported_langs(GList** lang_list)
                SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Engine is not loaded");
        }
 
-       if (NULL == g_dynamic_engine.pefuncs->foreach_langs) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] The function of engine is NULL!!");
-               return VCD_ERROR_OPERATION_FAILED;
-       }
-
-       int ret = g_dynamic_engine.pefuncs->foreach_langs(__supported_language_cb, (void*)lang_list);
+       int ret = g_dynamic_engine.callbacks->foreach_langs(__supported_language_cb, (void*)lang_list);
        if (0 != ret) {
                SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] get language list error(%d)", ret);
                return VCD_ERROR_OPERATION_FAILED;
@@ -1069,7 +708,7 @@ int vcd_engine_set_current_language(const char* language)
        if (true == g_dynamic_engine.is_loaded) {
                g_dynamic_engine.is_command_ready = false;
 
-               ret = g_dynamic_engine.pefuncs->set_language(language);
+               ret = g_dynamic_engine.callbacks->set_language(language);
                if (0 != ret) {
                        SLOG(LOG_WARN, TAG_VCD, "[Engine Agent] Fail to set language of dynamic engine error(%d, %s)", ret, language);
                }
@@ -1080,63 +719,113 @@ int vcd_engine_set_current_language(const char* language)
        return 0;
 }
 
-void __free_language_list(GList* lang_list)
+int vcd_engine_agent_get_foreach_command(vce_cmd_h vce_command, vce_command_cb callback, void* user_data)
 {
-       GList *iter = NULL;
-       char* data = NULL;
+       SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent] Request foreach command from engine");
+       return vcd_client_foreach_command((client_foreach_command_cb)callback, user_data);
+}
+
+int vcd_engine_agent_get_command_count(vce_cmd_h vce_command)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent] Request command length from engine");
+
+       return vcd_client_get_length();
+}
 
-       /* if list have item */
-       if (g_list_length(lang_list) > 0) {
-               /* Get a first item */
-               iter = g_list_first(lang_list);
+int vcd_engine_agent_get_audio_type(char** audio_type)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent] Request audio type");
 
-               while (NULL != iter) {
-                       data = iter->data;
+       return vcd_recorder_get(audio_type);
+}
 
-                       if (NULL != data)
-                               free(data);
+int vcd_engine_agent_set_private_data(const char* key, const char* data)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent] Request set private data, key(%s), data(%s)", key, data);
+       vcdc_send_request_set_private_data(vcd_client_manager_get_pid(), key, data);
 
-                       lang_list = g_list_remove_link(lang_list, iter);
+       return VCD_ERROR_NONE;
+}
 
-                       iter = g_list_first(lang_list);
-               }
+int vcd_engine_agent_get_private_data(const char* key, char** data)
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent] Request get private data, key(%s)", key);
+       vcdc_send_request_get_private_data(vcd_client_manager_get_pid(), key, data);
+
+       return VCD_ERROR_NONE;
+}
+
+int vcd_engine_agent_start_recording()
+{
+       SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent] Request start recording");
+
+       int ret = vcd_recorder_start();
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to start recorder : result(%d)", ret);
+               vcd_engine_recognize_cancel();
+               /* Send error cb to manager */
+               vcdc_send_error_signal_to_manager(vcd_client_manager_get_pid(), VCD_ERROR_OPERATION_FAILED, "voice_engine.error.proc_fail");
+               return ret;
        }
+
+       return VCD_ERROR_NONE;
 }
 
-int __log_enginelist()
+int vcd_engine_agent_stop_recording()
 {
-       GList *iter = NULL;
-       vcengine_info_s *data = NULL;
+       SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent] Request stop recording");
+
+       return vcd_recorder_stop();
+}
 
-       if (0 < g_list_length(g_engine_list)) {
+int vcd_engine_agent_set_private_data_set_cb(vce_private_data_set_cb callback_func)
+{
+       if (false == g_agent_init) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Not Initialized");
+               return VCD_ERROR_OPERATION_FAILED;
+       }
 
-               /* Get a first item */
-               iter = g_list_first(g_engine_list);
+       if (false == g_dynamic_engine.is_loaded) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Not loaded engine");
+               return VCD_ERROR_OPERATION_FAILED;
+       }
 
-               SLOG(LOG_DEBUG, TAG_VCD, "--------------- engine list -------------------");
+       g_dynamic_engine.callbacks->private_data_set = callback_func;
 
-               int i = 1;
-               while (NULL != iter) {
-                       /* Get handle data from list */
-                       data = iter->data;
+       return VCD_ERROR_NONE;
+}
 
-                       SLOG(LOG_DEBUG, TAG_VCD, "[%dth]", i);
-                       SLOG(LOG_DEBUG, TAG_VCD, "  engine uuid : %s", data->engine_uuid);
-                       SLOG(LOG_DEBUG, TAG_VCD, "  engine name : %s", data->engine_name);
-                       SLOG(LOG_DEBUG, TAG_VCD, "  engine path : %s", data->engine_path);
-                       iter = g_list_next(iter);
-                       i++;
-               }
-               SLOG(LOG_DEBUG, TAG_VCD, "----------------------------------------------");
-       } else {
-               SLOG(LOG_DEBUG, TAG_VCD, "-------------- engine list -------------------");
-               SLOG(LOG_DEBUG, TAG_VCD, "  No Engine in engine directory");
-               SLOG(LOG_DEBUG, TAG_VCD, "----------------------------------------------");
+int vcd_engine_agent_set_private_data_requested_cb(vce_private_data_requested_cb callback_func)
+{
+       if (false == g_agent_init) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Not Initialized");
+               return VCD_ERROR_OPERATION_FAILED;
        }
 
-       return 0;
+       if (false == g_dynamic_engine.is_loaded) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Not loaded engine");
+               return VCD_ERROR_OPERATION_FAILED;
+       }
+
+       g_dynamic_engine.callbacks->private_data_request = callback_func;
+
+       return VCD_ERROR_NONE;
 }
 
+int vcd_engine_agent_set_nlu_base_info_requested_cb(vce_nlu_base_info_requested_cb callback_func)
+{
+       if (false == g_agent_init) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Not Initialized");
+               return VCD_ERROR_OPERATION_FAILED;
+       }
 
+       if (false == g_dynamic_engine.is_loaded) {
+               SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Not loaded engine");
+               return VCD_ERROR_OPERATION_FAILED;
+       }
 
+       g_dynamic_engine.callbacks->nlu_base_info_request = callback_func;
+
+       return VCD_ERROR_NONE;
+}