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] |