Server/Actions/ActionCecSendKeypressTvPowerOff.cs
author StephaneLenclud
Tue, 26 Jul 2016 11:51:50 +0200
changeset 219 99c407831232
permissions -rw-r--r--
Basis for action property edition support.
StephaneLenclud@214
     1

StephaneLenclud@214
     2
using CecSharp;
StephaneLenclud@214
     3
using SharpLib.Ear;
StephaneLenclud@214
     4
using System;
StephaneLenclud@214
     5
using System.Collections.Generic;
StephaneLenclud@214
     6
using System.Linq;
StephaneLenclud@214
     7
using System.Runtime.Serialization;
StephaneLenclud@214
     8
using System.Text;
StephaneLenclud@214
     9
using System.Threading.Tasks;
StephaneLenclud@214
    10
StephaneLenclud@214
    11
namespace SharpDisplayManager
StephaneLenclud@214
    12
{
StephaneLenclud@214
    13
    [DataContract]
StephaneLenclud@214
    14
    [AttributeAction(Id = "Cec.SendKepressTvPowerOff", Name = "CEC Send Keypress TV Power Off", Description = "Send Power Off keypress to your TV.")]
StephaneLenclud@214
    15
    class ActionCecSendKeypressTvPowerOff : SharpLib.Ear.Action
StephaneLenclud@214
    16
    {
StephaneLenclud@214
    17
        public override void Execute()
StephaneLenclud@214
    18
        {
StephaneLenclud@214
    19
            if (Cec.Client.Static == null)
StephaneLenclud@214
    20
            {
StephaneLenclud@214
    21
                Console.WriteLine("WARNING: No CEC client installed.");
StephaneLenclud@214
    22
            }
StephaneLenclud@214
    23
StephaneLenclud@214
    24
            Cec.Client.Static.Lib.SendKeypress(CecLogicalAddress.Tv,CecUserControlCode.PowerOffFunction,true);
StephaneLenclud@214
    25
        }
StephaneLenclud@214
    26
    }
StephaneLenclud@214
    27
}