4 using System.Collections.Generic;
6 using System.Runtime.InteropServices;
7 using System.Runtime.Serialization;
9 using System.Threading.Tasks;
11 namespace SharpDisplayManager
14 /// Send a user key press event to the given CEC device.
17 [AttributeObject(Id = "Cec.UserControlPressed", Name = "CEC User Control Pressed", Description = "Send user control code to defined CEC device.")]
18 public class ActionCecUserControlPressed : ActionCecDevice
21 public ActionCecUserControlPressed()
27 [AttributeObjectProperty(
28 Id = "Cec.UserControlPressed.Code",
30 Description = "The key code used by this action."
32 public CecUserControlCode Code { get; set; }
35 [AttributeObjectProperty(
36 Id = "Cec.UserControlPressed.Wait",
38 Description = "Wait for that command."
40 public bool Wait { get; set; }
45 /// <returns></returns>
46 public override string Brief()
48 string brief = Name + ": " + Code.ToString() + " to " + DeviceName;
59 protected override void DoExecute()
61 if (Cec.Client.Static == null)
63 Console.WriteLine("WARNING: No CEC client installed.");
67 Cec.Client.Static.Lib.SendKeypress(Device, Code, Wait);