Published v0.8.8.0.
Idle client now monitoring display power status so as to avoid going power
saving when the monitor is still on.
1.1 --- a/Clients/Idle/App.config Sun Feb 07 13:29:05 2016 +0100
1.2 +++ b/Clients/Idle/App.config Sun Feb 07 22:37:31 2016 +0100
1.3 @@ -1,6 +1,6 @@
1.4 -<?xml version="1.0" encoding="utf-8" ?>
1.5 +<?xml version="1.0" encoding="utf-8"?>
1.6 <configuration>
1.7 <startup>
1.8 - <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
1.9 + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
1.10 </startup>
1.11 -</configuration>
1.12 \ No newline at end of file
1.13 +</configuration>
2.1 --- a/Clients/Idle/FormClientIdle.cs Sun Feb 07 13:29:05 2016 +0100
2.2 +++ b/Clients/Idle/FormClientIdle.cs Sun Feb 07 22:37:31 2016 +0100
2.3 @@ -44,6 +44,9 @@
2.4 Client iClient;
2.5 ContentAlignment iAlignment;
2.6 TextField iTextField;
2.7 + //Used to determine if screen saver need to kick in
2.8 + private PowerManager.SettingNotifier iPowerSettingNotifier;
2.9 + private bool MonitorPowerOn;
2.10
2.11 public delegate void CloseDelegate();
2.12 public delegate void CloseConnectionDelegate();
2.13 @@ -75,9 +78,52 @@
2.14 //Timer
2.15 iTimer.Interval = IntervalToNextMinute();
2.16 iTimer.Start();
2.17 +
2.18 + //Create our power setting notifier and register the event we are interested in
2.19 + iPowerSettingNotifier = new PowerManager.SettingNotifier(Handle);
2.20 + iPowerSettingNotifier.OnMonitorPowerOn += OnMonitorPowerOn;
2.21 + iPowerSettingNotifier.OnMonitorPowerOff += OnMonitorPowerOff;
2.22 + MonitorPowerOn = true;
2.23 +
2.24 }
2.25
2.26 /// <summary>
2.27 + /// Broadcast messages to subscribers.
2.28 + /// </summary>
2.29 + /// <param name="message"></param>
2.30 + protected override void WndProc(ref Message aMessage)
2.31 + {
2.32 + //Hook in our power manager
2.33 + if (iPowerSettingNotifier != null)
2.34 + {
2.35 + iPowerSettingNotifier.WndProc(ref aMessage);
2.36 + }
2.37 +
2.38 + base.WndProc(ref aMessage);
2.39 + }
2.40 +
2.41 +
2.42 +
2.43 + /// <summary>
2.44 + ///
2.45 + /// </summary>
2.46 + private void OnMonitorPowerOn()
2.47 + {
2.48 + MonitorPowerOn = true;
2.49 + UpdateDisplay();
2.50 + }
2.51 +
2.52 + /// <summary>
2.53 + ///
2.54 + /// </summary>
2.55 + private void OnMonitorPowerOff()
2.56 + {
2.57 + MonitorPowerOn = false;
2.58 + UpdateDisplay();
2.59 + }
2.60 +
2.61 +
2.62 + /// <summary>
2.63 ///
2.64 /// </summary>
2.65 /// <returns></returns>
2.66 @@ -190,6 +236,15 @@
2.67 iTimer.Interval = IntervalToNextMinute();
2.68 iTimer.Start();
2.69
2.70 + UpdateDisplay();
2.71 +
2.72 + }
2.73 +
2.74 + /// <summary>
2.75 + ///
2.76 + /// </summary>
2.77 + private void UpdateDisplay()
2.78 + {
2.79 //
2.80 if (String.IsNullOrEmpty(iTextField.Text))
2.81 {
2.82 @@ -206,7 +261,8 @@
2.83 iClient.SetField(iTextField);
2.84
2.85 //Now make sure we save our screen from any running system monitor
2.86 - if (String.IsNullOrEmpty(iTextField.Text))
2.87 + //We don't go into screen saving mode if our monitor is still on
2.88 + if (String.IsNullOrEmpty(iTextField.Text) && !MonitorPowerOn)
2.89 {
2.90 //If text it empty it means we need to cool down our display even if system monitor is running
2.91 iClient.SetPriority(Priorities.SystemMonitor + 1);
2.92 @@ -218,6 +274,11 @@
2.93 }
2.94 }
2.95
2.96 + /// <summary>
2.97 + ///
2.98 + /// </summary>
2.99 + /// <param name="sender"></param>
2.100 + /// <param name="e"></param>
2.101 private void FormClientIdle_Shown(object sender, EventArgs e)
2.102 {
2.103 //Visible = false;
3.1 --- a/Clients/Idle/Properties/Resources.Designer.cs Sun Feb 07 13:29:05 2016 +0100
3.2 +++ b/Clients/Idle/Properties/Resources.Designer.cs Sun Feb 07 22:37:31 2016 +0100
3.3 @@ -8,10 +8,10 @@
3.4 // </auto-generated>
3.5 //------------------------------------------------------------------------------
3.6
3.7 -namespace SharpDisplayIdleClient.Properties
3.8 -{
3.9 -
3.10 -
3.11 +namespace SharpDisplayIdleClient.Properties {
3.12 + using System;
3.13 +
3.14 +
3.15 /// <summary>
3.16 /// A strongly-typed resource class, for looking up localized strings, etc.
3.17 /// </summary>
3.18 @@ -22,48 +22,40 @@
3.19 [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
3.20 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
3.21 [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
3.22 - internal class Resources
3.23 - {
3.24 -
3.25 + internal class Resources {
3.26 +
3.27 private static global::System.Resources.ResourceManager resourceMan;
3.28 -
3.29 +
3.30 private static global::System.Globalization.CultureInfo resourceCulture;
3.31 -
3.32 +
3.33 [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
3.34 - internal Resources()
3.35 - {
3.36 + internal Resources() {
3.37 }
3.38 -
3.39 +
3.40 /// <summary>
3.41 /// Returns the cached ResourceManager instance used by this class.
3.42 /// </summary>
3.43 [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
3.44 - internal static global::System.Resources.ResourceManager ResourceManager
3.45 - {
3.46 - get
3.47 - {
3.48 - if ((resourceMan == null))
3.49 - {
3.50 + internal static global::System.Resources.ResourceManager ResourceManager {
3.51 + get {
3.52 + if (object.ReferenceEquals(resourceMan, null)) {
3.53 global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharpDisplayIdleClient.Properties.Resources", typeof(Resources).Assembly);
3.54 resourceMan = temp;
3.55 }
3.56 return resourceMan;
3.57 }
3.58 }
3.59 -
3.60 +
3.61 /// <summary>
3.62 /// Overrides the current thread's CurrentUICulture property for all
3.63 /// resource lookups using this strongly typed resource class.
3.64 /// </summary>
3.65 [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
3.66 - internal static global::System.Globalization.CultureInfo Culture
3.67 - {
3.68 - get
3.69 - {
3.70 + internal static global::System.Globalization.CultureInfo Culture {
3.71 + get {
3.72 return resourceCulture;
3.73 }
3.74 - set
3.75 - {
3.76 + set {
3.77 resourceCulture = value;
3.78 }
3.79 }
4.1 --- a/Clients/Idle/Properties/Settings.Designer.cs Sun Feb 07 13:29:05 2016 +0100
4.2 +++ b/Clients/Idle/Properties/Settings.Designer.cs Sun Feb 07 22:37:31 2016 +0100
4.3 @@ -8,21 +8,17 @@
4.4 // </auto-generated>
4.5 //------------------------------------------------------------------------------
4.6
4.7 -namespace SharpDisplayIdleClient.Properties
4.8 -{
4.9 -
4.10 -
4.11 +namespace SharpDisplayIdleClient.Properties {
4.12 +
4.13 +
4.14 [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
4.15 - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
4.16 - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
4.17 - {
4.18 -
4.19 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
4.20 + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
4.21 +
4.22 private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
4.23 -
4.24 - public static Settings Default
4.25 - {
4.26 - get
4.27 - {
4.28 +
4.29 + public static Settings Default {
4.30 + get {
4.31 return defaultInstance;
4.32 }
4.33 }
5.1 --- a/Clients/Idle/SharpDisplayClientIdle.csproj Sun Feb 07 13:29:05 2016 +0100
5.2 +++ b/Clients/Idle/SharpDisplayClientIdle.csproj Sun Feb 07 22:37:31 2016 +0100
5.3 @@ -9,9 +9,10 @@
5.4 <AppDesignerFolder>Properties</AppDesignerFolder>
5.5 <RootNamespace>SharpDisplayIdleClient</RootNamespace>
5.6 <AssemblyName>SharpDisplayIdleClient</AssemblyName>
5.7 - <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
5.8 + <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
5.9 <FileAlignment>512</FileAlignment>
5.10 <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
5.11 + <TargetFrameworkProfile />
5.12 </PropertyGroup>
5.13 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
5.14 <PlatformTarget>AnyCPU</PlatformTarget>
5.15 @@ -81,6 +82,7 @@
5.16 <Compile Include="Properties\Resources.Designer.cs">
5.17 <AutoGen>True</AutoGen>
5.18 <DependentUpon>Resources.resx</DependentUpon>
5.19 + <DesignTime>True</DesignTime>
5.20 </Compile>
5.21 <None Include="packages.config" />
5.22 <None Include="Properties\Settings.settings">
5.23 @@ -96,6 +98,12 @@
5.24 <ItemGroup>
5.25 <None Include="App.config" />
5.26 </ItemGroup>
5.27 + <ItemGroup>
5.28 + <ProjectReference Include="..\..\PowerManager\PowerManager.vcxproj">
5.29 + <Project>{c174f23d-3055-49bc-b6b0-563011af624d}</Project>
5.30 + <Name>PowerManager</Name>
5.31 + </ProjectReference>
5.32 + </ItemGroup>
5.33 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
5.34 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
5.35 Other similar extension points exist, see Microsoft.Common.targets.
6.1 --- a/Server/ConsumerElectronicControl.cs Sun Feb 07 13:29:05 2016 +0100
6.2 +++ b/Server/ConsumerElectronicControl.cs Sun Feb 07 22:37:31 2016 +0100
6.3 @@ -15,6 +15,9 @@
6.4 private PowerManager.SettingNotifier iPowerSettingNotifier;
6.5 ///
6.6 private Cec.Client iCecClient;
6.7 + ///This flag will only work properly if both on and off events are monitored.
6.8 + ///TODO: have a more solid implementation
6.9 + public bool MonitorPowerOn;
6.10
6.11 /// <summary>
6.12 ///
6.13 @@ -24,6 +27,9 @@
6.14 /// <param name="aHdmiPort"></param>
6.15 public void Start(IntPtr aWndHandle, string aDeviceName, byte aHdmiPort, bool aMonitorOn, bool aMonitorOff)
6.16 {
6.17 + //Assuming monitor is on when we start up
6.18 + MonitorPowerOn = true;
6.19 +
6.20 //Create our power setting notifier and register the event we are interested in
6.21 iPowerSettingNotifier = new PowerManager.SettingNotifier(aWndHandle);
6.22
6.23 @@ -72,16 +78,18 @@
6.24 Debug.WriteLine("ON");
6.25 iCecClient.Lib.PowerOnDevices(CecLogicalAddress.Tv);
6.26 iCecClient.Lib.SetActiveSource(CecDeviceType.Tv);
6.27 + MonitorPowerOn = true;
6.28 }
6.29
6.30 private void OnMonitorPowerOff()
6.31 {
6.32 Debug.WriteLine("OFF");
6.33 iCecClient.Lib.StandbyDevices(CecLogicalAddress.Tv);
6.34 + MonitorPowerOn = false;
6.35 }
6.36
6.37 /// <summary>
6.38 - /// We need to handle WM_INPUT.
6.39 + /// We need to handle WM_POWERBROADCAST.
6.40 /// </summary>
6.41 /// <param name="message"></param>
6.42 public void OnWndProc(ref Message message)
7.1 --- a/Server/SharpDisplayManager.csproj Sun Feb 07 13:29:05 2016 +0100
7.2 +++ b/Server/SharpDisplayManager.csproj Sun Feb 07 22:37:31 2016 +0100
7.3 @@ -34,7 +34,7 @@
7.4 <WebPage>index.htm</WebPage>
7.5 <OpenBrowserOnPublish>false</OpenBrowserOnPublish>
7.6 <ApplicationRevision>0</ApplicationRevision>
7.7 - <ApplicationVersion>0.8.7.0</ApplicationVersion>
7.8 + <ApplicationVersion>0.8.8.0</ApplicationVersion>
7.9 <UseApplicationTrust>false</UseApplicationTrust>
7.10 <CreateDesktopShortcut>true</CreateDesktopShortcut>
7.11 <PublishWizardCompleted>true</PublishWizardCompleted>