From: sooyeon Date: Mon, 20 Jun 2022 12:05:33 +0000 (+0900) Subject: Add namespace(-n) option to build tidlc and Change TIDL apis X-Git-Tag: submit/tizen/20220801.042437~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d41e4834b1e4309b6bb7fbe245dcc6631fcccbba;p=platform%2Fcore%2Fuifw%2Fvoice-control.git Add namespace(-n) option to build tidlc and Change TIDL apis Change-Id: I1feba522be81db7567081650613e506f085d1906 Signed-off-by: sooyeon --- diff --git a/client/vc_mgr_tidl.c b/client/vc_mgr_tidl.c index daf53a1..3d98e9c 100755 --- a/client/vc_mgr_tidl.c +++ b/client/vc_mgr_tidl.c @@ -29,9 +29,9 @@ typedef struct { bool connected; bool connection_requesting; bool register_callback_invoked; - rpc_port_proxy_vc_mgr_h rpc_h; - rpc_port_proxy_vc_mgr_notify_cb_h notify_cb_h; - rpc_port_proxy_vc_mgr_send_buffer_cb_h send_buffer_cb_h; + rpc_port_proxy_vc_mgr_proxy_vc_mgr_h rpc_h; + rpc_port_proxy_vc_mgr_proxy_vc_mgr_notify_cb_h notify_cb_h; + rpc_port_proxy_vc_mgr_proxy_vc_mgr_send_buffer_cb_h send_buffer_cb_h; } vc_mgr_tidl_info_s; typedef struct { @@ -45,7 +45,7 @@ static vcd_mgr_tidl_info_s* g_stub_tidl_info = NULL; static pthread_mutex_t g_tidl_mutex = PTHREAD_MUTEX_INITIALIZER; -static rpc_port_stub_vcd_mgr_callback_s g_mgr_callback; +static rpc_port_stub_vc_mgr_stub_vcd_mgr_callback_s g_mgr_callback; static int g_volume_count = 0; @@ -300,7 +300,7 @@ static void __notify_cb(void *user_data, bundle *msg) } -static void __send_buffer_cb(void *user_data, rpc_port_proxy_array_char_h data_in, bundle *msg) +static void __send_buffer_cb(void *user_data, rpc_port_proxy_vc_mgr_proxy_array_char_h data_in, bundle *msg) { char *method = NULL; char *val = NULL; @@ -319,7 +319,7 @@ static void __send_buffer_cb(void *user_data, rpc_port_proxy_array_char_h data_i bundle_get_str(msg, VC_MANAGER_BUNDLE_UTTID, &utt_id); bundle_get_str(msg, VC_MANAGER_BUNDLE_EVENT, &event); - rpc_port_proxy_array_char_get(data_in, &buffer, &len); + rpc_port_proxy_vc_mgr_proxy_array_char_get(data_in, &buffer, &len); __vc_mgr_cb_feedback_streaming(atoi(val), atoi(utt_id), atoi(event), buffer, len); free(buffer); @@ -332,7 +332,7 @@ static void __send_buffer_cb(void *user_data, rpc_port_proxy_array_char_h data_i } -static void __on_connected(rpc_port_proxy_vc_mgr_h h, void *user_data) +static void __on_connected(rpc_port_proxy_vc_mgr_proxy_vc_mgr_h h, void *user_data) { g_proxy_tidl_info->connected = true; g_proxy_tidl_info->connection_requesting = false; @@ -341,7 +341,7 @@ static void __on_connected(rpc_port_proxy_vc_mgr_h h, void *user_data) SLOG(LOG_INFO, TAG_VCM, "Connected to server"); } -static void __on_disconnected(rpc_port_proxy_vc_mgr_h h, void *user_data) +static void __on_disconnected(rpc_port_proxy_vc_mgr_proxy_vc_mgr_h h, void *user_data) { g_proxy_tidl_info->connected = false; g_proxy_tidl_info->connection_requesting = false; @@ -353,7 +353,7 @@ static void __on_disconnected(rpc_port_proxy_vc_mgr_h h, void *user_data) __vc_mgr_cb_error(VC_ERROR_SERVICE_RESET, -1, "Server Disconnected, re-launch"); } -static void __on_rejected(rpc_port_proxy_vc_mgr_h h, void *user_data) +static void __on_rejected(rpc_port_proxy_vc_mgr_proxy_vc_mgr_h h, void *user_data) { g_proxy_tidl_info->connection_requesting = false; g_proxy_tidl_info->register_callback_invoked = false; @@ -362,17 +362,17 @@ static void __on_rejected(rpc_port_proxy_vc_mgr_h h, void *user_data) } -static rpc_port_proxy_vc_mgr_h __create_rpc_port(const char* engine_app_id) +static rpc_port_proxy_vc_mgr_proxy_vc_mgr_h __create_rpc_port(const char* engine_app_id) { SLOG(LOG_DEBUG, TAG_VCM, "[TIDL] __create_rpc_port"); - rpc_port_proxy_vc_mgr_callback_s rpc_callback = { + rpc_port_proxy_vc_mgr_proxy_vc_mgr_callback_s rpc_callback = { .connected = __on_connected, .disconnected = __on_disconnected, .rejected = __on_rejected }; - rpc_port_proxy_vc_mgr_h handle = NULL; - if (0 != rpc_port_proxy_vc_mgr_create(engine_app_id, &rpc_callback, NULL, &handle)) { + rpc_port_proxy_vc_mgr_proxy_vc_mgr_h handle = NULL; + if (0 != rpc_port_proxy_vc_mgr_proxy_vc_mgr_create(engine_app_id, &rpc_callback, NULL, &handle)) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Fail to create proxy"); return NULL; } @@ -380,7 +380,7 @@ static rpc_port_proxy_vc_mgr_h __create_rpc_port(const char* engine_app_id) return handle; } -static void __vcd_mgr_create_cb(rpc_port_stub_vcd_mgr_context_h context, void *user_data) +static void __vcd_mgr_create_cb(rpc_port_stub_vc_mgr_stub_vcd_mgr_context_h context, void *user_data) { g_stub_tidl_info->connected = true; g_stub_tidl_info->register_callback_requesting = false; @@ -389,7 +389,7 @@ static void __vcd_mgr_create_cb(rpc_port_stub_vcd_mgr_context_h context, void *u char *sender = NULL; - rpc_port_stub_vcd_mgr_context_get_sender(context, &sender); + rpc_port_stub_vc_mgr_stub_vcd_mgr_context_get_sender(context, &sender); if (!sender) { SLOG(LOG_ERROR, TAG_VCM, "@@@ Sender is NULL"); return; @@ -399,15 +399,15 @@ static void __vcd_mgr_create_cb(rpc_port_stub_vcd_mgr_context_h context, void *u free(sender); } -static void __vcd_mgr_terminate_cb(rpc_port_stub_vcd_mgr_context_h context, void *user_data) +static void __vcd_mgr_terminate_cb(rpc_port_stub_vc_mgr_stub_vcd_mgr_context_h context, void *user_data) { g_stub_tidl_info->connected = false; g_stub_tidl_info->register_callback_requesting = false; - rpc_port_stub_vcd_mgr_context_set_tag(context, NULL); + rpc_port_stub_vc_mgr_stub_vcd_mgr_context_set_tag(context, NULL); char *sender = NULL; - rpc_port_stub_vcd_mgr_context_get_sender(context, &sender); + rpc_port_stub_vc_mgr_stub_vcd_mgr_context_get_sender(context, &sender); if (!sender) return; @@ -415,7 +415,7 @@ static void __vcd_mgr_terminate_cb(rpc_port_stub_vcd_mgr_context_h context, void free(sender); } -static void __vcd_mgr_set_foreground_cb(rpc_port_stub_vcd_mgr_context_h context, int pid, int value, void *user_data) +static void __vcd_mgr_set_foreground_cb(rpc_port_stub_vc_mgr_stub_vcd_mgr_context_h context, int pid, int value, void *user_data) { SLOG(LOG_INFO, TAG_VCM, "@@@ Set foreground"); SLOG(LOG_INFO, TAG_VCM, "@@ foreground changed : pid(%d) value(%s)", pid, value ? "true" : "false"); @@ -425,7 +425,7 @@ static void __vcd_mgr_set_foreground_cb(rpc_port_stub_vcd_mgr_context_h context, SLOG(LOG_DEBUG, TAG_VCM, "@@@"); } -static int __vcd_mgr_get_private_data_cb(rpc_port_stub_vcd_mgr_context_h context, int pid, const char *key, char **data, void *user_data) +static int __vcd_mgr_get_private_data_cb(rpc_port_stub_vc_mgr_stub_vcd_mgr_context_h context, int pid, const char *key, char **data, void *user_data) { SLOG(LOG_INFO, TAG_VCM, "@@@ Get request get private data"); SLOG(LOG_INFO, TAG_VCM, "@@ vc mgr get request get private data : pid(%d) ", pid); @@ -448,7 +448,7 @@ static int __vcd_mgr_get_private_data_cb(rpc_port_stub_vcd_mgr_context_h context return ret; } -static int __vcd_mgr_auth_enable_cb(rpc_port_stub_vcd_mgr_context_h context, int pid, void *user_data) +static int __vcd_mgr_auth_enable_cb(rpc_port_stub_vc_mgr_stub_vcd_mgr_context_h context, int pid, void *user_data) { SLOG(LOG_INFO, TAG_VCM, "@@@ Get request auth enable"); SLOG(LOG_INFO, TAG_VCM, "@@ vc mgr request auth enable : pid(%d)", pid); @@ -465,7 +465,7 @@ static int __vcd_mgr_auth_enable_cb(rpc_port_stub_vcd_mgr_context_h context, int return ret; } -static int __vcd_mgr_auth_disable_cb(rpc_port_stub_vcd_mgr_context_h context, int pid, void *user_data) +static int __vcd_mgr_auth_disable_cb(rpc_port_stub_vc_mgr_stub_vcd_mgr_context_h context, int pid, void *user_data) { SLOG(LOG_INFO, TAG_VCM, "@@@ Get request auth disable"); SLOG(LOG_INFO, TAG_VCM, "@@ vc mgr request auth disable : pid(%d)", pid); @@ -482,7 +482,7 @@ static int __vcd_mgr_auth_disable_cb(rpc_port_stub_vcd_mgr_context_h context, in return ret; } -static int __vcd_mgr_auth_start_cb(rpc_port_stub_vcd_mgr_context_h context, int pid, void *user_data) +static int __vcd_mgr_auth_start_cb(rpc_port_stub_vc_mgr_stub_vcd_mgr_context_h context, int pid, void *user_data) { SLOG(LOG_INFO, TAG_VCM, "@@@ Get request auth start"); SLOG(LOG_INFO, TAG_VCM, "@@ vc mgr request auth start : pid(%d)", pid); @@ -499,7 +499,7 @@ static int __vcd_mgr_auth_start_cb(rpc_port_stub_vcd_mgr_context_h context, int return ret; } -static int __vcd_mgr_auth_stop_cb(rpc_port_stub_vcd_mgr_context_h context, int pid, void *user_data) +static int __vcd_mgr_auth_stop_cb(rpc_port_stub_vc_mgr_stub_vcd_mgr_context_h context, int pid, void *user_data) { SLOG(LOG_INFO, TAG_VCM, "@@@ Get request auth stop"); SLOG(LOG_INFO, TAG_VCM, "@@ vc mgr request auth stop : pid(%d)", pid); @@ -516,7 +516,7 @@ static int __vcd_mgr_auth_stop_cb(rpc_port_stub_vcd_mgr_context_h context, int p return ret; } -static int __vcd_mgr_auth_cancel_cb(rpc_port_stub_vcd_mgr_context_h context, int pid, void *user_data) +static int __vcd_mgr_auth_cancel_cb(rpc_port_stub_vc_mgr_stub_vcd_mgr_context_h context, int pid, void *user_data) { SLOG(LOG_INFO, TAG_VCM, "@@@ Get request auth cancel"); SLOG(LOG_INFO, TAG_VCM, "@@ vc mgr request auth cancel : pid(%d)", pid); @@ -552,7 +552,7 @@ static void __register_stub_callback() g_mgr_callback.auth_cancel = __vcd_mgr_auth_cancel_cb; int ret = -1; - ret = rpc_port_stub_vcd_mgr_register(&g_mgr_callback, NULL); + ret = rpc_port_stub_vc_mgr_stub_vcd_mgr_register(&g_mgr_callback, NULL); if (0 == ret) { SLOG(LOG_DEBUG, TAG_VCM, "register callback"); g_stub_tidl_info->register_callback_requesting = true; @@ -630,7 +630,7 @@ int vc_mgr_tidl_close_connection() return VC_ERROR_OPERATION_FAILED; } - if (0 != rpc_port_proxy_vc_mgr_destroy(g_proxy_tidl_info->rpc_h)) { + if (0 != rpc_port_proxy_vc_mgr_proxy_vc_mgr_destroy(g_proxy_tidl_info->rpc_h)) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Fail to destroy tidl handle"); pthread_mutex_unlock(&g_tidl_mutex); return VC_ERROR_OPERATION_FAILED; @@ -657,7 +657,7 @@ static void __request_tidl_connect() return; } - int ret = rpc_port_proxy_vc_mgr_connect(g_proxy_tidl_info->rpc_h); + int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_connect(g_proxy_tidl_info->rpc_h); SLOG(LOG_INFO, TAG_VCM, "[INFO] Request connection to stub. ret(%d)", ret); if (0 == ret) { @@ -668,30 +668,30 @@ static void __request_tidl_connect() static int __create_callback_handles() { if (NULL != g_proxy_tidl_info->notify_cb_h) { - rpc_port_proxy_vc_mgr_notify_cb_dispose(g_proxy_tidl_info->rpc_h, g_proxy_tidl_info->notify_cb_h); + rpc_port_proxy_vc_mgr_proxy_vc_mgr_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_mgr_notify_cb_create(&g_proxy_tidl_info->notify_cb_h)) { + if (RPC_PORT_ERROR_NONE != rpc_port_proxy_vc_mgr_proxy_vc_mgr_notify_cb_create(&g_proxy_tidl_info->notify_cb_h)) { return VC_ERROR_OUT_OF_MEMORY; } - rpc_port_proxy_vc_mgr_notify_cb_set_callback(g_proxy_tidl_info->notify_cb_h, __notify_cb, NULL); + rpc_port_proxy_vc_mgr_proxy_vc_mgr_notify_cb_set_callback(g_proxy_tidl_info->notify_cb_h, __notify_cb, NULL); - rpc_port_proxy_vc_mgr_notify_cb_set_once(g_proxy_tidl_info->notify_cb_h, false); + rpc_port_proxy_vc_mgr_proxy_vc_mgr_notify_cb_set_once(g_proxy_tidl_info->notify_cb_h, false); if (NULL != g_proxy_tidl_info->send_buffer_cb_h) { - rpc_port_proxy_vc_mgr_send_buffer_cb_dispose(g_proxy_tidl_info->rpc_h, g_proxy_tidl_info->send_buffer_cb_h); + rpc_port_proxy_vc_mgr_proxy_vc_mgr_send_buffer_cb_dispose(g_proxy_tidl_info->rpc_h, g_proxy_tidl_info->send_buffer_cb_h); g_proxy_tidl_info->send_buffer_cb_h = NULL; } - if (RPC_PORT_ERROR_NONE != rpc_port_proxy_vc_mgr_send_buffer_cb_create(&g_proxy_tidl_info->send_buffer_cb_h)) { + if (RPC_PORT_ERROR_NONE != rpc_port_proxy_vc_mgr_proxy_vc_mgr_send_buffer_cb_create(&g_proxy_tidl_info->send_buffer_cb_h)) { return VC_ERROR_OUT_OF_MEMORY; } - rpc_port_proxy_vc_mgr_send_buffer_cb_set_callback(g_proxy_tidl_info->send_buffer_cb_h, __send_buffer_cb, NULL); + rpc_port_proxy_vc_mgr_proxy_vc_mgr_send_buffer_cb_set_callback(g_proxy_tidl_info->send_buffer_cb_h, __send_buffer_cb, NULL); - rpc_port_proxy_vc_mgr_send_buffer_cb_set_once(g_proxy_tidl_info->send_buffer_cb_h, false); + rpc_port_proxy_vc_mgr_proxy_vc_mgr_send_buffer_cb_set_once(g_proxy_tidl_info->send_buffer_cb_h, false); return VC_ERROR_NONE; } @@ -709,7 +709,7 @@ static int __invoke_register_callback() return VC_ERROR_OPERATION_FAILED; } - rpc_port_proxy_vc_mgr_invoke_register_cb(g_proxy_tidl_info->rpc_h, getpid(), g_proxy_tidl_info->notify_cb_h, g_proxy_tidl_info->send_buffer_cb_h); + rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_register_cb(g_proxy_tidl_info->rpc_h, getpid(), g_proxy_tidl_info->notify_cb_h, g_proxy_tidl_info->send_buffer_cb_h); g_proxy_tidl_info->register_callback_invoked = true; return VC_ERROR_NONE; } @@ -770,7 +770,7 @@ int vc_mgr_tidl_request_initialize(int pid, int audio_streaming_mode, int* servi return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vc_mgr_invoke_initialize(g_proxy_tidl_info->rpc_h, pid, audio_streaming_mode, &tmp_service_state, &tmp_forground, &tmp_daemon_pid); + int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_initialize(g_proxy_tidl_info->rpc_h, pid, audio_streaming_mode, &tmp_service_state, &tmp_forground, &tmp_daemon_pid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager initialize : Fail to invoke message, error(%d)", ret); return ret; @@ -799,7 +799,7 @@ int vc_mgr_tidl_request_finalize(int pid) return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vc_mgr_invoke_finalize(g_proxy_tidl_info->rpc_h, pid); + int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_finalize(g_proxy_tidl_info->rpc_h, pid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager finalize : Fail to invoke message, error(%d)", ret); return ret; @@ -822,7 +822,7 @@ int vc_mgr_tidl_request_set_command(int pid) return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vc_mgr_invoke_set_command(g_proxy_tidl_info->rpc_h, pid); + int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_set_command(g_proxy_tidl_info->rpc_h, pid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager set command : Fail to invoke message, error(%d)", ret); return ret; @@ -845,7 +845,7 @@ int vc_mgr_tidl_request_unset_command(int pid) return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vc_mgr_invoke_unset_command(g_proxy_tidl_info->rpc_h, pid); + int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_unset_command(g_proxy_tidl_info->rpc_h, pid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager unset command : Fail to invoke message, error(%d)", ret); return ret; @@ -868,7 +868,7 @@ int vc_mgr_tidl_request_demandable_client(int pid) return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vc_mgr_invoke_demandable_client(g_proxy_tidl_info->rpc_h, pid); + int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_demandable_client(g_proxy_tidl_info->rpc_h, pid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager demandable client : Fail to invoke message, error(%d)", ret); return ret; @@ -891,7 +891,7 @@ int vc_mgr_tidl_request_set_audio_type(int pid, const char* audio_type) return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vc_mgr_invoke_set_audio_type(g_proxy_tidl_info->rpc_h, pid, audio_type); + int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_set_audio_type(g_proxy_tidl_info->rpc_h, pid, audio_type); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager set audio type : Fail to invoke message, error(%d)", ret); return ret; @@ -915,7 +915,7 @@ int vc_mgr_tidl_request_get_audio_type(int pid, char** audio_type) } char *tmp = NULL; - int ret = rpc_port_proxy_vc_mgr_invoke_get_audio_type(g_proxy_tidl_info->rpc_h, pid, &tmp); + int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_get_audio_type(g_proxy_tidl_info->rpc_h, pid, &tmp); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager get audio type : Fail to invoke message, error(%d)", ret); return ret; @@ -941,7 +941,7 @@ int vc_mgr_tidl_request_set_private_data(int pid, const char* key, const char* d return VC_ERROR_OPERATION_FAILED; } - rpc_port_proxy_vc_mgr_invoke_set_private_data(g_proxy_tidl_info->rpc_h, pid, key, data); + rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_set_private_data(g_proxy_tidl_info->rpc_h, pid, key, data); return VC_ERROR_NONE; } @@ -961,7 +961,7 @@ int vc_mgr_tidl_request_get_private_data(int pid, const char* key, char** data) } char *tmp = NULL; - int ret = rpc_port_proxy_vc_mgr_invoke_get_private_data(g_proxy_tidl_info->rpc_h, pid, key, &tmp); + int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_get_private_data(g_proxy_tidl_info->rpc_h, pid, key, &tmp); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager get private data : Fail to invoke message, error(%d)", ret); return ret; @@ -987,7 +987,7 @@ int vc_mgr_tidl_request_set_client_info(int pid) return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vc_mgr_invoke_set_client_info(g_proxy_tidl_info->rpc_h, pid); + int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_set_client_info(g_proxy_tidl_info->rpc_h, pid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager set client info : Fail to invoke message, error(%d)", ret); return ret; @@ -1010,7 +1010,7 @@ int vc_mgr_tidl_request_set_domain(int pid, const char* domain) return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vc_mgr_invoke_set_domain(g_proxy_tidl_info->rpc_h, pid, domain); + int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_set_domain(g_proxy_tidl_info->rpc_h, pid, domain); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager set domain : Fail to invoke message, error(%d)", ret); return ret; @@ -1033,7 +1033,7 @@ int vc_mgr_tidl_request_do_action(int pid, vc_send_event_type_e type, char* send return VC_ERROR_OPERATION_FAILED; } - rpc_port_proxy_vc_mgr_invoke_do_action(g_proxy_tidl_info->rpc_h, pid, type, send_event); + rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_do_action(g_proxy_tidl_info->rpc_h, pid, type, send_event); return VC_ERROR_NONE; } @@ -1052,7 +1052,7 @@ int vc_mgr_tidl_request_start(int pid, int recognition_mode, bool exclusive_comm return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vc_mgr_invoke_start(g_proxy_tidl_info->rpc_h, pid, recognition_mode, exclusive_command_option, start_by_client, disabled_cmd_type); + int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_start(g_proxy_tidl_info->rpc_h, pid, recognition_mode, exclusive_command_option, start_by_client, disabled_cmd_type); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager start : Fail to invoke message, error(%d)", ret); return ret; @@ -1075,7 +1075,7 @@ int vc_mgr_tidl_request_stop(int pid) return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vc_mgr_invoke_stop(g_proxy_tidl_info->rpc_h, pid); + int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_stop(g_proxy_tidl_info->rpc_h, pid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager stop : Fail to invoke message, error(%d)", ret); return ret; @@ -1098,7 +1098,7 @@ int vc_mgr_tidl_request_cancel(int pid) return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vc_mgr_invoke_cancel(g_proxy_tidl_info->rpc_h, pid); + int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_cancel(g_proxy_tidl_info->rpc_h, pid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager cancel : Fail to invoke message, error(%d)", ret); return ret; @@ -1121,7 +1121,7 @@ int vc_mgr_tidl_request_set_audio_streaming_mode(int pid, vc_audio_streaming_mod return VC_ERROR_OPERATION_FAILED; } - rpc_port_proxy_vc_mgr_invoke_set_audio_streaming_mode(g_proxy_tidl_info->rpc_h, pid, mode); + rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_set_audio_streaming_mode(g_proxy_tidl_info->rpc_h, pid, mode); return VC_ERROR_NONE; } @@ -1140,7 +1140,7 @@ int vc_mgr_tidl_send_result_selection(int pid) return VC_ERROR_OPERATION_FAILED; } - rpc_port_proxy_vc_mgr_invoke_send_result_selection(g_proxy_tidl_info->rpc_h, pid); + rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_send_result_selection(g_proxy_tidl_info->rpc_h, pid); return VC_ERROR_NONE; } @@ -1161,7 +1161,7 @@ int vc_mgr_tidl_send_specific_engine_request(int pid, const char* engine_app_id, gchar *gEncodedRequest = g_base64_encode((const guchar*)request, strlen(request)); - rpc_port_proxy_vc_mgr_invoke_send_specific_engine_request(g_proxy_tidl_info->rpc_h, pid, engine_app_id, event, gEncodedRequest); + rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_send_specific_engine_request(g_proxy_tidl_info->rpc_h, pid, engine_app_id, event, gEncodedRequest); if (gEncodedRequest) g_free(gEncodedRequest); @@ -1183,7 +1183,7 @@ int vc_mgr_tidl_send_utterance_status(int pid, int utt_id, vc_tts_utterance_stat return VC_ERROR_OPERATION_FAILED; } - rpc_port_proxy_vc_mgr_invoke_send_utterance_status(g_proxy_tidl_info->rpc_h, utt_id, utt_status); + rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_send_utterance_status(g_proxy_tidl_info->rpc_h, utt_id, utt_status); return VC_ERROR_NONE; } @@ -1202,21 +1202,21 @@ int vc_mgr_tidl_send_audio_streaming(int pid, vc_audio_streaming_event_e event, return VC_ERROR_OPERATION_FAILED; } - rpc_port_proxy_array_char_h data = NULL; - rpc_port_proxy_array_char_create(&data); + rpc_port_proxy_vc_mgr_proxy_array_char_h data = NULL; + rpc_port_proxy_vc_mgr_proxy_array_char_create(&data); if (NULL == data) { SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to create data handle"); return VC_ERROR_OUT_OF_MEMORY; } if (NULL != buffer && 0 < len) { - rpc_port_proxy_array_char_set(data, (char*)buffer, len); + rpc_port_proxy_vc_mgr_proxy_array_char_set(data, (char*)buffer, len); } else { SLOG(LOG_ERROR, TAG_VCM, "[TIDL] buffer is empty"); } - rpc_port_proxy_vc_mgr_invoke_send_audio_streaming(g_proxy_tidl_info->rpc_h, pid, event, data); - rpc_port_proxy_array_char_destroy(data); + rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_send_audio_streaming(g_proxy_tidl_info->rpc_h, pid, event, data); + rpc_port_proxy_vc_mgr_proxy_array_char_destroy(data); return VC_ERROR_NONE; } diff --git a/client/vc_proxy.c b/client/vc_proxy.c deleted file mode 100755 index d55b82d..0000000 --- a/client/vc_proxy.c +++ /dev/null @@ -1,2869 +0,0 @@ -/* - * Generated by tidlc 1.8.1. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "vc_proxy.h" - -#undef LOG_TAG -#define LOG_TAG "RPC_PORT_PROXY" - -#undef _E -#define _E(fmt, ...) dlog_print(DLOG_ERROR, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) - -#undef _W -#define _W(fmt, ...) dlog_print(DLOG_WARN, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) - -#undef _I -#define _I(fmt, ...) dlog_print(DLOG_INFO, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) - -#undef _D -#define _D(fmt, ...) dlog_print(DLOG_DEBUG, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) - -#ifndef TIDL_VERSION -#define TIDL_VERSION "1.8.1" -#endif - -#ifndef nullptr -#define nullptr NULL -#endif - -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -#endif - -#ifndef STRING_GET -#define STRING_GET(x) ((x) ? x : "") -#endif - -typedef void (*rpc_port_proxy_delegate_cb)(GList **delegates, rpc_port_parcel_h parcel, int id, int seq_id); - -typedef struct rpc_port_proxy_array_char_s { - rpc_port_parcelable_t parcelable; - char *value; - int size; -} rpc_port_proxy_array_char_t; - -typedef struct rpc_port_proxy_vc_notify_cb_s { - rpc_port_parcelable_t parcelable; - int id; - int seq_id; - bool once; - rpc_port_proxy_vc_notify_cb_cb callback; - void *user_data; -} rpc_port_proxy_vc_notify_cb_t; - -typedef struct rpc_port_proxy_vc_feedback_cb_s { - rpc_port_parcelable_t parcelable; - int id; - int seq_id; - bool once; - rpc_port_proxy_vc_feedback_cb_cb callback; - void *user_data; -} rpc_port_proxy_vc_feedback_cb_t; - -typedef struct rpc_port_proxy_vc_s { - char *stub_appid; - rpc_port_proxy_h proxy; - rpc_port_h port; - rpc_port_h callback_port; - rpc_port_proxy_vc_callback_s callback; - void *user_data; - GList *delegates; - GRecMutex mutex; -} rpc_port_proxy_vc_t; - -static void __rpc_port_proxy_array_char_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_proxy_array_char_h h = data; - int i; - - if (parcel == nullptr || h == nullptr) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_array_count(parcel, h->size); - - for (i = 0; i < h->size; ++i) - rpc_port_parcel_write_byte(parcel, h->value[i]); -} - -static void __rpc_port_proxy_array_char_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_proxy_array_char_h h = data; - char value; - int ret; - int i; - - if (parcel == nullptr || h == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return; - } - - ret = rpc_port_parcel_read_array_count(parcel, &h->size); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to read array count. error(%d)", ret); - set_last_result(ret); - return; - } - - h->value = calloc(h->size, sizeof(char)); - if (h->value == nullptr) { - _E("Out of memory"); - set_last_result(RPC_PORT_ERROR_OUT_OF_MEMORY); - return; - } - - for (i = 0; i < h->size; ++i) { - rpc_port_parcel_read_byte(parcel, &value); - h->value[i] = value; - } - - set_last_result(RPC_PORT_ERROR_NONE); -} - -int rpc_port_proxy_array_char_create(rpc_port_proxy_array_char_h *h) -{ - rpc_port_proxy_array_char_t *handle; - - if (h == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - handle = calloc(1, sizeof(rpc_port_proxy_array_char_t)); - if (handle == nullptr) { - _E("Out of memory"); - return RPC_PORT_ERROR_OUT_OF_MEMORY; - } - - handle->parcelable.to = __rpc_port_proxy_array_char_to; - handle->parcelable.from = __rpc_port_proxy_array_char_from; - - *h = handle; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_array_char_destroy(rpc_port_proxy_array_char_h h) -{ - if (h == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - if (h->value) - free(h->value); - - free(h); - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_array_char_clone(rpc_port_proxy_array_char_h h, rpc_port_proxy_array_char_h *clone) -{ - rpc_port_proxy_array_char_h handle; - rpc_port_parcel_h parcel; - int ret; - - if (h == nullptr || clone == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - ret = rpc_port_proxy_array_char_create(&handle); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to create handle. error(%d)", ret); - return ret; - } - - ret = rpc_port_parcel_create(&parcel); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret); - rpc_port_proxy_array_char_destroy(handle); - return ret; - } - - rpc_port_parcel_write(parcel, &h->parcelable, h); - rpc_port_parcel_read(parcel, &handle->parcelable, handle); - ret = get_last_result(); - rpc_port_parcel_destroy(parcel); - - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to read data. error(%d)", ret); - rpc_port_proxy_array_char_destroy(handle); - return ret; - } - - *clone = handle; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_array_char_set(rpc_port_proxy_array_char_h h, char *value, int size) -{ - rpc_port_proxy_array_char_h handle; - rpc_port_proxy_array_char_h clone; - int ret; - - if (h == nullptr || value == nullptr || size <= 0) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - ret = rpc_port_proxy_array_char_create(&handle); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to create handle. error(%d)", ret); - return ret; - } - - handle->value = (char *)value; - handle->size = size; - - ret = rpc_port_proxy_array_char_clone(handle, &clone); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to clone handle. error(%d)", ret); - handle->value = nullptr; - handle->size = 0; - rpc_port_proxy_array_char_destroy(handle); - return ret; - } - - handle->value = h->value; - handle->size = h->size; - rpc_port_proxy_array_char_destroy(handle); - - h->value = clone->value; - h->size = clone->size; - - clone->value = nullptr; - clone->size = 0; - rpc_port_proxy_array_char_destroy(clone); - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_array_char_get(rpc_port_proxy_array_char_h h, char **value, int *size) -{ - rpc_port_proxy_array_char_h handle; - int ret; - - if (h == nullptr || value == nullptr || size == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - ret = rpc_port_proxy_array_char_clone(h, &handle); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to clone handle. error(%d)", ret); - return ret; - } - - *value = handle->value; - *size = handle->size; - - handle->value = nullptr; - handle->size = 0; - rpc_port_proxy_array_char_destroy(handle); - - return RPC_PORT_ERROR_NONE; -} - -typedef enum { - RPC_PORT_PROXY_VC_DELEGATE_NOTIFY_CB = 1, - RPC_PORT_PROXY_VC_DELEGATE_FEEDBACK_CB = 2, -} rpc_port_proxy_vc_delegate_e; - -static void __rpc_port_proxy_vc_notify_cb_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_proxy_vc_notify_cb_h h = data; - - if (parcel == nullptr || h == nullptr) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_int32(parcel, h->id); - - rpc_port_parcel_write_int32(parcel, h->seq_id); - - rpc_port_parcel_write_bool(parcel, h->once); - - _I("id(%d), seq_id(%d), once(%s)", h->id, h->seq_id, h->once ? "true" : "false"); -} - -static void __rpc_port_proxy_vc_notify_cb_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_proxy_vc_notify_cb_h h = data; - - if (parcel == nullptr || h == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return; - } - - rpc_port_parcel_read_int32(parcel, &h->id); - - rpc_port_parcel_read_int32(parcel, &h->seq_id); - - rpc_port_parcel_read_bool(parcel, &h->once); - - _I("id(%d), seq_id(%d), once(%s)", h->id, h->seq_id, h->once ? "true" : "false"); - set_last_result(RPC_PORT_ERROR_NONE); -} - -int rpc_port_proxy_vc_notify_cb_create(rpc_port_proxy_vc_notify_cb_h *h) -{ - rpc_port_proxy_vc_notify_cb_t *handle; - static int seq_num; - - if (h == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - handle = calloc(1, sizeof(rpc_port_proxy_vc_notify_cb_t)); - if (handle == nullptr) { - _E("Out of memory"); - return RPC_PORT_ERROR_OUT_OF_MEMORY; - } - - handle->parcelable.to = __rpc_port_proxy_vc_notify_cb_to; - handle->parcelable.from = __rpc_port_proxy_vc_notify_cb_from; - handle->id = RPC_PORT_PROXY_VC_DELEGATE_NOTIFY_CB; - handle->seq_id = g_atomic_int_add(&seq_num, 1) + 1; - _I("id(%d), seq_id(%d)", handle->id, handle->seq_id); - - *h = handle; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_notify_cb_destroy(rpc_port_proxy_vc_notify_cb_h h) -{ - if (h == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - _W("id(%d), seq_id(%d), once(%s)", h->id, h->seq_id, h->once ? "true" : "false"); - - free(h); - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_notify_cb_clone(rpc_port_proxy_vc_notify_cb_h h, rpc_port_proxy_vc_notify_cb_h *clone) -{ - rpc_port_proxy_vc_notify_cb_h handle; - rpc_port_parcel_h parcel; - int ret; - - if (h == nullptr || clone == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - ret = rpc_port_proxy_vc_notify_cb_create(&handle); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to create handle. error(%d)", ret); - return ret; - } - - ret = rpc_port_parcel_create(&parcel); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret); - rpc_port_proxy_vc_notify_cb_destroy(handle); - return ret; - } - - rpc_port_parcel_write(parcel, &h->parcelable, h); - rpc_port_parcel_read(parcel, &handle->parcelable, handle); - ret = get_last_result(); - rpc_port_parcel_destroy(parcel); - - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to read data. error(%d)", ret); - rpc_port_proxy_vc_notify_cb_destroy(handle); - return ret; - } - - handle->callback = h->callback; - handle->user_data = h->user_data; - - *clone = handle; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_notify_cb_set_callback(rpc_port_proxy_vc_notify_cb_h h, rpc_port_proxy_vc_notify_cb_cb callback, void *user_data) -{ - if (h == nullptr || callback == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - h->callback = callback; - h->user_data = user_data; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_notify_cb_set_once(rpc_port_proxy_vc_notify_cb_h h, bool once) -{ - if (h == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - h->once = once; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_notify_cb_get_id(rpc_port_proxy_vc_notify_cb_h h, int *id) -{ - if (h == nullptr || id == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - *id = h->id; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_notify_cb_get_seq_id(rpc_port_proxy_vc_notify_cb_h h, int *seq_id) -{ - if (h == nullptr || seq_id == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - *seq_id = h->seq_id; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_notify_cb_is_once(rpc_port_proxy_vc_notify_cb_h h, bool *once) -{ - if (h == nullptr || once == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - *once = h->once; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_notify_cb_get_tag(rpc_port_proxy_vc_notify_cb_h h, char **tag) -{ - char *new_tag; - char buf[128]; - - if (h == nullptr || tag == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - snprintf(buf, sizeof(buf), "%d::%d", h->id, h->seq_id); - new_tag = strdup(buf); - if (new_tag == nullptr) { - _E("Out of memory"); - return RPC_PORT_ERROR_OUT_OF_MEMORY; - } - - *tag = new_tag; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_notify_cb_dispose(rpc_port_proxy_vc_h proxy, rpc_port_proxy_vc_notify_cb_h h) -{ - GList *found; - - if (proxy == nullptr || h == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - found = g_list_find(proxy->delegates, h); - if (found == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - proxy->delegates = g_list_remove_link(proxy->delegates, found); - rpc_port_proxy_vc_notify_cb_destroy(h); - g_list_free(found); - - return RPC_PORT_ERROR_NONE; -} - -static void __rpc_port_proxy_vc_notify_cb_delegate_handler(GList **delegates, rpc_port_parcel_h parcel, int id, int seq_id) -{ - rpc_port_proxy_vc_notify_cb_h handle; - GList *iter; - bool once; - int pid = -1; - bundle *msg = nullptr; - - rpc_port_parcel_read_int32(parcel, &pid); - - rpc_port_parcel_read_bundle(parcel, &msg); - if (msg == nullptr) { - _E("Failed to read data"); - goto out; - } - - iter = *delegates; - while (iter) { - handle = iter->data; - iter = g_list_next(iter); - if (handle->id == id && handle->seq_id == seq_id) { - once = handle->once; - _W("Invoke id(%d), seq_id(%d)", id, seq_id); - if (handle->callback) - handle->callback(handle->user_data, pid, msg); - else - _W("The callback function is nullptr"); - - if (once) { - *delegates = g_list_remove(*delegates, handle); - rpc_port_proxy_vc_notify_cb_destroy(handle); - } - - break; - } - } - -out: - - if (msg) - bundle_free(msg); -} - -static void __rpc_port_proxy_vc_feedback_cb_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_proxy_vc_feedback_cb_h h = data; - - if (parcel == nullptr || h == nullptr) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_int32(parcel, h->id); - - rpc_port_parcel_write_int32(parcel, h->seq_id); - - rpc_port_parcel_write_bool(parcel, h->once); - - _I("id(%d), seq_id(%d), once(%s)", h->id, h->seq_id, h->once ? "true" : "false"); -} - -static void __rpc_port_proxy_vc_feedback_cb_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_proxy_vc_feedback_cb_h h = data; - - if (parcel == nullptr || h == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return; - } - - rpc_port_parcel_read_int32(parcel, &h->id); - - rpc_port_parcel_read_int32(parcel, &h->seq_id); - - rpc_port_parcel_read_bool(parcel, &h->once); - - _I("id(%d), seq_id(%d), once(%s)", h->id, h->seq_id, h->once ? "true" : "false"); - set_last_result(RPC_PORT_ERROR_NONE); -} - -int rpc_port_proxy_vc_feedback_cb_create(rpc_port_proxy_vc_feedback_cb_h *h) -{ - rpc_port_proxy_vc_feedback_cb_t *handle; - static int seq_num; - - if (h == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - handle = calloc(1, sizeof(rpc_port_proxy_vc_feedback_cb_t)); - if (handle == nullptr) { - _E("Out of memory"); - return RPC_PORT_ERROR_OUT_OF_MEMORY; - } - - handle->parcelable.to = __rpc_port_proxy_vc_feedback_cb_to; - handle->parcelable.from = __rpc_port_proxy_vc_feedback_cb_from; - handle->id = RPC_PORT_PROXY_VC_DELEGATE_FEEDBACK_CB; - handle->seq_id = g_atomic_int_add(&seq_num, 1) + 1; - _I("id(%d), seq_id(%d)", handle->id, handle->seq_id); - - *h = handle; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_feedback_cb_destroy(rpc_port_proxy_vc_feedback_cb_h h) -{ - if (h == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - _W("id(%d), seq_id(%d), once(%s)", h->id, h->seq_id, h->once ? "true" : "false"); - - free(h); - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_feedback_cb_clone(rpc_port_proxy_vc_feedback_cb_h h, rpc_port_proxy_vc_feedback_cb_h *clone) -{ - rpc_port_proxy_vc_feedback_cb_h handle; - rpc_port_parcel_h parcel; - int ret; - - if (h == nullptr || clone == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - ret = rpc_port_proxy_vc_feedback_cb_create(&handle); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to create handle. error(%d)", ret); - return ret; - } - - ret = rpc_port_parcel_create(&parcel); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret); - rpc_port_proxy_vc_feedback_cb_destroy(handle); - return ret; - } - - rpc_port_parcel_write(parcel, &h->parcelable, h); - rpc_port_parcel_read(parcel, &handle->parcelable, handle); - ret = get_last_result(); - rpc_port_parcel_destroy(parcel); - - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to read data. error(%d)", ret); - rpc_port_proxy_vc_feedback_cb_destroy(handle); - return ret; - } - - handle->callback = h->callback; - handle->user_data = h->user_data; - - *clone = handle; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_feedback_cb_set_callback(rpc_port_proxy_vc_feedback_cb_h h, rpc_port_proxy_vc_feedback_cb_cb callback, void *user_data) -{ - if (h == nullptr || callback == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - h->callback = callback; - h->user_data = user_data; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_feedback_cb_set_once(rpc_port_proxy_vc_feedback_cb_h h, bool once) -{ - if (h == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - h->once = once; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_feedback_cb_get_id(rpc_port_proxy_vc_feedback_cb_h h, int *id) -{ - if (h == nullptr || id == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - *id = h->id; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_feedback_cb_get_seq_id(rpc_port_proxy_vc_feedback_cb_h h, int *seq_id) -{ - if (h == nullptr || seq_id == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - *seq_id = h->seq_id; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_feedback_cb_is_once(rpc_port_proxy_vc_feedback_cb_h h, bool *once) -{ - if (h == nullptr || once == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - *once = h->once; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_feedback_cb_get_tag(rpc_port_proxy_vc_feedback_cb_h h, char **tag) -{ - char *new_tag; - char buf[128]; - - if (h == nullptr || tag == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - snprintf(buf, sizeof(buf), "%d::%d", h->id, h->seq_id); - new_tag = strdup(buf); - if (new_tag == nullptr) { - _E("Out of memory"); - return RPC_PORT_ERROR_OUT_OF_MEMORY; - } - - *tag = new_tag; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_feedback_cb_dispose(rpc_port_proxy_vc_h proxy, rpc_port_proxy_vc_feedback_cb_h h) -{ - GList *found; - - if (proxy == nullptr || h == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - found = g_list_find(proxy->delegates, h); - if (found == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - proxy->delegates = g_list_remove_link(proxy->delegates, found); - rpc_port_proxy_vc_feedback_cb_destroy(h); - g_list_free(found); - - return RPC_PORT_ERROR_NONE; -} - -static void __rpc_port_proxy_vc_feedback_cb_delegate_handler(GList **delegates, rpc_port_parcel_h parcel, int id, int seq_id) -{ - rpc_port_proxy_vc_feedback_cb_h handle; - GList *iter; - bool once; - int utt_id = -1; - int event = -1; - rpc_port_proxy_array_char_h pcm_data = nullptr; - int len = -1; - - rpc_port_parcel_read_int32(parcel, &utt_id); - - rpc_port_parcel_read_int32(parcel, &event); - - rpc_port_proxy_array_char_create(&pcm_data); - if (pcm_data == nullptr) { - _E("Failed to create handle"); - goto out; - } - - rpc_port_parcel_read(parcel, &pcm_data->parcelable, pcm_data); - if (get_last_result() != RPC_PORT_ERROR_NONE) { - _E("Failed to read data"); - goto out; - } - - rpc_port_parcel_read_int32(parcel, &len); - - iter = *delegates; - while (iter) { - handle = iter->data; - iter = g_list_next(iter); - if (handle->id == id && handle->seq_id == seq_id) { - once = handle->once; - _W("Invoke id(%d), seq_id(%d)", id, seq_id); - if (handle->callback) - handle->callback(handle->user_data, utt_id, event, pcm_data, len); - else - _W("The callback function is nullptr"); - - if (once) { - *delegates = g_list_remove(*delegates, handle); - rpc_port_proxy_vc_feedback_cb_destroy(handle); - } - - break; - } - } - -out: - - if (pcm_data) - rpc_port_proxy_array_char_destroy(pcm_data); -} - -static rpc_port_proxy_delegate_cb __rpc_port_proxy_vc_delegate_table[] = { - [RPC_PORT_PROXY_VC_DELEGATE_NOTIFY_CB] = __rpc_port_proxy_vc_notify_cb_delegate_handler, - [RPC_PORT_PROXY_VC_DELEGATE_FEEDBACK_CB] = __rpc_port_proxy_vc_feedback_cb_delegate_handler, -}; - -typedef enum { - RPC_PORT_PROXY_VC_METHOD_RESULT_, - RPC_PORT_PROXY_VC_METHOD_CALLBACK_, - RPC_PORT_PROXY_VC_METHOD_REGISTER_NOTIFY_CB, - RPC_PORT_PROXY_VC_METHOD_REGISTER_NOTIFY_CB_SYNC, - RPC_PORT_PROXY_VC_METHOD_REGISTER_FEEDBACK_CB, - RPC_PORT_PROXY_VC_METHOD_REGISTER_FEEDBACK_CB_SYNC, - RPC_PORT_PROXY_VC_METHOD_INITIALIZE, - RPC_PORT_PROXY_VC_METHOD_FINALIZE, - RPC_PORT_PROXY_VC_METHOD_SET_COMMAND, - RPC_PORT_PROXY_VC_METHOD_UNSET_COMMAND, - RPC_PORT_PROXY_VC_METHOD_SET_FOREGROUND, - RPC_PORT_PROXY_VC_METHOD_SET_SERVER_DIALOG, - RPC_PORT_PROXY_VC_METHOD_REQUEST_DIALOG, - RPC_PORT_PROXY_VC_METHOD_IS_SYSTEM_COMMAND_VALID, - RPC_PORT_PROXY_VC_METHOD_AUTH_ENABLE, - RPC_PORT_PROXY_VC_METHOD_AUTH_DISABLE, - RPC_PORT_PROXY_VC_METHOD_AUTH_START, - RPC_PORT_PROXY_VC_METHOD_AUTH_STOP, - RPC_PORT_PROXY_VC_METHOD_AUTH_CANCEL, - RPC_PORT_PROXY_VC_METHOD_REQUEST_TTS, - RPC_PORT_PROXY_VC_METHOD_CANCEL_TTS, - RPC_PORT_PROXY_VC_METHOD_GET_TTS_AUDIO_FORMAT, -} rpc_port_proxy_vc_method_e; - -static void __rpc_port_proxy_vc_process_received_event(GList **delegates, rpc_port_parcel_h parcel) -{ - int id = 0; - int seq_id = 0; - bool once = false; - - rpc_port_parcel_read_int32(parcel, &id); - rpc_port_parcel_read_int32(parcel, &seq_id); - rpc_port_parcel_read_bool(parcel, &once); - _W("id(%d), seq_id(%d)", id, seq_id); - - if (id > 0 && id < ARRAY_SIZE(__rpc_port_proxy_vc_delegate_table)) { - if (__rpc_port_proxy_vc_delegate_table[id]) - __rpc_port_proxy_vc_delegate_table[id](delegates, parcel, id, seq_id); - } else { - _W("Unknown ID(%d)", id); - } -} - -static void __rpc_port_proxy_vc_consume_command(rpc_port_h port, rpc_port_parcel_h *p) -{ - rpc_port_parcel_h parcel; - int cmd = -1; - int ret; - - do { - ret = rpc_port_parcel_create_from_port(&parcel, port); - if (ret != RPC_PORT_ERROR_NONE) - break; - - rpc_port_parcel_read_int32(parcel, &cmd); - if (cmd == RPC_PORT_PROXY_VC_METHOD_RESULT_) { - *p = parcel; - return; - } - - rpc_port_parcel_destroy(parcel); - } while (true); - - *p = nullptr; -} - -static void __rpc_port_proxy_vc_connected(const char *endpoint, const char *port_name, rpc_port_h port, void *data) -{ - rpc_port_proxy_vc_h h = data; - - _I("endpoint(%s), port_name(%s)", endpoint, port_name); - h->port = port; - rpc_port_proxy_get_port(h->proxy, RPC_PORT_PORT_CALLBACK, &h->callback_port); - h->callback.connected(h, h->user_data); -} - -static void __rpc_port_proxy_vc_disconnected(const char *endpoint, const char *port_name, void *data) -{ - rpc_port_proxy_vc_h h = data; - - _W("endpoint(%s), port_name(%s)", endpoint, port_name); - h->port = nullptr; - h->callback.disconnected(h, h->user_data); -} - -static void __rpc_port_proxy_vc_rejected(const char *endpoint, const char *port_name, void *data) -{ - rpc_port_proxy_vc_h h = data; - - _W("endpoint(%s), port_name(%s)", endpoint, port_name); - h->port = nullptr; - h->callback.rejected(h, h->user_data); -} - -static void __rpc_port_proxy_vc_received(const char *endpoint, const char *port_name, void *data) -{ - rpc_port_proxy_vc_h h = data; - rpc_port_parcel_h parcel; - int cmd = -1; - int ret; - - _W("endpoint(%s), port_name(%s)", endpoint, port_name); - ret = rpc_port_parcel_create_from_port(&parcel, h->callback_port); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle from port. error(%d)", ret); - return; - } - - rpc_port_parcel_read_int32(parcel, &cmd); - if (cmd != RPC_PORT_PROXY_VC_METHOD_CALLBACK_) { - _E("Invalid protocol"); - rpc_port_parcel_destroy(parcel); - return; - } - - __rpc_port_proxy_vc_process_received_event(&h->delegates, parcel); - rpc_port_parcel_destroy(parcel); -} - -int rpc_port_proxy_vc_create(const char *stub_appid, rpc_port_proxy_vc_callback_s *callback, void *user_data, rpc_port_proxy_vc_h *h) -{ - rpc_port_proxy_vc_t *handle; - int ret; - - if (stub_appid == nullptr || callback == nullptr || h == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - if (callback->connected == nullptr || callback->disconnected == nullptr || callback->rejected == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - handle = calloc(1, sizeof(rpc_port_proxy_vc_t)); - if (handle == nullptr) { - _E("Out of memory"); - return RPC_PORT_ERROR_OUT_OF_MEMORY; - } - - g_rec_mutex_init(&handle->mutex); - - handle->stub_appid = strdup(stub_appid); - if (handle->stub_appid == nullptr) { - _E("Failed to duplicate stub appid"); - rpc_port_proxy_vc_destroy(handle); - return RPC_PORT_ERROR_OUT_OF_MEMORY; - } - - ret = rpc_port_proxy_create(&handle->proxy); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to create proxy handle. error(%d)", ret); - rpc_port_proxy_vc_destroy(handle); - return ret; - } - - handle->callback = *callback; - handle->user_data = user_data; - - ret = rpc_port_proxy_add_connected_event_cb(handle->proxy, __rpc_port_proxy_vc_connected, handle); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to add connected event cb. error(%d)", ret); - rpc_port_proxy_vc_destroy(handle); - return ret; - } - - ret = rpc_port_proxy_add_disconnected_event_cb(handle->proxy, __rpc_port_proxy_vc_disconnected, handle); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to add disconnected event cb. error(%d)", ret); - rpc_port_proxy_vc_destroy(handle); - return ret; - } - - ret = rpc_port_proxy_add_rejected_event_cb(handle->proxy, __rpc_port_proxy_vc_rejected, handle); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to add rejected event cb. error(%d)", ret); - rpc_port_proxy_vc_destroy(handle); - return ret; - } - - ret = rpc_port_proxy_add_received_event_cb(handle->proxy, __rpc_port_proxy_vc_received, handle); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to add received event cb. error(%d)", ret); - rpc_port_proxy_vc_destroy(handle); - return ret; - } - - *h = handle; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_destroy(rpc_port_proxy_vc_h h) -{ - if (h == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - g_rec_mutex_lock(&h->mutex); - g_rec_mutex_unlock(&h->mutex); - g_rec_mutex_clear(&h->mutex); - - if (h->delegates) - g_list_free_full(h->delegates, free); - - if (h->proxy) - rpc_port_proxy_destroy(h->proxy); - - if (h->stub_appid) - free(h->stub_appid); - - free(h); - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_connect(rpc_port_proxy_vc_h h) -{ - int ret; - - if (h == nullptr || h->proxy == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - ret = rpc_port_proxy_connect(h->proxy, h->stub_appid, "vc"); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to connect to stub. error(%d)", ret); - return ret; - } - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_connect_sync(rpc_port_proxy_vc_h h) -{ - int ret; - - if (h == nullptr || h->proxy == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - ret = rpc_port_proxy_connect_sync(h->proxy, h->stub_appid, "vc"); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to connect to stub. error(%d)", ret); - return ret; - } - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_proxy_vc_disconnect(rpc_port_proxy_vc_h h) -{ - int ret; - - if (h == nullptr || h->proxy == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - ret = rpc_port_disconnect(h->port); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to disconnect from stub. error(%d)", ret); - return ret; - } - - return RPC_PORT_ERROR_NONE; -} - -void rpc_port_proxy_vc_invoke_register_notify_cb(rpc_port_proxy_vc_h h, int pid, rpc_port_proxy_vc_notify_cb_h callback) -{ - rpc_port_parcel_h parcel_; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - int res_; - - if (h == nullptr || callback == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return; - } - - g_rec_mutex_lock(&h->mutex); - if (h->port == nullptr) { - _E("Not connected"); - g_rec_mutex_unlock(&h->mutex); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return; - } - - res_ = rpc_port_parcel_create(&parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", res_); - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); - return; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Version] \"%s\", [Sequence] %d", TIDL_VERSION, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_PROXY_VC_METHOD_REGISTER_NOTIFY_CB); - - rpc_port_parcel_write_int32(parcel_, pid); - - rpc_port_parcel_write(parcel_, &callback->parcelable, callback); - - h->delegates = g_list_append(h->delegates, callback); - - res_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - if (res_ != RPC_PORT_ERROR_NONE) - _E("Failed to send parcel. error(%d)", res_); - - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); -} - -int rpc_port_proxy_vc_invoke_register_notify_cb_sync(rpc_port_proxy_vc_h h, int pid, rpc_port_proxy_vc_notify_cb_h callback) -{ - rpc_port_parcel_h parcel_; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - int recv_seq_num_ = -1; - char *tag_ = nullptr; - bool done_ = false; - int res_; - int ret_ = -1; - - if (h == nullptr || callback == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return ret_; - } - - g_rec_mutex_lock(&h->mutex); - if (h->port == nullptr) { - _E("Not connected"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - res_ = rpc_port_parcel_create(&parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Version] \"%s\", [Sequence] %d", TIDL_VERSION, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_PROXY_VC_METHOD_REGISTER_NOTIFY_CB_SYNC); - - rpc_port_parcel_write_int32(parcel_, pid); - - rpc_port_parcel_write(parcel_, &callback->parcelable, callback); - - h->delegates = g_list_append(h->delegates, callback); - - res_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - do { - parcel_ = nullptr; - __rpc_port_proxy_vc_consume_command(h->port, &parcel_); - if (parcel_ == nullptr) { - _E("Invalid protocol"); - res_ = RPC_PORT_ERROR_IO_ERROR; - break; - } - - header_ = nullptr; - rpc_port_parcel_get_header(parcel_, &header_); - tag_ = nullptr; - rpc_port_parcel_header_get_tag(header_, &tag_); - if (tag_ && tag_[0] != '\0') { - _W("[Version] %s", tag_); - rpc_port_parcel_header_get_seq_num(header_, &recv_seq_num_); - if (recv_seq_num_ != seq_num_) { - _E("Invalid protocol. %d", recv_seq_num_); - free(tag_); - rpc_port_parcel_destroy(parcel_); - continue; - } - } - done_ = true; - free(tag_); - - rpc_port_parcel_read_int32(parcel_, &ret_); - - rpc_port_parcel_destroy(parcel_); - } while (!done_); - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); - - return ret_; -} - -void rpc_port_proxy_vc_invoke_register_feedback_cb(rpc_port_proxy_vc_h h, int pid, rpc_port_proxy_vc_feedback_cb_h callback) -{ - rpc_port_parcel_h parcel_; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - int res_; - - if (h == nullptr || callback == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return; - } - - g_rec_mutex_lock(&h->mutex); - if (h->port == nullptr) { - _E("Not connected"); - g_rec_mutex_unlock(&h->mutex); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return; - } - - res_ = rpc_port_parcel_create(&parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", res_); - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); - return; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Version] \"%s\", [Sequence] %d", TIDL_VERSION, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_PROXY_VC_METHOD_REGISTER_FEEDBACK_CB); - - rpc_port_parcel_write_int32(parcel_, pid); - - rpc_port_parcel_write(parcel_, &callback->parcelable, callback); - - h->delegates = g_list_append(h->delegates, callback); - - res_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - if (res_ != RPC_PORT_ERROR_NONE) - _E("Failed to send parcel. error(%d)", res_); - - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); -} - -int rpc_port_proxy_vc_invoke_register_feedback_cb_sync(rpc_port_proxy_vc_h h, int pid, rpc_port_proxy_vc_feedback_cb_h callback) -{ - rpc_port_parcel_h parcel_; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - int recv_seq_num_ = -1; - char *tag_ = nullptr; - bool done_ = false; - int res_; - int ret_ = -1; - - if (h == nullptr || callback == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return ret_; - } - - g_rec_mutex_lock(&h->mutex); - if (h->port == nullptr) { - _E("Not connected"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - res_ = rpc_port_parcel_create(&parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Version] \"%s\", [Sequence] %d", TIDL_VERSION, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_PROXY_VC_METHOD_REGISTER_FEEDBACK_CB_SYNC); - - rpc_port_parcel_write_int32(parcel_, pid); - - rpc_port_parcel_write(parcel_, &callback->parcelable, callback); - - h->delegates = g_list_append(h->delegates, callback); - - res_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - do { - parcel_ = nullptr; - __rpc_port_proxy_vc_consume_command(h->port, &parcel_); - if (parcel_ == nullptr) { - _E("Invalid protocol"); - res_ = RPC_PORT_ERROR_IO_ERROR; - break; - } - - header_ = nullptr; - rpc_port_parcel_get_header(parcel_, &header_); - tag_ = nullptr; - rpc_port_parcel_header_get_tag(header_, &tag_); - if (tag_ && tag_[0] != '\0') { - _W("[Version] %s", tag_); - rpc_port_parcel_header_get_seq_num(header_, &recv_seq_num_); - if (recv_seq_num_ != seq_num_) { - _E("Invalid protocol. %d", recv_seq_num_); - free(tag_); - rpc_port_parcel_destroy(parcel_); - continue; - } - } - done_ = true; - free(tag_); - - rpc_port_parcel_read_int32(parcel_, &ret_); - - rpc_port_parcel_destroy(parcel_); - } while (!done_); - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); - - return ret_; -} - -int rpc_port_proxy_vc_invoke_initialize(rpc_port_proxy_vc_h h, int pid, int *mgr_pid, int *service_state, int *daemon_pid) -{ - rpc_port_parcel_h parcel_; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - int recv_seq_num_ = -1; - char *tag_ = nullptr; - bool done_ = false; - int res_; - int ret_ = -1; - int new_mgr_pid; - int new_service_state; - int new_daemon_pid; - - if (h == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return ret_; - } - - g_rec_mutex_lock(&h->mutex); - if (h->port == nullptr) { - _E("Not connected"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - res_ = rpc_port_parcel_create(&parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Version] \"%s\", [Sequence] %d", TIDL_VERSION, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_PROXY_VC_METHOD_INITIALIZE); - - rpc_port_parcel_write_int32(parcel_, pid); - - res_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - do { - parcel_ = nullptr; - __rpc_port_proxy_vc_consume_command(h->port, &parcel_); - if (parcel_ == nullptr) { - _E("Invalid protocol"); - res_ = RPC_PORT_ERROR_IO_ERROR; - break; - } - - header_ = nullptr; - rpc_port_parcel_get_header(parcel_, &header_); - tag_ = nullptr; - rpc_port_parcel_header_get_tag(header_, &tag_); - if (tag_ && tag_[0] != '\0') { - _W("[Version] %s", tag_); - rpc_port_parcel_header_get_seq_num(header_, &recv_seq_num_); - if (recv_seq_num_ != seq_num_) { - _E("Invalid protocol. %d", recv_seq_num_); - free(tag_); - rpc_port_parcel_destroy(parcel_); - continue; - } - } - done_ = true; - free(tag_); - - rpc_port_parcel_read_int32(parcel_, &new_mgr_pid); - - *mgr_pid = new_mgr_pid; - - rpc_port_parcel_read_int32(parcel_, &new_service_state); - - *service_state = new_service_state; - - rpc_port_parcel_read_int32(parcel_, &new_daemon_pid); - - *daemon_pid = new_daemon_pid; - - rpc_port_parcel_read_int32(parcel_, &ret_); - - rpc_port_parcel_destroy(parcel_); - } while (!done_); - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); - - return ret_; -} - -int rpc_port_proxy_vc_invoke_finalize(rpc_port_proxy_vc_h h, int pid) -{ - rpc_port_parcel_h parcel_; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - int recv_seq_num_ = -1; - char *tag_ = nullptr; - bool done_ = false; - int res_; - int ret_ = -1; - - if (h == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return ret_; - } - - g_rec_mutex_lock(&h->mutex); - if (h->port == nullptr) { - _E("Not connected"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - res_ = rpc_port_parcel_create(&parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Version] \"%s\", [Sequence] %d", TIDL_VERSION, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_PROXY_VC_METHOD_FINALIZE); - - rpc_port_parcel_write_int32(parcel_, pid); - - res_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - do { - parcel_ = nullptr; - __rpc_port_proxy_vc_consume_command(h->port, &parcel_); - if (parcel_ == nullptr) { - _E("Invalid protocol"); - res_ = RPC_PORT_ERROR_IO_ERROR; - break; - } - - header_ = nullptr; - rpc_port_parcel_get_header(parcel_, &header_); - tag_ = nullptr; - rpc_port_parcel_header_get_tag(header_, &tag_); - if (tag_ && tag_[0] != '\0') { - _W("[Version] %s", tag_); - rpc_port_parcel_header_get_seq_num(header_, &recv_seq_num_); - if (recv_seq_num_ != seq_num_) { - _E("Invalid protocol. %d", recv_seq_num_); - free(tag_); - rpc_port_parcel_destroy(parcel_); - continue; - } - } - done_ = true; - free(tag_); - - rpc_port_parcel_read_int32(parcel_, &ret_); - - rpc_port_parcel_destroy(parcel_); - } while (!done_); - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); - - return ret_; -} - -int rpc_port_proxy_vc_invoke_set_command(rpc_port_proxy_vc_h h, int pid, int cmd_type) -{ - rpc_port_parcel_h parcel_; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - int recv_seq_num_ = -1; - char *tag_ = nullptr; - bool done_ = false; - int res_; - int ret_ = -1; - - if (h == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return ret_; - } - - g_rec_mutex_lock(&h->mutex); - if (h->port == nullptr) { - _E("Not connected"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - res_ = rpc_port_parcel_create(&parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Version] \"%s\", [Sequence] %d", TIDL_VERSION, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_PROXY_VC_METHOD_SET_COMMAND); - - rpc_port_parcel_write_int32(parcel_, pid); - - rpc_port_parcel_write_int32(parcel_, cmd_type); - - res_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - do { - parcel_ = nullptr; - __rpc_port_proxy_vc_consume_command(h->port, &parcel_); - if (parcel_ == nullptr) { - _E("Invalid protocol"); - res_ = RPC_PORT_ERROR_IO_ERROR; - break; - } - - header_ = nullptr; - rpc_port_parcel_get_header(parcel_, &header_); - tag_ = nullptr; - rpc_port_parcel_header_get_tag(header_, &tag_); - if (tag_ && tag_[0] != '\0') { - _W("[Version] %s", tag_); - rpc_port_parcel_header_get_seq_num(header_, &recv_seq_num_); - if (recv_seq_num_ != seq_num_) { - _E("Invalid protocol. %d", recv_seq_num_); - free(tag_); - rpc_port_parcel_destroy(parcel_); - continue; - } - } - done_ = true; - free(tag_); - - rpc_port_parcel_read_int32(parcel_, &ret_); - - rpc_port_parcel_destroy(parcel_); - } while (!done_); - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); - - return ret_; -} - -int rpc_port_proxy_vc_invoke_unset_command(rpc_port_proxy_vc_h h, int pid, int cmd_type) -{ - rpc_port_parcel_h parcel_; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - int recv_seq_num_ = -1; - char *tag_ = nullptr; - bool done_ = false; - int res_; - int ret_ = -1; - - if (h == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return ret_; - } - - g_rec_mutex_lock(&h->mutex); - if (h->port == nullptr) { - _E("Not connected"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - res_ = rpc_port_parcel_create(&parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Version] \"%s\", [Sequence] %d", TIDL_VERSION, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_PROXY_VC_METHOD_UNSET_COMMAND); - - rpc_port_parcel_write_int32(parcel_, pid); - - rpc_port_parcel_write_int32(parcel_, cmd_type); - - res_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - do { - parcel_ = nullptr; - __rpc_port_proxy_vc_consume_command(h->port, &parcel_); - if (parcel_ == nullptr) { - _E("Invalid protocol"); - res_ = RPC_PORT_ERROR_IO_ERROR; - break; - } - - header_ = nullptr; - rpc_port_parcel_get_header(parcel_, &header_); - tag_ = nullptr; - rpc_port_parcel_header_get_tag(header_, &tag_); - if (tag_ && tag_[0] != '\0') { - _W("[Version] %s", tag_); - rpc_port_parcel_header_get_seq_num(header_, &recv_seq_num_); - if (recv_seq_num_ != seq_num_) { - _E("Invalid protocol. %d", recv_seq_num_); - free(tag_); - rpc_port_parcel_destroy(parcel_); - continue; - } - } - done_ = true; - free(tag_); - - rpc_port_parcel_read_int32(parcel_, &ret_); - - rpc_port_parcel_destroy(parcel_); - } while (!done_); - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); - - return ret_; -} - -int rpc_port_proxy_vc_invoke_set_foreground(rpc_port_proxy_vc_h h, int pid, bool value) -{ - rpc_port_parcel_h parcel_; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - int recv_seq_num_ = -1; - char *tag_ = nullptr; - bool done_ = false; - int res_; - int ret_ = -1; - - if (h == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return ret_; - } - - g_rec_mutex_lock(&h->mutex); - if (h->port == nullptr) { - _E("Not connected"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - res_ = rpc_port_parcel_create(&parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Version] \"%s\", [Sequence] %d", TIDL_VERSION, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_PROXY_VC_METHOD_SET_FOREGROUND); - - rpc_port_parcel_write_int32(parcel_, pid); - - rpc_port_parcel_write_bool(parcel_, value); - - res_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - do { - parcel_ = nullptr; - __rpc_port_proxy_vc_consume_command(h->port, &parcel_); - if (parcel_ == nullptr) { - _E("Invalid protocol"); - res_ = RPC_PORT_ERROR_IO_ERROR; - break; - } - - header_ = nullptr; - rpc_port_parcel_get_header(parcel_, &header_); - tag_ = nullptr; - rpc_port_parcel_header_get_tag(header_, &tag_); - if (tag_ && tag_[0] != '\0') { - _W("[Version] %s", tag_); - rpc_port_parcel_header_get_seq_num(header_, &recv_seq_num_); - if (recv_seq_num_ != seq_num_) { - _E("Invalid protocol. %d", recv_seq_num_); - free(tag_); - rpc_port_parcel_destroy(parcel_); - continue; - } - } - done_ = true; - free(tag_); - - rpc_port_parcel_read_int32(parcel_, &ret_); - - rpc_port_parcel_destroy(parcel_); - } while (!done_); - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); - - return ret_; -} - -int rpc_port_proxy_vc_invoke_set_server_dialog(rpc_port_proxy_vc_h h, int pid, const char *app_id, const char *credential) -{ - rpc_port_parcel_h parcel_; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - int recv_seq_num_ = -1; - char *tag_ = nullptr; - bool done_ = false; - int res_; - int ret_ = -1; - - if (h == nullptr || app_id == nullptr || credential == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return ret_; - } - - g_rec_mutex_lock(&h->mutex); - if (h->port == nullptr) { - _E("Not connected"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - res_ = rpc_port_parcel_create(&parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Version] \"%s\", [Sequence] %d", TIDL_VERSION, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_PROXY_VC_METHOD_SET_SERVER_DIALOG); - - rpc_port_parcel_write_int32(parcel_, pid); - - rpc_port_parcel_write_string(parcel_, app_id); - - rpc_port_parcel_write_string(parcel_, credential); - - res_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - do { - parcel_ = nullptr; - __rpc_port_proxy_vc_consume_command(h->port, &parcel_); - if (parcel_ == nullptr) { - _E("Invalid protocol"); - res_ = RPC_PORT_ERROR_IO_ERROR; - break; - } - - header_ = nullptr; - rpc_port_parcel_get_header(parcel_, &header_); - tag_ = nullptr; - rpc_port_parcel_header_get_tag(header_, &tag_); - if (tag_ && tag_[0] != '\0') { - _W("[Version] %s", tag_); - rpc_port_parcel_header_get_seq_num(header_, &recv_seq_num_); - if (recv_seq_num_ != seq_num_) { - _E("Invalid protocol. %d", recv_seq_num_); - free(tag_); - rpc_port_parcel_destroy(parcel_); - continue; - } - } - done_ = true; - free(tag_); - - rpc_port_parcel_read_int32(parcel_, &ret_); - - rpc_port_parcel_destroy(parcel_); - } while (!done_); - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); - - return ret_; -} - -int rpc_port_proxy_vc_invoke_request_dialog(rpc_port_proxy_vc_h h, int pid, const char *disp_text, const char *utt_text, bool continuous) -{ - rpc_port_parcel_h parcel_; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - int recv_seq_num_ = -1; - char *tag_ = nullptr; - bool done_ = false; - int res_; - int ret_ = -1; - - if (h == nullptr || disp_text == nullptr || utt_text == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return ret_; - } - - g_rec_mutex_lock(&h->mutex); - if (h->port == nullptr) { - _E("Not connected"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - res_ = rpc_port_parcel_create(&parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Version] \"%s\", [Sequence] %d", TIDL_VERSION, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_PROXY_VC_METHOD_REQUEST_DIALOG); - - rpc_port_parcel_write_int32(parcel_, pid); - - rpc_port_parcel_write_string(parcel_, disp_text); - - rpc_port_parcel_write_string(parcel_, utt_text); - - rpc_port_parcel_write_bool(parcel_, continuous); - - res_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - do { - parcel_ = nullptr; - __rpc_port_proxy_vc_consume_command(h->port, &parcel_); - if (parcel_ == nullptr) { - _E("Invalid protocol"); - res_ = RPC_PORT_ERROR_IO_ERROR; - break; - } - - header_ = nullptr; - rpc_port_parcel_get_header(parcel_, &header_); - tag_ = nullptr; - rpc_port_parcel_header_get_tag(header_, &tag_); - if (tag_ && tag_[0] != '\0') { - _W("[Version] %s", tag_); - rpc_port_parcel_header_get_seq_num(header_, &recv_seq_num_); - if (recv_seq_num_ != seq_num_) { - _E("Invalid protocol. %d", recv_seq_num_); - free(tag_); - rpc_port_parcel_destroy(parcel_); - continue; - } - } - done_ = true; - free(tag_); - - rpc_port_parcel_read_int32(parcel_, &ret_); - - rpc_port_parcel_destroy(parcel_); - } while (!done_); - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); - - return ret_; -} - -int rpc_port_proxy_vc_invoke_is_system_command_valid(rpc_port_proxy_vc_h h, int pid, bool *is_sys_cmd_valid) -{ - rpc_port_parcel_h parcel_; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - int recv_seq_num_ = -1; - char *tag_ = nullptr; - bool done_ = false; - int res_; - int ret_ = -1; - bool new_is_sys_cmd_valid; - - if (h == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return ret_; - } - - g_rec_mutex_lock(&h->mutex); - if (h->port == nullptr) { - _E("Not connected"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - res_ = rpc_port_parcel_create(&parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Version] \"%s\", [Sequence] %d", TIDL_VERSION, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_PROXY_VC_METHOD_IS_SYSTEM_COMMAND_VALID); - - rpc_port_parcel_write_int32(parcel_, pid); - - res_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - do { - parcel_ = nullptr; - __rpc_port_proxy_vc_consume_command(h->port, &parcel_); - if (parcel_ == nullptr) { - _E("Invalid protocol"); - res_ = RPC_PORT_ERROR_IO_ERROR; - break; - } - - header_ = nullptr; - rpc_port_parcel_get_header(parcel_, &header_); - tag_ = nullptr; - rpc_port_parcel_header_get_tag(header_, &tag_); - if (tag_ && tag_[0] != '\0') { - _W("[Version] %s", tag_); - rpc_port_parcel_header_get_seq_num(header_, &recv_seq_num_); - if (recv_seq_num_ != seq_num_) { - _E("Invalid protocol. %d", recv_seq_num_); - free(tag_); - rpc_port_parcel_destroy(parcel_); - continue; - } - } - done_ = true; - free(tag_); - - rpc_port_parcel_read_bool(parcel_, &new_is_sys_cmd_valid); - - *is_sys_cmd_valid = new_is_sys_cmd_valid; - - rpc_port_parcel_read_int32(parcel_, &ret_); - - rpc_port_parcel_destroy(parcel_); - } while (!done_); - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); - - return ret_; -} - -int rpc_port_proxy_vc_invoke_auth_enable(rpc_port_proxy_vc_h h, int pid, int mgr_pid) -{ - rpc_port_parcel_h parcel_; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - int recv_seq_num_ = -1; - char *tag_ = nullptr; - bool done_ = false; - int res_; - int ret_ = -1; - - if (h == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return ret_; - } - - g_rec_mutex_lock(&h->mutex); - if (h->port == nullptr) { - _E("Not connected"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - res_ = rpc_port_parcel_create(&parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Version] \"%s\", [Sequence] %d", TIDL_VERSION, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_PROXY_VC_METHOD_AUTH_ENABLE); - - rpc_port_parcel_write_int32(parcel_, pid); - - rpc_port_parcel_write_int32(parcel_, mgr_pid); - - res_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - do { - parcel_ = nullptr; - __rpc_port_proxy_vc_consume_command(h->port, &parcel_); - if (parcel_ == nullptr) { - _E("Invalid protocol"); - res_ = RPC_PORT_ERROR_IO_ERROR; - break; - } - - header_ = nullptr; - rpc_port_parcel_get_header(parcel_, &header_); - tag_ = nullptr; - rpc_port_parcel_header_get_tag(header_, &tag_); - if (tag_ && tag_[0] != '\0') { - _W("[Version] %s", tag_); - rpc_port_parcel_header_get_seq_num(header_, &recv_seq_num_); - if (recv_seq_num_ != seq_num_) { - _E("Invalid protocol. %d", recv_seq_num_); - free(tag_); - rpc_port_parcel_destroy(parcel_); - continue; - } - } - done_ = true; - free(tag_); - - rpc_port_parcel_read_int32(parcel_, &ret_); - - rpc_port_parcel_destroy(parcel_); - } while (!done_); - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); - - return ret_; -} - -int rpc_port_proxy_vc_invoke_auth_disable(rpc_port_proxy_vc_h h, int pid, int mgr_pid) -{ - rpc_port_parcel_h parcel_; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - int recv_seq_num_ = -1; - char *tag_ = nullptr; - bool done_ = false; - int res_; - int ret_ = -1; - - if (h == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return ret_; - } - - g_rec_mutex_lock(&h->mutex); - if (h->port == nullptr) { - _E("Not connected"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - res_ = rpc_port_parcel_create(&parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Version] \"%s\", [Sequence] %d", TIDL_VERSION, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_PROXY_VC_METHOD_AUTH_DISABLE); - - rpc_port_parcel_write_int32(parcel_, pid); - - rpc_port_parcel_write_int32(parcel_, mgr_pid); - - res_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - do { - parcel_ = nullptr; - __rpc_port_proxy_vc_consume_command(h->port, &parcel_); - if (parcel_ == nullptr) { - _E("Invalid protocol"); - res_ = RPC_PORT_ERROR_IO_ERROR; - break; - } - - header_ = nullptr; - rpc_port_parcel_get_header(parcel_, &header_); - tag_ = nullptr; - rpc_port_parcel_header_get_tag(header_, &tag_); - if (tag_ && tag_[0] != '\0') { - _W("[Version] %s", tag_); - rpc_port_parcel_header_get_seq_num(header_, &recv_seq_num_); - if (recv_seq_num_ != seq_num_) { - _E("Invalid protocol. %d", recv_seq_num_); - free(tag_); - rpc_port_parcel_destroy(parcel_); - continue; - } - } - done_ = true; - free(tag_); - - rpc_port_parcel_read_int32(parcel_, &ret_); - - rpc_port_parcel_destroy(parcel_); - } while (!done_); - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); - - return ret_; -} - -int rpc_port_proxy_vc_invoke_auth_start(rpc_port_proxy_vc_h h, int pid, int mgr_pid) -{ - rpc_port_parcel_h parcel_; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - int recv_seq_num_ = -1; - char *tag_ = nullptr; - bool done_ = false; - int res_; - int ret_ = -1; - - if (h == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return ret_; - } - - g_rec_mutex_lock(&h->mutex); - if (h->port == nullptr) { - _E("Not connected"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - res_ = rpc_port_parcel_create(&parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Version] \"%s\", [Sequence] %d", TIDL_VERSION, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_PROXY_VC_METHOD_AUTH_START); - - rpc_port_parcel_write_int32(parcel_, pid); - - rpc_port_parcel_write_int32(parcel_, mgr_pid); - - res_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - do { - parcel_ = nullptr; - __rpc_port_proxy_vc_consume_command(h->port, &parcel_); - if (parcel_ == nullptr) { - _E("Invalid protocol"); - res_ = RPC_PORT_ERROR_IO_ERROR; - break; - } - - header_ = nullptr; - rpc_port_parcel_get_header(parcel_, &header_); - tag_ = nullptr; - rpc_port_parcel_header_get_tag(header_, &tag_); - if (tag_ && tag_[0] != '\0') { - _W("[Version] %s", tag_); - rpc_port_parcel_header_get_seq_num(header_, &recv_seq_num_); - if (recv_seq_num_ != seq_num_) { - _E("Invalid protocol. %d", recv_seq_num_); - free(tag_); - rpc_port_parcel_destroy(parcel_); - continue; - } - } - done_ = true; - free(tag_); - - rpc_port_parcel_read_int32(parcel_, &ret_); - - rpc_port_parcel_destroy(parcel_); - } while (!done_); - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); - - return ret_; -} - -int rpc_port_proxy_vc_invoke_auth_stop(rpc_port_proxy_vc_h h, int pid, int mgr_pid) -{ - rpc_port_parcel_h parcel_; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - int recv_seq_num_ = -1; - char *tag_ = nullptr; - bool done_ = false; - int res_; - int ret_ = -1; - - if (h == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return ret_; - } - - g_rec_mutex_lock(&h->mutex); - if (h->port == nullptr) { - _E("Not connected"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - res_ = rpc_port_parcel_create(&parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Version] \"%s\", [Sequence] %d", TIDL_VERSION, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_PROXY_VC_METHOD_AUTH_STOP); - - rpc_port_parcel_write_int32(parcel_, pid); - - rpc_port_parcel_write_int32(parcel_, mgr_pid); - - res_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - do { - parcel_ = nullptr; - __rpc_port_proxy_vc_consume_command(h->port, &parcel_); - if (parcel_ == nullptr) { - _E("Invalid protocol"); - res_ = RPC_PORT_ERROR_IO_ERROR; - break; - } - - header_ = nullptr; - rpc_port_parcel_get_header(parcel_, &header_); - tag_ = nullptr; - rpc_port_parcel_header_get_tag(header_, &tag_); - if (tag_ && tag_[0] != '\0') { - _W("[Version] %s", tag_); - rpc_port_parcel_header_get_seq_num(header_, &recv_seq_num_); - if (recv_seq_num_ != seq_num_) { - _E("Invalid protocol. %d", recv_seq_num_); - free(tag_); - rpc_port_parcel_destroy(parcel_); - continue; - } - } - done_ = true; - free(tag_); - - rpc_port_parcel_read_int32(parcel_, &ret_); - - rpc_port_parcel_destroy(parcel_); - } while (!done_); - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); - - return ret_; -} - -int rpc_port_proxy_vc_invoke_auth_cancel(rpc_port_proxy_vc_h h, int pid, int mgr_pid) -{ - rpc_port_parcel_h parcel_; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - int recv_seq_num_ = -1; - char *tag_ = nullptr; - bool done_ = false; - int res_; - int ret_ = -1; - - if (h == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return ret_; - } - - g_rec_mutex_lock(&h->mutex); - if (h->port == nullptr) { - _E("Not connected"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - res_ = rpc_port_parcel_create(&parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Version] \"%s\", [Sequence] %d", TIDL_VERSION, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_PROXY_VC_METHOD_AUTH_CANCEL); - - rpc_port_parcel_write_int32(parcel_, pid); - - rpc_port_parcel_write_int32(parcel_, mgr_pid); - - res_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - do { - parcel_ = nullptr; - __rpc_port_proxy_vc_consume_command(h->port, &parcel_); - if (parcel_ == nullptr) { - _E("Invalid protocol"); - res_ = RPC_PORT_ERROR_IO_ERROR; - break; - } - - header_ = nullptr; - rpc_port_parcel_get_header(parcel_, &header_); - tag_ = nullptr; - rpc_port_parcel_header_get_tag(header_, &tag_); - if (tag_ && tag_[0] != '\0') { - _W("[Version] %s", tag_); - rpc_port_parcel_header_get_seq_num(header_, &recv_seq_num_); - if (recv_seq_num_ != seq_num_) { - _E("Invalid protocol. %d", recv_seq_num_); - free(tag_); - rpc_port_parcel_destroy(parcel_); - continue; - } - } - done_ = true; - free(tag_); - - rpc_port_parcel_read_int32(parcel_, &ret_); - - rpc_port_parcel_destroy(parcel_); - } while (!done_); - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); - - return ret_; -} - -int rpc_port_proxy_vc_invoke_request_tts(rpc_port_proxy_vc_h h, int pid, const char *text, const char *lang, bool to_vcm, int *utt_id) -{ - rpc_port_parcel_h parcel_; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - int recv_seq_num_ = -1; - char *tag_ = nullptr; - bool done_ = false; - int res_; - int ret_ = -1; - int new_utt_id; - - if (h == nullptr || text == nullptr || lang == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return ret_; - } - - g_rec_mutex_lock(&h->mutex); - if (h->port == nullptr) { - _E("Not connected"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - res_ = rpc_port_parcel_create(&parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Version] \"%s\", [Sequence] %d", TIDL_VERSION, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_PROXY_VC_METHOD_REQUEST_TTS); - - rpc_port_parcel_write_int32(parcel_, pid); - - rpc_port_parcel_write_string(parcel_, text); - - rpc_port_parcel_write_string(parcel_, lang); - - rpc_port_parcel_write_bool(parcel_, to_vcm); - - res_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - do { - parcel_ = nullptr; - __rpc_port_proxy_vc_consume_command(h->port, &parcel_); - if (parcel_ == nullptr) { - _E("Invalid protocol"); - res_ = RPC_PORT_ERROR_IO_ERROR; - break; - } - - header_ = nullptr; - rpc_port_parcel_get_header(parcel_, &header_); - tag_ = nullptr; - rpc_port_parcel_header_get_tag(header_, &tag_); - if (tag_ && tag_[0] != '\0') { - _W("[Version] %s", tag_); - rpc_port_parcel_header_get_seq_num(header_, &recv_seq_num_); - if (recv_seq_num_ != seq_num_) { - _E("Invalid protocol. %d", recv_seq_num_); - free(tag_); - rpc_port_parcel_destroy(parcel_); - continue; - } - } - done_ = true; - free(tag_); - - rpc_port_parcel_read_int32(parcel_, &new_utt_id); - - *utt_id = new_utt_id; - - rpc_port_parcel_read_int32(parcel_, &ret_); - - rpc_port_parcel_destroy(parcel_); - } while (!done_); - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); - - return ret_; -} - -int rpc_port_proxy_vc_invoke_cancel_tts(rpc_port_proxy_vc_h h, int pid, int utt_id) -{ - rpc_port_parcel_h parcel_; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - int recv_seq_num_ = -1; - char *tag_ = nullptr; - bool done_ = false; - int res_; - int ret_ = -1; - - if (h == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return ret_; - } - - g_rec_mutex_lock(&h->mutex); - if (h->port == nullptr) { - _E("Not connected"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - res_ = rpc_port_parcel_create(&parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Version] \"%s\", [Sequence] %d", TIDL_VERSION, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_PROXY_VC_METHOD_CANCEL_TTS); - - rpc_port_parcel_write_int32(parcel_, pid); - - rpc_port_parcel_write_int32(parcel_, utt_id); - - res_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - do { - parcel_ = nullptr; - __rpc_port_proxy_vc_consume_command(h->port, &parcel_); - if (parcel_ == nullptr) { - _E("Invalid protocol"); - res_ = RPC_PORT_ERROR_IO_ERROR; - break; - } - - header_ = nullptr; - rpc_port_parcel_get_header(parcel_, &header_); - tag_ = nullptr; - rpc_port_parcel_header_get_tag(header_, &tag_); - if (tag_ && tag_[0] != '\0') { - _W("[Version] %s", tag_); - rpc_port_parcel_header_get_seq_num(header_, &recv_seq_num_); - if (recv_seq_num_ != seq_num_) { - _E("Invalid protocol. %d", recv_seq_num_); - free(tag_); - rpc_port_parcel_destroy(parcel_); - continue; - } - } - done_ = true; - free(tag_); - - rpc_port_parcel_read_int32(parcel_, &ret_); - - rpc_port_parcel_destroy(parcel_); - } while (!done_); - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); - - return ret_; -} - -int rpc_port_proxy_vc_invoke_get_tts_audio_format(rpc_port_proxy_vc_h h, int pid, int *rate, int *channel, int *audio_type) -{ - rpc_port_parcel_h parcel_; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - int recv_seq_num_ = -1; - char *tag_ = nullptr; - bool done_ = false; - int res_; - int ret_ = -1; - int new_rate; - int new_channel; - int new_audio_type; - - if (h == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return ret_; - } - - g_rec_mutex_lock(&h->mutex); - if (h->port == nullptr) { - _E("Not connected"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - res_ = rpc_port_parcel_create(&parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Version] \"%s\", [Sequence] %d", TIDL_VERSION, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_PROXY_VC_METHOD_GET_TTS_AUDIO_FORMAT); - - rpc_port_parcel_write_int32(parcel_, pid); - - res_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - if (res_ != RPC_PORT_ERROR_NONE) { - _E("Failed to send parcel. error(%d)", res_); - set_last_result(res_); - g_rec_mutex_unlock(&h->mutex); - return ret_; - } - - do { - parcel_ = nullptr; - __rpc_port_proxy_vc_consume_command(h->port, &parcel_); - if (parcel_ == nullptr) { - _E("Invalid protocol"); - res_ = RPC_PORT_ERROR_IO_ERROR; - break; - } - - header_ = nullptr; - rpc_port_parcel_get_header(parcel_, &header_); - tag_ = nullptr; - rpc_port_parcel_header_get_tag(header_, &tag_); - if (tag_ && tag_[0] != '\0') { - _W("[Version] %s", tag_); - rpc_port_parcel_header_get_seq_num(header_, &recv_seq_num_); - if (recv_seq_num_ != seq_num_) { - _E("Invalid protocol. %d", recv_seq_num_); - free(tag_); - rpc_port_parcel_destroy(parcel_); - continue; - } - } - done_ = true; - free(tag_); - - rpc_port_parcel_read_int32(parcel_, &new_rate); - - *rate = new_rate; - - rpc_port_parcel_read_int32(parcel_, &new_channel); - - *channel = new_channel; - - rpc_port_parcel_read_int32(parcel_, &new_audio_type); - - *audio_type = new_audio_type; - - rpc_port_parcel_read_int32(parcel_, &ret_); - - rpc_port_parcel_destroy(parcel_); - } while (!done_); - g_rec_mutex_unlock(&h->mutex); - set_last_result(res_); - - return ret_; -} diff --git a/client/vc_proxy.h b/client/vc_proxy.h deleted file mode 100755 index 5b2fa31..0000000 --- a/client/vc_proxy.h +++ /dev/null @@ -1,819 +0,0 @@ -/* - * Generated by tidlc 1.8.1. - */ - -#pragma once - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief The rpc_port_proxy_array_char handle. - */ -typedef struct rpc_port_proxy_array_char_s *rpc_port_proxy_array_char_h; - -/** - * @brief The rpc_port_proxy_vc handle. - */ -typedef struct rpc_port_proxy_vc_s *rpc_port_proxy_vc_h; - -/** - * @brief The rpc_port_proxy_vc_notify_cb handle. - */ -typedef struct rpc_port_proxy_vc_notify_cb_s *rpc_port_proxy_vc_notify_cb_h; - -/** - * @brief The rpc_port_proxy_vc_feedback_cb handle. - */ -typedef struct rpc_port_proxy_vc_feedback_cb_s *rpc_port_proxy_vc_feedback_cb_h; - -/** - * @briefs Creates a rpc_port_proxy_array_char handle. - * - * @remarks The @a h should be released using the rpc_port_proxy_array_char_destroy() - * if it's no longer needed. - * @param[out] h The rpc_port_proxy_array_char handle that is newly created - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @see rpc_port_proxy_array_char_destroy() - */ -int rpc_port_proxy_array_char_create(rpc_port_proxy_array_char_h *h); - -/** - * @brief Destroys the rpc_port_proxy_array_char handle. - * - * @param[in] h The rpc_port_proxy_array_char handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @see rpc_port_proxy_array_char_create() - */ -int rpc_port_proxy_array_char_destroy(rpc_port_proxy_array_char_h h); - -/** - * @brief Creates and returns a copy of the given rpc_port_proxy_array_char handle. - * - * @remarks A new created rpc_port_proxy_array_char should be released using - * the rpc_port_proxy_array_char_destroy() if it's no longer needed. - * @param[in] h The rpc_port_proxy_array_char handle - * @param[out] clone If successful, a new created rpc_port_proxy_array_char handle will be returned - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @see rpc_port_proxy_array_char_destroy() - */ -int rpc_port_proxy_array_char_clone(rpc_port_proxy_array_char_h h, rpc_port_proxy_array_char_h *clone); - -/** - * @brief Sets the value to the rpc_port_proxy_array_char handle. - * - * @remarks The value is internally copied and stored. - * You should release it if it's allocaed when it's no longer needed, - * @param[in] h The rpc_port_proxy_array_char handle - * @param[in] value The array value - * @param[in] size The size of the array - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @see rpc_port_proxy_array_char_get() - */ -int rpc_port_proxy_array_char_set(rpc_port_proxy_array_char_h h, char *value, int size); - -/** - * @brief Gets the value from the rpc_port_proxy_array_char handle. - * - * @remarks A new created value should be released if it's no longer needed. - * @param[in] h The rpc_port_proxy_array_char handle - * @param[out] value The array value - * @param[out] size The size of the array - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @see rpc_port_proxy_array_char_set() - */ -int rpc_port_proxy_array_char_get(rpc_port_proxy_array_char_h h, char **value, int *size); - -/** - * @brief Called when the event is received. - * - * @param[in] user_data The user data passed from the callback registration function - * @param[in] ... - * - * @see rpc_port_proxy_vc_notify_cb_create() - */ -typedef void (*rpc_port_proxy_vc_notify_cb_cb)(void *user_data, int pid, bundle *msg); - -/** - * @brief Creates a rpc_port_proxy_vc_notify_cb handle. - * - * @param[out] h The rpc_port_proxy_vc_notify_cb handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memorya - * @see rpc_port_proxy_vc_notify_cb_destroy() - * @see rpc_port_proxy_vc_notify_cb_dispose() - * @see rpc_port_proxy_vc_notify_cb_set_callback() - * @see rpc_port_proxy_vc_notify_cb_set_once() - */ -int rpc_port_proxy_vc_notify_cb_create(rpc_port_proxy_vc_notify_cb_h *h); - -/** - * @brief Destroys the rpc_port_proxy_vc_notify_cb handle. - * - * @param[in] h The rpc_port_proxy_vc_notify_cb handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @see rpc_port_proxy_vc_notify_cb_create() - */ -int rpc_port_proxy_vc_notify_cb_destroy(rpc_port_proxy_vc_notify_cb_h h); - -/** - * @brief Creates and returns a copy of the given rpc_port_proxy_vc_notify_cb handle. - * - * @remarks A new created rpc_port_proxy_vc_notify_cb should be released using - * the rpc_port_proxy_vc_notify_cb_destroy() if it's no longer needed. - * @param[in] h The rpc_port_proxy_vc_notify_cb handle - * @param[out] clone If successful, a new created rpc_port_proxy_vc_notify_cb handle will be returned - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @see rpc_port_proxy_vc_notify_cb_destroy() - */ -int rpc_port_proxy_vc_notify_cb_clone(rpc_port_proxy_vc_notify_cb_h h, rpc_port_proxy_vc_notify_cb_h *clone); - -/** - * @brief Sets the callback function to the rpc_port_proxy_vc_notify_cb handle. - * - * @param[in] h The rpc_port_proxy_vc_notify_cb handle - * @param[in] callback The callback function - * @param[in] user_data The user data to be passed to the callback function - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - */ -int rpc_port_proxy_vc_notify_cb_set_callback(rpc_port_proxy_vc_notify_cb_h h, rpc_port_proxy_vc_notify_cb_cb callback, void *user_data); - -/** - * @brief Set the once flag to the rpc_port_proxy_vc_notify_cb handle. - * @details If the once flag is 'true', the delegate handle will be deleted after invocation. - * If the @a h handle is not used using the method, the handle should be released using - * the rpc_port_proxy_vc_notify_cb_destroy() when it's no longer needed. - * If you don't want the delegate callback function to be called after it's used using the method, - * you should release the handle using the rpc_port_proxy_vc_notify_cb_dispose(). - * - * @param[in] h The rpc_port_proxy_vc_notify_cb handle - * @param[in] once The flag if it's true, the delegate will be deleted after invocation - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - */ -int rpc_port_proxy_vc_notify_cb_set_once(rpc_port_proxy_vc_notify_cb_h h, bool once); - -/** - * @brief Gets the ID of the rpc_port_proxy_vc_notify_cb handle. - * - * @param[in] h The rpc_port_proxy_vc_notify_cb handle - * @param[out] id The ID - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - */ -int rpc_port_proxy_vc_notify_cb_get_id(rpc_port_proxy_vc_notify_cb_h h, int *id); - -/** - * @brief Gets the sequence ID of the rpc_port_proxy_vc_notify_cb handle. - * - * @param[in] h The rpc_port_proxy_vc_notify_cb handle - * @param[out] seq_id The Sequence ID - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - */ -int rpc_port_proxy_vc_notify_cb_get_seq_id(rpc_port_proxy_vc_notify_cb_h h, int *seq_id); - -/** - * @brief Checks whether the delegate is for one-time or not. - * - * @param[in] h The rpc_port_proxy_vc_notify_cb handle - * @param[out] once The flag, it's true, the handle is for one-time - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - */ -int rpc_port_proxy_vc_notify_cb_is_once(rpc_port_proxy_vc_notify_cb_h h, bool *once); - -/** - * @brief Gets the tag from the rpc_port_proxy_vc_notify_cb handle. - * - * @remarks The @a tag should be released using free(). - * @param[in] h The rpc_port_proxy_vc_notify_cb handle - * @param[out] tag The tag - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - */ -int rpc_port_proxy_vc_notify_cb_get_tag(rpc_port_proxy_vc_notify_cb_h h, char **tag); - -/** - * @brief Disposes the rpc_port_proxy_vc_notify_cb handle from the rpc_port_proxy_vc handle. - * - * @param[in] proxy The rpc_port_proxy_vc handle - * @param[in] h The rpc_port_proxy_vc_notify_cb handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @see rpc_port_proxy_vc_notify_cb_create() - */ -int rpc_port_proxy_vc_notify_cb_dispose(rpc_port_proxy_vc_h proxy, rpc_port_proxy_vc_notify_cb_h h); - -/** - * @brief Called when the event is received. - * - * @param[in] user_data The user data passed from the callback registration function - * @param[in] ... - * - * @see rpc_port_proxy_vc_feedback_cb_create() - */ -typedef void (*rpc_port_proxy_vc_feedback_cb_cb)(void *user_data, int utt_id, int event, rpc_port_proxy_array_char_h pcm_data, int len); - -/** - * @brief Creates a rpc_port_proxy_vc_feedback_cb handle. - * - * @param[out] h The rpc_port_proxy_vc_feedback_cb handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memorya - * @see rpc_port_proxy_vc_feedback_cb_destroy() - * @see rpc_port_proxy_vc_feedback_cb_dispose() - * @see rpc_port_proxy_vc_feedback_cb_set_callback() - * @see rpc_port_proxy_vc_feedback_cb_set_once() - */ -int rpc_port_proxy_vc_feedback_cb_create(rpc_port_proxy_vc_feedback_cb_h *h); - -/** - * @brief Destroys the rpc_port_proxy_vc_feedback_cb handle. - * - * @param[in] h The rpc_port_proxy_vc_feedback_cb handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @see rpc_port_proxy_vc_feedback_cb_create() - */ -int rpc_port_proxy_vc_feedback_cb_destroy(rpc_port_proxy_vc_feedback_cb_h h); - -/** - * @brief Creates and returns a copy of the given rpc_port_proxy_vc_feedback_cb handle. - * - * @remarks A new created rpc_port_proxy_vc_feedback_cb should be released using - * the rpc_port_proxy_vc_feedback_cb_destroy() if it's no longer needed. - * @param[in] h The rpc_port_proxy_vc_feedback_cb handle - * @param[out] clone If successful, a new created rpc_port_proxy_vc_feedback_cb handle will be returned - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @see rpc_port_proxy_vc_feedback_cb_destroy() - */ -int rpc_port_proxy_vc_feedback_cb_clone(rpc_port_proxy_vc_feedback_cb_h h, rpc_port_proxy_vc_feedback_cb_h *clone); - -/** - * @brief Sets the callback function to the rpc_port_proxy_vc_feedback_cb handle. - * - * @param[in] h The rpc_port_proxy_vc_feedback_cb handle - * @param[in] callback The callback function - * @param[in] user_data The user data to be passed to the callback function - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - */ -int rpc_port_proxy_vc_feedback_cb_set_callback(rpc_port_proxy_vc_feedback_cb_h h, rpc_port_proxy_vc_feedback_cb_cb callback, void *user_data); - -/** - * @brief Set the once flag to the rpc_port_proxy_vc_feedback_cb handle. - * @details If the once flag is 'true', the delegate handle will be deleted after invocation. - * If the @a h handle is not used using the method, the handle should be released using - * the rpc_port_proxy_vc_feedback_cb_destroy() when it's no longer needed. - * If you don't want the delegate callback function to be called after it's used using the method, - * you should release the handle using the rpc_port_proxy_vc_feedback_cb_dispose(). - * - * @param[in] h The rpc_port_proxy_vc_feedback_cb handle - * @param[in] once The flag if it's true, the delegate will be deleted after invocation - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - */ -int rpc_port_proxy_vc_feedback_cb_set_once(rpc_port_proxy_vc_feedback_cb_h h, bool once); - -/** - * @brief Gets the ID of the rpc_port_proxy_vc_feedback_cb handle. - * - * @param[in] h The rpc_port_proxy_vc_feedback_cb handle - * @param[out] id The ID - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - */ -int rpc_port_proxy_vc_feedback_cb_get_id(rpc_port_proxy_vc_feedback_cb_h h, int *id); - -/** - * @brief Gets the sequence ID of the rpc_port_proxy_vc_feedback_cb handle. - * - * @param[in] h The rpc_port_proxy_vc_feedback_cb handle - * @param[out] seq_id The Sequence ID - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - */ -int rpc_port_proxy_vc_feedback_cb_get_seq_id(rpc_port_proxy_vc_feedback_cb_h h, int *seq_id); - -/** - * @brief Checks whether the delegate is for one-time or not. - * - * @param[in] h The rpc_port_proxy_vc_feedback_cb handle - * @param[out] once The flag, it's true, the handle is for one-time - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - */ -int rpc_port_proxy_vc_feedback_cb_is_once(rpc_port_proxy_vc_feedback_cb_h h, bool *once); - -/** - * @brief Gets the tag from the rpc_port_proxy_vc_feedback_cb handle. - * - * @remarks The @a tag should be released using free(). - * @param[in] h The rpc_port_proxy_vc_feedback_cb handle - * @param[out] tag The tag - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - */ -int rpc_port_proxy_vc_feedback_cb_get_tag(rpc_port_proxy_vc_feedback_cb_h h, char **tag); - -/** - * @brief Disposes the rpc_port_proxy_vc_feedback_cb handle from the rpc_port_proxy_vc handle. - * - * @param[in] proxy The rpc_port_proxy_vc handle - * @param[in] h The rpc_port_proxy_vc_feedback_cb handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @see rpc_port_proxy_vc_feedback_cb_create() - */ -int rpc_port_proxy_vc_feedback_cb_dispose(rpc_port_proxy_vc_h proxy, rpc_port_proxy_vc_feedback_cb_h h); - -/** - * @brief Called when the proxy is connected. - * @details The callback function is called when the proxy is connected to the stub. - * - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] user_data The user data passed from the registeration function - * @see #rpc_port_proxy_vc_callback_s - */ -typedef void (*rpc_port_proxy_vc_connected_cb)(rpc_port_proxy_vc_h h, void *user_data); - -/** - * @brief Called when the proxy is disconnected. - * @details The callback function is called when the proxy is disconnected from the stub. - * - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] user_data The user data passed from the registeration function - * @see #rpc_port_proxy_vc_callback_s - */ -typedef void (*rpc_port_proxy_vc_disconnected_cb)(rpc_port_proxy_vc_h h, void *user_data); - -/** - * @brief Called when the proxy is rejected. - * @details The callback function is called when the proxy is rejected to connect to the stub. - * - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] user_data The user data passed from the registeration function - * @see #rpc_port_proxy_vc_callback_s - */ -typedef void (*rpc_port_proxy_vc_rejected_cb)(rpc_port_proxy_vc_h h, void *user_data); - -/** - * @brief The structure type containing the set of callback functions for handling proxy events. - * @details It is one of the input parameters of the rpc_port_proxy_vc_create() function. - * - * @see rpc_port_proxy_vc_connected_cb - * @see rpc_port_proxy_vc_disconnected_cb - * @see rpc_port_proxy_vc_rejected_cb - */ -typedef struct { - rpc_port_proxy_vc_connected_cb connected; /**< This callback function is called when the proxy is connected to the stub. */ - rpc_port_proxy_vc_disconnected_cb disconnected; /**< This callback function is called when the proxy is disconnected from the stub. */ - rpc_port_proxy_vc_rejected_cb rejected; /**< This callback function is called when the proxy is rejected to connect to the stub. */ -} rpc_port_proxy_vc_callback_s; - -/** - * @brief Creates a rpc_port_proxy_vc handle. - * @remarks The @a h handle should be released using - * the rpc_port_proxy_vc_destroy() if it's no longer needed. - * - * @param[in] stub_appid The application ID of the stub - * @param[in] callback The set of callback functions to handle proxy events - * @param[in] user_data The user data to be passed to the callback function - * @param[out] h The rpc_port_proxy_vc handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @see rpc_port_proxy_vc_destroy() - * @see #rpc_port_proxy_vc_callback_s - */ -int rpc_port_proxy_vc_create(const char *stub_appid, rpc_port_proxy_vc_callback_s *callback, void *user_data, rpc_port_proxy_vc_h *h); - -/** - * @brief Destroys the rpc_port_proxy_vc handle. - * - * @param[in] h The rpc_port_proxy_vc handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @see rpc_port_proxy_vc_create() - */ -int rpc_port_proxy_vc_destroy(rpc_port_proxy_vc_h h); - -/** - * @brief Connects to the stub. - * - * @param[in] h The rpc_port_proxy_vc handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_IO_ERROR I/O error - * @retval #RPC_PORT_ERROR_PERMISSION_DENIED Permission denied - */ -int rpc_port_proxy_vc_connect(rpc_port_proxy_vc_h h); - -/** - * @brief Connects to the stub synchronously. - * - * @param[in] h The rpc_port_proxy_vc handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_IO_ERROR I/O error - * @retval #RPC_PORT_ERROR_PERMISSION_DENIED Permission denied - */ -int rpc_port_proxy_vc_connect_sync(rpc_port_proxy_vc_h h); - -/** - * @brief Disconnects from the stub. - * - * @param[in] h The rpc_port_proxy_vc handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - */ -int rpc_port_proxy_vc_disconnect(rpc_port_proxy_vc_h h); - -/** - * @brief Calls the register_notify_cb() method. - * @details The return value and args are decided by the interface declaration. - * You can get the result using get_last_result(). - * Before returning the function, the function sets the result using set_last_result(). - * @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section. - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] ... - * @exception #RPC_PORT_ERROR_NONE Successful - * @exception #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @exception #RPC_PORT_ERROR_IO_ERROR I/O error - */ -void rpc_port_proxy_vc_invoke_register_notify_cb(rpc_port_proxy_vc_h h, int pid, rpc_port_proxy_vc_notify_cb_h callback); - -/** - * @brief Calls the register_notify_cb_sync() method. - * @details The return value and args are decided by the interface declaration. - * You can get the result using get_last_result(). - * Before returning the function, the function sets the result using set_last_result(). - * @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section. - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] ... - * @exception #RPC_PORT_ERROR_NONE Successful - * @exception #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @exception #RPC_PORT_ERROR_IO_ERROR I/O error - */ -int rpc_port_proxy_vc_invoke_register_notify_cb_sync(rpc_port_proxy_vc_h h, int pid, rpc_port_proxy_vc_notify_cb_h callback); - -/** - * @brief Calls the register_feedback_cb() method. - * @details The return value and args are decided by the interface declaration. - * You can get the result using get_last_result(). - * Before returning the function, the function sets the result using set_last_result(). - * @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section. - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] ... - * @exception #RPC_PORT_ERROR_NONE Successful - * @exception #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @exception #RPC_PORT_ERROR_IO_ERROR I/O error - */ -void rpc_port_proxy_vc_invoke_register_feedback_cb(rpc_port_proxy_vc_h h, int pid, rpc_port_proxy_vc_feedback_cb_h callback); - -/** - * @brief Calls the register_feedback_cb_sync() method. - * @details The return value and args are decided by the interface declaration. - * You can get the result using get_last_result(). - * Before returning the function, the function sets the result using set_last_result(). - * @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section. - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] ... - * @exception #RPC_PORT_ERROR_NONE Successful - * @exception #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @exception #RPC_PORT_ERROR_IO_ERROR I/O error - */ -int rpc_port_proxy_vc_invoke_register_feedback_cb_sync(rpc_port_proxy_vc_h h, int pid, rpc_port_proxy_vc_feedback_cb_h callback); - -/** - * @brief Calls the initialize() method. - * @details The return value and args are decided by the interface declaration. - * You can get the result using get_last_result(). - * Before returning the function, the function sets the result using set_last_result(). - * @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section. - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] ... - * @exception #RPC_PORT_ERROR_NONE Successful - * @exception #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @exception #RPC_PORT_ERROR_IO_ERROR I/O error - */ -int rpc_port_proxy_vc_invoke_initialize(rpc_port_proxy_vc_h h, int pid, int *mgr_pid, int *service_state, int *daemon_pid); - -/** - * @brief Calls the finalize() method. - * @details The return value and args are decided by the interface declaration. - * You can get the result using get_last_result(). - * Before returning the function, the function sets the result using set_last_result(). - * @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section. - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] ... - * @exception #RPC_PORT_ERROR_NONE Successful - * @exception #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @exception #RPC_PORT_ERROR_IO_ERROR I/O error - */ -int rpc_port_proxy_vc_invoke_finalize(rpc_port_proxy_vc_h h, int pid); - -/** - * @brief Calls the set_command() method. - * @details The return value and args are decided by the interface declaration. - * You can get the result using get_last_result(). - * Before returning the function, the function sets the result using set_last_result(). - * @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section. - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] ... - * @exception #RPC_PORT_ERROR_NONE Successful - * @exception #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @exception #RPC_PORT_ERROR_IO_ERROR I/O error - */ -int rpc_port_proxy_vc_invoke_set_command(rpc_port_proxy_vc_h h, int pid, int cmd_type); - -/** - * @brief Calls the unset_command() method. - * @details The return value and args are decided by the interface declaration. - * You can get the result using get_last_result(). - * Before returning the function, the function sets the result using set_last_result(). - * @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section. - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] ... - * @exception #RPC_PORT_ERROR_NONE Successful - * @exception #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @exception #RPC_PORT_ERROR_IO_ERROR I/O error - */ -int rpc_port_proxy_vc_invoke_unset_command(rpc_port_proxy_vc_h h, int pid, int cmd_type); - -/** - * @brief Calls the set_foreground() method. - * @details The return value and args are decided by the interface declaration. - * You can get the result using get_last_result(). - * Before returning the function, the function sets the result using set_last_result(). - * @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section. - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] ... - * @exception #RPC_PORT_ERROR_NONE Successful - * @exception #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @exception #RPC_PORT_ERROR_IO_ERROR I/O error - */ -int rpc_port_proxy_vc_invoke_set_foreground(rpc_port_proxy_vc_h h, int pid, bool value); - -/** - * @brief Calls the set_server_dialog() method. - * @details The return value and args are decided by the interface declaration. - * You can get the result using get_last_result(). - * Before returning the function, the function sets the result using set_last_result(). - * @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section. - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] ... - * @exception #RPC_PORT_ERROR_NONE Successful - * @exception #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @exception #RPC_PORT_ERROR_IO_ERROR I/O error - */ -int rpc_port_proxy_vc_invoke_set_server_dialog(rpc_port_proxy_vc_h h, int pid, const char *app_id, const char *credential); - -/** - * @brief Calls the request_dialog() method. - * @details The return value and args are decided by the interface declaration. - * You can get the result using get_last_result(). - * Before returning the function, the function sets the result using set_last_result(). - * @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section. - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] ... - * @exception #RPC_PORT_ERROR_NONE Successful - * @exception #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @exception #RPC_PORT_ERROR_IO_ERROR I/O error - */ -int rpc_port_proxy_vc_invoke_request_dialog(rpc_port_proxy_vc_h h, int pid, const char *disp_text, const char *utt_text, bool continuous); - -/** - * @brief Calls the is_system_command_valid() method. - * @details The return value and args are decided by the interface declaration. - * You can get the result using get_last_result(). - * Before returning the function, the function sets the result using set_last_result(). - * @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section. - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] ... - * @exception #RPC_PORT_ERROR_NONE Successful - * @exception #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @exception #RPC_PORT_ERROR_IO_ERROR I/O error - */ -int rpc_port_proxy_vc_invoke_is_system_command_valid(rpc_port_proxy_vc_h h, int pid, bool *is_sys_cmd_valid); - -/** - * @brief Calls the auth_enable() method. - * @details The return value and args are decided by the interface declaration. - * You can get the result using get_last_result(). - * Before returning the function, the function sets the result using set_last_result(). - * @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section. - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] ... - * @exception #RPC_PORT_ERROR_NONE Successful - * @exception #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @exception #RPC_PORT_ERROR_IO_ERROR I/O error - */ -int rpc_port_proxy_vc_invoke_auth_enable(rpc_port_proxy_vc_h h, int pid, int mgr_pid); - -/** - * @brief Calls the auth_disable() method. - * @details The return value and args are decided by the interface declaration. - * You can get the result using get_last_result(). - * Before returning the function, the function sets the result using set_last_result(). - * @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section. - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] ... - * @exception #RPC_PORT_ERROR_NONE Successful - * @exception #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @exception #RPC_PORT_ERROR_IO_ERROR I/O error - */ -int rpc_port_proxy_vc_invoke_auth_disable(rpc_port_proxy_vc_h h, int pid, int mgr_pid); - -/** - * @brief Calls the auth_start() method. - * @details The return value and args are decided by the interface declaration. - * You can get the result using get_last_result(). - * Before returning the function, the function sets the result using set_last_result(). - * @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section. - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] ... - * @exception #RPC_PORT_ERROR_NONE Successful - * @exception #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @exception #RPC_PORT_ERROR_IO_ERROR I/O error - */ -int rpc_port_proxy_vc_invoke_auth_start(rpc_port_proxy_vc_h h, int pid, int mgr_pid); - -/** - * @brief Calls the auth_stop() method. - * @details The return value and args are decided by the interface declaration. - * You can get the result using get_last_result(). - * Before returning the function, the function sets the result using set_last_result(). - * @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section. - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] ... - * @exception #RPC_PORT_ERROR_NONE Successful - * @exception #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @exception #RPC_PORT_ERROR_IO_ERROR I/O error - */ -int rpc_port_proxy_vc_invoke_auth_stop(rpc_port_proxy_vc_h h, int pid, int mgr_pid); - -/** - * @brief Calls the auth_cancel() method. - * @details The return value and args are decided by the interface declaration. - * You can get the result using get_last_result(). - * Before returning the function, the function sets the result using set_last_result(). - * @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section. - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] ... - * @exception #RPC_PORT_ERROR_NONE Successful - * @exception #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @exception #RPC_PORT_ERROR_IO_ERROR I/O error - */ -int rpc_port_proxy_vc_invoke_auth_cancel(rpc_port_proxy_vc_h h, int pid, int mgr_pid); - -/** - * @brief Calls the request_tts() method. - * @details The return value and args are decided by the interface declaration. - * You can get the result using get_last_result(). - * Before returning the function, the function sets the result using set_last_result(). - * @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section. - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] ... - * @exception #RPC_PORT_ERROR_NONE Successful - * @exception #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @exception #RPC_PORT_ERROR_IO_ERROR I/O error - */ -int rpc_port_proxy_vc_invoke_request_tts(rpc_port_proxy_vc_h h, int pid, const char *text, const char *lang, bool to_vcm, int *utt_id); - -/** - * @brief Calls the cancel_tts() method. - * @details The return value and args are decided by the interface declaration. - * You can get the result using get_last_result(). - * Before returning the function, the function sets the result using set_last_result(). - * @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section. - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] ... - * @exception #RPC_PORT_ERROR_NONE Successful - * @exception #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @exception #RPC_PORT_ERROR_IO_ERROR I/O error - */ -int rpc_port_proxy_vc_invoke_cancel_tts(rpc_port_proxy_vc_h h, int pid, int utt_id); - -/** - * @brief Calls the get_tts_audio_format() method. - * @details The return value and args are decided by the interface declaration. - * You can get the result using get_last_result(). - * Before returning the function, the function sets the result using set_last_result(). - * @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section. - * @param[in] h The rpc_port_proxy_vc handle - * @param[in] ... - * @exception #RPC_PORT_ERROR_NONE Successful - * @exception #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @exception #RPC_PORT_ERROR_IO_ERROR I/O error - */ -int rpc_port_proxy_vc_invoke_get_tts_audio_format(rpc_port_proxy_vc_h h, int pid, int *rate, int *channel, int *audio_type); - -#ifdef __cplusplus -} -#endif diff --git a/client/vc_tidl.c b/client/vc_tidl.c index e937f0f..77ddc1d 100755 --- a/client/vc_tidl.c +++ b/client/vc_tidl.c @@ -28,9 +28,9 @@ typedef struct { bool register_notify_callback_invoked; bool register_feedback_callback_invoked; - rpc_port_proxy_vc_h rpc_h; - rpc_port_proxy_vc_notify_cb_h notify_cb_h; - rpc_port_proxy_vc_feedback_cb_h feedback_cb_h; + rpc_port_proxy_vc_proxy_vc_h rpc_h; + rpc_port_proxy_vc_proxy_vc_notify_cb_h notify_cb_h; + rpc_port_proxy_vc_proxy_vc_feedback_cb_h feedback_cb_h; char* engine_appid; } vc_tidl_info_s; @@ -83,7 +83,7 @@ static char* __get_engine_appid(void) return appid; } -static void __on_connected(rpc_port_proxy_vc_h h, void* user_data) +static void __on_connected(rpc_port_proxy_vc_proxy_vc_h h, void* user_data) { unsigned int pid = (uintptr_t)user_data; @@ -97,7 +97,7 @@ static void __on_connected(rpc_port_proxy_vc_h h, void* user_data) SLOG(LOG_INFO, TAG_VCC, "[INFO] Connected to server"); } -static void __on_disconnected(rpc_port_proxy_vc_h h, void* user_data) +static void __on_disconnected(rpc_port_proxy_vc_proxy_vc_h h, void* user_data) { unsigned int pid = (uintptr_t)user_data; @@ -112,7 +112,7 @@ static void __on_disconnected(rpc_port_proxy_vc_h h, void* user_data) SLOG(LOG_INFO, TAG_VCC, "[INFO] Disconnected to server"); } -static void __on_rejected(rpc_port_proxy_vc_h h, void* user_data) +static void __on_rejected(rpc_port_proxy_vc_proxy_vc_h h, void* user_data) { unsigned int pid = (uintptr_t)user_data; @@ -126,17 +126,17 @@ static void __on_rejected(rpc_port_proxy_vc_h h, void* user_data) } -static rpc_port_proxy_vc_h __create_rpc_port(int pid, const char* engine_app_id) +static rpc_port_proxy_vc_proxy_vc_h __create_rpc_port(int pid, const char* engine_app_id) { - rpc_port_proxy_vc_callback_s rpc_callback = { + rpc_port_proxy_vc_proxy_vc_callback_s rpc_callback = { .connected = __on_connected, .disconnected = __on_disconnected, .rejected = __on_rejected }; - rpc_port_proxy_vc_h handle = NULL; + rpc_port_proxy_vc_proxy_vc_h handle = NULL; uintptr_t ptr_pid = pid; - if (0 != rpc_port_proxy_vc_create(engine_app_id, &rpc_callback, (void*)ptr_pid, &handle)) { + if (0 != rpc_port_proxy_vc_proxy_vc_create(engine_app_id, &rpc_callback, (void*)ptr_pid, &handle)) { return NULL; } @@ -146,11 +146,11 @@ static rpc_port_proxy_vc_h __create_rpc_port(int pid, const char* engine_app_id) static void __request_tidl_connect(vc_tidl_info_s* info) { if (info->connection_requesting) { - SLOG(LOG_INFO, TAG_VCC, "[TIDL] Already connection is requested. Skip to call rpc_port_proxy_vc_connect()."); + SLOG(LOG_INFO, TAG_VCC, "[TIDL] Already connection is requested. Skip to call rpc_port_proxy_vc_proxy_vc_connect()."); return ; } - int ret = rpc_port_proxy_vc_connect(info->rpc_h); + int ret = rpc_port_proxy_vc_proxy_vc_connect(info->rpc_h); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request connection to stub. ret(%d)", ret); return ; @@ -226,7 +226,7 @@ static void __notify_cb(void* user_data, int pid, bundle* msg) } } -void __feedback_cb(void *user_data, int utt_id, int event, rpc_port_proxy_array_char_h pcm_data, int len) +void __feedback_cb(void *user_data, int utt_id, int event, rpc_port_proxy_vc_proxy_array_char_h pcm_data, int len) { // corresponding to listener_event_callback (only for tts_streaming) SLOG(LOG_DEBUG, TAG_VCC, "__feedback_cb is invoked utt_id(%d) event(%d)", utt_id, event); @@ -243,16 +243,16 @@ void __feedback_cb(void *user_data, int utt_id, int event, rpc_port_proxy_array_ static int __create_notify_callback_handle(vc_tidl_info_s* info) { if (NULL != info->notify_cb_h) { - rpc_port_proxy_vc_notify_cb_dispose(info->rpc_h, info->notify_cb_h); + rpc_port_proxy_vc_proxy_vc_notify_cb_dispose(info->rpc_h, info->notify_cb_h); info->notify_cb_h = NULL; } - if (RPC_PORT_ERROR_NONE != rpc_port_proxy_vc_notify_cb_create(&info->notify_cb_h)) { + if (RPC_PORT_ERROR_NONE != rpc_port_proxy_vc_proxy_vc_notify_cb_create(&info->notify_cb_h)) { return VC_ERROR_OUT_OF_MEMORY; } - rpc_port_proxy_vc_notify_cb_set_callback(info->notify_cb_h, __notify_cb, NULL); - rpc_port_proxy_vc_notify_cb_set_once(info->notify_cb_h, false); + rpc_port_proxy_vc_proxy_vc_notify_cb_set_callback(info->notify_cb_h, __notify_cb, NULL); + rpc_port_proxy_vc_proxy_vc_notify_cb_set_once(info->notify_cb_h, false); return VC_ERROR_NONE; } @@ -260,16 +260,16 @@ static int __create_notify_callback_handle(vc_tidl_info_s* info) static int __create_feedback_callback_handle(vc_tidl_info_s* info) { if (NULL != info) { - rpc_port_proxy_vc_feedback_cb_dispose(info->rpc_h, info->feedback_cb_h); + rpc_port_proxy_vc_proxy_vc_feedback_cb_dispose(info->rpc_h, info->feedback_cb_h); info->feedback_cb_h = NULL; } - if (RPC_PORT_ERROR_NONE != rpc_port_proxy_vc_feedback_cb_create(&info->feedback_cb_h)) { + if (RPC_PORT_ERROR_NONE != rpc_port_proxy_vc_proxy_vc_feedback_cb_create(&info->feedback_cb_h)) { return VC_ERROR_OUT_OF_MEMORY; } - rpc_port_proxy_vc_feedback_cb_set_callback(info->feedback_cb_h, __feedback_cb, NULL); - rpc_port_proxy_vc_feedback_cb_set_once(info->feedback_cb_h, false); + rpc_port_proxy_vc_proxy_vc_feedback_cb_set_callback(info->feedback_cb_h, __feedback_cb, NULL); + rpc_port_proxy_vc_proxy_vc_feedback_cb_set_once(info->feedback_cb_h, false); return VC_ERROR_NONE; } @@ -287,7 +287,7 @@ static int __invoke_register_notify_callback(int pid, vc_tidl_info_s* info) return VC_ERROR_OPERATION_FAILED; } - rpc_port_proxy_vc_invoke_register_notify_cb(info->rpc_h, pid, info->notify_cb_h); + rpc_port_proxy_vc_proxy_vc_invoke_register_notify_cb(info->rpc_h, pid, info->notify_cb_h); info->register_notify_callback_invoked = true; return VC_ERROR_NONE; } @@ -305,7 +305,7 @@ static int __invoke_register_feedback_callback(int pid, vc_tidl_info_s* info) return VC_ERROR_OPERATION_FAILED; } - rpc_port_proxy_vc_invoke_register_feedback_cb(info->rpc_h, pid, info->feedback_cb_h); + rpc_port_proxy_vc_proxy_vc_invoke_register_feedback_cb(info->rpc_h, pid, info->feedback_cb_h); info->register_feedback_callback_invoked = true; return VC_ERROR_NONE; } @@ -346,7 +346,7 @@ int vc_tidl_close_connection() vc_tidl_info_s* info = __get_tidl_info_s(pid); RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info"); - if (0 != rpc_port_proxy_vc_destroy(info->rpc_h)) { + if (0 != rpc_port_proxy_vc_proxy_vc_destroy(info->rpc_h)) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to disconnect"); return VC_ERROR_OPERATION_FAILED; } @@ -402,7 +402,7 @@ int vc_tidl_request_initialize(int pid, int* mgr_pid, int* service_state, int* d RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info"); RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected"); - int ret = rpc_port_proxy_vc_invoke_initialize(info->rpc_h, pid, mgr_pid, service_state, daemon_pid); + int ret = rpc_port_proxy_vc_proxy_vc_invoke_initialize(info->rpc_h, pid, mgr_pid, service_state, daemon_pid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc initialize : Fail to invoke message"); return __covert_unhandled_error(ret); @@ -421,7 +421,7 @@ int vc_tidl_request_finalize(int pid) RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info"); RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected"); - int ret = rpc_port_proxy_vc_invoke_finalize(info->rpc_h, pid); + int ret = rpc_port_proxy_vc_proxy_vc_invoke_finalize(info->rpc_h, pid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc finalize : Fail to invoke message"); return __covert_unhandled_error(ret); @@ -440,7 +440,7 @@ int vc_tidl_request_set_command(int pid, vc_cmd_type_e cmd_type) RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info"); RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected"); - int ret = rpc_port_proxy_vc_invoke_set_command(info->rpc_h, pid, cmd_type); + int ret = rpc_port_proxy_vc_proxy_vc_invoke_set_command(info->rpc_h, pid, cmd_type); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc set command : Fail to invoke message"); return __covert_unhandled_error(ret); @@ -459,7 +459,7 @@ int vc_tidl_request_unset_command(int pid, vc_cmd_type_e cmd_type) RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info"); RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected"); - int ret = rpc_port_proxy_vc_invoke_unset_command(info->rpc_h, pid, cmd_type); + int ret = rpc_port_proxy_vc_proxy_vc_invoke_unset_command(info->rpc_h, pid, cmd_type); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc unset command : Fail to invoke message"); return __covert_unhandled_error(ret); @@ -479,7 +479,7 @@ int vc_tidl_request_set_foreground(int pid, bool value) RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info"); RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected"); - int ret = rpc_port_proxy_vc_invoke_set_foreground(info->rpc_h, pid, value); + int ret = rpc_port_proxy_vc_proxy_vc_invoke_set_foreground(info->rpc_h, pid, value); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc set foreground : Fail to invoke message"); return __covert_unhandled_error(ret); @@ -498,7 +498,7 @@ int vc_tidl_request_set_server_dialog(int pid, const char* app_id, const char* c RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info"); RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected"); - int ret = rpc_port_proxy_vc_invoke_set_server_dialog(info->rpc_h, pid, app_id, credential); + int ret = rpc_port_proxy_vc_proxy_vc_invoke_set_server_dialog(info->rpc_h, pid, app_id, credential); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc set server dialog : Fail to invoke message"); return __covert_unhandled_error(ret); @@ -518,7 +518,7 @@ int vc_tidl_request_request_dialog(int pid, const char* disp_text, const char* u RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info"); RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected"); - int ret = rpc_port_proxy_vc_invoke_request_dialog(info->rpc_h, pid, disp_text, utt_text, continuous); + int ret = rpc_port_proxy_vc_proxy_vc_invoke_request_dialog(info->rpc_h, pid, disp_text, utt_text, continuous); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc request dialog : Fail to invoke message"); return __covert_unhandled_error(ret); @@ -537,7 +537,7 @@ int vc_tidl_request_is_system_command_valid(int pid, bool* is_sys_cmd_valid) RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info"); RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected"); - int ret = rpc_port_proxy_vc_invoke_is_system_command_valid(info->rpc_h, pid, is_sys_cmd_valid); + int ret = rpc_port_proxy_vc_proxy_vc_invoke_is_system_command_valid(info->rpc_h, pid, is_sys_cmd_valid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc is system command valid : Fail to invoke message"); return __covert_unhandled_error(ret); @@ -557,7 +557,7 @@ int vc_tidl_request_auth_enable(int pid, int mgr_pid) RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info"); RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected"); - int ret = rpc_port_proxy_vc_invoke_auth_enable(info->rpc_h, pid, mgr_pid); + int ret = rpc_port_proxy_vc_proxy_vc_invoke_auth_enable(info->rpc_h, pid, mgr_pid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth enable : Fail to invoke message"); return __covert_unhandled_error(ret); @@ -576,7 +576,7 @@ int vc_tidl_request_auth_disable(int pid, int mgr_pid) RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info"); RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected"); - int ret = rpc_port_proxy_vc_invoke_auth_disable(info->rpc_h, pid, mgr_pid); + int ret = rpc_port_proxy_vc_proxy_vc_invoke_auth_disable(info->rpc_h, pid, mgr_pid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth disable : Fail to invoke message"); return __covert_unhandled_error(ret); @@ -595,7 +595,7 @@ int vc_tidl_request_auth_start(int pid, int mgr_pid) RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info"); RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected"); - int ret = rpc_port_proxy_vc_invoke_auth_start(info->rpc_h, pid, mgr_pid); + int ret = rpc_port_proxy_vc_proxy_vc_invoke_auth_start(info->rpc_h, pid, mgr_pid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth start : Fail to invoke message"); return __covert_unhandled_error(ret); @@ -614,7 +614,7 @@ int vc_tidl_request_auth_stop(int pid, int mgr_pid) RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info"); RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected"); - int ret = rpc_port_proxy_vc_invoke_auth_stop(info->rpc_h, pid, mgr_pid); + int ret = rpc_port_proxy_vc_proxy_vc_invoke_auth_stop(info->rpc_h, pid, mgr_pid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth stop : Fail to invoke message"); return __covert_unhandled_error(ret); @@ -633,7 +633,7 @@ int vc_tidl_request_auth_cancel(int pid, int mgr_pid) RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info"); RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected"); - int ret = rpc_port_proxy_vc_invoke_auth_cancel(info->rpc_h, pid, mgr_pid); + int ret = rpc_port_proxy_vc_proxy_vc_invoke_auth_cancel(info->rpc_h, pid, mgr_pid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth cancel : Fail to invoke message"); return __covert_unhandled_error(ret); @@ -658,7 +658,7 @@ int vc_tidl_request_request_tts(int pid, const char* text, const char* language, return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vc_invoke_request_tts(info->rpc_h, pid, text, language, to_vcm, utt_id); + int ret = rpc_port_proxy_vc_proxy_vc_invoke_request_tts(info->rpc_h, pid, text, language, to_vcm, utt_id); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc request tts : Fail to invoke message"); return __covert_unhandled_error(ret); @@ -677,7 +677,7 @@ int vc_tidl_request_cancel_tts(int pid, int utt_id) RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info"); RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected"); - int ret = rpc_port_proxy_vc_invoke_cancel_tts(info->rpc_h, pid, utt_id); + int ret = rpc_port_proxy_vc_proxy_vc_invoke_cancel_tts(info->rpc_h, pid, utt_id); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc cancel tts : Fail to invoke message"); return __covert_unhandled_error(ret); @@ -696,7 +696,7 @@ int vc_tidl_request_get_tts_audio_format(int pid, int* rate, vc_audio_channel_e* RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, "[ERROR] Fail to get tidl info"); RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, "[ERROR] Not Connected"); - int ret = rpc_port_proxy_vc_invoke_get_tts_audio_format(info->rpc_h, pid, rate, (int*)channel, (int*)audio_type); + int ret = rpc_port_proxy_vc_proxy_vc_invoke_get_tts_audio_format(info->rpc_h, pid, rate, (int*)channel, (int*)audio_type); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc get tts audio format: Fail to invoke message"); return __covert_unhandled_error(ret); diff --git a/client/vc_widget_tidl.c b/client/vc_widget_tidl.c index 1210668..dc2b84b 100644 --- a/client/vc_widget_tidl.c +++ b/client/vc_widget_tidl.c @@ -27,8 +27,8 @@ typedef struct { 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 { @@ -43,7 +43,7 @@ static vcd_widget_tidl_info_s* g_stub_tidl_info = NULL; 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); @@ -146,7 +146,7 @@ static void __notify_cb(void *user_data, bundle *msg) } } -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; @@ -155,7 +155,7 @@ static void __on_connected(rpc_port_proxy_vc_widget_h h, void *user_data) 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; @@ -167,7 +167,7 @@ static void __on_disconnected(rpc_port_proxy_vc_widget_h h, void *user_data) __vc_widget_cb_error(VC_ERROR_SERVICE_RESET, -1, "Server Disconnected, re-launch"); } -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; @@ -176,17 +176,17 @@ static void __on_rejected(rpc_port_proxy_vc_widget_h h, void *user_data) } -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; } @@ -194,7 +194,7 @@ static rpc_port_proxy_vc_widget_h __create_rpc_port(const char* engine_app_id) 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; @@ -203,7 +203,7 @@ static void __vcd_widget_create_cb(rpc_port_stub_vcd_widget_context_h context, v 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; @@ -213,15 +213,15 @@ static void __vcd_widget_create_cb(rpc_port_stub_vcd_widget_context_h context, v 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; @@ -229,7 +229,7 @@ static void __vcd_widget_terminate_cb(rpc_port_stub_vcd_widget_context_h context 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"); @@ -253,7 +253,7 @@ static void __register_stub_callback() 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; @@ -331,7 +331,7 @@ int vc_widget_tidl_close_connection() 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; @@ -357,7 +357,7 @@ static void __request_tidl_connect() 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) { @@ -368,17 +368,17 @@ static void __request_tidl_connect() 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; } @@ -396,7 +396,7 @@ static int __invoke_register_callback() 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; } @@ -452,7 +452,7 @@ int vc_widget_tidl_request_initialize(int pid, int* service_state, int* daemon_p int temp_service_state = 0; int temp_daemon_pid = 0; - int ret = rpc_port_proxy_vc_widget_invoke_initialize(g_proxy_tidl_info->rpc_h, pid, &temp_service_state, &temp_daemon_pid); + 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) { 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); @@ -485,7 +485,7 @@ int vc_widget_tidl_request_finalize(int pid) return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vc_widget_invoke_finalize(g_proxy_tidl_info->rpc_h, pid); + 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); pthread_mutex_unlock(&g_w_init_mutex); @@ -510,7 +510,7 @@ int vc_widget_tidl_request_start_recording(int pid, bool command) return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vc_widget_invoke_start_recording(g_proxy_tidl_info->rpc_h, pid, (int)command); + 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) { SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget start recording : Fail to invoke message, error(%d)", ret); return ret; @@ -534,7 +534,7 @@ int vc_widget_tidl_set_foreground(int pid, bool value) } // TODO: Error tolerance cannot be applied because this function is asynchronous. - rpc_port_proxy_vc_widget_invoke_set_foreground(g_proxy_tidl_info->rpc_h, pid, (int)value); + rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_set_foreground(g_proxy_tidl_info->rpc_h, pid, (int)value); return VC_ERROR_NONE; } @@ -553,7 +553,7 @@ int vc_widget_tidl_request_enable_asr_result(int pid, bool enable) return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vc_widget_invoke_enable_asr_result(g_proxy_tidl_info->rpc_h, pid, (int)enable); + 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) { SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget enable asr result : Fail to invoke message, error(%d)", ret); return ret; @@ -576,7 +576,7 @@ int vc_widget_tidl_request_start(int pid, int silence) return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vc_widget_invoke_start(g_proxy_tidl_info->rpc_h, pid, silence); + 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) { SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget start : Fail to invoke message, error(%d)", ret); return ret; @@ -599,7 +599,7 @@ int vc_widget_tidl_request_stop(int pid) return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vc_widget_invoke_stop(g_proxy_tidl_info->rpc_h, pid); + 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) { SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget stop : Fail to invoke message, error(%d)", ret); return ret; @@ -622,7 +622,7 @@ int vc_widget_tidl_request_cancel(int pid) return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vc_widget_invoke_cancel(g_proxy_tidl_info->rpc_h, pid); + 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) { SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget cancel : Fail to invoke message, error(%d)", ret); return ret; diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index bbe1861..30bfc62 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -115,18 +115,18 @@ GTest for Voice Control %setup -q -n %{name}-%{version} cp %{SOURCE1001} %{SOURCE1002} . -tidlc -p -l C -i tidl/vc.tidl -o vc_proxy -tidlc -s -l C -i tidl/vc.tidl -o vcd_stub - -tidlc -p -l C -i tidl/vc_mgr.tidl -o vc_mgr_proxy -tidlc -s -l C -i tidl/vc_mgr.tidl -o vcd_mgr_stub -tidlc -s -l C -i tidl/vcd_mgr.tidl -o vc_mgr_stub -tidlc -p -l C -i tidl/vcd_mgr.tidl -o vcd_mgr_proxy - -tidlc -p -l C -i tidl/vc_widget.tidl -o vc_widget_proxy -tidlc -s -l C -i tidl/vc_widget.tidl -o vcd_widget_stub -tidlc -s -l C -i tidl/vcd_widget.tidl -o vc_widget_stub -tidlc -p -l C -i tidl/vcd_widget.tidl -o vcd_widget_proxy +tidlc -p -l C -i tidl/vc.tidl -o vc_proxy -n +tidlc -s -l C -i tidl/vc.tidl -o vcd_stub -n + +tidlc -p -l C -i tidl/vc_mgr.tidl -o vc_mgr_proxy -n +tidlc -s -l C -i tidl/vc_mgr.tidl -o vcd_mgr_stub -n +tidlc -s -l C -i tidl/vcd_mgr.tidl -o vc_mgr_stub -n +tidlc -p -l C -i tidl/vcd_mgr.tidl -o vcd_mgr_proxy -n + +tidlc -p -l C -i tidl/vc_widget.tidl -o vc_widget_proxy -n +tidlc -s -l C -i tidl/vc_widget.tidl -o vcd_widget_stub -n +tidlc -s -l C -i tidl/vcd_widget.tidl -o vc_widget_stub -n +tidlc -p -l C -i tidl/vcd_widget.tidl -o vcd_widget_proxy -n mv vc_* client mv vcd_* server diff --git a/server/vcd_client_data.c b/server/vcd_client_data.c index 8e33a1f..4a05082 100644 --- a/server/vcd_client_data.c +++ b/server/vcd_client_data.c @@ -296,7 +296,7 @@ int vcd_client_manager_create_tidl_info(int pid) return VCD_ERROR_NONE; } -int vcd_client_manager_set_tidl_notify_cb(rpc_port_stub_vc_mgr_notify_cb_h callback, void* user_data) +int vcd_client_manager_set_tidl_notify_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_notify_cb_h callback, void* user_data) { if (NULL == g_mgr_tidl_info) { SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] There is no manager tidl info"); @@ -304,7 +304,7 @@ int vcd_client_manager_set_tidl_notify_cb(rpc_port_stub_vc_mgr_notify_cb_h callb } int ret = -1; - ret = rpc_port_stub_vc_mgr_notify_cb_clone(callback, &(g_mgr_tidl_info->notify_cb)); + ret = rpc_port_stub_vcd_mgr_stub_vc_mgr_notify_cb_clone(callback, &(g_mgr_tidl_info->notify_cb)); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to clone notify callback. ret(%d)", ret); } else { @@ -323,7 +323,7 @@ int vcd_client_manager_unset_tidl_notify_cb() } int ret = -1; - ret = rpc_port_stub_vc_mgr_notify_cb_destroy(g_mgr_tidl_info->notify_cb); + ret = rpc_port_stub_vcd_mgr_stub_vc_mgr_notify_cb_destroy(g_mgr_tidl_info->notify_cb); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to destroy notify callback. ret(%d)", ret); } else { @@ -335,7 +335,7 @@ int vcd_client_manager_unset_tidl_notify_cb() return VCD_ERROR_NONE; } -int vcd_client_manager_set_tidl_send_buffer_cb(rpc_port_stub_vc_mgr_send_buffer_cb_h callback, void* user_data) +int vcd_client_manager_set_tidl_send_buffer_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_send_buffer_cb_h callback, void* user_data) { if (NULL == g_mgr_tidl_info) { SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] There is no manager tidl info"); @@ -343,7 +343,7 @@ int vcd_client_manager_set_tidl_send_buffer_cb(rpc_port_stub_vc_mgr_send_buffer_ } int ret = -1; - ret = rpc_port_stub_vc_mgr_send_buffer_cb_clone(callback, &(g_mgr_tidl_info->send_buffer_cb)); + ret = rpc_port_stub_vcd_mgr_stub_vc_mgr_send_buffer_cb_clone(callback, &(g_mgr_tidl_info->send_buffer_cb)); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to clone feedback callback. ret(%d)", ret); } else { @@ -362,7 +362,7 @@ int vcd_client_manager_unset_tidl_send_buffer_cb() } int ret = -1; - ret = rpc_port_stub_vc_mgr_send_buffer_cb_destroy(g_mgr_tidl_info->send_buffer_cb); + ret = rpc_port_stub_vcd_mgr_stub_vc_mgr_send_buffer_cb_destroy(g_mgr_tidl_info->send_buffer_cb); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to destroy feedback callback. ret(%d)", ret); } else { @@ -381,7 +381,7 @@ int vcd_client_manager_delete_tidl_info() return VCD_ERROR_INVALID_PARAMETER; } - if (0 != rpc_port_proxy_vcd_mgr_destroy(g_mgr_tidl_info->rpc_h)) { + if (0 != rpc_port_proxy_vcd_mgr_proxy_vcd_mgr_destroy(g_mgr_tidl_info->rpc_h)) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to destroy tidl handle"); } @@ -1323,7 +1323,7 @@ int vcd_client_add_ipc_info(int pid) return VCD_ERROR_NONE; } -int vcd_client_set_ipc_notify_cb(int pid, rpc_port_stub_vc_notify_cb_h callback, void* user_data) +int vcd_client_set_ipc_notify_cb(int pid, rpc_port_stub_vcd_stub_vc_notify_cb_h callback, void* user_data) { /*Check pid*/ client_ipc_info_s* info = NULL; @@ -1335,7 +1335,7 @@ int vcd_client_set_ipc_notify_cb(int pid, rpc_port_stub_vc_notify_cb_h callback, } int ret = -1; - ret = rpc_port_stub_vc_notify_cb_clone(callback, &(info->notify_cb)); + ret = rpc_port_stub_vcd_stub_vc_notify_cb_clone(callback, &(info->notify_cb)); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to clone notify callback. ret(%d)", ret); } else { @@ -1358,7 +1358,7 @@ int vcd_client_unset_ipc_notify_cb(int pid) } int ret = -1; - ret = rpc_port_stub_vc_notify_cb_destroy(info->notify_cb); + ret = rpc_port_stub_vcd_stub_vc_notify_cb_destroy(info->notify_cb); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to destroy notify callback. ret(%d)", ret); } else { @@ -1370,7 +1370,7 @@ int vcd_client_unset_ipc_notify_cb(int pid) return VCD_ERROR_NONE; } -int vcd_client_set_ipc_feedback_cb(int pid, rpc_port_stub_vc_feedback_cb_h callback, void* user_data) +int vcd_client_set_ipc_feedback_cb(int pid, rpc_port_stub_vcd_stub_vc_feedback_cb_h callback, void* user_data) { /*Check pid*/ client_ipc_info_s* info = NULL; @@ -1382,7 +1382,7 @@ int vcd_client_set_ipc_feedback_cb(int pid, rpc_port_stub_vc_feedback_cb_h callb } int ret = -1; - ret = rpc_port_stub_vc_feedback_cb_clone(callback, &(info->feedback_cb)); + ret = rpc_port_stub_vcd_stub_vc_feedback_cb_clone(callback, &(info->feedback_cb)); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to clone feedback callback. ret(%d)", ret); } else { @@ -1405,7 +1405,7 @@ int vcd_client_unset_ipc_feedback_cb(int pid) } int ret = -1; - ret = rpc_port_stub_vc_feedback_cb_destroy(info->feedback_cb); + ret = rpc_port_stub_vcd_stub_vc_feedback_cb_destroy(info->feedback_cb); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to destroy feedback callback. ret(%d)", ret); } else { @@ -2023,7 +2023,7 @@ int vcd_client_widget_add_tidl_info(int pid) return VCD_ERROR_NONE; } -int vcd_client_widget_set_tidl_notify_cb(int pid, rpc_port_stub_vc_widget_notify_cb_h callback, void* user_data) +int vcd_client_widget_set_tidl_notify_cb(int pid, rpc_port_stub_vcd_widget_stub_vc_widget_notify_cb_h callback, void* user_data) { /*Check pid*/ widget_tidl_info_s* info = NULL; @@ -2035,7 +2035,7 @@ int vcd_client_widget_set_tidl_notify_cb(int pid, rpc_port_stub_vc_widget_notify } int ret = -1; - ret = rpc_port_stub_vc_widget_notify_cb_clone(callback, &(info->notify_cb)); + ret = rpc_port_stub_vcd_widget_stub_vc_widget_notify_cb_clone(callback, &(info->notify_cb)); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to clone notify callback. ret(%d)", ret); } else { @@ -2058,7 +2058,7 @@ int vcd_client_widget_unset_tidl_notify_cb(int pid) } int ret = -1; - ret = rpc_port_stub_vc_widget_notify_cb_destroy(info->notify_cb); + ret = rpc_port_stub_vcd_widget_stub_vc_widget_notify_cb_destroy(info->notify_cb); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to destroy notify callback. ret(%d)", ret); } else { diff --git a/server/vcd_client_data.h b/server/vcd_client_data.h index 789f329..2071bd1 100644 --- a/server/vcd_client_data.h +++ b/server/vcd_client_data.h @@ -72,35 +72,35 @@ typedef struct { typedef struct { int pid; - rpc_port_stub_vc_notify_cb_h notify_cb; + rpc_port_stub_vcd_stub_vc_notify_cb_h notify_cb; void* notify_cb_user_data; - rpc_port_stub_vc_feedback_cb_h feedback_cb; + rpc_port_stub_vcd_stub_vc_feedback_cb_h feedback_cb; void* feedback_cb_user_data; } client_ipc_info_s; typedef struct { int pid; - rpc_port_stub_vc_mgr_notify_cb_h notify_cb; + rpc_port_stub_vcd_mgr_stub_vc_mgr_notify_cb_h notify_cb; void* notify_cb_user_data; - rpc_port_stub_vc_mgr_send_buffer_cb_h send_buffer_cb; + rpc_port_stub_vcd_mgr_stub_vc_mgr_send_buffer_cb_h send_buffer_cb; void* send_buffer_cb_user_data; bool connected; bool connection_requesting; - rpc_port_proxy_vcd_mgr_h rpc_h; + rpc_port_proxy_vcd_mgr_proxy_vcd_mgr_h rpc_h; } manager_tidl_info_s; typedef struct { int pid; - rpc_port_stub_vc_widget_notify_cb_h notify_cb; + rpc_port_stub_vcd_widget_stub_vc_widget_notify_cb_h notify_cb; void* notify_cb_user_data; bool connected; bool connection_requesting; - rpc_port_proxy_vcd_widget_h rpc_h; + rpc_port_proxy_vcd_widget_proxy_vcd_widget_h rpc_h; } widget_tidl_info_s; typedef enum { @@ -171,11 +171,11 @@ bool vcd_client_manager_is_system_command_valid(int pid); int vcd_client_manager_create_tidl_info(int pid); -int vcd_client_manager_set_tidl_notify_cb(rpc_port_stub_vc_mgr_notify_cb_h callback, void* user_data); +int vcd_client_manager_set_tidl_notify_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_notify_cb_h callback, void* user_data); int vcd_client_manager_unset_tidl_notify_cb(); -int vcd_client_manager_set_tidl_send_buffer_cb(rpc_port_stub_vc_mgr_send_buffer_cb_h callback, void* user_data); +int vcd_client_manager_set_tidl_send_buffer_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_send_buffer_cb_h callback, void* user_data); int vcd_client_manager_unset_tidl_send_buffer_cb(); @@ -192,11 +192,11 @@ int vcd_client_delete(int pid); int vcd_client_add_ipc_info(int pid); -int vcd_client_set_ipc_notify_cb(int pid, rpc_port_stub_vc_notify_cb_h callback, void* user_data); +int vcd_client_set_ipc_notify_cb(int pid, rpc_port_stub_vcd_stub_vc_notify_cb_h callback, void* user_data); int vcd_client_unset_ipc_notify_cb(int pid); -int vcd_client_set_ipc_feedback_cb(int pid, rpc_port_stub_vc_feedback_cb_h callback, void* user_data); +int vcd_client_set_ipc_feedback_cb(int pid, rpc_port_stub_vcd_stub_vc_feedback_cb_h callback, void* user_data); int vcd_client_unset_ipc_feedback_cb(int pid); @@ -255,7 +255,7 @@ int vcd_client_widget_get_waiting_for_recording(int pid, bool* waiting); int vcd_client_widget_add_tidl_info(int pid); -int vcd_client_widget_set_tidl_notify_cb(int pid, rpc_port_stub_vc_widget_notify_cb_h callback, void* user_data); +int vcd_client_widget_set_tidl_notify_cb(int pid, rpc_port_stub_vcd_widget_stub_vc_widget_notify_cb_h callback, void* user_data); int vcd_client_widget_unset_tidl_notify_cb(int pid); diff --git a/server/vcd_dbus.c b/server/vcd_dbus.c index 0e67e46..d16ce39 100755 --- a/server/vcd_dbus.c +++ b/server/vcd_dbus.c @@ -27,35 +27,35 @@ static DBusConnection* g_conn_listener = NULL; static Ecore_Fd_Handler* g_dbus_fd_handler = NULL; -static int g_waiting_time = 3000; +// static int g_waiting_time = 3000; // static int g_volume_count = 0; -static DBusMessage* __get_message(int pid, const char* method, vcd_client_type_e type) -{ - char service_name[64] = {0,}; - char object_path[64] = {0,}; - char target_if_name[128] = {0,}; - - if (VCD_CLIENT_TYPE_NORMAL == type) { - snprintf(service_name, 64, "%s%d", VC_CLIENT_SERVICE_NAME, pid); - snprintf(object_path, 64, "%s", VC_CLIENT_SERVICE_OBJECT_PATH); - snprintf(target_if_name, 128, "%s", VC_CLIENT_SERVICE_INTERFACE); - } else if (VCD_CLIENT_TYPE_WIDGET == type) { - snprintf(service_name, 64, "%s%d", VC_WIDGET_SERVICE_NAME, pid); - snprintf(object_path, 64, "%s", VC_WIDGET_SERVICE_OBJECT_PATH); - snprintf(target_if_name, 128, "%s", VC_WIDGET_SERVICE_INTERFACE); - } else if (VCD_CLIENT_TYPE_MANAGER == type) { - snprintf(service_name, 64, "%s", VC_MANAGER_SERVICE_NAME); - snprintf(object_path, 64, "%s", VC_MANAGER_SERVICE_OBJECT_PATH); - snprintf(target_if_name, 128, "%s", VC_MANAGER_SERVICE_INTERFACE); - } else { - return NULL; - } +// static DBusMessage* __get_message(int pid, const char* method, vcd_client_type_e type) +// { +// char service_name[64] = {0,}; +// char object_path[64] = {0,}; +// char target_if_name[128] = {0,}; - return dbus_message_new_method_call(service_name, object_path, target_if_name, method); -} +// if (VCD_CLIENT_TYPE_NORMAL == type) { +// snprintf(service_name, 64, "%s%d", VC_CLIENT_SERVICE_NAME, pid); +// snprintf(object_path, 64, "%s", VC_CLIENT_SERVICE_OBJECT_PATH); +// snprintf(target_if_name, 128, "%s", VC_CLIENT_SERVICE_INTERFACE); +// } else if (VCD_CLIENT_TYPE_WIDGET == type) { +// snprintf(service_name, 64, "%s%d", VC_WIDGET_SERVICE_NAME, pid); +// snprintf(object_path, 64, "%s", VC_WIDGET_SERVICE_OBJECT_PATH); +// snprintf(target_if_name, 128, "%s", VC_WIDGET_SERVICE_INTERFACE); +// } else if (VCD_CLIENT_TYPE_MANAGER == type) { +// snprintf(service_name, 64, "%s", VC_MANAGER_SERVICE_NAME); +// snprintf(object_path, 64, "%s", VC_MANAGER_SERVICE_OBJECT_PATH); +// snprintf(target_if_name, 128, "%s", VC_MANAGER_SERVICE_INTERFACE); +// } else { +// return NULL; +// } + +// return dbus_message_new_method_call(service_name, object_path, target_if_name, method); +// } int vcd_dbus_reconnect() { diff --git a/server/vcd_stub.c b/server/vcd_stub.c deleted file mode 100755 index e84a2e3..0000000 --- a/server/vcd_stub.c +++ /dev/null @@ -1,2422 +0,0 @@ -/* - * Generated by tidlc 1.8.1. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "vcd_stub.h" - -#undef LOG_TAG -#define LOG_TAG "RPC_PORT_STUB" - -#undef _E -#define _E(fmt, ...) dlog_print(DLOG_ERROR, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) - -#undef _W -#define _W(fmt, ...) dlog_print(DLOG_WARN, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) - -#undef _I -#define _I(fmt, ...) dlog_print(DLOG_INFO, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) - -#undef _D -#define _D(fmt, ...) dlog_print(DLOG_DEBUG, LOG_TAG, "%s: %s(%d) > "fmt, basename(__FILE__), __FUNCTION__, __LINE__, ##__VA_ARGS__) - -#ifndef TIDL_VERSION -#define TIDL_VERSION "1.8.1" -#endif - -#ifndef nullptr -#define nullptr NULL -#endif - -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -#endif - -#ifndef STRING_GET -#define STRING_GET(x) ((x) ? x : "") -#endif - -typedef int (*rpc_port_stub_method_handler)(rpc_port_h port, rpc_port_parcel_h parcel, void *data); - -typedef enum { - RPC_PORT_STUB_VC_METHOD_RESULT_, - RPC_PORT_STUB_VC_METHOD_CALLBACK_, - RPC_PORT_STUB_VC_METHOD_REGISTER_NOTIFY_CB, - RPC_PORT_STUB_VC_METHOD_REGISTER_NOTIFY_CB_SYNC, - RPC_PORT_STUB_VC_METHOD_REGISTER_FEEDBACK_CB, - RPC_PORT_STUB_VC_METHOD_REGISTER_FEEDBACK_CB_SYNC, - RPC_PORT_STUB_VC_METHOD_INITIALIZE, - RPC_PORT_STUB_VC_METHOD_FINALIZE, - RPC_PORT_STUB_VC_METHOD_SET_COMMAND, - RPC_PORT_STUB_VC_METHOD_UNSET_COMMAND, - RPC_PORT_STUB_VC_METHOD_SET_FOREGROUND, - RPC_PORT_STUB_VC_METHOD_SET_SERVER_DIALOG, - RPC_PORT_STUB_VC_METHOD_REQUEST_DIALOG, - RPC_PORT_STUB_VC_METHOD_IS_SYSTEM_COMMAND_VALID, - RPC_PORT_STUB_VC_METHOD_AUTH_ENABLE, - RPC_PORT_STUB_VC_METHOD_AUTH_DISABLE, - RPC_PORT_STUB_VC_METHOD_AUTH_START, - RPC_PORT_STUB_VC_METHOD_AUTH_STOP, - RPC_PORT_STUB_VC_METHOD_AUTH_CANCEL, - RPC_PORT_STUB_VC_METHOD_REQUEST_TTS, - RPC_PORT_STUB_VC_METHOD_CANCEL_TTS, - RPC_PORT_STUB_VC_METHOD_GET_TTS_AUDIO_FORMAT, -} rpc_port_stub_vc_method_e; - -typedef enum { - RPC_PORT_STUB_VC_DELEGATE_NOTIFY_CB = 1, - RPC_PORT_STUB_VC_DELEGATE_FEEDBACK_CB = 2, -} rpc_port_stub_vc_delegate_e; - -typedef struct rpc_port_stub_array_char_s { - rpc_port_parcelable_t parcelable; - char *value; - int size; -} rpc_port_stub_array_char_t; - -typedef struct rpc_port_stub_vc_notify_cb_s { - rpc_port_parcelable_t parcelable; - rpc_port_h port; - int id; - int seq_id; - bool once; - bool valid; -} rpc_port_stub_vc_notify_cb_t; - -typedef struct rpc_port_stub_vc_feedback_cb_s { - rpc_port_parcelable_t parcelable; - rpc_port_h port; - int id; - int seq_id; - bool once; - bool valid; -} rpc_port_stub_vc_feedback_cb_t; - -static bool __rpc_port_stub_vc_exist_callback_port(rpc_port_h callback_port); - -typedef struct rpc_port_stub_vc_context_s { - char *sender; - char *instance; - rpc_port_h port; - rpc_port_h callback_port; - void *tag; - rpc_port_stub_vc_callback_s callback; - void *user_data; -#ifdef TIDL_THREAD_ENABLE - GThread *thread; - GQueue *queue; - GMutex mutex; - GCond cond; - bool done; -#endif /* TIDL_THREAD_ENABLE */ -} rpc_port_stub_vc_context_t; - -typedef struct rpc_port_stub_vc_s { - rpc_port_stub_h stub; - rpc_port_stub_vc_callback_s callback; - void *user_data; - GList* contexts; - GList* callback_ports; - GRecMutex mutex; -} rpc_port_stub_vc_t; - -static rpc_port_stub_vc_t __vc; - -static void __rpc_port_stub_array_char_to(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_stub_array_char_h h = data; - int i; - - if (parcel == nullptr || h == nullptr) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_array_count(parcel, h->size); - - for (i = 0; i < h->size; ++i) - rpc_port_parcel_write_byte(parcel, h->value[i]); -} - -static void __rpc_port_stub_array_char_from(rpc_port_parcel_h parcel, void *data) -{ - rpc_port_stub_array_char_h h = data; - char value; - int ret; - int i; - - if (parcel == nullptr || h == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return; - } - - ret = rpc_port_parcel_read_array_count(parcel, &h->size); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to read array count. error(%d)", ret); - set_last_result(ret); - return; - } - - h->value = calloc(h->size, sizeof(char)); - if (h->value == nullptr) { - _E("Out of memory"); - set_last_result(RPC_PORT_ERROR_OUT_OF_MEMORY); - return; - } - - for (i = 0; i < h->size; ++i) { - rpc_port_parcel_read_byte(parcel, &value); - h->value[i] = value; - } - - set_last_result(RPC_PORT_ERROR_NONE); -} - -int rpc_port_stub_array_char_create(rpc_port_stub_array_char_h *h) -{ - rpc_port_stub_array_char_t *handle; - - if (h == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - handle = calloc(1, sizeof(rpc_port_stub_array_char_t)); - if (handle == nullptr) { - _E("Out of memory"); - return RPC_PORT_ERROR_OUT_OF_MEMORY; - } - - handle->parcelable.to = __rpc_port_stub_array_char_to; - handle->parcelable.from = __rpc_port_stub_array_char_from; - - *h = handle; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_array_char_destroy(rpc_port_stub_array_char_h h) -{ - if (h == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - if (h->value) - free(h->value); - - free(h); - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_array_char_clone(rpc_port_stub_array_char_h h, rpc_port_stub_array_char_h *clone) -{ - rpc_port_stub_array_char_h handle; - rpc_port_parcel_h parcel; - int ret; - - if (h == nullptr || clone == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - ret = rpc_port_stub_array_char_create(&handle); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to create handle. error(%d)", ret); - return ret; - } - - ret = rpc_port_parcel_create(&parcel); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret); - rpc_port_stub_array_char_destroy(handle); - return ret; - } - - rpc_port_parcel_write(parcel, &h->parcelable, h); - rpc_port_parcel_read(parcel, &handle->parcelable, handle); - ret = get_last_result(); - rpc_port_parcel_destroy(parcel); - - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to read data. error(%d)", ret); - rpc_port_stub_array_char_destroy(handle); - return ret; - } - - *clone = handle; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_array_char_set(rpc_port_stub_array_char_h h, char *value, int size) -{ - rpc_port_stub_array_char_h handle; - rpc_port_stub_array_char_h clone; - int ret; - - if (h == nullptr || value == nullptr || size <= 0) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - ret = rpc_port_stub_array_char_create(&handle); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to create handle. error(%d)", ret); - return ret; - } - - handle->value = (char *)value; - handle->size = size; - - ret = rpc_port_stub_array_char_clone(handle, &clone); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to clone handle. error(%d)", ret); - handle->value = nullptr; - handle->size = 0; - rpc_port_stub_array_char_destroy(handle); - return ret; - } - - handle->value = h->value; - handle->size = h->size; - rpc_port_stub_array_char_destroy(handle); - - h->value = clone->value; - h->size = clone->size; - - clone->value = nullptr; - clone->size = 0; - rpc_port_stub_array_char_destroy(clone); - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_array_char_get(rpc_port_stub_array_char_h h, char **value, int *size) -{ - rpc_port_stub_array_char_h handle; - int ret; - - if (h == nullptr || value == nullptr || size == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - ret = rpc_port_stub_array_char_clone(h, &handle); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to clone handle. error(%d)", ret); - return ret; - } - - *value = handle->value; - *size = handle->size; - - handle->value = nullptr; - handle->size = 0; - rpc_port_stub_array_char_destroy(handle); - - return RPC_PORT_ERROR_NONE; -} - -static void __rpc_port_stub_vc_notify_cb_to(rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_notify_cb_h h = user_data; - - if (parcel == nullptr || h == nullptr) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_int32(parcel, h->id); - - rpc_port_parcel_write_int32(parcel, h->seq_id); - - rpc_port_parcel_write_bool(parcel, h->once); - - _I("id(%d), seq_id(%d), once(%s)", h->id, h->seq_id, h->once ? "true" : "false"); -} - -static void __rpc_port_stub_vc_notify_cb_from(rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_notify_cb_h h = user_data; - - if (parcel == nullptr || h == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return; - } - - rpc_port_parcel_read_int32(parcel, &h->id); - - rpc_port_parcel_read_int32(parcel, &h->seq_id); - - rpc_port_parcel_read_bool(parcel, &h->once); - - _I("id(%d), seq_id(%d), once(%s)", h->id, h->seq_id, h->once ? "true" : "false"); - set_last_result(RPC_PORT_ERROR_NONE); -} - -int rpc_port_stub_vc_notify_cb_create(rpc_port_stub_vc_notify_cb_h *h) -{ - rpc_port_stub_vc_notify_cb_t *handle; - static int seq_num; - - if (h == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - handle = calloc(1, sizeof(rpc_port_stub_vc_notify_cb_t)); - if (handle == nullptr) { - _E("Out of memory"); - return RPC_PORT_ERROR_OUT_OF_MEMORY; - } - - handle->parcelable.to = __rpc_port_stub_vc_notify_cb_to; - handle->parcelable.from = __rpc_port_stub_vc_notify_cb_from; - handle->id = RPC_PORT_STUB_VC_DELEGATE_NOTIFY_CB; - handle->seq_id = g_atomic_int_add(&seq_num, 1) + 1; - handle->once = false; - handle->valid = true; - _I("id(%d), seq_id(%d)", handle->id, handle->seq_id); - - *h = handle; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_notify_cb_destroy(rpc_port_stub_vc_notify_cb_h h) -{ - if (h == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - _W("id(%d), seq_id(%d), once(%s)", h->id, h->seq_id, h->once ? "true" : "false"); - - free(h); - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_notify_cb_clone(rpc_port_stub_vc_notify_cb_h h, rpc_port_stub_vc_notify_cb_h *clone) -{ - rpc_port_stub_vc_notify_cb_h handle; - int ret; - - if (h == nullptr || clone == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - ret = rpc_port_stub_vc_notify_cb_create(&handle); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to create handle. error(%d)", ret); - return ret; - } - - handle->port = h->port; - handle->seq_id = h->seq_id; - handle->once = h->once; - handle->valid = h->valid; - - *clone = handle; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_notify_cb_get_id(rpc_port_stub_vc_notify_cb_h h, int *id) -{ - if (h == nullptr || id == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - *id = h->id; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_notify_cb_get_seq_id(rpc_port_stub_vc_notify_cb_h h, int *seq_id) -{ - if (h == nullptr || seq_id == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - *seq_id = h->seq_id; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_notify_cb_is_once(rpc_port_stub_vc_notify_cb_h h, bool *once) -{ - if (h == nullptr || once == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - *once = h->once; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_notify_cb_get_tag(rpc_port_stub_vc_notify_cb_h h, char **tag) -{ - char *value; - char buf[128]; - - if (h == nullptr || tag == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - snprintf(buf, sizeof(buf), "%d::%d", h->id, h->seq_id); - value = strdup(buf); - if (value == nullptr) { - _E("Out of memory"); - return RPC_PORT_ERROR_OUT_OF_MEMORY; - } - - *tag = value; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_notify_cb_set_port(rpc_port_stub_vc_notify_cb_h h, rpc_port_h port) -{ - if (h == nullptr || port == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - h->port = port; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_notify_cb_invoke(rpc_port_stub_vc_notify_cb_h h, int pid, bundle *msg) -{ - rpc_port_parcel_h parcel_; - int ret_; - - if (h == nullptr || h->port == nullptr || msg == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - if (!__rpc_port_stub_vc_exist_callback_port(h->port)) { - _E("Not connected"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - if (h->once && !h->valid) { - _E("The delegate handle is already used"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - ret_ = rpc_port_parcel_create(&parcel_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret_); - return ret_; - } - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_STUB_VC_METHOD_CALLBACK_); - - rpc_port_parcel_write(parcel_, &h->parcelable, h); - - rpc_port_parcel_write_int32(parcel_, pid); - - rpc_port_parcel_write_bundle(parcel_, msg); - - ret_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - h->valid = false; - - return ret_; -} - -static void __rpc_port_stub_vc_feedback_cb_to(rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_feedback_cb_h h = user_data; - - if (parcel == nullptr || h == nullptr) { - _E("Invalid parameter"); - return; - } - - rpc_port_parcel_write_int32(parcel, h->id); - - rpc_port_parcel_write_int32(parcel, h->seq_id); - - rpc_port_parcel_write_bool(parcel, h->once); - - _I("id(%d), seq_id(%d), once(%s)", h->id, h->seq_id, h->once ? "true" : "false"); -} - -static void __rpc_port_stub_vc_feedback_cb_from(rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_feedback_cb_h h = user_data; - - if (parcel == nullptr || h == nullptr) { - _E("Invalid parameter"); - set_last_result(RPC_PORT_ERROR_INVALID_PARAMETER); - return; - } - - rpc_port_parcel_read_int32(parcel, &h->id); - - rpc_port_parcel_read_int32(parcel, &h->seq_id); - - rpc_port_parcel_read_bool(parcel, &h->once); - - _I("id(%d), seq_id(%d), once(%s)", h->id, h->seq_id, h->once ? "true" : "false"); - set_last_result(RPC_PORT_ERROR_NONE); -} - -int rpc_port_stub_vc_feedback_cb_create(rpc_port_stub_vc_feedback_cb_h *h) -{ - rpc_port_stub_vc_feedback_cb_t *handle; - static int seq_num; - - if (h == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - handle = calloc(1, sizeof(rpc_port_stub_vc_feedback_cb_t)); - if (handle == nullptr) { - _E("Out of memory"); - return RPC_PORT_ERROR_OUT_OF_MEMORY; - } - - handle->parcelable.to = __rpc_port_stub_vc_feedback_cb_to; - handle->parcelable.from = __rpc_port_stub_vc_feedback_cb_from; - handle->id = RPC_PORT_STUB_VC_DELEGATE_FEEDBACK_CB; - handle->seq_id = g_atomic_int_add(&seq_num, 1) + 1; - handle->once = false; - handle->valid = true; - _I("id(%d), seq_id(%d)", handle->id, handle->seq_id); - - *h = handle; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_feedback_cb_destroy(rpc_port_stub_vc_feedback_cb_h h) -{ - if (h == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - _W("id(%d), seq_id(%d), once(%s)", h->id, h->seq_id, h->once ? "true" : "false"); - - free(h); - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_feedback_cb_clone(rpc_port_stub_vc_feedback_cb_h h, rpc_port_stub_vc_feedback_cb_h *clone) -{ - rpc_port_stub_vc_feedback_cb_h handle; - int ret; - - if (h == nullptr || clone == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - ret = rpc_port_stub_vc_feedback_cb_create(&handle); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to create handle. error(%d)", ret); - return ret; - } - - handle->port = h->port; - handle->seq_id = h->seq_id; - handle->once = h->once; - handle->valid = h->valid; - - *clone = handle; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_feedback_cb_get_id(rpc_port_stub_vc_feedback_cb_h h, int *id) -{ - if (h == nullptr || id == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - *id = h->id; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_feedback_cb_get_seq_id(rpc_port_stub_vc_feedback_cb_h h, int *seq_id) -{ - if (h == nullptr || seq_id == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - *seq_id = h->seq_id; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_feedback_cb_is_once(rpc_port_stub_vc_feedback_cb_h h, bool *once) -{ - if (h == nullptr || once == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - *once = h->once; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_feedback_cb_get_tag(rpc_port_stub_vc_feedback_cb_h h, char **tag) -{ - char *value; - char buf[128]; - - if (h == nullptr || tag == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - snprintf(buf, sizeof(buf), "%d::%d", h->id, h->seq_id); - value = strdup(buf); - if (value == nullptr) { - _E("Out of memory"); - return RPC_PORT_ERROR_OUT_OF_MEMORY; - } - - *tag = value; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_feedback_cb_set_port(rpc_port_stub_vc_feedback_cb_h h, rpc_port_h port) -{ - if (h == nullptr || port == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - h->port = port; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_feedback_cb_invoke(rpc_port_stub_vc_feedback_cb_h h, int utt_id, int event, rpc_port_stub_array_char_h pcm_data, int len) -{ - rpc_port_parcel_h parcel_; - int ret_; - - if (h == nullptr || h->port == nullptr || pcm_data == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - if (!__rpc_port_stub_vc_exist_callback_port(h->port)) { - _E("Not connected"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - if (h->once && !h->valid) { - _E("The delegate handle is already used"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - ret_ = rpc_port_parcel_create(&parcel_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret_); - return ret_; - } - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_STUB_VC_METHOD_CALLBACK_); - - rpc_port_parcel_write(parcel_, &h->parcelable, h); - - rpc_port_parcel_write_int32(parcel_, utt_id); - - rpc_port_parcel_write_int32(parcel_, event); - - rpc_port_parcel_write(parcel_, &pcm_data->parcelable, pcm_data); - - rpc_port_parcel_write_int32(parcel_, len); - - ret_ = rpc_port_parcel_send(parcel_, h->port); - rpc_port_parcel_destroy(parcel_); - h->valid = false; - - return ret_; -} - -static int __rpc_port_stub_vc_method_register_notify_cb_handler(rpc_port_h port, rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_context_h context_ = user_data; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - rpc_port_h callback_port_; - int ret_; - int pid = -1; - rpc_port_stub_vc_notify_cb_h callback = nullptr; - - ret_ = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, context_->instance, &callback_port_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel, &header_); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Sequence] %d", seq_num_); - - rpc_port_parcel_read_int32(parcel, &pid); - - ret_ = rpc_port_stub_vc_notify_cb_create(&callback); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create handle. error(%d)", ret_); - goto out; - } - - rpc_port_stub_vc_notify_cb_set_port(callback, callback_port_); - rpc_port_parcel_read(parcel, &callback->parcelable, callback); - ret_ = get_last_result(); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to read data. error(%d)", ret_); - goto out; - } - - if (context_->callback.register_notify_cb) - context_->callback.register_notify_cb(context_, pid, callback, context_->user_data); - -out: - if (callback) - rpc_port_stub_vc_notify_cb_destroy(callback); - - return ret_; -} - -static int __rpc_port_stub_vc_method_register_notify_cb_sync_handler(rpc_port_h port, rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_context_h context_ = user_data; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - rpc_port_h callback_port_; - int ret_; - int pid = -1; - rpc_port_stub_vc_notify_cb_h callback = nullptr; - rpc_port_parcel_h parcel_; - int res_ = -1; - - ret_ = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, context_->instance, &callback_port_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel, &header_); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Sequence] %d", seq_num_); - - rpc_port_parcel_read_int32(parcel, &pid); - - ret_ = rpc_port_stub_vc_notify_cb_create(&callback); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create handle. error(%d)", ret_); - goto out; - } - - rpc_port_stub_vc_notify_cb_set_port(callback, callback_port_); - rpc_port_parcel_read(parcel, &callback->parcelable, callback); - ret_ = get_last_result(); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to read data. error(%d)", ret_); - goto out; - } - - if (context_->callback.register_notify_cb_sync) - res_ = context_->callback.register_notify_cb_sync(context_, pid, callback, context_->user_data); - - ret_ = rpc_port_parcel_create(&parcel_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_set_seq_num(header_, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_STUB_VC_METHOD_RESULT_); - - rpc_port_parcel_write_int32(parcel_, res_); - - ret_ = rpc_port_parcel_send(parcel_, port); - rpc_port_parcel_destroy(parcel_); - -out: - if (callback) - rpc_port_stub_vc_notify_cb_destroy(callback); - - return ret_; -} - -static int __rpc_port_stub_vc_method_register_feedback_cb_handler(rpc_port_h port, rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_context_h context_ = user_data; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - rpc_port_h callback_port_; - int ret_; - int pid = -1; - rpc_port_stub_vc_feedback_cb_h callback = nullptr; - - ret_ = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, context_->instance, &callback_port_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel, &header_); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Sequence] %d", seq_num_); - - rpc_port_parcel_read_int32(parcel, &pid); - - ret_ = rpc_port_stub_vc_feedback_cb_create(&callback); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create handle. error(%d)", ret_); - goto out; - } - - rpc_port_stub_vc_feedback_cb_set_port(callback, callback_port_); - rpc_port_parcel_read(parcel, &callback->parcelable, callback); - ret_ = get_last_result(); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to read data. error(%d)", ret_); - goto out; - } - - if (context_->callback.register_feedback_cb) - context_->callback.register_feedback_cb(context_, pid, callback, context_->user_data); - -out: - if (callback) - rpc_port_stub_vc_feedback_cb_destroy(callback); - - return ret_; -} - -static int __rpc_port_stub_vc_method_register_feedback_cb_sync_handler(rpc_port_h port, rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_context_h context_ = user_data; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - rpc_port_h callback_port_; - int ret_; - int pid = -1; - rpc_port_stub_vc_feedback_cb_h callback = nullptr; - rpc_port_parcel_h parcel_; - int res_ = -1; - - ret_ = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, context_->instance, &callback_port_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel, &header_); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Sequence] %d", seq_num_); - - rpc_port_parcel_read_int32(parcel, &pid); - - ret_ = rpc_port_stub_vc_feedback_cb_create(&callback); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create handle. error(%d)", ret_); - goto out; - } - - rpc_port_stub_vc_feedback_cb_set_port(callback, callback_port_); - rpc_port_parcel_read(parcel, &callback->parcelable, callback); - ret_ = get_last_result(); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to read data. error(%d)", ret_); - goto out; - } - - if (context_->callback.register_feedback_cb_sync) - res_ = context_->callback.register_feedback_cb_sync(context_, pid, callback, context_->user_data); - - ret_ = rpc_port_parcel_create(&parcel_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_set_seq_num(header_, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_STUB_VC_METHOD_RESULT_); - - rpc_port_parcel_write_int32(parcel_, res_); - - ret_ = rpc_port_parcel_send(parcel_, port); - rpc_port_parcel_destroy(parcel_); - -out: - if (callback) - rpc_port_stub_vc_feedback_cb_destroy(callback); - - return ret_; -} - -static int __rpc_port_stub_vc_method_initialize_handler(rpc_port_h port, rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_context_h context_ = user_data; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - rpc_port_h callback_port_; - int ret_; - int pid = -1; - int mgr_pid = -1; - int service_state = -1; - int daemon_pid = -1; - rpc_port_parcel_h parcel_; - int res_ = -1; - - ret_ = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, context_->instance, &callback_port_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel, &header_); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Sequence] %d", seq_num_); - - rpc_port_parcel_read_int32(parcel, &pid); - - if (context_->callback.initialize) - res_ = context_->callback.initialize(context_, pid, &mgr_pid, &service_state, &daemon_pid, context_->user_data); - - ret_ = rpc_port_parcel_create(&parcel_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_set_seq_num(header_, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_STUB_VC_METHOD_RESULT_); - - rpc_port_parcel_write_int32(parcel_, mgr_pid); - - rpc_port_parcel_write_int32(parcel_, service_state); - - rpc_port_parcel_write_int32(parcel_, daemon_pid); - - rpc_port_parcel_write_int32(parcel_, res_); - - ret_ = rpc_port_parcel_send(parcel_, port); - rpc_port_parcel_destroy(parcel_); - -out: - - return ret_; -} - -static int __rpc_port_stub_vc_method_finalize_handler(rpc_port_h port, rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_context_h context_ = user_data; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - rpc_port_h callback_port_; - int ret_; - int pid = -1; - rpc_port_parcel_h parcel_; - int res_ = -1; - - ret_ = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, context_->instance, &callback_port_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel, &header_); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Sequence] %d", seq_num_); - - rpc_port_parcel_read_int32(parcel, &pid); - - if (context_->callback.finalize) - res_ = context_->callback.finalize(context_, pid, context_->user_data); - - ret_ = rpc_port_parcel_create(&parcel_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_set_seq_num(header_, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_STUB_VC_METHOD_RESULT_); - - rpc_port_parcel_write_int32(parcel_, res_); - - ret_ = rpc_port_parcel_send(parcel_, port); - rpc_port_parcel_destroy(parcel_); - -out: - - return ret_; -} - -static int __rpc_port_stub_vc_method_set_command_handler(rpc_port_h port, rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_context_h context_ = user_data; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - rpc_port_h callback_port_; - int ret_; - int pid = -1; - int cmd_type = -1; - rpc_port_parcel_h parcel_; - int res_ = -1; - - ret_ = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, context_->instance, &callback_port_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel, &header_); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Sequence] %d", seq_num_); - - rpc_port_parcel_read_int32(parcel, &pid); - - rpc_port_parcel_read_int32(parcel, &cmd_type); - - if (context_->callback.set_command) - res_ = context_->callback.set_command(context_, pid, cmd_type, context_->user_data); - - ret_ = rpc_port_parcel_create(&parcel_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_set_seq_num(header_, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_STUB_VC_METHOD_RESULT_); - - rpc_port_parcel_write_int32(parcel_, res_); - - ret_ = rpc_port_parcel_send(parcel_, port); - rpc_port_parcel_destroy(parcel_); - -out: - - return ret_; -} - -static int __rpc_port_stub_vc_method_unset_command_handler(rpc_port_h port, rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_context_h context_ = user_data; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - rpc_port_h callback_port_; - int ret_; - int pid = -1; - int cmd_type = -1; - rpc_port_parcel_h parcel_; - int res_ = -1; - - ret_ = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, context_->instance, &callback_port_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel, &header_); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Sequence] %d", seq_num_); - - rpc_port_parcel_read_int32(parcel, &pid); - - rpc_port_parcel_read_int32(parcel, &cmd_type); - - if (context_->callback.unset_command) - res_ = context_->callback.unset_command(context_, pid, cmd_type, context_->user_data); - - ret_ = rpc_port_parcel_create(&parcel_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_set_seq_num(header_, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_STUB_VC_METHOD_RESULT_); - - rpc_port_parcel_write_int32(parcel_, res_); - - ret_ = rpc_port_parcel_send(parcel_, port); - rpc_port_parcel_destroy(parcel_); - -out: - - return ret_; -} - -static int __rpc_port_stub_vc_method_set_foreground_handler(rpc_port_h port, rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_context_h context_ = user_data; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - rpc_port_h callback_port_; - int ret_; - int pid = -1; - bool value = false; - rpc_port_parcel_h parcel_; - int res_ = -1; - - ret_ = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, context_->instance, &callback_port_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel, &header_); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Sequence] %d", seq_num_); - - rpc_port_parcel_read_int32(parcel, &pid); - - rpc_port_parcel_read_bool(parcel, &value); - - if (context_->callback.set_foreground) - res_ = context_->callback.set_foreground(context_, pid, value, context_->user_data); - - ret_ = rpc_port_parcel_create(&parcel_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_set_seq_num(header_, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_STUB_VC_METHOD_RESULT_); - - rpc_port_parcel_write_int32(parcel_, res_); - - ret_ = rpc_port_parcel_send(parcel_, port); - rpc_port_parcel_destroy(parcel_); - -out: - - return ret_; -} - -static int __rpc_port_stub_vc_method_set_server_dialog_handler(rpc_port_h port, rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_context_h context_ = user_data; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - rpc_port_h callback_port_; - int ret_; - int pid = -1; - char *app_id = nullptr; - char *credential = nullptr; - rpc_port_parcel_h parcel_; - int res_ = -1; - - ret_ = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, context_->instance, &callback_port_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel, &header_); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Sequence] %d", seq_num_); - - rpc_port_parcel_read_int32(parcel, &pid); - - rpc_port_parcel_read_string(parcel, &app_id); - if (app_id == nullptr) { - _E("Failed to read data"); - ret_ = RPC_PORT_ERROR_OUT_OF_MEMORY; - goto out; - } - - rpc_port_parcel_read_string(parcel, &credential); - if (credential == nullptr) { - _E("Failed to read data"); - ret_ = RPC_PORT_ERROR_OUT_OF_MEMORY; - goto out; - } - - if (context_->callback.set_server_dialog) - res_ = context_->callback.set_server_dialog(context_, pid, app_id, credential, context_->user_data); - - ret_ = rpc_port_parcel_create(&parcel_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_set_seq_num(header_, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_STUB_VC_METHOD_RESULT_); - - rpc_port_parcel_write_int32(parcel_, res_); - - ret_ = rpc_port_parcel_send(parcel_, port); - rpc_port_parcel_destroy(parcel_); - -out: - if (app_id) - free(app_id); - - if (credential) - free(credential); - - return ret_; -} - -static int __rpc_port_stub_vc_method_request_dialog_handler(rpc_port_h port, rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_context_h context_ = user_data; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - rpc_port_h callback_port_; - int ret_; - int pid = -1; - char *disp_text = nullptr; - char *utt_text = nullptr; - bool continuous = false; - rpc_port_parcel_h parcel_; - int res_ = -1; - - ret_ = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, context_->instance, &callback_port_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel, &header_); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Sequence] %d", seq_num_); - - rpc_port_parcel_read_int32(parcel, &pid); - - rpc_port_parcel_read_string(parcel, &disp_text); - if (disp_text == nullptr) { - _E("Failed to read data"); - ret_ = RPC_PORT_ERROR_OUT_OF_MEMORY; - goto out; - } - - rpc_port_parcel_read_string(parcel, &utt_text); - if (utt_text == nullptr) { - _E("Failed to read data"); - ret_ = RPC_PORT_ERROR_OUT_OF_MEMORY; - goto out; - } - - rpc_port_parcel_read_bool(parcel, &continuous); - - if (context_->callback.request_dialog) - res_ = context_->callback.request_dialog(context_, pid, disp_text, utt_text, continuous, context_->user_data); - - ret_ = rpc_port_parcel_create(&parcel_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_set_seq_num(header_, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_STUB_VC_METHOD_RESULT_); - - rpc_port_parcel_write_int32(parcel_, res_); - - ret_ = rpc_port_parcel_send(parcel_, port); - rpc_port_parcel_destroy(parcel_); - -out: - if (disp_text) - free(disp_text); - - if (utt_text) - free(utt_text); - - return ret_; -} - -static int __rpc_port_stub_vc_method_is_system_command_valid_handler(rpc_port_h port, rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_context_h context_ = user_data; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - rpc_port_h callback_port_; - int ret_; - int pid = -1; - bool is_sys_cmd_valid = false; - rpc_port_parcel_h parcel_; - int res_ = -1; - - ret_ = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, context_->instance, &callback_port_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel, &header_); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Sequence] %d", seq_num_); - - rpc_port_parcel_read_int32(parcel, &pid); - - if (context_->callback.is_system_command_valid) - res_ = context_->callback.is_system_command_valid(context_, pid, &is_sys_cmd_valid, context_->user_data); - - ret_ = rpc_port_parcel_create(&parcel_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_set_seq_num(header_, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_STUB_VC_METHOD_RESULT_); - - rpc_port_parcel_write_bool(parcel_, is_sys_cmd_valid); - - rpc_port_parcel_write_int32(parcel_, res_); - - ret_ = rpc_port_parcel_send(parcel_, port); - rpc_port_parcel_destroy(parcel_); - -out: - - return ret_; -} - -static int __rpc_port_stub_vc_method_auth_enable_handler(rpc_port_h port, rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_context_h context_ = user_data; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - rpc_port_h callback_port_; - int ret_; - int pid = -1; - int mgr_pid = -1; - rpc_port_parcel_h parcel_; - int res_ = -1; - - ret_ = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, context_->instance, &callback_port_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel, &header_); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Sequence] %d", seq_num_); - - rpc_port_parcel_read_int32(parcel, &pid); - - rpc_port_parcel_read_int32(parcel, &mgr_pid); - - if (context_->callback.auth_enable) - res_ = context_->callback.auth_enable(context_, pid, mgr_pid, context_->user_data); - - ret_ = rpc_port_parcel_create(&parcel_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_set_seq_num(header_, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_STUB_VC_METHOD_RESULT_); - - rpc_port_parcel_write_int32(parcel_, res_); - - ret_ = rpc_port_parcel_send(parcel_, port); - rpc_port_parcel_destroy(parcel_); - -out: - - return ret_; -} - -static int __rpc_port_stub_vc_method_auth_disable_handler(rpc_port_h port, rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_context_h context_ = user_data; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - rpc_port_h callback_port_; - int ret_; - int pid = -1; - int mgr_pid = -1; - rpc_port_parcel_h parcel_; - int res_ = -1; - - ret_ = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, context_->instance, &callback_port_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel, &header_); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Sequence] %d", seq_num_); - - rpc_port_parcel_read_int32(parcel, &pid); - - rpc_port_parcel_read_int32(parcel, &mgr_pid); - - if (context_->callback.auth_disable) - res_ = context_->callback.auth_disable(context_, pid, mgr_pid, context_->user_data); - - ret_ = rpc_port_parcel_create(&parcel_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_set_seq_num(header_, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_STUB_VC_METHOD_RESULT_); - - rpc_port_parcel_write_int32(parcel_, res_); - - ret_ = rpc_port_parcel_send(parcel_, port); - rpc_port_parcel_destroy(parcel_); - -out: - - return ret_; -} - -static int __rpc_port_stub_vc_method_auth_start_handler(rpc_port_h port, rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_context_h context_ = user_data; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - rpc_port_h callback_port_; - int ret_; - int pid = -1; - int mgr_pid = -1; - rpc_port_parcel_h parcel_; - int res_ = -1; - - ret_ = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, context_->instance, &callback_port_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel, &header_); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Sequence] %d", seq_num_); - - rpc_port_parcel_read_int32(parcel, &pid); - - rpc_port_parcel_read_int32(parcel, &mgr_pid); - - if (context_->callback.auth_start) - res_ = context_->callback.auth_start(context_, pid, mgr_pid, context_->user_data); - - ret_ = rpc_port_parcel_create(&parcel_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_set_seq_num(header_, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_STUB_VC_METHOD_RESULT_); - - rpc_port_parcel_write_int32(parcel_, res_); - - ret_ = rpc_port_parcel_send(parcel_, port); - rpc_port_parcel_destroy(parcel_); - -out: - - return ret_; -} - -static int __rpc_port_stub_vc_method_auth_stop_handler(rpc_port_h port, rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_context_h context_ = user_data; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - rpc_port_h callback_port_; - int ret_; - int pid = -1; - int mgr_pid = -1; - rpc_port_parcel_h parcel_; - int res_ = -1; - - ret_ = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, context_->instance, &callback_port_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel, &header_); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Sequence] %d", seq_num_); - - rpc_port_parcel_read_int32(parcel, &pid); - - rpc_port_parcel_read_int32(parcel, &mgr_pid); - - if (context_->callback.auth_stop) - res_ = context_->callback.auth_stop(context_, pid, mgr_pid, context_->user_data); - - ret_ = rpc_port_parcel_create(&parcel_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_set_seq_num(header_, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_STUB_VC_METHOD_RESULT_); - - rpc_port_parcel_write_int32(parcel_, res_); - - ret_ = rpc_port_parcel_send(parcel_, port); - rpc_port_parcel_destroy(parcel_); - -out: - - return ret_; -} - -static int __rpc_port_stub_vc_method_auth_cancel_handler(rpc_port_h port, rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_context_h context_ = user_data; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - rpc_port_h callback_port_; - int ret_; - int pid = -1; - int mgr_pid = -1; - rpc_port_parcel_h parcel_; - int res_ = -1; - - ret_ = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, context_->instance, &callback_port_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel, &header_); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Sequence] %d", seq_num_); - - rpc_port_parcel_read_int32(parcel, &pid); - - rpc_port_parcel_read_int32(parcel, &mgr_pid); - - if (context_->callback.auth_cancel) - res_ = context_->callback.auth_cancel(context_, pid, mgr_pid, context_->user_data); - - ret_ = rpc_port_parcel_create(&parcel_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_set_seq_num(header_, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_STUB_VC_METHOD_RESULT_); - - rpc_port_parcel_write_int32(parcel_, res_); - - ret_ = rpc_port_parcel_send(parcel_, port); - rpc_port_parcel_destroy(parcel_); - -out: - - return ret_; -} - -static int __rpc_port_stub_vc_method_request_tts_handler(rpc_port_h port, rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_context_h context_ = user_data; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - rpc_port_h callback_port_; - int ret_; - int pid = -1; - char *text = nullptr; - char *lang = nullptr; - bool to_vcm = false; - int utt_id = -1; - rpc_port_parcel_h parcel_; - int res_ = -1; - - ret_ = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, context_->instance, &callback_port_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel, &header_); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Sequence] %d", seq_num_); - - rpc_port_parcel_read_int32(parcel, &pid); - - rpc_port_parcel_read_string(parcel, &text); - if (text == nullptr) { - _E("Failed to read data"); - ret_ = RPC_PORT_ERROR_OUT_OF_MEMORY; - goto out; - } - - rpc_port_parcel_read_string(parcel, &lang); - if (lang == nullptr) { - _E("Failed to read data"); - ret_ = RPC_PORT_ERROR_OUT_OF_MEMORY; - goto out; - } - - rpc_port_parcel_read_bool(parcel, &to_vcm); - - if (context_->callback.request_tts) - res_ = context_->callback.request_tts(context_, pid, text, lang, to_vcm, &utt_id, context_->user_data); - - ret_ = rpc_port_parcel_create(&parcel_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_set_seq_num(header_, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_STUB_VC_METHOD_RESULT_); - - rpc_port_parcel_write_int32(parcel_, utt_id); - - rpc_port_parcel_write_int32(parcel_, res_); - - ret_ = rpc_port_parcel_send(parcel_, port); - rpc_port_parcel_destroy(parcel_); - -out: - if (text) - free(text); - - if (lang) - free(lang); - - return ret_; -} - -static int __rpc_port_stub_vc_method_cancel_tts_handler(rpc_port_h port, rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_context_h context_ = user_data; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - rpc_port_h callback_port_; - int ret_; - int pid = -1; - int utt_id = -1; - rpc_port_parcel_h parcel_; - int res_ = -1; - - ret_ = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, context_->instance, &callback_port_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel, &header_); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Sequence] %d", seq_num_); - - rpc_port_parcel_read_int32(parcel, &pid); - - rpc_port_parcel_read_int32(parcel, &utt_id); - - if (context_->callback.cancel_tts) - res_ = context_->callback.cancel_tts(context_, pid, utt_id, context_->user_data); - - ret_ = rpc_port_parcel_create(&parcel_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_set_seq_num(header_, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_STUB_VC_METHOD_RESULT_); - - rpc_port_parcel_write_int32(parcel_, res_); - - ret_ = rpc_port_parcel_send(parcel_, port); - rpc_port_parcel_destroy(parcel_); - -out: - - return ret_; -} - -static int __rpc_port_stub_vc_method_get_tts_audio_format_handler(rpc_port_h port, rpc_port_parcel_h parcel, void *user_data) -{ - rpc_port_stub_vc_context_h context_ = user_data; - rpc_port_parcel_header_h header_; - int seq_num_ = -1; - rpc_port_h callback_port_; - int ret_; - int pid = -1; - int rate = -1; - int channel = -1; - int audio_type = -1; - rpc_port_parcel_h parcel_; - int res_ = -1; - - ret_ = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, context_->instance, &callback_port_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel, &header_); - rpc_port_parcel_header_get_seq_num(header_, &seq_num_); - _W("[Sequence] %d", seq_num_); - - rpc_port_parcel_read_int32(parcel, &pid); - - if (context_->callback.get_tts_audio_format) - res_ = context_->callback.get_tts_audio_format(context_, pid, &rate, &channel, &audio_type, context_->user_data); - - ret_ = rpc_port_parcel_create(&parcel_); - if (ret_ != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle. error(%d)", ret_); - goto out; - } - - rpc_port_parcel_get_header(parcel_, &header_); - rpc_port_parcel_header_set_tag(header_, TIDL_VERSION); - rpc_port_parcel_header_set_seq_num(header_, seq_num_); - - rpc_port_parcel_write_int32(parcel_, RPC_PORT_STUB_VC_METHOD_RESULT_); - - rpc_port_parcel_write_int32(parcel_, rate); - - rpc_port_parcel_write_int32(parcel_, channel); - - rpc_port_parcel_write_int32(parcel_, audio_type); - - rpc_port_parcel_write_int32(parcel_, res_); - - ret_ = rpc_port_parcel_send(parcel_, port); - rpc_port_parcel_destroy(parcel_); - -out: - - return ret_; -} - -static rpc_port_stub_method_handler __vc_method_table[] = { - [RPC_PORT_STUB_VC_METHOD_REGISTER_NOTIFY_CB] = __rpc_port_stub_vc_method_register_notify_cb_handler, - [RPC_PORT_STUB_VC_METHOD_REGISTER_NOTIFY_CB_SYNC] = __rpc_port_stub_vc_method_register_notify_cb_sync_handler, - [RPC_PORT_STUB_VC_METHOD_REGISTER_FEEDBACK_CB] = __rpc_port_stub_vc_method_register_feedback_cb_handler, - [RPC_PORT_STUB_VC_METHOD_REGISTER_FEEDBACK_CB_SYNC] = __rpc_port_stub_vc_method_register_feedback_cb_sync_handler, - [RPC_PORT_STUB_VC_METHOD_INITIALIZE] = __rpc_port_stub_vc_method_initialize_handler, - [RPC_PORT_STUB_VC_METHOD_FINALIZE] = __rpc_port_stub_vc_method_finalize_handler, - [RPC_PORT_STUB_VC_METHOD_SET_COMMAND] = __rpc_port_stub_vc_method_set_command_handler, - [RPC_PORT_STUB_VC_METHOD_UNSET_COMMAND] = __rpc_port_stub_vc_method_unset_command_handler, - [RPC_PORT_STUB_VC_METHOD_SET_FOREGROUND] = __rpc_port_stub_vc_method_set_foreground_handler, - [RPC_PORT_STUB_VC_METHOD_SET_SERVER_DIALOG] = __rpc_port_stub_vc_method_set_server_dialog_handler, - [RPC_PORT_STUB_VC_METHOD_REQUEST_DIALOG] = __rpc_port_stub_vc_method_request_dialog_handler, - [RPC_PORT_STUB_VC_METHOD_IS_SYSTEM_COMMAND_VALID] = __rpc_port_stub_vc_method_is_system_command_valid_handler, - [RPC_PORT_STUB_VC_METHOD_AUTH_ENABLE] = __rpc_port_stub_vc_method_auth_enable_handler, - [RPC_PORT_STUB_VC_METHOD_AUTH_DISABLE] = __rpc_port_stub_vc_method_auth_disable_handler, - [RPC_PORT_STUB_VC_METHOD_AUTH_START] = __rpc_port_stub_vc_method_auth_start_handler, - [RPC_PORT_STUB_VC_METHOD_AUTH_STOP] = __rpc_port_stub_vc_method_auth_stop_handler, - [RPC_PORT_STUB_VC_METHOD_AUTH_CANCEL] = __rpc_port_stub_vc_method_auth_cancel_handler, - [RPC_PORT_STUB_VC_METHOD_REQUEST_TTS] = __rpc_port_stub_vc_method_request_tts_handler, - [RPC_PORT_STUB_VC_METHOD_CANCEL_TTS] = __rpc_port_stub_vc_method_cancel_tts_handler, - [RPC_PORT_STUB_VC_METHOD_GET_TTS_AUDIO_FORMAT] = __rpc_port_stub_vc_method_get_tts_audio_format_handler, -}; - -static int __rpc_port_stub_vc_context_handle_request(rpc_port_stub_vc_context_h h, rpc_port_parcel_h parcel) -{ - int ret = RPC_PORT_ERROR_NONE; - int cmd = -1; - - rpc_port_parcel_read_int32(parcel, &cmd); - if (cmd > 1 && cmd < ARRAY_SIZE(__vc_method_table)) { - if (__vc_method_table[cmd]) - ret = __vc_method_table[cmd](h->port, parcel, h); - } else { - _W("Invalid protocol. cmd(%d)", cmd); - ret = RPC_PORT_ERROR_INVALID_PARAMETER; - } - - return ret; -} - -#ifdef TIDL_THREAD_ENABLE -static int __rpc_port_stub_vc_context_push(rpc_port_stub_vc_context_h h, rpc_port_parcel_h parcel) -{ - g_mutex_lock(&h->mutex); - g_queue_push_tail(h->queue, parcel); - g_cond_signal(&h->cond); - g_mutex_unlock(&h->mutex); - - return 0; -} - -static rpc_port_parcel_h __rpc_port_stub_vc_context_wait_and_pop(rpc_port_stub_vc_context_h h) -{ - rpc_port_parcel_h parcel; - - g_mutex_lock(&h->mutex); - while (g_queue_is_empty(h->queue) && !h->done) - g_cond_wait(&h->cond, &h->mutex); - - parcel = g_queue_pop_head(h->queue); - g_mutex_unlock(&h->mutex); - - return parcel; -} - -static gpointer __rpc_port_stub_vc_context_thread_cb(gpointer user_data) -{ - rpc_port_stub_vc_context_h h = user_data; - rpc_port_parcel_h parcel; - - _W("START"); - while (!h->done) { - parcel = __rpc_port_stub_vc_context_wait_and_pop(h); - if (parcel) { - __rpc_port_stub_vc_context_handle_request(h, parcel); - rpc_port_parcel_destroy(parcel); - } - } - _W("END"); - - return nullptr; -} -#endif /* TIDL_THREAD_ENABLE */ - -static void __rpc_port_stub_vc_context_destroy(gpointer data) -{ - rpc_port_stub_vc_context_h h = data; -#ifdef TIDL_THREAD_ENABLE - rpc_port_parcel_h parcel; -#endif /* TIDL_THREAD_ENABLE */ - - if (h == nullptr) - return; - -#ifdef TIDL_THREAD_ENABLE - g_mutex_lock(&h->mutex); - h->done = true; - g_cond_signal(&h->cond); - g_mutex_unlock(&h->mutex); - - if (h->thread) { - g_thread_join(h->thread); - g_thread_unref(h->thread); - } - - g_mutex_clear(&h->mutex); - g_cond_clear(&h->cond); - - if (h->queue) { - while (!g_queue_is_empty(h->queue)) { - parcel = g_queue_pop_head(h->queue); - rpc_port_parcel_destroy(parcel); - } - - g_queue_free(h->queue); - } -#endif /* TIDL_THREAD_ENABLE */ - - if (h->instance) - free(h->instance); - - if (h->sender) - free(h->sender); - - free(h); -} - -static rpc_port_stub_vc_context_h __rpc_port_stub_vc_context_create(const char *sender, const char *instance, rpc_port_h callback_port) -{ - rpc_port_stub_vc_context_t *handle; - - if (sender == nullptr || instance == nullptr || callback_port == nullptr) { - _E("Invalid parameter"); - return nullptr; - } - - handle = calloc(1, sizeof(rpc_port_stub_vc_context_t)); - if (handle == nullptr) { - _E("Out of memory"); - return nullptr; - } - - handle->sender = strdup(sender); - if (handle->sender == nullptr) { - _E("Failed to duplicate sender"); - __rpc_port_stub_vc_context_destroy(handle); - return nullptr; - } - - handle->instance = strdup(instance); - if (handle->instance == nullptr) { - _E("Failed to duplicate instance"); - __rpc_port_stub_vc_context_destroy(handle); - return nullptr; - } - -#ifdef TIDL_THREAD_ENABLE - g_mutex_init(&handle->mutex); - g_cond_init(&handle->cond); - - handle->queue = g_queue_new(); - if (handle->queue == nullptr) { - _E("Failed to create queue"); - __rpc_port_stub_vc_context_destroy(handle); - return nullptr; - } - - handle->thread = g_thread_new(instance, __rpc_port_stub_vc_context_thread_cb, handle); - if (handle->thread == nullptr) { - _E("Failed to create thread"); - __rpc_port_stub_vc_context_destroy(handle); - return nullptr; - } -#endif /* TIDL_THREAD_ENABLE */ - - handle->callback_port = callback_port; - handle->callback = __vc.callback; - handle->user_data = __vc.user_data; - - return handle; -} - -int rpc_port_stub_vc_context_set_tag(rpc_port_stub_vc_context_h context, void *tag) -{ - if (context == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - context->tag = tag; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_context_get_tag(rpc_port_stub_vc_context_h context, void **tag) -{ - if (context == nullptr || tag == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - *tag = context->tag; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_context_get_sender(rpc_port_stub_vc_context_h context, char **sender) -{ - char *value; - - if (context == nullptr || sender == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - value = strdup(context->sender); - if (value == nullptr) { - _E("Failed to duplicate sender"); - return RPC_PORT_ERROR_OUT_OF_MEMORY; - } - - *sender = value; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_context_get_instance(rpc_port_stub_vc_context_h context, char **instance) -{ - char *value; - - if (context == nullptr || instance == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - value = strdup(context->instance); - if (value == nullptr) { - _E("Failed to duplicate instance"); - return RPC_PORT_ERROR_OUT_OF_MEMORY; - } - - *instance = value; - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_context_disconnect(rpc_port_stub_vc_context_h context) -{ - int ret; - - if (context == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - g_rec_mutex_lock(&__vc.mutex); - - ret = rpc_port_disconnect(context->callback_port); - if (ret != RPC_PORT_ERROR_NONE) - _E("Failed to disconnect. error(%d)", ret); - - g_rec_mutex_unlock(&__vc.mutex); - - return ret; -} - -static rpc_port_stub_vc_context_h __rpc_port_stub_vc_find_context(const char *instance) -{ - rpc_port_stub_vc_context_h context; - GList *iter; - - g_rec_mutex_lock(&__vc.mutex); - iter = __vc.contexts; - while (iter) { - context = iter->data; - if (!strcmp(context->instance, instance)) { - g_rec_mutex_unlock(&__vc.mutex); - return context; - } - - iter = g_list_next(iter); - } - g_rec_mutex_unlock(&__vc.mutex); - - return nullptr; -} - -static void __rpc_port_stub_vc_add_context(rpc_port_stub_vc_context_h context) -{ - g_rec_mutex_lock(&__vc.mutex); - __vc.contexts = g_list_append(__vc.contexts, context); - g_rec_mutex_unlock(&__vc.mutex); -} - -static void __rpc_port_stub_vc_remove_context(rpc_port_stub_vc_context_h context) -{ - g_rec_mutex_lock(&__vc.mutex); - __vc.contexts = g_list_remove(__vc.contexts, context); - g_rec_mutex_unlock(&__vc.mutex); -} - -static bool __rpc_port_stub_vc_exist_callback_port(rpc_port_h callback_port) -{ - rpc_port_h port; - GList *iter; - - g_rec_mutex_lock(&__vc.mutex); - iter = __vc.callback_ports; - while (iter) { - port = iter->data; - if (port == callback_port) { - g_rec_mutex_unlock(&__vc.mutex); - return true; - } - - iter = g_list_next(iter); - } - g_rec_mutex_unlock(&__vc.mutex); - - return false; -} - -static void __rpc_port_stub_vc_add_callback_port(rpc_port_h callback_port) -{ - g_rec_mutex_lock(&__vc.mutex); - __vc.callback_ports = g_list_append(__vc.callback_ports, callback_port); - g_rec_mutex_unlock(&__vc.mutex); -} - -static void __rpc_port_stub_vc_remove_callback_port(rpc_port_h callback_port) -{ - g_rec_mutex_lock(&__vc.mutex); - __vc.callback_ports = g_list_remove(__vc.callback_ports, callback_port); - g_rec_mutex_unlock(&__vc.mutex); -} - -static void __rpc_port_stub_vc_connected_event_cb(const char *sender, const char *instance, void *user_data) -{ - rpc_port_stub_vc_context_h context; - rpc_port_h callback_port = nullptr; - int ret; - - _W("sender(%s), instance(%s)", sender, instance); - ret = rpc_port_stub_get_port(__vc.stub, RPC_PORT_PORT_CALLBACK, instance, &callback_port); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to get callback port. error(%d)", ret); - return; - } - - context = __rpc_port_stub_vc_context_create(sender, instance, callback_port); - if (context == nullptr) - return; - - __rpc_port_stub_vc_add_context(context); - __rpc_port_stub_vc_add_callback_port(context->callback_port); - context->callback.create(context, context->user_data); -} - -static void __rpc_port_stub_vc_disconnected_event_cb(const char *sender, const char *instance, void *user_data) -{ - rpc_port_stub_vc_context_h context; - - _W("sender(%s), instance(%s)", sender, instance); - context = __rpc_port_stub_vc_find_context(instance); - if (context == nullptr) - return; - - __rpc_port_stub_vc_remove_callback_port(context->callback_port); - context->callback.terminate(context, context->user_data); - __rpc_port_stub_vc_remove_context(context); - __rpc_port_stub_vc_context_destroy(context); -} - -static int __rpc_port_stub_vc_received_event_cb(const char *sender, const char *instance, rpc_port_h port, void *user_data) -{ - rpc_port_stub_vc_context_h context; - rpc_port_parcel_h parcel; - int ret; - - _W("sender(%s), instance(%s)", sender, instance); - context = __rpc_port_stub_vc_find_context(instance); - if (context == nullptr) { - _E("Failed to find context. instance(%s)", instance); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - context->port = port; - ret = rpc_port_parcel_create_from_port(&parcel, port); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to create parcel handle from port. error(%d)", ret); - return ret; - } - -#ifdef TIDL_THREAD_ENABLE - ret = __rpc_port_stub_vc_context_push(context, parcel); -#else - ret = __rpc_port_stub_vc_context_handle_request(context, parcel); - rpc_port_parcel_destroy(parcel); -#endif /* TIDL_THREAD_ENABLE */ - - return ret; -} - -static int __rpc_port_stub_vc_set_access_control(void) -{ - int ret = RPC_PORT_ERROR_NONE; - - return ret; -} - -int rpc_port_stub_vc_register(rpc_port_stub_vc_callback_s *callback, void *user_data) -{ - int ret; - - if (callback == nullptr || callback->create == nullptr || callback->terminate == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - if (__vc.stub) { - _E("Already exists"); - return RPC_PORT_ERROR_NONE; - } - - g_rec_mutex_init(&__vc.mutex); - __vc.callback = *callback; - __vc.user_data = user_data; - - ret = rpc_port_stub_create(&__vc.stub, "vc"); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to create stub handle. error(%d)", ret); - g_rec_mutex_clear(&__vc.mutex); - return ret; - } - - ret = rpc_port_stub_add_received_event_cb(__vc.stub, __rpc_port_stub_vc_received_event_cb, &__vc); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to add received event callback"); - rpc_port_stub_vc_unregister(); - return ret; - } - - ret = rpc_port_stub_add_connected_event_cb(__vc.stub, __rpc_port_stub_vc_connected_event_cb, &__vc); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to add connected event callback"); - rpc_port_stub_vc_unregister(); - return ret; - } - - ret = rpc_port_stub_add_disconnected_event_cb(__vc.stub, __rpc_port_stub_vc_disconnected_event_cb, &__vc); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to add disconnected event callback"); - rpc_port_stub_vc_unregister(); - return ret; - } - - ret = __rpc_port_stub_vc_set_access_control(); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to add privileges"); - rpc_port_stub_vc_unregister(); - return ret; - } - - ret = rpc_port_stub_listen(__vc.stub); - if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to listen events. error(%d)", ret); - rpc_port_stub_vc_unregister(); - return ret; - } - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_unregister(void) -{ - if (__vc.stub == nullptr) - return RPC_PORT_ERROR_NONE; - - g_rec_mutex_lock(&__vc.mutex); - g_rec_mutex_unlock(&__vc.mutex); - g_rec_mutex_clear(&__vc.mutex); - - if (__vc.contexts) { - g_list_free_full(__vc.contexts, __rpc_port_stub_vc_context_destroy); - __vc.contexts = nullptr; - } - - if (__vc.stub) { - rpc_port_stub_destroy(__vc.stub); - __vc.stub = nullptr; - } - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_foreach_context(rpc_port_stub_vc_context_cb callback, void *user_data) -{ - rpc_port_stub_vc_context_h context; - GList *iter; - - if (callback == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - g_rec_mutex_lock(&__vc.mutex); - iter = __vc.contexts; - while (iter) { - context = iter->data; - if (!callback(context, user_data)) - break; - - iter = g_list_next(iter); - } - g_rec_mutex_unlock(&__vc.mutex); - - return RPC_PORT_ERROR_NONE; -} - -int rpc_port_stub_vc_get_client_number(unsigned int *client_number) -{ - if (client_number == nullptr) { - _E("Invalid parameter"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - if (__vc.stub == nullptr) { - _E("Invalid context"); - return RPC_PORT_ERROR_INVALID_PARAMETER; - } - - g_rec_mutex_lock(&__vc.mutex); - *client_number = g_list_length(__vc.contexts); - g_rec_mutex_unlock(&__vc.mutex); - - return RPC_PORT_ERROR_NONE; -} diff --git a/server/vcd_stub.h b/server/vcd_stub.h deleted file mode 100755 index 70c5013..0000000 --- a/server/vcd_stub.h +++ /dev/null @@ -1,680 +0,0 @@ -/* - * Generated by tidlc 1.8.1. - */ - -#pragma once - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief The rpc_port_stub_array_char handle. - */ -typedef struct rpc_port_stub_array_char_s *rpc_port_stub_array_char_h; - -/** - * @brief The rpc_port_stub_vc_context handle. - */ -typedef struct rpc_port_stub_vc_context_s *rpc_port_stub_vc_context_h; - -/** - * @brief The rpc_port_stub_vc_notify_cb handle. - */ -typedef struct rpc_port_stub_vc_notify_cb_s *rpc_port_stub_vc_notify_cb_h; - -/** - * @brief The rpc_port_stub_vc_feedback_cb handle. - */ -typedef struct rpc_port_stub_vc_feedback_cb_s *rpc_port_stub_vc_feedback_cb_h; - -/** - * @briefs Creates a rpc_port_stub_array_char handle. - * - * @remarks The @a h should be released using the rpc_port_stub_array_char_destroy() - * if it's no longer needed. - * @param[out] h The rpc_port_stub_array_char handle that is newly created - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @see rpc_port_stub_array_char_destroy() - */ -int rpc_port_stub_array_char_create(rpc_port_stub_array_char_h *h); - -/** - * @brief Destroys the rpc_port_stub_array_char handle. - * - * @param[in] h The rpc_port_stub_array_char handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @see rpc_port_stub_array_char_create() - */ -int rpc_port_stub_array_char_destroy(rpc_port_stub_array_char_h h); - -/** - * @brief Creates and returns a copy of the given rpc_port_stub_array_char handle. - * - * @remarks A new created rpc_port_stub_array_char should be released using - * the rpc_port_stub_array_char_destroy() if it's no longer needed. - * @param[in] h The rpc_port_stub_array_char handle - * @param[out] clone If successful, a new created rpc_port_stub_array_char handle will be returned - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @see rpc_port_stub_array_char_destroy() - */ -int rpc_port_stub_array_char_clone(rpc_port_stub_array_char_h h, rpc_port_stub_array_char_h *clone); - -/** - * @brief Sets the value to the rpc_port_stub_array_char handle. - * - * @remarks The value is internally copied and stored. - * You should release it if it's allocaed when it's no longer needed, - * @param[in] h The rpc_port_stub_array_char handle - * @param[in] value The array value - * @param[in] size The size of the array - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @see rpc_port_stub_array_char_get() - */ -int rpc_port_stub_array_char_set(rpc_port_stub_array_char_h h, char *value, int size); - -/** - * @brief Gets the value from the rpc_port_stub_array_char handle. - * - * @remarks A new created value should be released if it's no longer needed. - * @param[in] h The rpc_port_stub_array_char handle - * @param[out] value The array value - * @param[out] size The size of the array - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @see rpc_port_stub_array_char_set() - */ -int rpc_port_stub_array_char_get(rpc_port_stub_array_char_h h, char **value, int *size); - -/** - * @brief Called when the proxy is connected. - * @details The callback function is called when the proxy is connected to the stub. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s - */ -typedef void (*rpc_port_stub_vc_create_cb)(rpc_port_stub_vc_context_h context, void *user_data); - -/** - * @brief Called when the proxy is disconnected. - * @details The callback function is called when the proxy is disconnected from the stub. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s - */ -typedef void (*rpc_port_stub_vc_terminate_cb)(rpc_port_stub_vc_context_h context, void *user_data); - -/** - * @brief Called to get the proxy context once for each connected proxy. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @return @c true to continue with the next iteration of the loop, - * otherwise @c false to break out of the loop - * @pre rpc_port_stub_vc_foreach_context() will invoke this callback. - * @see rpc_port_stub_vc_foreach_context() - */ -typedef bool (*rpc_port_stub_vc_context_cb)(rpc_port_stub_vc_context_h context, void *user_data); - -/** - * @brief Called when the request of the proxy is delivered. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s; - */ -typedef void (*rpc_port_stub_vc_register_notify_cb_cb)(rpc_port_stub_vc_context_h context, int pid, rpc_port_stub_vc_notify_cb_h callback, void *user_data); - -/** - * @brief Called when the request of the proxy is delivered. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s; - */ -typedef int (*rpc_port_stub_vc_register_notify_cb_sync_cb)(rpc_port_stub_vc_context_h context, int pid, rpc_port_stub_vc_notify_cb_h callback, void *user_data); - -/** - * @brief Called when the request of the proxy is delivered. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s; - */ -typedef void (*rpc_port_stub_vc_register_feedback_cb_cb)(rpc_port_stub_vc_context_h context, int pid, rpc_port_stub_vc_feedback_cb_h callback, void *user_data); - -/** - * @brief Called when the request of the proxy is delivered. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s; - */ -typedef int (*rpc_port_stub_vc_register_feedback_cb_sync_cb)(rpc_port_stub_vc_context_h context, int pid, rpc_port_stub_vc_feedback_cb_h callback, void *user_data); - -/** - * @brief Called when the request of the proxy is delivered. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s; - */ -typedef int (*rpc_port_stub_vc_initialize_cb)(rpc_port_stub_vc_context_h context, int pid, int *mgr_pid, int *service_state, int *daemon_pid, void *user_data); - -/** - * @brief Called when the request of the proxy is delivered. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s; - */ -typedef int (*rpc_port_stub_vc_finalize_cb)(rpc_port_stub_vc_context_h context, int pid, void *user_data); - -/** - * @brief Called when the request of the proxy is delivered. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s; - */ -typedef int (*rpc_port_stub_vc_set_command_cb)(rpc_port_stub_vc_context_h context, int pid, int cmd_type, void *user_data); - -/** - * @brief Called when the request of the proxy is delivered. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s; - */ -typedef int (*rpc_port_stub_vc_unset_command_cb)(rpc_port_stub_vc_context_h context, int pid, int cmd_type, void *user_data); - -/** - * @brief Called when the request of the proxy is delivered. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s; - */ -typedef int (*rpc_port_stub_vc_set_foreground_cb)(rpc_port_stub_vc_context_h context, int pid, bool value, void *user_data); - -/** - * @brief Called when the request of the proxy is delivered. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s; - */ -typedef int (*rpc_port_stub_vc_set_server_dialog_cb)(rpc_port_stub_vc_context_h context, int pid, const char *app_id, const char *credential, void *user_data); - -/** - * @brief Called when the request of the proxy is delivered. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s; - */ -typedef int (*rpc_port_stub_vc_request_dialog_cb)(rpc_port_stub_vc_context_h context, int pid, const char *disp_text, const char *utt_text, bool continuous, void *user_data); - -/** - * @brief Called when the request of the proxy is delivered. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s; - */ -typedef int (*rpc_port_stub_vc_is_system_command_valid_cb)(rpc_port_stub_vc_context_h context, int pid, bool *is_sys_cmd_valid, void *user_data); - -/** - * @brief Called when the request of the proxy is delivered. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s; - */ -typedef int (*rpc_port_stub_vc_auth_enable_cb)(rpc_port_stub_vc_context_h context, int pid, int mgr_pid, void *user_data); - -/** - * @brief Called when the request of the proxy is delivered. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s; - */ -typedef int (*rpc_port_stub_vc_auth_disable_cb)(rpc_port_stub_vc_context_h context, int pid, int mgr_pid, void *user_data); - -/** - * @brief Called when the request of the proxy is delivered. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s; - */ -typedef int (*rpc_port_stub_vc_auth_start_cb)(rpc_port_stub_vc_context_h context, int pid, int mgr_pid, void *user_data); - -/** - * @brief Called when the request of the proxy is delivered. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s; - */ -typedef int (*rpc_port_stub_vc_auth_stop_cb)(rpc_port_stub_vc_context_h context, int pid, int mgr_pid, void *user_data); - -/** - * @brief Called when the request of the proxy is delivered. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s; - */ -typedef int (*rpc_port_stub_vc_auth_cancel_cb)(rpc_port_stub_vc_context_h context, int pid, int mgr_pid, void *user_data); - -/** - * @brief Called when the request of the proxy is delivered. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s; - */ -typedef int (*rpc_port_stub_vc_request_tts_cb)(rpc_port_stub_vc_context_h context, int pid, const char *text, const char *lang, bool to_vcm, int *utt_id, void *user_data); - -/** - * @brief Called when the request of the proxy is delivered. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s; - */ -typedef int (*rpc_port_stub_vc_cancel_tts_cb)(rpc_port_stub_vc_context_h context, int pid, int utt_id, void *user_data); - -/** - * @brief Called when the request of the proxy is delivered. - * - * @param[in] context The context handle - * @param[in] user_data The user data passed from the registration function - * @see #rpc_port_stub_vc_callback_s; - */ -typedef int (*rpc_port_stub_vc_get_tts_audio_format_cb)(rpc_port_stub_vc_context_h context, int pid, int *rate, int *channel, int *audio_type, void *user_data); - -/** - * @brief Sets the tag to the context handle. - * - * @param[in] context The context handle - * @param[in] tag The tag - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @see rpc_port_stub_vc_context_get_tag() - */ -int rpc_port_stub_vc_context_set_tag(rpc_port_stub_vc_context_h context, void *tag); - -/** - * @brief Gets the tag from the context handle. - * - * @param[in] context The context handle - * @param[out] tag The tag - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @see rpc_port_stub_vc_context_set_tag() - */ -int rpc_port_stub_vc_context_get_tag(rpc_port_stub_vc_context_h context, void **tag); - -/** - * @brief Gets the sender ID from the context handle. - * @details The @a sender should be released using free(). - * - * @param[in] context The context handle - * @param[out] sender The sender ID of the context handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - */ -int rpc_port_stub_vc_context_get_sender(rpc_port_stub_vc_context_h context, char **sender); - -/** - * @brief Gets the instance ID from the context handle. - * @details The @a instance should be released using free(). - * - * @param[in] context The context handle - * @param[out] instance The instance ID of the context handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - */ -int rpc_port_stub_vc_context_get_instance(rpc_port_stub_vc_context_h context, char **instance); - -/** - * @brief Disconnects from the proxy. - * - * @param[in] context The context handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - */ -int rpc_port_stub_vc_context_disconnect(rpc_port_stub_vc_context_h context); - -/** - * @brief Creates a rpc_port_stub_vc_notify_cb handle. - * - * @param[out] h The rpc_port_stub_vc_notify_cb handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @see rpc_port_stub_vc_notify_cb_destroy() - */ -int rpc_port_stub_vc_notify_cb_create(rpc_port_stub_vc_notify_cb_h *h); - -/** - * @brief Destroys the rpc_port_stub_vc_notify_cb handle. - * - * @param[in] h The rpc_port_stub_vc_notify_cb handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @see rpc_port_stub_vc_notify_cb_clone() - */ -int rpc_port_stub_vc_notify_cb_destroy(rpc_port_stub_vc_notify_cb_h h); - -/** - * @brief Creates and returns a copy of the given rpc_port_stub_vc_notify_cb handle. - * - * @remarks A new created rpc_port_stub_vc_notify_cb should be released using - * the rpc_port_stub_vc_notify_cb_destroy() if it's no longer needed. - * @param[in] h The rpc_port_stub_vc_notify_cb handle - * @param[out] clone If successful, a new created rpc_port_stub_vc_notify_cb handle will be returned - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @see rpc_port_stub_vc_notify_cb_destroy() - */ -int rpc_port_stub_vc_notify_cb_clone(rpc_port_stub_vc_notify_cb_h h, rpc_port_stub_vc_notify_cb_h *clone); - -/** - * @brief Gets the ID of the rpc_port_stub_vc_notify_cb handle. - * - * @param[in] h The rpc_port_stub_vc_notify_cb handle - * @param[out] id The ID - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - */ -int rpc_port_stub_vc_notify_cb_get_id(rpc_port_stub_vc_notify_cb_h h, int *id); - -/** - * @brief Gets the sequence ID of the rpc_port_stub_vc_notify_cb handle. - * - * @param[in] h The rpc_port_stub_vc_notify_cb handle - * @param[out] seq_id The Sequence ID - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - */ -int rpc_port_stub_vc_notify_cb_get_seq_id(rpc_port_stub_vc_notify_cb_h h, int *seq_id); - -/** - * @brief Checks whether the delegate is for one-time or not. - * - * @param[in] h The rpc_port_stub_vc_notify_cb handle - * @param[out] once The flag, it's true, the handle is for one-time - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - */ -int rpc_port_stub_vc_notify_cb_is_once(rpc_port_stub_vc_notify_cb_h h, bool *once); - -/** - * @brief Gets the tag from the rpc_port_stub_vc_notify_cb handle. - * - * @remarks The @a tag should be released using free(). - * @param[in] h The rpc_port_stub_vc_notify_cb handle - * @param[out] tag The tag - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - */ -int rpc_port_stub_vc_notify_cb_get_tag(rpc_port_stub_vc_notify_cb_h h, char **tag); - -/** - * @brief Invokes the callback function of the rpc_port_stub_vc_notify_cb handle. - * - * @param[in] h The rpc_port_stub_vc_notify_cb handle - * @param[in] ... - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @retval #RPC_PORT_ERROR_IO_ERROR I/O error - */ -int rpc_port_stub_vc_notify_cb_invoke(rpc_port_stub_vc_notify_cb_h h, int pid, bundle *msg); - -/** - * @brief Creates a rpc_port_stub_vc_feedback_cb handle. - * - * @param[out] h The rpc_port_stub_vc_feedback_cb handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @see rpc_port_stub_vc_feedback_cb_destroy() - */ -int rpc_port_stub_vc_feedback_cb_create(rpc_port_stub_vc_feedback_cb_h *h); - -/** - * @brief Destroys the rpc_port_stub_vc_feedback_cb handle. - * - * @param[in] h The rpc_port_stub_vc_feedback_cb handle - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @see rpc_port_stub_vc_feedback_cb_clone() - */ -int rpc_port_stub_vc_feedback_cb_destroy(rpc_port_stub_vc_feedback_cb_h h); - -/** - * @brief Creates and returns a copy of the given rpc_port_stub_vc_feedback_cb handle. - * - * @remarks A new created rpc_port_stub_vc_feedback_cb should be released using - * the rpc_port_stub_vc_feedback_cb_destroy() if it's no longer needed. - * @param[in] h The rpc_port_stub_vc_feedback_cb handle - * @param[out] clone If successful, a new created rpc_port_stub_vc_feedback_cb handle will be returned - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @see rpc_port_stub_vc_feedback_cb_destroy() - */ -int rpc_port_stub_vc_feedback_cb_clone(rpc_port_stub_vc_feedback_cb_h h, rpc_port_stub_vc_feedback_cb_h *clone); - -/** - * @brief Gets the ID of the rpc_port_stub_vc_feedback_cb handle. - * - * @param[in] h The rpc_port_stub_vc_feedback_cb handle - * @param[out] id The ID - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - */ -int rpc_port_stub_vc_feedback_cb_get_id(rpc_port_stub_vc_feedback_cb_h h, int *id); - -/** - * @brief Gets the sequence ID of the rpc_port_stub_vc_feedback_cb handle. - * - * @param[in] h The rpc_port_stub_vc_feedback_cb handle - * @param[out] seq_id The Sequence ID - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - */ -int rpc_port_stub_vc_feedback_cb_get_seq_id(rpc_port_stub_vc_feedback_cb_h h, int *seq_id); - -/** - * @brief Checks whether the delegate is for one-time or not. - * - * @param[in] h The rpc_port_stub_vc_feedback_cb handle - * @param[out] once The flag, it's true, the handle is for one-time - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - */ -int rpc_port_stub_vc_feedback_cb_is_once(rpc_port_stub_vc_feedback_cb_h h, bool *once); - -/** - * @brief Gets the tag from the rpc_port_stub_vc_feedback_cb handle. - * - * @remarks The @a tag should be released using free(). - * @param[in] h The rpc_port_stub_vc_feedback_cb handle - * @param[out] tag The tag - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - */ -int rpc_port_stub_vc_feedback_cb_get_tag(rpc_port_stub_vc_feedback_cb_h h, char **tag); - -/** - * @brief Invokes the callback function of the rpc_port_stub_vc_feedback_cb handle. - * - * @param[in] h The rpc_port_stub_vc_feedback_cb handle - * @param[in] ... - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @retval #RPC_PORT_ERROR_IO_ERROR I/O error - */ -int rpc_port_stub_vc_feedback_cb_invoke(rpc_port_stub_vc_feedback_cb_h h, int utt_id, int event, rpc_port_stub_array_char_h pcm_data, int len); - -/** - * @brief The structure type containing the set of callback functions for handling stub events. - * @details It is one of the input parameters of the rpc_port_stub_vc_register() function. - * - * @see rpc_port_stub_vc_create_cb - * @see rpc_port_stub_vc_terminate_cb - */ -typedef struct { - rpc_port_stub_vc_create_cb create; /**< This callback function is invoked when the proxy is connected. */ - rpc_port_stub_vc_terminate_cb terminate; /**< This callback function is invoked when the proxy is disconnected. */ - rpc_port_stub_vc_register_notify_cb_cb register_notify_cb; /**< This callback function is invoked when the register_notify_cb request is delivered. */ - rpc_port_stub_vc_register_notify_cb_sync_cb register_notify_cb_sync; /**< This callback function is invoked when the register_notify_cb_sync request is delivered. */ - rpc_port_stub_vc_register_feedback_cb_cb register_feedback_cb; /**< This callback function is invoked when the register_feedback_cb request is delivered. */ - rpc_port_stub_vc_register_feedback_cb_sync_cb register_feedback_cb_sync; /**< This callback function is invoked when the register_feedback_cb_sync request is delivered. */ - rpc_port_stub_vc_initialize_cb initialize; /**< This callback function is invoked when the initialize request is delivered. */ - rpc_port_stub_vc_finalize_cb finalize; /**< This callback function is invoked when the finalize request is delivered. */ - rpc_port_stub_vc_set_command_cb set_command; /**< This callback function is invoked when the set_command request is delivered. */ - rpc_port_stub_vc_unset_command_cb unset_command; /**< This callback function is invoked when the unset_command request is delivered. */ - rpc_port_stub_vc_set_foreground_cb set_foreground; /**< This callback function is invoked when the set_foreground request is delivered. */ - rpc_port_stub_vc_set_server_dialog_cb set_server_dialog; /**< This callback function is invoked when the set_server_dialog request is delivered. */ - rpc_port_stub_vc_request_dialog_cb request_dialog; /**< This callback function is invoked when the request_dialog request is delivered. */ - rpc_port_stub_vc_is_system_command_valid_cb is_system_command_valid; /**< This callback function is invoked when the is_system_command_valid request is delivered. */ - rpc_port_stub_vc_auth_enable_cb auth_enable; /**< This callback function is invoked when the auth_enable request is delivered. */ - rpc_port_stub_vc_auth_disable_cb auth_disable; /**< This callback function is invoked when the auth_disable request is delivered. */ - rpc_port_stub_vc_auth_start_cb auth_start; /**< This callback function is invoked when the auth_start request is delivered. */ - rpc_port_stub_vc_auth_stop_cb auth_stop; /**< This callback function is invoked when the auth_stop request is delivered. */ - rpc_port_stub_vc_auth_cancel_cb auth_cancel; /**< This callback function is invoked when the auth_cancel request is delivered. */ - rpc_port_stub_vc_request_tts_cb request_tts; /**< This callback function is invoked when the request_tts request is delivered. */ - rpc_port_stub_vc_cancel_tts_cb cancel_tts; /**< This callback function is invoked when the cancel_tts request is delivered. */ - rpc_port_stub_vc_get_tts_audio_format_cb get_tts_audio_format; /**< This callback function is invoked when the get_tts_audio_format request is delivered. */ -} rpc_port_stub_vc_callback_s; - -/** - * @brief Registers the set of the callback functions and the port. - * @details This function registers the set of the callback functions to handle stub events. - * And, the rpc_port_stub_listen() is called internally to handle events. - * - * @param[in] callback The set of callback functions to handle stub events - * @param[in] user_data The user data to be passed to the callback function - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #RPC_PORT_ERROR_OUT_OF_MEMORY Out of memory - * @retval #RPC_PORT_ERROR_IO_ERROR I/O error - * @retval #RPC_PORT_ERROR_PERMISSION_DENIED Permission denied - * @see rpc_port_stub_vc_unregister() - * @see #rpc_port_stub_vc_callback_s - */ -int rpc_port_stub_vc_register(rpc_port_stub_vc_callback_s *callback, void *user_data); - -/** - * @brief Unregisters the registered port. - */ -int rpc_port_stub_vc_unregister(void); - -/** - * @brief Retrieves the connected context handles. - * - * @param[in] callback The callback function - * @param[in] user_data The user data to be passed to the callback function - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - * @see rpc_port_stub_vc_context_cb() - */ -int rpc_port_stub_vc_foreach_context(rpc_port_stub_vc_context_cb callback, void *user_data); - -/** - * @brief Gets the number of connected clients. - * - * @param[out] client_number The client number - * @return @c 0 on success, - * otherwise a negative error value - * @retval #RPC_PORT_ERROR_NONE Successful - * @retval #RPC_PORT_ERROR_INVALID_PARAMETER Invalid parameter - */ -int rpc_port_stub_vc_get_client_number(unsigned int *client_number); - -#ifdef __cplusplus -} -#endif diff --git a/server/vcd_tidl.c b/server/vcd_tidl.c index 354cf21..8d6f305 100644 --- a/server/vcd_tidl.c +++ b/server/vcd_tidl.c @@ -27,23 +27,26 @@ #include "vcd_widget_proxy.h" -static rpc_port_stub_vc_mgr_callback_s g_mgr_callback; +static rpc_port_stub_vcd_mgr_stub_vc_mgr_callback_s g_mgr_callback; static pthread_mutex_t g_mgr_tidl_info_mutex = PTHREAD_MUTEX_INITIALIZER; -static rpc_port_stub_vc_widget_callback_s g_widget_callback; +static rpc_port_stub_vcd_widget_stub_vc_widget_callback_s g_widget_callback; static pthread_mutex_t g_widget_tidl_info_mutex = PTHREAD_MUTEX_INITIALIZER; -static rpc_port_stub_vc_callback_s g_vc_callback; +static rpc_port_stub_vcd_stub_vc_callback_s g_vc_callback; static int g_volume_count = 0; +int vcd_client_tidl_open_connection(); +int vcd_client_tidl_close_connection(); int vcd_mgr_tidl_open_connection(); int vcd_mgr_tidl_close_connection(); int vcd_widget_tidl_open_connection(); int vcd_widget_tidl_close_connection(); + /* for common request */ static void __request_tidl_connect(vcd_client_type_e type, int pid) { @@ -61,7 +64,7 @@ static void __request_tidl_connect(vcd_client_type_e type, int pid) return; } - ret = rpc_port_proxy_vcd_mgr_connect(mgr_tidl_info->rpc_h); + ret = rpc_port_proxy_vcd_mgr_proxy_vcd_mgr_connect(mgr_tidl_info->rpc_h); if (0 == ret) { mgr_tidl_info->connection_requesting = true; @@ -97,7 +100,7 @@ static void __request_tidl_connect(vcd_client_type_e type, int pid) return; } - ret = rpc_port_proxy_vcd_widget_connect(widget_tidl_info->rpc_h); + ret = rpc_port_proxy_vcd_widget_proxy_vcd_widget_connect(widget_tidl_info->rpc_h); if (0 == ret) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated"); @@ -131,14 +134,14 @@ void __send_msg(bundle* msg, vcd_client_type_e type, int pid) return; } - rpc_port_stub_vc_mgr_notify_cb_h handle = mgr_tidl_info->notify_cb; + rpc_port_stub_vcd_mgr_stub_vc_mgr_notify_cb_h handle = mgr_tidl_info->notify_cb; if (NULL == handle) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null"); pthread_mutex_unlock(&g_mgr_tidl_info_mutex); return; } - if (0 != rpc_port_stub_vc_mgr_notify_cb_invoke(handle, msg)) { + if (0 != rpc_port_stub_vcd_mgr_stub_vc_mgr_notify_cb_invoke(handle, msg)) { SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg"); pthread_mutex_unlock(&g_mgr_tidl_info_mutex); return; @@ -180,14 +183,14 @@ void __send_msg(bundle* msg, vcd_client_type_e type, int pid) return; } - rpc_port_stub_vc_widget_notify_cb_h handle = widget_tidl_info->notify_cb; + rpc_port_stub_vcd_widget_stub_vc_widget_notify_cb_h handle = widget_tidl_info->notify_cb; if (NULL == handle) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null"); pthread_mutex_unlock(&g_widget_tidl_info_mutex); return; } - if (0 != rpc_port_stub_vc_widget_notify_cb_invoke(handle, msg)) { + if (0 != rpc_port_stub_vcd_widget_stub_vc_widget_notify_cb_invoke(handle, msg)) { SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg"); pthread_mutex_unlock(&g_widget_tidl_info_mutex); return; @@ -213,14 +216,14 @@ void __send_signal(bundle* msg) return; } - rpc_port_stub_vc_mgr_notify_cb_h handle = mgr_tidl_info->notify_cb; + rpc_port_stub_vcd_mgr_stub_vc_mgr_notify_cb_h handle = mgr_tidl_info->notify_cb; if (NULL == handle) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null"); pthread_mutex_unlock(&g_mgr_tidl_info_mutex); return; } - if (0 != rpc_port_stub_vc_mgr_notify_cb_invoke(handle, msg)) { + if (0 != rpc_port_stub_vcd_mgr_stub_vc_mgr_notify_cb_invoke(handle, msg)) { SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg"); pthread_mutex_unlock(&g_mgr_tidl_info_mutex); return; @@ -296,13 +299,13 @@ void __send_signal(bundle* msg) SLOG(LOG_INFO, TAG_VCD, "[TIDL] message to widget"); - rpc_port_stub_vc_widget_notify_cb_h handle = widget_tidl_info->notify_cb; + rpc_port_stub_vcd_widget_stub_vc_widget_notify_cb_h handle = widget_tidl_info->notify_cb; if (NULL == handle) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null"); break; } - if (0 != rpc_port_stub_vc_widget_notify_cb_invoke(handle, msg)) { + if (0 != rpc_port_stub_vcd_widget_stub_vc_widget_notify_cb_invoke(handle, msg)) { SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg"); break; } @@ -316,13 +319,13 @@ void __send_signal(bundle* msg) /** * TIDL functions for VC client */ -static void __vc_create_cb(rpc_port_stub_vc_context_h context, void *user_data) +static void __vc_create_cb(rpc_port_stub_vcd_stub_vc_context_h context, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_create_cb"); char *sender = NULL; - rpc_port_stub_vc_context_get_sender(context, &sender); + rpc_port_stub_vcd_stub_vc_context_get_sender(context, &sender); if (!sender) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Sender is NULL"); return ; @@ -332,12 +335,12 @@ static void __vc_create_cb(rpc_port_stub_vc_context_h context, void *user_data) free(sender); } -static void __vc_terminate_cb(rpc_port_stub_vc_context_h context, void *user_data) +static void __vc_terminate_cb(rpc_port_stub_vcd_stub_vc_context_h context, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_terminate_cb"); } -static void __vc_register_notify_cb_cb(rpc_port_stub_vc_context_h context, int pid, rpc_port_stub_vc_notify_cb_h callback, void *user_data) +static void __vc_register_notify_cb_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, rpc_port_stub_vcd_stub_vc_notify_cb_h callback, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_register_notify_cb_cb. pid(%d)", pid); @@ -361,7 +364,7 @@ static void __vc_register_notify_cb_cb(rpc_port_stub_vc_context_h context, int p } } -static int __vc_register_notify_cb_sync_cb(rpc_port_stub_vc_context_h context, int pid, rpc_port_stub_vc_notify_cb_h callback, void *user_data) +static int __vc_register_notify_cb_sync_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, rpc_port_stub_vcd_stub_vc_notify_cb_h callback, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_register_notify_cb_sync_cb. pid(%d)", pid); @@ -387,7 +390,7 @@ static int __vc_register_notify_cb_sync_cb(rpc_port_stub_vc_context_h context, i return ret; } -static void __vc_register_feedback_cb_cb(rpc_port_stub_vc_context_h context, int pid, rpc_port_stub_vc_feedback_cb_h callback, void *user_data) +static void __vc_register_feedback_cb_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, rpc_port_stub_vcd_stub_vc_feedback_cb_h callback, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_register_feedback_cb_cb. pid(%d)", pid); @@ -411,7 +414,7 @@ static void __vc_register_feedback_cb_cb(rpc_port_stub_vc_context_h context, int } } -static int __vc_register_feedback_cb_sync_cb(rpc_port_stub_vc_context_h context, int pid, rpc_port_stub_vc_feedback_cb_h callback, void *user_data) +static int __vc_register_feedback_cb_sync_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, rpc_port_stub_vcd_stub_vc_feedback_cb_h callback, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_register_feedback_cb_sync_cb. pid(%d)", pid); @@ -437,7 +440,7 @@ static int __vc_register_feedback_cb_sync_cb(rpc_port_stub_vc_context_h context, return ret; } -static int __vc_initialize_cb(rpc_port_stub_vc_context_h context, int pid, int *mgr_pid, int *service_state, int *daemon_pid, void *user_data) +static int __vc_initialize_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int *mgr_pid, int *service_state, int *daemon_pid, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_initialize_cb. pid(%d)", pid); @@ -457,7 +460,7 @@ static int __vc_initialize_cb(rpc_port_stub_vc_context_h context, int pid, int * return ret; } -static int __vc_finalize_cb(rpc_port_stub_vc_context_h context, int pid, void *user_data) +static int __vc_finalize_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_finalize_cb"); @@ -473,7 +476,7 @@ static int __vc_finalize_cb(rpc_port_stub_vc_context_h context, int pid, void *u return ret; } -static int __vc_set_command_cb(rpc_port_stub_vc_context_h context, int pid, int cmd_type, void *user_data) +static int __vc_set_command_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int cmd_type, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_set_command_cb"); @@ -489,7 +492,7 @@ static int __vc_set_command_cb(rpc_port_stub_vc_context_h context, int pid, int return ret; } -static int __vc_unset_command_cb(rpc_port_stub_vc_context_h context, int pid, int cmd_type, void *user_data) +static int __vc_unset_command_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int cmd_type, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_unset_command_cb"); @@ -505,7 +508,7 @@ static int __vc_unset_command_cb(rpc_port_stub_vc_context_h context, int pid, in return ret; } -static int __vc_set_foreground_cb(rpc_port_stub_vc_context_h context, int pid, bool value, void *user_data) +static int __vc_set_foreground_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, bool value, void *user_data) { // check more... SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_set_foreground_cb"); @@ -522,7 +525,7 @@ static int __vc_set_foreground_cb(rpc_port_stub_vc_context_h context, int pid, b return ret; } -static int __vc_set_server_dialog_cb(rpc_port_stub_vc_context_h context, int pid, const char *app_id, const char *credential, void *user_data) +static int __vc_set_server_dialog_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, const char *app_id, const char *credential, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_set_server_dialog_cb"); @@ -538,7 +541,7 @@ static int __vc_set_server_dialog_cb(rpc_port_stub_vc_context_h context, int pid return ret; } -static int __vc_request_dialog_cb(rpc_port_stub_vc_context_h context, int pid, const char *disp_text, const char *utt_text, bool continuous, void *user_data) +static int __vc_request_dialog_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, const char *disp_text, const char *utt_text, bool continuous, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_request_dialog_cb"); @@ -554,7 +557,7 @@ static int __vc_request_dialog_cb(rpc_port_stub_vc_context_h context, int pid, c return ret; } -static int __vc_is_system_command_valid_cb(rpc_port_stub_vc_context_h context, int pid, bool *is_sys_cmd_valid, void *user_data) +static int __vc_is_system_command_valid_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, bool *is_sys_cmd_valid, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_is_system_command_valid_cb"); @@ -570,7 +573,7 @@ static int __vc_is_system_command_valid_cb(rpc_port_stub_vc_context_h context, i return ret; } -static int __vc_auth_enable_cb(rpc_port_stub_vc_context_h context, int pid, int mgr_pid, void *user_data) +static int __vc_auth_enable_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int mgr_pid, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_enable_cb. Send a request to vc_mgr"); @@ -587,7 +590,7 @@ static int __vc_auth_enable_cb(rpc_port_stub_vc_context_h context, int pid, int return VCD_ERROR_NONE; } -static int __vc_auth_disable_cb(rpc_port_stub_vc_context_h context, int pid, int mgr_pid, void *user_data) +static int __vc_auth_disable_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int mgr_pid, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_disable_cb. Send a request to vc_mgr"); @@ -604,7 +607,7 @@ static int __vc_auth_disable_cb(rpc_port_stub_vc_context_h context, int pid, int return VCD_ERROR_NONE; } -static int __vc_auth_start_cb(rpc_port_stub_vc_context_h context, int pid, int mgr_pid, void *user_data) +static int __vc_auth_start_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int mgr_pid, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_start_cb. Send a request to vc_mgr"); @@ -621,7 +624,7 @@ static int __vc_auth_start_cb(rpc_port_stub_vc_context_h context, int pid, int m return VCD_ERROR_NONE; } -static int __vc_auth_stop_cb(rpc_port_stub_vc_context_h context, int pid, int mgr_pid, void *user_data) +static int __vc_auth_stop_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int mgr_pid, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_stop_cb. Send a request to vc_mgr"); @@ -638,7 +641,7 @@ static int __vc_auth_stop_cb(rpc_port_stub_vc_context_h context, int pid, int mg return VCD_ERROR_NONE; } -static int __vc_auth_cancel_cb(rpc_port_stub_vc_context_h context, int pid, int mgr_pid, void *user_data) +static int __vc_auth_cancel_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int mgr_pid, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_cancel_cb. Send a request to vc_mgr"); @@ -655,7 +658,7 @@ static int __vc_auth_cancel_cb(rpc_port_stub_vc_context_h context, int pid, int return VCD_ERROR_NONE; } -static int __vc_request_tts_cb(rpc_port_stub_vc_context_h context, int pid, const char *text, const char *lang, bool to_vcm, int *utt_id, void *user_data) +static int __vc_request_tts_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, const char *text, const char *lang, bool to_vcm, int *utt_id, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_request_tts_cb"); @@ -671,7 +674,7 @@ static int __vc_request_tts_cb(rpc_port_stub_vc_context_h context, int pid, cons return ret; } -static int __vc_cancel_tts_cb(rpc_port_stub_vc_context_h context, int pid, int utt_id, void *user_data) +static int __vc_cancel_tts_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int utt_id, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_cancel_tts_cb"); @@ -687,7 +690,7 @@ static int __vc_cancel_tts_cb(rpc_port_stub_vc_context_h context, int pid, int u return ret; } -static int __vc_get_tts_audio_format_cb(rpc_port_stub_vc_context_h context, int pid, int *rate, int *channel, int *audio_type, void *user_data) +static int __vc_get_tts_audio_format_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int *rate, int *channel, int *audio_type, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_get_tts_audio_format_cb"); @@ -703,9 +706,9 @@ static int __vc_get_tts_audio_format_cb(rpc_port_stub_vc_context_h context, int return ret; } -int vcd_tidl_open_connection() +int vcd_client_tidl_open_connection() { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] vcd_tidl_open_connection"); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] vcd_client_tidl_open_connection"); g_vc_callback.create = __vc_create_cb; g_vc_callback.terminate = __vc_terminate_cb; @@ -731,7 +734,7 @@ int vcd_tidl_open_connection() g_vc_callback.get_tts_audio_format = __vc_get_tts_audio_format_cb; int ret = -1; - ret = rpc_port_stub_vc_register(&g_vc_callback, NULL); + ret = rpc_port_stub_vcd_stub_vc_register(&g_vc_callback, NULL); if (VCD_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to register TIDL callbacks. ret(%d)", ret); return VCD_ERROR_OPERATION_FAILED; @@ -740,10 +743,10 @@ int vcd_tidl_open_connection() return VCD_ERROR_NONE; } -int vcd_tidl_close_connection() +int vcd_client_tidl_close_connection() { SLOG(LOG_INFO, TAG_VCD, "[TIDL] vcd_tidl_close_connection"); - rpc_port_stub_vc_unregister(); + rpc_port_stub_vcd_stub_vc_unregister(); return VCD_ERROR_NONE; } @@ -791,7 +794,7 @@ int vcdc_send_result(int pid, int manager_pid, int cmd_type) return -1; } - rpc_port_stub_vc_notify_cb_invoke(info->notify_cb, pid, bundle_data); + rpc_port_stub_vcd_stub_vc_notify_cb_invoke(info->notify_cb, pid, bundle_data); return VCD_ERROR_NONE; } @@ -827,7 +830,7 @@ int vcdc_send_error_signal_to_app(int pid, int reason, char *err_msg) bundle_add_str(bundle_data, VC_BUNDLE_REASON, reason_char); bundle_add_str(bundle_data, VC_BUNDLE_ERR_MSG, err_msg); - rpc_port_stub_vc_notify_cb_invoke(info->notify_cb, pid, bundle_data); + rpc_port_stub_vcd_stub_vc_notify_cb_invoke(info->notify_cb, pid, bundle_data); return VCD_ERROR_NONE; } @@ -875,7 +878,7 @@ int vcdc_send_manager_pid(int manager_pid) bundle_add_str(bundle_data, VC_BUNDLE_PID, pid_char); bundle_add_str(bundle_data, VC_BUNDLE_MANAGER_PID, mgrpid_char); - rpc_port_stub_vc_notify_cb_invoke(info->notify_cb, pid, bundle_data); + rpc_port_stub_vcd_stub_vc_notify_cb_invoke(info->notify_cb, pid, bundle_data); bundle_free(bundle_data); } @@ -904,11 +907,11 @@ int vcdc_send_feedback_streaming(int pid, int utt_id, vc_feedback_event_e event, SLOG(LOG_INFO, TAG_VCD, "[TIDL] Send feedback streaming to app(%d), utt_id(%d), event(%d), length(%d)", pid, utt_id, event, len); - rpc_port_stub_array_char_h arr_char = NULL; - rpc_port_stub_array_char_create(&arr_char); - rpc_port_stub_array_char_set(arr_char, buffer, len); + rpc_port_stub_vcd_stub_array_char_h arr_char = NULL; + rpc_port_stub_vcd_stub_array_char_create(&arr_char); + rpc_port_stub_vcd_stub_array_char_set(arr_char, buffer, len); - rpc_port_stub_vc_feedback_cb_invoke(info->feedback_cb, utt_id, event, arr_char, len); + rpc_port_stub_vcd_stub_vc_feedback_cb_invoke(info->feedback_cb, utt_id, event, arr_char, len); return VCD_ERROR_NONE; } @@ -955,11 +958,10 @@ int vcd_tidl_open_connection() return VCD_ERROR_OPERATION_FAILED; } - // TODO: uncomment after client done - // if (0 != vcd_client_tidl_open_connection()) { - // SLOG(LOG_ERROR, TAG_VCD, "Fail to open connection to client"); - // return VCD_ERROR_OPERATION_FAILED; - // } + if (0 != vcd_client_tidl_open_connection()) { + SLOG(LOG_ERROR, TAG_VCD, "Fail to open connection to client"); + return VCD_ERROR_OPERATION_FAILED; + } if (0 != vcd_widget_tidl_open_connection()) { SLOG(LOG_ERROR, TAG_VCD, "Fail to open connection to widget"); @@ -978,11 +980,10 @@ int vcd_tidl_close_connection() return VCD_ERROR_OPERATION_FAILED; } - // TODO: uncomment after client done - // if (0 != vcd_client_tidl_close_connection()) { - // SLOG(LOG_ERROR, TAG_VCD, "Fail to close connection to client"); - // return VCD_ERROR_OPERATION_FAILED; - // } + if (0 != vcd_client_tidl_close_connection()) { + SLOG(LOG_ERROR, TAG_VCD, "Fail to close connection to client"); + return VCD_ERROR_OPERATION_FAILED; + } if (0 != vcd_widget_tidl_close_connection()) { SLOG(LOG_ERROR, TAG_VCD, "Fail to close connection to widget"); @@ -1360,15 +1361,15 @@ int vcdc_send_feedback_streaming_to_manager(int manager_pid, int pid, int utt_id bundle_add_str(msg, VC_MANAGER_BUNDLE_UTTID, tmp_utt_id); bundle_add_str(msg, VC_MANAGER_BUNDLE_EVENT, tmp_event); - rpc_port_stub_array_char_h streaming_data = NULL; - rpc_port_stub_array_char_create(&streaming_data); + rpc_port_stub_vcd_mgr_stub_array_char_h streaming_data = NULL; + rpc_port_stub_vcd_mgr_stub_array_char_create(&streaming_data); if (NULL == streaming_data) { SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to create data handle"); return VCD_ERROR_OUT_OF_MEMORY; } if (NULL != buffer && 0 < len) { - rpc_port_stub_array_char_set(streaming_data, (char*)buffer, len); + rpc_port_stub_vcd_mgr_stub_array_char_set(streaming_data, (char*)buffer, len); } else { SLOG(LOG_ERROR, TAG_VCD, "[TIDL] buffer is empty"); } @@ -1382,29 +1383,29 @@ int vcdc_send_feedback_streaming_to_manager(int manager_pid, int pid, int utt_id if (NULL == mgr_tidl_info) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get manager tidl info. pid(%d)", pid); pthread_mutex_unlock(&g_mgr_tidl_info_mutex); - rpc_port_stub_array_char_destroy(streaming_data); + rpc_port_stub_vcd_mgr_stub_array_char_destroy(streaming_data); bundle_free(msg); return VCD_ERROR_OPERATION_FAILED; } - rpc_port_stub_vc_mgr_send_buffer_cb_h handle = mgr_tidl_info->send_buffer_cb; + rpc_port_stub_vcd_mgr_stub_vc_mgr_send_buffer_cb_h handle = mgr_tidl_info->send_buffer_cb; if (NULL == handle) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null"); pthread_mutex_unlock(&g_mgr_tidl_info_mutex); - rpc_port_stub_array_char_destroy(streaming_data); + rpc_port_stub_vcd_mgr_stub_array_char_destroy(streaming_data); bundle_free(msg); return VCD_ERROR_OPERATION_FAILED; } - if (0 != rpc_port_stub_vc_mgr_send_buffer_cb_invoke(handle, streaming_data, msg)) { + if (0 != rpc_port_stub_vcd_mgr_stub_vc_mgr_send_buffer_cb_invoke(handle, streaming_data, msg)) { SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg"); pthread_mutex_unlock(&g_mgr_tidl_info_mutex); - rpc_port_stub_array_char_destroy(streaming_data); + rpc_port_stub_vcd_mgr_stub_array_char_destroy(streaming_data); bundle_free(msg); return VCD_ERROR_OPERATION_FAILED; } pthread_mutex_unlock(&g_mgr_tidl_info_mutex); - rpc_port_stub_array_char_destroy(streaming_data); + rpc_port_stub_vcd_mgr_stub_array_char_destroy(streaming_data); bundle_free(msg); return VCD_ERROR_NONE; @@ -1426,7 +1427,7 @@ void vcdc_send_request_set_foreground(int pid, int value) return; } - rpc_port_proxy_vcd_mgr_invoke_set_foreground(mgr_tidl_info->rpc_h, pid, value); + rpc_port_proxy_vcd_mgr_proxy_vcd_mgr_invoke_set_foreground(mgr_tidl_info->rpc_h, pid, value); SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Request set foreground"); } @@ -1448,7 +1449,7 @@ int vcdc_send_request_get_private_data(int pid, const char* key, char** data) } char *tmp = NULL; - int ret = rpc_port_proxy_vcd_mgr_invoke_get_private_data(mgr_tidl_info->rpc_h, pid, key, &tmp); + int ret = rpc_port_proxy_vcd_mgr_proxy_vcd_mgr_invoke_get_private_data(mgr_tidl_info->rpc_h, pid, key, &tmp); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request vcd manager get private data : Fail to invoke message, error(%d)", ret); return ret; @@ -1476,7 +1477,7 @@ int vcdc_send_request_auth_enable(int pid) return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vcd_mgr_invoke_auth_enable(mgr_tidl_info->rpc_h, pid); + int ret = rpc_port_proxy_vcd_mgr_proxy_vcd_mgr_invoke_auth_enable(mgr_tidl_info->rpc_h, pid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request auth enable : Fail to invoke message, error(%d)", ret); return ret; @@ -1502,7 +1503,7 @@ int vcdc_send_request_auth_disable(int pid) return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vcd_mgr_invoke_auth_disable(mgr_tidl_info->rpc_h, pid); + int ret = rpc_port_proxy_vcd_mgr_proxy_vcd_mgr_invoke_auth_disable(mgr_tidl_info->rpc_h, pid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request auth disable : Fail to invoke message, error(%d)", ret); return ret; @@ -1528,7 +1529,7 @@ int vcdc_send_request_auth_start(int pid) return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vcd_mgr_invoke_auth_start(mgr_tidl_info->rpc_h, pid); + int ret = rpc_port_proxy_vcd_mgr_proxy_vcd_mgr_invoke_auth_start(mgr_tidl_info->rpc_h, pid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request auth start : Fail to invoke message, error(%d)", ret); return ret; @@ -1554,7 +1555,7 @@ int vcdc_send_request_auth_stop(int pid) return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vcd_mgr_invoke_auth_stop(mgr_tidl_info->rpc_h, pid); + int ret = rpc_port_proxy_vcd_mgr_proxy_vcd_mgr_invoke_auth_stop(mgr_tidl_info->rpc_h, pid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request auth stop : Fail to invoke message, error(%d)", ret); return ret; @@ -1580,7 +1581,7 @@ int vcdc_send_request_auth_cancel(int pid) return VC_ERROR_OPERATION_FAILED; } - int ret = rpc_port_proxy_vcd_mgr_invoke_auth_cancel(mgr_tidl_info->rpc_h, pid); + int ret = rpc_port_proxy_vcd_mgr_proxy_vcd_mgr_invoke_auth_cancel(mgr_tidl_info->rpc_h, pid); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request auth cancel : Fail to invoke message, error(%d)", ret); return ret; @@ -1607,7 +1608,7 @@ int vcdc_send_asr_result(int pid, int event, const char* asr_result, int cmd_typ } bool temp; - int ret = rpc_port_proxy_vcd_widget_invoke_send_asr_result(widget_tidl_info->rpc_h, pid, event, asr_result, &temp); + int ret = rpc_port_proxy_vcd_widget_proxy_vcd_widget_invoke_send_asr_result(widget_tidl_info->rpc_h, pid, event, asr_result, &temp); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request vcd widget send asr result : Fail to invoke message, error(%d)", ret); return ret; @@ -1622,7 +1623,7 @@ int vcdc_send_asr_result(int pid, int event, const char* asr_result, int cmd_typ /* * Tidl for manager */ -static void __mgr_on_connected(rpc_port_proxy_vcd_mgr_h h, void *user_data) +static void __mgr_on_connected(rpc_port_proxy_vcd_mgr_proxy_vcd_mgr_h h, void *user_data) { manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info(); @@ -1637,7 +1638,7 @@ static void __mgr_on_connected(rpc_port_proxy_vcd_mgr_h h, void *user_data) SLOG(LOG_INFO, TAG_VCD, "Connected to manager"); } -static void __mgr_on_disconnected(rpc_port_proxy_vcd_mgr_h h, void *user_data) +static void __mgr_on_disconnected(rpc_port_proxy_vcd_mgr_proxy_vcd_mgr_h h, void *user_data) { manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info(); @@ -1652,7 +1653,7 @@ static void __mgr_on_disconnected(rpc_port_proxy_vcd_mgr_h h, void *user_data) SLOG(LOG_INFO, TAG_VCD, "Disonnected to manager"); } -static void __mgr_on_rejected(rpc_port_proxy_vcd_mgr_h h, void *user_data) +static void __mgr_on_rejected(rpc_port_proxy_vcd_mgr_proxy_vcd_mgr_h h, void *user_data) { manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info(); @@ -1666,17 +1667,17 @@ static void __mgr_on_rejected(rpc_port_proxy_vcd_mgr_h h, void *user_data) SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Rejected from manager"); } -static rpc_port_proxy_vcd_mgr_h __mgr_create_rpc_port(const char* engine_app_id) +static rpc_port_proxy_vcd_mgr_proxy_vcd_mgr_h __mgr_create_rpc_port(const char* engine_app_id) { SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] __mgr_create_rpc_port"); - rpc_port_proxy_vcd_mgr_callback_s rpc_callback = { + rpc_port_proxy_vcd_mgr_proxy_vcd_mgr_callback_s rpc_callback = { .connected = __mgr_on_connected, .disconnected = __mgr_on_disconnected, .rejected = __mgr_on_rejected }; - rpc_port_proxy_vcd_mgr_h handle = NULL; - if (0 != rpc_port_proxy_vcd_mgr_create(engine_app_id, &rpc_callback, NULL, &handle)) { + rpc_port_proxy_vcd_mgr_proxy_vcd_mgr_h handle = NULL; + if (0 != rpc_port_proxy_vcd_mgr_proxy_vcd_mgr_create(engine_app_id, &rpc_callback, NULL, &handle)) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create proxy"); return NULL; } @@ -1684,11 +1685,11 @@ static rpc_port_proxy_vcd_mgr_h __mgr_create_rpc_port(const char* engine_app_id) return handle; } -static void __vc_mgr_create_cb(rpc_port_stub_vc_mgr_context_h context, void *user_data) +static void __vc_mgr_create_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, void *user_data) { char *sender = NULL; - rpc_port_stub_vc_mgr_context_get_sender(context, &sender); + rpc_port_stub_vcd_mgr_stub_vc_mgr_context_get_sender(context, &sender); if (!sender){ SLOG(LOG_ERROR, TAG_VCD, "Sender is NULL"); return; @@ -1699,7 +1700,7 @@ static void __vc_mgr_create_cb(rpc_port_stub_vc_mgr_context_h context, void *use free(sender); } -static void __vc_mgr_terminate_cb(rpc_port_stub_vc_mgr_context_h context, void *user_data) +static void __vc_mgr_terminate_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, void *user_data) { pthread_mutex_lock(&g_mgr_tidl_info_mutex); manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info(); @@ -1730,7 +1731,7 @@ static void __vc_mgr_terminate_cb(rpc_port_stub_vc_mgr_context_h context, void * char *sender = NULL; - rpc_port_stub_vc_mgr_context_get_sender(context, &sender); + rpc_port_stub_vcd_mgr_stub_vc_mgr_context_get_sender(context, &sender); if (!sender) return; @@ -1739,7 +1740,7 @@ static void __vc_mgr_terminate_cb(rpc_port_stub_vc_mgr_context_h context, void * free(sender); } -static void __vc_mgr_register_cb_cb(rpc_port_stub_vc_mgr_context_h context, int pid, rpc_port_stub_vc_mgr_notify_cb_h notify_callback, rpc_port_stub_vc_mgr_send_buffer_cb_h send_buffer_callback, void *user_data) +static void __vc_mgr_register_cb_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, rpc_port_stub_vcd_mgr_stub_vc_mgr_notify_cb_h notify_callback, rpc_port_stub_vcd_mgr_stub_vc_mgr_send_buffer_cb_h send_buffer_callback, void *user_data) { pthread_mutex_lock(&g_mgr_tidl_info_mutex); SLOG(LOG_INFO, TAG_VCD, "@@@ VC MANAGER REGISTER CALLBACK"); @@ -1762,7 +1763,7 @@ static void __vc_mgr_register_cb_cb(rpc_port_stub_vc_mgr_context_h context, int } char *sender = NULL; - rpc_port_stub_vc_mgr_context_get_sender(context, &sender); + rpc_port_stub_vcd_mgr_stub_vc_mgr_context_get_sender(context, &sender); if (!sender){ SLOG(LOG_ERROR, TAG_VCD, "Sender is NULL"); @@ -1799,7 +1800,7 @@ static void __vc_mgr_register_cb_cb(rpc_port_stub_vc_mgr_context_h context, int SLOG(LOG_DEBUG, TAG_VCD, "@@@"); } -static int __vc_mgr_initialize_cb(rpc_port_stub_vc_mgr_context_h context, int pid, int audio_streaming_mode, int *service_state, int *foreground, int *daemon_pid, void *user_data) +static int __vc_mgr_initialize_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, int audio_streaming_mode, int *service_state, int *foreground, int *daemon_pid, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "@@@ VCD Manager Initialize"); @@ -1820,7 +1821,7 @@ static int __vc_mgr_initialize_cb(rpc_port_stub_vc_mgr_context_h context, int p return ret; } -static int __vc_mgr_finalize_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data) +static int __vc_mgr_finalize_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager Finalize"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr finalize : pid(%d)", pid); @@ -1837,7 +1838,7 @@ static int __vc_mgr_finalize_cb(rpc_port_stub_vc_mgr_context_h context, int pid return ret; } -static int __vc_mgr_set_command_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data) +static int __vc_mgr_set_command_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager Set command"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set command : pid(%d)", pid); @@ -1855,7 +1856,7 @@ static int __vc_mgr_set_command_cb(rpc_port_stub_vc_mgr_context_h context, int return ret; } -static int __vc_mgr_unset_command_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data) +static int __vc_mgr_unset_command_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager unset command"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr unset command : pid(%d)", pid); @@ -1873,7 +1874,7 @@ static int __vc_mgr_unset_command_cb(rpc_port_stub_vc_mgr_context_h context, in return ret; } -static int __vc_mgr_set_demandable_client_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data) +static int __vc_mgr_set_demandable_client_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager Set demandable client"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set demandable client : pid(%d)", pid); @@ -1891,7 +1892,7 @@ static int __vc_mgr_set_demandable_client_cb(rpc_port_stub_vc_mgr_context_h con return ret; } -static int __vc_mgr_set_audio_type_cb(rpc_port_stub_vc_mgr_context_h context, int pid, const char *audio_type, void *user_data) +static int __vc_mgr_set_audio_type_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, const char *audio_type, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager set audio type"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set audio type : pid(%d), audio type(%s)", pid, audio_type); @@ -1909,7 +1910,7 @@ static int __vc_mgr_set_audio_type_cb(rpc_port_stub_vc_mgr_context_h context, i return ret; } -static int __vc_mgr_get_audio_type_cb(rpc_port_stub_vc_mgr_context_h context, int pid, char **audio_type, void *user_data) +static int __vc_mgr_get_audio_type_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, char **audio_type, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager get audio type"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set audio type : pid(%d)", pid); @@ -1932,7 +1933,7 @@ static int __vc_mgr_get_audio_type_cb(rpc_port_stub_vc_mgr_context_h context, i return ret; } -static void __vc_mgr_set_private_data_cb(rpc_port_stub_vc_mgr_context_h context, int pid, const char *key, const char *data, void *user_data) +static void __vc_mgr_set_private_data_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, const char *key, const char *data, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager set private data"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set domain : pid(%d), key(%s), data(%s)", pid, key, data); @@ -1948,7 +1949,7 @@ static void __vc_mgr_set_private_data_cb(rpc_port_stub_vc_mgr_context_h context SLOG(LOG_DEBUG, TAG_VCD, "@@@"); } -static int __vc_mgr_get_private_data_cb(rpc_port_stub_vc_mgr_context_h context, int pid, const char *key, char **data, void *user_data) +static int __vc_mgr_get_private_data_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, const char *key, char **data, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager get private data"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr get private data : pid(%d), key(%s)", pid, key); @@ -1974,7 +1975,7 @@ static int __vc_mgr_get_private_data_cb(rpc_port_stub_vc_mgr_context_h context, return ret; } -static int __vc_mgr_set_client_info_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data) +static int __vc_mgr_set_client_info_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager set client info"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set client info : pid(%d)", pid); @@ -1992,7 +1993,7 @@ static int __vc_mgr_set_client_info_cb(rpc_port_stub_vc_mgr_context_h context, return ret; } -static int __vc_mgr_set_domain_cb(rpc_port_stub_vc_mgr_context_h context, int pid, const char *domain, void *user_data) +static int __vc_mgr_set_domain_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, const char *domain, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager set domain type"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set domain : pid(%d), domain(%s)", pid, domain); @@ -2010,7 +2011,7 @@ static int __vc_mgr_set_domain_cb(rpc_port_stub_vc_mgr_context_h context, int p return ret; } -static void __vc_mgr_do_action_cb(rpc_port_stub_vc_mgr_context_h context, int pid, int type, const char *send_event, void *user_data) +static void __vc_mgr_do_action_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, int type, const char *send_event, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager request to do action"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr request to do action : pid(%d), type(%d) send_event(%s)", pid, type, send_event); @@ -2025,7 +2026,7 @@ static void __vc_mgr_do_action_cb(rpc_port_stub_vc_mgr_context_h context, int p SLOG(LOG_DEBUG, TAG_VCD, "@@@"); } -static int __vc_mgr_start_cb(rpc_port_stub_vc_mgr_context_h context, int pid, int recognition_mode, bool exclusive_command_option, bool start_by_client, int disabled_cmd_type, void *user_data) +static int __vc_mgr_start_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, int recognition_mode, bool exclusive_command_option, bool start_by_client, int disabled_cmd_type, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager start"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd check enabled or disabled command types. disabled cmd type(%d)", disabled_cmd_type); @@ -2046,7 +2047,7 @@ static int __vc_mgr_start_cb(rpc_port_stub_vc_mgr_context_h context, int pid, i return ret; } -static int __vc_mgr_stop_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data) +static int __vc_mgr_stop_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager stop"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr stop : pid(%d)", pid); @@ -2065,7 +2066,7 @@ static int __vc_mgr_stop_cb(rpc_port_stub_vc_mgr_context_h context, int pid, vo return ret; } -static int __vc_mgr_cancel_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data) +static int __vc_mgr_cancel_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager cancel"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr cancel : pid(%d)", pid); @@ -2083,7 +2084,7 @@ static int __vc_mgr_cancel_cb(rpc_port_stub_vc_mgr_context_h context, int pid, return ret; } -static void __vc_mgr_set_audio_streaming_mode_cb(rpc_port_stub_vc_mgr_context_h context, int pid, int mode, void *user_data) +static void __vc_mgr_set_audio_streaming_mode_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, int mode, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager set audio streaming mode"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr set audio streaming mode : pid(%d) mode(%d)", pid, mode); @@ -2093,7 +2094,7 @@ static void __vc_mgr_set_audio_streaming_mode_cb(rpc_port_stub_vc_mgr_context_h SLOG(LOG_DEBUG, TAG_VCD, "@@@"); } -static void __vc_mgr_send_specific_engine_request_cb(rpc_port_stub_vc_mgr_context_h context, int pid, const char *engine_app_id, const char *event, const char *request, void *user_data) +static void __vc_mgr_send_specific_engine_request_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, const char *engine_app_id, const char *event, const char *request, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager specific engine request"); @@ -2114,7 +2115,7 @@ static void __vc_mgr_send_specific_engine_request_cb(rpc_port_stub_vc_mgr_conte SLOG(LOG_DEBUG, TAG_VCD, "@@@"); } -static void __vc_mgr_send_result_selection_cb(rpc_port_stub_vc_mgr_context_h context, int pid, void *user_data) +static void __vc_mgr_send_result_selection_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager result selection"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr result selection : pid(%d)", pid); @@ -2124,7 +2125,7 @@ static void __vc_mgr_send_result_selection_cb(rpc_port_stub_vc_mgr_context_h co SLOG(LOG_DEBUG, TAG_VCD, "@@@"); } -static void __vc_mgr_send_utterance_status_cb(rpc_port_stub_vc_mgr_context_h context, int utt_id, int utt_status, void *user_data) +static void __vc_mgr_send_utterance_status_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int utt_id, int utt_status, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager send utterance status"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr send utterance status : utt_id(%d), utt_status(%d)", utt_id, utt_status); @@ -2133,14 +2134,14 @@ static void __vc_mgr_send_utterance_status_cb(rpc_port_stub_vc_mgr_context_h co SLOG(LOG_DEBUG, TAG_VCD, "@@@"); } -static void __vc_mgr_send_audio_streaming_cb(rpc_port_stub_vc_mgr_context_h context, int pid, int event, rpc_port_stub_array_char_h data, void *user_data) +static void __vc_mgr_send_audio_streaming_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, int pid, int event, rpc_port_stub_vcd_mgr_stub_array_char_h data, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager send audio streaming"); char* buffer = NULL; int len = 0; int ret = -1; - rpc_port_stub_array_char_get(data, &buffer, &len); + rpc_port_stub_vcd_mgr_stub_array_char_get(data, &buffer, &len); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr send audio streaming : pid(%d), event(%d), buffer(%p), len(%d)", pid, event, buffer, len); @@ -2183,7 +2184,7 @@ int vcd_mgr_tidl_open_connection() int ret = -1; int count = 0; while (VC_RETRY_MIN_COUNT >= count) { - ret = rpc_port_stub_vc_mgr_register(&g_mgr_callback, NULL); + ret = rpc_port_stub_vcd_mgr_stub_vc_mgr_register(&g_mgr_callback, NULL); if (0 == ret) { SLOG(LOG_DEBUG, TAG_VCD, "register callback"); return VCD_ERROR_NONE; @@ -2199,7 +2200,7 @@ int vcd_mgr_tidl_open_connection() int vcd_mgr_tidl_close_connection() { SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Close connection"); - rpc_port_stub_vc_mgr_unregister(); + rpc_port_stub_vcd_mgr_stub_vc_mgr_unregister(); return VCD_ERROR_NONE; } @@ -2207,7 +2208,7 @@ int vcd_mgr_tidl_close_connection() /* * Tidl for widget */ -static void __widget_on_connected(rpc_port_proxy_vcd_widget_h h, void *user_data) +static void __widget_on_connected(rpc_port_proxy_vcd_widget_proxy_vcd_widget_h h, void *user_data) { widget_tidl_info_s* widget_tidl_info = vcd_client_widget_get_tidl_info((int)user_data); @@ -2217,7 +2218,7 @@ static void __widget_on_connected(rpc_port_proxy_vcd_widget_h h, void *user_data SLOG(LOG_INFO, TAG_VCD, "Connected to widget"); } -static void __widget_on_disconnected(rpc_port_proxy_vcd_widget_h h, void *user_data) +static void __widget_on_disconnected(rpc_port_proxy_vcd_widget_proxy_vcd_widget_h h, void *user_data) { widget_tidl_info_s* widget_tidl_info = vcd_client_widget_get_tidl_info((int)user_data); @@ -2227,7 +2228,7 @@ static void __widget_on_disconnected(rpc_port_proxy_vcd_widget_h h, void *user_d SLOG(LOG_INFO, TAG_VCD, "Disonnected to widget"); } -static void __widget_on_rejected(rpc_port_proxy_vcd_widget_h h, void *user_data) +static void __widget_on_rejected(rpc_port_proxy_vcd_widget_proxy_vcd_widget_h h, void *user_data) { widget_tidl_info_s* widget_tidl_info = vcd_client_widget_get_tidl_info((int)user_data); @@ -2236,17 +2237,17 @@ static void __widget_on_rejected(rpc_port_proxy_vcd_widget_h h, void *user_data) SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Rejected from widget"); } -static rpc_port_proxy_vcd_widget_h __widget_create_rpc_port(const char* engine_app_id, int pid) +static rpc_port_proxy_vcd_widget_proxy_vcd_widget_h __widget_create_rpc_port(const char* engine_app_id, int pid) { SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] __widget_create_rpc_port"); - rpc_port_proxy_vcd_widget_callback_s rpc_callback = { + rpc_port_proxy_vcd_widget_proxy_vcd_widget_callback_s rpc_callback = { .connected = __widget_on_connected, .disconnected = __widget_on_disconnected, .rejected = __widget_on_rejected }; - rpc_port_proxy_vcd_widget_h handle = NULL; - if (0 != rpc_port_proxy_vcd_widget_create(engine_app_id, &rpc_callback, (void *)pid, &handle)) { + rpc_port_proxy_vcd_widget_proxy_vcd_widget_h handle = NULL; + if (0 != rpc_port_proxy_vcd_widget_proxy_vcd_widget_create(engine_app_id, &rpc_callback, (void *)pid, &handle)) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create proxy"); return NULL; } @@ -2254,11 +2255,11 @@ static rpc_port_proxy_vcd_widget_h __widget_create_rpc_port(const char* engine_a return handle; } -static void __vc_widget_create_cb(rpc_port_stub_vc_widget_context_h context, void *user_data) +static void __vc_widget_create_cb(rpc_port_stub_vcd_widget_stub_vc_widget_context_h context, void *user_data) { char *sender = NULL; - rpc_port_stub_vc_widget_context_get_sender(context, &sender); + rpc_port_stub_vcd_widget_stub_vc_widget_context_get_sender(context, &sender); if (!sender) { SLOG(LOG_ERROR, TAG_VCD, "Sender is NULL"); return; @@ -2268,10 +2269,10 @@ static void __vc_widget_create_cb(rpc_port_stub_vc_widget_context_h context, voi free(sender); } -static void __vc_widget_terminate_cb(rpc_port_stub_vc_widget_context_h context, void *user_data) +static void __vc_widget_terminate_cb(rpc_port_stub_vcd_widget_stub_vc_widget_context_h context, void *user_data) { void* tag = NULL; - rpc_port_stub_vc_widget_context_get_tag(context, &tag); + rpc_port_stub_vcd_widget_stub_vc_widget_context_get_tag(context, &tag); if (NULL != tag) { int pid = (intptr_t)tag; @@ -2299,7 +2300,7 @@ static void __vc_widget_terminate_cb(rpc_port_stub_vc_widget_context_h context, pthread_mutex_unlock(&g_widget_tidl_info_mutex); char *sender = NULL; - rpc_port_stub_vc_widget_context_get_sender(context, &sender); + rpc_port_stub_vcd_widget_stub_vc_widget_context_get_sender(context, &sender); if (!sender) return; @@ -2307,10 +2308,10 @@ static void __vc_widget_terminate_cb(rpc_port_stub_vc_widget_context_h context, free(sender); } - rpc_port_stub_vc_widget_context_set_tag(context, NULL); + rpc_port_stub_vcd_widget_stub_vc_widget_context_set_tag(context, NULL); } -static void __vc_widget_register_cb_cb(rpc_port_stub_vc_widget_context_h context, int pid, rpc_port_stub_vc_widget_notify_cb_h notify_callback, void *user_data) +static void __vc_widget_register_cb_cb(rpc_port_stub_vcd_widget_stub_vc_widget_context_h context, int pid, rpc_port_stub_vcd_widget_stub_vc_widget_notify_cb_h notify_callback, void *user_data) { pthread_mutex_lock(&g_widget_tidl_info_mutex); SLOG(LOG_INFO, TAG_VCD, "@@@ VC WIDGET REGISTER CALLBACK"); @@ -2332,7 +2333,7 @@ static void __vc_widget_register_cb_cb(rpc_port_stub_vc_widget_context_h contex } char *sender = NULL; - rpc_port_stub_vc_widget_context_get_sender(context, &sender); + rpc_port_stub_vcd_widget_stub_vc_widget_context_get_sender(context, &sender); if (!sender){ SLOG(LOG_ERROR, TAG_VCD, "Sender is NULL"); @@ -2363,14 +2364,14 @@ static void __vc_widget_register_cb_cb(rpc_port_stub_vc_widget_context_h contex SLOG(LOG_DEBUG, TAG_VCD, "@@@"); } -static int __vc_widget_initialize_cb(rpc_port_stub_vc_widget_context_h context, int pid, int *service_state, int *daemon_pid, void *user_data) +static int __vc_widget_initialize_cb(rpc_port_stub_vcd_widget_stub_vc_widget_context_h context, int pid, int *service_state, int *daemon_pid, void *user_data) { SLOG(LOG_INFO, TAG_VCD, "@@@ VCD Widget Initialize"); uintptr_t ptr_pid = pid; int ret = -1; - rpc_port_stub_vc_widget_context_set_tag(context, (void*)ptr_pid); + rpc_port_stub_vcd_widget_stub_vc_widget_context_set_tag(context, (void*)ptr_pid); ret = vcd_server_widget_initialize(pid); if (0 != ret) { @@ -2385,7 +2386,7 @@ static int __vc_widget_initialize_cb(rpc_port_stub_vc_widget_context_h context, return ret; } -static int __vc_widget_finalize_cb(rpc_port_stub_vc_widget_context_h context, int pid, void *user_data) +static int __vc_widget_finalize_cb(rpc_port_stub_vcd_widget_stub_vc_widget_context_h context, int pid, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Widget Finalize"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd widget finalize : pid(%d)", pid); @@ -2403,7 +2404,7 @@ static int __vc_widget_finalize_cb(rpc_port_stub_vc_widget_context_h context, i return ret; } -static int __vc_widget_start_recording_cb(rpc_port_stub_vc_widget_context_h context, int pid, int command, void *user_data) +static int __vc_widget_start_recording_cb(rpc_port_stub_vcd_widget_stub_vc_widget_context_h context, int pid, int command, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Widget Start Recording"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd widget start recording : pid(%d) command(%d)", pid, command); @@ -2421,7 +2422,7 @@ static int __vc_widget_start_recording_cb(rpc_port_stub_vc_widget_context_h cont return ret; } -static int __vc_widget_start_cb(rpc_port_stub_vc_widget_context_h context, int pid, int silence, void *user_data) +static int __vc_widget_start_cb(rpc_port_stub_vcd_widget_stub_vc_widget_context_h context, int pid, int silence, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Widget Start"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd widget start : pid(%d) silence(%d)", pid, silence); @@ -2439,7 +2440,7 @@ static int __vc_widget_start_cb(rpc_port_stub_vc_widget_context_h context, int p return ret; } -static int __vc_widget_stop_cb(rpc_port_stub_vc_widget_context_h context, int pid, void *user_data) +static int __vc_widget_stop_cb(rpc_port_stub_vcd_widget_stub_vc_widget_context_h context, int pid, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Widget Stop"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd widget stop : pid(%d)", pid); @@ -2457,7 +2458,7 @@ static int __vc_widget_stop_cb(rpc_port_stub_vc_widget_context_h context, int pi return ret; } -static int __vc_widget_cancel_cb(rpc_port_stub_vc_widget_context_h context, int pid, void *user_data) +static int __vc_widget_cancel_cb(rpc_port_stub_vcd_widget_stub_vc_widget_context_h context, int pid, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Widget Cancel"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd widget cancel : pid(%d)", pid); @@ -2475,7 +2476,7 @@ static int __vc_widget_cancel_cb(rpc_port_stub_vc_widget_context_h context, int return ret; } -static int __vc_widget_enable_asr_result_cb(rpc_port_stub_vc_widget_context_h context, int pid, int enable, void *user_data) +static int __vc_widget_enable_asr_result_cb(rpc_port_stub_vcd_widget_stub_vc_widget_context_h context, int pid, int enable, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Widget Enable Asr Result"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd widget enable asr result : pid(%d) enable(%d)", pid, enable); @@ -2493,7 +2494,7 @@ static int __vc_widget_enable_asr_result_cb(rpc_port_stub_vc_widget_context_h co return ret; } -static void __vc_widget_set_foreground_cb(rpc_port_stub_vc_widget_context_h context, int pid, int value, void *user_data) +static void __vc_widget_set_foreground_cb(rpc_port_stub_vcd_widget_stub_vc_widget_context_h context, int pid, int value, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Widget Set Foreground"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd widget set foreground : pid(%d) value(%d)", pid, value); @@ -2533,7 +2534,7 @@ int vcd_widget_tidl_open_connection() int ret = -1; int count = 0; while (VC_RETRY_MIN_COUNT >= count) { - ret = rpc_port_stub_vc_widget_register(&g_widget_callback, NULL); + ret = rpc_port_stub_vcd_widget_stub_vc_widget_register(&g_widget_callback, NULL); if (0 == ret) { SLOG(LOG_DEBUG, TAG_VCD, "register callback"); return VCD_ERROR_NONE; @@ -2549,7 +2550,7 @@ int vcd_widget_tidl_open_connection() int vcd_widget_tidl_close_connection() { SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Close connection"); - rpc_port_stub_vc_widget_unregister(); + rpc_port_stub_vcd_widget_stub_vc_widget_unregister(); return VCD_ERROR_NONE; }