Server/Actions/ActionCecSendKeypressTvPowerOn.cs
author StephaneLenclud
Sun, 24 Jul 2016 20:36:07 +0200
changeset 214 4961ede27e0a
permissions -rw-r--r--
Adding a bunch of CEC actions.
     1 
     2 using CecSharp;
     3 using SharpLib.Ear;
     4 using System;
     5 using System.Collections.Generic;
     6 using System.Linq;
     7 using System.Runtime.Serialization;
     8 using System.Text;
     9 using System.Threading.Tasks;
    10 
    11 namespace SharpDisplayManager
    12 {
    13     [DataContract]
    14     [AttributeAction(Id = "Cec.SendKepressTvPowerOn", Name = "CEC Send Keypress TV Power On", Description = "Send Power On keypress to your TV.")]
    15     class ActionCecSendKeypressTvPowerOn : SharpLib.Ear.Action
    16     {
    17         public override void Execute()
    18         {
    19             if (Cec.Client.Static == null)
    20             {
    21                 Console.WriteLine("WARNING: No CEC client installed.");
    22             }
    23 
    24             Cec.Client.Static.Lib.SendKeypress(CecLogicalAddress.Tv, CecUserControlCode.PowerOnFunction, true);
    25         }
    26     }
    27 }