/// <summary> /// Requests the device to switch some or all leds to a specific color. /// </summary> /// <param name="target">Specify which leds should be switched</param> /// <param name="color">Specify the color to which leds should be switched</param> /// <param name="fadeInTime">Abstract duration for the fading effect. The higher, the longer it will take to switch to the color. Null to switch instantaneously</param> /// <param name="timeout">Time, in milliseconds, after which the application should stop waiting for the acknowledgment of this message</param> /// <returns>Task representing the operation. Result is true if the message has been acknowledged, false otherwise</returns> public Task <bool> SetColor(LedTarget target, Color color, byte?fadeInTime = null, int timeout = 0) { var command = fadeInTime.HasValue ? (ICommand) new FadeToCommand(target, color, fadeInTime.Value) : (ICommand) new JumpToCommand(target, color); return(SendCommand(command, timeout)); }
internal LedPort(IDevice device, LedTarget target) { this.device = device; this.target = target; }
/// <summary> /// Requests the device to blink with a specific color. /// </summary> /// <param name="target">Specify which leds should blink</param> /// <param name="color">Specify the color to which leds should blink</param> /// <param name="speed">Abstract duration for the fading effect. The higher, the longer each blink will take.</param> /// <param name="repeatCount">Number of time the blink should be repeated</param> /// <param name="timeout">Time, in milliseconds, after which the application should stop waiting for the acknowledgment of this message</param> /// <returns>Task representing the operation. Result is true if the message has been acknowledged, false otherwise</returns> public Task <bool> Blink(LedTarget target, Color color, byte speed, byte repeatCount = 0, int timeout = 0) { var command = new BlinkCommand(target, color, speed, repeatCount); return(SendCommand(command, timeout)); }
/// <summary> /// Sub-part of the device able to receive commands that target a specific led. /// </summary> /// <param name="index">Index of the led. Should be between 1 and 6</param> /// <returns>The sub-device for the requested led</returns> public IPort this [byte index] { get { return(new LedPort(this, LedTarget.OfIndex(index))); } }