/*
* This file is part of the libCEC(R) library.
*
- * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited. All rights reserved.
+ * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved.
* libCEC(R) is an original work, containing original code.
*
* libCEC(R) is a trademark of Pulse-Eight Limited.
configuration.wakeDevices = m_configuration.wakeDevices;
configuration.powerOffDevices = m_configuration.powerOffDevices;
configuration.bPowerOffScreensaver = m_configuration.bPowerOffScreensaver;
+ configuration.bPowerOnScreensaver = m_configuration.bPowerOnScreensaver;
configuration.bPowerOffOnStandby = m_configuration.bPowerOffOnStandby;
configuration.bSendInactiveSource = m_configuration.bSendInactiveSource;
configuration.logicalAddresses = m_configuration.logicalAddresses;
m_configuration.bMonitorOnly = configuration.bMonitorOnly;
m_configuration.cecVersion = configuration.cecVersion;
m_configuration.adapterType = configuration.adapterType;
- m_configuration.iDoubleTapTimeoutMs = configuration.iDoubleTapTimeoutMs;
+ m_configuration.iDoubleTapTimeout50Ms = configuration.iDoubleTapTimeout50Ms;
m_configuration.deviceTypes.Add(configuration.deviceTypes[0]);
if (m_configuration.clientVersion >= CEC_CLIENT_VERSION_2_0_5)
m_configuration.comboKey = defaultSettings.comboKey;
m_configuration.iComboKeyTimeoutMs = defaultSettings.iComboKeyTimeoutMs;
}
+
+ if (m_configuration.clientVersion >= CEC_CLIENT_VERSION_2_1_0)
+ m_configuration.bPowerOnScreensaver = configuration.bPowerOnScreensaver;
+ else
+ m_configuration.bPowerOnScreensaver = defaultSettings.bPowerOnScreensaver;
}
bool bNeedReinit(false);
{
key.duration = (unsigned int) (GetTimeMs() - m_buttontime);
- cec_user_control_code comboKey(m_configuration.comboKey);
- uint32_t iTimeoutMs(m_configuration.iComboKeyTimeoutMs);
-
- if (key.duration > iTimeoutMs || m_iCurrentButton != comboKey || bSendComboKey)
+ if (key.duration > m_configuration.iComboKeyTimeoutMs ||
+ m_configuration.iComboKeyTimeoutMs == 0 ||
+ m_iCurrentButton != m_configuration.comboKey ||
+ bSendComboKey)
{
key.keycode = m_iCurrentButton;
void CCECClient::AddKey(const cec_keypress &key)
{
- if (key.keycode > CEC_USER_CONTROL_CODE_MAX &&
+ if (key.keycode > CEC_USER_CONTROL_CODE_MAX ||
key.keycode < CEC_USER_CONTROL_CODE_SELECT)
{
// send back the previous key if there is one
{
CLockObject lock(m_mutex);
- if (m_iCurrentButton == comboKey && key.duration == 0)
+ if (m_configuration.iComboKeyTimeoutMs > 0 && m_iCurrentButton == comboKey && key.duration == 0)
{
// stop + ok -> exit
if (key.keycode == CEC_USER_CONTROL_CODE_SELECT)
m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS);
if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN &&
- ((m_iCurrentButton == comboKey && iNow - m_buttontime > iTimeoutMs) ||
+ ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_buttontime > iTimeoutMs) ||
(m_iCurrentButton != comboKey && iNow - m_buttontime > CEC_BUTTON_TIMEOUT)))
{
key.duration = (unsigned int) (iNow - m_buttontime);
m_configuration.callbacks->CBCecCommand(m_configuration.callbackParam, command);
}
+uint32_t CCECClient::DoubleTapTimeoutMS(void)
+{
+ CLockObject lock(m_cbMutex);
+ return m_configuration.clientVersion >= CEC_CLIENT_VERSION_2_2_0 ?
+ m_configuration.iDoubleTapTimeout50Ms * DOUBLE_TAP_TIMEOUT_UNIT_SIZE :
+ m_configuration.iDoubleTapTimeout50Ms;
+}
+
void CCECClient::CallbackAddKey(const cec_keypress &key)
{
CLockObject lock(m_cbMutex);
int64_t now = GetTimeMs();
if (m_lastKeypress.keycode != key.keycode ||
key.duration > 0 ||
- now - m_iLastKeypressTime >= m_configuration.iDoubleTapTimeoutMs)
+ now - m_iLastKeypressTime >= DoubleTapTimeoutMS())
{
// no double tap
if (key.duration == 0)