X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2FCECProcessor.cpp;h=18e0e6128e2ec1bcbc84e6a23802ad5ccefb9f56;hb=700d9b00855bc3de5e08f6502e89b3b2807cc24d;hp=b5cd540fb9135d26a1685a47f3c20406e87a41d8;hpb=3f9b82aa7229403771e0b5d33087e75084631891;p=deb_libcec.git diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index b5cd540..18e0e61 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -98,7 +98,8 @@ void *CCECProcessor::Process(void) { CLockObject lock(&m_mutex); - if (m_communication->IsOpen() && m_communication->Read(msg, 50)) + if (m_frameBuffer.Pop(msg) || + (m_communication->IsOpen() && m_communication->Read(msg, 50))) bParseFrame = ParseMessage(msg); bParseFrame &= !IsStopped(); @@ -149,12 +150,17 @@ void CCECProcessor::LogOutput(const cec_command &data) bool CCECProcessor::SetLogicalAddress(cec_logical_address iLogicalAddress) { - CStdString strLog; - strLog.Format("<< setting logical address to %1x", iLogicalAddress); - m_controller->AddLog(CEC_LOG_NOTICE, strLog.c_str()); + if (m_iLogicalAddress != iLogicalAddress) + { + CStdString strLog; + strLog.Format("<< setting logical address to %1x", iLogicalAddress); + m_controller->AddLog(CEC_LOG_NOTICE, strLog.c_str()); + + m_iLogicalAddress = iLogicalAddress; + return m_communication && m_communication->SetAckMask(0x1 << (uint8_t)m_iLogicalAddress); + } - m_iLogicalAddress = iLogicalAddress; - return m_communication && m_communication->SetAckMask(0x1 << (uint8_t)m_iLogicalAddress); + return true; } bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress) @@ -181,7 +187,7 @@ bool CCECProcessor::Transmit(const cec_command &data, bool bWaitForAck /* = true bool bReturn(false); LogOutput(data); - CCECAdapterMessage output(data); + CCECAdapterMessagePtr output(new CCECAdapterMessage(data)); CLockObject lock(&m_mutex); if (!m_communication || !m_communication->Write(output)) @@ -190,7 +196,7 @@ bool CCECProcessor::Transmit(const cec_command &data, bool bWaitForAck /* = true if (bWaitForAck) { bool bError(false); - if ((bReturn = WaitForAck(&bError, output.size(), 1000)) == false) + if ((bReturn = WaitForAck(&bError, output->size(), 1000)) == false) m_controller->AddLog(CEC_LOG_ERROR, "did not receive ack"); } else