4 using System.Collections.Generic;
5 using System.Diagnostics;
7 using System.Runtime.InteropServices;
8 using System.Runtime.Serialization;
10 using System.Threading.Tasks;
12 namespace SharpDisplayManager
15 /// Send a user key press event to the given CEC device.
18 [AttributeObject(Id = "Cec.UserControlPressed", Name = "CEC User Control Pressed", Description = "Send user control code to defined CEC device.")]
19 public class ActionCecUserControlPressed : ActionCecDevice
22 public ActionCecUserControlPressed()
28 [AttributeObjectProperty(
29 Id = "Cec.UserControlPressed.Code",
31 Description = "The key code used by this action."
33 public CecUserControlCode Code { get; set; }
36 [AttributeObjectProperty(
37 Id = "Cec.UserControlPressed.Wait",
39 Description = "Wait for that command."
41 public bool Wait { get; set; }
46 /// <returns></returns>
47 public override string Brief()
49 string brief = Name + ": " + Code.ToString() + " to " + DeviceName;
60 protected override void DoExecute()
62 if (Cec.Client.Static == null)
64 Trace.WriteLine("WARNING: No CEC client installed.");
68 Cec.Client.Static.Lib.SendKeypress(Device, Code, Wait);