char* val = NULL;
SLOG(LOG_DEBUG, TAG_VCW, "__notify_cb is invoked");
- bundle_get_str(msg, VC_WIDGET_BUNDLE_METHOD, &method);
+ bundle_get_str(msg, VC_BUNDLE_METHOD, &method);
if (0 == strncmp(VCD_WIDGET_METHOD_HELLO, method, strlen(VCD_WIDGET_METHOD_HELLO))) {
SLOG(LOG_INFO, TAG_VCW, "@@@ Get widget hello");
- bundle_get_str(msg, VC_WIDGET_BUNDLE_MESSAGE, &val);
+ bundle_get_str(msg, VC_BUNDLE_PID, &val);
if (val) {
SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget get hello : pid(%d) ", atoi(val));
} else {
SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget get hello : invalid pid ");
}
- SLOG(LOG_DEBUG, TAG_VCW, "@@@");
} /* VCD_METHOD_HELLO */
- else if (0 == strncmp(VCD_WIDGET_METHOD_SET_SERVICE_STATE, method, strlen(VCD_WIDGET_METHOD_SET_SERVICE_STATE))) {
- bundle_get_str(msg, VC_WIDGET_BUNDLE_MESSAGE, &val);
+ else if (0 == strncmp(VCD_METHOD_SET_SERVICE_STATE, method, strlen(VCD_METHOD_SET_SERVICE_STATE))) {
+ bundle_get_str(msg, VC_BUNDLE_SERVICE_STATE, &val);
int state = 0;
if (val) {
state = atoi(val);
SLOG(LOG_INFO, TAG_VCW, "@@ service state changed : %d", state);
__vc_widget_cb_service_state(state);
}
- } /* VCD_WIDGET_METHOD_SET_SERVICE_STATE */
+ } /* VCD_METHOD_SET_SERVICE_STATE */
else if (0 == strncmp(VCD_WIDGET_METHOD_SHOW_TOOLTIP, method, strlen(VCD_WIDGET_METHOD_SHOW_TOOLTIP))) {
SLOG(LOG_DEBUG, TAG_VCW, "@@@ Show / Hide tooltip");
char* temp_show = NULL;
- bundle_get_str(msg, VC_WIDGET_BUNDLE_MESSAGE, &val);
- bundle_get_str(msg, VC_WIDGET_BUNDLE_SHOW, &temp_show);
+ bundle_get_str(msg, VC_BUNDLE_PID, &val);
+ bundle_get_str(msg, VC_BUNDLE_SHOW, &temp_show);
int pid = 0;
int show = 0;
} else {
SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget show tooltip : invalid pid");
}
- SLOG(LOG_DEBUG, TAG_VCW, "@@@");
} /* VCD_WIDGET_METHOD_SHOW_TOOLTIP */
else if (0 == strncmp(VCD_WIDGET_METHOD_RESULT, method, strlen(VCD_WIDGET_METHOD_RESULT))) {
SLOG(LOG_DEBUG, TAG_VCW, "@@@ Get widget result");
__vc_widget_cb_result();
-
- SLOG(LOG_DEBUG, TAG_VCW, "@@@");
} /* VCD_WIDGET_METHOD_RESULT */
else if (0 == strncmp(VCD_WIDGET_METHOD_ERROR, method, strlen(VCD_WIDGET_METHOD_ERROR))) {
char* temp_daemon_pid = NULL;
char* err_msg = NULL;
- bundle_get_str(msg, VC_WIDGET_BUNDLE_REASON, &temp_reason);
- bundle_get_str(msg, VC_WIDGET_BUNDLE_DAEMON_PID, &temp_daemon_pid);
- bundle_get_str(msg, VC_WIDGET_BUNDLE_ERROR_MESSAGE, &err_msg);
+ bundle_get_str(msg, VC_BUNDLE_REASON, &temp_reason);
+ bundle_get_str(msg, VC_BUNDLE_DAEMON_PID, &temp_daemon_pid);
+ bundle_get_str(msg, VC_BUNDLE_ERR_MSG, &err_msg);
int reason = 0;
int daemon_pid = 0;
SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget get error message : reason(%d), daemon_pid(%d), msg(%s)", reason, daemon_pid, err_msg);
__vc_widget_cb_error(reason, daemon_pid, err_msg);
-
- SLOG(LOG_DEBUG, TAG_VCW, "@@@");
} /* VCD_WIDGET_METHOD_ERROR */
else {
SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Invalid msg");
}
+
+ SLOG(LOG_DEBUG, TAG_VCW, "@@@ __notify_cb DONE");
}
static void __on_connected(rpc_port_proxy_vc_widget_proxy_vc_widget_h h, void *user_data)
SLOG(LOG_INFO, TAG_VCW, "Disonnected to server");
- SLOG(LOG_INFO, TAG_VCW, "Re-connection start");
- __vc_widget_cb_error(VC_ERROR_SERVICE_RESET, -1, "Server Disconnected, re-launch");
+ __vc_widget_cb_error(VC_ERROR_SERVICE_RESET, -1, "Server Disconnected");
}
static void __on_rejected(rpc_port_proxy_vc_widget_proxy_vc_widget_h h, void *user_data)
return VC_ERROR_NONE;
}
+static int __convert_unhandled_error(int ret)
+{
+ if (RPC_PORT_ERROR_IO_ERROR == ret || RPC_PORT_ERROR_OUT_OF_MEMORY == ret) {
+ return VC_ERROR_OPERATION_FAILED;
+ }
+
+ return ret;
+}
+
static void __request_tidl_connect()
{
if (g_proxy_tidl_info->connection_requesting) {
int temp_service_state = 0;
int temp_daemon_pid = 0;
int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_initialize(g_proxy_tidl_info->rpc_h, pid, &temp_service_state, &temp_daemon_pid);
- if (RPC_PORT_ERROR_NONE != ret) {
+ int exception = get_last_result();
+ if (RPC_PORT_ERROR_NONE != exception) {
+ ret = __convert_unhandled_error(exception);
+ }
+
+ if (VC_ERROR_NONE != ret) {
SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget initialize : Fail to invoke message, error(%d)", ret);
pthread_mutex_unlock(&g_w_init_mutex);
return ret;
}
int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_finalize(g_proxy_tidl_info->rpc_h, pid);
- if (RPC_PORT_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget finalize : Fail to invoke message, error(%d)", ret);
+ int exception = get_last_result();
+ if (RPC_PORT_ERROR_NONE != exception) {
+ ret = __convert_unhandled_error(exception);
+ }
+
+ if (VC_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget finalize : Fail to invoke finalize, error(%d)", ret);
+ pthread_mutex_unlock(&g_w_init_mutex);
+ return ret;
+ }
+
+ ret = rpc_port_proxy_vc_widget_proxy_vc_widget_disconnect(g_proxy_tidl_info->rpc_h);
+ exception = get_last_result();
+ if (RPC_PORT_ERROR_NONE != exception) {
+ ret = __convert_unhandled_error(exception);
+ }
+
+ if (VC_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget finalize : Fail to disconnect, error(%d)", ret);
pthread_mutex_unlock(&g_w_init_mutex);
return ret;
}
}
int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_start_recording(g_proxy_tidl_info->rpc_h, pid, (int)command);
- if (RPC_PORT_ERROR_NONE != ret) {
+ int exception = get_last_result();
+ if (RPC_PORT_ERROR_NONE != exception) {
+ ret = __convert_unhandled_error(exception);
+ }
+
+ if (VC_ERROR_NONE != ret) {
SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget start recording : Fail to invoke message, error(%d)", ret);
return ret;
}
}
int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_enable_asr_result(g_proxy_tidl_info->rpc_h, pid, (int)enable);
- if (RPC_PORT_ERROR_NONE != ret) {
+ int exception = get_last_result();
+ if (RPC_PORT_ERROR_NONE != exception) {
+ ret = __convert_unhandled_error(exception);
+ }
+
+ if (VC_ERROR_NONE != ret) {
SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget enable asr result : Fail to invoke message, error(%d)", ret);
return ret;
}
}
int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_start(g_proxy_tidl_info->rpc_h, pid, silence);
- if (RPC_PORT_ERROR_NONE != ret) {
+ int exception = get_last_result();
+ if (RPC_PORT_ERROR_NONE != exception) {
+ ret = __convert_unhandled_error(exception);
+ }
+
+ if (VC_ERROR_NONE != ret) {
SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget start : Fail to invoke message, error(%d)", ret);
return ret;
}
}
int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_stop(g_proxy_tidl_info->rpc_h, pid);
- if (RPC_PORT_ERROR_NONE != ret) {
+ int exception = get_last_result();
+ if (RPC_PORT_ERROR_NONE != exception) {
+ ret = __convert_unhandled_error(exception);
+ }
+
+ if (VC_ERROR_NONE != ret) {
SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget stop : Fail to invoke message, error(%d)", ret);
return ret;
}
}
int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_cancel(g_proxy_tidl_info->rpc_h, pid);
- if (RPC_PORT_ERROR_NONE != ret) {
+ int exception = get_last_result();
+ if (RPC_PORT_ERROR_NONE != exception) {
+ ret = __convert_unhandled_error(exception);
+ }
+
+ if (VC_ERROR_NONE != ret) {
SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget cancel : Fail to invoke message, error(%d)", ret);
return ret;
}