#define CEC_CLEAR_INPUT_DEFAULT_WAIT 1000
#define CEC_ACTIVE_SOURCE_SWITCH_RETRY_TIME_MS 5000
+#define CEC_FORWARD_STANDBY_MIN_INTERVAL 10000
#define CEC_MIN_LIB_VERSION 1
#define CEC_LIB_VERSION_MAJOR 1
m_bInitialised(false),
m_bRegistered(false),
m_iCurrentButton(CEC_USER_CONTROL_CODE_UNKNOWN),
- m_buttontime(0)
+ m_buttontime(0),
+ m_iPreventForwardingPowerOffCommand(0)
{
// set the initial configuration
SetConfiguration(configuration);
void CCECClient::AddCommand(const cec_command &command)
{
+ // don't forward the standby opcode more than once every 10 seconds
+ if (command.opcode == CEC_OPCODE_STANDBY)
+ {
+ CLockObject lock(m_mutex);
+ if (m_iPreventForwardingPowerOffCommand != 0 &&
+ m_iPreventForwardingPowerOffCommand > GetTimeMs())
+ return;
+ else
+ m_iPreventForwardingPowerOffCommand = GetTimeMs() + CEC_FORWARD_STANDBY_MIN_INTERVAL;
+ }
+
if (command.destination == CECDEVICE_BROADCAST || GetLogicalAddresses().IsSet(command.destination))
{
CLockObject lock(m_mutex);
PLATFORM::CMutex m_logMutex; /**< mutex that is held when sending a log message back to the client */
cec_user_control_code m_iCurrentButton; /**< the control code of the button that's currently held down (if any) */
int64_t m_buttontime; /**< the timestamp when the button was pressed (in seconds since epoch), or 0 if none was pressed. */
+ int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */
PLATFORM::SyncedBuffer<cec_log_message> m_logBuffer; /**< @deprecated will be removed in v2.0. buffer for log messages */
PLATFORM::SyncedBuffer<cec_keypress> m_keyBuffer; /**< @deprecated will be removed in v2.0. buffer for keypresses */
PLATFORM::SyncedBuffer<cec_command> m_commandBuffer; /**< @deprecated will be removed in v2.0. buffer for commands */