#define CEC_BUTTON_TIMEOUT 500
#define CEC_POWER_STATE_REFRESH_TIME 30000
#define CEC_FW_VERSION_UNKNOWN 0xFFFF
+#define CEC_CONNECT_TRIES 3
#define CEC_DEFAULT_SETTING_USE_TV_MENU_LANGUAGE 1
#define CEC_DEFAULT_SETTING_ACTIVATE_SOURCE 1
return bReturn;
}
- uint64_t iNow = GetTimeMs();
- uint64_t iTarget = iTimeoutMs > 0 ? iNow + iTimeoutMs : iNow + CEC_DEFAULT_TRANSMIT_WAIT;
+ CTimeout timeout(iTimeoutMs > 0 ? iTimeoutMs : CEC_DEFAULT_TRANSMIT_WAIT);
/* open a new connection */
unsigned iConnectTry(0);
- while (iNow < iTarget && (bReturn = m_communication->Open(this, iTimeoutMs)) == false)
+ while (timeout.TimeLeft() > 0 && (bReturn = m_communication->Open(this, (timeout.TimeLeft() / CEC_CONNECT_TRIES))) == false)
{
CLibCEC::AddLog(CEC_LOG_ERROR, "could not open a connection (try %d)", ++iConnectTry);
Sleep(500);
- iNow = GetTimeMs();
}
if (bReturn)