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

pl.grzeslowski.jsupla.protocol.api.decoders.TSuplaChannelValueBDecoder Maven / Gradle / Ivy

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.TSuplaChannelValueB;
import static pl.grzeslowski.jsupla.protocol.api.JavaConsts.*;
import static pl.grzeslowski.jsupla.protocol.api.consts.ProtoConsts.*;

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

    @Override
	public TSuplaChannelValueB decode(byte[] bytes, int offset) {
		val value = PrimitiveDecoder.INSTANCE.copyOfRangeByte(bytes, offset, offset + (int) SUPLA_CHANNELVALUE_SIZE);
		offset += SUPLA_CHANNELVALUE_SIZE * BYTE_SIZE;

		val subValue = PrimitiveDecoder.INSTANCE.copyOfRangeByte(bytes, offset, offset + (int) SUPLA_CHANNELVALUE_SIZE);
		offset += SUPLA_CHANNELVALUE_SIZE * BYTE_SIZE;

		val subValueType = PrimitiveDecoder.INSTANCE.parseByte(bytes, offset);
		offset += BYTE_SIZE;
		
	    return new TSuplaChannelValueB(value, subValue, subValueType);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy