Published V0.9.1.0
authorStephane Lenclud
Sun, 17 Jul 2016 19:35:29 +0200
changeset 203ce63ebb51da4
parent 202 8784c59c784e
child 204 6345461600d7
Published V0.9.1.0
Fixing libcec to prevent turning back on TV after standby.
Server/CecClient.cs
Server/ConsumerElectronicControl.cs
Server/SharpDisplayManager.csproj
Server/cec.dll
     1.1 --- a/Server/CecClient.cs	Sat Jul 16 00:24:08 2016 +0200
     1.2 +++ b/Server/CecClient.cs	Sun Jul 17 19:35:29 2016 +0200
     1.3 @@ -44,10 +44,10 @@
     1.4          /// </summary>
     1.5          /// <param name="aDeviceName"></param>
     1.6          /// <param name="aHdmiPort"></param>
     1.7 -        public Client(string aDeviceName, byte aHdmiPort, CecLogLevel aLogLevel = CecLogLevel.Warning)
     1.8 +        public Client(string aDeviceName, byte aHdmiPort, CecDeviceType aDeviceType = CecDeviceType.PlaybackDevice, CecLogLevel aLogLevel = CecLogLevel.Warning)
     1.9          {
    1.10              Config = new LibCECConfiguration();
    1.11 -            Config.DeviceTypes.Types[0] = CecDeviceType.RecordingDevice;
    1.12 +            Config.DeviceTypes.Types[0] = aDeviceType;
    1.13              Config.DeviceName = aDeviceName;
    1.14              Config.HDMIPort = aHdmiPort;
    1.15              //Config.ClientVersion = LibCECConfiguration.CurrentVersion;
    1.16 @@ -509,21 +509,7 @@
    1.17                      LogLevel = int.Parse(splitCommand[1]);                
    1.18              }
    1.19          }
    1.20 -
    1.21 -        /// TODO: remove that
    1.22 -        static void Main(string[] args)
    1.23 -        {
    1.24 -            Client p = new Client("CEC",2, CecLogLevel.All);
    1.25 -            if (p.Connect(10000))
    1.26 -            {
    1.27 -                p.MainLoop();
    1.28 -            }
    1.29 -            else
    1.30 -            {
    1.31 -                Console.WriteLine("Could not open a connection to the CEC adapter");
    1.32 -            }
    1.33 -        }
    1.34 -
    1.35 +       
    1.36          /// <summary>
    1.37          /// Provide direct access to CEC library
    1.38          /// </summary>
     2.1 --- a/Server/ConsumerElectronicControl.cs	Sat Jul 16 00:24:08 2016 +0200
     2.2 +++ b/Server/ConsumerElectronicControl.cs	Sun Jul 17 19:35:29 2016 +0200
     2.3 @@ -51,7 +51,7 @@
     2.4              }
     2.5  
     2.6              //CEC
     2.7 -            iCecClient = new Cec.Client(aDeviceName,aHdmiPort, CecLogLevel.Notice);
     2.8 +            iCecClient = new Cec.Client(aDeviceName,aHdmiPort, CecDeviceType.PlaybackDevice, CecLogLevel.All&~CecLogLevel.Traffic&~CecLogLevel.Debug);
     2.9              if (!iCecClient.Connect(1000))
    2.10              {
    2.11                  Debug.WriteLine("WARNING: No CEC connection!");
    2.12 @@ -80,16 +80,24 @@
    2.13  
    2.14          private void OnMonitorPowerOn()
    2.15          {
    2.16 -            Debug.WriteLine("ON");
    2.17 -            iCecClient.Lib.PowerOnDevices(CecLogicalAddress.Tv);
    2.18 -            iCecClient.Lib.SetActiveSource(CecDeviceType.Tv);
    2.19 +            Console.WriteLine("ON");
    2.20 +            //Turn on the TV
    2.21 +            //iCecClient.Lib.PowerOnDevices(CecLogicalAddress.Tv);
    2.22 +            //iCecClient.Lib.SendKeypress(CecLogicalAddress.Tv,CecUserControlCode.PowerOnFunction,true);
    2.23 +            //Set ourselves as the active source
    2.24 +            iCecClient.Lib.SetActiveSource(CecDeviceType.PlaybackDevice);
    2.25              MonitorPowerOn = true;
    2.26          }
    2.27  
    2.28          private void OnMonitorPowerOff()
    2.29          {
    2.30 -            Debug.WriteLine("OFF");
    2.31 +            Console.WriteLine("OFF");
    2.32 +            //Try turning off the TV
    2.33              iCecClient.Lib.StandbyDevices(CecLogicalAddress.Tv);
    2.34 +            //iCecClient.Lib.SendKeypress(CecLogicalAddress.Tv, CecUserControlCode.PowerOffFunction, true);
    2.35 +            //Tell everyone that we are no longer active
    2.36 +            //iCecClient.Lib.SetInactiveView();
    2.37 +
    2.38              MonitorPowerOn = false;
    2.39          }
    2.40  
     3.1 --- a/Server/SharpDisplayManager.csproj	Sat Jul 16 00:24:08 2016 +0200
     3.2 +++ b/Server/SharpDisplayManager.csproj	Sun Jul 17 19:35:29 2016 +0200
     3.3 @@ -34,7 +34,7 @@
     3.4      <WebPage>index.htm</WebPage>
     3.5      <OpenBrowserOnPublish>false</OpenBrowserOnPublish>
     3.6      <ApplicationRevision>0</ApplicationRevision>
     3.7 -    <ApplicationVersion>0.9.0.0</ApplicationVersion>
     3.8 +    <ApplicationVersion>0.9.1.0</ApplicationVersion>
     3.9      <UseApplicationTrust>false</UseApplicationTrust>
    3.10      <CreateDesktopShortcut>true</CreateDesktopShortcut>
    3.11      <PublishWizardCompleted>true</PublishWizardCompleted>
     4.1 Binary file Server/cec.dll has changed