m_iTransmitWait(CEC_DEFAULT_TRANSMIT_WAIT),
m_iTransmitRetries(CEC_DEFAULT_TRANSMIT_RETRIES),
m_bHandlerInited(false),
- m_iUseCounter(0)
+ m_iUseCounter(0),
+ m_expectedResponse(CEC_OPCODE_NONE)
{
}
if (bHandled && !bHandlerChanged)
{
CLockObject lock(&m_receiveMutex);
- m_condition.Signal();
+ if (m_expectedResponse == CEC_OPCODE_NONE ||
+ m_expectedResponse == command.opcode)
+ m_condition.Signal();
}
MarkReady();
return Transmit(command, bWait);
}
-bool CCECCommandHandler::Transmit(cec_command &command, bool bExpectResponse /* = true */)
+bool CCECCommandHandler::Transmit(cec_command &command, bool bExpectResponse /* = true */, cec_opcode expectedResponse /* = CEC_OPCODE_NONE */)
{
bool bReturn(false);
command.transmit_timeout = m_iTransmitTimeout;
++m_iUseCounter;
while (!bReturn && ++iTries <= iMaxTries)
{
+ m_expectedResponse = expectedResponse;
if (m_processor->Transmit(command))
{
m_processor->AddLog(CEC_LOG_DEBUG, "command transmitted");
virtual bool SetVendorId(const cec_command &command);
virtual void SetPhysicalAddress(cec_logical_address iAddress, uint16_t iNewAddress);
- virtual bool Transmit(cec_command &command, bool bExpectResponse = true);
+ virtual bool Transmit(cec_command &command, bool bExpectResponse = true, cec_opcode expectedResponse = CEC_OPCODE_NONE);
CCECBusDevice *m_busDevice;
CCECProcessor *m_processor;
int8_t m_iTransmitRetries;
bool m_bHandlerInited;
uint8_t m_iUseCounter;
+ cec_opcode m_expectedResponse;
CMutex m_receiveMutex;
CCondition m_condition;
};