bool CCECBusDevice::PowerOn(void)
{
bool bReturn(false);
- GetVendorId(); // ensure that we got the vendor id
+ GetVendorId(); // ensure that we got the vendor id, because the implementations vary per vendor
MarkBusy();
CLibCEC::AddLog(CEC_LOG_NOTICE, "<< powering on '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
if (m_handler->PowerOn(GetMyLogicalAddress(), m_iLogicalAddress))
{
- {
-// CLockObject lock(m_mutex);
-// m_powerStatus = CEC_POWER_STATUS_UNKNOWN;
- SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON);
- }
-// cec_power_status status = GetPowerStatus();
-// if (status == CEC_POWER_STATUS_STANDBY || status == CEC_POWER_STATUS_UNKNOWN)
-// {
-// /* sending the normal power on command appears to have failed */
-// CStdString strLog;
-// strLog.Format("<< sending power on keypress to '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
-// CLibCEC::AddLog(CEC_LOG_DEBUG, strLog.c_str());
-//
-// TransmitKeypress(CEC_USER_CONTROL_CODE_POWER);
-// return TransmitKeyRelease();
-// }
+ SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON);
bReturn = true;
}
//@{
cec_version CCECBusDevice::GetCecVersion(bool bUpdate /* = false */)
{
+ bool bIsPresent(GetStatus() == CEC_DEVICE_STATUS_PRESENT);
bool bRequestUpdate(false);
{
CLockObject lock(m_mutex);
- bRequestUpdate = (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
- (bUpdate || m_cecVersion == CEC_VERSION_UNKNOWN));
+ bRequestUpdate = bIsPresent &&
+ (bUpdate || m_cecVersion == CEC_VERSION_UNKNOWN);
}
if (bRequestUpdate)
cec_menu_language &CCECBusDevice::GetMenuLanguage(bool bUpdate /* = false */)
{
+ bool bIsPresent(GetStatus() == CEC_DEVICE_STATUS_PRESENT);
bool bRequestUpdate(false);
{
CLockObject lock(m_mutex);
- bRequestUpdate = (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
+ bRequestUpdate = (bIsPresent &&
(bUpdate || !strcmp(m_menuLanguage.language, "???")));
}
CStdString CCECBusDevice::GetOSDName(bool bUpdate /* = false */)
{
+ bool bIsPresent(GetStatus() == CEC_DEVICE_STATUS_PRESENT);
bool bRequestUpdate(false);
{
CLockObject lock(m_mutex);
- bRequestUpdate = (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
+ bRequestUpdate = bIsPresent &&
(bUpdate || m_strDeviceName.Equals(ToString(m_iLogicalAddress))) &&
- m_type != CEC_DEVICE_TYPE_TV);
+ m_type != CEC_DEVICE_TYPE_TV;
}
if (bRequestUpdate)
uint16_t CCECBusDevice::GetPhysicalAddress(bool bUpdate /* = false */)
{
+ bool bIsPresent(GetStatus() == CEC_DEVICE_STATUS_PRESENT);
bool bRequestUpdate(false);
{
CLockObject lock(m_mutex);
- bRequestUpdate = (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
- (m_iPhysicalAddress == 0xFFFF || bUpdate));
+ bRequestUpdate = bIsPresent &&
+ (m_iPhysicalAddress == 0xFFFF || bUpdate);
}
if (bRequestUpdate && !RequestPhysicalAddress())
cec_power_status CCECBusDevice::GetPowerStatus(bool bUpdate /* = false */)
{
+ bool bIsPresent(GetStatus() == CEC_DEVICE_STATUS_PRESENT);
bool bRequestUpdate(false);
{
CLockObject lock(m_mutex);
- bRequestUpdate = (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
+ bRequestUpdate = (bIsPresent &&
(bUpdate || m_powerStatus == CEC_POWER_STATUS_UNKNOWN ||
m_powerStatus == CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON ||
m_powerStatus == CEC_POWER_STATUS_IN_TRANSITION_ON_TO_STANDBY ||
cec_vendor_id CCECBusDevice::GetVendorId(bool bUpdate /* = false */)
{
+ bool bIsPresent(GetStatus() == CEC_DEVICE_STATUS_PRESENT);
bool bRequestUpdate(false);
{
CLockObject lock(m_mutex);
- bRequestUpdate = (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
+ bRequestUpdate = (bIsPresent &&
(bUpdate || m_vendor == CEC_VENDOR_UNKNOWN));
}
void CCECBusDevice::HandlePoll(cec_logical_address iDestination)
{
- CLockObject lock(m_mutex);
CLibCEC::AddLog(CEC_LOG_DEBUG, "<< POLL: %s (%x) -> %s (%x)", ToString(m_iLogicalAddress), m_iLogicalAddress, ToString(iDestination), iDestination);
m_bAwaitingReceiveFailed = true;
}
bool CCECBusDevice::HandleReceiveFailed(void)
{
- CLockObject lock(m_mutex);
bool bReturn = m_bAwaitingReceiveFailed;
m_bAwaitingReceiveFailed = false;
return bReturn;