Server/Actions/ActionCecDevicePowerOn.cs
changeset 220 e5910d7b6a81
child 221 5770478e1fe3
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Server/Actions/ActionCecDevicePowerOn.cs	Tue Jul 26 15:05:57 2016 +0200
     1.3 @@ -0,0 +1,40 @@
     1.4 +using CecSharp;
     1.5 +using SharpLib.Ear;
     1.6 +using System;
     1.7 +using System.Collections.Generic;
     1.8 +using System.Linq;
     1.9 +using System.Runtime.InteropServices;
    1.10 +using System.Runtime.Serialization;
    1.11 +using System.Text;
    1.12 +using System.Threading.Tasks;
    1.13 +
    1.14 +namespace SharpDisplayManager
    1.15 +{
    1.16 +    [DataContract]
    1.17 +    [AttributeAction(Id = "Cec.Device.PowerOn", Name = "CEC Device Power On", Description = "Turns on the specified CEC device on your HDMI bus.")]
    1.18 +    public class ActionCecDevicePowerOn : ActionCecDevice
    1.19 +    {
    1.20 +        /// <summary>
    1.21 +        /// 
    1.22 +        /// </summary>
    1.23 +        /// <returns></returns>
    1.24 +        public override string Brief()
    1.25 +        {
    1.26 +            return "CEC Power On " + Device.ToString();
    1.27 +        }
    1.28 +
    1.29 +        /// <summary>
    1.30 +        /// 
    1.31 +        /// </summary>
    1.32 +        public override void Execute()
    1.33 +        {
    1.34 +            if (Cec.Client.Static == null)
    1.35 +            {
    1.36 +                Console.WriteLine("WARNING: No CEC client installed.");
    1.37 +                return;
    1.38 +            }
    1.39 +
    1.40 +            Cec.Client.Static.Lib.PowerOnDevices(Device);
    1.41 +        }
    1.42 +    }
    1.43 +}