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

pl.grzeslowski.jsupla.protocol.api.decoders.cs.SuplaNewValueDecoder Maven / Gradle / Ivy

The newest version!
package pl.grzeslowski.jsupla.protocol.api.decoders.cs;

import lombok.val;
import pl.grzeslowski.jsupla.protocol.api.decoders.PrimitiveDecoder;
import pl.grzeslowski.jsupla.protocol.api.structs.cs.SuplaNewValue;
import static pl.grzeslowski.jsupla.protocol.api.JavaConsts.*;
import static pl.grzeslowski.jsupla.protocol.api.consts.ProtoConsts.*;

@javax.annotation.Generated(value="Struct original name: TCS_SuplaNewValue", date = "2024-09-06T08:44:37.651Z[Etc/UTC]")
@lombok.NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
public class SuplaNewValueDecoder implements pl.grzeslowski.jsupla.protocol.api.decoders.cs.ClientServerDecoder {
	public static final SuplaNewValueDecoder INSTANCE = new SuplaNewValueDecoder();

    @Override
	public SuplaNewValue decode(byte[] bytes, int offset) {
		val id = PrimitiveDecoder.INSTANCE.parseInt(bytes, offset);
		offset += INT_SIZE;

		val target = PrimitiveDecoder.INSTANCE.parseByte(bytes, offset);
		offset += BYTE_SIZE;

		val value = PrimitiveDecoder.INSTANCE.copyOfRangeByte(bytes, offset, offset + (int) SUPLA_CHANNELVALUE_SIZE);
		offset += SUPLA_CHANNELVALUE_SIZE * BYTE_SIZE;
		
	    return new SuplaNewValue(id, target, value);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy