diff -r 77092f415c7c -r 4961ede27e0a Server/Actions/ActionCecSendKeypressTvPowerOff.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Server/Actions/ActionCecSendKeypressTvPowerOff.cs Sun Jul 24 20:36:07 2016 +0200 @@ -0,0 +1,27 @@ + +using CecSharp; +using SharpLib.Ear; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace SharpDisplayManager +{ + [DataContract] + [AttributeAction(Id = "Cec.SendKepressTvPowerOff", Name = "CEC Send Keypress TV Power Off", Description = "Send Power Off keypress to your TV.")] + class ActionCecSendKeypressTvPowerOff : SharpLib.Ear.Action + { + public override void Execute() + { + if (Cec.Client.Static == null) + { + Console.WriteLine("WARNING: No CEC client installed."); + } + + Cec.Client.Static.Lib.SendKeypress(CecLogicalAddress.Tv,CecUserControlCode.PowerOffFunction,true); + } + } +}