int ret = VCD_ERROR_OPERATION_FAILED;
ret = vcd_server_set_foreground(pid, value);
- if (VCD_ERROR_NONE == ret) {
- SLOG(LOG_INFO, TAG_VCD, "[IN] vcd set foreground : pid(%d)", pid);
- } else {
+ 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;
}
{
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);
- // }
-
- // return ret;
+ 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 VCD_ERROR_NONE;
+ 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");
- // 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;
+ 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 VCD_ERROR_NONE;
+ 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");
- // 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;
+ 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 VCD_ERROR_NONE;
+ 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");
- // 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;
+ 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 VCD_ERROR_NONE;
+ 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");
- // 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;
+ 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 VCD_ERROR_NONE;
+ 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_DEBUG, TAG_VCD, "@@@");
}
-static void __vc_mgr_send_utterance_status_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int utt_id, int utt_status, void *user_data)
+static void __vc_mgr_send_utterance_status_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, int utt_id, int utt_status, void *user_data)
{
SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager send utterance status");
- SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr send utterance status : utt_id(%d), utt_status(%d)", utt_id, utt_status);
- // TODO: send parameter to client?? It seems to send method (no reply) to mgr. Need to check.
+ 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);
SLOG(LOG_DEBUG, TAG_VCD, "@@@");
}