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

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

There is a newer version: 2.2.0
Show newest version
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.SuplaDeviceChannelValueB;
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_SuplaDeviceChannelValue_B", date = "2024-07-06T18:57:04.643Z[Etc/UTC]")
@lombok.NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
public class SuplaDeviceChannelValueBEncoder implements pl.grzeslowski.jsupla.protocol.api.encoders.ds.DeviceServerEncoder {
	public static final SuplaDeviceChannelValueBEncoder INSTANCE = new SuplaDeviceChannelValueBEncoder();

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

		offset += PrimitiveEncoder.INSTANCE.writeUnsignedByte(proto.channelNumber, bytes, offset);
		offset += PrimitiveEncoder.INSTANCE.writeUnsignedByte(proto.offline, bytes, offset);
		offset += PrimitiveEncoder.INSTANCE.writeByteArray(proto.value, bytes, offset);
		
	    return bytes;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy