Server/Actions/ActionCecDeviceStandby.cs
author StephaneLenclud
Thu, 18 Aug 2016 14:35:50 +0200
changeset 238 c92587ddabcd
parent 228 6a84d8282226
child 253 2dae7a163fff
permissions -rw-r--r--
Support for launch action and WMC HID events.
StephaneLenclud@220
     1
using CecSharp;
StephaneLenclud@220
     2
using SharpLib.Ear;
StephaneLenclud@220
     3
using System;
StephaneLenclud@220
     4
using System.Collections.Generic;
StephaneLenclud@220
     5
using System.Linq;
StephaneLenclud@220
     6
using System.Runtime.InteropServices;
StephaneLenclud@220
     7
using System.Runtime.Serialization;
StephaneLenclud@220
     8
using System.Text;
StephaneLenclud@220
     9
using System.Threading.Tasks;
StephaneLenclud@220
    10
StephaneLenclud@220
    11
namespace SharpDisplayManager
StephaneLenclud@220
    12
{
StephaneLenclud@220
    13
    [DataContract]
StephaneLenclud@231
    14
    [AttributeObject(Id = "Cec.Device.Standby", Name = "CEC Device Standby", Description = "Puts on standby the specified CEC device on your HDMI bus.")]
StephaneLenclud@220
    15
    public class ActionCecDeviceStandby : ActionCecDevice
StephaneLenclud@220
    16
    {
StephaneLenclud@220
    17
        /// <summary>
StephaneLenclud@222
    18
        /// Build a user readable string to describe this action.
StephaneLenclud@220
    19
        /// </summary>
StephaneLenclud@220
    20
        /// <returns></returns>
StephaneLenclud@220
    21
        public override string Brief()
StephaneLenclud@220
    22
        {
StephaneLenclud@222
    23
            return "CEC Standby " + DeviceName;
StephaneLenclud@220
    24
        }
StephaneLenclud@220
    25
StephaneLenclud@220
    26
        /// <summary>
StephaneLenclud@220
    27
        /// 
StephaneLenclud@220
    28
        /// </summary>
StephaneLenclud@228
    29
        protected override void DoExecute()
StephaneLenclud@220
    30
        {
StephaneLenclud@220
    31
            if (Cec.Client.Static == null)
StephaneLenclud@220
    32
            {
StephaneLenclud@220
    33
                Console.WriteLine("WARNING: No CEC client installed.");
StephaneLenclud@220
    34
                return;
StephaneLenclud@220
    35
            }
StephaneLenclud@220
    36
StephaneLenclud@220
    37
            Cec.Client.Static.Lib.StandbyDevices(Device);
StephaneLenclud@220
    38
        }
StephaneLenclud@220
    39
StephaneLenclud@220
    40
    }
StephaneLenclud@220
    41
}