All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.grzeslowski.jsupla.protocol.api.encoders.ThermostatTimeEncoder Maven / Gradle / Ivy

The newest version!
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.ThermostatTime;
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_Time", date = "2024-09-06T08:44:37.937Z[Etc/UTC]")
@lombok.NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
public class ThermostatTimeEncoder implements pl.grzeslowski.jsupla.protocol.api.encoders.ProtoWithSizeEncoder {
	public static final ThermostatTimeEncoder INSTANCE = new ThermostatTimeEncoder();

   @Override
	public byte[] encode(ThermostatTime proto) {
final byte[] bytes = new byte[proto.size()];
int offset = 0;

		offset += PrimitiveEncoder.INSTANCE.writeUnsignedByte(proto.sec, bytes, offset);
		offset += PrimitiveEncoder.INSTANCE.writeUnsignedByte(proto.min, bytes, offset);
		offset += PrimitiveEncoder.INSTANCE.writeUnsignedByte(proto.hour, bytes, offset);
		offset += PrimitiveEncoder.INSTANCE.writeUnsignedByte(proto.dayOfWeek, bytes, offset);
		
	    return bytes;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy