package com.its.pis.xnetudp.protocol;

import com.its.app.utils.SysUtils;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class CENTER_VDS_REQ_COMMON {

	private String cmdTime;
	private String operId;
	private String vdsCtlrNmbr;
	private byte[] body;

	public CENTER_VDS_REQ_COMMON(byte buffer[]) {
		ByteBuffer byteBuffer = ByteBuffer.wrap(buffer);
		byteBuffer.order(ByteOrder.LITTLE_ENDIAN);

		byte[] cmdTime = new byte[CENTER_COMM_DEFINE.INT_VDS_MAX_DATETIME];
		byte[] operId  = new byte[CENTER_COMM_DEFINE.INT_VDS_MAX_OPER_ID];
		int  nmbr;
		
		byteBuffer.get(cmdTime);
		byteBuffer.get(operId);
		nmbr = byteBuffer.getInt();

		this.cmdTime     = new String(cmdTime).trim();
		this.operId      = SysUtils.byteArrayToString(operId);
		this.vdsCtlrNmbr = Integer.toString(nmbr);
		
		if (byteBuffer.remaining() > 0) {
			body = new byte[byteBuffer.remaining()];
			byteBuffer.get(body);
		}
		else {
			body = null;
		}
	}
	public String getCmdTime() {
		return cmdTime;
	}

	public void setCmdTime(String cmdTime) {
		this.cmdTime = cmdTime;
	}

	public String getOperId() {
		return operId;
	}

	public void setOperId(String operId) {
		this.operId = operId;
	}

	public String getVdsCtlrNmbr() {
		return vdsCtlrNmbr;
	}

	public void setVdsCtlrNmbr(String vdsCtlrNmbr) {
		this.vdsCtlrNmbr = vdsCtlrNmbr;
	}
	public byte[] getBody() {
		return body;
	}
	public void setBody(byte[] body) {
		this.body = body;
	}

}
