Пример #1
0
 public static void CreateUpdateFadeValueSetting(Stream stream, byte fadeValue, FadingAction action)
 {
     stream.WriteByte((byte)(((byte)CommandCodes.UpdateSetting << 4) | ((byte)SettingValue.FadeValue)));
     stream.WriteByte(fadeValue);
     stream.WriteByte((byte)((byte)action << 6));
 }
Пример #2
0
        public static int DecodeUpdateFadeValueSetting(byte[] buffer, int offset, out byte fadeValue, out FadingAction action)
        {
            System.Diagnostics.Debug.Assert((CommandCodes)(buffer[offset] >> 4) == CommandCodes.UpdateSetting);
            System.Diagnostics.Debug.Assert((SettingValue)(buffer[offset] & 0xF) == SettingValue.FadeValue);

            fadeValue = buffer[offset + 1];
            action    = (FadingAction)((buffer[offset + 2] >> 6) & 0x3);
            return(3);
        }