Server/Actions/ActionCecDevice.cs
author StephaneLenclud
Fri, 29 Jul 2016 14:46:30 +0200
changeset 229 7c631055b94b
parent 220 e5910d7b6a81
child 231 4c706feaf706
permissions -rw-r--r--
Adding event test button.
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@222
    13
    /// <summary>
StephaneLenclud@222
    14
    /// Abstract CEC action using a device logical address.
StephaneLenclud@222
    15
    /// </summary>
StephaneLenclud@220
    16
    [DataContract]
StephaneLenclud@220
    17
    public abstract class ActionCecDevice: SharpLib.Ear.Action
StephaneLenclud@220
    18
    {
StephaneLenclud@220
    19
        [DataMember]
StephaneLenclud@220
    20
        [AttributeActionProperty
StephaneLenclud@220
    21
            (
StephaneLenclud@220
    22
            Id = "CEC.Device",
StephaneLenclud@220
    23
            Name = "Device",
StephaneLenclud@220
    24
            Description = "The logical address used by this action."
StephaneLenclud@220
    25
            )
StephaneLenclud@220
    26
        ]
StephaneLenclud@220
    27
        public CecLogicalAddress Device { get; set; }
StephaneLenclud@222
    28
StephaneLenclud@222
    29
        /// <summary>
StephaneLenclud@222
    30
        /// 
StephaneLenclud@222
    31
        /// </summary>
StephaneLenclud@222
    32
        public string DeviceName {
StephaneLenclud@222
    33
            get
StephaneLenclud@222
    34
            {
StephaneLenclud@222
    35
                if (Device == CecLogicalAddress.Broadcast)
StephaneLenclud@222
    36
                {
StephaneLenclud@222
    37
                    //Because of duplicate value in enumeration
StephaneLenclud@222
    38
                    return "Broadcast";
StephaneLenclud@222
    39
                }
StephaneLenclud@222
    40
StephaneLenclud@222
    41
                return Device.ToString();
StephaneLenclud@222
    42
            }
StephaneLenclud@222
    43
        }
StephaneLenclud@222
    44
StephaneLenclud@220
    45
    }
StephaneLenclud@220
    46
}