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

pl.grzeslowski.jsupla.protocol.api.encoders.ds.SuplaDeviceChannelExtendedValueEncoder Maven / Gradle / Ivy

package pl.grzeslowski.jsupla.protocol.api.encoders.ds;

import lombok.val;
import pl.grzeslowski.jsupla.protocol.api.encoders.PrimitiveEncoder;
import pl.grzeslowski.jsupla.protocol.api.structs.ds.SuplaDeviceChannelExtendedValue;
import static pl.grzeslowski.jsupla.protocol.api.JavaConsts.*;
import static pl.grzeslowski.jsupla.protocol.api.consts.ProtoConsts.*;

@javax.annotation.Generated(value="Struct original name: TDS_SuplaDeviceChannelExtendedValue", date = "2024-08-03T11:49:42.065Z[Etc/UTC]")
@lombok.NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
public class SuplaDeviceChannelExtendedValueEncoder implements pl.grzeslowski.jsupla.protocol.api.encoders.ds.DeviceServerEncoder {
	public static final SuplaDeviceChannelExtendedValueEncoder INSTANCE = new SuplaDeviceChannelExtendedValueEncoder();

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

		offset += PrimitiveEncoder.INSTANCE.writeUnsignedByte(proto.channelNumber, bytes, offset);
		byte[] valueBytes = pl.grzeslowski.jsupla.protocol.api.encoders.SuplaChannelExtendedValueEncoder.INSTANCE.encode(proto.value);
		offset += valueBytes.length;			
		
	    return bytes;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy