return;
}
pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
- } 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_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_vcd_stub_vc_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_vcd_stub_vc_notify_cb_invoke(handle, pid, 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_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_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_vcd_stub_vc_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_vcd_stub_vc_notify_cb_invoke(handle, pid, 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);
pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
pthread_mutex_lock(&g_client_tidl_info_mutex);
- // get all pids
- int* client_list = NULL;
+ // get all pids
+ int* client_list = NULL;
int client_count = 0;
- int ret = -1;
- ret = vcd_client_get_tidl_list(&client_list, &client_count);
+ int ret = -1;
+ ret = vcd_client_get_tidl_list(&client_list, &client_count);
- client_tidl_info_s* client_tidl_info;
- int pid = -1;
+ client_tidl_info_s* client_tidl_info = NULL;
+ int pid = -1;
if (0 == ret && 0 < client_count) {
- for (int i = 0 ; i < client_count ; i++) {
- pid = client_list[i];
+ for (int i = 0 ; i < client_count ; i++) {
+ pid = client_list[i];
- client_tidl_info = vcd_client_get_tidl_info(pid);
- if (NULL == client_tidl_info) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get tidl info. pid(%d)", pid);
- continue;
- }
+ client_tidl_info = vcd_client_get_tidl_info(pid);
+ if (NULL == client_tidl_info) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get tidl info. pid(%d)", pid);
+ continue;
+ }
- if (0 != rpc_port_stub_vcd_stub_vc_notify_cb_invoke(client_tidl_info->notify_cb, pid, msg)) {
+ if (0 != rpc_port_stub_vcd_stub_vc_notify_cb_invoke(client_tidl_info->notify_cb, pid, msg)) {
SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg");
continue;
- }
- }
- }
+ }
+ }
+ }
pthread_mutex_unlock(&g_client_tidl_info_mutex);
pthread_mutex_lock(&g_widget_tidl_info_mutex);
*/
static void __vc_create_cb(rpc_port_stub_vcd_stub_vc_context_h context, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_create_cb");
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_create_cb");
char *sender = NULL;
rpc_port_stub_vcd_stub_vc_context_get_sender(context, &sender);
if (!sender) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Sender is NULL");
- return ;
- }
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Sender is NULL");
+ return;
+ }
SLOG(LOG_INFO, TAG_VCD, "[TIDL] sender(%s)", sender); // sender (app_id)
- free(sender);
+ free(sender);
}
static void __vc_terminate_cb(rpc_port_stub_vcd_stub_vc_context_h context, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_terminate_cb");
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_terminate_cb");
void* tag = NULL;
rpc_port_stub_vcd_stub_vc_context_get_tag(context, &tag);
static void __vc_register_notify_cb_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, rpc_port_stub_vcd_stub_vc_notify_cb_h callback, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_register_notify_cb_cb. pid(%d)", pid);
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_register_notify_cb_cb. pid(%d)", pid);
- if (NULL == callback) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null.");
- return ;
- }
+ if (NULL == callback) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null.");
+ return;
+ }
- int ret = -1;
- ret = vcd_client_add_tidl_info(pid);
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info.");
- return ;
- }
+ int ret = -1;
+ ret = vcd_client_add_tidl_info(pid);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info.");
+ return;
+ }
- ret = vcd_client_set_tidl_notify_cb(pid, callback, user_data);
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback.");
- } else {
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set notify callback.");
- }
+ ret = vcd_client_set_tidl_notify_cb(pid, callback, user_data);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback.");
+ } else {
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set notify callback.");
+ }
}
static int __vc_register_notify_cb_sync_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, rpc_port_stub_vcd_stub_vc_notify_cb_h callback, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_register_notify_cb_sync_cb. pid(%d)", pid);
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_register_notify_cb_sync_cb. pid(%d)", pid);
- if (NULL == callback) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null.");
- return VCD_ERROR_INVALID_PARAMETER;
- }
+ if (NULL == callback) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null.");
+ return VCD_ERROR_INVALID_PARAMETER;
+ }
- int ret = -1;
- ret = vcd_client_add_tidl_info(pid);
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info.");
- return ret;
- }
-
- ret = vcd_client_set_tidl_notify_cb(pid, callback, user_data);
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback.");
- } else {
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set notify callback.");
- }
+ int ret = -1;
+ ret = vcd_client_add_tidl_info(pid);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info.");
+ return ret;
+ }
+
+ ret = vcd_client_set_tidl_notify_cb(pid, callback, user_data);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback.");
+ } else {
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set notify callback.");
+ }
- return ret;
+ return ret;
}
static void __vc_register_feedback_cb_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, rpc_port_stub_vcd_stub_vc_feedback_cb_h callback, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_register_feedback_cb_cb. pid(%d)", pid);
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_register_feedback_cb_cb. pid(%d)", pid);
- if (NULL == callback) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null.");
- return ;
- }
+ if (NULL == callback) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null.");
+ return;
+ }
- int ret = -1;
- ret = vcd_client_add_tidl_info(pid);
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info.");
- return ;
- }
+ int ret = -1;
+ ret = vcd_client_add_tidl_info(pid);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info.");
+ return;
+ }
- ret = vcd_client_set_tidl_feedback_cb(pid, callback, user_data);
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set feedback callback.");
- } else {
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set feedback callback.");
- }
+ ret = vcd_client_set_tidl_feedback_cb(pid, callback, user_data);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set feedback callback.");
+ } else {
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set feedback callback.");
+ }
}
static int __vc_register_feedback_cb_sync_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, rpc_port_stub_vcd_stub_vc_feedback_cb_h callback, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_register_feedback_cb_sync_cb. pid(%d)", pid);
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_register_feedback_cb_sync_cb. pid(%d)", pid);
- if (NULL == callback) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null.");
- return VCD_ERROR_INVALID_PARAMETER;
- }
+ if (NULL == callback) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null.");
+ return VCD_ERROR_INVALID_PARAMETER;
+ }
- int ret = -1;
- ret = vcd_client_add_tidl_info(pid);
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info.");
- return ret;
- }
-
- ret = vcd_client_set_tidl_feedback_cb(pid, callback, user_data);
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set feedback callback.");
- } else {
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set feedback callback.");
- }
+ int ret = -1;
+ ret = vcd_client_add_tidl_info(pid);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info.");
+ return ret;
+ }
+
+ ret = vcd_client_set_tidl_feedback_cb(pid, callback, user_data);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set feedback callback.");
+ } else {
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set feedback callback.");
+ }
- return ret;
+ return ret;
}
static int __vc_initialize_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int *mgr_pid, int *service_state, int *daemon_pid, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_initialize_cb. pid(%d)", pid);
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_initialize_cb. pid(%d)", pid);
- int ret = VCD_ERROR_OPERATION_FAILED;
+ int ret = VCD_ERROR_OPERATION_FAILED;
uintptr_t ptr_pid = pid;
rpc_port_stub_vcd_stub_vc_context_set_tag(context, (void*)ptr_pid);
- ret = vcd_server_initialize(pid);
- *service_state = vcd_server_get_service_state();
- *daemon_pid = getpid();
- *mgr_pid = vcd_client_manager_get_pid();
+ ret = vcd_server_initialize(pid);
+ *service_state = vcd_server_get_service_state();
+ *daemon_pid = getpid();
+ *mgr_pid = vcd_client_manager_get_pid();
- if (VCD_ERROR_NONE == ret) {
- SLOG(LOG_INFO, TAG_VCD, "[IN] vcd initialize : pid(%d) daemon_pid(%d)", pid, *daemon_pid);
- } else {
- SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd initialize : pid(%d) daemon_pid(%d) ret(%d)", pid, *daemon_pid, ret);
- }
+ if (VCD_ERROR_NONE == ret) {
+ SLOG(LOG_INFO, TAG_VCD, "[IN] vcd initialize : pid(%d) daemon_pid(%d)", pid, *daemon_pid);
+ } else {
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd initialize : pid(%d) daemon_pid(%d) ret(%d)", pid, *daemon_pid, ret);
+ }
- return ret;
+ return ret;
}
static int __vc_finalize_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_finalize_cb");
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_finalize_cb");
- int ret = VCD_ERROR_OPERATION_FAILED;
+ int ret = VCD_ERROR_OPERATION_FAILED;
- ret = vcd_server_finalize(pid);
- if (VCD_ERROR_NONE == ret) {
- SLOG(LOG_INFO, TAG_VCD, "[IN] vcd finalize : pid(%d)", pid);
- } else {
- SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd finalize : pid(%d) ret(%d)", pid, ret);
- }
+ ret = vcd_server_finalize(pid);
+ if (VCD_ERROR_NONE == ret) {
+ SLOG(LOG_INFO, TAG_VCD, "[IN] vcd finalize : pid(%d)", pid);
+ } else {
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd finalize : pid(%d) ret(%d)", pid, ret);
+ }
- return ret;
+ return ret;
}
static int __vc_set_command_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int cmd_type, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_set_command_cb");
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_set_command_cb");
- int ret = VCD_ERROR_OPERATION_FAILED;
+ int ret = VCD_ERROR_OPERATION_FAILED;
- ret = vcd_server_set_command(pid, (vc_cmd_type_e)cmd_type);
- if (VCD_ERROR_NONE == ret) {
- SLOG(LOG_INFO, TAG_VCD, "[IN] vcd set command : pid(%d), cmd_type(%d)", pid, cmd_type);
- } else {
- SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd set command : pid(%d), cmd_type(%d) ret(%d)", pid, cmd_type, ret);
- }
+ ret = vcd_server_set_command(pid, (vc_cmd_type_e)cmd_type);
+ if (VCD_ERROR_NONE == ret) {
+ SLOG(LOG_INFO, TAG_VCD, "[IN] vcd set command : pid(%d), cmd_type(%d)", pid, cmd_type);
+ } else {
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd set command : pid(%d), cmd_type(%d) ret(%d)", pid, cmd_type, ret);
+ }
- return ret;
+ return ret;
}
static int __vc_unset_command_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int cmd_type, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_unset_command_cb");
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_unset_command_cb");
- int ret = VCD_ERROR_OPERATION_FAILED;
+ int ret = VCD_ERROR_OPERATION_FAILED;
- ret = vcd_server_unset_command(pid, (vc_cmd_type_e)cmd_type);
- if (VCD_ERROR_NONE == ret) {
- SLOG(LOG_INFO, TAG_VCD, "[IN] vcd unset command : pid(%d), cmd_type(%d)", pid, cmd_type);
- } else {
- SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd unset command : pid(%d), cmd_type(%d) ret(%d)", pid, cmd_type, ret);
- }
-
- return ret;
+ ret = vcd_server_unset_command(pid, (vc_cmd_type_e)cmd_type);
+ if (VCD_ERROR_NONE == ret) {
+ SLOG(LOG_INFO, TAG_VCD, "[IN] vcd unset command : pid(%d), cmd_type(%d)", pid, cmd_type);
+ } else {
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd unset command : pid(%d), cmd_type(%d) ret(%d)", pid, cmd_type, ret);
+ }
+
+ return ret;
}
static int __vc_set_foreground_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, bool value, void *user_data)
{
- // check more...
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_set_foreground_cb");
+ // check more...
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_set_foreground_cb");
- int ret = VCD_ERROR_OPERATION_FAILED;
+ int ret = VCD_ERROR_OPERATION_FAILED;
- ret = vcd_server_set_foreground(pid, value);
- if (VCD_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd set foreground : pid(%d) ret(%d)", pid, ret);
- return ret;
- }
-
- SLOG(LOG_INFO, TAG_VCD, "[IN] vcd set foreground : pid(%d)", pid);
- vcdc_send_request_set_foreground(pid, value);
+ ret = vcd_server_set_foreground(pid, value);
+ if (VCD_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd set foreground : pid(%d) ret(%d)", pid, ret);
+ return ret;
+ }
+
+ SLOG(LOG_INFO, TAG_VCD, "[IN] vcd set foreground : pid(%d)", pid);
+ vcdc_send_request_set_foreground(pid, value);
- return ret;
+ return ret;
}
static int __vc_set_server_dialog_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, const char *app_id, const char *credential, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_set_server_dialog_cb");
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_set_server_dialog_cb");
- int ret = VCD_ERROR_OPERATION_FAILED;
+ int ret = VCD_ERROR_OPERATION_FAILED;
- ret = vcd_server_set_server_dialog(pid, app_id, credential);
- if (VCD_ERROR_NONE == ret) {
- SLOG(LOG_INFO, TAG_VCD, "[IN] vcd set server dialog : pid(%d), app_id(%s)", pid, app_id);
- } else {
- SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd set server dialog : pid(%d), app_id(%s) ret(%d)", pid, app_id, ret);
- }
-
- return ret;
+ ret = vcd_server_set_server_dialog(pid, app_id, credential);
+ if (VCD_ERROR_NONE == ret) {
+ SLOG(LOG_INFO, TAG_VCD, "[IN] vcd set server dialog : pid(%d), app_id(%s)", pid, app_id);
+ } else {
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd set server dialog : pid(%d), app_id(%s) ret(%d)", pid, app_id, ret);
+ }
+
+ return ret;
}
static int __vc_request_dialog_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, const char *disp_text, const char *utt_text, bool continuous, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_request_dialog_cb");
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_request_dialog_cb");
- int ret = VCD_ERROR_OPERATION_FAILED;
+ int ret = VCD_ERROR_OPERATION_FAILED;
- ret = vcd_server_dialog(pid, disp_text, utt_text, continuous);
- if (VCD_ERROR_NONE == ret) {
- SLOG(LOG_INFO, TAG_VCD, "[IN] vcd request dialog : pid(%d), disp_text(%s), utt_text(%s), continuous(%d)", pid, disp_text, utt_text, continuous);
- } else {
- SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd request dialog : pid(%d), disp_text(%s), utt_text(%s), continuous(%d), ret(%d)", pid, disp_text, utt_text, continuous, ret);
- }
-
- return ret;
+ ret = vcd_server_dialog(pid, disp_text, utt_text, continuous);
+ if (VCD_ERROR_NONE == ret) {
+ SLOG(LOG_INFO, TAG_VCD, "[IN] vcd request dialog : pid(%d), disp_text(%s), utt_text(%s), continuous(%d)", pid, disp_text, utt_text, continuous);
+ } else {
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd request dialog : pid(%d), disp_text(%s), utt_text(%s), continuous(%d), ret(%d)", pid, disp_text, utt_text, continuous, ret);
+ }
+
+ return ret;
}
static int __vc_is_system_command_valid_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, bool *is_sys_cmd_valid, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_is_system_command_valid_cb");
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_is_system_command_valid_cb");
- int ret = VCD_ERROR_OPERATION_FAILED;
+ int ret = VCD_ERROR_OPERATION_FAILED;
- ret = vcd_server_is_system_command_valid(pid, (int*)is_sys_cmd_valid);
- if (VCD_ERROR_NONE == ret) {
- SLOG(LOG_INFO, TAG_VCD, "[IN] vcd check system command is valid : pid(%d), is_sys_cmd_valid(%d)", pid, *is_sys_cmd_valid);
- } else {
- SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd check system command is valid : pid(%d), ret(%d)", pid, ret);
- }
-
- return ret;
+ ret = vcd_server_is_system_command_valid(pid, (int*)is_sys_cmd_valid);
+ if (VCD_ERROR_NONE == ret) {
+ SLOG(LOG_INFO, TAG_VCD, "[IN] vcd check system command is valid : pid(%d), is_sys_cmd_valid(%d)", pid, *is_sys_cmd_valid);
+ } else {
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd check system command is valid : pid(%d), ret(%d)", pid, ret);
+ }
+
+ return ret;
}
static int __vc_auth_enable_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int mgr_pid, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_enable_cb. Send a request to vc_mgr");
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_enable_cb. Send a request to vc_mgr");
- int ret = VCD_ERROR_OPERATION_FAILED;
- ret = vcdc_send_request_auth_enable(pid);
- if (VCD_ERROR_NONE == ret) {
- SLOG(LOG_INFO, TAG_VCD, "[SUCCESS] Send request auth enable. pid(%d), mgr_pid(%d)", pid, mgr_pid);
- } else {
- SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send request auth enable. ret(%d), pid(%d), mgr_pid(%d)", ret, pid, mgr_pid);
- }
+ int ret = VCD_ERROR_OPERATION_FAILED;
+ ret = vcdc_send_request_auth_enable(pid);
+ if (VCD_ERROR_NONE == ret) {
+ SLOG(LOG_INFO, TAG_VCD, "[SUCCESS] Send request auth enable. pid(%d), mgr_pid(%d)", pid, mgr_pid);
+ } else {
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send request auth enable. ret(%d), pid(%d), mgr_pid(%d)", ret, pid, mgr_pid);
+ }
- return ret;
+ return ret;
}
static int __vc_auth_disable_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int mgr_pid, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_disable_cb. Send a request to vc_mgr");
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_disable_cb. Send a request to vc_mgr");
- int ret = VCD_ERROR_OPERATION_FAILED;
- ret = vcdc_send_request_auth_disable(pid);
- if (VCD_ERROR_NONE == ret) {
- SLOG(LOG_INFO, TAG_VCD, "[SUCCESS] Send request auth disable. pid(%d), mgr_pid(%d)", pid, mgr_pid);
- } else {
- SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send request auth disable. ret(%d), pid(%d), mgr_pid(%d)", ret, pid, mgr_pid);
- }
+ int ret = VCD_ERROR_OPERATION_FAILED;
+ ret = vcdc_send_request_auth_disable(pid);
+ if (VCD_ERROR_NONE == ret) {
+ SLOG(LOG_INFO, TAG_VCD, "[SUCCESS] Send request auth disable. pid(%d), mgr_pid(%d)", pid, mgr_pid);
+ } else {
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send request auth disable. ret(%d), pid(%d), mgr_pid(%d)", ret, pid, mgr_pid);
+ }
- return ret;
+ return ret;
}
static int __vc_auth_start_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int mgr_pid, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_start_cb. Send a request to vc_mgr");
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_start_cb. Send a request to vc_mgr");
- int ret = VCD_ERROR_OPERATION_FAILED;
- ret = vcdc_send_request_auth_start(pid);
- if (VCD_ERROR_NONE == ret) {
- SLOG(LOG_INFO, TAG_VCD, "[SUCCESS] Send request auth start. pid(%d), mgr_pid(%d)", pid, mgr_pid);
- } else {
- SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send request auth start. ret(%d), pid(%d), mgr_pid(%d)", ret, pid, mgr_pid);
- }
+ int ret = VCD_ERROR_OPERATION_FAILED;
+ ret = vcdc_send_request_auth_start(pid);
+ if (VCD_ERROR_NONE == ret) {
+ SLOG(LOG_INFO, TAG_VCD, "[SUCCESS] Send request auth start. pid(%d), mgr_pid(%d)", pid, mgr_pid);
+ } else {
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send request auth start. ret(%d), pid(%d), mgr_pid(%d)", ret, pid, mgr_pid);
+ }
- return ret;
+ return ret;
}
static int __vc_auth_stop_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int mgr_pid, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_stop_cb. Send a request to vc_mgr");
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_stop_cb. Send a request to vc_mgr");
- int ret = VCD_ERROR_OPERATION_FAILED;
- ret = vcdc_send_request_auth_stop(pid);
- if (VCD_ERROR_NONE == ret) {
- SLOG(LOG_INFO, TAG_VCD, "[SUCCESS] Send request auth stop. pid(%d), mgr_pid(%d)", pid, mgr_pid);
- } else {
- SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send request auth stop. ret(%d), pid(%d), mgr_pid(%d)", ret, pid, mgr_pid);
- }
+ int ret = VCD_ERROR_OPERATION_FAILED;
+ ret = vcdc_send_request_auth_stop(pid);
+ if (VCD_ERROR_NONE == ret) {
+ SLOG(LOG_INFO, TAG_VCD, "[SUCCESS] Send request auth stop. pid(%d), mgr_pid(%d)", pid, mgr_pid);
+ } else {
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send request auth stop. ret(%d), pid(%d), mgr_pid(%d)", ret, pid, mgr_pid);
+ }
- return ret;
+ return ret;
}
static int __vc_auth_cancel_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int mgr_pid, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_cancel_cb. Send a request to vc_mgr");
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_cancel_cb. Send a request to vc_mgr");
- int ret = VCD_ERROR_OPERATION_FAILED;
- ret = vcdc_send_request_auth_cancel(pid);
- if (VCD_ERROR_NONE == ret) {
- SLOG(LOG_INFO, TAG_VCD, "[SUCCESS] Send request auth cancel. pid(%d), mgr_pid(%d)", pid, mgr_pid);
- } else {
- SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send request auth cancel. ret(%d), pid(%d), mgr_pid(%d)", ret, pid, mgr_pid);
- }
+ int ret = VCD_ERROR_OPERATION_FAILED;
+ ret = vcdc_send_request_auth_cancel(pid);
+ if (VCD_ERROR_NONE == ret) {
+ SLOG(LOG_INFO, TAG_VCD, "[SUCCESS] Send request auth cancel. pid(%d), mgr_pid(%d)", pid, mgr_pid);
+ } else {
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send request auth cancel. ret(%d), pid(%d), mgr_pid(%d)", ret, pid, mgr_pid);
+ }
- return ret;
+ return ret;
}
static int __vc_request_tts_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, const char *text, const char *lang, bool to_vcm, int *utt_id, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_request_tts_cb");
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_request_tts_cb");
- int ret = VCD_ERROR_OPERATION_FAILED;
+ int ret = VCD_ERROR_OPERATION_FAILED;
- ret = vcd_server_request_tts(pid, text, lang, to_vcm, utt_id);
- if (VCD_ERROR_NONE == ret) {
- SLOG(LOG_INFO, TAG_VCD, "[IN] vcd request tts : pid(%d), text(%s), language(%s), to_vcm(%d)", pid, text, lang, to_vcm);
- } else {
- SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd request tts : pid(%d), text(%s), language(%s), to_vcm(%d), ret(%d)", pid, text, lang, to_vcm, ret);
- }
-
- return ret;
+ ret = vcd_server_request_tts(pid, text, lang, to_vcm, utt_id);
+ if (VCD_ERROR_NONE == ret) {
+ SLOG(LOG_INFO, TAG_VCD, "[IN] vcd request tts : pid(%d), text(%s), language(%s), to_vcm(%d)", pid, text, lang, to_vcm);
+ } else {
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd request tts : pid(%d), text(%s), language(%s), to_vcm(%d), ret(%d)", pid, text, lang, to_vcm, ret);
+ }
+
+ return ret;
}
static int __vc_cancel_tts_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int utt_id, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_cancel_tts_cb");
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_cancel_tts_cb");
- int ret = VCD_ERROR_OPERATION_FAILED;
+ int ret = VCD_ERROR_OPERATION_FAILED;
- ret = vcd_server_cancel_tts(pid, utt_id);
- if (VCD_ERROR_NONE == ret) {
- SLOG(LOG_INFO, TAG_VCD, "[IN] vcd cancel tts : pid(%d), utt_id(%d)", pid, utt_id);
- } else {
- SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd cancel tts : pid(%d), utt_id(%d), ret(%d)", pid, utt_id, ret);
- }
-
- return ret;
+ ret = vcd_server_cancel_tts(pid, utt_id);
+ if (VCD_ERROR_NONE == ret) {
+ SLOG(LOG_INFO, TAG_VCD, "[IN] vcd cancel tts : pid(%d), utt_id(%d)", pid, utt_id);
+ } else {
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd cancel tts : pid(%d), utt_id(%d), ret(%d)", pid, utt_id, ret);
+ }
+
+ return ret;
}
static int __vc_get_tts_audio_format_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int *rate, int *channel, int *audio_type, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_get_tts_audio_format_cb");
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_get_tts_audio_format_cb");
- int ret = VCD_ERROR_OPERATION_FAILED;
+ int ret = VCD_ERROR_OPERATION_FAILED;
- ret = vcd_server_get_tts_audio_format(pid, rate, channel, audio_type);
- if (VCD_ERROR_NONE == ret) {
- SLOG(LOG_INFO, TAG_VCD, "[IN] vcd get tts audio format : pid(%d), rate(%d), channel(%d), audio_type(%d)", pid, *rate, *channel, *audio_type);
- } else {
- SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd get tts audio format : pid(%d) ret(%d)", pid, ret);
- }
-
- return ret;
+ ret = vcd_server_get_tts_audio_format(pid, rate, channel, audio_type);
+ if (VCD_ERROR_NONE == ret) {
+ SLOG(LOG_INFO, TAG_VCD, "[IN] vcd get tts audio format : pid(%d), rate(%d), channel(%d), audio_type(%d)", pid, *rate, *channel, *audio_type);
+ } else {
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd get tts audio format : pid(%d) ret(%d)", pid, ret);
+ }
+
+ return ret;
}
int vcd_client_tidl_open_connection()
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] vcd_client_tidl_open_connection");
-
- g_client_callback.create = __vc_create_cb;
- g_client_callback.terminate = __vc_terminate_cb;
- g_client_callback.register_notify_cb = __vc_register_notify_cb_cb;
- g_client_callback.register_notify_cb_sync = __vc_register_notify_cb_sync_cb;
- g_client_callback.register_feedback_cb = __vc_register_feedback_cb_cb;
- g_client_callback.register_feedback_cb_sync = __vc_register_feedback_cb_sync_cb;
- g_client_callback.initialize = __vc_initialize_cb;
- g_client_callback.finalize = __vc_finalize_cb;
- g_client_callback.set_command = __vc_set_command_cb;
- g_client_callback.unset_command = __vc_unset_command_cb;
- g_client_callback.set_foreground = __vc_set_foreground_cb;
- g_client_callback.set_server_dialog = __vc_set_server_dialog_cb;
- g_client_callback.request_dialog = __vc_request_dialog_cb;
- g_client_callback.is_system_command_valid = __vc_is_system_command_valid_cb;
- g_client_callback.auth_enable = __vc_auth_enable_cb;
- g_client_callback.auth_disable = __vc_auth_disable_cb;
- g_client_callback.auth_start = __vc_auth_start_cb;
- g_client_callback.auth_stop = __vc_auth_stop_cb;
- g_client_callback.auth_cancel = __vc_auth_cancel_cb;
- g_client_callback.request_tts = __vc_request_tts_cb;
- g_client_callback.cancel_tts = __vc_cancel_tts_cb;
- g_client_callback.get_tts_audio_format = __vc_get_tts_audio_format_cb;
-
- int ret = -1;
- ret = rpc_port_stub_vcd_stub_vc_register(&g_client_callback, NULL);
- if (VCD_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to register TIDL callbacks. ret(%d)", ret);
- return VCD_ERROR_OPERATION_FAILED;
- }
-
- return VCD_ERROR_NONE;
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] vcd_client_tidl_open_connection");
+
+ g_client_callback.create = __vc_create_cb;
+ g_client_callback.terminate = __vc_terminate_cb;
+ g_client_callback.register_notify_cb = __vc_register_notify_cb_cb;
+ g_client_callback.register_notify_cb_sync = __vc_register_notify_cb_sync_cb;
+ g_client_callback.register_feedback_cb = __vc_register_feedback_cb_cb;
+ g_client_callback.register_feedback_cb_sync = __vc_register_feedback_cb_sync_cb;
+ g_client_callback.initialize = __vc_initialize_cb;
+ g_client_callback.finalize = __vc_finalize_cb;
+ g_client_callback.set_command = __vc_set_command_cb;
+ g_client_callback.unset_command = __vc_unset_command_cb;
+ g_client_callback.set_foreground = __vc_set_foreground_cb;
+ g_client_callback.set_server_dialog = __vc_set_server_dialog_cb;
+ g_client_callback.request_dialog = __vc_request_dialog_cb;
+ g_client_callback.is_system_command_valid = __vc_is_system_command_valid_cb;
+ g_client_callback.auth_enable = __vc_auth_enable_cb;
+ g_client_callback.auth_disable = __vc_auth_disable_cb;
+ g_client_callback.auth_start = __vc_auth_start_cb;
+ g_client_callback.auth_stop = __vc_auth_stop_cb;
+ g_client_callback.auth_cancel = __vc_auth_cancel_cb;
+ g_client_callback.request_tts = __vc_request_tts_cb;
+ g_client_callback.cancel_tts = __vc_cancel_tts_cb;
+ g_client_callback.get_tts_audio_format = __vc_get_tts_audio_format_cb;
+
+ int ret = -1;
+ ret = rpc_port_stub_vcd_stub_vc_register(&g_client_callback, NULL);
+ if (VCD_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to register TIDL callbacks. ret(%d)", ret);
+ return VCD_ERROR_OPERATION_FAILED;
+ }
+
+ return VCD_ERROR_NONE;
}
int vcd_client_tidl_close_connection()
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] vcd_tidl_close_connection");
- rpc_port_stub_vcd_stub_vc_unregister();
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] vcd_tidl_close_connection");
+ rpc_port_stub_vcd_stub_vc_unregister();
- return VCD_ERROR_NONE;
+ return VCD_ERROR_NONE;
}
int vcdc_send_error_signal_to_app(int pid, int reason, char *err_msg)
{
- if (NULL == err_msg) {
+ if (NULL == err_msg) {
SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Input parameter is NULL");
return VCD_ERROR_INVALID_PARAMETER;
- }
+ }
- client_tidl_info_s* info = vcd_client_get_tidl_info(pid);
- if (NULL == info) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get tidl info. pid(%d)", pid);
- return VCD_ERROR_INVALID_PARAMETER;
- }
+ client_tidl_info_s* info = vcd_client_get_tidl_info(pid);
+ if (NULL == info) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get tidl info. pid(%d)", pid);
+ return VCD_ERROR_INVALID_PARAMETER;
+ }
- bundle* msg = bundle_create();
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data");
- return VCD_ERROR_OUT_OF_MEMORY;
- }
+ bundle* msg = bundle_create();
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data");
+ return VCD_ERROR_OUT_OF_MEMORY;
+ }
SLOG(LOG_INFO, TAG_VCD, "[TIDL] Send error signal to app(%d)", pid);
- char pid_char[10] = {0};
- char reason_char[10] = {0};
- snprintf(pid_char, 10, "%d", pid);
- snprintf(reason_char, 10, "%d", reason);
+ char pid_char[10] = {0};
+ char reason_char[10] = {0};
+ snprintf(pid_char, 10, "%d", pid);
+ snprintf(reason_char, 10, "%d", reason);
- bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_METHOD_ERROR_TO_APP);
- bundle_add_str(msg, VC_BUNDLE_PID, pid_char);
- bundle_add_str(msg, VC_BUNDLE_REASON, reason_char);
- bundle_add_str(msg, VC_BUNDLE_ERR_MSG, err_msg);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_METHOD_ERROR_TO_APP);
+ bundle_add_str(msg, VC_BUNDLE_PID, pid_char);
+ bundle_add_str(msg, VC_BUNDLE_REASON, reason_char);
+ bundle_add_str(msg, VC_BUNDLE_ERR_MSG, err_msg);
- rpc_port_stub_vcd_stub_vc_notify_cb_invoke(info->notify_cb, pid, msg);
+ rpc_port_stub_vcd_stub_vc_notify_cb_invoke(info->notify_cb, pid, msg);
- return VCD_ERROR_NONE;
+ return VCD_ERROR_NONE;
}
int vcdc_send_manager_pid(int manager_pid)
{
- // send signal to all pid
+ // send signal to all pid
- // get all pids
- int* client_list = NULL;
+ // get all pids
+ int* client_list = NULL;
int client_count = 0;
- int ret = -1;
- ret = vcd_client_get_tidl_list(&client_list, &client_count);
- if (0 != ret || 0 == client_count) {
- SLOG(LOG_WARN, TAG_VCD, "[WARNING] There is no client");
- return VCD_ERROR_NONE;
- }
-
- client_tidl_info_s* info;
- int pid = -1;
- bundle* msg;
- char pid_char[10] = {0};
- char mgrpid_char[10] = {0};
- for (int i = 0 ; i < client_count ; i++) {
- pid = client_list[i];
-
- info = vcd_client_get_tidl_info(pid);
- if (NULL == info) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get tidl info. pid(%d)", pid);
- continue;
- }
+ int ret = -1;
+ ret = vcd_client_get_tidl_list(&client_list, &client_count);
+ if (0 != ret || 0 == client_count) {
+ SLOG(LOG_WARN, TAG_VCD, "[WARNING] There is no client");
+ return VCD_ERROR_NONE;
+ }
+
+ client_tidl_info_s* info;
+ int pid = -1;
+ bundle* msg;
+ char pid_char[10] = {0};
+ char mgrpid_char[10] = {0};
+ for (int i = 0 ; i < client_count ; i++) {
+ pid = client_list[i];
+
+ info = vcd_client_get_tidl_info(pid);
+ if (NULL == info) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get tidl info. pid(%d)", pid);
+ continue;
+ }
- msg = bundle_create();
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data");
- continue;
- }
+ msg = bundle_create();
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data");
+ continue;
+ }
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] Send manager pid(%d) to app(%d)", manager_pid, pid);
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] Send manager pid(%d) to app(%d)", manager_pid, pid);
- snprintf(pid_char, 10, "%d", pid);
- snprintf(mgrpid_char, 10, "%d", manager_pid);
+ snprintf(pid_char, 10, "%d", pid);
+ snprintf(mgrpid_char, 10, "%d", manager_pid);
- bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_METHOD_SEND_MANAGER_PID);
- bundle_add_str(msg, VC_BUNDLE_PID, pid_char);
- bundle_add_str(msg, VC_BUNDLE_MANAGER_PID, mgrpid_char);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_METHOD_SEND_MANAGER_PID);
+ bundle_add_str(msg, VC_BUNDLE_PID, pid_char);
+ bundle_add_str(msg, VC_BUNDLE_MANAGER_PID, mgrpid_char);
- rpc_port_stub_vcd_stub_vc_notify_cb_invoke(info->notify_cb, pid, msg);
+ rpc_port_stub_vcd_stub_vc_notify_cb_invoke(info->notify_cb, pid, msg);
- bundle_free(msg);
- }
+ bundle_free(msg);
+ }
- return VCD_ERROR_NONE;
+ return VCD_ERROR_NONE;
}
int vcdc_send_feedback_streaming(int pid, int utt_id, vc_feedback_event_e event, char* buffer, int len)
{
- if (NULL == buffer || 0 >= len) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Invalid parameter");
- return VCD_ERROR_INVALID_PARAMETER;
- }
+ if (NULL == buffer || 0 >= len) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Invalid parameter");
+ return VCD_ERROR_INVALID_PARAMETER;
+ }
- client_tidl_info_s* info = vcd_client_get_tidl_info(pid);
- if (NULL == info) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get tidl info. pid(%d)", pid);
- return VCD_ERROR_INVALID_PARAMETER;
- }
+ client_tidl_info_s* info = vcd_client_get_tidl_info(pid);
+ if (NULL == info) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get tidl info. pid(%d)", pid);
+ return VCD_ERROR_INVALID_PARAMETER;
+ }
- bundle* msg = bundle_create();
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data");
- return VCD_ERROR_OUT_OF_MEMORY;
- }
+ bundle* msg = bundle_create();
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data");
+ return VCD_ERROR_OUT_OF_MEMORY;
+ }
SLOG(LOG_INFO, TAG_VCD, "[TIDL] Send feedback streaming to app(%d), utt_id(%d), event(%d), length(%d)", pid, utt_id, event, len);
- rpc_port_stub_vcd_stub_array_char_h arr_char = NULL;
- rpc_port_stub_vcd_stub_array_char_create(&arr_char);
- rpc_port_stub_vcd_stub_array_char_set(arr_char, buffer, len);
+ rpc_port_stub_vcd_stub_array_char_h arr_char = NULL;
+ rpc_port_stub_vcd_stub_array_char_create(&arr_char);
+ rpc_port_stub_vcd_stub_array_char_set(arr_char, buffer, len);
- rpc_port_stub_vcd_stub_vc_feedback_cb_invoke(info->feedback_cb, utt_id, event, arr_char, len);
+ rpc_port_stub_vcd_stub_vc_feedback_cb_invoke(info->feedback_cb, utt_id, event, arr_char, len);
- rpc_port_stub_vcd_stub_array_char_destroy(arr_char);
+ rpc_port_stub_vcd_stub_array_char_destroy(arr_char);
- bundle_free(msg);
+ bundle_free(msg);
- return VCD_ERROR_NONE;
+ return VCD_ERROR_NONE;
}
int vcdc_send_hello(int pid, vcd_client_type_e type)
SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] VCD SEND MESSAGE");
- // TODO: VCD_CLIENT_TYPE_MANAGER?? type??
+ // TODO: VCD_CLIENT_TYPE_MANAGER?? type??
__send_msg(msg, VCD_CLIENT_TYPE_MANAGER, pid);
bundle_free(msg);
{
SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send result");
- vcd_client_type_e type;
+ vcd_client_type_e type;
bundle* msg = bundle_create();
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data");
- return VCD_ERROR_OUT_OF_MEMORY;
- }
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data");
+ return VCD_ERROR_OUT_OF_MEMORY;
+ }
SLOG(LOG_INFO, TAG_VCD, "[TIDL] Result command type(%d)", cmd_type);
case VC_COMMAND_TYPE_FOREGROUND:
case VC_COMMAND_TYPE_BACKGROUND:
if (pid == manager_pid) {
- type = VCD_CLIENT_TYPE_MANAGER;
- bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_RESULT);
+ type = VCD_CLIENT_TYPE_MANAGER;
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_RESULT);
} else {
- type = VCD_CLIENT_TYPE_NORMAL;
- char pid_char[10] = {0};
- snprintf(pid_char, 10, "%d", pid);
- bundle_add_str(msg, VC_BUNDLE_PID, pid_char);
- bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_METHOD_RESULT);
+ type = VCD_CLIENT_TYPE_NORMAL;
+ char pid_char[10] = {0};
+ snprintf(pid_char, 10, "%d", pid);
+ bundle_add_str(msg, VC_BUNDLE_PID, pid_char);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_METHOD_RESULT);
}
break;
case VC_COMMAND_TYPE_WIDGET:
- type = VCD_CLIENT_TYPE_WIDGET;
- bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_WIDGET_METHOD_RESULT);
+ type = VCD_CLIENT_TYPE_WIDGET;
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_WIDGET_METHOD_RESULT);
break;
case VC_COMMAND_TYPE_SYSTEM:
case VC_COMMAND_TYPE_SYSTEM_BACKGROUND:
case VC_COMMAND_TYPE_EXCLUSIVE:
- type = VCD_CLIENT_TYPE_MANAGER;
- bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_RESULT);
+ type = VCD_CLIENT_TYPE_MANAGER;
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_RESULT);
break;
default:
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;
+ 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;
+ return;
}
char *sender = NULL;
SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager send utterance status");
SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr send utterance status : pid(%d), utt_id(%d), utt_status(%d)", pid, utt_id, utt_status);
- 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_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_vcd_stub_vc_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;
- }
-
- bundle* msg = bundle_create();
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data");
- pthread_mutex_unlock(&g_client_tidl_info_mutex);
- return;
- }
-
- char pid_char[10] = {0};
- char uttid_char[10] = {0};
- char uttstatus_char[10] = {0};
- snprintf(pid_char, 10, "%d", pid);
- snprintf(uttid_char, 10, "%d", utt_id);
- snprintf(uttstatus_char, 10, "%d", utt_status);
-
- bundle_add_str(msg, VC_BUNDLE_METHOD, VC_MANAGER_METHOD_UTTERANCE_STATUS);
- bundle_add_str(msg, VC_BUNDLE_PID, pid_char);
- bundle_add_str(msg, VC_BUNDLE_REASON, uttid_char);
- bundle_add_str(msg, VC_BUNDLE_ERR_MSG, uttstatus_char);
-
- if (0 != rpc_port_stub_vcd_stub_vc_notify_cb_invoke(handle, pid, msg)) {
- SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg");
- bundle_free(msg);
- pthread_mutex_unlock(&g_client_tidl_info_mutex);
- return;
- }
-
- bundle_free(msg);
- pthread_mutex_unlock(&g_client_tidl_info_mutex);
+ 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_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_vcd_stub_vc_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;
+ }
+
+ bundle* msg = bundle_create();
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data");
+ pthread_mutex_unlock(&g_client_tidl_info_mutex);
+ return;
+ }
+
+ char pid_char[10] = {0};
+ char uttid_char[10] = {0};
+ char uttstatus_char[10] = {0};
+ snprintf(pid_char, 10, "%d", pid);
+ snprintf(uttid_char, 10, "%d", utt_id);
+ snprintf(uttstatus_char, 10, "%d", utt_status);
+
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VC_MANAGER_METHOD_UTTERANCE_STATUS);
+ bundle_add_str(msg, VC_BUNDLE_PID, pid_char);
+ bundle_add_str(msg, VC_BUNDLE_REASON, uttid_char);
+ bundle_add_str(msg, VC_BUNDLE_ERR_MSG, uttstatus_char);
+
+ if (0 != rpc_port_stub_vcd_stub_vc_notify_cb_invoke(handle, pid, msg)) {
+ SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg");
+ bundle_free(msg);
+ pthread_mutex_unlock(&g_client_tidl_info_mutex);
+ return;
+ }
+
+ bundle_free(msg);
+ pthread_mutex_unlock(&g_client_tidl_info_mutex);
SLOG(LOG_DEBUG, TAG_VCD, "@@@");
}
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;
+ return;
}
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. pid(%d)", pid);
pthread_mutex_unlock(&g_widget_tidl_info_mutex);
- return;
+ return;
}
char *sender = NULL;
*/
static void __vc_setting_create_cb(rpc_port_stub_vcd_setting_stub_vc_setting_context_h context, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_setting_create_cb");
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_setting_create_cb");
char *sender = NULL;
rpc_port_stub_vcd_setting_stub_vc_setting_context_get_sender(context, &sender);
if (!sender) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Sender is NULL");
- return ;
- }
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Sender is NULL");
+ return;
+ }
SLOG(LOG_INFO, TAG_VCD, "[TIDL] sender(%s)", sender); // sender (app_id)
- free(sender);
+ free(sender);
}
static void __vc_setting_terminate_cb(rpc_port_stub_vcd_setting_stub_vc_setting_context_h context, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_setting_terminate_cb");
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_setting_terminate_cb");
void* tag = NULL;
rpc_port_stub_vcd_setting_stub_vc_setting_context_get_tag(context, &tag);
static void __vc_setting_register_notify_cb_cb(rpc_port_stub_vcd_setting_stub_vc_setting_context_h context, int pid, rpc_port_stub_vcd_setting_stub_vc_setting_notify_cb_h callback, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_setting_register_notify_cb_cb. pid(%d)", pid);
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_setting_register_notify_cb_cb. pid(%d)", pid);
- if (NULL == callback) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null.");
- return ;
- }
+ if (NULL == callback) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null.");
+ return;
+ }
- int ret = -1;
- ret = vcd_client_setting_add_tidl_info(pid);
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info.");
- return ;
- }
+ int ret = -1;
+ ret = vcd_client_setting_add_tidl_info(pid);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info.");
+ return;
+ }
- ret = vcd_client_setting_set_tidl_notify_cb(pid, callback, user_data);
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback.");
- } else {
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set notify callback.");
- }
+ ret = vcd_client_setting_set_tidl_notify_cb(pid, callback, user_data);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback.");
+ } else {
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set notify callback.");
+ }
}
static int __vc_setting_register_notify_cb_sync_cb(rpc_port_stub_vcd_setting_stub_vc_setting_context_h context, int pid, rpc_port_stub_vcd_setting_stub_vc_setting_notify_cb_h callback, void *user_data)
{
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_setting_register_notify_cb_sync_cb. pid(%d)", pid);
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_setting_register_notify_cb_sync_cb. pid(%d)", pid);
- if (NULL == callback) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null.");
- return VCD_ERROR_INVALID_PARAMETER;
- }
+ if (NULL == callback) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null.");
+ return VCD_ERROR_INVALID_PARAMETER;
+ }
- int ret = -1;
- ret = vcd_client_setting_add_tidl_info(pid);
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info.");
- return ret;
- }
-
- ret = vcd_client_setting_set_tidl_notify_cb(pid, callback, user_data);
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback.");
- } else {
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set notify callback.");
- }
+ int ret = -1;
+ ret = vcd_client_setting_add_tidl_info(pid);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info.");
+ return ret;
+ }
+
+ ret = vcd_client_setting_set_tidl_notify_cb(pid, callback, user_data);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback.");
+ } else {
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set notify callback.");
+ }
- return ret;
+ return ret;
}
int __vc_setting_set_language_cb(rpc_port_stub_vcd_setting_stub_vc_setting_context_h context, int pid, const char *language, void *user_data)
return VCD_ERROR_INVALID_PARAMETER;
}
- SLOG(LOG_INFO, TAG_VCD, "[IN] vcd server set language : language(%s)", language);
+ SLOG(LOG_INFO, TAG_VCD, "[IN] vcd server set language : language(%s)", language);
- int ret = vcd_server_set_language(language);
+ int ret = vcd_server_set_language(language);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set language(%d).", ret);
- } else {
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set language.");
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set language(%d).", ret);
+ } else {
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set language.");
}
return ret;