Server/MainForm.Hid.cs
changeset 161 7b19bea5d73a
parent 160 de942d321cfb
child 167 d2295c186ce1
     1.1 --- a/Server/MainForm.Hid.cs	Thu Sep 24 22:45:32 2015 +0200
     1.2 +++ b/Server/MainForm.Hid.cs	Fri Sep 25 12:28:47 2015 +0200
     1.3 @@ -34,6 +34,9 @@
     1.4          ///
     1.5          private PowerManager.SettingNotifier iPowerSettingNotifier;
     1.6  
     1.7 +        ///
     1.8 +        private Cec.Client iCecClient;
     1.9 +
    1.10          /// <summary>
    1.11          /// Register HID devices so that we receive corresponding WM_INPUT messages.
    1.12          /// </summary>
    1.13 @@ -99,16 +102,25 @@
    1.14              iPowerSettingNotifier = new PowerManager.SettingNotifier(Handle);
    1.15              iPowerSettingNotifier.OnMonitorPowerOn += MonitorPowerOn;
    1.16              iPowerSettingNotifier.OnMonitorPowerOff += MonitorPowerOff;
    1.17 +
    1.18 +            //CEC
    1.19 +            iCecClient = new Cec.Client();
    1.20 +            if (!iCecClient.Connect(1000))
    1.21 +            {
    1.22 +                Debug.WriteLine("WARNING: No CEC connection!");
    1.23 +            }
    1.24          }
    1.25  
    1.26 -        static void MonitorPowerOn()
    1.27 +        void MonitorPowerOn()
    1.28          {
    1.29              Debug.WriteLine("ON");
    1.30 +            iCecClient.PowerOnDevices(CecSharp.CecLogicalAddress.Tv);
    1.31          }
    1.32  
    1.33 -        static void MonitorPowerOff()
    1.34 +        void MonitorPowerOff()
    1.35          {
    1.36              Debug.WriteLine("OFF");
    1.37 +            iCecClient.StandbyDevices(CecSharp.CecLogicalAddress.Tv);
    1.38          }
    1.39  
    1.40