public async Task <bool> HandleEventAsync(Response response) { var data = (RemoteButtonData)response; var color = RgbLightColors.Red; if (data.PlusPressed) { color = RgbLightColors.Yellow; } else if (data.RedPressed) { color = RgbLightColors.Red; } else if (data.MinusPressed) { color = RgbLightColors.Pink; } if (!data.PlusPressed && !data.MinusPressed && !data.RedPressed) { color = RgbLightColors.None; } var command = new RgbLightCommand(_controller, color); await _controller.ExecuteCommandAsync(command); return(false); }
public async Task <bool> HandleEventAsync(Response response) { var data = (BoostMotorData)response; var color = RgbLightColors.Red; if (data.Speed > 30) { color = RgbLightColors.Green; } else if (data.Speed > 1) { color = RgbLightColors.Purple; } var command = new RgbLightCommand(_controller, color); await _controller.ExecuteCommandAsync(command); return(false); }
public async Task <bool> HandleEventAsync(Response response) { var data = (ButtonStateMessage)response; var color = RgbLightColors.Red; if (data.State == ButtonState.Pressed) { color = RgbLightColors.Yellow; } else if (data.State == ButtonState.Released) { color = RgbLightColors.Purple; } var command = new RgbLightCommand(_controller, color); await _controller.ExecuteCommandAsync(command); return(false); }