m_port = new CSerialPort(strPort, iBaudRate);
}
-CUSBCECAdapterCommunication::~CUSBCECAdapterCommunication(void)
-{
- Close();
-}
-
bool CUSBCECAdapterCommunication::CheckAdapter(uint32_t iTimeoutMs /* = 10000 */)
{
bool bReturn(false);
if (!bSkipChecks && !CheckAdapter())
{
CLibCEC::AddLog(CEC_LOG_ERROR, "the adapter failed to pass basic checks");
+ Close();
return false;
}
else
}
else
{
+ Close();
CLibCEC::AddLog(CEC_LOG_ERROR, "could not create a communication thread");
}
}
void CUSBCECAdapterCommunication::Close(void)
{
- StopThread();
+ StopThread(0);
}
void *CUSBCECAdapterCommunication::Process(void)
bool CUSBCECAdapterCommunication::SetLineTimeout(uint8_t iTimeout)
{
- m_iLineTimeout = iTimeout;
- bool bReturn(m_iLineTimeout != iTimeout);
+ bool bReturn(true);
- if (!bReturn)
+ if (m_iLineTimeout != iTimeout)
{
CLibCEC::AddLog(CEC_LOG_DEBUG, "setting the line timeout to %d", iTimeout);
CCECAdapterMessage params;
params.PushEscaped(iTimeout);
bReturn = SendCommand(MSGCODE_TRANSMIT_IDLETIME, params);
+ if (bReturn)
+ m_iLineTimeout = iTimeout;
}
return bReturn;