+ if (bRequestUpdate)
+ RequestOSDName();
+
+ CLockObject lock(&m_mutex);
+ return m_strDeviceName;
+}
+
+bool CCECBusDevice::RequestOSDName(void)
+{
+ bool bReturn(false);
+
+ 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;
+}
+
+uint16_t CCECBusDevice::GetPhysicalAddress(bool bUpdate /* = false */)
+{
+ bool bRequestUpdate(false);
+ {
+ 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;
+}
+
+bool CCECBusDevice::RequestPhysicalAddress(void)
+{
+ bool bReturn(false);
+
+ 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;
+}
+
+cec_power_status CCECBusDevice::GetPowerStatus(bool bUpdate /* = false */)
+{
+ bool bRequestUpdate(false);
+ {
+ CLockObject lock(&m_mutex);
+ bRequestUpdate = (GetStatus() == CEC_DEVICE_STATUS_PRESENT &&
+ (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 ||
+ GetTimeMs() - m_iLastPowerStateUpdate >= CEC_POWER_STATE_REFRESH_TIME));
+ }
+
+ if (bRequestUpdate)
+ RequestPowerStatus();
+
+ CLockObject lock(&m_mutex);