Server/Actions/ActionCecDevice.cs
author StephaneLenclud
Thu, 25 Aug 2016 00:42:09 +0200
changeset 253 2dae7a163fff
parent 222 0e8c6c2f4777
permissions -rw-r--r--
Published v1.0.0.0
Updating Harmony library to v0.4.0 for keep alive support.
Improved logs mechanism.
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@231
    20
        [AttributeObjectProperty
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
}