public override LightCommand GetLightCommand(IDictionary<string, string> values, PhilipsHueDevice bulb) { string hexColor; if (!values.TryGetValue("Color", out hexColor)) { throw new ArgumentException("Color"); } // TODO: http://www.developers.meethue.com/documentation/color-conversions-rgb-xy var rgb = new RGBColor(hexColor); var xy = RgbToCieConverter.Convert(bulb.Model, rgb.R, rgb.G, rgb.B); if (Equals(xy, default(RgbToCieConverter.CieResult))) { return new LightCommand(); } var command = new LightCommand { On = true, ColorCoordinates = new[] {xy.X, xy.Y} }; TimeSpan transitionTime; if (TryGetTransitionTime(values, out transitionTime)) { command.TransitionTime = transitionTime; } return command; }
public override LightCommand GetLightCommand(IDictionary<string, string> values, PhilipsHueDevice bulb) { return new LightCommand { Alert = Alert.Once }; }
public override LightCommand GetLightCommand(IDictionary<string, string> values, PhilipsHueDevice bulb) { int temperature; if (!TryGetTemperature(values, out temperature)) { throw new ArgumentException("Temperature"); } return new LightCommand { ColorTemperature = temperature }; }
public override LightCommand GetLightCommand(IDictionary<string, string> values, PhilipsHueDevice bulb) { var command = new LightCommand { On = true }; TimeSpan transitionTime; if (TryGetTransitionTime(values, out transitionTime)) { command.TransitionTime = transitionTime; } return command; }
public override LightCommand GetLightCommand(IDictionary<string, string> values, PhilipsHueDevice bulb) { byte brightness; if (!TryGetBrightness(values, out brightness)) { throw new ArgumentException("Brightness"); } var command = new LightCommand { Brightness = brightness, On = true }; TimeSpan transitionTime; if (TryGetTransitionTime(values, out transitionTime)) { command.TransitionTime = transitionTime; } return command; }
public override LightCommand GetLightCommand(IDictionary <string, string> values, PhilipsHueDevice bulb) { string hexColor; if (!values.TryGetValue("Color", out hexColor)) { throw new ArgumentException("Color"); } // TODO: http://www.developers.meethue.com/documentation/color-conversions-rgb-xy var rgb = new RGBColor(hexColor); var xy = RgbToCieConverter.Convert(bulb.Model, rgb.R, rgb.G, rgb.B); if (Equals(xy, default(RgbToCieConverter.CieResult))) { return(new LightCommand()); } var command = new LightCommand { On = true, ColorCoordinates = new[] { xy.X, xy.Y } }; TimeSpan transitionTime; if (TryGetTransitionTime(values, out transitionTime)) { command.TransitionTime = transitionTime; } return(command); }
public abstract LightCommand GetLightCommand(IDictionary<string, string> values, PhilipsHueDevice bulb);
public override LightCommand GetLightCommand(IDictionary <string, string> values, PhilipsHueDevice bulb) { byte brightness; if (!TryGetBrightness(values, out brightness)) { throw new ArgumentException("Brightness"); } var command = new LightCommand { Brightness = brightness, On = true }; TimeSpan transitionTime; if (TryGetTransitionTime(values, out transitionTime)) { command.TransitionTime = transitionTime; } return(command); }
public override LightCommand GetLightCommand(IDictionary <string, string> values, PhilipsHueDevice bulb) { var command = new LightCommand { On = false }; TimeSpan transitionTime; if (TryGetTransitionTime(values, out transitionTime)) { command.TransitionTime = transitionTime; } return(command); }
public abstract LightCommand GetLightCommand(IDictionary <string, string> values, PhilipsHueDevice bulb);
public override LightCommand GetLightCommand(IDictionary <string, string> values, PhilipsHueDevice bulb) { return(new LightCommand { Alert = Alert.Multiple }); }
public override LightCommand GetLightCommand(IDictionary <string, string> values, PhilipsHueDevice bulb) { int temperature; if (!TryGetTemperature(values, out temperature)) { throw new ArgumentException("Temperature"); } return(new LightCommand { ColorTemperature = temperature }); }