pl.grzeslowski.jsupla.protocol.api.encoders.ThermostatScheduleCfgEncoder 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.ThermostatScheduleCfg;
import static pl.grzeslowski.jsupla.protocol.api.JavaConsts.*;
import static pl.grzeslowski.jsupla.protocol.api.consts.ProtoConsts.*;
@javax.annotation.Generated(value="Struct original name: TThermostat_ScheduleCfg", date = "2024-08-03T11:49:42.123Z[Etc/UTC]")
@lombok.NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
public class ThermostatScheduleCfgEncoder implements pl.grzeslowski.jsupla.protocol.api.encoders.ProtoWithSizeEncoder {
public static final ThermostatScheduleCfgEncoder INSTANCE = new ThermostatScheduleCfgEncoder();
@Override
public byte[] encode(ThermostatScheduleCfg proto) {
final byte[] bytes = new byte[proto.size()];
int offset = 0;
for (val element : proto.group) {
byte[] groupBytes = pl.grzeslowski.jsupla.protocol.api.encoders.ThermostatValueGroupEncoder.INSTANCE.encode(element);
offset += groupBytes.length;
}
return bytes;
}
}