Server/Actions/ActionCecDeviceStandby.cs
author StephaneLenclud
Tue, 26 Jul 2016 15:30:46 +0200
changeset 221 5770478e1fe3
parent 220 e5910d7b6a81
child 222 0e8c6c2f4777
permissions -rw-r--r--
Improved support for action enum properties.
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@220
    14
    [AttributeAction(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@220
    18
        /// 
StephaneLenclud@220
    19
        /// </summary>
StephaneLenclud@220
    20
        /// <returns></returns>
StephaneLenclud@220
    21
        public override string Brief()
StephaneLenclud@220
    22
        {
StephaneLenclud@221
    23
            if (Device == CecLogicalAddress.Broadcast)
StephaneLenclud@221
    24
            {
StephaneLenclud@221
    25
                //Because of duplicated values it would display Unregistered
StephaneLenclud@221
    26
                return "CEC Standby Broadcast";
StephaneLenclud@221
    27
            }
StephaneLenclud@221
    28
StephaneLenclud@220
    29
            return "CEC Standby " + Device.ToString();
StephaneLenclud@220
    30
        }
StephaneLenclud@220
    31
StephaneLenclud@220
    32
        /// <summary>
StephaneLenclud@220
    33
        /// 
StephaneLenclud@220
    34
        /// </summary>
StephaneLenclud@220
    35
        public override void Execute()
StephaneLenclud@220
    36
        {
StephaneLenclud@220
    37
            if (Cec.Client.Static == null)
StephaneLenclud@220
    38
            {
StephaneLenclud@220
    39
                Console.WriteLine("WARNING: No CEC client installed.");
StephaneLenclud@220
    40
                return;
StephaneLenclud@220
    41
            }
StephaneLenclud@220
    42
StephaneLenclud@220
    43
            Cec.Client.Static.Lib.StandbyDevices(Device);
StephaneLenclud@220
    44
        }
StephaneLenclud@220
    45
StephaneLenclud@220
    46
    }
StephaneLenclud@220
    47
}