pl.grzeslowski.jsupla.protocol.api.decoders.RGBWValueDecoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of protocol Show documentation
Show all versions of protocol Show documentation
Uploads all artifacts belonging to configuration ':protocol:archives'
The newest version!
package pl.grzeslowski.jsupla.protocol.api.decoders;
import lombok.val;
import pl.grzeslowski.jsupla.protocol.api.decoders.PrimitiveDecoder;
import pl.grzeslowski.jsupla.protocol.api.structs.RGBWValue;
import static pl.grzeslowski.jsupla.protocol.api.JavaConsts.*;
import static pl.grzeslowski.jsupla.protocol.api.consts.ProtoConsts.*;
@javax.annotation.Generated(value="Struct original name: TRGBW_Value", date = "2024-09-06T08:44:37.698Z[Etc/UTC]")
@lombok.NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
public class RGBWValueDecoder implements pl.grzeslowski.jsupla.protocol.api.decoders.ProtoWithSizeDecoder {
public static final RGBWValueDecoder INSTANCE = new RGBWValueDecoder();
@Override
public RGBWValue decode(byte[] bytes, int offset) {
val brightness = PrimitiveDecoder.INSTANCE.parseByte(bytes, offset);
offset += BYTE_SIZE;
val colorBrightness = PrimitiveDecoder.INSTANCE.parseByte(bytes, offset);
offset += BYTE_SIZE;
val b = PrimitiveDecoder.INSTANCE.parseByte(bytes, offset);
offset += BYTE_SIZE;
val g = PrimitiveDecoder.INSTANCE.parseByte(bytes, offset);
offset += BYTE_SIZE;
val r = PrimitiveDecoder.INSTANCE.parseByte(bytes, offset);
offset += BYTE_SIZE;
val onOff = PrimitiveDecoder.INSTANCE.parseByte(bytes, offset);
offset += BYTE_SIZE;
val command = PrimitiveDecoder.INSTANCE.parseByte(bytes, offset);
offset += BYTE_SIZE;
return new RGBWValue(brightness, colorBrightness, b, g, r, onOff, command);
}
}