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

import java.nio.ByteOrder;

/**
 * 화상이미지 요구
 */
public class VdsReqImage extends VdsReqFramePacket {

    public VdsReqImage(short groupNo, short controllerNo) {
        super(groupNo, controllerNo, VdsProtocol.vds_Image);
        this.body = new byte[3];
        setFrameNo(0);
        setCameraNo(1);
    }

    public void setFrameNo(int frameNo) {
        short frameNo1 = (short) frameNo;
        this.body[0] = (byte)((frameNo1 & 0xFF00) >> 8);
        this.body[1] = (byte)((frameNo1 & 0x00FF));
        if (VdsProtocol.byteOrder == ByteOrder.LITTLE_ENDIAN) {
            this.body[1] = (byte)((frameNo1 >> 8 ) & 0xFF);
            this.body[0] = (byte)((frameNo1) & 0xFF);
        }
    }
    public void setCameraNo(int cameraNo) {
        // 제어기에 연결된 카메라 번호(1~255)
        byte cameraNo1 = (byte) (cameraNo & 0xFF);
        this.body[2] = cameraNo1;
    }
}
