Server/Actions/ActionCecActiveSource.cs
author StephaneLenclud
Tue, 30 Aug 2016 21:14:18 +0200
changeset 261 e2729a990e8b
parent 253 2dae7a163fff
child 264 4a08e1b7ba64
permissions -rw-r--r--
Published v1.2.1.0
Support for Event Trigger through SharpLibDisplay.
StephaneLenclud@214
     1
using CecSharp;
StephaneLenclud@214
     2
using SharpLib.Ear;
StephaneLenclud@214
     3
using System;
StephaneLenclud@214
     4
using System.Collections.Generic;
StephaneLenclud@253
     5
using System.Diagnostics;
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@231
    14
    [AttributeObject(Id = "Cec.ActiveSource", Name = "CEC Active Source", Description = "Set this CEC device as active source.")]
StephaneLenclud@222
    15
    class ActionCecActiveSource : ActionCecDeviceType
StephaneLenclud@214
    16
    {
StephaneLenclud@222
    17
        /// <summary>
StephaneLenclud@222
    18
        /// Build a user readable string to describe this action.
StephaneLenclud@222
    19
        /// </summary>
StephaneLenclud@222
    20
        /// <returns></returns>
StephaneLenclud@222
    21
        public override string Brief()
StephaneLenclud@222
    22
        {
StephaneLenclud@222
    23
            return "CEC Active Source to " + DeviceType.ToString();
StephaneLenclud@222
    24
        }
StephaneLenclud@222
    25
StephaneLenclud@222
    26
        /// <summary>
StephaneLenclud@222
    27
        /// Set the defined device type as active source.
StephaneLenclud@222
    28
        /// </summary>
StephaneLenclud@258
    29
        protected override async Task DoExecute()
StephaneLenclud@214
    30
        {
StephaneLenclud@214
    31
            if (Cec.Client.Static == null)
StephaneLenclud@214
    32
            {
StephaneLenclud@253
    33
                Trace.WriteLine("WARNING: No CEC client installed.");
StephaneLenclud@222
    34
                return;
StephaneLenclud@214
    35
            }
StephaneLenclud@214
    36
StephaneLenclud@222
    37
            Cec.Client.Static.Lib.SetActiveSource(DeviceType);
StephaneLenclud@214
    38
        }
StephaneLenclud@214
    39
    }
StephaneLenclud@214
    40
}