|
|
@@ -5,20 +5,25 @@ import com.its.app.utils.SysUtils;
|
|
|
import com.its.vms.config.ApplicationConfig;
|
|
|
import com.its.vms.domain.*;
|
|
|
import com.its.vms.domain.enums.eVmsFormType;
|
|
|
+import com.its.vms.domain.task.VmsCommandTimeoutTask;
|
|
|
import com.its.vms.entity.TbVmsCtlr;
|
|
|
import com.its.vms.entity.TbVmsCtlrStts;
|
|
|
import com.its.vms.entity.TbVmsCtrlHs;
|
|
|
+import com.its.vms.entity.VmsCtlrParam;
|
|
|
+import com.its.vms.process.DbmsData;
|
|
|
+import com.its.vms.process.DbmsDataProcess;
|
|
|
+import com.its.vms.process.DbmsDataType;
|
|
|
import com.its.vms.service.VmsFormService;
|
|
|
import com.its.vms.xnettcp.vms.handler.VmsServerIdleStateHandler;
|
|
|
import com.its.vms.xnettcp.vms.process.TcpServerSendData;
|
|
|
import com.its.vms.xnettcp.vms.process.TcpServerSendDataProcess;
|
|
|
+import com.its.vms.xnettcp.vms.protocol.VmsReqFramePacket;
|
|
|
import com.its.vms.xnettcp.vms.protocol.dto.*;
|
|
|
import com.its.vms.xnettcp.vms.protocol.enums.eVmsFileSaveLocation;
|
|
|
import com.its.vms.xnettcp.vms.protocol.enums.eVmsFormObjectKind;
|
|
|
import com.its.vms.xnettcp.vms.protocol.enums.eVmsImageType;
|
|
|
import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
|
|
|
import com.its.vms.xnettcp.vms.protocol.impl.*;
|
|
|
-import com.its.vms.xnettcp.vms.task.VmsTimeoutTask;
|
|
|
import io.netty.channel.Channel;
|
|
|
import io.netty.channel.ChannelFuture;
|
|
|
import io.netty.channel.ChannelHandlerContext;
|
|
|
@@ -32,7 +37,6 @@ import java.text.SimpleDateFormat;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Timer;
|
|
|
-import java.util.TimerTask;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
|
@Slf4j
|
|
|
@@ -58,30 +62,32 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
private String typeCd;
|
|
|
private String modlTypeCd;
|
|
|
private String operMode;
|
|
|
- private Integer cmncFailRate;
|
|
|
- private Integer brghNghtStep;
|
|
|
- private Integer brghWeekStep;
|
|
|
- private Integer defPhseChngCycl;
|
|
|
- private Integer modlErrRate;
|
|
|
private Integer cmncfailSlotNmbr;
|
|
|
private Integer pwerFailSlotNmbr;
|
|
|
private String cmtrinfrCnctYn;
|
|
|
private String wthrinfrCnctYn;
|
|
|
private String envrinfrCnctYn;
|
|
|
private Integer maxPhaseNum;
|
|
|
- private String panlOnTime;
|
|
|
- private String panlOffTime;
|
|
|
- private String panlPwerMode;
|
|
|
- private String brghMode;
|
|
|
private String istlLctnNm;
|
|
|
+ private String istlLctnAddr;
|
|
|
private String trfcStrgUseYn;
|
|
|
private Long locIfscId;
|
|
|
- private Double fanRunTmpr;
|
|
|
- private Double hetrRunTmpr;
|
|
|
- private Integer fanMode;
|
|
|
- private Integer hetrMode;
|
|
|
- private Integer brghCurrStep;
|
|
|
- private String istlLctnAddr;
|
|
|
+
|
|
|
+ private Integer defPhseChngCycl; // 기본메시지주기
|
|
|
+ private String panlOnTime; // 전광판 ON TIME
|
|
|
+ private String panlOffTime; // 전광판 OFF TIME
|
|
|
+ private Integer panlPwerMode; // 전광판 전원 모드(0x00:꺼짐,0x01:켜짐,0x02:자동,0x09:알수없음)
|
|
|
+ private Integer fanMode; // FAN 동작모드(0x00:꺼짐,0x01:켜짐,0x02:자동,0x09:알수없음)
|
|
|
+ private Integer fanRunTmpr; // 팬 동작 온도
|
|
|
+ private Integer hetrMode; // 히터 동작모드(0x00:꺼짐,0x01:켜짐,0x02:자동,0x09:알수없음)
|
|
|
+ private Integer hetrRunTmpr; // 히터 동작 온도
|
|
|
+ private Integer brghMode; // 휘도 모드(0x00:주간,0x01:야간,0x02:자동,0x09:수동)
|
|
|
+ private Integer brghCurrStep; // 휘도 현재 단계(0~100)
|
|
|
+ private Integer brghWeekStep; // 휘도 주간 단계(0~100)
|
|
|
+ private Integer brghNghtStep; // 휘도 야간 단계(0~100)
|
|
|
+ private Integer modlErrRate; // VMS 모듈 오류 율
|
|
|
+ private Integer cmncFailRate; // VMS 통신 오류 기본 값
|
|
|
+
|
|
|
private Integer protocolVer;
|
|
|
private String delYn;
|
|
|
|
|
|
@@ -132,15 +138,17 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
|
|
|
private Integer downloadFormId;
|
|
|
private VmsDownloadFile downloadFile; // 제어기로 다운로드할 파일정보(TB_VMS_DOWNLOAD)
|
|
|
- private VmsDownloadData downloadData;
|
|
|
+ private VmsDownloadData downloadData; // 제어기로 다운로드할 파일 데이터
|
|
|
private ConcurrentHashMap<Integer, VmsDownloadForm> downloadFormMap = null;
|
|
|
private ConcurrentHashMap<Integer, TbVmsSymbLibDnldDto> dnldSymbMap = null;
|
|
|
private ConcurrentHashMap<Integer, VmsScheduleSymbDto> reqDnldSymbMap;
|
|
|
Integer dnldSymbLibNmbr;
|
|
|
|
|
|
- private ConcurrentHashMap<Long, TbVmsRltnIfscDto> rltnIfscMap = null;
|
|
|
+ private ConcurrentHashMap<Long, TbVmsRltnIfscDto> rltnIfscMap = null; // VMS 에 설정된 VMS 정보제공구간 목록
|
|
|
+
|
|
|
+ private ConcurrentHashMap<Short, Timer> registeredCommandTimer = null;
|
|
|
+ private ConcurrentHashMap<Short, VmsCommandTimeoutTask> registeredCommand = null;
|
|
|
|
|
|
- private ConcurrentHashMap<Long, Timer> registeredCommandsTimer = null;
|
|
|
private ConcurrentHashMap<Long, TbVmsCtrlHs> userCommands = null;
|
|
|
|
|
|
private int connectCount;
|
|
|
@@ -148,20 +156,22 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
private String disConnectTm;
|
|
|
private long lastRecvTime;
|
|
|
|
|
|
- private TcpServerSendDataProcess dataProcess;
|
|
|
+ private TcpServerSendDataProcess dataProcess; // 제어기로 데이터를 전송할 전송 전송 큐를 처리할 스레드
|
|
|
|
|
|
public void init() {
|
|
|
this.stts = new TbVmsCtlrStts(this.vmsCtlrNmbr);
|
|
|
this.seq = new VmsFrameSequence();
|
|
|
|
|
|
- this.downloadData = new VmsDownloadData();
|
|
|
this.downloadFormMap = new ConcurrentHashMap<>();
|
|
|
this.dnldSymbMap = new ConcurrentHashMap<>();
|
|
|
this.reqDnldSymbMap = new ConcurrentHashMap<>();
|
|
|
this.dnldSymbLibNmbr = 0;
|
|
|
|
|
|
- this.registeredCommandsTimer = new ConcurrentHashMap<>();
|
|
|
+ this.registeredCommandTimer = new ConcurrentHashMap<>();
|
|
|
+ this.registeredCommand = new ConcurrentHashMap<>();
|
|
|
+
|
|
|
this.userCommands = new ConcurrentHashMap<>();
|
|
|
+
|
|
|
this.rltnIfscMap = new ConcurrentHashMap<>();
|
|
|
|
|
|
this.formManager = new VmsFormManager(this.vmsWidth, this.vmsHeight);
|
|
|
@@ -173,7 +183,9 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
this.module = new VmsModule();
|
|
|
this.luminance = new VmsLuminance();
|
|
|
this.controlMode = new VmsControlMode();
|
|
|
+ this.downloadFormId = 0;
|
|
|
this.downloadFile = new VmsDownloadFile();
|
|
|
+ this.downloadData = new VmsDownloadData();
|
|
|
|
|
|
this.connectCount = 0;
|
|
|
this.connectTm = "-";
|
|
|
@@ -220,14 +232,27 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 제어기 전송 패킷의 패킷 번호를 구한다.
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public short getSeqNext() {
|
|
|
return this.seq.nextValue();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 제어기 전송 스레드 타스크 큐에 명령을 전송
|
|
|
+ * @param data
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public synchronized boolean addRequestData(TcpServerSendData data) {
|
|
|
return this.dataProcess.add(data);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 제어기 네트워크 최초 접속시 발생 이벤트
|
|
|
+ * @param ctx
|
|
|
+ */
|
|
|
public synchronized void connected(ChannelHandlerContext ctx) {
|
|
|
this.netState = NET.LOGIN_REQ;
|
|
|
this.connectTm = SysUtils.getSysTimeStr();
|
|
|
@@ -235,11 +260,15 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
this.lastRecvTime = System.currentTimeMillis();
|
|
|
this.connectCount++;
|
|
|
this.stts.initNormal();
|
|
|
+ clearRegisteredCommandTimer();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 제어기 네트워크 연결 종료 이벤트
|
|
|
+ */
|
|
|
public synchronized void disconnected() {
|
|
|
+ clearRegisteredCommandTimer();
|
|
|
this.netState = NET.CLOSED;
|
|
|
- this.registeredCommandsTimer.clear();
|
|
|
this.channel = null;
|
|
|
this.disConnectTm = SysUtils.getSysTimeStr();
|
|
|
this.stts.initError();
|
|
|
@@ -268,61 +297,80 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
this.syncTime = 0;
|
|
|
}
|
|
|
|
|
|
- public synchronized void channelLogin(Channel channel) {
|
|
|
- this.channel = channel;
|
|
|
-
|
|
|
- //this.registeredCommands.clear();
|
|
|
- for (Map.Entry<Long, Timer> e : this.registeredCommandsTimer.entrySet()) {
|
|
|
+ /**
|
|
|
+ * 제어기 명령 타임아웃 타스크 클리어
|
|
|
+ */
|
|
|
+ public synchronized void clearRegisteredCommandTimer() {
|
|
|
+ this.registeredCommand.clear();
|
|
|
+ for (Map.Entry<Short, Timer> e : this.registeredCommandTimer.entrySet()) {
|
|
|
Timer task = e.getValue();
|
|
|
task.cancel();
|
|
|
}
|
|
|
- this.registeredCommandsTimer.clear();
|
|
|
-
|
|
|
- this.netState = NET.LOGINED;
|
|
|
+ this.registeredCommandTimer.clear();
|
|
|
}
|
|
|
- public synchronized void channelLoginInit() {
|
|
|
- //this.registeredCommands.clear();
|
|
|
- for (Map.Entry<Long, Timer> e : this.registeredCommandsTimer.entrySet()) {
|
|
|
- Timer task = e.getValue();
|
|
|
- task.cancel();
|
|
|
- }
|
|
|
- this.registeredCommandsTimer.clear();
|
|
|
|
|
|
- this.netState = NET.LOGINED;
|
|
|
+ /**
|
|
|
+ * 제어기 명령 타임아웃 타스크 추가
|
|
|
+ * @param cmdTimeoutTask
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public synchronized void addRegisteredCommandsTimer(VmsCommandTimeoutTask cmdTimeoutTask) {
|
|
|
+ long timeoutSec = 1000L * 5;
|
|
|
+ Timer timer = new Timer();
|
|
|
+ timer.schedule(cmdTimeoutTask, timeoutSec);
|
|
|
+ this.registeredCommandTimer.put(cmdTimeoutTask.getPacketNmbr(), timer);
|
|
|
+ this.registeredCommand.put(cmdTimeoutTask.getPacketNmbr(), cmdTimeoutTask);
|
|
|
+// log.info("addRegisteredCommandsTimer: VMS {}, Task {} EA, OpCode {}.",
|
|
|
+// cmdTimeoutTask.getCtlr().getVmsCtlrNmbr(), this.registeredCommandTimer.size(), cmdTimeoutTask.getPacket().getOpCode());
|
|
|
}
|
|
|
|
|
|
- public void sleep(long milliSeconds) {
|
|
|
- try {
|
|
|
- Thread.sleep(milliSeconds);
|
|
|
- } catch (InterruptedException e) {
|
|
|
- log.error("sleep: InterruptedException");
|
|
|
+ /**
|
|
|
+ * 제어기 명령 타임아웃 타스크 제거
|
|
|
+ * @param opCode
|
|
|
+ */
|
|
|
+ public synchronized void removeRegisteredCommandsTimer(eVmsOpCode opCode) {
|
|
|
+ short packetNmbr = (short)opCode.getValue();
|
|
|
+ Timer timer = this.registeredCommandTimer.get(packetNmbr);
|
|
|
+ if (timer != null) {
|
|
|
+ timer.cancel();
|
|
|
+ this.registeredCommandTimer.remove(packetNmbr);
|
|
|
+ }
|
|
|
+ VmsCommandTimeoutTask cmdTimeoutTask = this.registeredCommand.get(packetNmbr);
|
|
|
+ if (cmdTimeoutTask != null) {
|
|
|
+ this.registeredCommand.remove(packetNmbr);
|
|
|
+// log.info("removeRegisteredCommandsTimer: VMS {}, Task {} EA, OpCode {}.",
|
|
|
+// cmdTimeoutTask.getCtlr().getVmsCtlrNmbr(), this.registeredCommandTimer.size(), cmdTimeoutTask.getPacket().getOpCode());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Channel Send Data
|
|
|
- * @param sendBuffer
|
|
|
- * @param delayMilliSeconds
|
|
|
- * @param packetDesc
|
|
|
+ * @param packet
|
|
|
+ * @param retryCnt
|
|
|
* @return
|
|
|
*/
|
|
|
- public synchronized boolean sendData(ByteBuffer sendBuffer, int delayMilliSeconds, String packetDesc) {
|
|
|
+ public synchronized boolean sendData(VmsReqFramePacket packet, int retryCnt) {
|
|
|
boolean result = false;
|
|
|
+
|
|
|
+ ByteBuffer sendBuffer = packet.getByteBuffer();
|
|
|
+ String packetDesc = packet.getOpCodeDesc();
|
|
|
+
|
|
|
log.info("~REQUEST-{}. VMS {}, {} Bytes.", packetDesc, this.vmsCtlrNmbr, sendBuffer.capacity());
|
|
|
if (this.channel != null) {
|
|
|
ChannelFuture f = this.channel.writeAndFlush(sendBuffer);
|
|
|
f.awaitUninterruptibly();
|
|
|
if (f.isDone() || f.isSuccess()) {
|
|
|
result = true;
|
|
|
- if (delayMilliSeconds > 0) {
|
|
|
- sleep(delayMilliSeconds);
|
|
|
- }
|
|
|
} else {
|
|
|
log.error("~REQUEST-{}. VMS {}, sendData Failed. {} Bytes.", packetDesc, this.vmsCtlrNmbr, sendBuffer.array().length);
|
|
|
}
|
|
|
} else {
|
|
|
log.error("~REQUEST-{}. VMS {}, sendData Failed. Not Connected. {} Bytes.", packetDesc, this.vmsCtlrNmbr, sendBuffer.array().length);
|
|
|
}
|
|
|
+ if (result) {
|
|
|
+ VmsCommandTimeoutTask cmdTimeoutTask = new VmsCommandTimeoutTask(this, packet, retryCnt);
|
|
|
+ addRegisteredCommandsTimer(cmdTimeoutTask);
|
|
|
+ }
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@@ -345,12 +393,6 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
return addRequestData(new TcpServerSendData(eVmsOpCode.OP_VMS_STATUS_CONTROL, resetControl));
|
|
|
}
|
|
|
|
|
|
- public synchronized boolean addUserCommands(Long packetNmbr, TbVmsCtrlHs command) {
|
|
|
-
|
|
|
- this.userCommands.put(packetNmbr, command);
|
|
|
- return addCommandTimer(packetNmbr);
|
|
|
- }
|
|
|
-
|
|
|
public synchronized boolean removeUserCommands(Long packetNmbr) {
|
|
|
|
|
|
TbVmsCtrlHs command = this.userCommands.get(packetNmbr);
|
|
|
@@ -367,49 +409,6 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
return command;
|
|
|
}
|
|
|
|
|
|
- private boolean addCommandTimer(Long packetNmbr) {
|
|
|
-
|
|
|
- long timeoutSec = 10;//this.login.getDatexLoginResponseTimeOutQty().value.longValue();
|
|
|
- if (timeoutSec == 0L || timeoutSec > 30L) {
|
|
|
- timeoutSec = 30L;
|
|
|
- }
|
|
|
- if (timeoutSec < 5L)
|
|
|
- timeoutSec = 5L;
|
|
|
-
|
|
|
- timeoutSec = 1000L * timeoutSec;
|
|
|
- Timer timer = new Timer();
|
|
|
- timer.schedule((TimerTask)new VmsTimeoutTask(this, packetNmbr), timeoutSec);
|
|
|
- this.registeredCommandsTimer.put(packetNmbr, timer);
|
|
|
-
|
|
|
- log.info("addCommandTimer: [{}], packetNmbr: {}, timeoutSec: {} ms, {}", this.vmsCtlrNmbr, packetNmbr, timeoutSec, timer);
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- public synchronized boolean removeRegisteredCommandsTimer(int packetNmbr) {
|
|
|
-
|
|
|
- Timer timer = this.registeredCommandsTimer.get(Integer.valueOf(packetNmbr));
|
|
|
- if (timer != null) {
|
|
|
- this.registeredCommandsTimer.remove(Integer.valueOf(packetNmbr));
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- public synchronized boolean removeRegisteredCommands(Long packetNmbr, boolean cancelTimer) {
|
|
|
-
|
|
|
- Timer timer = this.registeredCommandsTimer.get(packetNmbr);
|
|
|
- if (timer != null) {
|
|
|
- if (cancelTimer)
|
|
|
- timer.cancel();
|
|
|
- this.registeredCommandsTimer.remove(packetNmbr);
|
|
|
- }
|
|
|
-
|
|
|
-// C2CAuthenticatedMessage c2c = this.registeredCommands.get(packetNmbr);
|
|
|
-// if (c2c != null) {
|
|
|
-// this.registeredCommands.remove(packetNmbr);
|
|
|
-// }
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
public TbVmsCtlr toDto() {
|
|
|
return TbVmsCtlr.builder()
|
|
|
.vmsCtlrNmbr(this.vmsCtlrNmbr)
|
|
|
@@ -458,12 +457,10 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
* 2. 파일 다운로드(이미지, 심볼) - downloadFile
|
|
|
* 3. 폼 스케쥴 다운로드 - downloadFormSchedule
|
|
|
* 4. Blank - downloadBlank
|
|
|
- * @param isSchedule
|
|
|
* @return
|
|
|
*/
|
|
|
- public boolean downloadForm(boolean isSchedule) {
|
|
|
+ public boolean downloadForm() {
|
|
|
VmsFormService formService = (VmsFormService) AppUtils.getBean(VmsFormService.class);
|
|
|
- this.controlMode.setSchedule(isSchedule);
|
|
|
this.txtOpCode = (byte)0x00;
|
|
|
this.downloadData.init();
|
|
|
|
|
|
@@ -495,37 +492,39 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
units[forms].setVmsFormId(vmsFormId);
|
|
|
units[forms].setDownload(true);
|
|
|
units[forms].setFormIdx(ii);
|
|
|
- units[forms].setBitmapId(forms + 1000);
|
|
|
+ //units[forms].setBitmapId(forms + 1000);
|
|
|
+ units[forms].setBitmapId(pForm.getDnldFormNo());
|
|
|
units[forms].setFormNo(9000 + forms);
|
|
|
units[forms].setDisplaySec(pForm.getDsplHh());
|
|
|
units[forms].setDisplayType(pForm.getVmsFormDsplMthdCd());
|
|
|
units[forms].setBkClr(pForm.getVmsFormColrCd());
|
|
|
|
|
|
- VmsDownloadForm downloadForm = this.downloadFormMap.get(vmsFormId);
|
|
|
- // 홍보폼이면서 신규폼이 아니면서 이전 다운로드 목록이 존재하는 경우에 다운로드 여부를 체크한다.
|
|
|
- if (vmsForm.getVmsFormTypeCd() == eVmsFormType.eFormTp_hongbo.getValue() && !vmsForm.isNewForm() && downloadForm != null) {
|
|
|
- if (downloadForm.isAlreadyDownload()) {
|
|
|
- // 이미 이전에 다운로드를 했기때문에 이번에는 제어기로 다운로드를 하지 않는다.
|
|
|
- units[forms].setDownload(false);
|
|
|
+ if (vmsForm.getVmsFormTypeCd() == eVmsFormType.eFormTp_hongbo.getValue()) {
|
|
|
+ // 다운로드 할 폼이 홍보폼이면 여러번 다운로드 하지 않도록 메모리에서 관리하자.
|
|
|
+ VmsDownloadForm downloadForm = this.downloadFormMap.get(vmsFormId);
|
|
|
+ if (downloadForm != null) {
|
|
|
+ // 이전에 다운로드한 폼 정보가 존재하면
|
|
|
+ if (!vmsForm.getUpdtDt().equals(downloadForm.getUpdtDt())) {
|
|
|
+ // 업데이트시각이 다르기때문에 신규폼으로 판단한다.
|
|
|
+ downloadForm.setAlreadyDownload(false);
|
|
|
+ downloadForm.setUpdtDt(vmsForm.getUpdtDt());
|
|
|
+ units[forms].setDownload(true); // 현재 스케쥴폼으로 다운로드 플래그 설정
|
|
|
+ }
|
|
|
+ if (downloadForm.isAlreadyDownload()) {
|
|
|
+ // 이미 이전에 다운로드를 했기때문에 이번에는 제어기로 다운로드를 하지 않는다.
|
|
|
+ units[forms].setDownload(false);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- // 이전에 다운로드한 정보가 존재하면
|
|
|
- if (downloadForm != null) {
|
|
|
- if (!vmsForm.getUpdtDt().equals(downloadForm.getUpdtDt())) {
|
|
|
- // 업데이트시각이 다르기때문에 신규폼으로 판단한다.
|
|
|
+ else {
|
|
|
+ // 이전에 다운로드 한 정보가 없기때문에 메모리에 저장해 놓는다.
|
|
|
+ downloadForm = new VmsDownloadForm();
|
|
|
+ downloadForm.setVmsFormId(vmsFormId);
|
|
|
downloadForm.setAlreadyDownload(false);
|
|
|
downloadForm.setUpdtDt(vmsForm.getUpdtDt());
|
|
|
- units[forms].setDownload(true);
|
|
|
+ this.downloadFormMap.put(vmsFormId, downloadForm);
|
|
|
}
|
|
|
}
|
|
|
- else {
|
|
|
- downloadForm = new VmsDownloadForm();
|
|
|
- downloadForm.setVmsFormId(vmsFormId);
|
|
|
- downloadForm.setAlreadyDownload(false);
|
|
|
- downloadForm.setUpdtDt(vmsForm.getUpdtDt());
|
|
|
- this.downloadFormMap.put(vmsFormId, downloadForm);
|
|
|
- }
|
|
|
+
|
|
|
forms++;
|
|
|
}
|
|
|
|
|
|
@@ -608,7 +607,7 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
formData.calFormCount();
|
|
|
|
|
|
VmsReqDownloadForm downloadForm = new VmsReqDownloadForm(this, formData);
|
|
|
- return sendData(downloadForm.getByteBuffer(), 10, downloadForm.getOpCodeDesc());
|
|
|
+ return sendData(downloadForm, 1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -624,7 +623,7 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
return true;
|
|
|
}
|
|
|
int downloadCnt = this.downloadData.getDownloadCnt();
|
|
|
- log.info("downloadAutoFixForm: VMS {}, Form {} EA, Download Count {} EA.", this.vmsCtlrNmbr, formCnt, downloadCnt);
|
|
|
+ log.info("downloadAutoFixForm: VMS {}, Schedule Form {} EA, Download Count {} EA.", this.vmsCtlrNmbr, formCnt, downloadCnt);
|
|
|
if (downloadCnt >= formCnt) {
|
|
|
// 폼정보를 모두 다운로드 했기때문에 폼파일을 다운로드 해야 한다.
|
|
|
this.downloadData.setDownloadCnt(0); // 폼이미지파일을 다운로드해야 하기때문에 다운로드 인덱스를 다시 0으로 리셋
|
|
|
@@ -654,7 +653,10 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
formDto.addObject(formObjDto);
|
|
|
formData.calFormCount();
|
|
|
|
|
|
- log.info("downloadAutoFixForm: DownloadCnt: VMS {}, IDX {}, FormId {}, BitmapId {}, VMS_FORM_ID: {}", this.vmsCtlrNmbr, formCnt, formId, bitmapId, this.downloadFormId);
|
|
|
+ this.downloadData.setDownloadCnt(downloadCnt+1);
|
|
|
+
|
|
|
+ log.info("downloadAutoFixForm: VMS {}, Schedule Form {} EA, Download Count {} EA, VmsFormId {}, FormId {}, BitmapId {}.",
|
|
|
+ this.vmsCtlrNmbr, formCnt, downloadCnt+1, pForm.getVmsFormId(), formId, bitmapId);
|
|
|
|
|
|
// VmsFormDataDto formData = new VmsFormDataDto(formId, downloadFormCnt);
|
|
|
// int ii = downloadCnt;
|
|
|
@@ -696,10 +698,8 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
// formDto.calObjCount();
|
|
|
// formData.calFormCount();
|
|
|
|
|
|
- this.downloadData.setDownloadCnt(downloadCnt+1);
|
|
|
-
|
|
|
VmsReqDownloadForm downloadForm = new VmsReqDownloadForm(this, formData);
|
|
|
- return sendData(downloadForm.getByteBuffer(), 10, downloadForm.getOpCodeDesc());
|
|
|
+ return sendData(downloadForm, 1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -714,35 +714,43 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
}
|
|
|
|
|
|
int downloadCnt = this.downloadData.getDownloadCnt();
|
|
|
- log.info("downloadFile: VMS {}, Form {} EA, Download Count {} EA.", this.vmsCtlrNmbr, formCnt, downloadCnt);
|
|
|
+ log.info("downloadFile: VMS {}, Schedule Form {} EA, Download Count {} EA.", this.vmsCtlrNmbr, formCnt, downloadCnt);
|
|
|
if (downloadCnt >= formCnt) {
|
|
|
// 폼파일이(폼이미지파일) 모두 다운로드 되었으므로 스케쥴 정보를 다운로드 한다.
|
|
|
return downloadFormSchedule(); // Display Schedule Form
|
|
|
}
|
|
|
|
|
|
+ this.downloadFormId = 0;
|
|
|
ApplicationConfig config = (ApplicationConfig)AppUtils.getBean(ApplicationConfig.class);
|
|
|
VmsDownloadData.VmsDownloadDataInfo[] units = this.downloadData.getUnits();
|
|
|
for (int ii = downloadCnt; ii < formCnt; ii++) {
|
|
|
this.downloadData.setDownloadCnt(downloadCnt+1);
|
|
|
|
|
|
- int formId = units[ii].getFormNo();
|
|
|
- int bitmapId = units[ii].getBitmapId();
|
|
|
- int formIdx = units[ii].getFormIdx();
|
|
|
+ int vmsFormId = units[ii].getVmsFormId();
|
|
|
+ int formId = units[ii].getFormNo();
|
|
|
+ int bitmapId = units[ii].getBitmapId();
|
|
|
+ int formIdx = units[ii].getFormIdx();
|
|
|
VmsForm pForm = this.formManager.getItem(formIdx);
|
|
|
if (config.isCheckNewForm() && !units[ii].isDownload()) {
|
|
|
// 이미 다운로드 했기 때문에 다시 다운로드 하지 않는다.
|
|
|
- log.info("downloadFile: VMS {}, IDX {}, FormId {}, BitmapId {}, already download...", this.vmsCtlrNmbr, ii, formId, bitmapId);
|
|
|
+ log.info("downloadFile: VMS {}, IDX {}, VmsFormId {}, FormId {}, BitmapId {}, formIdx {}, DownloadFormID: {}, already download...",
|
|
|
+ this.vmsCtlrNmbr, ii, vmsFormId, formId, bitmapId, formIdx, this.downloadFormId));
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- this.downloadFormId = units[ii].getVmsFormId();
|
|
|
+ if (pForm.getVmsFormTypeCd() == eVmsFormType.eFormTp_hongbo.getValue()) {
|
|
|
+ // 홈보폼인 경우 다운로드 폼 ID를 저장해 놓는다.
|
|
|
+ this.downloadFormId = vmsFormId;
|
|
|
+ }
|
|
|
+
|
|
|
+ log.info("downloadFile: VMS {}, Idx {}, VmsFormId {}, FormId {}, BitmapId {}, formIdx {}, DownloadFormID: {}",
|
|
|
+ this.vmsCtlrNmbr, ii, pForm.getVmsFormId(), formId, bitmapId, formIdx, this.downloadFormId);
|
|
|
|
|
|
- log.info("downloadFile: DownloadCnt: VMS {}, IDX {}, FormId {}, BitmapId {}, VMS_FORM_ID: {}", this.vmsCtlrNmbr, ii, formId, bitmapId, this.downloadFormId);
|
|
|
String fileName = String.format("BID%04d.BMP", bitmapId);
|
|
|
eVmsFileSaveLocation saveLoc = eVmsFileSaveLocation.LOC_DOWNLOAD_PROG_IMAGE;
|
|
|
|
|
|
VmsReqDataDownload dataDownload = new VmsReqDataDownload(this, saveLoc, fileName, pForm.getImageData());
|
|
|
- return sendData(dataDownload.getByteBuffer(), 10, dataDownload.getOpCodeDesc());
|
|
|
+ return sendData(dataDownload, 1);
|
|
|
}
|
|
|
|
|
|
// 폼이미지 정보가 모두 다운로드 되었으므로 스케쥴 정보를 다운로드 한다.
|
|
|
@@ -769,22 +777,22 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
dispSec[ii] = 0;
|
|
|
}
|
|
|
|
|
|
- log.info("downloadFormSchedule: VMS {}, Schedule {} EA, Default Schedule {}.", this.vmsCtlrNmbr, maxSchedule, this.downloadData.isDefault());
|
|
|
+ log.info("downloadFormSchedule: VMS {}, Schedule {} EA, Default Schedule {}.", this.vmsCtlrNmbr, formCnt, this.downloadData.isDefault());
|
|
|
if (this.downloadData.isDefault()) {
|
|
|
formId[0] = (short)VmsConstants.DEFAULT_FORM_ID;
|
|
|
dispSec[0] = 4;
|
|
|
- log.info("downloadFormSchedule: VMS {}, Schedule {} EA, Default Schedule {}.", this.vmsCtlrNmbr, maxSchedule, this.downloadData.isDefault());
|
|
|
+ log.info("downloadFormSchedule: VMS {}, Schedule {} EA, Default Schedule {}.", this.vmsCtlrNmbr, formCnt, this.downloadData.isDefault());
|
|
|
}
|
|
|
else {
|
|
|
for (int ii = 0; ii < formCnt && ii < maxSchedule; ii++) {
|
|
|
formId[ii] = (short) this.downloadData.getUnits()[ii].getFormNo();
|
|
|
dispSec[ii] = (byte)(this.downloadData.getUnits()[ii].getDisplaySec() & 0xFF);
|
|
|
- log.info("downloadFormSchedule: VMS {}, Schedule {} EA, FormId {}, DisplayTm {} .", this.vmsCtlrNmbr, maxSchedule, formId[ii], dispSec[ii]);
|
|
|
+ log.info("downloadFormSchedule: VMS {}, Schedule {} EA, Idx {}, FormId {}, DisplayTm {}.", this.vmsCtlrNmbr, formCnt, ii+1, formId[ii], dispSec[ii]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
VmsReqDownloadFormSchedule downloadFormSchedule = new VmsReqDownloadFormSchedule(this, formId, dispSec);
|
|
|
- return sendData(downloadFormSchedule.getByteBuffer(), 10, downloadFormSchedule.getOpCodeDesc());
|
|
|
+ return sendData(downloadFormSchedule, 1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -794,9 +802,13 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
public boolean downloadBlank() {
|
|
|
log.info("downloadBlank: VMS {}.", this.vmsCtlrNmbr);
|
|
|
VmsReqBlank reqBlank = new VmsReqBlank(this);
|
|
|
- return sendData(reqBlank.getByteBuffer(), 10, reqBlank.getOpCodeDesc());
|
|
|
+ return sendData(reqBlank, 1);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 제어기로 심벌라이브러리를 다운로드한다.
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public boolean downloadSymbLib() {
|
|
|
this.dnldSymbLibNmbr = 0;
|
|
|
if (this.reqDnldSymbMap.size() == 0) {
|
|
|
@@ -815,9 +827,98 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
eVmsFileSaveLocation saveLoc = eVmsFileSaveLocation.LOC_DOWNLOAD_PROG_IMAGE;
|
|
|
|
|
|
VmsReqDataDownload dataDownload = new VmsReqDataDownload(this, saveLoc, fileName, dnldSymb.getImageData());
|
|
|
- sendData(dataDownload.getByteBuffer(), 10, dataDownload.getOpCodeDesc());
|
|
|
+ sendData(dataDownload, 1);
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
+/*
|
|
|
+ private int powerCtrlMode; // 전원제어 모드 1 Byte 0x00 : 꺼짐, 0x01 : 켜짐,
|
|
|
+ private int fanRunMode; // Fan 동작모드 1 Byte 0x00 : 꺼짐, 0x01 : 켜짐, 0x02 : 자동, 0x09: Unknown
|
|
|
+ private int fanRunTemp; // Fan 의 동작개시온도 1 Byte 온도( 0x00 ~0x03f )
|
|
|
+ private int heaterRunMode; // Heater 의 동작모드 1 Byte 0x00 : 꺼짐, 0x01 : 켜짐, 0x02 : 자동, 0x09: Unknown
|
|
|
+ private int heaterRunTemp; // Heater 의 동작개시온도 1 Byte 온도(0x00 ~ 0x3f )
|
|
|
+ private int brightMode; // 화면의 밝기 - 휘도 모드, 0x00:주간, 0x01:야간, 0x02:Auto, 0x03:수동
|
|
|
+ private int brightCurr; // 화면의 밝기 - 현재 휘도값, 0~100
|
|
|
+ private int brightWeek; // 화면의 밝기 - 주간 휘도값, 0~100
|
|
|
+ private int brightNght; // 화면의 밝기 - 야간 휘도값, 0~100
|
|
|
+ private int blinkTime; // 깜빡이는 시간주기 1 Byte 문자 비트맵의 깜빡이는 시간주기 0x00 ~ 0x1e( 0.1 ~3.0 )
|
|
|
+ private short scnTurnTime; // 디폴트 시나리오로 전환시간 2 Byte 디폴트 시나리오로 전환될 때까지 기다리는 시간, 단위 : 초
|
|
|
+ private int modlErrRate; // 장애 모듈비율(%) 1 Byte 에러난 픽셀의 백분율 (0~100: 초기값:10%)
|
|
|
+*/
|
|
|
+ public void updateParameter(int powerCtrlMode, int fanRunMode, int fanRunTemp, int heaterRunMode, int heaterRunTemp,
|
|
|
+ int brightMode, int brightCurr, int brightWeek, int brightNght, int blinkTime, short scnTurnTime, int modlErrRate) {
|
|
|
+ boolean isDifferent = false;
|
|
|
+
|
|
|
+ if (powerCtrlMode != this.panlPwerMode) {
|
|
|
+ isDifferent = true;
|
|
|
+ this.panlPwerMode = powerCtrlMode;
|
|
|
+ }
|
|
|
+ if (fanRunMode != this.fanMode) {
|
|
|
+ isDifferent = true;
|
|
|
+ this.fanMode = fanRunMode;
|
|
|
+ }
|
|
|
+ if (fanRunTemp != this.fanRunTmpr) {
|
|
|
+ isDifferent = true;
|
|
|
+ this.fanRunTmpr = fanRunTemp;
|
|
|
+ }
|
|
|
+ if (heaterRunMode != this.hetrMode) {
|
|
|
+ isDifferent = true;
|
|
|
+ this.hetrMode = heaterRunMode;
|
|
|
+ }
|
|
|
+ if (heaterRunTemp != this.hetrRunTmpr) {
|
|
|
+ isDifferent = true;
|
|
|
+ this.hetrRunTmpr = heaterRunTemp;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (brightMode != this.brghMode) {
|
|
|
+ isDifferent = true;
|
|
|
+ this.brghMode = brightMode;
|
|
|
+ }
|
|
|
+ if (brightCurr != this.brghCurrStep) {
|
|
|
+ isDifferent = true;
|
|
|
+ this.brghCurrStep = brightCurr;
|
|
|
+ }
|
|
|
+ if (brightWeek != this.brghWeekStep) {
|
|
|
+ isDifferent = true;
|
|
|
+ this.brghWeekStep = brightWeek;
|
|
|
+ }
|
|
|
+ if (brightNght != this.brghNghtStep) {
|
|
|
+ isDifferent = true;
|
|
|
+ this.brghNghtStep = brightNght;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (scnTurnTime != this.defPhseChngCycl) {
|
|
|
+ isDifferent = true;
|
|
|
+ this.defPhseChngCycl = (int)scnTurnTime;
|
|
|
+ }
|
|
|
+ if (modlErrRate != this.modlErrRate) {
|
|
|
+ isDifferent = true;
|
|
|
+ this.modlErrRate = modlErrRate;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isDifferent) {
|
|
|
+ DbmsDataProcess dbmsDataProcess = (DbmsDataProcess) AppUtils.getBean(DbmsDataProcess.class);
|
|
|
+ dbmsDataProcess.add(new DbmsData(DbmsDataType.DBMS_DATA_CTLR_PARAMETER, false, toParamEntity()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public VmsCtlrParam toParamEntity() {
|
|
|
+ return VmsCtlrParam.builder()
|
|
|
+ .vmsCtlrNmbr(this.vmsCtlrNmbr)
|
|
|
+ .panlPwerMode(this.panlPwerMode)
|
|
|
+ .fanMode(this.fanMode)
|
|
|
+ .fanRunTmpr(this.fanRunTmpr)
|
|
|
+ .hetrMode(this.hetrMode)
|
|
|
+ .hetrRunTmpr(this.hetrRunTmpr)
|
|
|
+ .brghMode(this.brghMode)
|
|
|
+ .brghCurrStep(this.brghCurrStep)
|
|
|
+ .brghWeekStep(this.brghWeekStep)
|
|
|
+ .brghNghtStep(this.brghNghtStep)
|
|
|
+ .modlErrRate(this.modlErrRate)
|
|
|
+ .cmncFailRate(this.cmncFailRate)
|
|
|
+ .build();
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
+
|