package gmt.common.vo;

import gmt.common.util.GmtUtils;

import java.time.LocalDateTime;

public class MonitorInfoVO {
	private boolean isConnected;
	private boolean checkRecvDT;
	private int disConnInterval;
	private int recvCount;
	private int recvMonitorCount;
	private int recvByteSize;
	private int recvMonitorByteSize;
	private LocalDateTime lastRecvDT;
	private int sendCount;
	private int sendMonitorCount;
	private int sendByteSize;
	private int sendMonitorByteSize;
	private LocalDateTime lastSendDT;
	private LocalDateTime refreshDT;
	private int sendQCount;
	private int sendQBufferCount;
	private int recvQCount;
	private int serialBuffer;
	private int lastSequence;
	private int Tag;
	
	public MonitorInfoVO() {
		this.recvCount = 0;
		this.recvMonitorCount = 0;
		this.recvByteSize = 0;
		this.recvMonitorByteSize = 0;
		this.lastRecvDT = GmtUtils.defaultTime();
		this.sendCount = 0;
		this.sendMonitorCount = 0;
		this.sendByteSize = 0;
		this.sendMonitorByteSize = 0;
		this.lastSendDT = GmtUtils.defaultTime();
		this.refreshDT = LocalDateTime.now();
		this.sendQCount = 0;
		this.sendQBufferCount = 100000;
		this.lastSequence = 0;
	}
	
	public void increseRecvCount(int value) {
		recvCount = recvCount + value;
	}
	
	public void increseRecvByte(int bytes) {
		recvByteSize = recvByteSize + bytes;
	}
	
	public void increseSendCount(int value) {
		sendCount = sendCount + value;
	}
	
	public void increseSendByte(int bytes) {
		sendByteSize = sendByteSize + bytes;
	}
	
	public void settleUpMonitorInfo() {
		recvMonitorCount    = recvCount;
		recvMonitorByteSize = recvByteSize;
		sendMonitorCount    = sendCount;
		sendMonitorByteSize = sendByteSize;
		
		recvCount    = 0;
		recvByteSize = 0;
		sendCount    = 0;
		sendByteSize = 0;

		refreshDT = LocalDateTime.now();		
	}
	
	public boolean isConnected() {
		return isConnected;
	}
	public void setConnected(boolean isConnected) {
		this.isConnected = isConnected;
	}
	public boolean isCheckRecvDT() {
		return checkRecvDT;
	}
	public void setCheckRecvDT(boolean checkRecvDT) {
		this.checkRecvDT = checkRecvDT;
	}
	public int getDisConnInterval() {
		return disConnInterval;
	}
	public void setDisConnInterval(int disConnInterval) {
		this.disConnInterval = disConnInterval;
	}
	public int getRecvCount() {
		return recvCount;
	}
	public void setRecvCount(int recvCount) {
		this.recvCount = recvCount;
	}
	public int getRecvMonitorCount() {
		return recvMonitorCount;
	}
	public void setRecvMonitorCount(int recvMonitorCount) {
		this.recvMonitorCount = recvMonitorCount;
	}
	public int getRecvByteSize() {
		return recvByteSize;
	}
	public void setRecvByteSize(int recvByteSize) {
		this.recvByteSize = recvByteSize;
	}
	public int getRecvMonitorByteSize() {
		return recvMonitorByteSize;
	}
	public void setRecvMonitorByteSize(int recvMonitorByteSize) {
		this.recvMonitorByteSize = recvMonitorByteSize;
	}
	public LocalDateTime getLastRecvDT() {
		return lastRecvDT;
	}
	public void setLastRecvDT(LocalDateTime lastRecvDT) {
		this.lastRecvDT = lastRecvDT;
	}
	public int getSendCount() {
		return sendCount;
	}
	public void setSendCount(int sendCount) {
		this.sendCount = sendCount;
	}
	public int getSendMonitorCount() {
		return sendMonitorCount;
	}
	public void setSendMonitorCount(int sendMonitorCount) {
		this.sendMonitorCount = sendMonitorCount;
	}
	public int getSendByteSize() {
		return sendByteSize;
	}
	public void setSendByteSize(int sendByteSize) {
		this.sendByteSize = sendByteSize;
	}
	public int getSendMonitorByteSize() {
		return sendMonitorByteSize;
	}
	public void setSendMonitorByteSize(int sendMonitorByteSize) {
		this.sendMonitorByteSize = sendMonitorByteSize;
	}
	public LocalDateTime getLastSendDT() {
		return lastSendDT;
	}
	public void setLastSendDT(LocalDateTime lastSendDT) {
		this.lastSendDT = lastSendDT;
	}
	public LocalDateTime getRefreshDT() {
		return refreshDT;
	}
	public void setRefreshDT(LocalDateTime refreshDT) {
		this.refreshDT = refreshDT;
	}
	public int getSendQCount() {
		return sendQCount;
	}
	public void setSendQCount(int sendQCount) {
		this.sendQCount = sendQCount;
	}
	public int getSendQBufferCount() {
		return sendQBufferCount;
	}
	public void setSendQBufferCount(int sendQBufferCount) {
		this.sendQBufferCount = sendQBufferCount;
	}
	public int getSerialBuffer() {
		return serialBuffer;
	}
	public void setSerialBuffer(int serialBuffer) {
		this.serialBuffer = serialBuffer;
	}
	public int getLastSequence() {
		return lastSequence;
	}
	public void setLastSequence(int lastSequence) {
		this.lastSequence = lastSequence;
	}
	public int getTag() {
		return Tag;
	}
	public void setTag(int tag) {
		Tag = tag;
	}

	public int getRecvQCount() {
		return recvQCount;
	}

	public void setRecvQCount(int recvQCount) {
		this.recvQCount = recvQCount;
	}

	@Override
	public String toString() {
		return "MonitorInfoVO{" +
				"isConnected=" + isConnected +
				", checkRecvDT=" + checkRecvDT +
				", disConnInterval=" + disConnInterval +
				", recvCount=" + recvCount +
				", recvMonitorCount=" + recvMonitorCount +
				", recvByteSize=" + recvByteSize +
				", recvMonitorByteSize=" + recvMonitorByteSize +
				", lastRecvDT=" + lastRecvDT +
				", sendCount=" + sendCount +
				", sendMonitorCount=" + sendMonitorCount +
				", sendByteSize=" + sendByteSize +
				", sendMonitorByteSize=" + sendMonitorByteSize +
				", lastSendDT=" + lastSendDT +
				", refreshDT=" + refreshDT +
				", sendQCount=" + sendQCount +
				", sendQBufferCount=" + sendQBufferCount +
				", recvQCount=" + recvQCount +
				", serialBuffer=" + serialBuffer +
				", lastSequence=" + lastSequence +
				", Tag=" + Tag +
				'}';
	}
}
