package com.its.vds.xnettcp.vds.protocol.impl;

import com.its.vds.dto.TbVdsCtlrDto;
import com.its.vds.xnettcp.vds.protocol.VdsFramePacket;
import com.its.vds.xnettcp.vds.protocol.VdsReqFramePacket;
import com.its.vds.xnettcp.vds.protocol.enums.eVdsOpCode;
import com.its.vds.xnettcp.vds.protocol.impl.andong.VdsAndongReqFramePacket;
import lombok.extern.slf4j.Slf4j;

import java.nio.ByteBuffer;

/**
 * VDS Synchronization 요청(응답없음)
 */
@Slf4j
public class VdsReqSynchronization extends VdsReqFramePacket {

    private final VdsFramePacket framePacket;

    public VdsReqSynchronization(TbVdsCtlrDto vdsObj) {
        this.opCode = eVdsOpCode.OP_VDS_SYNCHRONIZATION;
        byte opCode = (byte)this.opCode.getValue();
        this.packetNmbr = vdsObj.getPacketNmbrSynchronize();
        this.framePacket = new VdsAndongReqFramePacket(0xFFFF, 0xFFFF, this.packetNmbr, opCode);
    }

    @Override
    public ByteBuffer getByteBuffer() {
        return this.framePacket.getByteBuffer();
    }

}
