pl.grzeslowski.jsupla.protocol.api.encoders.ThermostatTemperatureCfgEncoder Maven / Gradle / Ivy
package pl.grzeslowski.jsupla.protocol.api.encoders;
import lombok.val;
import pl.grzeslowski.jsupla.protocol.api.encoders.PrimitiveEncoder;
import pl.grzeslowski.jsupla.protocol.api.structs.ThermostatTemperatureCfg;
import static pl.grzeslowski.jsupla.protocol.api.JavaConsts.*;
import static pl.grzeslowski.jsupla.protocol.api.consts.ProtoConsts.*;
@javax.annotation.Generated(value="Struct original name: TThermostatTemperatureCfg", date = "2024-08-03T11:49:42.120Z[Etc/UTC]")
@lombok.NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
public class ThermostatTemperatureCfgEncoder implements pl.grzeslowski.jsupla.protocol.api.encoders.ProtoWithSizeEncoder {
public static final ThermostatTemperatureCfgEncoder INSTANCE = new ThermostatTemperatureCfgEncoder();
@Override
public byte[] encode(ThermostatTemperatureCfg proto) {
final byte[] bytes = new byte[proto.size()];
int offset = 0;
offset += PrimitiveEncoder.INSTANCE.writeShort(proto.index, bytes, offset);
offset += PrimitiveEncoder.INSTANCE.writeUnsignedShortArray(proto.temperature, bytes, offset);
return bytes;
}
}