2 * Copyright (c) 2011-2015 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.
17 #include "vc_command.h"
27 bool connection_requesting;
28 bool register_notify_callback_invoked;
29 bool register_feedback_callback_invoked;
31 rpc_port_proxy_vc_proxy_vc_h rpc_h;
32 rpc_port_proxy_vc_proxy_vc_notify_cb_h notify_cb_h;
33 rpc_port_proxy_vc_proxy_vc_feedback_cb_h feedback_cb_h;
38 static GList* g_tidl_infos = NULL;
40 extern int __vc_cb_error(int reason, int daemon_pid, char* msg);
41 extern int __vc_cb_error_to_app(int pid, int reason, char* msg);
42 extern void __vc_cb_result();
43 extern int __vc_cb_service_state(int state);
44 extern int __vc_cb_manager_pid(int manager_pid);
45 extern int __vc_cb_tts_streaming(int utt_id, vc_feedback_event_e event, char* buffer, int len);
46 extern int __vc_cb_utterance_status(int utt_id, int utt_status);
49 static vc_tidl_info_s* __get_tidl_info_s(int pid)
52 vc_tidl_info_s* info = NULL;
54 if (g_list_length(g_tidl_infos) > 0) {
55 /* Get a first item */
56 iter = g_list_first(g_tidl_infos);
58 while (NULL != iter) {
61 if (info->pid == pid) {
66 iter = g_list_next(iter);
73 static char* __get_engine_appid(void)
75 char* engine_name = vconf_get_str(VC_ENGINE_DB_DEFAULT);
76 if (NULL == engine_name) {
77 SLOG(LOG_WARN, TAG_VCC, "[WARNING] Fail to get engine name. Please use default engine name.");
78 engine_name = strdup("org.tizen.vc-engine-default");
81 char* appid = strdup(engine_name);
83 SLOG(LOG_INFO, TAG_VCC, "[INFO] VC engine appid(%s)", appid);
88 static void __on_connected(rpc_port_proxy_vc_proxy_vc_h h, void* user_data)
90 unsigned int pid = (uintptr_t)user_data;
92 vc_tidl_info_s* info = __get_tidl_info_s(pid);
93 RETM_IF(NULL == info, "[ERROR] Fail to get tidl info");
95 info->connected = true;
96 info->connection_requesting = false;
97 info->register_notify_callback_invoked = false;
99 SLOG(LOG_INFO, TAG_VCC, "[INFO] Connected to server");
102 static void __on_disconnected(rpc_port_proxy_vc_proxy_vc_h h, void* user_data)
104 unsigned int pid = (uintptr_t)user_data;
106 vc_tidl_info_s* info = __get_tidl_info_s(pid);
107 RETM_IF(NULL == info, "[ERROR] Fail to get tidl info");
109 info->connected = false;
110 info->connection_requesting = false;
111 info->register_notify_callback_invoked = false;
113 /* retry to connect */
114 SLOG(LOG_INFO, TAG_VCC, "[INFO] Disconnected to server");
117 static void __on_rejected(rpc_port_proxy_vc_proxy_vc_h h, void* user_data)
119 unsigned int pid = (uintptr_t)user_data;
121 vc_tidl_info_s* info = __get_tidl_info_s(pid);
122 RETM_IF(NULL == info, "[ERROR] Fail to get tidl info");
124 info->connection_requesting = false;
125 info->register_notify_callback_invoked = false;
127 SLOG(LOG_INFO, TAG_VCC, "[INFO] Rejected from server(%d)", pid);
131 static rpc_port_proxy_vc_proxy_vc_h __create_rpc_port(int pid, const char* engine_app_id)
133 SLOG(LOG_INFO, TAG_VCC, "[INFO] vc __create_rpc_port");
135 rpc_port_proxy_vc_proxy_vc_callback_s rpc_callback = {
136 .connected = __on_connected,
137 .disconnected = __on_disconnected,
138 .rejected = __on_rejected
141 rpc_port_proxy_vc_proxy_vc_h handle = NULL;
142 uintptr_t ptr_pid = pid;
143 if (0 != rpc_port_proxy_vc_proxy_vc_create(engine_app_id, &rpc_callback, (void*)ptr_pid, &handle)) {
146 SLOG(LOG_DEBUG, TAG_VCC, "[DEBUG] Succeed rpc_port_proxy_vc_proxy_vc_create");
151 static void __request_tidl_connect(vc_tidl_info_s* info)
153 if (info->connection_requesting) {
154 SLOG(LOG_INFO, TAG_VCC, "[TIDL] Already connection is requested. Skip to call rpc_port_proxy_vc_proxy_vc_connect().");
158 int ret = rpc_port_proxy_vc_proxy_vc_connect(info->rpc_h);
160 SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request connection to stub. ret(%d)", ret);
164 SLOG(LOG_INFO, TAG_VCC, "[INFO] Request connection to stub. ret(%d)", ret);
165 info->connection_requesting = true;
168 static void __notify_cb(void* user_data, int pid, bundle* msg)
170 // corresponding to listener_event_callback
173 SLOG(LOG_DEBUG, TAG_VCC, "__notify_cb is invoked pid(%d)", pid);
175 bundle_get_str(msg, VC_BUNDLE_METHOD, &method);
177 if (0 == strncmp(VCD_METHOD_HELLO, method, strlen(VCD_METHOD_HELLO))) {
178 } /* VCD_METHOD_HELLO */
179 else if (0 == strncmp(VCD_METHOD_SET_SERVICE_STATE, method, strlen(VCD_METHOD_SET_SERVICE_STATE))) {
182 bundle_get_str(msg, VC_BUNDLE_SERVICE_STATE, &state);
184 __vc_cb_service_state(atoi(state));
186 } /* VCD_METHOD_SET_SERVICE_STATE */
187 else if (0 == strncmp(VCD_METHOD_RESULT, method, strlen(VCD_METHOD_RESULT))) {
188 SLOG(LOG_DEBUG, TAG_VCC, "@@@ Get Client Result");
191 } /* VCD_METHOD_RESULT */
192 else if (0 == strncmp(VCD_METHOD_SEND_MANAGER_PID, method, strlen(VCD_METHOD_SEND_MANAGER_PID))) {
194 char* manager_pid = NULL;
195 bundle_get_str(msg, VC_BUNDLE_MANAGER_PID, &manager_pid);
197 SLOG(LOG_DEBUG, TAG_VCC, "@@ manager pid is changed : %d", atoi(manager_pid));
198 __vc_cb_manager_pid(atoi(manager_pid));
200 } /* VCD_METHOD_SEND_MANAGER_PID */
201 else if (0 == strncmp(VCD_METHOD_ERROR, method, strlen(VCD_METHOD_ERROR))) {
204 char* daemon_pid = NULL;
205 char* err_msg = NULL;
207 bundle_get_str(msg, VC_BUNDLE_REASON, &reason);
208 bundle_get_str(msg, VC_BUNDLE_DAEMON_PID, &daemon_pid);
209 bundle_get_str(msg, VC_BUNDLE_ERR_MSG, &err_msg);
211 SLOG(LOG_DEBUG, TAG_VCC, "@@ vc Get Error message : reason(%d), daemon_pid(%d), msg(%s)", atoi(reason), atoi(daemon_pid), err_msg);
212 __vc_cb_error(atoi(reason), atoi(daemon_pid), err_msg);
213 } /* VCD_METHOD_ERROR */
214 else if (0 == strncmp(VCD_METHOD_ERROR_TO_APP, method, strlen(VCD_METHOD_ERROR_TO_APP))) {
218 char* err_msg = NULL;
220 bundle_get_str(msg, VC_BUNDLE_PID, &pid);
221 bundle_get_str(msg, VC_BUNDLE_REASON, &reason);
222 bundle_get_str(msg, VC_BUNDLE_ERR_MSG, &err_msg);
224 SLOG(LOG_DEBUG, TAG_VCC, "@@ vc Get Error message : reason(%d), pid(%d), msg(%s)", atoi(reason), atoi(pid), err_msg);
225 __vc_cb_error_to_app(atoi(pid), atoi(reason), err_msg);
226 } /* VCD_METHOD_ERROR_TO_APP */
227 else if (0 == strncmp(VC_MANAGER_METHOD_UTTERANCE_STATUS, method, strlen(VC_MANAGER_METHOD_UTTERANCE_STATUS))) {
231 char* utt_status = NULL;
233 bundle_get_str(msg, VC_BUNDLE_PID, &pid);
234 bundle_get_str(msg, VC_BUNDLE_UTT_ID, &utt_id);
235 bundle_get_str(msg, VC_BUNDLE_UTT_STATUS, &utt_status);
237 SLOG(LOG_DEBUG, TAG_VCC, "@@ vc Get utterance status : pid(%d), utt_id(%d), utt_status(%d)", atoi(pid), atoi(utt_id), atoi(utt_status));
238 __vc_cb_utterance_status(atoi(utt_id), atoi(utt_status));
239 } /* VC_MANAGER_METHOD_UTTERANCE_STATUS */
241 SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid msg");
245 void __feedback_cb(void *user_data, int utt_id, int event, rpc_port_proxy_vc_proxy_array_char_h pcm_data, int len)
247 // corresponding to listener_event_callback (only for tts_streaming)
248 SLOG(LOG_DEBUG, TAG_VCC, "__feedback_cb is invoked. utt_id(%d), event(%d), pcm_len(%d)", utt_id, event, len);
250 char* data_char = NULL;
251 rpc_port_proxy_vc_proxy_array_char_get(pcm_data, &data_char, &len);
253 /* VCD_METHOD_FEEDBACK_STREAMING */
254 __vc_cb_tts_streaming(utt_id, event, data_char, len);
256 if (NULL != data_char) {
263 static int __create_notify_callback_handle(vc_tidl_info_s* info)
266 SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid parameter");
267 return VC_ERROR_INVALID_PARAMETER;
270 if (NULL != info->notify_cb_h) {
271 rpc_port_proxy_vc_proxy_vc_notify_cb_dispose(info->rpc_h, info->notify_cb_h);
272 info->notify_cb_h = NULL;
275 int ret = rpc_port_proxy_vc_proxy_vc_notify_cb_create(&info->notify_cb_h);
276 if (RPC_PORT_ERROR_NONE != ret) {
277 SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to invoke rpc_port_proxy_vc_proxy_vc_notify_cb_create(). err(%d)", ret);
278 return VC_ERROR_OUT_OF_MEMORY;
281 rpc_port_proxy_vc_proxy_vc_notify_cb_set_callback(info->notify_cb_h, __notify_cb, NULL);
282 rpc_port_proxy_vc_proxy_vc_notify_cb_set_once(info->notify_cb_h, false);
284 return VC_ERROR_NONE;
287 static int __create_feedback_callback_handle(vc_tidl_info_s* info)
290 SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid parameter");
291 return VC_ERROR_INVALID_PARAMETER;
294 if (NULL != info->feedback_cb_h) {
295 rpc_port_proxy_vc_proxy_vc_feedback_cb_dispose(info->rpc_h, info->feedback_cb_h);
296 info->feedback_cb_h = NULL;
299 int ret = rpc_port_proxy_vc_proxy_vc_feedback_cb_create(&info->feedback_cb_h);
300 if (RPC_PORT_ERROR_NONE != ret) {
301 SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to invoke rpc_port_proxy_vc_proxy_vc_feedback_cb_create(). err(%d)", ret);
302 return VC_ERROR_OUT_OF_MEMORY;
305 rpc_port_proxy_vc_proxy_vc_feedback_cb_set_callback(info->feedback_cb_h, __feedback_cb, NULL);
306 rpc_port_proxy_vc_proxy_vc_feedback_cb_set_once(info->feedback_cb_h, false);
308 return VC_ERROR_NONE;
311 static int __invoke_register_notify_callback(int pid, vc_tidl_info_s* info)
313 if (info->register_notify_callback_invoked) {
314 SLOG(LOG_ERROR, TAG_VCC, "[INFO] Already register callback is invoked");
315 return VC_ERROR_NONE;
318 int ret = __create_notify_callback_handle(info);
319 if (VC_ERROR_NONE != ret) {
320 SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to create callback handle. ret(%d)", ret);
321 return VC_ERROR_OPERATION_FAILED;
324 rpc_port_proxy_vc_proxy_vc_invoke_register_notify_cb(info->rpc_h, pid, info->notify_cb_h);
325 info->register_notify_callback_invoked = true;
326 return VC_ERROR_NONE;
329 static int __invoke_register_feedback_callback(int pid, vc_tidl_info_s* info)
331 if (info->register_feedback_callback_invoked) {
332 SLOG(LOG_ERROR, TAG_VCC, "[INFO] Already register callback is invoked");
333 return VC_ERROR_NONE;
336 int ret = __create_feedback_callback_handle(info);
337 if (VC_ERROR_NONE != ret) {
338 SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to create callback handle. ret(%d)", ret);
339 return VC_ERROR_OPERATION_FAILED;
342 rpc_port_proxy_vc_proxy_vc_invoke_register_feedback_cb(info->rpc_h, pid, info->feedback_cb_h);
343 info->register_feedback_callback_invoked = true;
344 return VC_ERROR_NONE;
347 int vc_tidl_open_connection()
349 SLOG(LOG_INFO, TAG_VCC, "[TIDL] vc_tidl_open_connection");
351 vc_tidl_info_s* info = (vc_tidl_info_s*)calloc(1, sizeof(vc_tidl_info_s));
353 SLOG(LOG_ERROR, TAG_VCC, "[TIDL ERROR] Fail to create tidl_info_s");
354 return VC_ERROR_OUT_OF_MEMORY;
358 char* engine_appid = __get_engine_appid();
360 info->rpc_h = __create_rpc_port(pid, engine_appid);
361 if (NULL == info->rpc_h) {
362 SLOG(LOG_ERROR, TAG_VCC, "[TIDL ERROR] Fail to create proxy");
364 return VC_ERROR_OPERATION_FAILED;
368 g_tidl_infos = g_list_append(g_tidl_infos, info);
370 SLOG(LOG_ERROR, TAG_VCC, "[TIDL] pid(%d) rpc_h(%p), engine_appid(%s)", pid, info->rpc_h, info->engine_appid);
371 return VC_ERROR_NONE;
375 int vc_tidl_close_connection()
377 SLOG(LOG_INFO, TAG_VCC, "[TIDL] vc_tidl_close_connection");
380 vc_tidl_info_s* info = __get_tidl_info_s(pid);
381 RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info");
383 if (0 != rpc_port_proxy_vc_proxy_vc_destroy(info->rpc_h)) {
384 SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to disconnect");
385 return VC_ERROR_OPERATION_FAILED;
389 info->notify_cb_h = NULL;
391 g_tidl_infos = g_list_remove(g_tidl_infos, info);
394 return VC_ERROR_NONE;
397 int vc_tidl_request_hello()
399 SLOG(LOG_INFO, TAG_VCC, "[TIDL] vc_tidl_request_hello");
402 vc_tidl_info_s* info = __get_tidl_info_s(pid);
403 RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info");
405 if (!info->connected) {
406 SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Not Connected. Call __request_tidl_connect()");
407 __request_tidl_connect(info);
408 return VC_ERROR_OPERATION_FAILED;
411 SLOG(LOG_DEBUG, TAG_VCC, ">>>>> VCC Hello");
412 if (VC_ERROR_NONE != __invoke_register_notify_callback(pid, info)) {
413 SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to invoke register callback");
414 return VC_ERROR_OPERATION_FAILED;
417 SLOG(LOG_DEBUG, TAG_VCC, "<<<<");
418 return VC_ERROR_NONE;
422 static int __covert_unhandled_error(int ret)
424 if (RPC_PORT_ERROR_IO_ERROR == ret || RPC_PORT_ERROR_OUT_OF_MEMORY == ret) {
425 return VC_ERROR_OPERATION_FAILED;
431 int vc_tidl_request_initialize(int pid, int* mgr_pid, int* service_state, int* daemon_pid)
433 SLOG(LOG_INFO, TAG_VCC, "[TIDL] vc_tidl_request_initialize");
435 vc_tidl_info_s* info = __get_tidl_info_s(pid);
436 RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info");
437 RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected");
439 int ret = rpc_port_proxy_vc_proxy_vc_invoke_initialize(info->rpc_h, pid, mgr_pid, service_state, daemon_pid);
440 if (RPC_PORT_ERROR_NONE != ret) {
441 SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc initialize : Fail to invoke message. err(%d)", ret);
442 return __covert_unhandled_error(ret);
445 SLOG(LOG_DEBUG, TAG_VCC, "@@ vc initialize : mgr = %d service = %d daemon_pid = %d", *mgr_pid, *service_state, *daemon_pid); //LCOV_EXCL_LINE
447 return VC_ERROR_NONE;
450 int vc_tidl_request_finalize(int pid)
452 SLOG(LOG_INFO, TAG_VCC, "[TIDL] vc_tidl_request_finalize");
454 vc_tidl_info_s* info = __get_tidl_info_s(pid);
455 RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info");
456 RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected");
458 int ret = rpc_port_proxy_vc_proxy_vc_invoke_finalize(info->rpc_h, pid);
459 if (RPC_PORT_ERROR_NONE != ret) {
460 SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc finalize : Fail to invoke message. err(%d)", ret);
461 return __covert_unhandled_error(ret);
464 SLOG(LOG_DEBUG, TAG_VCC, "@@ vc finalize : result = %d", ret);
466 return VC_ERROR_NONE;
469 int vc_tidl_request_set_command(int pid, vc_cmd_type_e cmd_type)
471 SLOG(LOG_INFO, TAG_VCC, "[TIDL] vc_tidl_request_set_command");
473 vc_tidl_info_s* info = __get_tidl_info_s(pid);
474 RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info");
475 RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected");
477 int ret = rpc_port_proxy_vc_proxy_vc_invoke_set_command(info->rpc_h, pid, cmd_type);
478 if (RPC_PORT_ERROR_NONE != ret) {
479 SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc set command : Fail to invoke message. err(%d)", ret);
480 return __covert_unhandled_error(ret);
483 SLOG(LOG_DEBUG, TAG_VCC, "@@ vc set command : pid(%d), cmd_type(%d)", pid, cmd_type);
485 return VC_ERROR_NONE;
488 int vc_tidl_request_unset_command(int pid, vc_cmd_type_e cmd_type)
490 SLOG(LOG_INFO, TAG_VCC, "[TIDL] vc_tidl_request_unset_command");
492 vc_tidl_info_s* info = __get_tidl_info_s(pid);
493 RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info");
494 RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected");
496 int ret = rpc_port_proxy_vc_proxy_vc_invoke_unset_command(info->rpc_h, pid, cmd_type);
497 if (RPC_PORT_ERROR_NONE != ret) {
498 SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc unset command : Fail to invoke message. err(%d)", ret);
499 return __covert_unhandled_error(ret);
502 SLOG(LOG_DEBUG, TAG_VCC, "@@ vc unset command : pid(%d), cmd_type(%d)", pid, cmd_type);
504 return VC_ERROR_NONE;
507 int vc_tidl_request_set_foreground(int pid, bool value)
509 // method no reply --> async
510 SLOG(LOG_INFO, TAG_VCC, "[TIDL] vc_tidl_request_set_foreground");
512 vc_tidl_info_s* info = __get_tidl_info_s(pid);
513 RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info");
514 RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected");
516 int ret = rpc_port_proxy_vc_proxy_vc_invoke_set_foreground(info->rpc_h, pid, value);
517 if (RPC_PORT_ERROR_NONE != ret) {
518 SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc set foreground : Fail to invoke message. err(%d)", ret);
519 return __covert_unhandled_error(ret);
522 SLOG(LOG_DEBUG, TAG_VCC, "@@ vc set foreground : pid(%d), value(%d)", pid, value);
524 return VC_ERROR_NONE;
527 int vc_tidl_request_set_server_dialog(int pid, const char* app_id, const char* credential)
529 SLOG(LOG_INFO, TAG_VCC, "[TIDL] vc_tidl_request_set_server_dialog");
531 vc_tidl_info_s* info = __get_tidl_info_s(pid);
532 RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info");
533 RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected");
535 int ret = rpc_port_proxy_vc_proxy_vc_invoke_set_server_dialog(info->rpc_h, pid, app_id, credential);
536 if (RPC_PORT_ERROR_NONE != ret) {
537 SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc set server dialog : Fail to invoke message. err(%d)", ret);
538 return __covert_unhandled_error(ret);
541 SLOG(LOG_DEBUG, TAG_VCC, "@@ vc set server dialog : pid(%d), app_id(%s), credential(%s)", pid, app_id, credential);
543 return VC_ERROR_NONE;
546 int vc_tidl_request_request_dialog(int pid, const char* disp_text, const char* utt_text, bool continuous)
548 // method no reply --> async
549 SLOG(LOG_INFO, TAG_VCC, "[TIDL] vc_tidl_request_request_dialog");
551 vc_tidl_info_s* info = __get_tidl_info_s(pid);
552 RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info");
553 RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected");
555 int ret = rpc_port_proxy_vc_proxy_vc_invoke_request_dialog(info->rpc_h, pid, disp_text, utt_text, continuous);
556 if (RPC_PORT_ERROR_NONE != ret) {
557 SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc request dialog : Fail to invoke message. err(%d)", ret);
558 return __covert_unhandled_error(ret);
561 SLOG(LOG_DEBUG, TAG_VCC, "@@ vc request dialog : pid(%d), disp_text(%s), utt_text(%s), continuous(%d)", pid, disp_text, utt_text, continuous);
563 return VC_ERROR_NONE;
566 int vc_tidl_request_is_system_command_valid(int pid, bool* is_sys_cmd_valid)
568 SLOG(LOG_INFO, TAG_VCC, "[TIDL] vc_tidl_request_is_system_command_valid");
570 vc_tidl_info_s* info = __get_tidl_info_s(pid);
571 RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info");
572 RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected");
574 int ret = rpc_port_proxy_vc_proxy_vc_invoke_is_system_command_valid(info->rpc_h, pid, is_sys_cmd_valid);
575 if (RPC_PORT_ERROR_NONE != ret) {
576 SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc is system command valid : Fail to invoke message. err(%d)", ret);
577 return __covert_unhandled_error(ret);
580 SLOG(LOG_DEBUG, TAG_VCC, "@@ vc is system command valid : pid(%d), is_sys_cmd_valid(%d)", pid, *is_sys_cmd_valid);
582 return VC_ERROR_NONE;
586 int vc_tidl_request_auth_enable(int pid, int mgr_pid)
588 SLOG(LOG_INFO, TAG_VCC, "[TIDL] vc_tidl_request_auth_enable");
590 vc_tidl_info_s* info = __get_tidl_info_s(pid);
591 RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info");
592 RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected");
594 int ret = rpc_port_proxy_vc_proxy_vc_invoke_auth_enable(info->rpc_h, pid, mgr_pid);
595 if (RPC_PORT_ERROR_NONE != ret) {
596 SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth enable : Fail to invoke message. err(%d)", ret);
597 return __covert_unhandled_error(ret);
600 SLOG(LOG_DEBUG, TAG_VCC, "@@ vc auth enable : pid(%d), mgr_pid(%d)", pid, mgr_pid);
602 return VC_ERROR_NONE;
605 int vc_tidl_request_auth_disable(int pid, int mgr_pid)
607 SLOG(LOG_INFO, TAG_VCC, "[TIDL] vc_tidl_request_auth_disable");
609 vc_tidl_info_s* info = __get_tidl_info_s(pid);
610 RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info");
611 RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected");
613 int ret = rpc_port_proxy_vc_proxy_vc_invoke_auth_disable(info->rpc_h, pid, mgr_pid);
614 if (RPC_PORT_ERROR_NONE != ret) {
615 SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth disable : Fail to invoke message. err(%d)", ret);
616 return __covert_unhandled_error(ret);
619 SLOG(LOG_DEBUG, TAG_VCC, "@@ vc auth disable : pid(%d), mgr_pid(%d)", pid, mgr_pid);
621 return VC_ERROR_NONE;
624 int vc_tidl_request_auth_start(int pid, int mgr_pid)
626 SLOG(LOG_INFO, TAG_VCC, "[TIDL] vc_tidl_request_auth_start");
628 vc_tidl_info_s* info = __get_tidl_info_s(pid);
629 RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info");
630 RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected");
632 int ret = rpc_port_proxy_vc_proxy_vc_invoke_auth_start(info->rpc_h, pid, mgr_pid);
633 if (RPC_PORT_ERROR_NONE != ret) {
634 SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth start : Fail to invoke message. err(%d)", ret);
635 return __covert_unhandled_error(ret);
638 SLOG(LOG_DEBUG, TAG_VCC, "@@ vc auth start : pid(%d), mgr_pid(%d)", pid, mgr_pid);
640 return VC_ERROR_NONE;
643 int vc_tidl_request_auth_stop(int pid, int mgr_pid)
645 SLOG(LOG_INFO, TAG_VCC, "[TIDL] vc_tidl_request_auth_stop");
647 vc_tidl_info_s* info = __get_tidl_info_s(pid);
648 RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info");
649 RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected");
651 int ret = rpc_port_proxy_vc_proxy_vc_invoke_auth_stop(info->rpc_h, pid, mgr_pid);
652 if (RPC_PORT_ERROR_NONE != ret) {
653 SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth stop : Fail to invoke message. err(%d)", ret);
654 return __covert_unhandled_error(ret);
657 SLOG(LOG_DEBUG, TAG_VCC, "@@ vc auth stop : pid(%d), mgr_pid(%d)", pid, mgr_pid);
659 return VC_ERROR_NONE;
662 int vc_tidl_request_auth_cancel(int pid, int mgr_pid)
664 SLOG(LOG_INFO, TAG_VCC, "[TIDL] vc_tidl_request_auth_cancel");
666 vc_tidl_info_s* info = __get_tidl_info_s(pid);
667 RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info");
668 RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected");
670 int ret = rpc_port_proxy_vc_proxy_vc_invoke_auth_cancel(info->rpc_h, pid, mgr_pid);
671 if (RPC_PORT_ERROR_NONE != ret) {
672 SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth cancel : Fail to invoke message. err(%d)", ret);
673 return __covert_unhandled_error(ret);
676 SLOG(LOG_DEBUG, TAG_VCC, "@@ vc auth cancel : pid(%d), mgr_pid(%d)", pid, mgr_pid);
678 return VC_ERROR_NONE;
682 int vc_tidl_request_request_tts(int pid, const char* text, const char* language, bool to_vcm, int* utt_id)
684 SLOG(LOG_INFO, TAG_VCC, "[TIDL] vc_tidl_request_request_tts");
686 vc_tidl_info_s* info = __get_tidl_info_s(pid);
687 RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info");
688 RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected");
690 if (VC_ERROR_NONE != __invoke_register_feedback_callback(pid, info)) {
691 SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to invoke register feedback callback");
692 return VC_ERROR_OPERATION_FAILED;
695 int ret = rpc_port_proxy_vc_proxy_vc_invoke_request_tts(info->rpc_h, pid, text, language, to_vcm, utt_id);
696 if (RPC_PORT_ERROR_NONE != ret) {
697 SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc request tts : Fail to invoke message. err(%d)", ret);
698 return __covert_unhandled_error(ret);
701 SLOG(LOG_DEBUG, TAG_VCC, "@@ vc request tts : pid(%d)", pid);
703 return VC_ERROR_NONE;
706 int vc_tidl_request_cancel_tts(int pid, int utt_id)
708 SLOG(LOG_INFO, TAG_VCC, "[TIDL] vc_tidl_request_cancel_tts");
710 vc_tidl_info_s* info = __get_tidl_info_s(pid);
711 RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info");
712 RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected");
714 int ret = rpc_port_proxy_vc_proxy_vc_invoke_cancel_tts(info->rpc_h, pid, utt_id);
715 if (RPC_PORT_ERROR_NONE != ret) {
716 SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc cancel tts : Fail to invoke message. err(%d)", ret);
717 return __covert_unhandled_error(ret);
720 SLOG(LOG_DEBUG, TAG_VCC, "@@ vc cancel tts : pid(%d), utt_id(%d)", pid, utt_id);
722 return VC_ERROR_NONE;
725 int vc_tidl_request_get_tts_audio_format(int pid, int* rate, vc_audio_channel_e* channel, vc_audio_type_e* audio_type)
727 SLOG(LOG_INFO, TAG_VCC, "[TIDL] vc_tidl_request_get_tts_audio_format");
729 vc_tidl_info_s* info = __get_tidl_info_s(pid);
730 RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info");
731 RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected");
733 int ret = rpc_port_proxy_vc_proxy_vc_invoke_get_tts_audio_format(info->rpc_h, pid, rate, (int*)channel, (int*)audio_type);
734 if (RPC_PORT_ERROR_NONE != ret) {
735 SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc get tts audio format: Fail to invoke message. err(%d)", ret);
736 return __covert_unhandled_error(ret);
739 SLOG(LOG_DEBUG, TAG_VCC, "@@ vc get tts audio format : pid(%d), rate(%d), channel(%d), audio_type(%d)", pid, *rate, *channel, *audio_type);
741 return VC_ERROR_NONE;