private static byte[] CreatePayloadData( Color color, Percentage brightness, Temperature Temperature, Power power, Label label ) { var hueData = HueConverter.ConvertHueToUInt16(color.Hue).GetBytes(); var saturationData = PercentageConverter.ConvertPercentageToUInt16(color.Saturation).GetBytes(); var brightnessData = PercentageConverter.ConvertPercentageToUInt16(brightness).GetBytes(); var temperatureData = ((ushort)Temperature).GetBytes(); var reserved1 = new byte[2]; var powerData = ((ushort)power).GetBytes(); var labelData = Encoding.UTF8.GetBytes(label); var reserved2 = new byte[8]; return(CombineArrays( hueData, saturationData, brightnessData, temperatureData, reserved1, powerData, labelData, reserved2 )); }
public override byte[] GetData() { var reservedData = new byte[1]; var hueData = HueConverter.ConvertHueToUInt16(_color.Hue).GetBytes(); var saturationData = PercentageConverter.ConvertPercentageToUInt16(_color.Saturation).GetBytes(); var brightnessData = PercentageConverter.ConvertPercentageToUInt16(_brightness).GetBytes(); var temperatureData = ((ushort)_temperature).GetBytes(); var durationData = _durationInMilliseconds.GetBytes(); return(CombineArrays(reservedData, hueData, saturationData, brightnessData, temperatureData, durationData)); }