From: <mic...@us...> - 2011-10-21 18:58:17
|
Revision: 4313 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4313&view=rev Author: michael-t Date: 2011-10-21 18:58:08 +0000 (Fri, 21 Oct 2011) Log Message: ----------- New experimental alpha version 1.2.5.1 for MP 1.2.1 FINAL Modified Paths: -------------- trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IEpgHandler.cs trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerScheduler.cs trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerSettings.cs trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/PowerManager.cs trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/PowerScheduler.Interfaces.csproj trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/PowerSettings.cs trunk/plugins/PowerScheduler++/Test/1.2.5.1/MPEI/PowerScheduler++.xmp2 trunk/plugins/PowerScheduler++/Test/1.2.5.1/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/RemoteClientStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/1.2.5.1/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/XmlTvImportWakeupHandler.cs trunk/plugins/PowerScheduler++/Test/1.2.5.1/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerScheduler.cs trunk/plugins/PowerScheduler++/Test/1.2.5.1/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerScheduler.csproj trunk/plugins/PowerScheduler++/Test/1.2.5.1/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerSchedulerFactory.cs trunk/plugins/PowerScheduler++/Test/1.2.5.1/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerSchedulerMasterSetup.Designer.cs trunk/plugins/PowerScheduler++/Test/1.2.5.1/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerSchedulerMasterSetup.cs trunk/plugins/PowerScheduler++/Test/1.2.5.1/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerSchedulerMasterSetup.resx trunk/plugins/PowerScheduler++/Test/1.2.5.1/TvEngine3/TVLibrary/Plugins/PowerScheduler/Properties/AssemblyInfo.cs trunk/plugins/PowerScheduler++/Test/1.2.5.1/TvEngine3/TVLibrary/Plugins/PowerScheduler/SelectShareForm.cs trunk/plugins/PowerScheduler++/Test/1.2.5.1/VersionInfo.cs trunk/plugins/PowerScheduler++/Test/1.2.5.1/mediaportal/PowerSchedulerClientPlugin/Handlers/WakeableStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/1.2.5.1/mediaportal/PowerSchedulerClientPlugin/Handlers/WakeableWakeupHandler.cs trunk/plugins/PowerScheduler++/Test/1.2.5.1/mediaportal/PowerSchedulerClientPlugin/PowerScheduler.cs trunk/plugins/PowerScheduler++/Test/1.2.5.1/mediaportal/PowerSchedulerClientPlugin/PowerSchedulerClientPlugin.csproj trunk/plugins/PowerScheduler++/Test/1.2.5.1/mediaportal/PowerSchedulerClientPlugin/PowerSchedulerClientSetup.cs trunk/plugins/PowerScheduler++/Test/1.2.5.1/mediaportal/PowerSchedulerClientPlugin/PowerSchedulerClientSetup.designer.cs trunk/plugins/PowerScheduler++/Test/1.2.5.1/mediaportal/PowerSchedulerClientPlugin/PowerSchedulerClientSetup.resx trunk/plugins/PowerScheduler++/Test/1.2.5.1/mediaportal/PowerSchedulerClientPlugin/Properties/AssemblyInfo.cs Added Paths: ----------- trunk/plugins/PowerScheduler++/Test/1.2.5.1/ Modified: trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IEpgHandler.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/1.1.7.1/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IEpgHandler.cs 2011-10-21 18:36:21 UTC (rev 4312) +++ trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IEpgHandler.cs 2011-10-21 18:58:08 UTC (rev 4313) @@ -29,8 +29,7 @@ public delegate void EPGScheduleHandler(); /// <summary> - /// Provides access to PowerScheduler's EPG interface for - /// EPG plugins. + /// Provides access to PowerScheduler's EPG interface for EPG plugins. /// </summary> public interface IEpgHandler { Modified: trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerScheduler.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/1.1.7.1/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerScheduler.cs 2011-10-21 18:36:21 UTC (rev 4312) +++ trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerScheduler.cs 2011-10-21 18:58:08 UTC (rev 4313) @@ -27,7 +27,7 @@ namespace TvEngine.PowerScheduler.Interfaces { /// <summary> - /// EvenHandler delegate for PowerScheduler events + /// EventHandler delegate for PowerScheduler events /// </summary> /// <param name="args"></param> public delegate void PowerSchedulerEventHandler(PowerSchedulerEventArgs args); @@ -114,7 +114,6 @@ void GetCurrentState(bool refresh, out bool unattended, out bool disAllowShutdown, out String disAllowShutdownHandler, out DateTime nextWakeupTime, out String nextWakeupHandler); - /// <summary> /// Checks if a suspend request is in progress /// </summary> Modified: trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerSettings.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/1.1.7.1/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerSettings.cs 2011-10-21 18:36:21 UTC (rev 4312) +++ trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerSettings.cs 2011-10-21 18:58:08 UTC (rev 4313) @@ -25,6 +25,27 @@ namespace TvEngine.PowerScheduler.Interfaces { /// <summary> + /// PowerScheduler shutdown mode enumeration + /// </summary> + public enum ShutdownMode + { + Sleep, + Hibernate, + StayOn, + ShutDown + } + + /// <summary> + /// PowerScheduler++ standby mode enumeration + /// </summary> + public enum StandbyMode + { + StandbyAllowed, + StandbyPrevented, + AwayModeRequested + } + + /// <summary> /// Provides access to PowerScheduler's settings /// </summary> public interface IPowerSettings @@ -73,9 +94,9 @@ int CheckInterval { get; } /// <summary> - /// How should put the system into standby? suspend/hibernate/stayon - /// suspend uses S3, hibernate uses S4, stayon is for debugging purposes and - /// doesn't put the system into standby at all + /// <summary> + /// How should put the system into standby? suspend/hibernate/stayon/shutdown + /// suspend uses S3, hibernate uses S4, stayon doesn't do anyting, shutdown uses S5 (soft power off) /// </summary> ShutdownMode ShutdownMode { get; } } Modified: trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IStandbyHandler.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/1.1.7.1/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IStandbyHandler.cs 2011-10-21 18:36:21 UTC (rev 4312) +++ trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IStandbyHandler.cs 2011-10-21 18:58:08 UTC (rev 4313) @@ -24,6 +24,9 @@ namespace TvEngine.PowerScheduler.Interfaces { + /// <summary> + /// StandbyHandler interface for PowerScheduler + /// </summary> public interface IStandbyHandler { /// <summary> @@ -43,14 +46,13 @@ } /// <summary> - /// Extension to the IStandbyHandler interface for away mode + /// Extension to the IStandbyHandler interface for PowerScheduler++ /// </summary> public interface IStandbyHandlerEx : IStandbyHandler { /// <summary> - /// Indicator whether away mode is required by standby handler or not + /// Indicator which standby mode is requested by the handler /// </summary> - bool RequireAwayMode { get; } + StandbyMode StandbyMode { get; } } - } \ No newline at end of file Modified: trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/PowerManager.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/1.1.7.1/Common-MP-TVE3/PowerScheduler.Interfaces/PowerManager.cs 2011-10-21 18:36:21 UTC (rev 4312) +++ trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/PowerManager.cs 2011-10-21 18:58:08 UTC (rev 4313) @@ -21,64 +21,21 @@ #region Usings using System; +using System.Net; using System.Runtime.InteropServices; -using System.Threading; #endregion namespace TvEngine.PowerScheduler.Interfaces { /// <summary> - /// Provides methods for handling system power events + /// Provides static methods for managing system power states, events and settings /// </summary> - public class PowerManager + public static class PowerManager { - #region Variables + #region System power constants and enumerations /// <summary> - /// Enable / disable away mode - /// </summary> - private bool _awayMode; - - /// <summary> - /// Thread for calling SetThreadExecutionState() - /// </summary> - private Thread _awayModeThread; - - #endregion - - #region Constructor/Destructor - - /// <summary> - /// Constructor starts the thread for away mode and inits PowerSettings array - /// </summary> - unsafe public PowerManager() - { - if (Environment.OSVersion.Version.Major >= 6) - { - // Start the thread to enable/disable away mode - _awayModeThread = new Thread(AwayModeThread); - _awayModeThread.Name = "ExecutionStateThread"; - _awayModeThread.IsBackground = true; - _awayModeThread.Start(); - } - } - - ~PowerManager() - { - if (_awayModeThread != null) - { - _awayModeThread.Abort(); - _awayModeThread.Join(100); - _awayModeThread = null; - } - } - - #endregion - - #region External power management methods and enumerations - - /// <summary> /// The thread's execution requirements /// </summary> [Flags] @@ -117,128 +74,306 @@ } /// <summary> - /// Enables an application to inform the system that it is in use, thereby preventing the system - /// from entering sleep or turning off the display while the application is running. + /// Flags to register for power setting change notification /// </summary> - /// <param name="esFlags">The thread's execution requirements - /// /// </param> - /// <returns> - /// If the function succeeds, the return value is the previous thread execution state. - /// If the function fails, the return value is NULL. - /// </returns> - [DllImport("kernel32.dll", SetLastError = true, EntryPoint = "SetThreadExecutionState")] - private static extern ExecutionState SetThreadExecutionState(ExecutionState esFlags); + private const int DEVICE_NOTIFY_WINDOW_HANDLE = 0x00000000; + private const int DEVICE_NOTIFY_SERVICE_HANDLE = 0x00000001; - #endregion + /// <summary> + /// Constants for power notifications + /// </summary> + public const int WM_POWERBROADCAST = 0x0218; + public const int PBT_APMQUERYSUSPEND = 0x0000; + public const int PBT_APMQUERYSUSPENDFAILED = 0x0002; + public const int PBT_APMSUSPEND = 0x0004; + public const int PBT_APMRESUMECRITICAL = 0x0006; + public const int PBT_APMRESUMESUSPEND = 0x0007; + public const int PBT_APMRESUMEAUTOMATIC = 0x0012; + public const int PBT_POWERSETTINGCHANGE = 0x8013; + public const int BROADCAST_QUERY_DENY = 0x424D5144; - #region Power management wrapper methods + /// <summary> + /// This structure is sent when the PBT_POWERSETTINGSCHANGE message is sent. + /// It describes the power setting that has changed and contains data about the change + /// </summary> + [StructLayout(LayoutKind.Sequential, Pack = 4)] + public struct POWERBROADCAST_SETTING + { + public Guid PowerSetting; + public uint DataLength; + public byte Data; + } /// <summary> - /// Set the PowerManager to allow standby + /// Handle to unregister for power setting change notification /// </summary> - /// <returns>bool indicating whether or not standby is allowed</returns> - public bool AllowStandby() + private static IntPtr _hAwayMode = (IntPtr)null; + + /// <summary> + /// Guid to register for power setting change notification + /// </summary> + public static Guid GUID_SYSTEM_AWAYMODE = new Guid("98a7f580-01f7-48aa-9c0f-44352c29e5C0"); + + /// <summary> + /// System power setting guids + /// </summary> + private static Guid NO_SUBGROUP_GUID = new Guid("fea3413e-7e05-4911-9a71-700331f1c294"); + private static Guid GUID_LOCK_CONSOLE_ON_WAKE = new Guid("0e796bdb-100d-47d6-a2d5-f7d2daa51f51"); + private static Guid GUID_SUB_SLEEP = new Guid("238c9fa8-0aad-41ed-83f4-97be242c8f20"); + private static Guid GUID_ALLOW_AWAY_MODE = new Guid("25dfa149-5dd1-4736-b5ab-e8a37b5b8187"); + private static Guid GUID_SLEEP_AFTER = new Guid("29f6c1db-86da-48c5-9fdb-f2b67b1f44da"); + private static Guid GUID_ALLOW_HYBRID_SLEEP = new Guid("94ac6d29-73ce-41a6-809f-6363ba21b47e"); + private static Guid GUID_HIBERNATE_AFTER = new Guid("9d7815a6-7ee4-497e-8888-515a05f02364"); + private static Guid GUID_ALLOW_RTC_WAKE = new Guid("bd3b718a-0680-4d9d-8ab2-e1d2b4ac806d"); + private static Guid GUID_SUB_POWER_BUTTONS_AND_LID = new Guid("4f971e89-eebd-4455-a8de-9e59040e7347"); + private static Guid GUID_LID_CLOSE_ACTION = new Guid("5ca83367-6e45-459f-a27b-476b1d01c936"); + private static Guid GUID_POWER_BUTTON_ACTION = new Guid("7648efa3-dd9c-4e3e-b566-50f929386280"); + private static Guid GUID_SLEEP_BUTTON_ACTION = new Guid("96996bc0-ad50-47ec-923b-6f41874dd9eb"); + private static Guid GUID_SUB_MULTIMEDIA = new Guid("9596fb26-9850-41fd-ac3e-f7c3c00afd4b"); + private static Guid GUID_WHEN_SHARING_MEDIA = new Guid("03680956-93bc-4294-bba6-4e0f09bb717f"); + + /// <summary> + /// System power setting structure + /// </summary> + private struct SystemPowerSetting { - return true; + public Guid settingGuid; + public Guid subgroupGuid; } /// <summary> - /// Set the PowerManager to prevent standby + /// Array of system power settings (index is SystemPowerSettingsType) /// </summary> + static SystemPowerSetting[] SystemPowerSettings = new SystemPowerSetting[] + { + new SystemPowerSetting // LOCK_CONSOLE_ON_WAKE + { + settingGuid = GUID_LOCK_CONSOLE_ON_WAKE, + subgroupGuid = NO_SUBGROUP_GUID, + }, + new SystemPowerSetting // ALLOW_AWAY_MODE + { + settingGuid = GUID_ALLOW_AWAY_MODE, + subgroupGuid = GUID_SUB_SLEEP, + }, + new SystemPowerSetting // SLEEP_AFTER + { + settingGuid = GUID_SLEEP_AFTER, + subgroupGuid = GUID_SUB_SLEEP, + }, + new SystemPowerSetting // ALLOW_HYBRID_SLEEP + { + settingGuid = GUID_ALLOW_HYBRID_SLEEP, + subgroupGuid = GUID_SUB_SLEEP, + }, + new SystemPowerSetting // HIBERNATE_AFTER + { + settingGuid = GUID_HIBERNATE_AFTER, + subgroupGuid = GUID_SUB_SLEEP, + }, + new SystemPowerSetting // ALLOW_RTC_WAKE + { + settingGuid = GUID_ALLOW_RTC_WAKE, + subgroupGuid = GUID_SUB_SLEEP, + }, + new SystemPowerSetting // LID_CLOSE_ACTION + { + settingGuid = GUID_LID_CLOSE_ACTION, + subgroupGuid = GUID_SUB_POWER_BUTTONS_AND_LID, + }, + new SystemPowerSetting // POWER_BUTTON_ACTION + { + settingGuid = GUID_POWER_BUTTON_ACTION, + subgroupGuid = GUID_SUB_POWER_BUTTONS_AND_LID, + }, + new SystemPowerSetting // SLEEP_BUTTON_ACTION + { + settingGuid = GUID_SLEEP_BUTTON_ACTION, + subgroupGuid = GUID_SUB_POWER_BUTTONS_AND_LID, + }, + new SystemPowerSetting // WHEN_SHARING_MEDIA + { + settingGuid = GUID_WHEN_SHARING_MEDIA, + subgroupGuid = GUID_SUB_MULTIMEDIA, + }, + }; + + /// <summary> + /// Power setting type (index to PowerSettings) + /// </summary> + public enum SystemPowerSettingType + { + LOCK_CONSOLE_ON_WAKE, + ALLOW_AWAY_MODE, + STANDBYIDLE, + ALLOW_HYBRID_SLEEP, + HIBERNATE_AFTER, + ALLOW_RTC_WAKE, + LID_CLOSE_ACTION, + POWER_BUTTON_ACTION, + SLEEP_BUTTON_ACTION, + WHEN_SHARING_MEDIA + } + + #endregion + + #region Public power management methods + + /// <summary> + /// Reset the system idle timeout to prevent standby + /// </summary> /// <returns>bool indicating whether or not standby is prevented</returns> - public bool PreventStandby() + public static void ResetIdleTimer() { - lock (this) - { - ExecutionState result = SetThreadExecutionState(ExecutionState.ES_SYSTEM_REQUIRED); - //Log.Debug("PowerManager.PreventStandBy: SetThreadExecutionState() returned: {0}", result.ToString()); - if (result == ExecutionState.Error) - { - return false; - } - return true; - } + // ES_SYSTEM_REQUIRED without ES_CONTINUOS resets the idle timeout + SetThreadExecutionState(ExecutionState.ES_SYSTEM_REQUIRED); } /// <summary> - /// Sets AwayModeRequired execution state; triggers AwayModeThread to do the real work + /// Sets thread execution state to allow / prevent standby (always must be called by one and the same thread) /// </summary> /// <param name="awayModeRequired">Enable/disable away mode</param> - public void SetAwayModeRequired(bool awayModeRequired) + public static void SetStandbyMode(StandbyMode standbyMode) { - if (Environment.OSVersion.Version.Major >= 6) + switch (standbyMode) { - Monitor.Enter(_awayModeThread); - _awayMode = awayModeRequired; - Monitor.Pulse(_awayModeThread); - Monitor.Exit(_awayModeThread); + case StandbyMode.StandbyAllowed: + SetThreadExecutionState(ExecutionState.ES_CONTINUOUS); + break; + case StandbyMode.StandbyPrevented: + SetThreadExecutionState(ExecutionState.ES_SYSTEM_REQUIRED | ExecutionState.ES_CONTINUOUS); + break; + case StandbyMode.AwayModeRequested: + if (Environment.OSVersion.Version.Major >= 6) + SetThreadExecutionState(ExecutionState.ES_SYSTEM_REQUIRED | ExecutionState.ES_AWAYMODE_REQUIRED | ExecutionState.ES_CONTINUOUS); + else + SetThreadExecutionState(ExecutionState.ES_SYSTEM_REQUIRED | ExecutionState.ES_CONTINUOUS); + break; } } /// <summary> - /// Gets triggered by SetAwayMode and sets the execution state to the desired value - /// /// </summary> - private void AwayModeThread() + /// Register for away mode notifications + /// </summary> + /// <param name="hRecipient">Window handle (e.g. GUIGraphicsContext.ActiveForm)</param> + public static void RegisterAwayModeNotification(IntPtr hRecipient) { - while (true) - { - Monitor.Enter(_awayModeThread); - Monitor.Wait(_awayModeThread); - if (_awayMode) - SetThreadExecutionState(ExecutionState.ES_AWAYMODE_REQUIRED | ExecutionState.ES_CONTINUOUS); - else - SetThreadExecutionState(ExecutionState.ES_CONTINUOUS); - Monitor.Exit(_awayModeThread); - } + if (Environment.OSVersion.Version.Major >= 6 && _hAwayMode == (IntPtr)null) + _hAwayMode = RegisterPowerSettingNotification(hRecipient, ref GUID_SYSTEM_AWAYMODE, DEVICE_NOTIFY_WINDOW_HANDLE); } - #endregion + /// <summary> + /// Unregister for away mode notifications + /// </summary> + public static void UnregisterAwayModeNotification() + { + if (Environment.OSVersion.Version.Major >= 6 && _hAwayMode != (IntPtr)null) + UnregisterPowerSettingNotification(_hAwayMode); + _hAwayMode = (IntPtr)null; + } - #region External power setting change notification methods and enumerations - /// <summary> - /// Flags to register for power setting change notification + /// Retrieves guid of active power scheme /// </summary> - private const int DEVICE_NOTIFY_WINDOW_HANDLE = 0x00000000; - private const int DEVICE_NOTIFY_SERVICE_HANDLE = 0x00000001; + /// <returns>Active power scheme guid</returns> + public static Guid GetActivePowerScheme() + { + try + { + IntPtr ptr = IntPtr.Zero; + PowerGetActiveScheme(IntPtr.Zero, ref ptr); + Guid activePowerScheme = (Guid)Marshal.PtrToStructure(ptr, typeof(Guid)); + return activePowerScheme; + } + catch (Exception) { } + return Guid.Empty; + } + /// <summary> - /// Handle to unregister for power setting change notification + /// Get system power setting /// </summary> - private IntPtr hAwayMode; + /// <param name="scheme"></param> + /// <param name="settingType"></param> + /// <returns>System power setting AC value</returns> + public static UInt32 GetSystemPowerSetting(Guid scheme, SystemPowerSettingType settingType) + { + UInt32 systemPowerSetting = 0; + try + { + SystemPowerSetting ps = SystemPowerSettings[(int)settingType]; + systemPowerSetting = ReadACPowerValueIndex(scheme, ps.subgroupGuid, ps.settingGuid); + } + catch (Exception) { } + + return systemPowerSetting; + } + /// <summary> - /// Constants for power notifications + /// Set system power setting AC and DC value /// </summary> - public const int WM_POWERBROADCAST = 0x0218; - public const int PBT_APMQUERYSUSPEND = 0x0000; - public const int PBT_APMQUERYSUSPENDFAILED = 0x0002; - public const int PBT_APMSUSPEND = 0x0004; - public const int PBT_APMRESUMECRITICAL = 0x0006; - public const int PBT_APMRESUMESUSPEND = 0x0007; - public const int PBT_APMRESUMEAUTOMATIC = 0x0012; - public const int PBT_POWERSETTINGCHANGE = 0x8013; - public const int BROADCAST_QUERY_DENY = 0x424D5144; + /// <param name="scheme"></param> + /// <param name="settingType"></param> + /// <param name="value"></param> + public static void SetSystemPowerSetting(Guid scheme, SystemPowerSettingType settingType, UInt32 value) + { + UInt32 systemPowerSetting; + try + { + SystemPowerSetting ps = SystemPowerSettings[(int)settingType]; + systemPowerSetting = ReadACPowerValueIndex(scheme, ps.subgroupGuid, ps.settingGuid); + if (systemPowerSetting != value) + WriteACPowerValueIndex(scheme, ps.subgroupGuid, ps.settingGuid, value); + systemPowerSetting = ReadDCPowerValueIndex(scheme, ps.subgroupGuid, ps.settingGuid); + if (systemPowerSetting != value) + WriteDCPowerValueIndex(scheme, ps.subgroupGuid, ps.settingGuid, value); + } + catch (Exception) { } + + } + /// <summary> - /// This structure is sent when the PBT_POWERSETTINGSCHANGE message is sent. - /// It describes the power setting that has changed and contains data about the change + /// Checks if the given hostname/IP address is the local host /// </summary> - [StructLayout(LayoutKind.Sequential, Pack = 4)] - public struct POWERBROADCAST_SETTING + /// <param name="serverName">hostname/IP address to check</param> + /// <returns>is this name/address local?</returns> + public static bool IsLocal(string serverName) { - public Guid PowerSetting; - public uint DataLength; - public byte Data; - } + foreach (string name in new string[] { "localhost", "127.0.0.1", Dns.GetHostName() }) + { + if (serverName.Equals(name, StringComparison.CurrentCultureIgnoreCase)) + return true; + } + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + foreach (IPAddress address in hostEntry.AddressList) + { + if (address.ToString().Equals(serverName, StringComparison.CurrentCultureIgnoreCase)) + return true; + } + return false; + } + #endregion + + #region System power management functions imports + /// <summary> - /// Guid to register for power setting change notification + /// Enables an application to inform the system that it is in use, thereby preventing the system + /// from entering sleep or turning off the display while the application is running. /// </summary> - public static Guid GUID_SYSTEM_AWAYMODE = new Guid("98a7f580-01f7-48aa-9c0f-44352c29e5C0"); + /// <param name="esFlags">The thread's execution requirements + /// /// </param> + /// <returns> + /// If the function succeeds, the return value is the previous thread execution state. + /// If the function fails, the return value is NULL. + /// </returns> + [DllImport("kernel32.dll", SetLastError = true, EntryPoint = "SetThreadExecutionState")] + private static extern ExecutionState SetThreadExecutionState(ExecutionState esFlags); /// <summary> - /// + /// Registers the application to receive power setting notifications for the specific power setting event /// </summary> /// <param name="hRecipient"></param> /// <param name="PowerSettingGuid"></param> @@ -248,36 +383,149 @@ private static extern IntPtr RegisterPowerSettingNotification(IntPtr hRecipient, ref Guid PowerSettingGuid, Int32 Flags); /// <summary> - /// + /// Unregisters the power setting notification /// </summary> /// <param name="handle"></param> /// <returns></returns> [DllImport(@"User32", SetLastError = true, EntryPoint = "UnregisterPowerSettingNotification", CallingConvention = CallingConvention.StdCall)] private static extern bool UnregisterPowerSettingNotification(IntPtr handle); + /// <summary> + /// Retrieves the active power scheme and returns a GUID that identifies the scheme. + /// </summary> + /// <param name="userRootPowerKey"></param> + /// <param name="activePolicyGuid"></param> + /// <returns></returns> + [DllImport("powrprof.dll", SetLastError = true)] + private static extern UInt32 PowerGetActiveScheme(IntPtr RootPowerKey, ref IntPtr activePolicyGuid); + + /// <summary> + /// Retrieves the AC index of the specified power setting. + /// </summary> + /// <param name="rootPowerKey"></param> + /// <param name="schemeGuid"></param> + /// <param name="subgroupOfPowerSettingsGuid"></param> + /// <param name="powerSettingGuid"></param> + /// <param name="valueIndex"></param> + /// <returns></returns> + [DllImport("powrprof.dll", SetLastError = true)] + private static extern UInt32 PowerReadACValueIndex(IntPtr RootPowerKey, ref Guid SchemeGuid, + ref Guid SubGroupOfPowerSettingsGuid, ref Guid PowerSettingGuid, ref UInt32 AcValueIndex); + + /// <summary> + /// Writes the AC index of the specified power setting. + /// </summary> + /// <param name="rootPowerKey"></param> + /// <param name="schemeGuid"></param> + /// <param name="subgroupOfPowerSettingsGuid"></param> + /// <param name="powerSettingGuid"></param> + /// <param name="valueIndex"></param> + /// <returns></returns> + [DllImport("powrprof.dll", SetLastError = true)] + private static extern UInt32 PowerWriteACValueIndex(IntPtr RootPowerKey, ref Guid SchemeGuid, + ref Guid SubGroupOfPowerSettingsGuid, ref Guid PowerSettingGuid, UInt32 AcValueIndex); + + /// <summary> + /// Retrieves the DC index of the specified power setting. + /// </summary> + /// <param name="rootPowerKey"></param> + /// <param name="schemeGuid"></param> + /// <param name="subgroupOfPowerSettingsGuid"></param> + /// <param name="powerSettingGuid"></param> + /// <param name="valueIndex"></param> + /// <returns></returns> + [DllImport("powrprof.dll", SetLastError = true)] + private static extern UInt32 PowerReadDCValueIndex(IntPtr RootPowerKey, ref Guid SchemeGuid, + ref Guid SubGroupOfPowerSettingsGuid, ref Guid PowerSettingGuid, ref UInt32 DcValueIndex); + + /// <summary> + /// Writes the DC index of the specified power setting. + /// </summary> + /// <param name="rootPowerKey"></param> + /// <param name="schemeGuid"></param> + /// <param name="subgroupOfPowerSettingsGuid"></param> + /// <param name="powerSettingGuid"></param> + /// <param name="valueIndex"></param> + /// <returns></returns> + [DllImport("powrprof.dll", SetLastError = true)] + private static extern UInt32 PowerWriteDCValueIndex(IntPtr RootPowerKey, ref Guid SchemeGuid, + ref Guid SubGroupOfPowerSettingsGuid, ref Guid PowerSettingGuid, UInt32 DcValueIndex); + #endregion - #region Power setting change notification wrapper methods + #region Private power management wrapper methods /// <summary> - /// Register for away mode notifications + /// Wrapper for PowerReadACValueIndex /// </summary> - /// <param name="hRecipient">Window handle (e.g. GUIGraphicsContext.ActiveForm)</param> - public void RegisterAwayModeNotification(IntPtr hRecipient) + /// <param name="schemeGuid"></param> + /// <param name="subgroupGuid"></param> + /// <param name="settingGuid"></param> + /// <returns></returns> + private static UInt32 ReadACPowerValueIndex(Guid schemeGuid, Guid subgroupGuid, Guid settingGuid) { - if (Environment.OSVersion.Version.Major >= 6) - hAwayMode = RegisterPowerSettingNotification(hRecipient, ref GUID_SYSTEM_AWAYMODE, DEVICE_NOTIFY_WINDOW_HANDLE); + UInt32 value = 0; + try + { + PowerReadACValueIndex(IntPtr.Zero, ref schemeGuid, ref subgroupGuid, ref settingGuid, ref value); + } + catch (Exception) { } + + return value; } /// <summary> - /// Unregister for away mode notifications + /// Wrapper for PowerWriteACValueIndex /// </summary> - public void UnregisterAwayModeNotification() + /// <param name="schemeGuid"></param> + /// <param name="subgroupGuid"></param> + /// <param name="settingGuid"></param> + /// <param name="value"></param> + private static void WriteACPowerValueIndex(Guid schemeGuid, Guid subgroupGuid, Guid settingGuid, UInt32 value) { - if (Environment.OSVersion.Version.Major >= 6) - UnregisterPowerSettingNotification(hAwayMode); + try + { + PowerWriteACValueIndex(IntPtr.Zero, ref schemeGuid, ref subgroupGuid, ref settingGuid, value); + } + catch (Exception) { } } + /// <summary> + /// Wrapper for PowerReadDCValueIndex + /// </summary> + /// <param name="schemeGuid"></param> + /// <param name="subgroupGuid"></param> + /// <param name="settingGuid"></param> + /// <returns></returns> + private static UInt32 ReadDCPowerValueIndex(Guid schemeGuid, Guid subgroupGuid, Guid settingGuid) + { + UInt32 value = 0; + try + { + PowerReadDCValueIndex(IntPtr.Zero, ref schemeGuid, ref subgroupGuid, ref settingGuid, ref value); + } + catch (Exception) { } + + return value; + } + + /// <summary> + /// Wrapper for PowerWriteDCValueIndex + /// </summary> + /// <param name="schemeGuid"></param> + /// <param name="subgroupGuid"></param> + /// <param name="settingGuid"></param> + /// <param name="value"></param> + private static void WriteDCPowerValueIndex(Guid schemeGuid, Guid subgroupGuid, Guid settingGuid, UInt32 value) + { + try + { + PowerWriteDCValueIndex(IntPtr.Zero, ref schemeGuid, ref subgroupGuid, ref settingGuid, value); + } + catch (Exception) { } + } + #endregion + } } \ No newline at end of file Modified: trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/PowerScheduler.Interfaces.csproj =================================================================== --- trunk/plugins/PowerScheduler++/Test/1.1.7.1/Common-MP-TVE3/PowerScheduler.Interfaces/PowerScheduler.Interfaces.csproj 2011-10-21 18:36:21 UTC (rev 4312) +++ trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/PowerScheduler.Interfaces.csproj 2011-10-21 18:58:08 UTC (rev 4313) @@ -92,5 +92,8 @@ </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> + <Reference Include="TvLibrary.Interfaces"> + <HintPath>..\..\Binaries\TvLibrary.Interfaces.dll</HintPath> + </Reference> </ItemGroup> </Project> \ No newline at end of file Modified: trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/PowerSettings.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/1.1.7.1/Common-MP-TVE3/PowerScheduler.Interfaces/PowerSettings.cs 2011-10-21 18:36:21 UTC (rev 4312) +++ trunk/plugins/PowerScheduler++/Test/1.2.5.1/Common-MP-TVE3/PowerScheduler.Interfaces/PowerSettings.cs 2011-10-21 18:58:08 UTC (rev 4313) @@ -27,19 +27,6 @@ namespace TvEngine.PowerScheduler.Interfaces { - - #region Enums - - public enum ShutdownMode - { - Sleep = 0, - Hibernate = 1, - ShutDown = 2, - StayOn = 3 - } - - #endregion - /// <summary> /// Holds all PowerScheduler related settings /// </summary> @@ -291,9 +278,8 @@ } /// <summary> - /// How should put the system into standby? suspend/hibernate/stayon - /// suspend uses S3, hibernate uses S4, stayon is for debugging purposes and - /// doesn't put the system into standby at all + /// How should put the system into standby? suspend/hibernate/stayon/shutdown + /// suspend uses S3, hibernate uses S4, stayon doesn't do anyting, shutdown uses S5 (soft power off) /// </summary> public ShutdownMode ShutdownMode { @@ -309,7 +295,7 @@ _shutdownMode = value; break; default: - throw new ArgumentException("unknown ShutdownMode", value.ToString()); + throw new ArgumentException("Unknown ShutdownMode", value.ToString()); } } } Modified: trunk/plugins/PowerScheduler++/Test/1.2.5.1/MPEI/PowerScheduler++.xmp2 =================================================================== --- trunk/plugins/PowerScheduler++/Test/1.1.7.1/MPEI/PowerScheduler++.xmp2 2011-10-21 18:36:21 UTC (rev 4312) +++ trunk/plugins/PowerScheduler++/Test/1.2.5.1/MPEI/PowerScheduler++.xmp2 2011-10-21 18:58:08 UTC (rev 4313) @@ -13,14 +13,14 @@ <FileItem InstallType="CopyFile" SystemFile="false" Modified="true"> <Param1 /> <UpdateOption>AlwaysOverwrite</UpdateOption> - <LocalFileName>..\TvEngine3\TVLibrary\Plugins\PowerScheduler\bin\Release\PowerScheduler.dll</LocalFileName> + <LocalFileName>..\TvEngine3\TVLibrary\Plugins\PowerScheduler\bin\Debug\PowerScheduler.dll</LocalFileName> <ZipFileName>Installer{CopyFile}\{41ffe535-6bef-44af-8fda-549e2443aabc}-PowerScheduler.dll</ZipFileName> <DestinationFilename>%TvServerPlugins%\PowerScheduler.dll</DestinationFilename> </FileItem> <FileItem InstallType="CopyFile" SystemFile="false" Modified="true"> <Param1 /> <UpdateOption>AlwaysOverwrite</UpdateOption> - <LocalFileName>..\Common-MP-TVE3\PowerScheduler.Interfaces\bin\Release\PowerScheduler.Interfaces.dll</LocalFileName> + <LocalFileName>..\Common-MP-TVE3\PowerScheduler.Interfaces\bin\Debug\PowerScheduler.Interfaces.dll</LocalFileName> <ZipFileName>Installer{CopyFile}\{fcb1df38-d861-4125-b4a0-8f062cb08d24}-PowerScheduler.Interfaces.dll</ZipFileName> <DestinationFilename>%TvServerBase%\PowerScheduler.Interfaces.dll</DestinationFilename> </FileItem> @@ -37,14 +37,14 @@ <FileItem InstallType="CopyFile" SystemFile="false" Modified="true"> <Param1 /> <UpdateOption>AlwaysOverwrite</UpdateOption> - <LocalFileName>..\mediaportal\PowerSchedulerClientPlugin\bin\Release\PowerSchedulerClientPlugin.dll</LocalFileName> + <LocalFileName>..\mediaportal\PowerSchedulerClientPlugin\bin\Debug\PowerSchedulerClientPlugin.dll</LocalFileName> <ZipFileName>Installer{CopyFile}\{ed9d9027-eca3-460f-b94e-d17ff4ab38ba}-PowerSchedulerClientPlugin.dll</ZipFileName> <DestinationFilename>%Plugins%\process\PowerSchedulerClientPlugin.dll</DestinationFilename> </FileItem> <FileItem InstallType="CopyFile" SystemFile="false" Modified="true"> <Param1 /> <UpdateOption>AlwaysOverwrite</UpdateOption> - <LocalFileName>..\mediaportal\PowerSchedulerClientPlugin\bin\Release\PowerScheduler.Interfaces.dll</LocalFileName> + <LocalFileName>..\Common-MP-TVE3\PowerScheduler.Interfaces\bin\Debug\PowerScheduler.Interfaces.dll</LocalFileName> <ZipFileName>Installer{CopyFile}\{ac7155e9-4a57-4108-8731-81f3fd669737}-PowerScheduler.Interfaces.dll</ZipFileName> <DestinationFilename>%Base%\PowerScheduler.Interfaces.dll</DestinationFilename> </FileItem> @@ -59,12 +59,12 @@ <Params> <Items> <SectionParam Name="Header text"> - <Value>[Name] [Version] ([DevelopmentStatus])</Value> + <Value>[Name] [Version] ([DevelopmentStatus] / experimental)</Value> <ValueType>String</ValueType> <Description /> </SectionParam> <SectionParam Name="Description"> - <Value>This will install the [Name] [Version] plugin on your computer. This plugin is designed for MediaPortal 1.2.0 Beta and will not work with other MediaPortal releases. + <Value>This will install the [Name] [Version] plugin on your computer. This plugin is designed for MediaPortal 1.2.1 FINAL and will not work with other MediaPortal releases. It is recommended that you close all other applications before continuing. @@ -424,34 +424,78 @@ </MinVersion> <MaxVersion> <Major>1</Major> - <Minor>1</Minor> - <Build>7</Build> + <Minor>2</Minor> + <Build>1</Build> <Revision>0</Revision> </MaxVersion> <WarnOnly>true</WarnOnly> - <Message>For MediaPortal release 1.2.0 beta (not compatible with 1.1.x stable releases and 1.2.0 alpha)</Message> + <Message>For MediaPortal release 1.2.1 FINAL (not compatible with 1.1.x releases)</Message> <Name>MediaPortal</Name> </DependencyItem> + <DependencyItem> + <Type>MediaPortal</Type> + <Id /> + <MinVersion> + <Major>1</Major> + <Minor>1</Minor> + <Build>6</Build> + <Revision>27644</Revision> + </MinVersion> + <MaxVersion> + <Major>1</Major> + <Minor>1</Minor> + <Build>6</Build> + <Revision>27644</Revision> + </MaxVersion> + <WarnOnly>false</WarnOnly> + <Message>For MediaPortal release 1.2.1 FINAL (not compatible with 1.1.x releases)</Message> + <Name>MediaPortal</Name> + </DependencyItem> </Items> </Dependencies> + <PluginDependencies> + <Items> + <PluginDependencyItem AssemblyName="PowerSchedulerClientPlugin.dll"> + <CompatibleVersion> + <Items> + <CompatibleVersionItem> + <MinRequiredVersion>1.1.6.27644</MinRequiredVersion> + <DesignedForVersion>1.2.1.0</DesignedForVersion> + </CompatibleVersionItem> + </Items> + </CompatibleVersion> + <SubSystemsUsed> + <Items> + <SubSystemItem Name="MP" /> + </Items> + </SubSystemsUsed> + </PluginDependencyItem> + </Items> + </PluginDependencies> <GeneralInfo> <Name>PowerScheduler++</Name> <Id>9b9bc24e-69ca-4abc-8810-f8f95bd4bbe6</Id> <Author>michael_t (based on PowerScheduler by micheloe)</Author> <HomePage>http://www.team-mediaportal.com/extensions/other/powerscheduler</HomePage> - <ForumPage>http://forum.team-mediaportal.com/tv-server-plugins-294/new-plugin-powerscheduler-new-version-1-1-1-5-a-87446/</ForumPage> - <UpdateUrl /> + <ForumPage>http://forum.team-mediaportal.com/tv-server-plugins-294/powerscheduler-test-version-1-2-5-0-mediaportal-1-2-x-1-3-alpha-87446/</ForumPage> + <UpdateUrl>http://forum.team-mediaportal.com/attachments/tv-server-plugins-294/90673d1318776972-powerscheduler-test-version-1-2-5-x-mediaportal-1-2-x-1-3-alpha-update.xml</UpdateUrl> <Version> <Major>1</Major> - <Minor>1</Minor> - <Build>7</Build> + <Minor>2</Minor> + <Build>5</Build> <Revision>1</Revision> </Version> <ExtensionDescription>The PowerScheduler++ plugin is a replacement for the PowerScheduler plugin that comes as part of MediaPortal. Compared to the original PowerScheduler it provides additional features (easy configuration, shares monitoring, reboot option, ...) and is supporting "away mode" for Vista and Win 7 systems.</ExtensionDescription> - <VersionDescription>Version [Version] - [DevelopmentStatus] version for MP 1.2.0 Beta</VersionDescription> - <DevelopmentStatus>Beta</DevelopmentStatus> - <OnlineLocation>http://forum.team-mediaportal.com/attachments/tv-server-plugins-294/80178d1303458252-powerscheduler-test-versions-1-1-6-0-mediaportal-1-2-0-pre-beta-svn-27810-powerscheduler-1.1.7.1.mpe1</OnlineLocation> - <ReleaseDate>2011-04-24T16:03:54</ReleaseDate> + <VersionDescription>Version 1.2.5.1 - Alpha / experimental version for MP 1.2.1 FINAL + +Version 1.2.5.1: +- Load and save "Set PowerSettings automatically" option +- Do not offer "Standby after" option for Windows XP +Version 1.2.5.0 - Initial version +</VersionDescription> + <DevelopmentStatus>Alpha</DevelopmentStatus> + <OnlineLocation>http://forum.team-mediaportal.com/attachments/tv-server-plugins-294/90672d1318776960-powerscheduler-test-version-1-2-5-x-mediaportal-1-2-x-1-3-alpha-powerscheduler-1.2.5.1.mpe1</OnlineLocation> + <ReleaseDate>2011-10-16T16:03:54</ReleaseDate> <Tags>tv server plugins, automation</Tags> <Location>..\MPEI\[Name] [Version].mpe1</Location> <Params> @@ -467,21 +511,14 @@ <Description>The icon file of the package stored online (jpg,png,bmp)</Description> </SectionParam> <SectionParam Name="Configuration file"> - <Value>%Plugins%\process\PowerSchedulerClientPlugin.dll</Value> + <Value /> <ValueType>Template</ValueType> <Description>The file used to configure the extension. If have .exe extension the will be executed If have .dll extension used like MP plugin configuration</Description> </SectionParam> <SectionParam Name="Online Screenshots"> - <Value>http://www.team-mediaportal.com/components/com_mtree/img/listings/m/480.jpg; -http://www.team-mediaportal.com/components/com_mtree/img/listings/m/481.jpg; -http://www.team-mediaportal.com/components/com_mtree/img/listings/m/482.jpg; -http://www.team-mediaportal.com/components/com_mtree/img/listings/m/483.jpg; -http://www.team-mediaportal.com/components/com_mtree/img/listings/m/484.jpg; -http://www.team-mediaportal.com/components/com_mtree/img/listings/m/485.jpg; -http://www.team-mediaportal.com/components/com_mtree/img/listings/m/486.jpg; -http://www.team-mediaportal.com/components/com_mtree/img/listings/m/487.jpg</Value> + <Value /> <ValueType>String</ValueType> <Description>Online stored screenshot urls separated by ; </Description> </SectionParam> @@ -498,52 +535,46 @@ <FileItem InstallType="CopyFile" SystemFile="false" Modified="true"> <Param1 /> <UpdateOption>AlwaysOverwrite</UpdateOption> - <LocalFileName>..\TvEngine3\TVLibrary\Plugins\PowerScheduler\bin\Release\PowerScheduler.dll</LocalFileName> + <LocalFileName>..\TvEngine3\TVLibrary\Plugins\PowerScheduler\bin\Debug\PowerScheduler.dll</LocalFileName> <ZipFileName>Installer{CopyFile}\{41ffe535-6bef-44af-8fda-549e2443aabc}-PowerScheduler.dll</ZipFileName> <DestinationFilename>%TvServerPlugins%\PowerScheduler.dll</DestinationFilename> </FileItem> <FileItem InstallType="CopyFile" SystemFile="false" Modified="true"> <Param1 /> <UpdateOption>AlwaysOverwrite</UpdateOption> - <LocalFileName>..\Common-MP-TVE3\PowerScheduler.Interfaces\bin\Release\PowerScheduler.Interfaces.dll</LocalFileName> + <LocalFileName>..\Common-MP-TVE3\PowerScheduler.Interfaces\bin\Debug\PowerScheduler.Interfaces.dll</LocalFileName> <ZipFileName>Installer{CopyFile}\{fcb1df38-d861-4125-b4a0-8f062cb08d24}-PowerScheduler.Interfaces.dll</ZipFileName> <DestinationFilename>%TvServerBase%\PowerScheduler.Interfaces.dll</DestinationFilename> </FileItem> <FileItem InstallType="CopyFile" SystemFile="false" Modified="true"> <Param1 /> <UpdateOption>AlwaysOverwrite</UpdateOption> - <LocalFileName>..\mediaportal\PowerSchedulerClientPlugin\bin\Release\PowerSchedulerClientPlugin.dll</LocalFileName> + <LocalFileName>..\mediaportal\PowerSchedulerClientPlugin\bin\Debug\PowerSchedulerClientPlugin.dll</LocalFileName> <ZipFileName>Installer{CopyFile}\{ed9d9027-eca3-460f-b94e-d17ff4ab38ba}-PowerSchedulerClientPlugin.dll</ZipFileName> <DestinationFilename>%Plugins%\process\PowerSchedulerClientPlugin.dll</DestinationFilename> </FileItem> - <FileItem InstallType="CopyFile" SystemFile="false" Modified="true"> - <Param1 /> - <UpdateOption>AlwaysOverwrite</UpdateOption> - <LocalFileName>..\mediaportal\PowerSchedulerClientPlugin\bin\Release\PowerScheduler.Interfaces.dll</LocalFileName> - <ZipFileName>Installer{CopyFile}\{ac7155e9-4a57-4108-8731-81f3fd669737}-PowerScheduler.Interfaces.dll</ZipFileName> - <DestinationFilename>%Base%\PowerScheduler.Interfaces.dll</DestinationFilename> - </FileItem> <FileItem InstallType="CopyFile" SystemFile="true" Modified="true"> <Param1 /> <UpdateOption>OverwriteIfOlder</UpdateOption> <LocalFileName>PowerScheduler_high.png</LocalFileName> - <ZipFileName>Installer{CopyFile}\{15edb7d9-2dca-45c1-bf4e-54ae231e18b5}-PowerScheduler_high.png</ZipFileName> + <ZipFileName>Installer{CopyFile}\{db12424d-8f08-4bbb-9305-0c9b6fd92950}-PowerScheduler_high.png</ZipFileName> <DestinationFilename /> </FileItem> <FileItem InstallType="CopyFile" SystemFile="true" Modified="true"> <Param1 /> <UpdateOption>OverwriteIfOlder</UpdateOption> <LocalFileName>..\mediaportal\PowerSchedulerClientPlugin\PowerScheduler.gif</LocalFileName> - <ZipFileName>Installer{CopyFile}\{97988cec-fca7-48b4-852a-f1d164a6089e}-PowerScheduler.gif</ZipFileName> + <ZipFileName>Installer{CopyFile}\{e463d5e3-32ae-49e6-b176-fdf8071ff264}-PowerScheduler.gif</ZipFileName> <DestinationFilename /> </FileItem> </Items> </UniqueFileList> <ProjectSettings> <FolderGroups /> - <ProjectFilename>P:\PowerScheduler++ 1.1.7.0\MPEI\PowerScheduler++.xmp2</ProjectFilename> + <ProjectFilename>PowerScheduler++.xmp2</ProjectFilename> <UpdatePath1>..\MPEI\update.xml</UpdatePath1> <UpdatePath2 /> <UpdatePath3 /> </ProjectSettings> + <IsSkin>false</IsSkin> </PackageClass> \ No newline at end of file Modified: trunk/plugins/PowerScheduler++/Test/1.2.5.1/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/RemoteClientStandbyHandler.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/1.1.7.1/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/RemoteClientStandbyHandler.cs 2011-10-21 18:36:21 UTC (rev 4312) +++ trunk/plugins/PowerScheduler++/Test/1.2.5.1/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/RemoteClientStandbyHandler.cs 2011-10-21 18:58:08 UTC (rev 4313) @@ -29,7 +29,7 @@ namespace TvEngine.PowerScheduler.Handlers { /// <summary> - /// Prevent standby if a remote client is active + /// Prevent standby if a remote (multi-seat) client is active (used by PowerScheduler client plugin) /// </summary> public class RemoteClientStandbyHandler : IStandbyHandler, IStandbyHandlerEx { @@ -43,36 +43,23 @@ /// <summary> /// Indicator if a remote client is active /// </summary> - private bool _disAllowShutdown = false; + private StandbyMode _standbyMode = StandbyMode.StandbyAllowed; /// <summary> /// Last time a remote client signalled activity /// </summary> private DateTime _lastUpdate = DateTime.MinValue; - /// <summary> - /// Manages setting the according thread execution state - /// </summary> - private PowerManager _powerManager; - #endregion #region Constructor public RemoteClientStandbyHandler() { - // Create the PowerManager that helps setting the correct thread executation state - _powerManager = new PowerManager(); } ~RemoteClientStandbyHandler() { - // Dereference the PowerManager instance - if (_powerManager != null) - { - _powerManager.SetAwayModeRequired(false); - _powerManager = null; - } } #endregion @@ -83,19 +70,12 @@ { get { - // Check if last update was longer ago than idle timeout - // If so, do not prevent standby any longer - if (_lastUpdate.AddSeconds(_timeout) < DateTime.Now) - { - _disAllowShutdown = false; - } - _powerManager.SetAwayModeRequired(_disAllowShutdown); - return _disAllowShutdown; + return _standbyMode != StandbyMode.StandbyAllowed; } set { _lastUpdate = DateTime.Now; - _disAllowShutdown = value; + _standbyMode = value ? StandbyMode.AwayModeRequested : StandbyMode.StandbyAllowed; } } @@ -103,22 +83,31 @@ public string HandlerName { - get { return "RemoteClientStandbyHandler"; } + get { return "RemoteClient"; } } #endregion - #region IStandbyHandlerEx Members + #region IStandbyHandlerEx implementation - /// <summary> - /// Is away mode required? - /// </summary> - public bool RequireAwayMode + public StandbyMode StandbyMode { - get { return (_disAllowShutdown); } + get + { + // Check if last update was longer ago than idle timeout + // If so, do not prevent standby any longer + if (_lastUpdate.AddSeconds(_timeout) < DateTime.Now) + { + _standbyMode = StandbyMode.StandbyAllowed; + } + return _standbyMode; + } + set + { + _lastUpdate = DateTime.Now; + _standbyMode = value; + } } - #endregion - } } \ No newline at end of file Modified: trunk/plugins/PowerScheduler++/Test/1.2.5.1/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/XmlTvImportWakeupHandler.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/1.1.7.1/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/XmlTvImportWakeupHandler.cs 2011-10-21 18:36:21 UTC (rev 4312) +++ trunk/plugins/PowerScheduler++/Test/1.2.5.1/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/XmlTvImportWakeupHandler.cs 2011-10-21 18:58:08 UTC (rev 4313) @@ -39,7 +39,7 @@ { #region Variables - private string _handlerName = "XmlTvImportWakeupHandler"; + private string _handlerName = "XmlTvImport"; #endregion Modified: trunk/plugins/PowerScheduler++/Test/1.2.5.1/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerScheduler.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/1.1.7.1/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerScheduler.cs 2011-10-21 18:36:21 UTC (rev 4312) +++ trunk/plugins/PowerScheduler++/Test/1.2.5.1/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerScheduler.cs 2011-10-21 18:58:08 UTC (rev 4313) @@ -20,7 +20,6 @@ #region Usings -using Gentle.Common; using System; using System.Collections; using System.Collections.Generic; @@ -31,6 +30,7 @@ using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Http; using System.Threading; +using Gentle.Common; using TvControl; using TvDatabase; using TvEngine.Interfaces; @@ -39,24 +39,18 @@ using TvLibrary.Interfaces; using TvLibrary.Log; - #endregion namespace TvEngine.PowerScheduler { /// <summary> - /// PowerScheduler: tvservice plugin which controls power management + /// PowerScheduler++ Server Plugin: tvservice plugin which controls power management /// </summary> public class PowerScheduler : MarshalByRefObject, IPowerScheduler, IPowerController { #region Variables /// <summary> - /// Register to this event to receive status changes from the PowerScheduler - /// </summary> - public event PowerSchedulerEventHandler OnPowerSchedulerEvent; - - /// <summary> /// PowerScheduler single instance /// </summary> private static PowerScheduler _powerScheduler; @@ -78,9 +72,9 @@ private PowerSchedulerFactory _factory; /// <summary> - /// Manages setting the according thread execution state + /// Thread starting and stopping PowerScheduler /// </summary> - private PowerManager _powerManager; + private Thread _tvServiceThread; /// <summary> /// List of registered standby handlers ("disable standby" plugins) @@ -93,14 +87,14 @@ private List<IWakeupHandler> _wakeupHandlers; /// <summary> - /// IStandbyHandler for the client in singleseat setups + /// StandbyHandler for the IPowerController interface /// </summary> - private GenericStandbyHandler _clientStandbyHandler; + private PowerControllerStandbyHandler _powerControllerStandbyHandler; /// <summary> - /// IWakeupHandler for the client in single-seat setups + /// WakeupHandler for the IPowerController interface /// </summary> - private GenericWakeupHandler _clientWakeupHandler; + private PowerControllerWakeupHandler _powerControllerWakeupHandler; /// <summary> /// IStandbyHandler for remote clients in client/server setups @@ -108,11 +102,21 @@ private RemoteClientStandbyHandler _remoteClientStandbyHandler; /// <summary> - /// Timer for executing periodic checks (should we enter standby..) + /// EventWaitHandle to trigger the StandbyWakeupThread /// </summary> - private System.Timers.Timer _timer; + private EventWaitHandle _standbyWakeupTriggered; /// <summary> + /// EventWaitHandle to signal finished + /// </summary> + private EventWaitHandle _standbyWakeupFinished; + + /// <summary> + /// Thread to check for standby and set wakeup timer + /// </summary> + private Thread _standbyWakeupThread; + + /// <summary> /// Timer with support for waking up the system /// </summary> private WaitableTimer _wakeupTimer; @@ -125,7 +129,7 @@ /// <summary> /// Global indicator if the PowerScheduler thinks the system is idle /// </summary> - private bool _idle = false; + private bool _idle; /// <summary> /// Indicating whether the PowerScheduler is in standby-mode. @@ -133,11 +137,31 @@ private bool _standby = false; /// <summary> + /// Used to avoid concurrent suspend requests which could result in a suspend - user resumes - immediately suspends. + /// </summary> + private DateTime _ignoreSuspendUntil = DateTime.MinValue; + + /// <summary> /// All PowerScheduler related settings are stored here /// </summary> private PowerSettings _settings; /// <summary> + /// Prevent standby, if the next event is due within _preNoShutdownTime seconds + /// </summary> + private const int _preNoShutdownTime = 300; + + /// <summary> + /// Check the system status every _checkInterval seconds + /// </summary> + private const int _checkInterval = 15; + + /// <summary> + /// Wakeup system _preWakeuptime seconds earlier than scheduled + /// </summary> + private const int _preWakeupTime = 60; + + /// <summary> /// Indicator if remoting has been setup /// </summary> private bool _remotingStarted = false; @@ -160,208 +184,60 @@ /// <summary> /// Creates a new PowerScheduler plugin and performs the one-time initialization /// </summary> - private PowerScheduler() + public PowerScheduler() { _standbyHandlers = new List<IStandbyHandler>(); _wakeupHandlers = new List<IWakeupHandler>(); _lastUserTime = DateTime.Now; _idle = false; - // Add ourselves to the GlobalServiceProvider - if (GlobalServiceProvider.Instance.IsRegistered<IPowerScheduler>()) + // Register as global service provider instance + if (!GlobalServiceProvider.Instance.IsRegistered<IPowerScheduler>()) { - GlobalServiceProvider.Instance.Remove<IPowerScheduler>(); + GlobalServiceProvider.Instance.Add<IPowerScheduler>(this); } - GlobalServiceProvider.Instance.Add<IPowerScheduler>(this); - Log.Debug("PowerScheduler: Registered PowerScheduler service to GlobalServiceProvider"); + Log.Debug("PS++: Registered PowerScheduler as IPowerScheduler service to GlobalServiceProvider"); } ~PowerScheduler() { + // Unregister as global service provider instance if (GlobalServiceProvider.Instance.IsRegistered<IPowerScheduler>()) { GlobalServiceProvider.Instance.Remove<IPowerScheduler>(); + Log.Debug("PS++: Unregistered IPowerScheduler service from GlobalServiceProvider"); } } - #endregion - - #region Public methods - - #region Start/Stop methods - - /// <summary> - /// Called by the PowerSchedulerPlugin to start the PowerScheduler - /// </summary> - /// <param name="controller">TVController from the tvservice</param> - [MethodImpl(MethodImplOptions.Synchronized)] - public void Start(IController controller) + public static PowerScheduler Instance { - try + get { - // Give PowerScheduler thread a name - string threadname = Thread.CurrentThread.Name; - if (string.IsNullOrEmpty(threadname)) - Thread.CurrentThread.Name = "Powerscheduler"; - - // Save controller - _controller = controller; - - // Create the PowerManager that helps setting the correct thread executation state - _powerManager = new PowerManager(); - - // Create the timer that will wakeup the system after a specific amount of time after the - // system has been put into standby - _wakeupTimer = new WaitableTimer(); - - // Create the timer responsible for standby checking and refreshing settings - _timer = new System.Timers.Timer(); - _timer.Elapsed += new System.Timers.ElapsedEventHandler(OnTimerElapsed); - - // Configure remoting if not already done - StartRemoting(); - - // Load settings - LoadSettings(); - - // Register standby/wakeup handlers - _clientStandbyHandler = new GenericStandbyHandler(); - Register(_clientStandbyHandler); - _clientWakeupHandler = new GenericWakeupHandler(); - Register(_clientWakeupHandler); - _remoteClientStandbyHandler = new RemoteClientStandbyHandler(); - Register(_remoteClientStandbyHandler); - _factory = new PowerSchedulerFactory(controller); - _factory.CreateDefaultSet(); - Log.Debug("PowerScheduler: Registered standby/wakeup handlers to PowerScheduler"); - - // Register power event handler to TVServer - RegisterPowerEventHandler(); - - // Start the timer for periodic setting... [truncated message content] |
From: <mic...@us...> - 2012-02-09 16:40:06
|
Revision: 4438 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4438&view=rev Author: michael-t Date: 2012-02-09 16:39:52 +0000 (Thu, 09 Feb 2012) Log Message: ----------- Added Paths: ----------- trunk/plugins/PowerScheduler++/Test/Binaries/ trunk/plugins/PowerScheduler++/Test/Binaries/Common.Utils.dll trunk/plugins/PowerScheduler++/Test/Binaries/Core.dll trunk/plugins/PowerScheduler++/Test/Binaries/Gentle.Common.dll trunk/plugins/PowerScheduler++/Test/Binaries/Gentle.Framework.dll trunk/plugins/PowerScheduler++/Test/Binaries/PluginBase.dll trunk/plugins/PowerScheduler++/Test/Binaries/PowerScheduler.Interfaces.dll trunk/plugins/PowerScheduler++/Test/Binaries/PowerScheduler.dll trunk/plugins/PowerScheduler++/Test/Binaries/PowerSchedulerClientPlugin.dll trunk/plugins/PowerScheduler++/Test/Binaries/SetupControls.dll trunk/plugins/PowerScheduler++/Test/Binaries/TVDatabase.dll trunk/plugins/PowerScheduler++/Test/Binaries/TVLibrary.dll trunk/plugins/PowerScheduler++/Test/Binaries/TvBusinessLayer.dll trunk/plugins/PowerScheduler++/Test/Binaries/TvControl.dll trunk/plugins/PowerScheduler++/Test/Binaries/TvLibrary.Interfaces.dll trunk/plugins/PowerScheduler++/Test/Binaries/TvService.exe trunk/plugins/PowerScheduler++/Test/Binaries/Utils.dll trunk/plugins/PowerScheduler++/Test/CleanupFiles.bat trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/ trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/ trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/EPGWakeupConfig.cs trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/ trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IEpgHandler.cs trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerController.cs trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerScheduler.cs trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerSettings.cs trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IWakeupHandler.cs trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/PowerManager.cs trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/PowerScheduler.Interfaces.csproj trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/PowerSchedulerEventArgs.cs trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/PowerSettings.cs trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Properties/ trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Properties/AssemblyInfo.cs trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/RemotePowerControl.cs trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/TimerException.cs trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/WaitableTimer.cs trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/WakeOnLanManager.cs trunk/plugins/PowerScheduler++/Test/CopyFiles.bat trunk/plugins/PowerScheduler++/Test/MPEI/ trunk/plugins/PowerScheduler++/Test/MPEI/PowerScheduler++ 1.2.5.12.mpe1 trunk/plugins/PowerScheduler++/Test/MPEI/PowerScheduler++.xmp2 trunk/plugins/PowerScheduler++/Test/MPEI/PowerScheduler_high.png trunk/plugins/PowerScheduler++/Test/MPEI/update.xml trunk/plugins/PowerScheduler++/Test/PowerScheduler++.sln trunk/plugins/PowerScheduler++/Test/RestoreFiles.bat trunk/plugins/PowerScheduler++/Test/TvEngine3/ trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/ trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/ trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/ trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/ trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/ActiveNetworkStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/ActiveSharesStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/ActiveStreamsStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/ControllerActiveStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/EpgGrabbingStandbyWakeupHandler.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/LocalClientStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/LocalClientWakeupHandler.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/PowerControllerStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/PowerControllerWakeupHandler.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/ProcessActiveStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/RebootWakeupHandler.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/RemoteClientStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/ScheduledRecordingsWakeupHandler.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/XmlTvImportWakeupHandler.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerScheduler.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerScheduler.csproj trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerSchedulerFactory.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerSchedulerPlugin.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Properties/ trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Properties/AssemblyInfo.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/ trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSchedulerSetup.Designer.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSchedulerSetup.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSchedulerSetup.resx trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSettingsForm.Designer.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSettingsForm.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/SelectProcessForm.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/SelectProcessForm.designer.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/SelectShareForm.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/SelectShareForm.designer.cs trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/TheAlgorithm.txt trunk/plugins/PowerScheduler++/Test/TvEngine3/TVLibrary/Plugins/PowerScheduler/WindowsController.cs trunk/plugins/PowerScheduler++/Test/VersionInfo.cs trunk/plugins/PowerScheduler++/Test/mediaportal/ trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/ trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/Handlers/ trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/Handlers/ActiveNetworkStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/Handlers/ActiveSharesStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/Handlers/ProcessActiveStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/Handlers/RebootWakeupHandler.cs trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/Handlers/WakeableStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/Handlers/WakeableWakeupHandler.cs trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/MasterVolume.cs trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/PowerScheduler.cs trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/PowerScheduler.gif trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/PowerSchedulerClientPlugin.cs trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/PowerSchedulerClientPlugin.csproj trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/PowerSchedulerFactory.cs trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/PowerScheduler_disabled.gif trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/Properties/ trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/Properties/AssemblyInfo.cs trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/Setup/ trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/Setup/PowerSchedulerSetup.Designer.cs trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/Setup/PowerSchedulerSetup.cs trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/Setup/PowerSchedulerSetup.resx trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/Setup/PowerSettingsForm.Designer.cs trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/Setup/PowerSettingsForm.cs trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/Setup/SelectProcessForm.cs trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/Setup/SelectProcessForm.designer.cs trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/Setup/SelectShareForm.cs trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/Setup/SelectShareForm.designer.cs trunk/plugins/PowerScheduler++/Test/mediaportal/PowerSchedulerClientPlugin/UnattendedWindow.cs Added: trunk/plugins/PowerScheduler++/Test/Binaries/Common.Utils.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/Binaries/Common.Utils.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/Binaries/Core.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/Binaries/Core.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/Binaries/Gentle.Common.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/Binaries/Gentle.Common.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/Binaries/Gentle.Framework.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/Binaries/Gentle.Framework.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/Binaries/PluginBase.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/Binaries/PluginBase.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/Binaries/PowerScheduler.Interfaces.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/Binaries/PowerScheduler.Interfaces.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/Binaries/PowerScheduler.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/Binaries/PowerScheduler.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/Binaries/PowerSchedulerClientPlugin.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/Binaries/PowerSchedulerClientPlugin.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/Binaries/SetupControls.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/Binaries/SetupControls.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/Binaries/TVDatabase.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/Binaries/TVDatabase.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/Binaries/TVLibrary.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/Binaries/TVLibrary.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/Binaries/TvBusinessLayer.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/Binaries/TvBusinessLayer.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/Binaries/TvControl.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/Binaries/TvControl.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/Binaries/TvLibrary.Interfaces.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/Binaries/TvLibrary.Interfaces.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/Binaries/TvService.exe =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/Binaries/TvService.exe ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/Binaries/Utils.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/Binaries/Utils.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/CleanupFiles.bat =================================================================== --- trunk/plugins/PowerScheduler++/Test/CleanupFiles.bat (rev 0) +++ trunk/plugins/PowerScheduler++/Test/CleanupFiles.bat 2012-02-09 16:39:52 UTC (rev 4438) @@ -0,0 +1,75 @@ +@echo off +set PROJECTPATH=%~dp0 +if "%ProgramFiles(x86)%" == "" goto 32bit +set SERVERPATH=%ProgramFiles(x86)%\Team MediaPortal\MediaPortal TV Server +set CLIENTPATH=%ProgramFiles(x86)%\Team MediaPortal\MediaPortal +goto data +:32bit +set SERVERPATH=%ProgramFiles%\Team MediaPortal\MediaPortal TV Server +set CLIENTPATH=%ProgramFiles%\Team MediaPortal\MediaPortal +:data +if "%ProgramData%" == "" goto winXP +set SERVERLOGPATH=%ProgramData%\Team MediaPortal\MediaPortal TV Server\log +goto count +:winXP +set SERVERLOGPATH=%ALLUSERSPROFILE%\Application Data\Team MediaPortal\MediaPortal TV Server\log + +:count +set COUNT=1 + +echo Stopping TV Server +echo --------------------- +:stop +echo trying... +net stop tvservice > nul 2>nul +tasklist | find /i "tvservice" >nul 2>nul +if not %ERRORLEVEL% == 1 ( + ping localhost >nul 2>nul + set /a COUNT=%COUNT%+1 + if %COUNT% GTR 5 goto end + goto stop +) +echo. + +echo MediaPortal TV Server +echo --------------------- +for %%f in (Plugins\PowerScheduler.dll) do ( + echo %%f + if exist "%SERVERPATH%\%%f.org" ( + del "%SERVERPATH%\%%f" + move /Y "%SERVERPATH%\%%f.org" "%SERVERPATH%\%%f" + ) 2>nul +) +echo. +echo MediaPortal Common Library +echo ---------------------------------- +for %%f in (PowerScheduler.Interfaces.dll) do ( + echo %%f + if exist "%SERVERPATH%\%%f.org" ( + del "%SERVERPATH%\%%f" + move /Y "%SERVERPATH%\%%f.org" "%SERVERPATH%\%%f" + ) 2>nul + if exist "%CLIENTPATH%\%%f.org" ( + del "%CLIENTPATH%\%%f" + move /Y "%CLIENTPATH%\%%f.org" "%CLIENTPATH%\%%f" + ) 2>nul +) +echo. +echo MediaPortal Client +echo ------------------ +for %%f in (plugins\process\PowerSchedulerClientPlugin.dll) do ( + echo %%f + if exist "%CLIENTPATH%\%%f.org" ( + del "%CLIENTPATH%\%%f" + move /Y "%CLIENTPATH%\%%f.org" "%CLIENTPATH%\%%f" + ) 2>nul +) +echo. +echo Cleanup +echo ------------------ +move /Y "%SERVERLOGPATH%\tv.log" "%SERVERLOGPATH%\tv_old.log" +net start tvservice +echo. +:end +pause +exit \ No newline at end of file Added: trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/EPGWakeupConfig.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/EPGWakeupConfig.cs (rev 0) +++ trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/EPGWakeupConfig.cs 2012-02-09 16:39:52 UTC (rev 4438) @@ -0,0 +1,125 @@ +#region Copyright (C) 2005-2011 Team MediaPortal + +// Copyright (C) 2005-2011 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// MediaPortal is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MediaPortal. If not, see <http://www.gnu.org/licenses/>. + +#endregion + +#region Usings + +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.Serialization.Formatters.Binary; + +#endregion + +namespace TvEngine.PowerScheduler +{ + + #region Enums + + public enum EPGGrabDays + { + Monday, + Tuesday, + Wednesday, + Thursday, + Friday, + Saturday, + Sunday + } + + #endregion + + [Serializable] + public class EPGWakeupConfig + { + public DateTime LastRun = DateTime.MinValue; + public List<EPGGrabDays> Days = new List<EPGGrabDays>(); + public int Hour; + public int Minutes; + + public EPGWakeupConfig() {} + + public EPGWakeupConfig(string serializedConfig) + { + EPGWakeupConfig cfg = new EPGWakeupConfig(); + try + { + BinaryFormatter formatter = new BinaryFormatter(); + byte[] buffer = Convert.FromBase64String(serializedConfig); + using (MemoryStream stream = new MemoryStream(buffer, 0, buffer.Length)) + { + cfg = (EPGWakeupConfig)formatter.Deserialize(stream); + } + } + catch (Exception) {} + Hour = cfg.Hour; + Minutes = cfg.Minutes; + Days = cfg.Days; + LastRun = cfg.LastRun; + } + + public string SerializeAsString() + { + BinaryFormatter formatter = new BinaryFormatter(); + string result; + using (MemoryStream stream = new MemoryStream()) + { + formatter.Serialize(stream, this); + stream.Flush(); + stream.Seek(0, SeekOrigin.Begin); + byte[] buffer = new byte[stream.Length]; + int bytesRead = stream.Read(buffer, 0, buffer.Length); + result = Convert.ToBase64String(buffer, 0, bytesRead); + } + return result; + } + + public override bool Equals(object obj) + { + if (obj is EPGWakeupConfig) + { + EPGWakeupConfig cfg = (EPGWakeupConfig)obj; + if (cfg.Hour == Hour && cfg.Minutes == Minutes) + { + foreach (EPGGrabDays day in cfg.Days) + { + if (!Days.Contains(day)) + { + return false; + } + } + foreach (EPGGrabDays day in Days) + { + if (!cfg.Days.Contains(day)) + { + return false; + } + } + return true; + } + } + return false; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + } +} \ No newline at end of file Added: trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IEpgHandler.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IEpgHandler.cs (rev 0) +++ trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IEpgHandler.cs 2012-02-09 16:39:52 UTC (rev 4438) @@ -0,0 +1,65 @@ +#region Copyright (C) 2005-2011 Team MediaPortal + +// Copyright (C) 2005-2011 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// MediaPortal is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MediaPortal. If not, see <http://www.gnu.org/licenses/>. + +#endregion + +#region Usings + +using System; + +#endregion + +namespace TvEngine.PowerScheduler.Interfaces +{ + public delegate void EPGScheduleHandler(); + + /// <summary> + /// Provides access to PowerScheduler's EPG interface for + /// EPG plugins. + /// </summary> + public interface IEpgHandler + { + /// <summary> + /// Allows an external EPG source to prevent standby when it's + /// grabbing EPG + /// </summary> + /// <param name="source">the source preventing standby</param> + /// <param name="allowed">is standby allowed?</param> + void SetStandbyAllowed(object source, bool allowed, int timeout); + + /// <summary> + /// Allows an external EPG source to set a preferred next wakeup time + /// </summary> + /// <param name="source">the source that wants to wakeup the system for EPG grabbing</param> + /// <param name="time">the desired time to wakeup the system</param> + void SetNextEPGWakeupTime(object source, DateTime time); + + /// <summary> + /// Allows an external EPG source to retrieve the next wakeup time + /// for EPG grabbing. This time can be used to start an actual EPG + /// grabbing process. + /// </summary> + /// <returns>next EPG grab wakeup time</returns> + DateTime GetNextEPGWakeupTime(); + + /// <summary> + /// Event which gets fired when the configured EPG wakeup schedule is due. + /// </summary> + event EPGScheduleHandler EPGScheduleDue; + } +} \ No newline at end of file Added: trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerController.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerController.cs (rev 0) +++ trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerController.cs 2012-02-09 16:39:52 UTC (rev 4438) @@ -0,0 +1,108 @@ +#region Copyright (C) 2005-2011 Team MediaPortal + +// Copyright (C) 2005-2011 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// MediaPortal is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MediaPortal. If not, see <http://www.gnu.org/licenses/>. + +#endregion + +#region Usings + +using System; + +#endregion + +namespace TvEngine.PowerScheduler.Interfaces +{ + /// <summary> + /// Public interface to PowerScheduler power control + /// Intented to be used by singleseat setups + /// </summary> + public interface IPowerController + { + /// <summary> + /// Requests suspension of the system. Uses default action. + /// </summary> + /// <param name="source">description of who wants to suspend the system</param> + /// <param name="force">force the system to suspend (not recommended)</param> + void SuspendSystem(string source, bool force); + + /// <summary> + /// Requests suspension of the system. + /// </summary> + /// <param name="source"></param> + /// <param name="how">How to suspend, see MediaPortal.Util.RestartOptions</param> + /// <param name="force"></param> + void SuspendSystem(string source, int how, bool force); + + /// <summary> + /// Enables clients on singleseat setups to indicate whether or not the system + /// is allowed to enter standby + /// </summary> + /// <param name="standbyAllowed">is standby allowed?</param> + /// <param name="handlerName">client handlername which prevents standby</param> + void SetStandbyAllowed(bool standbyAllowed, string handlerName); + + /// <summary> + /// Enables clients on singleseat setups to indicate when the next + /// earliest wakeup time is due + /// </summary> + /// <param name="nextWakeupTime">DateTime when to wakeup the system</param> + /// <param name="handlerName">client handlername which is responsible for this wakeup time</param> + void SetNextWakeupTime(DateTime nextWakeupTime, string handlerName); + + /// <summary> + /// Resets the idle timer of the PowerScheduler. When enough time has passed (IdleTimeout), the system + /// is suspended as soon as possible (no handler disallows shutdown). + /// Note that the idle timer is automatically reset to now when the user moves the mouse or touchs the keyboard. + /// </summary> + void UserActivityDetected(DateTime when); + + /// <summary> + /// Register remote handlers. If an empty string or null is passed, no handler is registered for + /// that type. It returns a tag used to unregister the later. The returned tag is always not 0. + /// </summary> + /// <param name="standbyHandlerURI"></param> + /// <param name="wakeupHandlerURI"></param> + int RegisterRemote(String standbyHandlerURI, String wakeupHandlerURI); + + /// <summary> + /// Unregister remote handlers. + /// </summary> + void UnregisterRemote(int tag); + + /// <summary> + /// Indicates whether or not we're connected to the PowerScheduler power control interfaces + /// </summary> + bool IsConnected { get; } + + /// <summary> + /// Get the current state. If refresh is true, the state is the most current state, otherwise the state could be some seconds old. + /// Special case: If shutdown is not allowed because an event is almost due, the handler name is "EVENT-DUE". + /// </summary> + /// <param name="refresh"></param> + /// <param name="disAllowShutdown"></param> + /// <param name="disAllowShutdownHandler"></param> + /// <param name="nextWakeupTime"></param> + /// <param name="nextWakeupHandler"></param> + void GetCurrentState(bool refresh, out bool unattended, out bool disAllowShutdown, + out String disAllowShutdownHandler, out DateTime nextWakeupTime, out String nextWakeupHandler); + + /// <summary> + /// Provides access to PowerScheduler's settings + /// </summary> + IPowerSettings PowerSettings { get; } + } +} \ No newline at end of file Added: trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerScheduler.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerScheduler.cs (rev 0) +++ trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerScheduler.cs 2012-02-09 16:39:52 UTC (rev 4438) @@ -0,0 +1,129 @@ +#region Copyright (C) 2005-2011 Team MediaPortal + +// Copyright (C) 2005-2011 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// MediaPortal is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MediaPortal. If not, see <http://www.gnu.org/licenses/>. + +#endregion + +#region Usings + +using System; + +#endregion + +namespace TvEngine.PowerScheduler.Interfaces +{ + /// <summary> + /// EvenHandler delegate for PowerScheduler events + /// </summary> + /// <param name="args"></param> + public delegate void PowerSchedulerEventHandler(PowerSchedulerEventArgs args); + + /// <summary> + /// Interface to PowerScheduler + /// </summary> + public interface IPowerScheduler + { + /// <summary> + /// Register to this event to receive status changes from the PowerScheduler + /// </summary> + event PowerSchedulerEventHandler OnPowerSchedulerEvent; + + /// <summary> + /// Registers an IStandbyHandler implementation + /// </summary> + /// <param name="handler">implementation to register for handling standby requests</param> + void Register(IStandbyHandler handler); + + /// <summary> + /// Registers an IWakeupHandler implementation + /// </summary> + /// <param name="handler">implementation to register for handling system resume time</param> + void Register(IWakeupHandler handler); + + /// <summary> + /// Unregisters an IStandbyHandler implementation + /// </summary> + /// <param name="handler">implementation to unregister for handling standby requests</param> + void Unregister(IStandbyHandler handler); + + /// <summary> + /// Registers an IWakeupHandler implementation + /// </summary> + /// <param name="handler">implementation to register for handling system resume time</param> + void Unregister(IWakeupHandler handler); + + /// <summary> + /// Checks if the given IStandbyHandler is registered + /// </summary> + /// <param name="handler">IStandbyHandler to check</param> + /// <returns>is the given handler registered?</returns> + bool IsRegistered(IStandbyHandler handler); + + /// <summary> + /// Checks if the given IWakeupHandler is registered + /// </summary> + /// <param name="handler">IWakeupHandler to check</param> + /// <returns>is the given handler registered?</returns> + bool IsRegistered(IWakeupHandler handler); + + /// <summary> + /// Requests suspension of the system + /// </summary> + /// <param name="source">description of who wants to suspend the system</param> + /// <param name="force">force the system to suspend (not recommended)</param> + void SuspendSystem(string source, bool force); + + /// <summary> + /// Requests suspension of the system. + /// </summary> + /// <param name="source"></param> + /// <param name="how">How to suspend, see MediaPortal.Util.RestartOptions</param> + /// <param name="force"></param> + void SuspendSystem(string source, int how, bool force); + + /// <summary> + /// Resets the idle timer of the PowerScheduler. When enough time has passed (IdleTimeout), the system + /// is suspended as soon as possible (no handler disallows shutdown). + /// Note that the idle timer is automatically reset to now when the user moves the mouse or touchs the keyboard. + /// </summary> + void UserActivityDetected(DateTime when); + + /// <summary> + /// Get the current state. If refresh is true, the state is the most current state, otherwise the state could be some seconds old. + /// Special case: If shutdown is not allowed because an event is almost due, the handler name is "EVENT-DUE". + /// </summary> + /// <param name="refresh"></param> + /// <param name="disAllowShutdown"></param> + /// <param name="disAllowShutdownHandler"></param> + /// <param name="nextWakeupTime"></param> + /// <param name="nextWakeupHandler"></param> + void GetCurrentState(bool refresh, out bool unattended, out bool disAllowShutdown, + out String disAllowShutdownHandler, out DateTime nextWakeupTime, out String nextWakeupHandler); + + + /// <summary> + /// Checks if a suspend request is in progress + /// </summary> + /// <returns>is the system currently trying to suspend?</returns> + bool IsSuspendInProgress(); + + /// <summary> + /// Provides access to PowerScheduler's settings + /// </summary> + PowerSettings Settings { get; } + } +} \ No newline at end of file Added: trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerSettings.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerSettings.cs (rev 0) +++ trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerSettings.cs 2012-02-09 16:39:52 UTC (rev 4438) @@ -0,0 +1,76 @@ +#region Copyright (C) 2005-2011 Team MediaPortal + +// Copyright (C) 2005-2011 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// MediaPortal is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MediaPortal. If not, see <http://www.gnu.org/licenses/>. + +#endregion + +#region Usings + +#endregion + +namespace TvEngine.PowerScheduler.Interfaces +{ + /// <summary> + /// Provides access to PowerScheduler's settings + /// </summary> + public interface IPowerSettings + { + /// <summary> + /// Should PowerScheduler actively try to put the system into standby? + /// </summary> + bool ShutdownEnabled { get; } + + /// <summary> + /// Should PowerScheduler check when any plugin wants to wakeup the system? + /// </summary> + bool WakeupEnabled { get; } + + /// <summary> + /// Should the shutdown attemps be forced? + /// </summary> + bool ForceShutdown { get; } + + /// <summary> + /// Should PowerScheduler be verbose when logging? + /// </summary> + bool ExtensiveLogging { get; } + + /// <summary> + /// If ShutdownEnabled, how long (in minutes) to wait before putting the + /// system into standby + /// </summary> + int IdleTimeout { get; } + + /// <summary> + /// if WakeupEnabled, the time (in seconds) to wakeup the system earlier than + /// the actual wakeup time + /// </summary> + int PreWakeupTime { get; } + + /// <summary> + /// Controls the granularity of the standby/wakeup checks in seconds + /// </summary> + int CheckInterval { get; } + + /// <summary> + /// How should put the system into standby? suspend/hibernate/stayon + /// suspend uses S3, hibernate uses S4, stayon is for debugging purposes and + /// doesn't put the system into standby at all + /// </summary> + ShutdownMode ShutdownMode { get; } + } +} \ No newline at end of file Added: trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IStandbyHandler.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IStandbyHandler.cs (rev 0) +++ trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IStandbyHandler.cs 2012-02-09 16:39:52 UTC (rev 4438) @@ -0,0 +1,68 @@ +#region Copyright (C) 2005-2011 Team MediaPortal + +// Copyright (C) 2005-2011 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// MediaPortal is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MediaPortal. If not, see <http://www.gnu.org/licenses/>. + +#endregion + +#region Usings + +#endregion + +namespace TvEngine.PowerScheduler.Interfaces +{ + /// <summary> + /// StandbyHandler interface for PowerScheduler + /// </summary> + public interface IStandbyHandler + { + /// <summary> + /// Indicator whether or not to allow suspension/hibernation of the system + /// </summary> + bool DisAllowShutdown { get; } + + /// <summary> + /// Called when the user turns away from the system. + /// </summary> + void UserShutdownNow(); + + /// <summary> + /// Description of the source that allows / disallows shutdown + /// </summary> + string HandlerName { get; } + } + + /// <summary> + /// PowerScheduler++ standby mode enumeration + /// </summary> + public enum StandbyMode + { + StandbyAllowed, + StandbyPrevented, + AwayModeRequested + } + + /// <summary> + /// Extension to the IStandbyHandler interface for PowerScheduler++ + /// </summary> + public interface IStandbyHandlerEx : IStandbyHandler + { + /// <summary> + /// Indicator which standby mode is requested by the handler + /// </summary> + StandbyMode StandbyMode { get; } + } +} \ No newline at end of file Added: trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IWakeupHandler.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IWakeupHandler.cs (rev 0) +++ trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IWakeupHandler.cs 2012-02-09 16:39:52 UTC (rev 4438) @@ -0,0 +1,46 @@ +#region Copyright (C) 2005-2011 Team MediaPortal + +// Copyright (C) 2005-2011 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// MediaPortal is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MediaPortal. If not, see <http://www.gnu.org/licenses/>. + +#endregion + +#region Usings + +using System; + +#endregion + +namespace TvEngine.PowerScheduler.Interfaces +{ + /// <summary> + /// To be implemented by classes who want to control system resume + /// </summary> + public interface IWakeupHandler + { + /// <summary> + /// Should return the earliest time the implementation desires to wake up the system. + /// </summary> + /// <param name="earliestWakeupTime">indicates the earliest valid wake up time that is considered valid by the PowerScheduler</param> + /// <returns>earliest time the implementation wants to wake up the system</returns> + DateTime GetNextWakeupTime(DateTime earliestWakeupTime); + + /// <summary> + /// Description of the source that want to wake up the system at the given time + /// </summary> + string HandlerName { get; } + } +} \ No newline at end of file Added: trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/PowerManager.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/PowerManager.cs (rev 0) +++ trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/PowerScheduler.Interfaces/PowerManager.cs 2012-02-09 16:39:52 UTC (rev 4438) @@ -0,0 +1,1268 @@ +#region Copyright (C) 2005-2011 Team MediaPortal + +// Copyright (C) 2005-2011 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// MediaPortal is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MediaPortal. If not, see <http://www.gnu.org/licenses/>. + +#endregion + +#region Usings + +using System; +using System.Net; +using System.Runtime.InteropServices; + +#endregion + +namespace TvEngine.PowerScheduler.Interfaces +{ + /// <summary> + /// Provides static methods for managing system power states, events and settings + /// </summary> + public static class PowerManager + { + #region Variables + + /// <summary> + /// Handle to unregister for power setting change notification + /// </summary> + private static IntPtr _hAwayMode = (IntPtr)null; + + #endregion + + #region System power structures and enumerations + + /// <summary> + /// The thread's execution requirements + /// </summary> + [Flags] + enum ExecutionState : uint + { + /// <summary> + /// Some error. + /// </summary> + Error = 0, + + /// <summary> + /// System is required, do not hibernate. + /// </summary> + ES_SYSTEM_REQUIRED = 0x00000001, + + /// <summary> + /// Display is required, do not hibernate. + /// </summary> + ES_DISPLAY_REQUIRED = 0x00000002, + + /// <summary> + /// User is active, do not hibernate. + /// </summary> + ES_USER_PRESENT = 0x00000004, + + /// <summary> + /// Enables away mode. + /// </summary> + ES_AWAYMODE_REQUIRED = 0x00000040, + + /// <summary> + /// Use together with the above options to report a + /// state until explicitly changed. + /// </summary> + ES_CONTINUOUS = 0x80000000 + } + + /// <summary> + /// Flags to register for power setting change notification + /// </summary> + const int DEVICE_NOTIFY_WINDOW_HANDLE = 0x00000000; + const int DEVICE_NOTIFY_SERVICE_HANDLE = 0x00000001; + + /// <summary> + /// Constants for power notifications + /// </summary> + public const int WM_POWERBROADCAST = 0x0218; + public const int PBT_APMQUERYSUSPEND = 0x0000; + public const int PBT_APMQUERYSUSPENDFAILED = 0x0002; + public const int PBT_APMSUSPEND = 0x0004; + public const int PBT_APMRESUMECRITICAL = 0x0006; + public const int PBT_APMRESUMESUSPEND = 0x0007; + public const int PBT_APMRESUMEAUTOMATIC = 0x0012; + public const int PBT_POWERSETTINGCHANGE = 0x8013; + public const int BROADCAST_QUERY_DENY = 0x424D5144; + + /// <summary> + /// This structure is sent when the PBT_POWERSETTINGSCHANGE message is sent. + /// It describes the power setting that has changed and contains data about the change + /// </summary> + [StructLayout(LayoutKind.Sequential, Pack = 4)] + public struct POWERBROADCAST_SETTING + { + public Guid PowerSetting; + public uint DataLength; + public byte Data; + } + + /// <summary> + /// Guid to register for power setting change notification + /// </summary> + public static Guid GUID_SYSTEM_AWAYMODE = new Guid("98a7f580-01f7-48aa-9c0f-44352c29e5C0"); + + /// <summary> + /// System power setting guids + /// </summary> + static Guid NO_SUBGROUP_GUID = new Guid("fea3413e-7e05-4911-9a71-700331f1c294"); + static Guid GUID_LOCK_CONSOLE_ON_WAKE = new Guid("0e796bdb-100d-47d6-a2d5-f7d2daa51f51"); + static Guid GUID_SUB_SLEEP = new Guid("238c9fa8-0aad-41ed-83f4-97be242c8f20"); + static Guid GUID_ALLOW_AWAY_MODE = new Guid("25dfa149-5dd1-4736-b5ab-e8a37b5b8187"); + static Guid GUID_SLEEP_AFTER = new Guid("29f6c1db-86da-48c5-9fdb-f2b67b1f44da"); + static Guid GUID_ALLOW_HYBRID_SLEEP = new Guid("94ac6d29-73ce-41a6-809f-6363ba21b47e"); + static Guid GUID_HIBERNATE_AFTER = new Guid("9d7815a6-7ee4-497e-8888-515a05f02364"); + static Guid GUID_ALLOW_RTC_WAKE = new Guid("bd3b718a-0680-4d9d-8ab2-e1d2b4ac806d"); + static Guid GUID_SUB_POWER_BUTTONS_AND_LID = new Guid("4f971e89-eebd-4455-a8de-9e59040e7347"); + static Guid GUID_LID_CLOSE_ACTION = new Guid("5ca83367-6e45-459f-a27b-476b1d01c936"); + static Guid GUID_POWER_BUTTON_ACTION = new Guid("7648efa3-dd9c-4e3e-b566-50f929386280"); + static Guid GUID_SLEEP_BUTTON_ACTION = new Guid("96996bc0-ad50-47ec-923b-6f41874dd9eb"); + static Guid GUID_SUB_MULTIMEDIA = new Guid("9596fb26-9850-41fd-ac3e-f7c3c00afd4b"); + static Guid GUID_WHEN_SHARING_MEDIA = new Guid("03680956-93bc-4294-bba6-4e0f09bb717f"); + + /// <summary> + /// Contains information about the power capabilities of the system. + /// </summary> + [StructLayout(LayoutKind.Sequential)] + struct SYSTEM_POWER_CAPABILITIES + { + [MarshalAs(UnmanagedType.I1)] + public bool PowerButtonPresent; + [MarshalAs(UnmanagedType.I1)] + public bool SleepButtonPresent; + [MarshalAs(UnmanagedType.I1)] + public bool LidPresent; + [MarshalAs(UnmanagedType.I1)] + public bool SystemS1; + [MarshalAs(UnmanagedType.I1)] + public bool SystemS2; + [MarshalAs(UnmanagedType.I1)] + public bool SystemS3; + [MarshalAs(UnmanagedType.I1)] + public bool SystemS4; + [MarshalAs(UnmanagedType.I1)] + public bool SystemS5; + [MarshalAs(UnmanagedType.I1)] + public bool HiberFilePresent; + [MarshalAs(UnmanagedType.I1)] + public bool FullWake; + [MarshalAs(UnmanagedType.I1)] + public bool VideoDimPresent; + [MarshalAs(UnmanagedType.I1)] + public bool ApmPresent; + [MarshalAs(UnmanagedType.I1)] + public bool UpsPresent; + [MarshalAs(UnmanagedType.I1)] + public bool ThermalControl; + [MarshalAs(UnmanagedType.I1)] + public bool ProcessorThrottle; + public byte ProcessorMinimumThrottle; + public byte ProcessorMaximumThrottle; + [MarshalAs(UnmanagedType.I1)] + public bool FastSystemS4; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] spare2; + [MarshalAs(UnmanagedType.I1)] + public bool DiskSpinDown; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public byte[] spare3; + [MarshalAs(UnmanagedType.I1)] + public bool SystemBatteriesPresent; + [MarshalAs(UnmanagedType.I1)] + public bool BatteriesAreShortTerm; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public BATTERY_REPORTING_SCALE[] BatteryScale; + public SYSTEM_POWER_STATE AcOnlineWake; + public SYSTEM_POWER_STATE SoftLidWake; + public SYSTEM_POWER_STATE RtcWake; + public SYSTEM_POWER_STATE MinimumDeviceWakeState; + public SYSTEM_POWER_STATE DefaultLowLatencyWake; + } + + /// <summary> + /// Contains the granularity of the battery capacity that is reported by IOCTL_BATTERY_QUERY_STATUS. + /// </summary> + [StructLayout(LayoutKind.Sequential)] + struct BATTERY_REPORTING_SCALE + { + public UInt32 Granularity; + public UInt32 Capacity; + } + + /// <summary> + /// Contains information about the power status of the system. + /// </summary> + struct SYSTEM_POWER_STATUS + { + public ACLineStatus ACLineStatus; + public BatteryFlag BatteryFlag; + public Byte BatteryLifePercent; + public Byte Reserved1; + public Int32 BatteryLifeTime; + public Int32 BatteryFullLifeTime; + } + + /// <summary> + /// The AC power status. + /// </summary> + enum ACLineStatus : byte + { + Offline = 0, + Online = 1, + Unknown = 255 + } + + /// <summary> + /// The battery charge status. + /// </summary> + enum BatteryFlag : byte + { + High = 1, + Low = 2, + Critical = 4, + Charging = 8, + NoSystemBattery = 128, + Unknown = 255 + } + + /// <summary> + /// Contains information used to set the system power state. + /// </summary> + [StructLayout(LayoutKind.Sequential, Pack=1)] + struct POWER_ACTION_POLICY + { + public POWER_ACTION Action; + public PowerActionFlags Flags; + public PowerActionEventCode EventCode; + } + + /// <summary> + /// Defines values that are used to specify system power action types. + /// </summary> + enum POWER_ACTION : uint + { + PowerActionNone = 0, // No system power action. + PowerActionReserved, // Reserved; do not use. + PowerActionSleep, // Sleep. + PowerActionHibernate, // Hibernate. + PowerActionShutdown, // Shutdown. + PowerActionShutdownReset, // Shutdown and reset. + PowerActionShutdownOff, // Shutdown and power off. + PowerActionWarmEject, // Warm eject. + } + + /// <summary> + /// + /// </summary> + [Flags] + enum PowerActionFlags : uint + { + POWER_ACTION_QUERY_ALLOWED = 0x00000001, // Broadcasts a PBT_APMQUERYSUSPEND event to each application to request permission to suspend operation. + POWER_ACTION_UI_ALLOWED = 0x00000002, // Applications can prompt the user for directions on how to prepare for suspension. Sets bit 0 in the Flags parameter passed in the lParam parameter of WM_POWERBROADCAST. + POWER_ACTION_OVERRIDE_APPS = 0x00000004, // Ignores applications that do not respond to the PBT_APMQUERYSUSPEND event broadcast in the WM_POWERBROADCAST message. + POWER_ACTION_LIGHTEST_FIRST = 0x10000000, // Uses the first lightest available sleep state. + POWER_ACTION_LOCK_CONSOLE = 0x20000000, // Requires entry of the system password upon resume from one of the system standby states. + POWER_ACTION_DISABLE_WAKES = 0x40000000, // Disables all wake events. + POWER_ACTION_CRITICAL = 0x80000000, // Forces a critical suspension. + } + + [Flags] + enum PowerActionEventCode : uint + { + POWER_LEVEL_USER_NOTIFY_TEXT = 0x00000001, // User notified using the UI. + POWER_LEVEL_USER_NOTIFY_SOUND = 0x00000002, // User notified using sound. + POWER_LEVEL_USER_NOTIFY_EXEC = 0x00000004, // Specifies a program to be executed. + POWER_USER_NOTIFY_BUTTON = 0x00000008, // Indicates that the power action is in response to a user power button press. + POWER_USER_NOTIFY_SHUTDOWN = 0x00000010, // Indicates a power action of shutdown/off. + POWER_FORCE_TRIGGER_RESET = 0x80000000, // Clears a user power button press. + } + + /// <summary> + /// The global flags constants are used to enable or disable user power policy options + /// </summary> + [Flags] + enum GlobalFlags : uint + { + EnableMultiBatteryDisplay = 0x02, // Enables or disables multiple battery display in the system Power Meter. + EnablePasswordLogon = 0x04, // Enables or disables requiring password logon when the system resumes from standby or hibernate. + EnableSysTrayBatteryMeter = 0x01, // Enables or disables the battery meter icon in the system tray. When this flag is cleared, the battery meter icon is not displayed. + EnableVideoDimDisplay = 0x10, // Enables or disables support for dimming the video display when the system changes from running on AC power to running on battery power. + EnableWakeOnRing = 0x08, // Enables or disables wake on ring support. + } + + /// <summary> + /// Contains power policy settings that are unique to each power scheme. + /// </summary> + struct POWER_POLICY + { + public USER_POWER_POLICY user; + public MACHINE_POWER_POLICY mach; + } + + /// <summary> + /// Contains power policy settings that are unique to each power scheme for a user. + /// </summary> + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + struct USER_POWER_POLICY { + public uint Revision; + public POWER_ACTION_POLICY IdleAc; + public POWER_ACTION_POLICY IdleDc; + public uint IdleTimeoutAc; + public uint IdleTimeoutDc; + public byte IdleSensitivityAc; + public byte IdleSensitivityDc; + public byte ThrottlePolicyAc; + public byte ThrottlePolicyDc; + public SYSTEM_POWER_STATE MaxSleepAc; + public SYSTEM_POWER_STATE MaxSleepDc; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public uint[] Reserved; + public uint VideoTimeoutAc; + public uint VideoTimeoutDc; + public uint SpindownTimeoutAc; + public uint SpindownTimeoutDc; + [MarshalAs(UnmanagedType.I1)] + public bool OptimizeForPowerAc; + [MarshalAs(UnmanagedType.I1)] + public bool OptimizeForPowerDc; + public byte FanThrottleToleranceAc; + public byte FanThrottleToleranceDc; + public byte ForcedThrottleAc; + public byte ForcedThrottleDc; + } + + /// <summary> + /// Contains computer power policy settings that are unique to each power scheme on the computer. + /// </summary> + struct MACHINE_POWER_POLICY { + public uint Revision; + public SYSTEM_POWER_STATE MinSleepAc; + public SYSTEM_POWER_STATE MinSleepDc; + public SYSTEM_POWER_STATE ReducedLatencySleepAc; + public SYSTEM_POWER_STATE ReducedLatencySleepDc; + public uint DozeTimeoutAc; + public uint DozeTimeoutDc; + public uint DozeS4TimeoutAc; + public uint DozeS4TimeoutDc; + public byte MinThrottleAc; + public byte MinThrottleDc; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public byte[] pad1; + public POWER_ACTION_POLICY OverThrottledAc; + public POWER_ACTION_POLICY OverThrottledDc; + } + + /// <summary> + /// Contains global power policy settings that apply to all power schemes. + /// </summary> + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct GLOBAL_POWER_POLICY + { + public GLOBAL_USER_POWER_POLICY user; + public GLOBAL_MACHINE_POWER_POLICY mach; + } + + /// <summary> + /// Contains global user power policy settings that apply to all power schemes for a user. + /// </summary> + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct GLOBAL_USER_POWER_POLICY + { + public const int NUM_DISCHARGE_POLICIES = 4; + + public uint Revision; + public POWER_ACTION_POLICY PowerButtonAc; + public POWER_ACTION_POLICY PowerButtonDc; + public POWER_ACTION_POLICY SleepButtonAc; + public POWER_ACTION_POLICY SleepButtonDc; + public POWER_ACTION_POLICY LidCloseAc; + public POWER_ACTION_POLICY LidCloseDc; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = NUM_DISCHARGE_POLICIES)] + public SYSTEM_POWER_LEVEL[] DischargePolicy; + public GlobalFlags GlobalFlags; + } + + /// <summary> + /// Contains information about system battery drain policy settings. + /// </summary> + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct SYSTEM_POWER_LEVEL + { + public bool Enable; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] Spare; + public uint BatteryLevel; + public POWER_ACTION_POLICY PowerPolicy; + public SYSTEM_POWER_STATE MinSystemState; + } + + /// <summary> + /// Contains global computer power policy settings that apply to all power schemes for all users. + /// </summary> + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct GLOBAL_MACHINE_POWER_POLICY + { + public uint Revision; + public SYSTEM_POWER_STATE LidOpenWakeAc; + public SYSTEM_POWER_STATE LidOpenWakeDc; + public uint BroadcastCapacityResolution; + } + + /// <summary> + /// Defines values that are used to specify system power states. + /// </summary> + enum SYSTEM_POWER_STATE + { + PowerSystemUnspecified = 0, + PowerSystemWorking = 1, + PowerSystemSleeping1 = 2, + PowerSystemSleeping2 = 3, + PowerSystemSleeping3 = 4, + PowerSystemHibernate = 5, + PowerSystemShutdown = 6, + PowerSys... [truncated message content] |
From: <mic...@us...> - 2012-02-09 16:46:49
|
Revision: 4441 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4441&view=rev Author: michael-t Date: 2012-02-09 16:46:42 +0000 (Thu, 09 Feb 2012) Log Message: ----------- Added Paths: ----------- trunk/plugins/PowerScheduler++/Test/test/Binaries/ trunk/plugins/PowerScheduler++/Test/test/Common-MP-TVE3/ trunk/plugins/PowerScheduler++/Test/test/MPEI/ trunk/plugins/PowerScheduler++/Test/test/PowerScheduler++.sln trunk/plugins/PowerScheduler++/Test/test/TvEngine3/ trunk/plugins/PowerScheduler++/Test/test/VersionInfo.cs trunk/plugins/PowerScheduler++/Test/test/mediaportal/ Removed Paths: ------------- trunk/plugins/PowerScheduler++/Test/Binaries/ trunk/plugins/PowerScheduler++/Test/Common-MP-TVE3/ trunk/plugins/PowerScheduler++/Test/MPEI/ trunk/plugins/PowerScheduler++/Test/PowerScheduler++.sln trunk/plugins/PowerScheduler++/Test/TvEngine3/ trunk/plugins/PowerScheduler++/Test/VersionInfo.cs trunk/plugins/PowerScheduler++/Test/mediaportal/ Deleted: trunk/plugins/PowerScheduler++/Test/PowerScheduler++.sln =================================================================== --- trunk/plugins/PowerScheduler++/Test/PowerScheduler++.sln 2012-02-09 16:44:42 UTC (rev 4440) +++ trunk/plugins/PowerScheduler++/Test/PowerScheduler++.sln 2012-02-09 16:46:42 UTC (rev 4441) @@ -1,60 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual C# Express 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerScheduler.Interfaces", "Common-MP-TVE3\PowerScheduler.Interfaces\PowerScheduler.Interfaces.csproj", "{7701AA79-18D4-4A18-BB52-16774FB7943D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerSchedulerClientPlugin", "mediaportal\PowerSchedulerClientPlugin\PowerSchedulerClientPlugin.csproj", "{CC77F438-DBD3-4D9C-80B1-C86BA50CF635}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerScheduler", "TvEngine3\TVLibrary\Plugins\PowerScheduler\PowerScheduler.csproj", "{3F8F1617-A987-4516-BF37-E01D04D2686F}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|Mixed Platforms = Debug|Mixed Platforms - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|Mixed Platforms = Release|Mixed Platforms - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7701AA79-18D4-4A18-BB52-16774FB7943D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7701AA79-18D4-4A18-BB52-16774FB7943D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7701AA79-18D4-4A18-BB52-16774FB7943D}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {7701AA79-18D4-4A18-BB52-16774FB7943D}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {7701AA79-18D4-4A18-BB52-16774FB7943D}.Debug|x86.ActiveCfg = Debug|x86 - {7701AA79-18D4-4A18-BB52-16774FB7943D}.Debug|x86.Build.0 = Debug|x86 - {7701AA79-18D4-4A18-BB52-16774FB7943D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7701AA79-18D4-4A18-BB52-16774FB7943D}.Release|Any CPU.Build.0 = Release|Any CPU - {7701AA79-18D4-4A18-BB52-16774FB7943D}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {7701AA79-18D4-4A18-BB52-16774FB7943D}.Release|Mixed Platforms.Build.0 = Release|x86 - {7701AA79-18D4-4A18-BB52-16774FB7943D}.Release|x86.ActiveCfg = Release|x86 - {7701AA79-18D4-4A18-BB52-16774FB7943D}.Release|x86.Build.0 = Release|x86 - {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Debug|x86.ActiveCfg = Debug|x86 - {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Debug|x86.Build.0 = Debug|x86 - {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Release|Any CPU.Build.0 = Release|Any CPU - {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Release|Mixed Platforms.Build.0 = Release|x86 - {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Release|x86.ActiveCfg = Release|x86 - {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Release|x86.Build.0 = Release|x86 - {3F8F1617-A987-4516-BF37-E01D04D2686F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3F8F1617-A987-4516-BF37-E01D04D2686F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3F8F1617-A987-4516-BF37-E01D04D2686F}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {3F8F1617-A987-4516-BF37-E01D04D2686F}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {3F8F1617-A987-4516-BF37-E01D04D2686F}.Debug|x86.ActiveCfg = Debug|x86 - {3F8F1617-A987-4516-BF37-E01D04D2686F}.Debug|x86.Build.0 = Debug|x86 - {3F8F1617-A987-4516-BF37-E01D04D2686F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3F8F1617-A987-4516-BF37-E01D04D2686F}.Release|Any CPU.Build.0 = Release|Any CPU - {3F8F1617-A987-4516-BF37-E01D04D2686F}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {3F8F1617-A987-4516-BF37-E01D04D2686F}.Release|Mixed Platforms.Build.0 = Release|x86 - {3F8F1617-A987-4516-BF37-E01D04D2686F}.Release|x86.ActiveCfg = Release|x86 - {3F8F1617-A987-4516-BF37-E01D04D2686F}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal Deleted: trunk/plugins/PowerScheduler++/Test/VersionInfo.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/VersionInfo.cs 2012-02-09 16:44:42 UTC (rev 4440) +++ trunk/plugins/PowerScheduler++/Test/VersionInfo.cs 2012-02-09 16:46:42 UTC (rev 4441) @@ -1,56 +0,0 @@ -#region Copyright (C) 2005-2011 Team MediaPortal - -// Copyright (C) 2005-2011 Team MediaPortal -// http://www.team-mediaportal.com -// -// MediaPortal is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 2 of the License, or -// (at your option) any later version. -// -// MediaPortal is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with MediaPortal. If not, see <http://www.gnu.org/licenses/>. - -#endregion - -using System.Reflection; -using System.Runtime.InteropServices; - - -// Allgemeine Informationen \xFCber eine Assembly werden \xFCber die folgenden -// Attribute gesteuert. \xC4ndern Sie diese Attributwerte, um die Informationen zu \xE4ndern, -// die mit einer Assembly verkn\xFCpft sind. - -#if DEBUG -[assembly: AssemblyConfiguration("Debug version")] -#else -[assembly: AssemblyConfiguration("")] -#endif - -[assembly: AssemblyCompany("Team MediaPortal")] -[assembly: AssemblyProduct("PowerScheduler++")] -[assembly: AssemblyCopyright("Copyright \xA9 2005-2011 Team MediaPortal")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.2.5.12")] -[assembly: AssemblyFileVersion("1.2.5.12")] -[assembly: AssemblyInformationalVersion("1.2.5.12 alpha version for MP 1.2.x")] - - - - Copied: trunk/plugins/PowerScheduler++/Test/test/PowerScheduler++.sln (from rev 4440, trunk/plugins/PowerScheduler++/Test/PowerScheduler++.sln) =================================================================== --- trunk/plugins/PowerScheduler++/Test/test/PowerScheduler++.sln (rev 0) +++ trunk/plugins/PowerScheduler++/Test/test/PowerScheduler++.sln 2012-02-09 16:46:42 UTC (rev 4441) @@ -0,0 +1,60 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual C# Express 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerScheduler.Interfaces", "Common-MP-TVE3\PowerScheduler.Interfaces\PowerScheduler.Interfaces.csproj", "{7701AA79-18D4-4A18-BB52-16774FB7943D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerSchedulerClientPlugin", "mediaportal\PowerSchedulerClientPlugin\PowerSchedulerClientPlugin.csproj", "{CC77F438-DBD3-4D9C-80B1-C86BA50CF635}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerScheduler", "TvEngine3\TVLibrary\Plugins\PowerScheduler\PowerScheduler.csproj", "{3F8F1617-A987-4516-BF37-E01D04D2686F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7701AA79-18D4-4A18-BB52-16774FB7943D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7701AA79-18D4-4A18-BB52-16774FB7943D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7701AA79-18D4-4A18-BB52-16774FB7943D}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {7701AA79-18D4-4A18-BB52-16774FB7943D}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {7701AA79-18D4-4A18-BB52-16774FB7943D}.Debug|x86.ActiveCfg = Debug|x86 + {7701AA79-18D4-4A18-BB52-16774FB7943D}.Debug|x86.Build.0 = Debug|x86 + {7701AA79-18D4-4A18-BB52-16774FB7943D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7701AA79-18D4-4A18-BB52-16774FB7943D}.Release|Any CPU.Build.0 = Release|Any CPU + {7701AA79-18D4-4A18-BB52-16774FB7943D}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {7701AA79-18D4-4A18-BB52-16774FB7943D}.Release|Mixed Platforms.Build.0 = Release|x86 + {7701AA79-18D4-4A18-BB52-16774FB7943D}.Release|x86.ActiveCfg = Release|x86 + {7701AA79-18D4-4A18-BB52-16774FB7943D}.Release|x86.Build.0 = Release|x86 + {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Debug|x86.ActiveCfg = Debug|x86 + {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Debug|x86.Build.0 = Debug|x86 + {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Release|Any CPU.Build.0 = Release|Any CPU + {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Release|Mixed Platforms.Build.0 = Release|x86 + {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Release|x86.ActiveCfg = Release|x86 + {CC77F438-DBD3-4D9C-80B1-C86BA50CF635}.Release|x86.Build.0 = Release|x86 + {3F8F1617-A987-4516-BF37-E01D04D2686F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3F8F1617-A987-4516-BF37-E01D04D2686F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3F8F1617-A987-4516-BF37-E01D04D2686F}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {3F8F1617-A987-4516-BF37-E01D04D2686F}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {3F8F1617-A987-4516-BF37-E01D04D2686F}.Debug|x86.ActiveCfg = Debug|x86 + {3F8F1617-A987-4516-BF37-E01D04D2686F}.Debug|x86.Build.0 = Debug|x86 + {3F8F1617-A987-4516-BF37-E01D04D2686F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3F8F1617-A987-4516-BF37-E01D04D2686F}.Release|Any CPU.Build.0 = Release|Any CPU + {3F8F1617-A987-4516-BF37-E01D04D2686F}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {3F8F1617-A987-4516-BF37-E01D04D2686F}.Release|Mixed Platforms.Build.0 = Release|x86 + {3F8F1617-A987-4516-BF37-E01D04D2686F}.Release|x86.ActiveCfg = Release|x86 + {3F8F1617-A987-4516-BF37-E01D04D2686F}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Copied: trunk/plugins/PowerScheduler++/Test/test/VersionInfo.cs (from rev 4440, trunk/plugins/PowerScheduler++/Test/VersionInfo.cs) =================================================================== --- trunk/plugins/PowerScheduler++/Test/test/VersionInfo.cs (rev 0) +++ trunk/plugins/PowerScheduler++/Test/test/VersionInfo.cs 2012-02-09 16:46:42 UTC (rev 4441) @@ -0,0 +1,56 @@ +#region Copyright (C) 2005-2011 Team MediaPortal + +// Copyright (C) 2005-2011 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// MediaPortal is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MediaPortal. If not, see <http://www.gnu.org/licenses/>. + +#endregion + +using System.Reflection; +using System.Runtime.InteropServices; + + +// Allgemeine Informationen \xFCber eine Assembly werden \xFCber die folgenden +// Attribute gesteuert. \xC4ndern Sie diese Attributwerte, um die Informationen zu \xE4ndern, +// die mit einer Assembly verkn\xFCpft sind. + +#if DEBUG +[assembly: AssemblyConfiguration("Debug version")] +#else +[assembly: AssemblyConfiguration("")] +#endif + +[assembly: AssemblyCompany("Team MediaPortal")] +[assembly: AssemblyProduct("PowerScheduler++")] +[assembly: AssemblyCopyright("Copyright \xA9 2005-2011 Team MediaPortal")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.2.5.12")] +[assembly: AssemblyFileVersion("1.2.5.12")] +[assembly: AssemblyInformationalVersion("1.2.5.12 alpha version for MP 1.2.x")] + + + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mic...@us...> - 2012-02-09 16:47:40
|
Revision: 4442 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4442&view=rev Author: michael-t Date: 2012-02-09 16:47:29 +0000 (Thu, 09 Feb 2012) Log Message: ----------- Removed Paths: ------------- trunk/plugins/PowerScheduler++/Test/CleanupFiles.bat trunk/plugins/PowerScheduler++/Test/CopyFiles.bat trunk/plugins/PowerScheduler++/Test/RestoreFiles.bat Deleted: trunk/plugins/PowerScheduler++/Test/CleanupFiles.bat =================================================================== --- trunk/plugins/PowerScheduler++/Test/CleanupFiles.bat 2012-02-09 16:46:42 UTC (rev 4441) +++ trunk/plugins/PowerScheduler++/Test/CleanupFiles.bat 2012-02-09 16:47:29 UTC (rev 4442) @@ -1,75 +0,0 @@ -@echo off -set PROJECTPATH=%~dp0 -if "%ProgramFiles(x86)%" == "" goto 32bit -set SERVERPATH=%ProgramFiles(x86)%\Team MediaPortal\MediaPortal TV Server -set CLIENTPATH=%ProgramFiles(x86)%\Team MediaPortal\MediaPortal -goto data -:32bit -set SERVERPATH=%ProgramFiles%\Team MediaPortal\MediaPortal TV Server -set CLIENTPATH=%ProgramFiles%\Team MediaPortal\MediaPortal -:data -if "%ProgramData%" == "" goto winXP -set SERVERLOGPATH=%ProgramData%\Team MediaPortal\MediaPortal TV Server\log -goto count -:winXP -set SERVERLOGPATH=%ALLUSERSPROFILE%\Application Data\Team MediaPortal\MediaPortal TV Server\log - -:count -set COUNT=1 - -echo Stopping TV Server -echo --------------------- -:stop -echo trying... -net stop tvservice > nul 2>nul -tasklist | find /i "tvservice" >nul 2>nul -if not %ERRORLEVEL% == 1 ( - ping localhost >nul 2>nul - set /a COUNT=%COUNT%+1 - if %COUNT% GTR 5 goto end - goto stop -) -echo. - -echo MediaPortal TV Server -echo --------------------- -for %%f in (Plugins\PowerScheduler.dll) do ( - echo %%f - if exist "%SERVERPATH%\%%f.org" ( - del "%SERVERPATH%\%%f" - move /Y "%SERVERPATH%\%%f.org" "%SERVERPATH%\%%f" - ) 2>nul -) -echo. -echo MediaPortal Common Library -echo ---------------------------------- -for %%f in (PowerScheduler.Interfaces.dll) do ( - echo %%f - if exist "%SERVERPATH%\%%f.org" ( - del "%SERVERPATH%\%%f" - move /Y "%SERVERPATH%\%%f.org" "%SERVERPATH%\%%f" - ) 2>nul - if exist "%CLIENTPATH%\%%f.org" ( - del "%CLIENTPATH%\%%f" - move /Y "%CLIENTPATH%\%%f.org" "%CLIENTPATH%\%%f" - ) 2>nul -) -echo. -echo MediaPortal Client -echo ------------------ -for %%f in (plugins\process\PowerSchedulerClientPlugin.dll) do ( - echo %%f - if exist "%CLIENTPATH%\%%f.org" ( - del "%CLIENTPATH%\%%f" - move /Y "%CLIENTPATH%\%%f.org" "%CLIENTPATH%\%%f" - ) 2>nul -) -echo. -echo Cleanup -echo ------------------ -move /Y "%SERVERLOGPATH%\tv.log" "%SERVERLOGPATH%\tv_old.log" -net start tvservice -echo. -:end -pause -exit \ No newline at end of file Deleted: trunk/plugins/PowerScheduler++/Test/CopyFiles.bat =================================================================== --- trunk/plugins/PowerScheduler++/Test/CopyFiles.bat 2012-02-09 16:46:42 UTC (rev 4441) +++ trunk/plugins/PowerScheduler++/Test/CopyFiles.bat 2012-02-09 16:47:29 UTC (rev 4442) @@ -1,74 +0,0 @@ -@echo off -set PROJECTPATH=%~dp0 -if "%ProgramFiles(x86)%" == "" goto 32bit -set SERVERPATH=%ProgramFiles(x86)%\Team MediaPortal\MediaPortal TV Server -set CLIENTPATH=%ProgramFiles(x86)%\Team MediaPortal\MediaPortal -goto data -:32bit -set SERVERPATH=%ProgramFiles%\Team MediaPortal\MediaPortal TV Server -set CLIENTPATH=%ProgramFiles%\Team MediaPortal\MediaPortal -:data -if "%ProgramData%" == "" goto winXP -set SERVERLOGPATH=%ProgramData%\Team MediaPortal\MediaPortal TV Server\log -goto count -:winXP -set SERVERLOGPATH=%ALLUSERSPROFILE%\Application Data\Team MediaPortal\MediaPortal TV Server\log - -:count -set COUNT=1 - -echo Stopping TV Server -echo --------------------- -:stop -echo trying... -net stop tvservice > nul 2>nul -tasklist | find /i "tvservice" >nul 2>nul -if not %ERRORLEVEL% == 1 ( - ping localhost >nul 2>nul - set /a COUNT=%COUNT%+1 - if %COUNT% GTR 5 goto end - goto stop -) -echo. -echo MediaPortal TV Server -echo --------------------- -for %%f in (Plugins\PowerScheduler.dll) do ( - echo %%f - if not exist "%SERVERPATH%\%%f.org" ( - ren "%SERVERPATH%\%%f" "%%~nxf.org" - ) 2>nul - copy "%PROJECTPATH%\TvEngine3\TVLibrary\Plugins\%%~nf\bin\Debug\%%~nxf" "%SERVERPATH%\%%~f" -) -echo. -echo MediaPortal Common Library -echo ---------------------------------- -for %%f in (PowerScheduler.Interfaces.dll) do ( - echo %%f - if not exist "%SERVERPATH%\%%f.org" ( - ren "%SERVERPATH%\%%f" "%%~nxf.org" - ) 2>nul - copy "%PROJECTPATH%\Common-MP-TVE3\%%~nf\bin\Debug\%%~nxf" "%SERVERPATH%\%%~f" - if not exist "%CLIENTPATH%\%%f.org" ( - ren "%CLIENTPATH%\%%f" "%%~nxf.org" - ) 2>nul - copy "%PROJECTPATH%\Common-MP-TVE3\%%~nf\bin\Debug\%%~nxf" "%CLIENTPATH%\%%~f" -) -echo. -echo MediaPortal Client -echo ------------------ -for %%f in (plugins\process\PowerSchedulerClientPlugin.dll) do ( - echo %%f - if not exist "%CLIENTPATH%\%%f.org" ( - ren "%CLIENTPATH%\%%f" "%%~nxf.org" - ) 2>nul - copy "%PROJECTPATH%\mediaportal\%%~nf\bin\Debug\%%~nxf" "%CLIENTPATH%\%%~f" -) -echo. -echo Cleanup -echo ------------------ -move /Y "%SERVERLOGPATH%\tv.log" "%SERVERLOGPATH%\tv_old.log" -move /Y "%SERVERLOGPATH%\error.log" "%SERVERLOGPATH%\error_old.log" -net start tvservice -echo. -:end -exit \ No newline at end of file Deleted: trunk/plugins/PowerScheduler++/Test/RestoreFiles.bat =================================================================== --- trunk/plugins/PowerScheduler++/Test/RestoreFiles.bat 2012-02-09 16:46:42 UTC (rev 4441) +++ trunk/plugins/PowerScheduler++/Test/RestoreFiles.bat 2012-02-09 16:47:29 UTC (rev 4442) @@ -1,74 +0,0 @@ -@echo off -set PROJECTPATH=%~dp0 -if "%ProgramFiles(x86)%" == "" goto 32bit -set SERVERPATH=%ProgramFiles(x86)%\Team MediaPortal\MediaPortal TV Server -set CLIENTPATH=%ProgramFiles(x86)%\Team MediaPortal\MediaPortal -goto data -:32bit -set SERVERPATH=%ProgramFiles%\Team MediaPortal\MediaPortal TV Server -set CLIENTPATH=%ProgramFiles%\Team MediaPortal\MediaPortal -:data -if "%ProgramData%" == "" goto winXP -set SERVERLOGPATH=%ProgramData%\Team MediaPortal\MediaPortal TV Server\log -goto count -:winXP -set SERVERLOGPATH=%ALLUSERSPROFILE%\Application Data\Team MediaPortal\MediaPortal TV Server\log - -:count -set COUNT=1 - -echo Stopping TV Server -echo --------------------- -:stop -echo trying... -net stop tvservice > nul 2>nul -tasklist | find /i "tvservice" >nul 2>nul -if not %ERRORLEVEL% == 1 ( - ping localhost >nul 2>nul - set /a COUNT=%COUNT%+1 - if %COUNT% GTR 5 goto end - goto stop -) -echo. -echo MediaPortal TV Server -echo --------------------- -for %%f in (Plugins\PowerScheduler.dll) do ( - echo %%f - if exist "%SERVERPATH%\%%f.org" ( - del "%SERVERPATH%\%%f" - copy "%SERVERPATH%\%%f.org" "%SERVERPATH%\%%f" - ) 2>nul -) -echo. -echo MediaPortal Common Library -echo ---------------------------------- -for %%f in (PowerScheduler.Interfaces.dll) do ( - echo %%f - if exist "%SERVERPATH%\%%f.org" ( - del "%SERVERPATH%\%%f" - copy "%SERVERPATH%\%%f.org" "%SERVERPATH%\%%f" - ) 2>nul - if exist "%CLIENTPATH%\%%f.org" ( - del "%CLIENTPATH%\%%f" - copy "%CLIENTPATH%\%%f.org" "%CLIENTPATH%\%%f" - ) 2>nul -) -echo. -echo MediaPortal Client -echo ------------------ -for %%f in (plugins\process\PowerSchedulerClientPlugin.dll) do ( - echo %%f - if exist "%CLIENTPATH%\%%f.org" ( - del "%CLIENTPATH%\%%f" - copy "%CLIENTPATH%\%%f.org" "%CLIENTPATH%\%%f" - ) 2>nul -) -echo. -echo Cleanup -echo ------------------ -move /Y "%SERVERLOGPATH%\tv.log" "%SERVERLOGPATH%\tv_old.log" -net start tvservice -echo. -:end -pause -exit \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mic...@us...> - 2012-02-16 17:07:13
|
Revision: 4453 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4453&view=rev Author: michael-t Date: 2012-02-16 17:06:59 +0000 (Thu, 16 Feb 2012) Log Message: ----------- Added Paths: ----------- trunk/plugins/PowerScheduler++/Test/new/ trunk/plugins/PowerScheduler++/Test/new/Binaries/ trunk/plugins/PowerScheduler++/Test/new/Binaries/Common.Utils.dll trunk/plugins/PowerScheduler++/Test/new/Binaries/Core.dll trunk/plugins/PowerScheduler++/Test/new/Binaries/Gentle.Common.dll trunk/plugins/PowerScheduler++/Test/new/Binaries/Gentle.Framework.dll trunk/plugins/PowerScheduler++/Test/new/Binaries/PluginBase.dll trunk/plugins/PowerScheduler++/Test/new/Binaries/PowerScheduler.Interfaces.dll trunk/plugins/PowerScheduler++/Test/new/Binaries/PowerScheduler.dll trunk/plugins/PowerScheduler++/Test/new/Binaries/PowerSchedulerClientPlugin.dll trunk/plugins/PowerScheduler++/Test/new/Binaries/SetupControls.dll trunk/plugins/PowerScheduler++/Test/new/Binaries/TVDatabase.dll trunk/plugins/PowerScheduler++/Test/new/Binaries/TVLibrary.dll trunk/plugins/PowerScheduler++/Test/new/Binaries/TvBusinessLayer.dll trunk/plugins/PowerScheduler++/Test/new/Binaries/TvControl.dll trunk/plugins/PowerScheduler++/Test/new/Binaries/TvLibrary.Interfaces.dll trunk/plugins/PowerScheduler++/Test/new/Binaries/TvService.exe trunk/plugins/PowerScheduler++/Test/new/Binaries/Utils.dll trunk/plugins/PowerScheduler++/Test/new/CleanupFiles.bat trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/ trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/ trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/EPGWakeupConfig.cs trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/ trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IEpgHandler.cs trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerController.cs trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerScheduler.cs trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerSettings.cs trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IWakeupHandler.cs trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/PowerManager.cs trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/PowerScheduler.Interfaces.csproj trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/PowerSchedulerEventArgs.cs trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/PowerSettings.cs trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Properties/ trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Properties/AssemblyInfo.cs trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/RemotePowerControl.cs trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/TimerException.cs trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/WaitableTimer.cs trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/WakeOnLanManager.cs trunk/plugins/PowerScheduler++/Test/new/CopyFiles.bat trunk/plugins/PowerScheduler++/Test/new/MPEI/ trunk/plugins/PowerScheduler++/Test/new/MPEI/PowerScheduler++ 1.2.6.0.mpe1 trunk/plugins/PowerScheduler++/Test/new/MPEI/PowerScheduler++.xmp2 trunk/plugins/PowerScheduler++/Test/new/MPEI/PowerScheduler_high.png trunk/plugins/PowerScheduler++/Test/new/MPEI/update.xml trunk/plugins/PowerScheduler++/Test/new/PowerScheduler++.sln trunk/plugins/PowerScheduler++/Test/new/RestoreFiles.bat trunk/plugins/PowerScheduler++/Test/new/TvEngine3/ trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/ trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/ trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/ trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/ trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/ActiveNetworkStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/ActiveSharesStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/ActiveStreamsStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/ControllerActiveStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/EpgGrabbingStandbyWakeupHandler.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/LocalClientStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/LocalClientWakeupHandler.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/PowerControllerStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/PowerControllerWakeupHandler.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/ProcessActiveStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/RebootWakeupHandler.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/RemoteClientStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/ScheduledRecordingsWakeupHandler.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Handlers/XmlTvImportWakeupHandler.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerScheduler.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerScheduler.csproj trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerSchedulerFactory.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerSchedulerPlugin.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Properties/ trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Properties/AssemblyInfo.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/ trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSchedulerSetup.Designer.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSchedulerSetup.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSchedulerSetup.resx trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSettingsForm.Designer.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/PowerSettingsForm.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/SelectProcessForm.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/SelectProcessForm.designer.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/SelectShareForm.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/Setup/SelectShareForm.designer.cs trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/TheAlgorithm.txt trunk/plugins/PowerScheduler++/Test/new/TvEngine3/TVLibrary/Plugins/PowerScheduler/WindowsController.cs trunk/plugins/PowerScheduler++/Test/new/VersionInfo.cs trunk/plugins/PowerScheduler++/Test/new/mediaportal/ trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/ trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/Handlers/ trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/Handlers/ActiveNetworkStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/Handlers/ActiveSharesStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/Handlers/ProcessActiveStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/Handlers/RebootWakeupHandler.cs trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/Handlers/WakeableStandbyHandler.cs trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/Handlers/WakeableWakeupHandler.cs trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/MasterVolume.cs trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/PowerScheduler.cs trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/PowerScheduler.gif trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/PowerSchedulerClientPlugin.cs trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/PowerSchedulerClientPlugin.csproj trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/PowerSchedulerFactory.cs trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/PowerScheduler_disabled.gif trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/Properties/ trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/Properties/AssemblyInfo.cs trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/Setup/ trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/Setup/PowerSchedulerSetup.Designer.cs trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/Setup/PowerSchedulerSetup.cs trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/Setup/PowerSchedulerSetup.resx trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/Setup/PowerSettingsForm.Designer.cs trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/Setup/PowerSettingsForm.cs trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/Setup/SelectProcessForm.cs trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/Setup/SelectProcessForm.designer.cs trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/Setup/SelectShareForm.cs trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/Setup/SelectShareForm.designer.cs trunk/plugins/PowerScheduler++/Test/new/mediaportal/PowerSchedulerClientPlugin/UnattendedWindow.cs Added: trunk/plugins/PowerScheduler++/Test/new/Binaries/Common.Utils.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/new/Binaries/Common.Utils.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/new/Binaries/Core.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/new/Binaries/Core.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/new/Binaries/Gentle.Common.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/new/Binaries/Gentle.Common.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/new/Binaries/Gentle.Framework.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/new/Binaries/Gentle.Framework.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/new/Binaries/PluginBase.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/new/Binaries/PluginBase.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/new/Binaries/PowerScheduler.Interfaces.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/new/Binaries/PowerScheduler.Interfaces.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/new/Binaries/PowerScheduler.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/new/Binaries/PowerScheduler.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/new/Binaries/PowerSchedulerClientPlugin.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/new/Binaries/PowerSchedulerClientPlugin.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/new/Binaries/SetupControls.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/new/Binaries/SetupControls.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/new/Binaries/TVDatabase.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/new/Binaries/TVDatabase.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/new/Binaries/TVLibrary.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/new/Binaries/TVLibrary.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/new/Binaries/TvBusinessLayer.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/new/Binaries/TvBusinessLayer.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/new/Binaries/TvControl.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/new/Binaries/TvControl.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/new/Binaries/TvLibrary.Interfaces.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/new/Binaries/TvLibrary.Interfaces.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/new/Binaries/TvService.exe =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/new/Binaries/TvService.exe ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/new/Binaries/Utils.dll =================================================================== (Binary files differ) Property changes on: trunk/plugins/PowerScheduler++/Test/new/Binaries/Utils.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/PowerScheduler++/Test/new/CleanupFiles.bat =================================================================== --- trunk/plugins/PowerScheduler++/Test/new/CleanupFiles.bat (rev 0) +++ trunk/plugins/PowerScheduler++/Test/new/CleanupFiles.bat 2012-02-16 17:06:59 UTC (rev 4453) @@ -0,0 +1,75 @@ +@echo off +set PROJECTPATH=%~dp0 +if "%ProgramFiles(x86)%" == "" goto 32bit +set SERVERPATH=%ProgramFiles(x86)%\Team MediaPortal\MediaPortal TV Server +set CLIENTPATH=%ProgramFiles(x86)%\Team MediaPortal\MediaPortal +goto data +:32bit +set SERVERPATH=%ProgramFiles%\Team MediaPortal\MediaPortal TV Server +set CLIENTPATH=%ProgramFiles%\Team MediaPortal\MediaPortal +:data +if "%ProgramData%" == "" goto winXP +set SERVERLOGPATH=%ProgramData%\Team MediaPortal\MediaPortal TV Server\log +goto count +:winXP +set SERVERLOGPATH=%ALLUSERSPROFILE%\Application Data\Team MediaPortal\MediaPortal TV Server\log + +:count +set COUNT=1 + +echo Stopping TV Server +echo --------------------- +:stop +echo trying... +net stop tvservice > nul 2>nul +tasklist | find /i "tvservice" >nul 2>nul +if not %ERRORLEVEL% == 1 ( + ping localhost >nul 2>nul + set /a COUNT=%COUNT%+1 + if %COUNT% GTR 5 goto end + goto stop +) +echo. + +echo MediaPortal TV Server +echo --------------------- +for %%f in (Plugins\PowerScheduler.dll) do ( + echo %%f + if exist "%SERVERPATH%\%%f.org" ( + del "%SERVERPATH%\%%f" + move /Y "%SERVERPATH%\%%f.org" "%SERVERPATH%\%%f" + ) 2>nul +) +echo. +echo MediaPortal Common Library +echo ---------------------------------- +for %%f in (PowerScheduler.Interfaces.dll) do ( + echo %%f + if exist "%SERVERPATH%\%%f.org" ( + del "%SERVERPATH%\%%f" + move /Y "%SERVERPATH%\%%f.org" "%SERVERPATH%\%%f" + ) 2>nul + if exist "%CLIENTPATH%\%%f.org" ( + del "%CLIENTPATH%\%%f" + move /Y "%CLIENTPATH%\%%f.org" "%CLIENTPATH%\%%f" + ) 2>nul +) +echo. +echo MediaPortal Client +echo ------------------ +for %%f in (plugins\process\PowerSchedulerClientPlugin.dll) do ( + echo %%f + if exist "%CLIENTPATH%\%%f.org" ( + del "%CLIENTPATH%\%%f" + move /Y "%CLIENTPATH%\%%f.org" "%CLIENTPATH%\%%f" + ) 2>nul +) +echo. +echo Cleanup +echo ------------------ +move /Y "%SERVERLOGPATH%\tv.log" "%SERVERLOGPATH%\tv_old.log" +net start tvservice +echo. +:end +pause +exit \ No newline at end of file Added: trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/EPGWakeupConfig.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/EPGWakeupConfig.cs (rev 0) +++ trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/EPGWakeupConfig.cs 2012-02-16 17:06:59 UTC (rev 4453) @@ -0,0 +1,125 @@ +#region Copyright (C) 2005-2011 Team MediaPortal + +// Copyright (C) 2005-2011 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// MediaPortal is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MediaPortal. If not, see <http://www.gnu.org/licenses/>. + +#endregion + +#region Usings + +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.Serialization.Formatters.Binary; + +#endregion + +namespace TvEngine.PowerScheduler +{ + + #region Enums + + public enum EPGGrabDays + { + Monday, + Tuesday, + Wednesday, + Thursday, + Friday, + Saturday, + Sunday + } + + #endregion + + [Serializable] + public class EPGWakeupConfig + { + public DateTime LastRun = DateTime.MinValue; + public List<EPGGrabDays> Days = new List<EPGGrabDays>(); + public int Hour; + public int Minutes; + + public EPGWakeupConfig() {} + + public EPGWakeupConfig(string serializedConfig) + { + EPGWakeupConfig cfg = new EPGWakeupConfig(); + try + { + BinaryFormatter formatter = new BinaryFormatter(); + byte[] buffer = Convert.FromBase64String(serializedConfig); + using (MemoryStream stream = new MemoryStream(buffer, 0, buffer.Length)) + { + cfg = (EPGWakeupConfig)formatter.Deserialize(stream); + } + } + catch (Exception) {} + Hour = cfg.Hour; + Minutes = cfg.Minutes; + Days = cfg.Days; + LastRun = cfg.LastRun; + } + + public string SerializeAsString() + { + BinaryFormatter formatter = new BinaryFormatter(); + string result; + using (MemoryStream stream = new MemoryStream()) + { + formatter.Serialize(stream, this); + stream.Flush(); + stream.Seek(0, SeekOrigin.Begin); + byte[] buffer = new byte[stream.Length]; + int bytesRead = stream.Read(buffer, 0, buffer.Length); + result = Convert.ToBase64String(buffer, 0, bytesRead); + } + return result; + } + + public override bool Equals(object obj) + { + if (obj is EPGWakeupConfig) + { + EPGWakeupConfig cfg = (EPGWakeupConfig)obj; + if (cfg.Hour == Hour && cfg.Minutes == Minutes) + { + foreach (EPGGrabDays day in cfg.Days) + { + if (!Days.Contains(day)) + { + return false; + } + } + foreach (EPGGrabDays day in Days) + { + if (!cfg.Days.Contains(day)) + { + return false; + } + } + return true; + } + } + return false; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + } +} \ No newline at end of file Added: trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IEpgHandler.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IEpgHandler.cs (rev 0) +++ trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IEpgHandler.cs 2012-02-16 17:06:59 UTC (rev 4453) @@ -0,0 +1,65 @@ +#region Copyright (C) 2005-2011 Team MediaPortal + +// Copyright (C) 2005-2011 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// MediaPortal is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MediaPortal. If not, see <http://www.gnu.org/licenses/>. + +#endregion + +#region Usings + +using System; + +#endregion + +namespace TvEngine.PowerScheduler.Interfaces +{ + public delegate void EPGScheduleHandler(); + + /// <summary> + /// Provides access to PowerScheduler's EPG interface for + /// EPG plugins. + /// </summary> + public interface IEpgHandler + { + /// <summary> + /// Allows an external EPG source to prevent standby when it's + /// grabbing EPG + /// </summary> + /// <param name="source">the source preventing standby</param> + /// <param name="allowed">is standby allowed?</param> + void SetStandbyAllowed(object source, bool allowed, int timeout); + + /// <summary> + /// Allows an external EPG source to set a preferred next wakeup time + /// </summary> + /// <param name="source">the source that wants to wakeup the system for EPG grabbing</param> + /// <param name="time">the desired time to wakeup the system</param> + void SetNextEPGWakeupTime(object source, DateTime time); + + /// <summary> + /// Allows an external EPG source to retrieve the next wakeup time + /// for EPG grabbing. This time can be used to start an actual EPG + /// grabbing process. + /// </summary> + /// <returns>next EPG grab wakeup time</returns> + DateTime GetNextEPGWakeupTime(); + + /// <summary> + /// Event which gets fired when the configured EPG wakeup schedule is due. + /// </summary> + event EPGScheduleHandler EPGScheduleDue; + } +} \ No newline at end of file Added: trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerController.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerController.cs (rev 0) +++ trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerController.cs 2012-02-16 17:06:59 UTC (rev 4453) @@ -0,0 +1,108 @@ +#region Copyright (C) 2005-2011 Team MediaPortal + +// Copyright (C) 2005-2011 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// MediaPortal is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MediaPortal. If not, see <http://www.gnu.org/licenses/>. + +#endregion + +#region Usings + +using System; + +#endregion + +namespace TvEngine.PowerScheduler.Interfaces +{ + /// <summary> + /// Public interface to PowerScheduler power control + /// Intented to be used by singleseat setups + /// </summary> + public interface IPowerController + { + /// <summary> + /// Requests suspension of the system. Uses default action. + /// </summary> + /// <param name="source">description of who wants to suspend the system</param> + /// <param name="force">force the system to suspend (not recommended)</param> + void SuspendSystem(string source, bool force); + + /// <summary> + /// Requests suspension of the system. + /// </summary> + /// <param name="source"></param> + /// <param name="how">How to suspend, see MediaPortal.Util.RestartOptions</param> + /// <param name="force"></param> + void SuspendSystem(string source, int how, bool force); + + /// <summary> + /// Enables clients on singleseat setups to indicate whether or not the system + /// is allowed to enter standby + /// </summary> + /// <param name="standbyAllowed">is standby allowed?</param> + /// <param name="handlerName">client handlername which prevents standby</param> + void SetStandbyAllowed(bool standbyAllowed, string handlerName); + + /// <summary> + /// Enables clients on singleseat setups to indicate when the next + /// earliest wakeup time is due + /// </summary> + /// <param name="nextWakeupTime">DateTime when to wakeup the system</param> + /// <param name="handlerName">client handlername which is responsible for this wakeup time</param> + void SetNextWakeupTime(DateTime nextWakeupTime, string handlerName); + + /// <summary> + /// Resets the idle timer of the PowerScheduler. When enough time has passed (IdleTimeout), the system + /// is suspended as soon as possible (no handler disallows shutdown). + /// Note that the idle timer is automatically reset to now when the user moves the mouse or touchs the keyboard. + /// </summary> + void UserActivityDetected(DateTime when); + + /// <summary> + /// Register remote handlers. If an empty string or null is passed, no handler is registered for + /// that type. It returns a tag used to unregister the later. The returned tag is always not 0. + /// </summary> + /// <param name="standbyHandlerURI"></param> + /// <param name="wakeupHandlerURI"></param> + int RegisterRemote(String standbyHandlerURI, String wakeupHandlerURI); + + /// <summary> + /// Unregister remote handlers. + /// </summary> + void UnregisterRemote(int tag); + + /// <summary> + /// Indicates whether or not we're connected to the PowerScheduler power control interfaces + /// </summary> + bool IsConnected { get; } + + /// <summary> + /// Get the current state. If refresh is true, the state is the most current state, otherwise the state could be some seconds old. + /// Special case: If shutdown is not allowed because an event is almost due, the handler name is "EVENT-DUE". + /// </summary> + /// <param name="refresh"></param> + /// <param name="disAllowShutdown"></param> + /// <param name="disAllowShutdownHandler"></param> + /// <param name="nextWakeupTime"></param> + /// <param name="nextWakeupHandler"></param> + void GetCurrentState(bool refresh, out bool unattended, out bool disAllowShutdown, + out String disAllowShutdownHandler, out DateTime nextWakeupTime, out String nextWakeupHandler); + + /// <summary> + /// Provides access to PowerScheduler's settings + /// </summary> + IPowerSettings PowerSettings { get; } + } +} \ No newline at end of file Added: trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerScheduler.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerScheduler.cs (rev 0) +++ trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerScheduler.cs 2012-02-16 17:06:59 UTC (rev 4453) @@ -0,0 +1,129 @@ +#region Copyright (C) 2005-2011 Team MediaPortal + +// Copyright (C) 2005-2011 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// MediaPortal is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MediaPortal. If not, see <http://www.gnu.org/licenses/>. + +#endregion + +#region Usings + +using System; + +#endregion + +namespace TvEngine.PowerScheduler.Interfaces +{ + /// <summary> + /// EvenHandler delegate for PowerScheduler events + /// </summary> + /// <param name="args"></param> + public delegate void PowerSchedulerEventHandler(PowerSchedulerEventArgs args); + + /// <summary> + /// Interface to PowerScheduler + /// </summary> + public interface IPowerScheduler + { + /// <summary> + /// Register to this event to receive status changes from the PowerScheduler + /// </summary> + event PowerSchedulerEventHandler OnPowerSchedulerEvent; + + /// <summary> + /// Registers an IStandbyHandler implementation + /// </summary> + /// <param name="handler">implementation to register for handling standby requests</param> + void Register(IStandbyHandler handler); + + /// <summary> + /// Registers an IWakeupHandler implementation + /// </summary> + /// <param name="handler">implementation to register for handling system resume time</param> + void Register(IWakeupHandler handler); + + /// <summary> + /// Unregisters an IStandbyHandler implementation + /// </summary> + /// <param name="handler">implementation to unregister for handling standby requests</param> + void Unregister(IStandbyHandler handler); + + /// <summary> + /// Registers an IWakeupHandler implementation + /// </summary> + /// <param name="handler">implementation to register for handling system resume time</param> + void Unregister(IWakeupHandler handler); + + /// <summary> + /// Checks if the given IStandbyHandler is registered + /// </summary> + /// <param name="handler">IStandbyHandler to check</param> + /// <returns>is the given handler registered?</returns> + bool IsRegistered(IStandbyHandler handler); + + /// <summary> + /// Checks if the given IWakeupHandler is registered + /// </summary> + /// <param name="handler">IWakeupHandler to check</param> + /// <returns>is the given handler registered?</returns> + bool IsRegistered(IWakeupHandler handler); + + /// <summary> + /// Requests suspension of the system + /// </summary> + /// <param name="source">description of who wants to suspend the system</param> + /// <param name="force">force the system to suspend (not recommended)</param> + void SuspendSystem(string source, bool force); + + /// <summary> + /// Requests suspension of the system. + /// </summary> + /// <param name="source"></param> + /// <param name="how">How to suspend, see MediaPortal.Util.RestartOptions</param> + /// <param name="force"></param> + void SuspendSystem(string source, int how, bool force); + + /// <summary> + /// Resets the idle timer of the PowerScheduler. When enough time has passed (IdleTimeout), the system + /// is suspended as soon as possible (no handler disallows shutdown). + /// Note that the idle timer is automatically reset to now when the user moves the mouse or touchs the keyboard. + /// </summary> + void UserActivityDetected(DateTime when); + + /// <summary> + /// Get the current state. If refresh is true, the state is the most current state, otherwise the state could be some seconds old. + /// Special case: If shutdown is not allowed because an event is almost due, the handler name is "EVENT-DUE". + /// </summary> + /// <param name="refresh"></param> + /// <param name="disAllowShutdown"></param> + /// <param name="disAllowShutdownHandler"></param> + /// <param name="nextWakeupTime"></param> + /// <param name="nextWakeupHandler"></param> + void GetCurrentState(bool refresh, out bool unattended, out bool disAllowShutdown, + out String disAllowShutdownHandler, out DateTime nextWakeupTime, out String nextWakeupHandler); + + + /// <summary> + /// Checks if a suspend request is in progress + /// </summary> + /// <returns>is the system currently trying to suspend?</returns> + bool IsSuspendInProgress(); + + /// <summary> + /// Provides access to PowerScheduler's settings + /// </summary> + PowerSettings Settings { get; } + } +} \ No newline at end of file Added: trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerSettings.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerSettings.cs (rev 0) +++ trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IPowerSettings.cs 2012-02-16 17:06:59 UTC (rev 4453) @@ -0,0 +1,76 @@ +#region Copyright (C) 2005-2011 Team MediaPortal + +// Copyright (C) 2005-2011 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// MediaPortal is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MediaPortal. If not, see <http://www.gnu.org/licenses/>. + +#endregion + +#region Usings + +#endregion + +namespace TvEngine.PowerScheduler.Interfaces +{ + /// <summary> + /// Provides access to PowerScheduler's settings + /// </summary> + public interface IPowerSettings + { + /// <summary> + /// Should PowerScheduler actively try to put the system into standby? + /// </summary> + bool ShutdownEnabled { get; } + + /// <summary> + /// Should PowerScheduler check when any plugin wants to wakeup the system? + /// </summary> + bool WakeupEnabled { get; } + + /// <summary> + /// Should the shutdown attemps be forced? + /// </summary> + bool ForceShutdown { get; } + + /// <summary> + /// Should PowerScheduler be verbose when logging? + /// </summary> + bool ExtensiveLogging { get; } + + /// <summary> + /// If ShutdownEnabled, how long (in minutes) to wait before putting the + /// system into standby + /// </summary> + int IdleTimeout { get; } + + /// <summary> + /// if WakeupEnabled, the time (in seconds) to wakeup the system earlier than + /// the actual wakeup time + /// </summary> + int PreWakeupTime { get; } + + /// <summary> + /// Controls the granularity of the standby/wakeup checks in seconds + /// </summary> + int CheckInterval { get; } + + /// <summary> + /// How should put the system into standby? suspend/hibernate/stayon + /// suspend uses S3, hibernate uses S4, stayon is for debugging purposes and + /// doesn't put the system into standby at all + /// </summary> + ShutdownMode ShutdownMode { get; } + } +} \ No newline at end of file Added: trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IStandbyHandler.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IStandbyHandler.cs (rev 0) +++ trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IStandbyHandler.cs 2012-02-16 17:06:59 UTC (rev 4453) @@ -0,0 +1,68 @@ +#region Copyright (C) 2005-2011 Team MediaPortal + +// Copyright (C) 2005-2011 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// MediaPortal is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MediaPortal. If not, see <http://www.gnu.org/licenses/>. + +#endregion + +#region Usings + +#endregion + +namespace TvEngine.PowerScheduler.Interfaces +{ + /// <summary> + /// StandbyHandler interface for PowerScheduler + /// </summary> + public interface IStandbyHandler + { + /// <summary> + /// Indicator whether or not to allow suspension/hibernation of the system + /// </summary> + bool DisAllowShutdown { get; } + + /// <summary> + /// Called when the user turns away from the system. + /// </summary> + void UserShutdownNow(); + + /// <summary> + /// Description of the source that allows / disallows shutdown + /// </summary> + string HandlerName { get; } + } + + /// <summary> + /// PowerScheduler++ standby mode enumeration + /// </summary> + public enum StandbyMode + { + StandbyAllowed, + StandbyPrevented, + AwayModeRequested + } + + /// <summary> + /// Extension to the IStandbyHandler interface for PowerScheduler++ + /// </summary> + public interface IStandbyHandlerEx : IStandbyHandler + { + /// <summary> + /// Indicator which standby mode is requested by the handler + /// </summary> + StandbyMode StandbyMode { get; } + } +} \ No newline at end of file Added: trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IWakeupHandler.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IWakeupHandler.cs (rev 0) +++ trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/Interfaces/IWakeupHandler.cs 2012-02-16 17:06:59 UTC (rev 4453) @@ -0,0 +1,46 @@ +#region Copyright (C) 2005-2011 Team MediaPortal + +// Copyright (C) 2005-2011 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// MediaPortal is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MediaPortal. If not, see <http://www.gnu.org/licenses/>. + +#endregion + +#region Usings + +using System; + +#endregion + +namespace TvEngine.PowerScheduler.Interfaces +{ + /// <summary> + /// To be implemented by classes who want to control system resume + /// </summary> + public interface IWakeupHandler + { + /// <summary> + /// Should return the earliest time the implementation desires to wake up the system. + /// </summary> + /// <param name="earliestWakeupTime">indicates the earliest valid wake up time that is considered valid by the PowerScheduler</param> + /// <returns>earliest time the implementation wants to wake up the system</returns> + DateTime GetNextWakeupTime(DateTime earliestWakeupTime); + + /// <summary> + /// Description of the source that want to wake up the system at the given time + /// </summary> + string HandlerName { get; } + } +} \ No newline at end of file Added: trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/PowerManager.cs =================================================================== --- trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/PowerManager.cs (rev 0) +++ trunk/plugins/PowerScheduler++/Test/new/Common-MP-TVE3/PowerScheduler.Interfaces/PowerManager.cs 2012-02-16 17:06:59 UTC (rev 4453) @@ -0,0 +1,1268 @@ +#region Copyright (C) 2005-2011 Team MediaPortal + +// Copyright (C) 2005-2011 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// MediaPortal is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MediaPortal. If not, see <http://www.gnu.org/licenses/>. + +#endregion + +#region Usings + +using System; +using System.Net; +using System.Runtime.InteropServices; + +#endregion + +namespace TvEngine.PowerScheduler.Interfaces +{ + /// <summary> + /// Provides static methods for managing system power states, events and settings + /// </summary> + public static class PowerManager + { + #region Variables + + /// <summary> + /// Handle to unregister for power setting change notification + /// </summary> + private static IntPtr _hAwayMode = (IntPtr)null; + + #endregion + + #region System power structures and enumerations + + /// <summary> + /// The thread's execution requirements + /// </summary> + [Flags] + enum ExecutionState : uint + { + /// <summary> + /// Some error. + /// </summary> + Error = 0, + + /// <summary> + /// System is required, do not hibernate. + /// </summary> + ES_SYSTEM_REQUIRED = 0x00000001, + + /// <summary> + /// Display is required, do not hibernate. + /// </summary> + ES_DISPLAY_REQUIRED = 0x00000002, + + /// <summary> + /// User is active, do not hibernate. + /// </summary> + ES_USER_PRESENT = 0x00000004, + + /// <summary> + /// Enables away mode. + /// </summary> + ES_AWAYMODE_REQUIRED = 0x00000040, + + /// <summary> + /// Use together with the above options to report a + /// state until explicitly changed. + /// </summary> + ES_CONTINUOUS = 0x80000000 + } + + /// <summary> + /// Flags to register for power setting change notification + /// </summary> + const int DEVICE_NOTIFY_WINDOW_HANDLE = 0x00000000; + const int DEVICE_NOTIFY_SERVICE_HANDLE = 0x00000001; + + /// <summary> + /// Constants for power notifications + /// </summary> + public const int WM_POWERBROADCAST = 0x0218; + public const int PBT_APMQUERYSUSPEND = 0x0000; + public const int PBT_APMQUERYSUSPENDFAILED = 0x0002; + public const int PBT_APMSUSPEND = 0x0004; + public const int PBT_APMRESUMECRITICAL = 0x0006; + public const int PBT_APMRESUMESUSPEND = 0x0007; + public const int PBT_APMRESUMEAUTOMATIC = 0x0012; + public const int PBT_POWERSETTINGCHANGE = 0x8013; + public const int BROADCAST_QUERY_DENY = 0x424D5144; + + /// <summary> + /// This structure is sent when the PBT_POWERSETTINGSCHANGE message is sent. + /// It describes the power setting that has changed and contains data about the change + /// </summary> + [StructLayout(LayoutKind.Sequential, Pack = 4)] + public struct POWERBROADCAST_SETTING + { + public Guid PowerSetting; + public uint DataLength; + public byte Data; + } + + /// <summary> + /// Guid to register for power setting change notification + /// </summary> + public static Guid GUID_SYSTEM_AWAYMODE = new Guid("98a7f580-01f7-48aa-9c0f-44352c29e5C0"); + + /// <summary> + /// System power setting guids + /// </summary> + static Guid NO_SUBGROUP_GUID = new Guid("fea3413e-7e05-4911-9a71-700331f1c294"); + static Guid GUID_LOCK_CONSOLE_ON_WAKE = new Guid("0e796bdb-100d-47d6-a2d5-f7d2daa51f51"); + static Guid GUID_SUB_SLEEP = new Guid("238c9fa8-0aad-41ed-83f4-97be242c8f20"); + static Guid GUID_ALLOW_AWAY_MODE = new Guid("25dfa149-5dd1-4736-b5ab-e8a37b5b8187"); + static Guid GUID_SLEEP_AFTER = new Guid("29f6c1db-86da-48c5-9fdb-f2b67b1f44da"); + static Guid GUID_ALLOW_HYBRID_SLEEP = new Guid("94ac6d29-73ce-41a6-809f-6363ba21b47e"); + static Guid GUID_HIBERNATE_AFTER = new Guid("9d7815a6-7ee4-497e-8888-515a05f02364"); + static Guid GUID_ALLOW_RTC_WAKE = new Guid("bd3b718a-0680-4d9d-8ab2-e1d2b4ac806d"); + static Guid GUID_SUB_POWER_BUTTONS_AND_LID = new Guid("4f971e89-eebd-4455-a8de-9e59040e7347"); + static Guid GUID_LID_CLOSE_ACTION = new Guid("5ca83367-6e45-459f-a27b-476b1d01c936"); + static Guid GUID_POWER_BUTTON_ACTION = new Guid("7648efa3-dd9c-4e3e-b566-50f929386280"); + static Guid GUID_SLEEP_BUTTON_ACTION = new Guid("96996bc0-ad50-47ec-923b-6f41874dd9eb"); + static Guid GUID_SUB_MULTIMEDIA = new Guid("9596fb26-9850-41fd-ac3e-f7c3c00afd4b"); + static Guid GUID_WHEN_SHARING_MEDIA = new Guid("03680956-93bc-4294-bba6-4e0f09bb717f"); + + /// <summary> + /// Contains information about the power capabilities of the system. + /// </summary> + [StructLayout(LayoutKind.Sequential)] + struct SYSTEM_POWER_CAPABILITIES + { + [MarshalAs(UnmanagedType.I1)] + public bool PowerButtonPresent; + [MarshalAs(UnmanagedType.I1)] + public bool SleepButtonPresent; + [MarshalAs(UnmanagedType.I1)] + public bool LidPresent; + [MarshalAs(UnmanagedType.I1)] + public bool SystemS1; + [MarshalAs(UnmanagedType.I1)] + public bool SystemS2; + [MarshalAs(UnmanagedType.I1)] + public bool SystemS3; + [MarshalAs(UnmanagedType.I1)] + public bool SystemS4; + [MarshalAs(UnmanagedType.I1)] + public bool SystemS5; + [MarshalAs(UnmanagedType.I1)] + public bool HiberFilePresent; + [MarshalAs(UnmanagedType.I1)] + public bool FullWake; + [MarshalAs(UnmanagedType.I1)] + public bool VideoDimPresent; + [MarshalAs(UnmanagedType.I1)] + public bool ApmPresent; + [MarshalAs(UnmanagedType.I1)] + public bool UpsPresent; + [MarshalAs(UnmanagedType.I1)] + public bool ThermalControl; + [MarshalAs(UnmanagedType.I1)] + public bool ProcessorThrottle; + public byte ProcessorMinimumThrottle; + public byte ProcessorMaximumThrottle; + [MarshalAs(UnmanagedType.I1)] + public bool FastSystemS4; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] spare2; + [MarshalAs(UnmanagedType.I1)] + public bool DiskSpinDown; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public byte[] spare3; + [MarshalAs(UnmanagedType.I1)] + public bool SystemBatteriesPresent; + [MarshalAs(UnmanagedType.I1)] + public bool BatteriesAreShortTerm; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public BATTERY_REPORTING_SCALE[] BatteryScale; + public SYSTEM_POWER_STATE AcOnlineWake; + public SYSTEM_POWER_STATE SoftLidWake; + public SYSTEM_POWER_STATE RtcWake; + public SYSTEM_POWER_STATE MinimumDeviceWakeState; + public SYSTEM_POWER_STATE DefaultLowLatencyWake; + } + + /// <summary> + /// Contains the granularity of the battery capacity that is reported by IOCTL_BATTERY_QUERY_STATUS. + /// </summary> + [StructLayout(LayoutKind.Sequential)] + struct BATTERY_REPORTING_SCALE + { + public UInt32 Granularity; + public UInt32 Capacity; + } + + /// <summary> + /// Contains information about the power status of the system. + /// </summary> + struct SYSTEM_POWER_STATUS + { + public ACLineStatus ACLineStatus; + public BatteryFlag BatteryFlag; + public Byte BatteryLifePercent; + public Byte Reserved1; + public Int32 BatteryLifeTime; + public Int32 BatteryFullLifeTime; + } + + /// <summary> + /// The AC power status. + /// </summary> + enum ACLineStatus : byte + { + Offline = 0, + Online = 1, + Unknown = 255 + } + + /// <summary> + /// The battery charge status. + /// </summary> + enum BatteryFlag : byte + { + High = 1, + Low = 2, + Critical = 4, + Charging = 8, + NoSystemBattery = 128, + Unknown = 255 + } + + /// <summary> + /// Contains information used to set the system power state. + /// </summary> + [StructLayout(LayoutKind.Sequential, Pack=1)] + struct POWER_ACTION_POLICY + { + public POWER_ACTION Action; + public PowerActionFlags Flags; + public PowerActionEventCode EventCode; + } + + /// <summary> + /// Defines values that are used to specify system power action types. + /// </summary> + enum POWER_ACTION : uint + { + PowerActionNone = 0, // No system power action. + PowerActionReserved, // Reserved; do not use. + PowerActionSleep, // Sleep. + PowerActionHibernate, // Hibernate. + PowerActionShutdown, // Shutdown. + PowerActionShutdownReset, // Shutdown and reset. + PowerActionShutdownOff, // Shutdown and power off. + PowerActionWarmEject, // Warm eject. + } + + /// <summary> + /// + /// </summary> + [Flags] + enum PowerActionFlags : uint + { + POWER_ACTION_QUERY_ALLOWED = 0x00000001, // Broadcasts a PBT_APMQUERYSUSPEND event to each application to request permission to suspend operation. + POWER_ACTION_UI_ALLOWED = 0x00000002, // Applications can prompt the user for directions on how to prepare for suspension. Sets bit 0 in the Flags parameter passed in the lParam parameter of WM_POWERBROADCAST. + POWER_ACTION_OVERRIDE_APPS = 0x00000004, // Ignores applications that do not respond to the PBT_APMQUERYSUSPEND event broadcast in the WM_POWERBROADCAST message. + POWER_ACTION_LIGHTEST_FIRST = 0x10000000, // Uses the first lightest available sleep state. + POWER_ACTION_LOCK_CONSOLE = 0x20000000, // Requires entry of the system password upon resume from one of the system standby states. + POWER_ACTION_DISABLE_WAKES = 0x40000000, // Disables all wake events. + POWER_ACTION_CRITICAL = 0x80000000, // Forces a critical suspension. + } + + [Flags] + enum PowerActionEventCode : uint + { + POWER_LEVEL_USER_NOTIFY_TEXT = 0x00000001, // User notified using the UI. + POWER_LEVEL_USER_NOTIFY_SOUND = 0x00000002, // User notified using sound. + POWER_LEVEL_USER_NOTIFY_EXEC = 0x00000004, // Specifies a program to be executed. + POWER_USER_NOTIFY_BUTTON = 0x00000008, // Indicates that the power action is in response to a user power button press. + POWER_USER_NOTIFY_SHUTDOWN = 0x00000010, // Indicates a power action of shutdown/off. + POWER_FORCE_TRIGGER_RESET = 0x80000000, // Clears a user power button press. + } + + /// <summary> + /// The global flags constants are used to enable or disable user power policy options + /// </summary> + [Flags] + enum GlobalFlags : uint + { + EnableMultiBatteryDisplay = 0x02, // Enables or disables multiple battery display in the system Power Meter. + EnablePasswordLogon = 0x04, // Enables or disables requiring password logon when the system resumes from standby or hibernate. + EnableSysTrayBatteryMeter = 0x01, // Enables or disables the battery meter icon in the system tray. When this flag is cleared, the battery meter icon is not displayed. + EnableVideoDimDisplay = 0x10, // Enables or disables support for dimming the video display when the system changes from running on AC power to running on battery power. + EnableWakeOnRing = 0x08, // Enables or disables wake on ring support. + } + + /// <summary> + /// Contains power policy settings that are unique to each power scheme. + /// </summary> + struct POWER_POLICY + { + public USER_POWER_POLICY user; + public MACHINE_POWER_POLICY mach; + } + + /// <summary> + /// Contains power policy settings that are unique to each power scheme for a user. + /// </summary> + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + struct USER_POWER_POLICY { + public uint Revision; + public POWER_ACTION_POLICY IdleAc; + public POWER_ACTION_POLICY IdleDc; + public uint IdleTimeoutAc; + public uint IdleTimeoutDc; + public byte IdleSensitivityAc; + public byte IdleSensitivityDc; + public byte ThrottlePolicyAc; + public byte ThrottlePolicyDc; + public SYSTEM_POWER_STATE MaxSleepAc; + public SYSTEM_POWER_STATE MaxSleepDc; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public uint[] Reserved; + public uint VideoTimeoutAc; + public uint VideoTimeoutDc; + public uint SpindownTimeoutAc; + public uint SpindownTimeoutDc; + [MarshalAs(UnmanagedType.I1)] + public bool OptimizeForPowerAc; + [MarshalAs(UnmanagedType.I1)] + public bool OptimizeForPowerDc; + public byte FanThrottleToleranceAc; + public byte FanThrottleToleranceDc; + public byte ForcedThrottleAc; + public byte ForcedThrottleDc; + } + + /// <summary> + /// Contains computer power policy settings that are unique to each power scheme on the computer. + /// </summary> + struct MACHINE_POWER_POLICY { + public uint Revision; + public SYSTEM_POWER_STATE MinSleepAc; + public SYSTEM_POWER_STATE MinSleepDc; + public SYSTEM_POWER_STATE ReducedLatencySleepAc; + public SYSTEM_POWER_STATE ReducedLatencySleepDc; + public uint DozeTimeoutAc; + public uint DozeTimeoutDc; + public uint DozeS4TimeoutAc; + public uint DozeS4TimeoutDc; + public byte MinThrottleAc; + public byte MinThrottleDc; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public byte[] pad1; + public POWER_ACTION_POLICY OverThrottledAc; + public POWER_ACTION_POLICY OverThrottledDc; + } + + /// <summary> + /// Contains global power policy settings that apply to all power schemes. + /// </summary> + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct GLOBAL_POWER_POLICY + { + public GLOBAL_USER_POWER_POLICY user; + public GLOBAL_MACHINE_POWER_POLICY mach; + } + + /// <summary> + /// Contains global user power policy settings that apply to all power schemes for a user. + /// </summary> + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct GLOBAL_USER_POWER_POLICY + { + public const int NUM_DISCHARGE_POLICIES = 4; + + public uint Revision; + public POWER_ACTION_POLICY PowerButtonAc; + public POWER_ACTION_POLICY PowerButtonDc; + public POWER_ACTION_POLICY SleepButtonAc; + public POWER_ACTION_POLICY SleepButtonDc; + public POWER_ACTION_POLICY LidCloseAc; + public POWER_ACTION_POLICY LidCloseDc; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = NUM_DISCHARGE_POLICIES)] + public SYSTEM_POWER_LEVEL[] DischargePolicy; + public GlobalFlags GlobalFlags; + } + + /// <summary> + /// Contains information about system battery drain policy settings. + /// </summary> + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct SYSTEM_POWER_LEVEL + { + public bool Enable; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] Spare; + public uint BatteryLevel; + public POWER_ACTION_POLICY PowerPolicy; + public SYSTEM_POWER_STATE MinSystemState; + } + + /// <summary> + /// Contains global computer power policy settings that ap... [truncated message content] |