|
|
@@ -0,0 +1,112 @@
|
|
|
+package com.its.vms.xnettcp.vms.process.response;
|
|
|
+
|
|
|
+import com.its.vms.dto.TbVmsCtlrDto;
|
|
|
+import com.its.vms.xnettcp.vms.process.TcpServerSendData;
|
|
|
+import com.its.vms.xnettcp.vms.protocol.VmsDleFramePacket;
|
|
|
+import com.its.vms.xnettcp.vms.protocol.VmsFramePacket;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+
|
|
|
+import java.nio.ByteBuffer;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@RequiredArgsConstructor
|
|
|
+public class VmsResStatus implements VmsResponse {
|
|
|
+
|
|
|
+ private final TbVmsCtlrDto vmsObj;
|
|
|
+ private final VmsFramePacket resFramePacket;
|
|
|
+ private int door; // Door Open/Close 상태, 0x00: Open, 0x01: Close, 0x09: Unknown
|
|
|
+ private int power; // 전원의 ON/OFF 상태, 0x00: On, 0x01: Off, 0x09: Unknown (Sign Board)
|
|
|
+ private int fan; // VMS Fan 동작 상태, 0x00: On, 0x01: Off, 0x09: Unknown
|
|
|
+ private int heater; // VMS Heater 동작 상태, 0x00: On, 0x01: Off, 0x09: Unknown
|
|
|
+ private int formNo; // 표출 폼 번호, 현재 표출중인 폼 번호 : 0~9999
|
|
|
+ private int reboot; // 표출 폼 번호, 0x00: 정상, 0x01: 재실행
|
|
|
+ private int cboxTemp; // 함체온도, 127 ~ -127, -128 : Unknown
|
|
|
+ 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 dpTemp; // 외부온도, -127 ~ 127, -128: Unknown
|
|
|
+ private int dpHum; // 외부습도, 0 ~ 100, 101: Unknown
|
|
|
+ private int powerModuleStts = 0x02; // 0x00: 정상, 0x01: 에러, 0x02: Unknown
|
|
|
+ private int moduleStts = 0x02; // 0x00: 정상, 0x01: 불량, 0x02: Unknown
|
|
|
+ private int cboxFan = 0x09; // 0x00: On, 0x01: Off, 0x09: Unknown
|
|
|
+ private int cboxHeather = 0x09; // 0x00: On, 0x01: Off, 0x09: Unknown
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean process() {
|
|
|
+
|
|
|
+ this.vmsObj.addRequestData(new TcpServerSendData(TcpServerSendData.DATA_REQ_POWER_MODULE_STATUS, null));
|
|
|
+
|
|
|
+ byte[] body = this.resFramePacket.getBody();
|
|
|
+ log.info("VmsResStatus.process: body length: {} ", body != null ? body.length : 0);
|
|
|
+ if (body == null || body.length < 14) {
|
|
|
+ log.error("VmsResStatus.process: body length error: {} ", body != null ? body.length : 0);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Byte.toUnsignedInt(
|
|
|
+ ByteBuffer byteBuffer = ByteBuffer.wrap(body);
|
|
|
+ byteBuffer.order(VmsDleFramePacket.BYTE_ORDER);
|
|
|
+ this.door = byteBuffer.get() & 0xFF; // Door Open/Close 상태, 0x00: Open, 0x01: Close, 0x09: Unknown
|
|
|
+ this.power = byteBuffer.get() & 0xFF; // 전원의 ON/OFF 상태, 0x00: On, 0x01: Off, 0x09: Unknown (Sign Board)
|
|
|
+ this.fan = byteBuffer.get() & 0xFF; // VMS Fan 동작 상태, 0x00: On, 0x01: Off, 0x09: Unknown
|
|
|
+ this.heater = byteBuffer.get() & 0xFF; // VMS Heater 동작 상태, 0x00: On, 0x01: Off, 0x09: Unknown
|
|
|
+ this.formNo = byteBuffer.getShort() & 0xFFFF; // 표출 폼 번호, 현재 표출중인 폼 번호 : 0~9999
|
|
|
+ this.reboot = byteBuffer.get() & 0xFF; // 표출 폼 번호, 0x00: 정상, 0x01: 재실행
|
|
|
+ this.cboxTemp = byteBuffer.get() & 0xFF; // 함체온도, 127 ~ -127, -128 : Unknown
|
|
|
+ this.brightMode = byteBuffer.get() & 0xFF; // 화면의 밝기 - 휘도 모드, 0x00:주간, 0x01:야간, 0x02:Auto, 0x03:수동
|
|
|
+ this.brightCurr = byteBuffer.get() & 0xFF; // 화면의 밝기 - 현재 휘도값, 0~100
|
|
|
+ this.brightWeek = byteBuffer.get() & 0xFF; // 화면의 밝기 - 주간 휘도값, 0~100
|
|
|
+ this.brightNght = byteBuffer.get() & 0xFF; // 화면의 밝기 - 야간 휘도값, 0~100
|
|
|
+ this.dpTemp = byteBuffer.get() & 0xFF; // 외부온도, -127 ~ 127, -128: Unknown
|
|
|
+ this.dpHum = byteBuffer.get() & 0xFF; // 외부습도, 0 ~ 100, 101: Unknown
|
|
|
+
|
|
|
+ this.cboxFan = 0x09;
|
|
|
+ this.cboxHeather = 0x09;
|
|
|
+ if (body.length >= 16) {
|
|
|
+ this.powerModuleStts = byteBuffer.get() & 0xFF; // 전원 모듈 상태, 0x00: 정상, 0x01: 에러, 0x02: Unknown
|
|
|
+ this.moduleStts = byteBuffer.get() & 0xFF; // 모듈 상태, 0x00: 정상, 0x01: 불량, 0x02: Unknown
|
|
|
+ this.cboxFan = byteBuffer.get() & 0xFF; // 함체 Fan 동작 상태, 0x00: On, 0x01: Off, 0x09: Unknown
|
|
|
+ this.cboxHeather = byteBuffer.get() & 0xFF; // 함체 Heater 동작 상태, 0x00: On, 0x01: Off, 0x09: Unknown
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ int tmpFan1 = (this.fan & 0x0F);
|
|
|
+ int tmpFan2 = (this.fan & 0xF0) >> 4;
|
|
|
+ int tmpHtr1 = (this.heater & 0x0F);
|
|
|
+ int tmpHtr2 = (this.heater & 0xF0) >> 4;
|
|
|
+ this.fan = tmpFan1;
|
|
|
+ this.cboxFan = tmpFan2;
|
|
|
+ this.heater = tmpHtr1;
|
|
|
+ this.cboxHeather = tmpHtr2;
|
|
|
+ }
|
|
|
+
|
|
|
+ log.info("{}", toString());
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String toString() {
|
|
|
+ StringBuilder data = new StringBuilder();
|
|
|
+ data.append(String.format("VMS %d, ", this.vmsObj.getVmsCtlrNmbr()));
|
|
|
+ data.append(String.format("Door(%02X), ", this.door));
|
|
|
+ data.append(String.format("Power(%02X), ", this.power));
|
|
|
+ data.append(String.format("Fan(%02X), ", this.fan));
|
|
|
+ data.append(String.format("Heater(%02X), ", this.heater));
|
|
|
+ data.append(String.format("FormNo(%d), ", this.formNo));
|
|
|
+ data.append(String.format("ReBoot(%02X), ", this.reboot));
|
|
|
+ data.append(String.format("CboxTemp(%d), ", this.cboxTemp));
|
|
|
+ data.append(String.format("B-Mode(%02X), ", this.brightMode));
|
|
|
+ data.append(String.format("B-Curr(%d), ", this.brightCurr));
|
|
|
+ data.append(String.format("B-Week(%d), ", this.brightWeek));
|
|
|
+ data.append(String.format("B-Nght(%d), ", this.brightNght));
|
|
|
+ data.append(String.format("DpTemp(%d), ", this.dpTemp));
|
|
|
+ data.append(String.format("DpHum(%d), ", this.dpHum));
|
|
|
+ data.append(String.format("PowerModuleStts(%02X), ", this.powerModuleStts));
|
|
|
+ data.append(String.format("ModuleStts(%02X), ", this.moduleStts));
|
|
|
+ data.append(String.format("CboxFan(%02X), ", this.cboxFan));
|
|
|
+ data.append(String.format("CboxHeater(%02X)", this.cboxHeather));
|
|
|
+ return data.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|