|
@@ -16,10 +16,8 @@ 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.eVmsFileSaveLocation;
|
|
|
import com.its.vms.xnettcp.vms.protocol.enums.eVmsFormObjectKind;
|
|
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.eVmsImageType;
|
|
|
-import com.its.vms.xnettcp.vms.protocol.impl.VmsReqBlank;
|
|
|
|
|
-import com.its.vms.xnettcp.vms.protocol.impl.VmsReqDataDownload;
|
|
|
|
|
-import com.its.vms.xnettcp.vms.protocol.impl.VmsReqDownloadForm;
|
|
|
|
|
-import com.its.vms.xnettcp.vms.protocol.impl.VmsReqDownloadFormSchedule;
|
|
|
|
|
|
|
+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 com.its.vms.xnettcp.vms.task.VmsTimeoutTask;
|
|
|
import io.netty.channel.Channel;
|
|
import io.netty.channel.Channel;
|
|
|
import io.netty.channel.ChannelFuture;
|
|
import io.netty.channel.ChannelFuture;
|
|
@@ -191,6 +189,10 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
this.dataProcess.run();
|
|
this.dataProcess.run();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public String getLogKey() {
|
|
|
|
|
+ return this.ctlrId;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 파일 다운로드 정보 초기화
|
|
* 파일 다운로드 정보 초기화
|
|
|
*/
|
|
*/
|
|
@@ -215,7 +217,8 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
public short getSeqNext() {
|
|
public short getSeqNext() {
|
|
|
return this.seq.nextValue();
|
|
return this.seq.nextValue();
|
|
|
}
|
|
}
|
|
|
- public boolean addRequestData(TcpServerSendData data) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ public synchronized boolean addRequestData(TcpServerSendData data) {
|
|
|
return this.dataProcess.add(data);
|
|
return this.dataProcess.add(data);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -236,13 +239,9 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
this.stts.initError();
|
|
this.stts.initError();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public String getLogKey() {
|
|
|
|
|
- return this.ctlrId;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
public String getLastRecvTimeFmt() {
|
|
public String getLastRecvTimeFmt() {
|
|
|
SimpleDateFormat sdfDate = new SimpleDateFormat("MM-dd HH:mm:ss");
|
|
SimpleDateFormat sdfDate = new SimpleDateFormat("MM-dd HH:mm:ss");
|
|
|
- return sdfDate.format(lastRecvTime);
|
|
|
|
|
|
|
+ return sdfDate.format(this.lastRecvTime);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void resetConnectCount() {
|
|
public void resetConnectCount() {
|
|
@@ -301,7 +300,7 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
* @param packetDesc
|
|
* @param packetDesc
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- public boolean sendData(ByteBuffer sendBuffer, int delayMilliSeconds, String packetDesc) {
|
|
|
|
|
|
|
+ public synchronized boolean sendData(ByteBuffer sendBuffer, int delayMilliSeconds, String packetDesc) {
|
|
|
boolean result = false;
|
|
boolean result = false;
|
|
|
log.info("~REQUEST-{}. VMS {}, {} Bytes.", packetDesc, this.vmsCtlrNmbr, sendBuffer.capacity());
|
|
log.info("~REQUEST-{}. VMS {}, {} Bytes.", packetDesc, this.vmsCtlrNmbr, sendBuffer.capacity());
|
|
|
if (this.channel != null) {
|
|
if (this.channel != null) {
|
|
@@ -330,26 +329,14 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public int reset(int devcType, int cntlType, TbVmsCtrlHs ctrlHs) {
|
|
|
|
|
-// if (getChannel() == null || getNetState() == NET.CLOSED) {
|
|
|
|
|
-// log.error("Reset Request: channel not connected: [{}]", this);
|
|
|
|
|
-// return 1;
|
|
|
|
|
-// }
|
|
|
|
|
-// eControlDeviceId controlDeviceId = eControlDeviceId.getByValue(devcType);
|
|
|
|
|
-// eControlCommand commandType = eControlCommand.getByValue(cntlType);
|
|
|
|
|
-// if (controlDeviceId == null || commandType == null) {
|
|
|
|
|
-// log.error("Reset Request: control type missMatched: [{}], {}, {}", this, controlDeviceId, commandType);
|
|
|
|
|
-// return 2;
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// log.warn("[{}] [{},{}], controlDeviceId: {}, commandType: {}", this.vmsCtlrNmbr, devcType, cntlType, controlDeviceId.toString(), commandType.toString());
|
|
|
|
|
-// boolean res = ControlDeviceService.getInstance().requestResetCommand(true, this, getChannel());
|
|
|
|
|
-// if (res) {
|
|
|
|
|
-// log.info("RSE REQ CONTROL SEND OK: [{}] [{},{}]", this.RSE_CTLR_NMBR, devcType, cntlType);
|
|
|
|
|
-// return 0;
|
|
|
|
|
-// }
|
|
|
|
|
- log.error("RSE REQ CONTROL SEND Error: [{}] [{},{}]", this.vmsCtlrNmbr, devcType, cntlType);
|
|
|
|
|
- return 3;
|
|
|
|
|
|
|
+ public boolean reset(TbVmsCtrlHs ctrlHs) {
|
|
|
|
|
+ if (getChannel() == null || getNetState() == NET.CLOSED) {
|
|
|
|
|
+ log.error("Reset Request: channel not connected: [{}]", this);
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ VmsReqStatusControl resetControl = new VmsReqStatusControl(this);
|
|
|
|
|
+ resetControl.controlReset();
|
|
|
|
|
+ return addRequestData(new TcpServerSendData(eVmsOpCode.OP_VMS_STATUS_CONTROL, resetControl));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public synchronized boolean addUserCommands(Long packetNmbr, TbVmsCtrlHs command) {
|
|
public synchronized boolean addUserCommands(Long packetNmbr, TbVmsCtrlHs command) {
|
|
@@ -438,15 +425,6 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
// return c2c;
|
|
// return c2c;
|
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
- public synchronized boolean sendFrED() {
|
|
|
|
|
- if (getChannel() == null || getNetState() == NET.CLOSED) {
|
|
|
|
|
- log.error("sendFrED Request: channel not connected: [{}]", this);
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- return true;
|
|
|
|
|
- //return FredResponse.sendFrED(this, getChannel());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
public TbVmsCtlr toDto() {
|
|
public TbVmsCtlr toDto() {
|
|
|
return TbVmsCtlr.builder()
|
|
return TbVmsCtlr.builder()
|
|
|
.vmsCtlrNmbr(this.vmsCtlrNmbr)
|
|
.vmsCtlrNmbr(this.vmsCtlrNmbr)
|
|
@@ -661,7 +639,40 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
log.info("downloadAutoFixForm: VMS {}, Download Schedule Form Count Zero. {} EA.", this.vmsCtlrNmbr, formCnt);
|
|
log.info("downloadAutoFixForm: VMS {}, Download Schedule Form Count Zero. {} EA.", this.vmsCtlrNmbr, formCnt);
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
- return true;
|
|
|
|
|
|
|
+ int downloadCnt = this.downloadData.getDownloadCnt();
|
|
|
|
|
+ if (downloadCnt >= formCnt) {
|
|
|
|
|
+ // 폼정보를 모두 다운로드 했기때문에 폼파일을 다운로드 해야 한다.
|
|
|
|
|
+ this.downloadData.setDownloadCnt(0); // 폼이미지파일을 다운로드해야 하기때문에 다운로드 인덱스를 다시 0으로 리셋
|
|
|
|
|
+ return downloadFile();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 폼아이디는 제어기가 최초에 접속했을때 한번만 내려보내기 때문에
|
|
|
|
|
+ // 폼아이디를 여기서 설정해 주어야 한다.
|
|
|
|
|
+ VmsDownloadData.VmsDownloadDataInfo[] units = this.downloadData.getUnits();
|
|
|
|
|
+ int formId = units[downloadCnt].getFormNo();
|
|
|
|
|
+ int displaySec = units[downloadCnt].getDisplaySec();
|
|
|
|
|
+ int displayType = units[downloadCnt].getDisplayType();
|
|
|
|
|
+ int bitmapId = units[downloadCnt].getBitmapId();
|
|
|
|
|
+ int formIdx = units[downloadCnt].getFormIdx();
|
|
|
|
|
+ int downloadFormCnt = 1;
|
|
|
|
|
+ VmsForm pForm = this.formManager.getItem(formIdx);
|
|
|
|
|
+ int objSize = 7;
|
|
|
|
|
+ int blinking = pForm.getVmsFormDsplMthdCd();
|
|
|
|
|
+ int posX = 0;
|
|
|
|
|
+ int posY = 0;
|
|
|
|
|
+ int bkClr = units[downloadCnt].getBkClr();
|
|
|
|
|
+
|
|
|
|
|
+ VmsFormDataDto formData = new VmsFormDataDto(formId, downloadFormCnt);
|
|
|
|
|
+ VmsFormDto formDto = formData.addForm(formId, displaySec, displayType, bkClr, objSize);
|
|
|
|
|
+ VmsFormObj formObjDto= new VmsFormObjBitmapId(objSize, blinking, posX, posY, bkClr, this.vmsWidth, this.vmsHeight, eVmsImageType.VMS_IMAGE_TYPE_BMP.getValue(), bitmapId);
|
|
|
|
|
+ formObjDto.calSize();
|
|
|
|
|
+ formDto.addObject(formObjDto);
|
|
|
|
|
+ formData.calFormCount();
|
|
|
|
|
+
|
|
|
|
|
+ this.downloadData.setDownloadCnt(downloadCnt+1);
|
|
|
|
|
+
|
|
|
|
|
+ VmsReqDownloadForm downloadForm = new VmsReqDownloadForm(this, formData);
|
|
|
|
|
+ return sendData(downloadForm.getByteBuffer(), 10, downloadForm.getOpCodeDesc());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -682,7 +693,6 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
ApplicationConfig config = (ApplicationConfig)AppUtils.getBean(ApplicationConfig.class);
|
|
ApplicationConfig config = (ApplicationConfig)AppUtils.getBean(ApplicationConfig.class);
|
|
|
- boolean endDownload = true;
|
|
|
|
|
VmsDownloadData.VmsDownloadDataInfo[] units = this.downloadData.getUnits();
|
|
VmsDownloadData.VmsDownloadDataInfo[] units = this.downloadData.getUnits();
|
|
|
for (int ii = downloadCnt; ii < formCnt; ii++) {
|
|
for (int ii = downloadCnt; ii < formCnt; ii++) {
|
|
|
this.downloadData.setDownloadCnt(downloadCnt+1);
|
|
this.downloadData.setDownloadCnt(downloadCnt+1);
|
|
@@ -697,24 +707,18 @@ public class TbVmsCtlrDto implements Serializable {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- endDownload = false;
|
|
|
|
|
this.downloadFormId = units[ii].getVmsFormId();
|
|
this.downloadFormId = units[ii].getVmsFormId();
|
|
|
|
|
|
|
|
log.info("downloadFile: DownloadCnt: VMS {}, IDX {}, FormId {}, BitmapId {}, VMS_FORM_ID: {}", this.vmsCtlrNmbr, ii, formId, bitmapId, this.downloadFormId);
|
|
log.info("downloadFile: DownloadCnt: VMS {}, IDX {}, FormId {}, BitmapId {}, VMS_FORM_ID: {}", this.vmsCtlrNmbr, ii, formId, bitmapId, this.downloadFormId);
|
|
|
-
|
|
|
|
|
-// int fileNameSize = 11;
|
|
|
|
|
-// int fileSize = pForm.getImageData().length;
|
|
|
|
|
String fileName = String.format("BID%04d.BMP", bitmapId);
|
|
String fileName = String.format("BID%04d.BMP", bitmapId);
|
|
|
eVmsFileSaveLocation saveLoc = eVmsFileSaveLocation.LOC_DOWNLOAD_PROG_IMAGE;
|
|
eVmsFileSaveLocation saveLoc = eVmsFileSaveLocation.LOC_DOWNLOAD_PROG_IMAGE;
|
|
|
|
|
|
|
|
VmsReqDataDownload dataDownload = new VmsReqDataDownload(this, saveLoc, fileName, pForm.getImageData());
|
|
VmsReqDataDownload dataDownload = new VmsReqDataDownload(this, saveLoc, fileName, pForm.getImageData());
|
|
|
return sendData(dataDownload.getByteBuffer(), 10, dataDownload.getOpCodeDesc());
|
|
return sendData(dataDownload.getByteBuffer(), 10, dataDownload.getOpCodeDesc());
|
|
|
}
|
|
}
|
|
|
- if (endDownload) {
|
|
|
|
|
- // 폼이미지 정보가 모두 다운로드 되었으므로 스케쥴 정보를 다운로드 한다.
|
|
|
|
|
- return downloadFormSchedule(); // Display Schedule Form
|
|
|
|
|
- }
|
|
|
|
|
- return true;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 폼이미지 정보가 모두 다운로드 되었으므로 스케쥴 정보를 다운로드 한다.
|
|
|
|
|
+ return downloadFormSchedule(); // Display Schedule Form
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|