bool CAdapterCommunication::Open(const char *strPort, uint16_t iBaudRate /* = 38400 */, uint32_t iTimeoutMs /* = 10000 */)
{
- CLockObject lock(&m_commMutex);
if (!m_port)
{
m_controller->AddLog(CEC_LOG_ERROR, "port is NULL");
void CAdapterCommunication::Close(void)
{
- CLockObject lock(&m_commMutex);
StopThread();
m_rcvCondition.Broadcast();
while (!IsStopped())
{
- ReadFromDevice(100);
+ ReadFromDevice(500);
WriteNextCommand();
Sleep(5);
}
bool CAdapterCommunication::ReadFromDevice(uint32_t iTimeout)
{
- CLockObject lock(&m_commMutex);
int32_t iBytesRead;
uint8_t buff[1024];
if (!m_port)
void CAdapterCommunication::WriteNextCommand(void)
{
- CLockObject lock(&m_commMutex);
CCECAdapterMessage msg;
if (m_outBuffer.Pop(msg))
{