Ejemplo n.º 1
0
        private LightCommand CreateBrightnessCommand(HueBrightness brightness)
        {
            var command = new LightCommand();

            command.Brightness = brightness.ToValue();
            return(command);
        }
Ejemplo n.º 2
0
        public static byte ToValue(this HueBrightness brightness)
        {
            byte brightnessOut;

            switch (brightness)
            {
            case HueBrightness.Minumum:
                brightnessOut = 0x20;
                break;

            case HueBrightness.Low:
                brightnessOut = 0x40;
                break;

            case HueBrightness.Medium:
                brightnessOut = 0x80;
                break;

            case HueBrightness.High:
                brightnessOut = 0xB0;
                break;

            case HueBrightness.Maximum:
                brightnessOut = 0xFF;
                break;

            default:
                brightnessOut = 0xFF;
                break;
            }

            return(brightnessOut);
        }
Ejemplo n.º 3
0
        public async Task SetBrightness(HueBrightness brightness, int index)
        {
            var command = CreateBrightnessCommand(brightness);

            SendCommandAsync(command, index);
        }