2 * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 #include "vc_widget_client.h"
22 #include "vc_widget_tidl.h"
23 #include "vc_widget_proxy.h"
24 #include "vc_widget_stub.h"
28 bool connection_requesting;
29 bool register_callback_invoked;
30 rpc_port_proxy_vc_widget_proxy_vc_widget_h rpc_h;
31 rpc_port_proxy_vc_widget_proxy_vc_widget_notify_cb_h notify_cb_h;
32 } vc_widget_tidl_info_s;
36 bool register_callback_requesting;
37 } vcd_widget_tidl_info_s;
39 static vc_widget_tidl_info_s* g_proxy_tidl_info = NULL;
41 static vcd_widget_tidl_info_s* g_stub_tidl_info = NULL;
43 static pthread_mutex_t g_w_tidl_mutex = PTHREAD_MUTEX_INITIALIZER;
44 static pthread_mutex_t g_w_init_mutex = PTHREAD_MUTEX_INITIALIZER;
46 static rpc_port_stub_vc_widget_stub_vcd_widget_callback_s g_widget_callback;
48 extern int __vc_widget_cb_error(int reason, int daemon_pid, char* msg);
50 extern void __vc_widget_cb_show_tooltip(int pid, bool show);
52 extern void __vc_widget_cb_result();
54 extern bool __vc_widget_cb_asr_result(int event, const char* asr_result);
56 extern int __vc_widget_cb_service_state(int state);
58 static void __notify_cb(void *user_data, bundle *msg)
62 SLOG(LOG_DEBUG, TAG_VCW, "__notify_cb is invoked");
64 bundle_get_str(msg, VC_BUNDLE_METHOD, &method);
66 if (0 == strncmp(VCD_WIDGET_METHOD_HELLO, method, strlen(VCD_WIDGET_METHOD_HELLO))) {
67 SLOG(LOG_INFO, TAG_VCW, "@@@ Get widget hello");
68 bundle_get_str(msg, VC_BUNDLE_PID, &val);
70 SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget get hello : pid(%d) ", atoi(val));
72 SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget get hello : invalid pid ");
74 } /* VCD_METHOD_HELLO */
76 else if (0 == strncmp(VCD_METHOD_SET_SERVICE_STATE, method, strlen(VCD_METHOD_SET_SERVICE_STATE))) {
77 bundle_get_str(msg, VC_BUNDLE_SERVICE_STATE, &val);
81 SLOG(LOG_INFO, TAG_VCW, "@@ service state changed : %d", state);
82 __vc_widget_cb_service_state(state);
84 } /* VCD_METHOD_SET_SERVICE_STATE */
86 else if (0 == strncmp(VCD_WIDGET_METHOD_SHOW_TOOLTIP, method, strlen(VCD_WIDGET_METHOD_SHOW_TOOLTIP))) {
87 SLOG(LOG_DEBUG, TAG_VCW, "@@@ Show / Hide tooltip");
88 char* temp_show = NULL;
89 bundle_get_str(msg, VC_BUNDLE_PID, &val);
90 bundle_get_str(msg, VC_BUNDLE_SHOW, &temp_show);
98 show = atoi(temp_show);
102 SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget show tooltip : pid(%d), show(%d)", pid, show);
103 __vc_widget_cb_show_tooltip(pid, (bool)show);
105 SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget show tooltip : invalid pid");
107 } /* VCD_WIDGET_METHOD_SHOW_TOOLTIP */
109 else if (0 == strncmp(VCD_WIDGET_METHOD_RESULT, method, strlen(VCD_WIDGET_METHOD_RESULT))) {
110 SLOG(LOG_DEBUG, TAG_VCW, "@@@ Get widget result");
112 __vc_widget_cb_result();
113 } /* VCD_WIDGET_METHOD_RESULT */
115 else if (0 == strncmp(VCD_WIDGET_METHOD_ERROR, method, strlen(VCD_WIDGET_METHOD_ERROR))) {
116 SLOG(LOG_INFO, TAG_VCW, "@@@ Get Pre Result");
117 char* temp_reason = NULL;
118 char* temp_daemon_pid = NULL;
119 char* err_msg = NULL;
121 bundle_get_str(msg, VC_BUNDLE_REASON, &temp_reason);
122 bundle_get_str(msg, VC_BUNDLE_DAEMON_PID, &temp_daemon_pid);
123 bundle_get_str(msg, VC_BUNDLE_ERR_MSG, &err_msg);
127 if (NULL != temp_reason) {
128 reason = atoi(temp_reason);
130 if (NULL != temp_daemon_pid) {
131 daemon_pid = atoi(temp_daemon_pid);
134 SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget get error message : reason(%d), daemon_pid(%d), msg(%s)", reason, daemon_pid, err_msg);
135 __vc_widget_cb_error(reason, daemon_pid, err_msg);
136 } /* VCD_WIDGET_METHOD_ERROR */
139 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Invalid msg");
142 SLOG(LOG_DEBUG, TAG_VCW, "@@@ __notify_cb DONE");
145 static void __on_connected(rpc_port_proxy_vc_widget_proxy_vc_widget_h h, void *user_data)
147 g_proxy_tidl_info->connected = true;
148 g_proxy_tidl_info->connection_requesting = false;
149 g_proxy_tidl_info->register_callback_invoked = false;
151 SLOG(LOG_INFO, TAG_VCW, "Connected to server");
154 static void __on_disconnected(rpc_port_proxy_vc_widget_proxy_vc_widget_h h, void *user_data)
156 g_proxy_tidl_info->connected = false;
157 g_proxy_tidl_info->connection_requesting = false;
158 g_proxy_tidl_info->register_callback_invoked = false;
160 SLOG(LOG_INFO, TAG_VCW, "Disonnected to server");
162 __vc_widget_cb_error(VC_ERROR_SERVICE_RESET, -1, "Server Disconnected");
165 static void __on_rejected(rpc_port_proxy_vc_widget_proxy_vc_widget_h h, void *user_data)
167 g_proxy_tidl_info->connection_requesting = false;
168 g_proxy_tidl_info->register_callback_invoked = false;
170 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Rejected from server");
174 static rpc_port_proxy_vc_widget_proxy_vc_widget_h __create_rpc_port(const char* engine_app_id)
176 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] __create_rpc_port");
177 rpc_port_proxy_vc_widget_proxy_vc_widget_callback_s rpc_callback = {
178 .connected = __on_connected,
179 .disconnected = __on_disconnected,
180 .rejected = __on_rejected
183 rpc_port_proxy_vc_widget_proxy_vc_widget_h handle = NULL;
184 if (0 != rpc_port_proxy_vc_widget_proxy_vc_widget_create(engine_app_id, &rpc_callback, NULL, &handle)) {
185 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Fail to create proxy");
192 static void __vcd_widget_create_cb(rpc_port_stub_vc_widget_stub_vcd_widget_context_h context, void *user_data)
194 g_stub_tidl_info->connected = true;
195 g_stub_tidl_info->register_callback_requesting = false;
197 SLOG(LOG_DEBUG, TAG_VCW, "Connected to server");
201 rpc_port_stub_vc_widget_stub_vcd_widget_context_get_sender(context, &sender);
203 SLOG(LOG_ERROR, TAG_VCW, "@@@ Sender is NULL");
207 SLOG(LOG_DEBUG, TAG_VCW, "@@@ Server connect. appid(%s)", sender);
211 static void __vcd_widget_terminate_cb(rpc_port_stub_vc_widget_stub_vcd_widget_context_h context, void *user_data)
213 g_stub_tidl_info->connected = false;
214 g_stub_tidl_info->register_callback_requesting = false;
216 rpc_port_stub_vc_widget_stub_vcd_widget_context_set_tag(context, NULL);
219 rpc_port_stub_vc_widget_stub_vcd_widget_context_get_sender(context, &sender);
223 SLOG(LOG_INFO, TAG_VCW, "@@@ Server disconnect. appid(%s)", sender);
227 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)
229 SLOG(LOG_DEBUG, TAG_VCW, "@@@ Get widget asr result");
232 result = __vc_widget_cb_asr_result(event, asr_result);
233 *is_consumed = result;
235 return VC_ERROR_NONE;
238 static void __register_stub_callback()
240 if (g_stub_tidl_info->register_callback_requesting) {
244 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] __register_stub_callback");
246 g_widget_callback.create = __vcd_widget_create_cb;
247 g_widget_callback.terminate = __vcd_widget_terminate_cb;
248 g_widget_callback.send_asr_result = __vcd_widget_asr_result_cb;
251 ret = rpc_port_stub_vc_widget_stub_vcd_widget_register(&g_widget_callback, NULL);
253 SLOG(LOG_DEBUG, TAG_VCW, "register callback");
254 g_stub_tidl_info->register_callback_requesting = true;
258 SLOG(LOG_ERROR, TAG_VCW, "Fail to rister callback(%d)", ret);
262 int vc_widget_tidl_open_connection()
264 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_open_connection");
265 pthread_mutex_lock(&g_w_tidl_mutex);
267 if (NULL != g_proxy_tidl_info) {
268 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] g_proxy_tidl_info already created");
269 pthread_mutex_unlock(&g_w_tidl_mutex);
270 return VC_ERROR_NONE;
273 g_proxy_tidl_info = (vc_widget_tidl_info_s*)calloc(1, sizeof(vc_widget_tidl_info_s));
275 if (NULL == g_proxy_tidl_info) {
276 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Fail to create vc_widget_tidl_info_s");
277 pthread_mutex_unlock(&g_w_tidl_mutex);
278 return VC_ERROR_OUT_OF_MEMORY;
281 char* engine_app_id = vconf_get_str(VC_ENGINE_DB_DEFAULT);
282 if (NULL == engine_app_id) {
283 SLOG(LOG_ERROR, TAG_VCW, "[TIDL] vconf not found");
284 free(g_proxy_tidl_info);
285 g_proxy_tidl_info = NULL;
286 pthread_mutex_unlock(&g_w_tidl_mutex);
287 return VC_ERROR_ENGINE_NOT_FOUND;
290 g_proxy_tidl_info->rpc_h = __create_rpc_port(engine_app_id);
291 if (NULL == g_proxy_tidl_info->rpc_h) {
292 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Fail to create proxy");
294 free(g_proxy_tidl_info);
295 g_proxy_tidl_info = NULL;
296 pthread_mutex_unlock(&g_w_tidl_mutex);
297 return VC_ERROR_OPERATION_FAILED;
300 SLOG(LOG_INFO, TAG_VCW, "[TIDL] rpc_h(%p), engine_app_id(%s)", g_proxy_tidl_info->rpc_h, engine_app_id);
303 g_stub_tidl_info = (vcd_widget_tidl_info_s*)calloc(1, sizeof(vcd_widget_tidl_info_s));
305 if (NULL == g_stub_tidl_info) {
306 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Fail to create vcd_widget_tidl_info_s");
307 pthread_mutex_unlock(&g_w_tidl_mutex);
308 return VC_ERROR_OUT_OF_MEMORY;
311 __register_stub_callback();
313 pthread_mutex_unlock(&g_w_tidl_mutex);
315 return VC_ERROR_NONE;
318 int vc_widget_tidl_close_connection()
320 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_close_connection");
321 pthread_mutex_lock(&g_w_tidl_mutex);
323 if (NULL == g_proxy_tidl_info) {
324 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
325 pthread_mutex_unlock(&g_w_tidl_mutex);
326 return VC_ERROR_OPERATION_FAILED;
329 if (0 != rpc_port_proxy_vc_widget_proxy_vc_widget_destroy(g_proxy_tidl_info->rpc_h)) {
330 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Fail to destroy tidl handle");
331 pthread_mutex_unlock(&g_w_tidl_mutex);
332 return VC_ERROR_OPERATION_FAILED;
335 g_proxy_tidl_info->rpc_h = NULL;
336 g_proxy_tidl_info->notify_cb_h = NULL;
338 free(g_proxy_tidl_info);
339 g_proxy_tidl_info = NULL;
341 free(g_stub_tidl_info);
342 g_stub_tidl_info = NULL;
344 pthread_mutex_unlock(&g_w_tidl_mutex);
346 return VC_ERROR_NONE;
349 static int __convert_unhandled_error(int ret)
351 if (RPC_PORT_ERROR_IO_ERROR == ret || RPC_PORT_ERROR_OUT_OF_MEMORY == ret) {
352 return VC_ERROR_OPERATION_FAILED;
358 static void __request_tidl_connect()
360 if (g_proxy_tidl_info->connection_requesting) {
364 int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_connect(g_proxy_tidl_info->rpc_h);
365 SLOG(LOG_INFO, TAG_VCW, "[INFO] Request connection to stub. ret(%d)", ret);
368 g_proxy_tidl_info->connection_requesting = true;
372 static int __create_callback_handles()
374 if (NULL != g_proxy_tidl_info->notify_cb_h) {
375 rpc_port_proxy_vc_widget_proxy_vc_widget_notify_cb_dispose(g_proxy_tidl_info->rpc_h, g_proxy_tidl_info->notify_cb_h);
376 g_proxy_tidl_info->notify_cb_h = NULL;
379 if (RPC_PORT_ERROR_NONE != rpc_port_proxy_vc_widget_proxy_vc_widget_notify_cb_create(&g_proxy_tidl_info->notify_cb_h)) {
380 return VC_ERROR_OUT_OF_MEMORY;
383 rpc_port_proxy_vc_widget_proxy_vc_widget_notify_cb_set_callback(g_proxy_tidl_info->notify_cb_h, __notify_cb, NULL);
385 rpc_port_proxy_vc_widget_proxy_vc_widget_notify_cb_set_once(g_proxy_tidl_info->notify_cb_h, false);
387 return VC_ERROR_NONE;
390 static int __invoke_register_callback()
392 if (g_proxy_tidl_info->register_callback_invoked) {
393 SLOG(LOG_ERROR, TAG_VCW, "[INFO] Already register callback is invoked");
394 return VC_ERROR_NONE;
397 int ret = __create_callback_handles(g_proxy_tidl_info);
398 if (VC_ERROR_NONE != ret) {
399 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to create callback handle. ret(%d)", ret);
400 return VC_ERROR_OPERATION_FAILED;
403 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);
404 g_proxy_tidl_info->register_callback_invoked = true;
405 return VC_ERROR_NONE;
408 int vc_widget_tidl_request_hello()
410 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_hello");
412 if (NULL == g_proxy_tidl_info) {
413 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get proxy tidl info");
414 return VC_ERROR_OPERATION_FAILED;
417 if (!g_proxy_tidl_info->connected) {
418 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Proxy Not Connected");
419 __request_tidl_connect();
420 return VC_ERROR_OPERATION_FAILED;
423 if (VC_ERROR_NONE != __invoke_register_callback()) {
424 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to invoke register callback");
425 return VC_ERROR_OPERATION_FAILED;
428 if (NULL == g_stub_tidl_info) {
429 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get stub tidl info");
430 return VC_ERROR_OPERATION_FAILED;
433 if (!g_stub_tidl_info->connected) {
434 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Stub Not Connected");
435 __register_stub_callback();
436 return VC_ERROR_OPERATION_FAILED;
439 SLOG(LOG_DEBUG, TAG_VCW, ">>>>> VCW Hello");
441 SLOG(LOG_DEBUG, TAG_VCW, "<<<<");
443 return VC_ERROR_NONE;
446 int vc_widget_tidl_request_initialize(int pid, int* service_state, int* daemon_pid)
448 pthread_mutex_lock(&g_w_init_mutex);
449 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_initialize");
451 if (NULL == g_proxy_tidl_info) {
452 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
453 pthread_mutex_unlock(&g_w_init_mutex);
454 return VC_ERROR_OPERATION_FAILED;
457 int temp_service_state = 0;
458 int temp_daemon_pid = 0;
459 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);
460 int exception = get_last_result();
461 if (RPC_PORT_ERROR_NONE != exception) {
462 ret = __convert_unhandled_error(exception);
465 if (VC_ERROR_NONE != ret) {
466 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget initialize : Fail to invoke message, error(%d)", ret);
467 pthread_mutex_unlock(&g_w_init_mutex);
471 *service_state = temp_service_state;
472 *daemon_pid = temp_daemon_pid;
474 pthread_mutex_unlock(&g_w_init_mutex);
475 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc widget initialize: service_state(%d), daemon_pid(%d)", *service_state, *daemon_pid);
477 return VC_ERROR_NONE;
480 int vc_widget_tidl_request_finalize(int pid)
482 pthread_mutex_lock(&g_w_init_mutex);
483 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_finalize");
485 if (NULL == g_proxy_tidl_info) {
486 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
487 pthread_mutex_unlock(&g_w_init_mutex);
488 return VC_ERROR_OPERATION_FAILED;
491 if (!g_proxy_tidl_info->connected) {
492 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
493 pthread_mutex_unlock(&g_w_init_mutex);
494 return VC_ERROR_OPERATION_FAILED;
497 int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_finalize(g_proxy_tidl_info->rpc_h, pid);
498 int exception = get_last_result();
499 if (RPC_PORT_ERROR_NONE != exception) {
500 ret = __convert_unhandled_error(exception);
503 if (VC_ERROR_NONE != ret) {
504 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget finalize : Fail to invoke message, error(%d)", ret);
505 pthread_mutex_unlock(&g_w_init_mutex);
509 pthread_mutex_unlock(&g_w_init_mutex);
510 return VC_ERROR_NONE;
513 int vc_widget_tidl_request_start_recording(int pid, bool command)
515 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_start_recording");
517 if (NULL == g_proxy_tidl_info) {
518 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
519 return VC_ERROR_OPERATION_FAILED;
522 if (!g_proxy_tidl_info->connected) {
523 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
524 return VC_ERROR_OPERATION_FAILED;
527 int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_start_recording(g_proxy_tidl_info->rpc_h, pid, (int)command);
528 int exception = get_last_result();
529 if (RPC_PORT_ERROR_NONE != exception) {
530 ret = __convert_unhandled_error(exception);
533 if (VC_ERROR_NONE != ret) {
534 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget start recording : Fail to invoke message, error(%d)", ret);
538 return VC_ERROR_NONE;
541 int vc_widget_tidl_set_foreground(int pid, bool value)
543 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_set_foreground");
545 if (NULL == g_proxy_tidl_info) {
546 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
547 return VC_ERROR_OPERATION_FAILED;
550 if (!g_proxy_tidl_info->connected) {
551 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
552 return VC_ERROR_OPERATION_FAILED;
555 // TODO: Error tolerance cannot be applied because this function is asynchronous.
556 rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_set_foreground(g_proxy_tidl_info->rpc_h, pid, (int)value);
558 return VC_ERROR_NONE;
561 int vc_widget_tidl_request_enable_asr_result(int pid, bool enable)
563 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_enable_asr_result");
565 if (NULL == g_proxy_tidl_info) {
566 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
567 return VC_ERROR_OPERATION_FAILED;
570 if (!g_proxy_tidl_info->connected) {
571 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
572 return VC_ERROR_OPERATION_FAILED;
575 int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_enable_asr_result(g_proxy_tidl_info->rpc_h, pid, (int)enable);
576 int exception = get_last_result();
577 if (RPC_PORT_ERROR_NONE != exception) {
578 ret = __convert_unhandled_error(exception);
581 if (VC_ERROR_NONE != ret) {
582 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget enable asr result : Fail to invoke message, error(%d)", ret);
586 return VC_ERROR_NONE;
589 int vc_widget_tidl_request_start(int pid, int silence)
591 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_start");
593 if (NULL == g_proxy_tidl_info) {
594 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
595 return VC_ERROR_OPERATION_FAILED;
598 if (!g_proxy_tidl_info->connected) {
599 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
600 return VC_ERROR_OPERATION_FAILED;
603 int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_start(g_proxy_tidl_info->rpc_h, pid, silence);
604 int exception = get_last_result();
605 if (RPC_PORT_ERROR_NONE != exception) {
606 ret = __convert_unhandled_error(exception);
609 if (VC_ERROR_NONE != ret) {
610 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget start : Fail to invoke message, error(%d)", ret);
614 return VC_ERROR_NONE;
617 int vc_widget_tidl_request_stop(int pid)
619 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_stop");
621 if (NULL == g_proxy_tidl_info) {
622 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
623 return VC_ERROR_OPERATION_FAILED;
626 if (!g_proxy_tidl_info->connected) {
627 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
628 return VC_ERROR_OPERATION_FAILED;
631 int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_stop(g_proxy_tidl_info->rpc_h, pid);
632 int exception = get_last_result();
633 if (RPC_PORT_ERROR_NONE != exception) {
634 ret = __convert_unhandled_error(exception);
637 if (VC_ERROR_NONE != ret) {
638 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget stop : Fail to invoke message, error(%d)", ret);
642 return VC_ERROR_NONE;
645 int vc_widget_tidl_request_cancel(int pid)
647 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_cancel");
649 if (NULL == g_proxy_tidl_info) {
650 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
651 return VC_ERROR_OPERATION_FAILED;
654 if (!g_proxy_tidl_info->connected) {
655 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
656 return VC_ERROR_OPERATION_FAILED;
659 int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_cancel(g_proxy_tidl_info->rpc_h, pid);
660 int exception = get_last_result();
661 if (RPC_PORT_ERROR_NONE != exception) {
662 ret = __convert_unhandled_error(exception);
665 if (VC_ERROR_NONE != ret) {
666 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget cancel : Fail to invoke message, error(%d)", ret);
670 return VC_ERROR_NONE;