!IsUnsupportedFeature(CEC_OPCODE_GIVE_DEVICE_POWER_STATUS))
{
MarkBusy();
- LIB_CEC->AddLog(CEC_LOG_DEBUG, "<< requesting power status of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
bReturn = m_handler->TransmitRequestPowerStatus(initiator, m_iLogicalAddress, bWaitForResponse);
MarkReady();
}
#define LIB_CEC m_busDevice->GetProcessor()->GetLib()
#define ToString(p) CCECTypeUtils::ToString(p)
+#define REQUEST_POWER_STATUS_TIMEOUT 5000
CCECCommandHandler::CCECCommandHandler(CCECBusDevice *busDevice,
int32_t iTransmitTimeout /* = CEC_DEFAULT_TRANSMIT_TIMEOUT */,
m_bHandlerInited(false),
m_bOPTSendDeckStatusUpdateOnActiveSource(false),
m_vendorId(CEC_VENDOR_UNKNOWN),
- m_iActiveSourcePending(iActiveSourcePending)
+ m_iActiveSourcePending(iActiveSourcePending),
+ m_iPowerStatusRequested(0)
{
}
bool CCECCommandHandler::TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
{
+ if (iDestination == CECDEVICE_TV)
+ {
+ int64_t now(GetTimeMs());
+ if (now - m_iPowerStatusRequested < REQUEST_POWER_STATUS_TIMEOUT)
+ return true;
+ m_iPowerStatusRequested = now;
+ }
+
+ LIB_CEC->AddLog(CEC_LOG_DEBUG, "<< requesting power status of '%s' (%X)", m_busDevice->GetLogicalAddressName(), iDestination);
+
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GIVE_DEVICE_POWER_STATUS);
if (m_iActiveSourcePending == 0 || GetTimeMs() < m_iActiveSourcePending)
return false;
+#ifdef CEC_DEBUGGING
LIB_CEC->AddLog(CEC_LOG_DEBUG, "transmitting delayed activate source command");
+#endif
}
}
virtual bool SourceSwitchAllowed(void) { return true; }
- CCECBusDevice * m_busDevice;
- CCECProcessor * m_processor;
- int32_t m_iTransmitTimeout;
- int32_t m_iTransmitWait;
- int8_t m_iTransmitRetries;
- bool m_bHandlerInited;
- bool m_bOPTSendDeckStatusUpdateOnActiveSource;
- cec_vendor_id m_vendorId;
- int64_t m_iActiveSourcePending;
- PLATFORM::CMutex m_mutex;
+ CCECBusDevice * m_busDevice;
+ CCECProcessor * m_processor;
+ int32_t m_iTransmitTimeout;
+ int32_t m_iTransmitWait;
+ int8_t m_iTransmitRetries;
+ bool m_bHandlerInited;
+ bool m_bOPTSendDeckStatusUpdateOnActiveSource;
+ cec_vendor_id m_vendorId;
+ int64_t m_iActiveSourcePending;
+ PLATFORM::CMutex m_mutex;
+ int64_t m_iPowerStatusRequested;
};
};
#define VL_POWERED_DOWN 0x01
#define VL_UNKNOWN1 0x06
-#define VL_REQUEST_POWER_STATUS_TIMEOUT 5000
-
using namespace CEC;
using namespace PLATFORM;
int64_t iActiveSourcePending /* = 0 */) :
CCECCommandHandler(busDevice, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending),
m_iPowerUpEventReceived(0),
- m_bCapabilitiesSent(false),
- m_iPowerStatusRequested(0)
+ m_bCapabilitiesSent(false)
{
m_vendorId = CEC_VENDOR_PANASONIC;
}
return CEC_ABORT_REASON_INVALID_OPERAND;
}
-bool CVLCommandHandler::TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
-{
- m_iPowerStatusRequested = GetTimeMs();
- return CCECCommandHandler::TransmitRequestPowerStatus(iInitiator, iDestination, bWaitForResponse);
-}
-
bool CVLCommandHandler::SourceSwitchAllowed(void)
{
- int64_t now(GetTimeMs());
- if (!PowerUpEventReceived() && now - m_iPowerStatusRequested > VL_REQUEST_POWER_STATUS_TIMEOUT)
+ if (!PowerUpEventReceived())
TransmitRequestPowerStatus(m_processor->GetPrimaryDevice()->GetLogicalAddress(), CECDEVICE_TV, false);
return PowerUpEventReceived();
bool PowerUpEventReceived(void);
bool SupportsDeviceType(const cec_device_type type) const { return type != CEC_DEVICE_TYPE_RECORDING_DEVICE; };
cec_device_type GetReplacementDeviceType(const cec_device_type type) const { return type == CEC_DEVICE_TYPE_RECORDING_DEVICE ? CEC_DEVICE_TYPE_PLAYBACK_DEVICE : type; }
- bool TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);
bool SourceSwitchAllowed(void);
PLATFORM::CMutex m_mutex;
uint64_t m_iPowerUpEventReceived;
bool m_bCapabilitiesSent;
- int64_t m_iPowerStatusRequested;
};
};