/* get the vendor id from the TV, so we are using the correct handler */
m_busDevices[CECDEVICE_TV]->GetVendorId();
+ ReplaceHandlers();
bReturn = SetHDMIPort(m_iBaseDevice, m_iHDMIPort, true);
}
void CCECProcessor::ReplaceHandlers(void)
{
for (uint8_t iPtr = 0; iPtr <= CECDEVICE_PLAYBACKDEVICE3; iPtr++)
- m_busDevices[iPtr]->ReplaceHandler(true);
+ m_busDevices[iPtr]->ReplaceHandler(false);
}
void *CCECProcessor::Process(void)
while (!IsStopped())
{
- ReplaceHandlers();
-
command.Clear();
msg.clear();
bool CCECProcessor::SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort, bool bForce /* = false */)
{
bool bReturn(false);
- CLockObject lock(&m_mutex);
+ {
+ CLockObject lock(&m_mutex);
- m_iBaseDevice = iBaseDevice;
- m_iHDMIPort = iPort;
- if (!m_bStarted && !bForce)
- return true;
+ m_iBaseDevice = iBaseDevice;
+ m_iHDMIPort = iPort;
+ if (!m_bStarted && !bForce)
+ return true;
+ }
CStdString strLog;
strLog.Format("setting HDMI port to %d on device %s (%d)", iPort, ToString(iBaseDevice), (int)iBaseDevice);
//@{
cec_version CCECBusDevice::GetCecVersion(bool bUpdate /* = false */)
{
- CLockObject lock(&m_mutex);
- if (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
- (bUpdate || m_cecVersion == CEC_VERSION_UNKNOWN))
+ bool bRequestUpdate(false);
+ {
+ CLockObject lock(&m_mutex);
+ bRequestUpdate = (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
+ (bUpdate || m_cecVersion == CEC_VERSION_UNKNOWN));
+ }
+
+ if (bRequestUpdate)
RequestCecVersion();
+ CLockObject lock(&m_mutex);
return m_cecVersion;
}
cec_menu_language &CCECBusDevice::GetMenuLanguage(bool bUpdate /* = false */)
{
- CLockObject lock(&m_mutex);
- if (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
- (bUpdate || !strcmp(m_menuLanguage.language, "???")))
+ bool bRequestUpdate(false);
+ {
+ CLockObject lock(&m_mutex);
+ bRequestUpdate = (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
+ (bUpdate || !strcmp(m_menuLanguage.language, "???")));
+ }
+
+ if (bRequestUpdate)
RequestMenuLanguage();
+ CLockObject lock(&m_mutex);
return m_menuLanguage;
}
CStdString CCECBusDevice::GetOSDName(bool bUpdate /* = false */)
{
- CLockObject lock(&m_mutex);
- if (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
- (bUpdate || m_strDeviceName.Equals(ToString(m_iLogicalAddress))) &&
- m_type != CEC_DEVICE_TYPE_TV)
+ bool bRequestUpdate(false);
+ {
+ CLockObject lock(&m_mutex);
+ bRequestUpdate = (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
+ (bUpdate || m_strDeviceName.Equals(ToString(m_iLogicalAddress))) &&
+ m_type != CEC_DEVICE_TYPE_TV);
+ }
+
+ if (bRequestUpdate)
RequestOSDName();
+ CLockObject lock(&m_mutex);
return m_strDeviceName;
}
uint16_t CCECBusDevice::GetPhysicalAddress(bool bUpdate /* = false */)
{
- CLockObject lock(&m_mutex);
- if (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
- (m_iPhysicalAddress == 0xFFFF || bUpdate))
+ bool bRequestUpdate(false);
{
- if (!RequestPhysicalAddress())
- AddLog(CEC_LOG_ERROR, "failed to request the physical address");
+ CLockObject lock(&m_mutex);
+ bRequestUpdate = (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
+ (m_iPhysicalAddress == 0xFFFF || bUpdate));
}
+ if (bRequestUpdate && !RequestPhysicalAddress())
+ AddLog(CEC_LOG_ERROR, "failed to request the physical address (1)");
+
+ CLockObject lock(&m_mutex);
return m_iPhysicalAddress;
}
cec_power_status CCECBusDevice::GetPowerStatus(bool bUpdate /* = false */)
{
- CLockObject lock(&m_mutex);
- if (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
- (bUpdate || m_powerStatus == CEC_POWER_STATUS_UNKNOWN))
+ bool bRequestUpdate(false);
+ {
+ CLockObject lock(&m_mutex);
+ bRequestUpdate = (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
+ (bUpdate || m_powerStatus == CEC_POWER_STATUS_UNKNOWN));
+ }
+
+ if (bRequestUpdate)
RequestPowerStatus();
+ CLockObject lock(&m_mutex);
return m_powerStatus;
}
cec_vendor_id CCECBusDevice::GetVendorId(bool bUpdate /* = false */)
{
- CLockObject lock(&m_mutex);
- if (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
- (bUpdate || m_vendor == CEC_VENDOR_UNKNOWN))
+ bool bRequestUpdate(false);
+ {
+ CLockObject lock(&m_mutex);
+ bRequestUpdate = (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
+ (bUpdate || m_vendor == CEC_VENDOR_UNKNOWN));
+ }
+
+ if (bRequestUpdate)
RequestVendorId();
+ CLockObject lock(&m_mutex);
return m_vendor;
}