pl.grzeslowski.jsupla.protocol.api.decoders.sc.SuplaChannelEDecoder 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'
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.SuplaChannelE;
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_SuplaChannel_E", date = "2024-07-06T18:57:04.522Z[Etc/UTC]")
@lombok.NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
public class SuplaChannelEDecoder implements pl.grzeslowski.jsupla.protocol.api.decoders.sc.ServerClientDecoder {
public static final SuplaChannelEDecoder INSTANCE = new SuplaChannelEDecoder();
@Override
public SuplaChannelE 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 deviceId = PrimitiveDecoder.INSTANCE.parseInt(bytes, offset);
offset += INT_SIZE;
val locationId = PrimitiveDecoder.INSTANCE.parseInt(bytes, offset);
offset += INT_SIZE;
val type = 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 userIcon = PrimitiveDecoder.INSTANCE.parseInt(bytes, offset);
offset += INT_SIZE;
val manufacturerId = PrimitiveDecoder.INSTANCE.parseShort(bytes, offset);
offset += SHORT_SIZE;
val productId = PrimitiveDecoder.INSTANCE.parseShort(bytes, offset);
offset += SHORT_SIZE;
val defaultConfigCRC32 = PrimitiveDecoder.INSTANCE.parseUnsignedInt(bytes, offset);
offset += INT_SIZE;
val flags = PrimitiveDecoder.INSTANCE.parseUnsignedLong(bytes, offset);
offset += LONG_SIZE;
val protocolVersion = PrimitiveDecoder.INSTANCE.parseUnsignedByte(bytes, offset);
offset += BYTE_SIZE;
val online = PrimitiveDecoder.INSTANCE.parseByte(bytes, offset);
offset += BYTE_SIZE;
val value = pl.grzeslowski.jsupla.protocol.api.decoders.TSuplaChannelValueBDecoder.INSTANCE.decode(bytes, offset);
offset += value.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 SuplaChannelE(eOL, id, deviceId, locationId, type, func, altIcon, userIcon, manufacturerId, productId, defaultConfigCRC32, flags, protocolVersion, online, value, captionSize, caption);
}
}