return TTS_ERROR_NONE;
}
-static int __wait_tidl_connection(tts_tidl_info_s* info)
-{
- int cnt = 0;
- while (false == info->connected && MAX_CONNECT_CHECK > cnt) {
- ecore_main_loop_iterate();
- usleep(50000);
- cnt++;
+static int __request_tidl_connect_sync(tts_tidl_info_s* info) {
+ int ret = rpc_port_proxy_tts_connect_sync(info->rpc_h);
+ SLOG(LOG_INFO, TAG_TTSC, "[INFO] Request connection to stub. ret(%d)", ret);
+ if (RPC_PORT_ERROR_NONE == ret) {
+ return TTS_ERROR_NONE;
}
- if (false == info->connected) {
+ if (0 != rpc_port_proxy_tts_destroy(info->rpc_h)) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to disconnect");
return TTS_ERROR_OPERATION_FAILED;
}
- return TTS_ERROR_NONE;
+ info->rpc_h = __create_rpc_port(info->uid, info->engine_app_id);
+ if (NULL == info->rpc_h) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to create proxy");
+ return TTS_ERROR_OPERATION_FAILED;
+ }
+
+ return TTS_ERROR_OPERATION_FAILED;
}
int tts_tidl_request_hello_sync(int uid)
if (!info->connected) {
SLOG(LOG_WARN, TAG_TTSC, "[WARNNING] Stub is not Connected. Try to connect..");
- rpc_port_proxy_tts_connect(info->rpc_h);
- if (TTS_ERROR_NONE != __wait_tidl_connection(info)) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to connect");
+ int ret = __request_tidl_connect_sync(info);
+ if (TTS_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to connect. ret(%d)", ret);
return TTS_ERROR_OPERATION_FAILED;
}