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

pl.grzeslowski.jsupla.protocol.api.decoders.sc.SuplaChannelGroupDecoder Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
package pl.grzeslowski.jsupla.protocol.api.decoders.sc;

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

@javax.annotation.Generated(value="Struct original name: TSC_SuplaChannelGroup", date = "2024-07-06T18:57:04.512Z[Etc/UTC]")
@lombok.NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
public class SuplaChannelGroupDecoder implements pl.grzeslowski.jsupla.protocol.api.decoders.sc.ServerClientDecoder {
	public static final SuplaChannelGroupDecoder INSTANCE = new SuplaChannelGroupDecoder();

    @Override
	public SuplaChannelGroup decode(byte[] bytes, int offset) {
		val eOL = PrimitiveDecoder.INSTANCE.parseByte(bytes, offset);
		offset += BYTE_SIZE;

		val id = PrimitiveDecoder.INSTANCE.parseInt(bytes, offset);
		offset += INT_SIZE;

		val locationId = PrimitiveDecoder.INSTANCE.parseInt(bytes, offset);
		offset += INT_SIZE;

		val func = PrimitiveDecoder.INSTANCE.parseInt(bytes, offset);
		offset += INT_SIZE;

		val altIcon = PrimitiveDecoder.INSTANCE.parseInt(bytes, offset);
		offset += INT_SIZE;

		val flags = PrimitiveDecoder.INSTANCE.parseUnsignedInt(bytes, offset);
		offset += INT_SIZE;

		val captionSize = PrimitiveDecoder.INSTANCE.parseUnsignedInt(bytes, offset);
		offset += INT_SIZE;

		val caption = PrimitiveDecoder.INSTANCE.copyOfRangeByte(bytes, offset, offset + (int) captionSize);
		offset += captionSize * BYTE_SIZE;
		
	    return new SuplaChannelGroup(eOL, id, locationId, func, altIcon, flags, captionSize, caption);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy