bool connected;
bool connection_requesting;
bool register_callback_invoked;
- rpc_port_proxy_vc_widget_h rpc_h;
- rpc_port_proxy_vc_widget_notify_cb_h notify_cb_h;
+ rpc_port_proxy_vc_widget_proxy_vc_widget_h rpc_h;
+ rpc_port_proxy_vc_widget_proxy_vc_widget_notify_cb_h notify_cb_h;
} vc_widget_tidl_info_s;
typedef struct {
static pthread_mutex_t g_w_tidl_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t g_w_init_mutex = PTHREAD_MUTEX_INITIALIZER;
-static rpc_port_stub_vcd_widget_callback_s g_widget_callback;
+static rpc_port_stub_vc_widget_stub_vcd_widget_callback_s g_widget_callback;
extern int __vc_widget_cb_error(int reason, int daemon_pid, char* msg);
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_h h, void *user_data)
+static void __on_connected(rpc_port_proxy_vc_widget_proxy_vc_widget_h h, void *user_data)
{
g_proxy_tidl_info->connected = true;
g_proxy_tidl_info->connection_requesting = false;
SLOG(LOG_INFO, TAG_VCW, "Connected to server");
}
-static void __on_disconnected(rpc_port_proxy_vc_widget_h h, void *user_data)
+static void __on_disconnected(rpc_port_proxy_vc_widget_proxy_vc_widget_h h, void *user_data)
{
g_proxy_tidl_info->connected = false;
g_proxy_tidl_info->connection_requesting = false;
g_proxy_tidl_info->register_callback_invoked = false;
SLOG(LOG_INFO, TAG_VCW, "Disonnected to server");
+
+ __vc_widget_cb_error(VC_ERROR_SERVICE_RESET, -1, "Server Disconnected");
}
-static void __on_rejected(rpc_port_proxy_vc_widget_h h, void *user_data)
+static void __on_rejected(rpc_port_proxy_vc_widget_proxy_vc_widget_h h, void *user_data)
{
g_proxy_tidl_info->connection_requesting = false;
g_proxy_tidl_info->register_callback_invoked = false;
}
-static rpc_port_proxy_vc_widget_h __create_rpc_port(const char* engine_app_id)
+static rpc_port_proxy_vc_widget_proxy_vc_widget_h __create_rpc_port(const char* engine_app_id)
{
SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] __create_rpc_port");
- rpc_port_proxy_vc_widget_callback_s rpc_callback = {
+ rpc_port_proxy_vc_widget_proxy_vc_widget_callback_s rpc_callback = {
.connected = __on_connected,
.disconnected = __on_disconnected,
.rejected = __on_rejected
};
- rpc_port_proxy_vc_widget_h handle = NULL;
- if (0 != rpc_port_proxy_vc_widget_create(engine_app_id, &rpc_callback, NULL, &handle)) {
+ rpc_port_proxy_vc_widget_proxy_vc_widget_h handle = NULL;
+ if (0 != rpc_port_proxy_vc_widget_proxy_vc_widget_create(engine_app_id, &rpc_callback, NULL, &handle)) {
SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Fail to create proxy");
return NULL;
}
return handle;
}
-static void __vcd_widget_create_cb(rpc_port_stub_vcd_widget_context_h context, void *user_data)
+static void __vcd_widget_create_cb(rpc_port_stub_vc_widget_stub_vcd_widget_context_h context, void *user_data)
{
g_stub_tidl_info->connected = true;
g_stub_tidl_info->register_callback_requesting = false;
char *sender = NULL;
- rpc_port_stub_vcd_widget_context_get_sender(context, &sender);
+ rpc_port_stub_vc_widget_stub_vcd_widget_context_get_sender(context, &sender);
if (!sender) {
SLOG(LOG_ERROR, TAG_VCW, "@@@ Sender is NULL");
return;
free(sender);
}
-static void __vcd_widget_terminate_cb(rpc_port_stub_vcd_widget_context_h context, void *user_data)
+static void __vcd_widget_terminate_cb(rpc_port_stub_vc_widget_stub_vcd_widget_context_h context, void *user_data)
{
g_stub_tidl_info->connected = false;
g_stub_tidl_info->register_callback_requesting = false;
- rpc_port_stub_vcd_widget_context_set_tag(context, NULL);
+ rpc_port_stub_vc_widget_stub_vcd_widget_context_set_tag(context, NULL);
char *sender = NULL;
- rpc_port_stub_vcd_widget_context_get_sender(context, &sender);
+ rpc_port_stub_vc_widget_stub_vcd_widget_context_get_sender(context, &sender);
if (!sender)
return;
free(sender);
}
-static int __vcd_widget_asr_result_cb(rpc_port_stub_vcd_widget_context_h context, int pid, int event, const char *asr_result, bool *is_consumed, void *user_data)
+static int __vcd_widget_asr_result_cb(rpc_port_stub_vc_widget_stub_vcd_widget_context_h context, int pid, int event, const char *asr_result, bool *is_consumed, void *user_data)
{
SLOG(LOG_DEBUG, TAG_VCW, "@@@ Get widget asr result");
g_widget_callback.send_asr_result = __vcd_widget_asr_result_cb;
int ret = -1;
- ret = rpc_port_stub_vcd_widget_register(&g_widget_callback, NULL);
+ ret = rpc_port_stub_vc_widget_stub_vcd_widget_register(&g_widget_callback, NULL);
if (0 == ret) {
SLOG(LOG_DEBUG, TAG_VCW, "register callback");
g_stub_tidl_info->register_callback_requesting = true;
return VC_ERROR_OPERATION_FAILED;
}
- if (0 != rpc_port_proxy_vc_widget_destroy(g_proxy_tidl_info->rpc_h)) {
+ if (0 != rpc_port_proxy_vc_widget_proxy_vc_widget_destroy(g_proxy_tidl_info->rpc_h)) {
SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Fail to destroy tidl handle");
pthread_mutex_unlock(&g_w_tidl_mutex);
return VC_ERROR_OPERATION_FAILED;
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) {
return;
}
- int ret = rpc_port_proxy_vc_widget_connect(g_proxy_tidl_info->rpc_h);
+ int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_connect(g_proxy_tidl_info->rpc_h);
SLOG(LOG_INFO, TAG_VCW, "[INFO] Request connection to stub. ret(%d)", ret);
if (0 == ret) {
static int __create_callback_handles()
{
if (NULL != g_proxy_tidl_info->notify_cb_h) {
- rpc_port_proxy_vc_widget_notify_cb_dispose(g_proxy_tidl_info->rpc_h, g_proxy_tidl_info->notify_cb_h);
+ rpc_port_proxy_vc_widget_proxy_vc_widget_notify_cb_dispose(g_proxy_tidl_info->rpc_h, g_proxy_tidl_info->notify_cb_h);
g_proxy_tidl_info->notify_cb_h = NULL;
}
- if (RPC_PORT_ERROR_NONE != rpc_port_proxy_vc_widget_notify_cb_create(&g_proxy_tidl_info->notify_cb_h)) {
+ if (RPC_PORT_ERROR_NONE != rpc_port_proxy_vc_widget_proxy_vc_widget_notify_cb_create(&g_proxy_tidl_info->notify_cb_h)) {
return VC_ERROR_OUT_OF_MEMORY;
}
- rpc_port_proxy_vc_widget_notify_cb_set_callback(g_proxy_tidl_info->notify_cb_h, __notify_cb, NULL);
+ rpc_port_proxy_vc_widget_proxy_vc_widget_notify_cb_set_callback(g_proxy_tidl_info->notify_cb_h, __notify_cb, NULL);
- rpc_port_proxy_vc_widget_notify_cb_set_once(g_proxy_tidl_info->notify_cb_h, false);
+ rpc_port_proxy_vc_widget_proxy_vc_widget_notify_cb_set_once(g_proxy_tidl_info->notify_cb_h, false);
return VC_ERROR_NONE;
}
return VC_ERROR_OPERATION_FAILED;
}
- rpc_port_proxy_vc_widget_invoke_register_cb(g_proxy_tidl_info->rpc_h, getpid(), g_proxy_tidl_info->notify_cb_h);
+ rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_register_cb(g_proxy_tidl_info->rpc_h, getpid(), g_proxy_tidl_info->notify_cb_h);
g_proxy_tidl_info->register_callback_invoked = true;
return VC_ERROR_NONE;
}
int temp_service_state = 0;
int temp_daemon_pid = 0;
- if (0 != rpc_port_proxy_vc_widget_invoke_initialize(g_proxy_tidl_info->rpc_h, pid, &temp_service_state, &temp_daemon_pid)) {
- SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget initialize : Fail to invoke message");
+ 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);
+ 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 VC_ERROR_OPERATION_FAILED;
+ return ret;
}
*service_state = temp_service_state;
return VC_ERROR_OPERATION_FAILED;
}
- if (0 != rpc_port_proxy_vc_widget_invoke_finalize(g_proxy_tidl_info->rpc_h, pid)) {
- SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget finalize : Fail to invoke message");
+ int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_finalize(g_proxy_tidl_info->rpc_h, pid);
+ 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 VC_ERROR_OPERATION_FAILED;
+ 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;
}
pthread_mutex_unlock(&g_w_init_mutex);
return VC_ERROR_OPERATION_FAILED;
}
- if (0 != rpc_port_proxy_vc_widget_invoke_start_recording(g_proxy_tidl_info->rpc_h, pid, (int)command)) {
- SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget start recording : Fail to invoke message");
- return VC_ERROR_OPERATION_FAILED;
+ int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_start_recording(g_proxy_tidl_info->rpc_h, pid, (int)command);
+ 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;
}
return VC_ERROR_NONE;
return VC_ERROR_OPERATION_FAILED;
}
- rpc_port_proxy_vc_widget_invoke_set_foreground(g_proxy_tidl_info->rpc_h, pid, (int)value);
+ // TODO: Error tolerance cannot be applied because this function is asynchronous.
+ rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_set_foreground(g_proxy_tidl_info->rpc_h, pid, (int)value);
return VC_ERROR_NONE;
}
return VC_ERROR_OPERATION_FAILED;
}
- if (0 != rpc_port_proxy_vc_widget_invoke_enable_asr_result(g_proxy_tidl_info->rpc_h, pid, (int)enable)) {
- SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget enable asr result : Fail to invoke message");
- return VC_ERROR_OPERATION_FAILED;
+ int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_enable_asr_result(g_proxy_tidl_info->rpc_h, pid, (int)enable);
+ 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;
}
return VC_ERROR_NONE;
return VC_ERROR_OPERATION_FAILED;
}
- if (0 != rpc_port_proxy_vc_widget_invoke_start(g_proxy_tidl_info->rpc_h, pid, silence)) {
- SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget start : Fail to invoke message");
- return VC_ERROR_OPERATION_FAILED;
+ int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_start(g_proxy_tidl_info->rpc_h, pid, silence);
+ 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;
}
return VC_ERROR_NONE;
return VC_ERROR_OPERATION_FAILED;
}
- if (0 != rpc_port_proxy_vc_widget_invoke_stop(g_proxy_tidl_info->rpc_h, pid)) {
- SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget stop : Fail to invoke message");
- return VC_ERROR_OPERATION_FAILED;
+ int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_stop(g_proxy_tidl_info->rpc_h, pid);
+ 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;
}
return VC_ERROR_NONE;
return VC_ERROR_OPERATION_FAILED;
}
- if (0 != rpc_port_proxy_vc_widget_invoke_cancel(g_proxy_tidl_info->rpc_h, pid)) {
- SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget cancel : Fail to invoke message");
- return VC_ERROR_OPERATION_FAILED;
+ int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_cancel(g_proxy_tidl_info->rpc_h, pid);
+ 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;
}
return VC_ERROR_NONE;