+ bool bReturn(false);
+ GetVendorId(); // ensure that we got the vendor id
+
+ 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();
+// }
+ bReturn = true;
+ }
+
+ MarkReady();
+ return bReturn;
+}
+
+bool CCECBusDevice::Standby(void)
+{
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "<< putting '%s' (%X) in standby mode", GetLogicalAddressName(), m_iLogicalAddress);
+ MarkBusy();
+ bool bReturn = m_handler->TransmitStandby(GetMyLogicalAddress(), m_iLogicalAddress);
+ MarkReady();
+ return bReturn;
+}
+
+/** @name Getters */
+//@{
+cec_version CCECBusDevice::GetCecVersion(bool bUpdate /* = false */)
+{
+ 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;
+}
+
+bool CCECBusDevice::RequestCecVersion(void)
+{
+ bool bReturn(false);
+
+ if (!MyLogicalAddressContains(m_iLogicalAddress))
+ {
+ MarkBusy();
+ CLibCEC::AddLog(CEC_LOG_NOTICE, "<< requesting CEC version of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
+
+ bReturn = m_handler->TransmitRequestCecVersion(GetMyLogicalAddress(), m_iLogicalAddress);
+ MarkReady();
+ }
+ return bReturn;
+}
+
+const char* CCECBusDevice::GetLogicalAddressName(void) const
+{
+ return ToString(m_iLogicalAddress);
+}
+
+cec_menu_language &CCECBusDevice::GetMenuLanguage(bool bUpdate /* = false */)
+{
+ 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;
+}
+
+bool CCECBusDevice::RequestMenuLanguage(void)
+{
+ bool bReturn(false);
+
+ if (!MyLogicalAddressContains(m_iLogicalAddress) &&
+ !IsUnsupportedFeature(CEC_OPCODE_GET_MENU_LANGUAGE))
+ {
+ MarkBusy();
+ CLibCEC::AddLog(CEC_LOG_NOTICE, "<< requesting menu language of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
+ bReturn = m_handler->TransmitRequestMenuLanguage(GetMyLogicalAddress(), m_iLogicalAddress);
+ 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();