m_iTransmitWait(CEC_DEFAULT_TRANSMIT_WAIT),
m_iTransmitRetries(CEC_DEFAULT_TRANSMIT_RETRIES),
m_bHandlerInited(false),
- m_iUseCounter(0),
m_expectedResponse(CEC_OPCODE_NONE),
m_bOPTSendDeckStatusUpdateOnActiveSource(false),
- m_vendorId(CEC_VENDOR_UNKNOWN)
+ m_vendorId(CEC_VENDOR_UNKNOWN),
+ m_bRcvSignal(false)
{
}
CCECCommandHandler::~CCECCommandHandler(void)
{
- CLockObject lock(m_processor->m_transmitMutex);
- CLockObject receiveLock(m_receiveMutex);
m_condition.Broadcast();
}
{
bool bHandled(true);
- MarkBusy();
CLibCEC::AddCommand(command);
switch(command.opcode)
CLockObject lock(m_receiveMutex);
if (m_expectedResponse == CEC_OPCODE_NONE ||
m_expectedResponse == command.opcode)
+ {
+ m_bRcvSignal = true;
m_condition.Signal();
+ }
}
- MarkReady();
return bHandled;
}
{
device->SetActiveSource();
return device->TransmitPhysicalAddress() &&
+ device->TransmitImageViewOn() &&
device->TransmitActiveSource();
}
}
if (device && m_busDevice->MyLogicalAddressContains(device->GetLogicalAddress()))
{
device->SetActiveSource();
+ device->TransmitImageViewOn();
device->TransmitActiveSource();
device->SetMenuState(CEC_MENU_STATE_ACTIVATED);
if (device->MyLogicalAddressContains(device->GetLogicalAddress()))
{
device->SetActiveSource();
+ device->TransmitImageViewOn();
device->TransmitActiveSource();
if (device->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE ||
bool CCECCommandHandler::Transmit(cec_command &command, bool bExpectResponse /* = true */, cec_opcode expectedResponse /* = CEC_OPCODE_NONE */)
{
bool bReturn(false);
- MarkBusy();
command.transmit_timeout = m_iTransmitTimeout;
{
uint8_t iTries(0), iMaxTries(command.opcode == CEC_OPCODE_NONE ? 1 : m_iTransmitRetries + 1);
CLockObject writeLock(m_processor->m_transmitMutex);
CLockObject receiveLock(m_receiveMutex);
- ++m_iUseCounter;
while (!bReturn && ++iTries <= iMaxTries)
{
m_expectedResponse = expectedResponse;
{
CLibCEC::AddLog(CEC_LOG_DEBUG, "command transmitted");
if (bExpectResponse)
- bReturn = m_condition.Wait(m_receiveMutex, m_iTransmitWait);
+ bReturn = m_condition.Wait(m_receiveMutex, m_bRcvSignal, m_iTransmitWait);
+ m_bRcvSignal = false;
+ CLibCEC::AddLog(CEC_LOG_DEBUG, bReturn ? "expected response received" : "expected response not received");
}
}
- --m_iUseCounter;
}
- MarkReady();
return bReturn;
}
primary->SetPowerStatus(CEC_POWER_STATUS_ON);
primary->SetMenuState(CEC_MENU_STATE_ACTIVATED);
- if (m_processor->GetPrimaryDevice()->GetPhysicalAddress(false) != 0xffff)
+ if (m_busDevice->GetStatus(false) == CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC)
{
- m_processor->SetActiveSource();
- primary->TransmitMenuState(m_busDevice->GetLogicalAddress());
+ m_busDevice->TransmitMenuState(CECDEVICE_TV);
+
+ if ((m_busDevice->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE ||
+ m_busDevice->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE) &&
+ SendDeckStatusUpdateOnActiveSource())
+ ((CCECPlaybackDevice *)m_busDevice)->TransmitDeckStatus(CECDEVICE_TV);
m_bHandlerInited = true;
}
}
return true;
}
-
-void CCECCommandHandler::MarkBusy(void)
-{
- CLockObject receiveLock(m_receiveMutex);
- ++m_iUseCounter;
-}
-
-bool CCECCommandHandler::MarkReady(void)
-{
- CLockObject receiveLock(m_receiveMutex);
- return m_iUseCounter > 0 ? (--m_iUseCounter == 0) : true;
-}
-
-bool CCECCommandHandler::InUse(void)
-{
- CLockObject receiveLock(m_receiveMutex);
- return m_iUseCounter > 0;
-}