From: Lars Op den Kamp Date: Thu, 10 Nov 2011 17:30:00 +0000 (+0100) Subject: cec: separate 'last command sent' and 'last active' in CCECBusDevice X-Git-Tag: upstream/2.2.0~1^2~80 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=d54e8570c10d16927199245d9eb96880289af27b;p=deb_libcec.git cec: separate 'last command sent' and 'last active' in CCECBusDevice --- diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 340ef56..3c371f4 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -49,6 +49,7 @@ CCECBusDevice::CCECBusDevice(CCECProcessor *processor, cec_logical_address iLogi m_bMenuActive(true), m_bActiveSource(false), m_iVendorClass(CEC_VENDOR_UNKNOWN), + m_iLastCommandSent(0), m_iLastActive(0), m_cecVersion(CEC_VERSION_UNKNOWN) { @@ -89,13 +90,13 @@ void CCECBusDevice::PollVendorId(void) CLockObject lock(&m_mutex); if (m_iLastActive > 0 && m_iLogicalAddress != CECDEVICE_BROADCAST && m_vendor.vendor == CEC_VENDOR_UNKNOWN && - GetTimeMs() - m_iLastActive > 5000 && + GetTimeMs() - m_iLastCommandSent > 5000 && !m_processor->IsMonitoring()) { CStdString strLog; strLog.Format("<< requesting vendor ID of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress); AddLog(CEC_LOG_NOTICE, strLog); - m_iLastActive = GetTimeMs(); + m_iLastCommandSent = GetTimeMs(); cec_command command; cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID); diff --git a/src/lib/devices/CECBusDevice.h b/src/lib/devices/CECBusDevice.h index 64d26d0..0402648 100644 --- a/src/lib/devices/CECBusDevice.h +++ b/src/lib/devices/CECBusDevice.h @@ -56,6 +56,7 @@ namespace CEC virtual cec_version GetCecVersion(void); virtual CCECCommandHandler *GetHandler(void) const { return m_handler; }; + virtual uint64_t GetCommandSent(void) const { return m_iLastCommandSent; } virtual uint64_t GetLastActive(void) const { return m_iLastActive; } virtual cec_logical_address GetLogicalAddress(void) const { return m_iLogicalAddress; } virtual const char* GetLogicalAddressName(void) const; @@ -106,6 +107,7 @@ namespace CEC bool m_bMenuActive; bool m_bActiveSource; uint8_t m_iVendorClass; + uint64_t m_iLastCommandSent; uint64_t m_iLastActive; cec_version m_cecVersion; CMutex m_mutex;