pl.grzeslowski.jsupla.protocol.api.decoders.ChannelConfigOCRDecoder 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.decoders;
import lombok.val;
import pl.grzeslowski.jsupla.protocol.api.decoders.PrimitiveDecoder;
import pl.grzeslowski.jsupla.protocol.api.structs.ChannelConfigOCR;
import static pl.grzeslowski.jsupla.protocol.api.JavaConsts.*;
import static pl.grzeslowski.jsupla.protocol.api.consts.ProtoConsts.*;
@javax.annotation.Generated(value="Struct original name: TChannelConfig_OCR", date = "2024-09-06T08:44:37.664Z[Etc/UTC]")
@lombok.NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
public class ChannelConfigOCRDecoder implements pl.grzeslowski.jsupla.protocol.api.decoders.ProtoWithSizeDecoder {
public static final ChannelConfigOCRDecoder INSTANCE = new ChannelConfigOCRDecoder();
@Override
public ChannelConfigOCR decode(byte[] bytes, int offset) {
val authKey = PrimitiveDecoder.INSTANCE.copyOfRangeByte(bytes, offset, offset + (int) SUPLA_OCR_AUTHKEY_SIZE);
offset += SUPLA_OCR_AUTHKEY_SIZE * BYTE_SIZE;
val host = PrimitiveDecoder.INSTANCE.copyOfRangeByte(bytes, offset, offset + (int) SUPLA_URL_HOST_MAXSIZE);
offset += SUPLA_URL_HOST_MAXSIZE * BYTE_SIZE;
val photoIntervalSec = PrimitiveDecoder.INSTANCE.parseUnsignedInt(bytes, offset);
offset += INT_SIZE;
val lightingMode = PrimitiveDecoder.INSTANCE.parseUnsignedLong(bytes, offset);
offset += LONG_SIZE;
val lightingLevel = PrimitiveDecoder.INSTANCE.parseUnsignedByte(bytes, offset);
offset += BYTE_SIZE;
val maximumIncrement = PrimitiveDecoder.INSTANCE.parseUnsignedLong(bytes, offset);
offset += LONG_SIZE;
val availableLightingModes = PrimitiveDecoder.INSTANCE.parseUnsignedLong(bytes, offset);
offset += LONG_SIZE;
val reserved = PrimitiveDecoder.INSTANCE.copyOfRangeByteUnsigned(bytes, offset, offset + (int) 128);
offset += 128 * BYTE_SIZE;
return new ChannelConfigOCR(authKey, host, photoIntervalSec, lightingMode, lightingLevel, maximumIncrement, availableLightingModes, reserved);
}
}