/* Send hello */
while (0 != ret) {
- if (retry_count == 20) { // 200 ms * 20 = 4 sec
+ if (retry_count == VC_TIDL_RETRY_COUNT) { // 200 ms * 20 = 4 sec
SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request hello !!"); //LCOV_EXCL_LINE
return;
}
{
/* Send hello */
if (0 != vc_mgr_tidl_request_hello()) {
- if (g_tidl_send_hello_count == VC_TIDL_RETRY_COUNT) {
+ if (g_tidl_send_hello_count == VCM_TIDL_RETRY_COUNT) {
g_tidl_send_hello_count = 0;
SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to request hello !! send error to manager");
__vc_mgr_cb_error(VC_ERROR_TIMED_OUT, -1, "voice_framework.error.vcfw.connect_engine_fail");
g_send_hello_timer = NULL;
return EINA_FALSE;
} else {
- // TODO: discuss when updating connect/reconnect
g_tidl_send_hello_count++;
- usleep(200000);
return EINA_TRUE;
}
}
g_tidl_send_hello_count = 0;
SLOG(LOG_INFO, TAG_VCM, "[DEBUG] Create a new timer for preparation");
ecore_thread_main_loop_begin();
- g_send_hello_timer = ecore_timer_add(0.02, __send_hello_message, NULL);
+ g_send_hello_timer = ecore_timer_add(0.1, __send_hello_message, NULL);
ecore_thread_main_loop_end();
} else {
SLOG(LOG_INFO, TAG_VCM, "[INFO] timer handle is already created");
return ret;
}
-static void __register_stub_callback()
+static int __register_stub_callback()
{
if (g_stub_tidl_info->register_callback_requesting) {
- return;
+ return VC_ERROR_NONE;
}
SLOG(LOG_DEBUG, TAG_VCM, "[TIDL] __register_stub_callback");
if (0 == ret) {
SLOG(LOG_DEBUG, TAG_VCM, "register callback");
g_stub_tidl_info->register_callback_requesting = true;
- return;
+ return VC_ERROR_NONE;
}
- SLOG(LOG_ERROR, TAG_VCM, "Fail to rister callback(%d)", ret);
- return;
+ SLOG(LOG_ERROR, TAG_VCM, "Fail to register callback(%d)", ret);
+ return VC_ERROR_OPERATION_FAILED;
}
int vc_mgr_tidl_open_connection()
if (!g_stub_tidl_info->connected) {
SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Stub Not Connected");
- __register_stub_callback();
- return VC_ERROR_OPERATION_FAILED;
+ int ret = __register_stub_callback();
+ return ret;
}
SLOG(LOG_DEBUG, TAG_VCM, ">>>>> VCM Hello");
#define VC_CONNECTION_RETRY_COUNT 10
#define VC_INVALID_TTS_UID 0
#define VC_ENGINE_APPID_LEN 256
-#define VC_TIDL_RETRY_COUNT 100
+#define VCM_TIDL_RETRY_COUNT 200
+#define VC_TIDL_RETRY_COUNT 20
#define VC_MGR_DEFAULT_FARFIELD_DUCKING_RATIO 0.0
#define VC_MGR_DEFAULT_NEARFIELD_DUCKING_RATIO 0.7
return g_result_text;
}
-int vcd_client_manager_create_tidl_info(int pid)
+int vcd_client_manager_create_tidl_info()
{
/*Check already created*/
if (NULL != g_mgr_tidl_info) {
SLOG(LOG_WARN, TAG_VCD, "[Client Data] Manager tidl info pid is already registered");
- if (pid != g_mgr_tidl_info->pid) {
- SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Manager pid is different");
- return VCD_ERROR_OPERATION_FAILED;
- }
return VCD_ERROR_NONE;
}
return VCD_ERROR_OUT_OF_MEMORY;
}
- g_mgr_tidl_info->pid = pid;
g_mgr_tidl_info->notify_cb = NULL;
g_mgr_tidl_info->notify_cb_user_data = NULL;
g_mgr_tidl_info->send_buffer_cb = NULL;
g_mgr_tidl_info->connection_requesting = false;
g_mgr_tidl_info->rpc_h = NULL;
- SLOG(LOG_INFO, TAG_VCD, "[Client Data SUCCESS] Add new manager tidl info. pid(%d)", pid);
+ SLOG(LOG_INFO, TAG_VCD, "[Client Data SUCCESS] Add new manager tidl info.");
return VCD_ERROR_NONE;
}
} client_tidl_info_s;
typedef struct {
- int pid;
rpc_port_stub_vcd_mgr_stub_vc_mgr_notify_cb_h notify_cb;
void* notify_cb_user_data;
rpc_port_stub_vcd_mgr_stub_vc_mgr_send_buffer_cb_h send_buffer_cb;
bool vcd_client_manager_is_system_command_valid(int pid);
-int vcd_client_manager_create_tidl_info(int pid);
+int vcd_client_manager_create_tidl_info();
int vcd_client_manager_set_tidl_notify_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_notify_cb_h callback, void* user_data);
SLOG(LOG_DEBUG, TAG_VCD, "@@@ Manager connect. appid(%s)", sender);
+ pthread_mutex_lock(&g_mgr_tidl_info_mutex);
+ int ret = -1;
+ ret = vcd_client_manager_create_tidl_info();
+
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create manager tidl info.");
+ pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
+ return;
+ }
+
+ manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+
+ if (NULL == mgr_tidl_info) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get manager tidl info");
+ pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
+ return;
+ }
+
+ mgr_tidl_info->rpc_h = __mgr_create_rpc_port(sender);
+
+ if (NULL == mgr_tidl_info->rpc_h) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create server proxy");
+ } else {
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] rpc_h(%p), engine_app_id(%s)", mgr_tidl_info->rpc_h, sender);
+ }
+
free(sender);
+ pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
+ __request_tidl_connect(VCD_CLIENT_TYPE_MANAGER, -1);
}
static void __vc_mgr_terminate_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, void *user_data)
return;
}
- SLOG(LOG_DEBUG, TAG_VCD, "@@@ VC MANAGER FINALIZE. pid(%u)", mgr_tidl_info->pid);
+ SLOG(LOG_DEBUG, TAG_VCD, "@@@ VC MANAGER FINALIZE.");
if (0 != vcd_client_manager_unset_tidl_notify_cb()) {
SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to unset notify callback");
pthread_mutex_lock(&g_mgr_tidl_info_mutex);
SLOG(LOG_INFO, TAG_VCD, "@@@ VC MANAGER REGISTER CALLBACK");
- int ret = -1;
- ret = vcd_client_manager_create_tidl_info(pid);
-
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create manager tidl info.");
- pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
- return;
- }
-
- manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
-
- 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);
- return;
- }
-
- char *sender = NULL;
- rpc_port_stub_vcd_mgr_stub_vc_mgr_context_get_sender(context, &sender);
-
- if (!sender){
- SLOG(LOG_ERROR, TAG_VCD, "Sender is NULL");
- pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
- return;
- }
-
- mgr_tidl_info->rpc_h = __mgr_create_rpc_port(sender);
-
- if (NULL == mgr_tidl_info->rpc_h) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create server proxy");
- } else {
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] rpc_h(%p), engine_app_id(%s)", mgr_tidl_info->rpc_h, sender);
- }
-
- free(sender);
-
if (0 != vcd_client_manager_set_tidl_notify_cb(notify_callback, user_data)) {
SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback");
} else {
pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
- __request_tidl_connect(VCD_CLIENT_TYPE_MANAGER, pid);
-
SLOG(LOG_DEBUG, TAG_VCD, "@@@ VC MANAGER REGISTER CALLBACK DONE");
}