Add new method PowerOnScreensaver. closes #114
authorJavier Marcet <javier@marcet.info>
Wed, 2 Jan 2013 01:05:36 +0000 (02:05 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Tue, 26 Feb 2013 22:49:31 +0000 (23:49 +0100)
include/cectypes.h
src/LibCecSharp/CecSharpTypes.h
src/LibCecSharp/LibCecSharp.cpp
src/lib/CECClient.cpp

index 3a004aab31e35f617b104452ddf481d6f1e04266..58c7f6c15f32c4ca224af8f455bc5304da4280a9 100644 (file)
@@ -174,6 +174,11 @@ namespace CEC {
  */
 #define CEC_DEFAULT_SETTING_POWER_OFF_SCREENSAVER     1
 
+/*!
+ * default value for settings "wake up when deactivating the screensaver"
+ */
+#define CEC_DEFAULT_SETTING_POWER_ON_SCREENSAVER      1
+
 /*!
  * default value for settings "power off on standby"
  */
@@ -1452,6 +1457,7 @@ struct libcec_configuration
   uint8_t               bUseTVMenuLanguage;   /*!< use the menu language of the TV in the player application */
   uint8_t               bActivateSource;      /*!< make libCEC the active source on the bus when starting the player application */
   uint8_t               bPowerOffScreensaver; /*!< put devices in standby mode when activating the screensaver */
+  uint8_t               bPowerOnScreensaver;  /*!< wake devices when deactivating the screensaver */
   uint8_t               bPowerOffOnStandby;   /*!< put this PC in standby mode when the TV is switched off. only used when bShutdownOnStandby = 0  */
   uint8_t               bSendInactiveSource;  /*!< send an 'inactive source' message when stopping the player. added in 1.5.1 */
 
@@ -1504,8 +1510,9 @@ struct libcec_configuration
                   cecVersion                == other.cecVersion &&
                   adapterType               == other.adapterType &&
                   iDoubleTapTimeoutMs       == other.iDoubleTapTimeoutMs &&
-                  (other.clientVersion <= CEC_CLIENT_VERSION_2_0_4 || comboKey           == other.comboKey) &&
-                  (other.clientVersion <= CEC_CLIENT_VERSION_2_0_4 || iComboKeyTimeoutMs == other.iComboKeyTimeoutMs));
+                  (other.clientVersion <= CEC_CLIENT_VERSION_2_0_4 || comboKey            == other.comboKey) &&
+                  (other.clientVersion <= CEC_CLIENT_VERSION_2_0_4 || iComboKeyTimeoutMs  == other.iComboKeyTimeoutMs) &&
+                  (other.clientVersion <  CEC_CLIENT_VERSION_2_1_0 || bPowerOnScreensaver == other.bPowerOnScreensaver));
   }
 
   bool operator!=(const libcec_configuration &other) const
@@ -1529,6 +1536,7 @@ struct libcec_configuration
     bUseTVMenuLanguage =              CEC_DEFAULT_SETTING_USE_TV_MENU_LANGUAGE;
     bActivateSource =                 CEC_DEFAULT_SETTING_ACTIVATE_SOURCE;
     bPowerOffScreensaver =            CEC_DEFAULT_SETTING_POWER_OFF_SCREENSAVER;
+    bPowerOnScreensaver =             CEC_DEFAULT_SETTING_POWER_ON_SCREENSAVER;
     bPowerOffOnStandby =              CEC_DEFAULT_SETTING_POWER_OFF_ON_STANDBY;
     bShutdownOnStandby =              CEC_DEFAULT_SETTING_SHUTDOWN_ON_STANDBY;
     bSendInactiveSource =             CEC_DEFAULT_SETTING_SEND_INACTIVE_SOURCE;
index 67829daf60911fb801d4672f1547dbf4fd4901cc..78c2a8dc76f10896d0ebf1b1f8c3e0db72a2736e 100644 (file)
@@ -1794,6 +1794,9 @@ namespace CecSharp
 
       if (ServerVersion >= CecServerVersion::Version1_8_2)
         AdapterType = (CecAdapterType)config.adapterType;
+
+      if (ServerVersion >= CecServerVersion::Version2_1_0)
+        PowerOnScreensaver = config.bPowerOnScreensaver == 1;
     }
 
     /// <summary>
index ff3c619f487694166c2ec37d23aa37763e446c67..562d13af8a5db27cb07b5f86bcf729df5ebb270a 100644 (file)
@@ -822,6 +822,9 @@ namespace CecSharp
       if (netConfig->ServerVersion >= CecServerVersion::Version1_8_0)
         config.cecVersion = (cec_version)netConfig->CECVersion;
 
+      if (netConfig->ServerVersion >= CecServerVersion::Version2_1_0)
+        config.bPowerOnScreensaver  = netConfig->PowerOnScreensaver ? 1 : 0;
+
       config.callbacks = &g_cecCallbacks;
     }
 
index d0699130cd303a6bc247351edd318653ce7cdd5a..a67b956c7cf5d71f2e94041a4a5b93dbc7b66083 100644 (file)
@@ -822,6 +822,7 @@ bool CCECClient::GetCurrentConfiguration(libcec_configuration &configuration)
   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;
@@ -888,6 +889,11 @@ bool CCECClient::SetConfiguration(const libcec_configuration &configuration)
       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);