public void SetPower(BinarySwitchPower power) { var binaryState = TranslatePowerToBinaryState(power); _client.SetBinaryState(new SetBinaryState { BinaryState = binaryState }); }
public void SetPower(BinarySwitchPower power) { switch (power) { case BinarySwitchPower.On: _device.DoCommand("PowerOn"); break; case BinarySwitchPower.Off: _device.DoCommand("PowerOff"); break; } }
public void SetPower(BinarySwitchPower power) { switch (power) { case BinarySwitchPower.On: _device.DoDeviceOperation(_device.BackingObject.PowerOn); break; case BinarySwitchPower.Off: _device.DoDeviceOperation(_device.BackingObject.PowerOff); break; } }
public void SetPower(BinarySwitchPower power) { switch (power) { case BinarySwitchPower.On: _dataEntry.SetValue(true); break; case BinarySwitchPower.Off: _dataEntry.SetValue(false); break; } }
private static string TranslatePowerToBinaryState(BinarySwitchPower power) { switch (power) { case BinarySwitchPower.Off: return "0"; case BinarySwitchPower.On: return "1"; default: throw new ArgumentException("invalid BinarySwitchPower value \"" + power + "\"", "power"); } }
private static string TranslatePowerToBinaryState(BinarySwitchPower power) { switch (power) { case BinarySwitchPower.Off: return("0"); case BinarySwitchPower.On: return("1"); default: throw new ArgumentException("invalid BinarySwitchPower value \"" + power + "\"", "power"); } }
public string Generate(BinarySwitchPower? power, IPower value) { if (power != BinarySwitchPower.On || value == null) { return null; } foreach (var step in _steps) { //TODO: add comparison to IPower interface if (value.Value <= step.Item1.Value) { return step.Item2; } } return null; }
public void Works(string steps, BinarySwitchPower? binaryPower, double wattsPower, string expected) { var generator = new CurrentStateGenerator(); if (!string.IsNullOrEmpty(steps)) { foreach (var step in steps.Split(';').Select(x => x.Split(','))) { var stepValue = double.Parse(step[0]); var stepName = step[1]; generator.AddStep(new WattsPower(stepValue), stepName); } } var actual = generator.Generate(binaryPower, new WattsPower(wattsPower)); Assert.That(actual, Is.EqualTo(expected)); }
public static LightCommand CreateCommand(BinarySwitchPower power) { var result = new LightCommand(); switch (power) { case BinarySwitchPower.On: result.On = true; result.Brightness = byte.MaxValue; break; case BinarySwitchPower.Off: result.On = false; result.Brightness = byte.MinValue; break; default: throw new Exception(); } return(result); }
public static LightCommand CreateCommand(BinarySwitchPower power) { var result = new LightCommand(); switch (power) { case BinarySwitchPower.On: result.On = true; result.Brightness = byte.MaxValue; break; case BinarySwitchPower.Off: result.On = false; result.Brightness = byte.MinValue; break; default: throw new Exception(); } return result; }
public void SetPower(BinarySwitchPower power) { var command = Helpers.CreateCommand(power); _light.SendCommand(command); }
public ReadOnlyBinarySwitchSwitchState(BinarySwitchPower? power) { Power = power; }