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_h rpc_h;
31 rpc_port_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_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_WIDGET_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_WIDGET_BUNDLE_MESSAGE, &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 SLOG(LOG_DEBUG, TAG_VCW, "@@@");
75 } /* VCD_METHOD_HELLO */
77 else if (0 == strncmp(VCD_WIDGET_METHOD_SET_SERVICE_STATE, method, strlen(VCD_WIDGET_METHOD_SET_SERVICE_STATE))) {
78 bundle_get_str(msg, VC_WIDGET_BUNDLE_MESSAGE, &val);
82 SLOG(LOG_INFO, TAG_VCW, "@@ service state changed : %d", state);
83 __vc_widget_cb_service_state(state);
85 } /* VCD_WIDGET_METHOD_SET_SERVICE_STATE */
87 else if (0 == strncmp(VCD_WIDGET_METHOD_SHOW_TOOLTIP, method, strlen(VCD_WIDGET_METHOD_SHOW_TOOLTIP))) {
88 SLOG(LOG_DEBUG, TAG_VCW, "@@@ Show / Hide tooltip");
89 char* temp_show = NULL;
90 bundle_get_str(msg, VC_WIDGET_BUNDLE_MESSAGE, &val);
91 bundle_get_str(msg, VC_WIDGET_BUNDLE_SHOW, &temp_show);
99 show = atoi(temp_show);
103 SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget show tooltip : pid(%d), show(%d)", pid, show);
104 __vc_widget_cb_show_tooltip(pid, (bool)show);
106 SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget show tooltip : invalid pid");
108 SLOG(LOG_DEBUG, TAG_VCW, "@@@");
109 } /* VCD_WIDGET_METHOD_SHOW_TOOLTIP */
111 else if (0 == strncmp(VCD_WIDGET_METHOD_RESULT, method, strlen(VCD_WIDGET_METHOD_RESULT))) {
112 SLOG(LOG_DEBUG, TAG_VCW, "@@@ Get widget result");
114 __vc_widget_cb_result();
116 SLOG(LOG_DEBUG, TAG_VCW, "@@@");
117 } /* VCD_WIDGET_METHOD_RESULT */
119 else if (0 == strncmp(VCD_WIDGET_METHOD_ERROR, method, strlen(VCD_WIDGET_METHOD_ERROR))) {
120 SLOG(LOG_INFO, TAG_VCW, "@@@ Get Pre Result");
121 char* temp_reason = NULL;
122 char* temp_daemon_pid = NULL;
123 char* err_msg = NULL;
125 bundle_get_str(msg, VC_WIDGET_BUNDLE_REASON, &temp_reason);
126 bundle_get_str(msg, VC_WIDGET_BUNDLE_DAEMON_PID, &temp_daemon_pid);
127 bundle_get_str(msg, VC_WIDGET_BUNDLE_ERROR_MESSAGE, &err_msg);
131 if (NULL != temp_reason) {
132 reason = atoi(temp_reason);
134 if (NULL != temp_daemon_pid) {
135 daemon_pid = atoi(temp_daemon_pid);
138 SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget get error message : reason(%d), daemon_pid(%d), msg(%s)", reason, daemon_pid, err_msg);
139 __vc_widget_cb_error(reason, daemon_pid, err_msg);
141 SLOG(LOG_DEBUG, TAG_VCW, "@@@");
142 } /* VCD_WIDGET_METHOD_ERROR */
145 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Invalid msg");
149 static void __on_connected(rpc_port_proxy_vc_widget_h h, void *user_data)
151 g_proxy_tidl_info->connected = true;
152 g_proxy_tidl_info->connection_requesting = false;
153 g_proxy_tidl_info->register_callback_invoked = false;
155 SLOG(LOG_INFO, TAG_VCW, "Connected to server");
158 static void __on_disconnected(rpc_port_proxy_vc_widget_h h, void *user_data)
160 g_proxy_tidl_info->connected = false;
161 g_proxy_tidl_info->connection_requesting = false;
162 g_proxy_tidl_info->register_callback_invoked = false;
164 SLOG(LOG_INFO, TAG_VCW, "Disonnected to server");
166 SLOG(LOG_INFO, TAG_VCW, "Re-connection start");
167 __vc_widget_cb_error(VC_ERROR_SERVICE_RESET, -1, "Server Disconnected, re-launch");
170 static void __on_rejected(rpc_port_proxy_vc_widget_h h, void *user_data)
172 g_proxy_tidl_info->connection_requesting = false;
173 g_proxy_tidl_info->register_callback_invoked = false;
175 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Rejected from server");
179 static rpc_port_proxy_vc_widget_h __create_rpc_port(const char* engine_app_id)
181 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] __create_rpc_port");
182 rpc_port_proxy_vc_widget_callback_s rpc_callback = {
183 .connected = __on_connected,
184 .disconnected = __on_disconnected,
185 .rejected = __on_rejected
188 rpc_port_proxy_vc_widget_h handle = NULL;
189 if (0 != rpc_port_proxy_vc_widget_create(engine_app_id, &rpc_callback, NULL, &handle)) {
190 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Fail to create proxy");
197 static void __vcd_widget_create_cb(rpc_port_stub_vcd_widget_context_h context, void *user_data)
199 g_stub_tidl_info->connected = true;
200 g_stub_tidl_info->register_callback_requesting = false;
202 SLOG(LOG_DEBUG, TAG_VCW, "Connected to server");
206 rpc_port_stub_vcd_widget_context_get_sender(context, &sender);
208 SLOG(LOG_ERROR, TAG_VCW, "@@@ Sender is NULL");
212 SLOG(LOG_DEBUG, TAG_VCW, "@@@ Server connect. appid(%s)", sender);
216 static void __vcd_widget_terminate_cb(rpc_port_stub_vcd_widget_context_h context, void *user_data)
218 g_stub_tidl_info->connected = false;
219 g_stub_tidl_info->register_callback_requesting = false;
221 rpc_port_stub_vcd_widget_context_set_tag(context, NULL);
224 rpc_port_stub_vcd_widget_context_get_sender(context, &sender);
228 SLOG(LOG_INFO, TAG_VCW, "@@@ Server disconnect. appid(%s)", sender);
232 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)
234 SLOG(LOG_DEBUG, TAG_VCW, "@@@ Get widget asr result");
237 result = __vc_widget_cb_asr_result(event, asr_result);
238 *is_consumed = result;
240 return VC_ERROR_NONE;
243 static void __register_stub_callback()
245 if (g_stub_tidl_info->register_callback_requesting) {
249 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] __register_stub_callback");
251 g_widget_callback.create = __vcd_widget_create_cb;
252 g_widget_callback.terminate = __vcd_widget_terminate_cb;
253 g_widget_callback.send_asr_result = __vcd_widget_asr_result_cb;
256 ret = rpc_port_stub_vcd_widget_register(&g_widget_callback, NULL);
258 SLOG(LOG_DEBUG, TAG_VCW, "register callback");
259 g_stub_tidl_info->register_callback_requesting = true;
263 SLOG(LOG_ERROR, TAG_VCW, "Fail to rister callback(%d)", ret);
267 int vc_widget_tidl_open_connection()
269 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_open_connection");
270 pthread_mutex_lock(&g_w_tidl_mutex);
272 if (NULL != g_proxy_tidl_info) {
273 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] g_proxy_tidl_info already created");
274 pthread_mutex_unlock(&g_w_tidl_mutex);
275 return VC_ERROR_NONE;
278 g_proxy_tidl_info = (vc_widget_tidl_info_s*)calloc(1, sizeof(vc_widget_tidl_info_s));
280 if (NULL == g_proxy_tidl_info) {
281 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Fail to create vc_widget_tidl_info_s");
282 pthread_mutex_unlock(&g_w_tidl_mutex);
283 return VC_ERROR_OUT_OF_MEMORY;
286 char* engine_app_id = vconf_get_str(VC_ENGINE_DB_DEFAULT);
287 if (NULL == engine_app_id) {
288 SLOG(LOG_ERROR, TAG_VCW, "[TIDL] vconf not found");
289 free(g_proxy_tidl_info);
290 g_proxy_tidl_info = NULL;
291 pthread_mutex_unlock(&g_w_tidl_mutex);
292 return VC_ERROR_ENGINE_NOT_FOUND;
295 g_proxy_tidl_info->rpc_h = __create_rpc_port(engine_app_id);
296 if (NULL == g_proxy_tidl_info->rpc_h) {
297 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Fail to create proxy");
299 free(g_proxy_tidl_info);
300 g_proxy_tidl_info = NULL;
301 pthread_mutex_unlock(&g_w_tidl_mutex);
302 return VC_ERROR_OPERATION_FAILED;
305 SLOG(LOG_INFO, TAG_VCW, "[TIDL] rpc_h(%p), engine_app_id(%s)", g_proxy_tidl_info->rpc_h, engine_app_id);
308 g_stub_tidl_info = (vcd_widget_tidl_info_s*)calloc(1, sizeof(vcd_widget_tidl_info_s));
310 if (NULL == g_stub_tidl_info) {
311 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Fail to create vcd_widget_tidl_info_s");
312 pthread_mutex_unlock(&g_w_tidl_mutex);
313 return VC_ERROR_OUT_OF_MEMORY;
316 __register_stub_callback();
318 pthread_mutex_unlock(&g_w_tidl_mutex);
320 return VC_ERROR_NONE;
323 int vc_widget_tidl_close_connection()
325 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_close_connection");
326 pthread_mutex_lock(&g_w_tidl_mutex);
328 if (NULL == g_proxy_tidl_info) {
329 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
330 pthread_mutex_unlock(&g_w_tidl_mutex);
331 return VC_ERROR_OPERATION_FAILED;
334 if (0 != rpc_port_proxy_vc_widget_destroy(g_proxy_tidl_info->rpc_h)) {
335 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Fail to destroy tidl handle");
336 pthread_mutex_unlock(&g_w_tidl_mutex);
337 return VC_ERROR_OPERATION_FAILED;
340 g_proxy_tidl_info->rpc_h = NULL;
341 g_proxy_tidl_info->notify_cb_h = NULL;
343 free(g_proxy_tidl_info);
344 g_proxy_tidl_info = NULL;
346 free(g_stub_tidl_info);
347 g_stub_tidl_info = NULL;
349 pthread_mutex_unlock(&g_w_tidl_mutex);
351 return VC_ERROR_NONE;
354 static void __request_tidl_connect()
356 if (g_proxy_tidl_info->connection_requesting) {
360 int ret = rpc_port_proxy_vc_widget_connect(g_proxy_tidl_info->rpc_h);
361 SLOG(LOG_INFO, TAG_VCW, "[INFO] Request connection to stub. ret(%d)", ret);
364 g_proxy_tidl_info->connection_requesting = true;
368 static int __create_callback_handles()
370 if (NULL != g_proxy_tidl_info->notify_cb_h) {
371 rpc_port_proxy_vc_widget_notify_cb_dispose(g_proxy_tidl_info->rpc_h, g_proxy_tidl_info->notify_cb_h);
372 g_proxy_tidl_info->notify_cb_h = NULL;
375 if (RPC_PORT_ERROR_NONE != rpc_port_proxy_vc_widget_notify_cb_create(&g_proxy_tidl_info->notify_cb_h)) {
376 return VC_ERROR_OUT_OF_MEMORY;
379 rpc_port_proxy_vc_widget_notify_cb_set_callback(g_proxy_tidl_info->notify_cb_h, __notify_cb, NULL);
381 rpc_port_proxy_vc_widget_notify_cb_set_once(g_proxy_tidl_info->notify_cb_h, false);
383 return VC_ERROR_NONE;
386 static int __invoke_register_callback()
388 if (g_proxy_tidl_info->register_callback_invoked) {
389 SLOG(LOG_ERROR, TAG_VCW, "[INFO] Already register callback is invoked");
390 return VC_ERROR_NONE;
393 int ret = __create_callback_handles(g_proxy_tidl_info);
394 if (VC_ERROR_NONE != ret) {
395 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to create callback handle. ret(%d)", ret);
396 return VC_ERROR_OPERATION_FAILED;
399 rpc_port_proxy_vc_widget_invoke_register_cb(g_proxy_tidl_info->rpc_h, getpid(), g_proxy_tidl_info->notify_cb_h);
400 g_proxy_tidl_info->register_callback_invoked = true;
401 return VC_ERROR_NONE;
404 int vc_widget_tidl_request_hello()
406 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_hello");
408 if (NULL == g_proxy_tidl_info) {
409 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get proxy tidl info");
410 return VC_ERROR_OPERATION_FAILED;
413 if (!g_proxy_tidl_info->connected) {
414 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Proxy Not Connected");
415 __request_tidl_connect();
416 return VC_ERROR_OPERATION_FAILED;
419 if (VC_ERROR_NONE != __invoke_register_callback()) {
420 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to invoke register callback");
421 return VC_ERROR_OPERATION_FAILED;
424 if (NULL == g_stub_tidl_info) {
425 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get stub tidl info");
426 return VC_ERROR_OPERATION_FAILED;
429 if (!g_stub_tidl_info->connected) {
430 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Stub Not Connected");
431 __register_stub_callback();
432 return VC_ERROR_OPERATION_FAILED;
435 SLOG(LOG_DEBUG, TAG_VCW, ">>>>> VCW Hello");
437 SLOG(LOG_DEBUG, TAG_VCW, "<<<<");
439 return VC_ERROR_NONE;
442 int vc_widget_tidl_request_initialize(int pid, int* service_state, int* daemon_pid)
444 pthread_mutex_lock(&g_w_init_mutex);
445 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_initialize");
447 if (NULL == g_proxy_tidl_info) {
448 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
449 pthread_mutex_unlock(&g_w_init_mutex);
450 return VC_ERROR_OPERATION_FAILED;
453 int temp_service_state = 0;
454 int temp_daemon_pid = 0;
455 int ret = rpc_port_proxy_vc_widget_invoke_initialize(g_proxy_tidl_info->rpc_h, pid, &temp_service_state, &temp_daemon_pid);
456 if (RPC_PORT_ERROR_NONE != ret) {
457 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget initialize : Fail to invoke message, error(%d)", ret);
458 pthread_mutex_unlock(&g_w_init_mutex);
462 *service_state = temp_service_state;
463 *daemon_pid = temp_daemon_pid;
465 pthread_mutex_unlock(&g_w_init_mutex);
466 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc widget initialize: service_state(%d), daemon_pid(%d)", *service_state, *daemon_pid);
468 return VC_ERROR_NONE;
471 int vc_widget_tidl_request_finalize(int pid)
473 pthread_mutex_lock(&g_w_init_mutex);
474 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_finalize");
476 if (NULL == g_proxy_tidl_info) {
477 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
478 pthread_mutex_unlock(&g_w_init_mutex);
479 return VC_ERROR_OPERATION_FAILED;
482 if (!g_proxy_tidl_info->connected) {
483 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
484 pthread_mutex_unlock(&g_w_init_mutex);
485 return VC_ERROR_OPERATION_FAILED;
488 int ret = rpc_port_proxy_vc_widget_invoke_finalize(g_proxy_tidl_info->rpc_h, pid);
489 if (RPC_PORT_ERROR_NONE != ret) {
490 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget finalize : Fail to invoke message, error(%d)", ret);
491 pthread_mutex_unlock(&g_w_init_mutex);
495 pthread_mutex_unlock(&g_w_init_mutex);
496 return VC_ERROR_NONE;
499 int vc_widget_tidl_request_start_recording(int pid, bool command)
501 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_start_recording");
503 if (NULL == g_proxy_tidl_info) {
504 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
505 return VC_ERROR_OPERATION_FAILED;
508 if (!g_proxy_tidl_info->connected) {
509 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
510 return VC_ERROR_OPERATION_FAILED;
513 int ret = rpc_port_proxy_vc_widget_invoke_start_recording(g_proxy_tidl_info->rpc_h, pid, (int)command);
514 if (RPC_PORT_ERROR_NONE != ret) {
515 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget start recording : Fail to invoke message, error(%d)", ret);
519 return VC_ERROR_NONE;
522 int vc_widget_tidl_set_foreground(int pid, bool value)
524 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_set_foreground");
526 if (NULL == g_proxy_tidl_info) {
527 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
528 return VC_ERROR_OPERATION_FAILED;
531 if (!g_proxy_tidl_info->connected) {
532 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
533 return VC_ERROR_OPERATION_FAILED;
536 // TODO: Error tolerance cannot be applied because this function is asynchronous.
537 rpc_port_proxy_vc_widget_invoke_set_foreground(g_proxy_tidl_info->rpc_h, pid, (int)value);
539 return VC_ERROR_NONE;
542 int vc_widget_tidl_request_enable_asr_result(int pid, bool enable)
544 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_enable_asr_result");
546 if (NULL == g_proxy_tidl_info) {
547 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
548 return VC_ERROR_OPERATION_FAILED;
551 if (!g_proxy_tidl_info->connected) {
552 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
553 return VC_ERROR_OPERATION_FAILED;
556 int ret = rpc_port_proxy_vc_widget_invoke_enable_asr_result(g_proxy_tidl_info->rpc_h, pid, (int)enable);
557 if (RPC_PORT_ERROR_NONE != ret) {
558 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget enable asr result : Fail to invoke message, error(%d)", ret);
562 return VC_ERROR_NONE;
565 int vc_widget_tidl_request_start(int pid, int silence)
567 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_start");
569 if (NULL == g_proxy_tidl_info) {
570 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
571 return VC_ERROR_OPERATION_FAILED;
574 if (!g_proxy_tidl_info->connected) {
575 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
576 return VC_ERROR_OPERATION_FAILED;
579 int ret = rpc_port_proxy_vc_widget_invoke_start(g_proxy_tidl_info->rpc_h, pid, silence);
580 if (RPC_PORT_ERROR_NONE != ret) {
581 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget start : Fail to invoke message, error(%d)", ret);
585 return VC_ERROR_NONE;
588 int vc_widget_tidl_request_stop(int pid)
590 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_stop");
592 if (NULL == g_proxy_tidl_info) {
593 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
594 return VC_ERROR_OPERATION_FAILED;
597 if (!g_proxy_tidl_info->connected) {
598 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
599 return VC_ERROR_OPERATION_FAILED;
602 int ret = rpc_port_proxy_vc_widget_invoke_stop(g_proxy_tidl_info->rpc_h, pid);
603 if (RPC_PORT_ERROR_NONE != ret) {
604 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget stop : Fail to invoke message, error(%d)", ret);
608 return VC_ERROR_NONE;
611 int vc_widget_tidl_request_cancel(int pid)
613 SLOG(LOG_DEBUG, TAG_VCW, "[TIDL] vc_widget_tidl_request_cancel");
615 if (NULL == g_proxy_tidl_info) {
616 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get tidl info");
617 return VC_ERROR_OPERATION_FAILED;
620 if (!g_proxy_tidl_info->connected) {
621 SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Not Connected");
622 return VC_ERROR_OPERATION_FAILED;
625 int ret = rpc_port_proxy_vc_widget_invoke_cancel(g_proxy_tidl_info->rpc_h, pid);
626 if (RPC_PORT_ERROR_NONE != ret) {
627 SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget cancel : Fail to invoke message, error(%d)", ret);
631 return VC_ERROR_NONE;