From: Lars Op den Kamp Date: Sun, 30 Oct 2011 19:01:04 +0000 (+0100) Subject: cec: refresh device statuses by default X-Git-Tag: upstream/2.2.0~1^2~158 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=8acf4aac0ff1e3ac094290dbb9537c4aefb86e3d;p=deb_libcec.git cec: refresh device statuses by default --- diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 05a8cdb..07d944e 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -386,9 +386,9 @@ bool CCECBusDevice::BroadcastActiveSource(void) return m_processor->Transmit(command); } -cec_version CCECBusDevice::GetCecVersion(void) +cec_version CCECBusDevice::GetCecVersion(bool bRefresh /* = true */) { - if (m_cecVersion == CEC_VERSION_UNKNOWN) + if (bRefresh || m_cecVersion == CEC_VERSION_UNKNOWN) { AddLog(CEC_LOG_NOTICE, "<< requesting CEC version"); cec_command command; @@ -401,9 +401,9 @@ cec_version CCECBusDevice::GetCecVersion(void) return m_cecVersion; } -cec_menu_language &CCECBusDevice::GetMenuLanguage(void) +cec_menu_language &CCECBusDevice::GetMenuLanguage(bool bRefresh /* = true */) { - if (!strcmp(m_menuLanguage.language, "???")) + if (bRefresh || !strcmp(m_menuLanguage.language, "???")) { AddLog(CEC_LOG_NOTICE, "<< requesting menu language"); cec_command command; @@ -416,9 +416,9 @@ cec_menu_language &CCECBusDevice::GetMenuLanguage(void) return m_menuLanguage; } -cec_power_status CCECBusDevice::GetPowerStatus(void) +cec_power_status CCECBusDevice::GetPowerStatus(bool bRefresh /* = true */) { - if (m_powerStatus == CEC_POWER_STATUS_UNKNOWN) + if (bRefresh || m_powerStatus == CEC_POWER_STATUS_UNKNOWN) { AddLog(CEC_LOG_NOTICE, "<< requesting power status"); cec_command command; diff --git a/src/lib/devices/CECBusDevice.h b/src/lib/devices/CECBusDevice.h index 66948ad..5971f58 100644 --- a/src/lib/devices/CECBusDevice.h +++ b/src/lib/devices/CECBusDevice.h @@ -55,9 +55,9 @@ namespace CEC virtual uint64_t GetLastActive(void) const { return m_iLastActive; } virtual cec_logical_address GetLogicalAddress(void) const { return m_iLogicalAddress; } virtual uint16_t GetPhysicalAddress(void) const { return m_iPhysicalAddress; } - virtual cec_version GetCecVersion(void); - virtual cec_menu_language & GetMenuLanguage(void); - virtual cec_power_status GetPowerStatus(void); + virtual cec_version GetCecVersion(bool bRefresh = true); + virtual cec_menu_language & GetMenuLanguage(bool bRefresh = true); + virtual cec_power_status GetPowerStatus(bool bRefresh = true); virtual bool PowerOn(void); virtual bool Standby(void);