if (!MyLogicalAddressContains(m_iLogicalAddress))
{
+ m_handler->MarkBusy();
CStdString strLog;
strLog.Format("<< requesting CEC version of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
AddLog(CEC_LOG_NOTICE, strLog);
bReturn = m_handler->TransmitRequestCecVersion(GetMyLogicalAddress(), m_iLogicalAddress);
+ m_handler->MarkReady();
}
return bReturn;
}
if (!MyLogicalAddressContains(m_iLogicalAddress) &&
!IsUnsupportedFeature(CEC_OPCODE_GET_MENU_LANGUAGE))
{
+ m_handler->MarkBusy();
CStdString strLog;
strLog.Format("<< requesting menu language of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
AddLog(CEC_LOG_NOTICE, strLog);
bReturn = m_handler->TransmitRequestMenuLanguage(GetMyLogicalAddress(), m_iLogicalAddress);
+ m_handler->MarkReady();
}
return bReturn;
}
+cec_menu_state CCECBusDevice::GetMenuState(void)
+{
+ CLockObject lock(&m_mutex);
+ return m_menuState;
+}
+
cec_logical_address CCECBusDevice::GetMyLogicalAddress(void) const
{
return m_processor->GetLogicalAddress();
if (!MyLogicalAddressContains(m_iLogicalAddress) &&
!IsUnsupportedFeature(CEC_OPCODE_GIVE_OSD_NAME))
{
+ m_handler->MarkBusy();
CStdString strLog;
strLog.Format("<< requesting OSD name of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
AddLog(CEC_LOG_NOTICE, strLog);
bReturn = m_handler->TransmitRequestOSDName(GetMyLogicalAddress(), m_iLogicalAddress);
+ m_handler->MarkReady();
}
return bReturn;
}
if (!MyLogicalAddressContains(m_iLogicalAddress))
{
+ m_handler->MarkBusy();
CStdString strLog;
strLog.Format("<< requesting physical address of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
AddLog(CEC_LOG_NOTICE, strLog);
bReturn = m_handler->TransmitRequestPhysicalAddress(GetMyLogicalAddress(), m_iLogicalAddress);
+ m_handler->MarkReady();
}
return bReturn;
}
if (!MyLogicalAddressContains(m_iLogicalAddress) &&
!IsUnsupportedFeature(CEC_OPCODE_GIVE_DEVICE_POWER_STATUS))
{
+ m_handler->MarkBusy();
CStdString strLog;
strLog.Format("<< requesting power status of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
AddLog(CEC_LOG_NOTICE, strLog);
bReturn = m_handler->TransmitRequestPowerStatus(GetMyLogicalAddress(), m_iLogicalAddress);
+ m_handler->MarkReady();
}
return bReturn;
}
if (!MyLogicalAddressContains(m_iLogicalAddress))
{
+ m_handler->MarkBusy();
CStdString strLog;
strLog.Format("<< requesting vendor ID of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
AddLog(CEC_LOG_NOTICE, strLog);
bReturn = m_handler->TransmitRequestVendorId(GetMyLogicalAddress(), m_iLogicalAddress);
+ m_handler->MarkReady();
+
+ ReplaceHandler(true);
}
return bReturn;
}
}
}
-bool CCECBusDevice::ReplaceHandler(bool bInitHandler /* = true */)
+bool CCECBusDevice::ReplaceHandler(bool bActivateSource /* = true */)
{
CLockObject lock(&m_mutex);
CLockObject handlerLock(&m_handlerMutex);
if (m_vendor != m_handler->GetVendorId())
{
+ CStdString strLog;
if (m_handler->InUse())
+ {
+ strLog.Format("handler for device '%s' (%x) is being used. not replacing the command handler", GetLogicalAddressName(), GetLogicalAddress());
+ m_processor->AddLog(CEC_LOG_DEBUG, strLog);
return false;
+ }
+ strLog.Format("replacing the command handler for device '%s' (%x)", GetLogicalAddressName(), GetLogicalAddress());
+ m_processor->AddLog(CEC_LOG_DEBUG, strLog);
delete m_handler;
switch (m_vendor)
break;
}
- if (bInitHandler && m_processor->GetLogicalAddresses().IsSet(m_iLogicalAddress) && m_processor->IsInitialised())
- m_handler->InitHandler();
+ m_handler->InitHandler();
+
+ if (bActivateSource && m_processor->GetLogicalAddresses().IsSet(m_iLogicalAddress) && m_processor->IsInitialised())
+ m_handler->ActivateSource();
}
return true;
}
-bool CCECBusDevice::SetVendorId(uint64_t iVendorId, bool bInitHandler /* = true */)
+bool CCECBusDevice::SetVendorId(uint64_t iVendorId)
{
bool bVendorChanged(false);
CLockObject lock(&m_mutex);
bVendorChanged = (m_vendor != (cec_vendor_id)iVendorId);
m_vendor = (cec_vendor_id)iVendorId;
- ReplaceHandler(bInitHandler);
}
CStdString strLog;
m_unsupportedFeatures.insert(opcode);
}
-bool CCECBusDevice::InitHandler(void)
+bool CCECBusDevice::ActivateSource(void)
{
CLockObject lock(&m_mutex);
- return m_handler->InitHandler();
+ return m_handler->ActivateSource();
}
//@}