bool CAdapterCommunication::Open(const char *strPort, uint16_t iBaudRate /* = 38400 */, uint32_t iTimeoutMs /* = 10000 */)
{
+ CLockObject lock(&m_mutex);
if (!m_port)
{
m_controller->AddLog(CEC_LOG_ERROR, "port is NULL");
void CAdapterCommunication::Close(void)
{
+ CLockObject lock(&m_mutex);
StopThread();
m_rcvCondition.Broadcast();
void CAdapterCommunication::AddData(uint8_t *data, uint8_t iLen)
{
- CLockObject lock(&m_bufferMutex);
+ CLockObject lock(&m_mutex);
for (unsigned int iPtr = 0; iPtr < iLen; iPtr++)
m_inBuffer.Push(data[iPtr]);
bool CAdapterCommunication::Read(CCECAdapterMessage &msg, uint32_t iTimeout)
{
- CLockObject lock(&m_bufferMutex);
+ CLockObject lock(&m_mutex);
msg.clear();
uint64_t iNow = GetTimeMs();
uint8_t buf = 0;
if (!m_inBuffer.Pop(buf))
{
- if (!m_rcvCondition.Wait(&m_bufferMutex, iTarget - iNow))
+ if (!m_rcvCondition.Wait(&m_mutex, iTarget - iNow))
return false;
}