pl.grzeslowski.jsupla.protocol.api.encoders.sd.FirmwareUpdateUrlEncoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of protocol Show documentation
Show all versions of protocol Show documentation
Uploads all artifacts belonging to configuration ':protocol:archives'
The newest version!
package pl.grzeslowski.jsupla.protocol.api.encoders.sd;
import lombok.val;
import pl.grzeslowski.jsupla.protocol.api.encoders.PrimitiveEncoder;
import pl.grzeslowski.jsupla.protocol.api.structs.sd.FirmwareUpdateUrl;
import static pl.grzeslowski.jsupla.protocol.api.JavaConsts.*;
import static pl.grzeslowski.jsupla.protocol.api.consts.ProtoConsts.*;
@javax.annotation.Generated(value="Struct original name: TSD_FirmwareUpdate_Url", date = "2024-09-06T08:44:37.930Z[Etc/UTC]")
@lombok.NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
public class FirmwareUpdateUrlEncoder implements pl.grzeslowski.jsupla.protocol.api.encoders.sd.ServerDeviceEncoder {
public static final FirmwareUpdateUrlEncoder INSTANCE = new FirmwareUpdateUrlEncoder();
@Override
public byte[] encode(FirmwareUpdateUrl proto) {
final byte[] bytes = new byte[proto.size()];
int offset = 0;
offset += PrimitiveEncoder.INSTANCE.writeByte(proto.availableProtocols, bytes, offset);
offset += PrimitiveEncoder.INSTANCE.writeByteArray(proto.host, bytes, offset);
offset += PrimitiveEncoder.INSTANCE.writeInt(proto.port, bytes, offset);
offset += PrimitiveEncoder.INSTANCE.writeByteArray(proto.path, bytes, offset);
return bytes;
}
}