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

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

The 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.GetChannelValueResult;
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_GetChannelValueResult", date = "2024-09-06T08:44:37.704Z[Etc/UTC]")
@lombok.NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
public class GetChannelValueResultDecoder implements pl.grzeslowski.jsupla.protocol.api.decoders.sc.ServerClientDecoder {
	public static final GetChannelValueResultDecoder INSTANCE = new GetChannelValueResultDecoder();

    @Override
	public GetChannelValueResult decode(byte[] bytes, int offset) {
		val resultCode = PrimitiveDecoder.INSTANCE.parseUnsignedByte(bytes, offset);
		offset += BYTE_SIZE;

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

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

		val value = pl.grzeslowski.jsupla.protocol.api.decoders.TSuplaChannelValueBDecoder.INSTANCE.decode(bytes, offset);
		offset += value.size();

		val extendedValue = pl.grzeslowski.jsupla.protocol.api.decoders.SuplaChannelExtendedValueDecoder.INSTANCE.decode(bytes, offset);
		offset += extendedValue.size();
		
	    return new GetChannelValueResult(resultCode, channelId, function, value, extendedValue);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy