Parcourir la source

dev source code refectoring

shjung il y a 1 an
Parent
commit
7423e00fab

+ 29 - 28
src/main/java/com/its/vms/xnettcp/vms/process/response/impl/VmsResParameter.java

@@ -54,15 +54,15 @@ public class VmsResParameter implements VmsResponse {
         // Byte.toUnsignedInt(
         ByteBuffer byteBuffer = ByteBuffer.wrap(body);
         byteBuffer.order(VmsDleFramePacket.BYTE_ORDER);
-        this.powerCtrlMode = byteBuffer.get() & 0xFF;
-        this.fanRunMode = byteBuffer.get() & 0xFF;
-        this.fanRunTemp = byteBuffer.get() & 0xFF;
-        this.heaterRunMode = byteBuffer.get() & 0xFF;
-        this.heaterRunTemp = byteBuffer.get() & 0xFF;
+        this.powerCtrlMode  = byteBuffer.get() & 0xFF;
+        this.fanRunMode     = byteBuffer.get() & 0xFF;
+        this.fanRunTemp     = byteBuffer.get() & 0xFF;
+        this.heaterRunMode  = byteBuffer.get() & 0xFF;
+        this.heaterRunTemp  = byteBuffer.get() & 0xFF;
         this.dispFanRunMode = byteBuffer.get() & 0xFF;
         this.dispFanRunTemp = byteBuffer.get() & 0xFF;
-        this.brightMode = byteBuffer.get() & 0xFF;  // 화면의 밝기 - 휘도 모드, 0x00:주간, 0x01:야간, 0x02:Auto, 0x03:수동
-        this.brightCurr = byteBuffer.get() & 0xFF;  // 화면의 밝기 - 현재 휘도값, 0~100
+        this.brightMode     = byteBuffer.get() & 0xFF;  // 화면의 밝기 - 휘도 모드, 0x00:주간, 0x01:야간, 0x02:Auto, 0x03:수동
+        this.brightCurr     = byteBuffer.get() & 0xFF;  // 화면의 밝기 - 현재 휘도값, 0~100
         if (body.length > 17) {
             this.brightWeek = byteBuffer.get() & 0xFF;  // 화면의 밝기 - 주간 휘도값, 0~100
             this.brightNght = byteBuffer.get() & 0xFF;  // 화면의 밝기 - 야간 휘도값, 0~100
@@ -71,15 +71,15 @@ public class VmsResParameter implements VmsResponse {
             this.brightWeek = 0;
             this.brightNght = 0;
         }
-        this.blinkTime = byteBuffer.get() & 0xFF;
+        this.blinkTime   = byteBuffer.get() & 0xFF;
         this.scnTurnTime = (short) (byteBuffer.getShort() & 0xFFFF);
         this.modlErrRate = byteBuffer.get() & 0xFF;
-        this.year = byteBuffer.get() & 0xFF;
-        this.mon = byteBuffer.get() & 0xFF;
-        this.day = byteBuffer.get() & 0xFF;
-        this.hour = byteBuffer.get() & 0xFF;
-        this.min = byteBuffer.get() & 0xFF;
-        this.sec = byteBuffer.get() & 0xFF;
+        this.year        = byteBuffer.get() & 0xFF;
+        this.mon         = byteBuffer.get() & 0xFF;
+        this.day         = byteBuffer.get() & 0xFF;
+        this.hour        = byteBuffer.get() & 0xFF;
+        this.min         = byteBuffer.get() & 0xFF;
+        this.sec         = byteBuffer.get() & 0xFF;
 
         if (this.vmsObj.getDebug().isDebug()) {
             log.info("{}", toString());
@@ -112,22 +112,23 @@ public class VmsResParameter implements VmsResponse {
     }
 
     public String toString() {
+        String lineSeparator = System.getProperty("line.separator");
         StringBuilder data = new StringBuilder();
         data.append(String.format("RESPONSE-%s. VMS %d", eVmsOpCode.OP_VMS_PARAMETER_REQ, this.vmsObj.getVmsCtlrNmbr()));
-        data.append(System.getProperty("line.separator")).append(String.format("   PANL_PWER_MODE(%02X)", this.powerCtrlMode));
-        data.append(System.getProperty("line.separator")).append(String.format("         FAN_MODE(%02X)", this.fanRunMode));
-        data.append(System.getProperty("line.separator")).append(String.format("     FAN_RUN_TMPR(%d)", this.fanRunTemp));
-        data.append(System.getProperty("line.separator")).append(String.format("        HETR_MODE(%02X)", this.heaterRunMode));
-        data.append(System.getProperty("line.separator")).append(String.format("    HETR_RUN_TMPR(%d)", this.heaterRunTemp));
-        data.append(System.getProperty("line.separator")).append(String.format("    DISP_FAN_MODE(%02X)", this.dispFanRunMode));
-        data.append(System.getProperty("line.separator")).append(String.format("DISP_FAN_RUN_TMPR(%d)", this.dispFanRunTemp));
-        data.append(System.getProperty("line.separator")).append(String.format("        BRGH_MODE(%02X)", this.brightMode));
-        data.append(System.getProperty("line.separator")).append(String.format("        BRGH_CURR(%d)", this.brightCurr));
-        data.append(System.getProperty("line.separator")).append(String.format("        BRGH_WEEK(%d)", this.brightWeek));
-        data.append(System.getProperty("line.separator")).append(String.format("        BRGH_NGHT(%d)", this.brightNght));
-        data.append(System.getProperty("line.separator")).append(String.format("       BLINK_TIME(%d)", this.blinkTime));
-        data.append(System.getProperty("line.separator")).append(String.format("    SCN_TURN_TIME(%d)", this.scnTurnTime));
-        data.append(System.getProperty("line.separator")).append(String.format("       LOCAL_TIME(%04d%02d%02d%02d%02d%02d)", this.year+2000, this.mon, this.day, this.hour, this.min, this.sec));
+        data.append(lineSeparator).append(String.format("   PANL_PWER_MODE(%02X)", this.powerCtrlMode));
+        data.append(lineSeparator).append(String.format("         FAN_MODE(%02X)", this.fanRunMode));
+        data.append(lineSeparator).append(String.format("     FAN_RUN_TMPR(%d)", this.fanRunTemp));
+        data.append(lineSeparator).append(String.format("        HETR_MODE(%02X)", this.heaterRunMode));
+        data.append(lineSeparator).append(String.format("    HETR_RUN_TMPR(%d)", this.heaterRunTemp));
+        data.append(lineSeparator).append(String.format("    DISP_FAN_MODE(%02X)", this.dispFanRunMode));
+        data.append(lineSeparator).append(String.format("DISP_FAN_RUN_TMPR(%d)", this.dispFanRunTemp));
+        data.append(lineSeparator).append(String.format("        BRGH_MODE(%02X)", this.brightMode));
+        data.append(lineSeparator).append(String.format("        BRGH_CURR(%d)", this.brightCurr));
+        data.append(lineSeparator).append(String.format("        BRGH_WEEK(%d)", this.brightWeek));
+        data.append(lineSeparator).append(String.format("        BRGH_NGHT(%d)", this.brightNght));
+        data.append(lineSeparator).append(String.format("       BLINK_TIME(%d)", this.blinkTime));
+        data.append(lineSeparator).append(String.format("    SCN_TURN_TIME(%d)", this.scnTurnTime));
+        data.append(lineSeparator).append(String.format("       LOCAL_TIME(%04d%02d%02d%02d%02d%02d)", this.year+2000, this.mon, this.day, this.hour, this.min, this.sec));
         return data.toString();
     }
 

+ 53 - 52
src/main/java/com/its/vms/xnettcp/vms/process/response/impl/VmsResStatus.java

@@ -24,22 +24,22 @@ public class VmsResStatus implements VmsResponse {
 
     private int formNo;         //표출 폼 번호, 현재 표출중인 폼 번호 : 0~9999
     private int reboot;         //재실행 여부, 0x00: 정상, 0x01: 재실행
-    private int cboxTmpr;       //온도		1	N	127 ~ -127, -128 : Unknown
-    private int cboxHum;        //습도		1	N	0 ~ 100, 101: Unknown
-    private int cboxDoor;       //Door 상태		1	N	0x00: Open, 0x01: Close, 0x09: Unknown
-    private int cboxFan;        //Fan 동작 상태		1	N	0x00: On, 0x01: Off, 0x09: Unknown
-    private int cboxHetr;       //Heater 동작 상태		1	N	0x00: On, 0x01: Off, 0x09: Unknown
-    private int tmpr;           //온도		1	N	127 ~ -127, -128 : Unknown
-    private int hum;            //습도		1	N	0 ~ 100, 101: Unknown
-    private int door;           //Door 상태		1	N	0x00: Open, 0x01: Close, 0x09: Unknown
-    private int fan;            //Fan 동작 상태		1	N	0x00: On, 0x01: Off, 0x09: Unknown
-    private int power;          //전원 ON/OFF 상태		1	N	0x00: On, 0x01: Off, 0x09: Unknown
+    private int cboxTmpr;       //온도		                1	N	127 ~ -127, -128 : Unknown
+    private int cboxHum;        //습도		                1	N	0 ~ 100, 101: Unknown
+    private int cboxDoor;       //Door 상태		            1	N	0x00: Open, 0x01: Close, 0x09: Unknown
+    private int cboxFan;        //Fan 동작 상태		        1	N	0x00: On, 0x01: Off, 0x09: Unknown
+    private int cboxHetr;       //Heater 동작 상태		    1	N	0x00: On, 0x01: Off, 0x09: Unknown
+    private int tmpr;           //온도		                1	N	127 ~ -127, -128 : Unknown
+    private int hum;            //습도		                1	N	0 ~ 100, 101: Unknown
+    private int door;           //Door 상태		            1	N	0x00: Open, 0x01: Close, 0x09: Unknown
+    private int fan;            //Fan 동작 상태		        1	N	0x00: On, 0x01: Off, 0x09: Unknown
+    private int power;          //전원 ON/OFF 상태		    1	N	0x00: On, 0x01: Off, 0x09: Unknown
     private int brghMode;       //화면의 밝기	휘도 모드	1	N	0x00:주간, 0x01:야간, 0x02:Auto, 0x03:수동
-    private int brghCurr;       //현재 휘도값	1	N	0~100
-    private int brghWeek;       //주간 휘도값	1	N	0~100
-    private int brghNght;       //야간 휘도값	1	N	0~100
-    private int powerSupply;    //전원공급장치 상태		1	N	0x00: 정상, 0x01: 에러, 0x02: Unknown
-    private int ledModl;        //LED 모듈 상태		1	N	0x00: 정상, 0x01: 불량, 0x02: Unknown
+    private int brghCurr;       //현재 휘도값	            1	N	0~100
+    private int brghWeek;       //주간 휘도값	            1	N	0~100
+    private int brghNght;       //야간 휘도값	            1	N	0~100
+    private int powerSupply;    //전원공급장치 상태		    1	N	0x00: 정상, 0x01: 에러, 0x02: Unknown
+    private int ledModl;        //LED 모듈 상태		        1	N	0x00: 정상, 0x01: 불량, 0x02: Unknown
 
     @Override
     public boolean process() {
@@ -66,25 +66,25 @@ public class VmsResStatus implements VmsResponse {
         ByteBuffer byteBuffer = ByteBuffer.wrap(body);
         byteBuffer.order(VmsDleFramePacket.BYTE_ORDER);
 
-        this.formNo = byteBuffer.getShort() & 0xFFFF; // 표출 폼 번호, 현재 표출중인 폼 번호 : 0~9999
-        this.reboot = byteBuffer.get() & 0xFF;      // 표출 폼 번호, 0x00: 정상, 0x01: 재실행
-
-        this.cboxTmpr = byteBuffer.get() & 0xFF;       //온도		1	N	127 ~ -127, -128 : Unknown
-        this.cboxHum = byteBuffer.get() & 0xFF;        //습도		1	N	0 ~ 100, 101: Unknown
-        this.cboxDoor = byteBuffer.get() & 0xFF;       //Door 상태		1	N	0x00: Open, 0x01: Close, 0x09: Unknown
-        this.cboxFan = byteBuffer.get() & 0xFF;        //Fan 동작 상태		1	N	0x00: On, 0x01: Off, 0x09: Unknown
-        this.cboxHetr = byteBuffer.get() & 0xFF;       //Heater 동작 상태		1	N	0x00: On, 0x01: Off, 0x09: Unknown
-        this.tmpr = byteBuffer.get() & 0xFF;           //온도		1	N	127 ~ -127, -128 : Unknown
-        this.hum = byteBuffer.get() & 0xFF;            //습도		1	N	0 ~ 100, 101: Unknown
-        this.door = byteBuffer.get() & 0xFF;           //Door 상태		1	N	0x00: Open, 0x01: Close, 0x09: Unknown
-        this.fan = byteBuffer.get() & 0xFF;            //Fan 동작 상태		1	N	0x00: On, 0x01: Off, 0x09: Unknown
-        this.power = byteBuffer.get() & 0xFF;          //전원 ON/OFF 상태		1	N	0x00: On, 0x01: Off, 0x09: Unknown
-        this.brghMode = byteBuffer.get() & 0xFF;       //화면의 밝기	휘도 모드	1	N	0x00:주간, 0x01:야간, 0x02:Auto, 0x03:수동
-        this.brghCurr = byteBuffer.get() & 0xFF;       //현재 휘도값	1	N	0~100
-        this.brghWeek = byteBuffer.get() & 0xFF;       //주간 휘도값	1	N	0~100
-        this.brghNght = byteBuffer.get() & 0xFF;       //야간 휘도값	1	N	0~100
-        this.powerSupply = byteBuffer.get() & 0xFF;    //전원공급장치 상태		1	N	0x00: 정상, 0x01: 에러, 0x02: Unknown
-        this.ledModl = byteBuffer.get() & 0xFF;        //LED 모듈 상태		1	N	0x00: 정상, 0x01: 불량, 0x02: Unknown
+        this.formNo = byteBuffer.getShort() & 0xFFFF;   // 표출 폼 번호, 현재 표출중인 폼 번호 : 0~9999
+        this.reboot = byteBuffer.get() & 0xFF;          // 표출 폼 번호, 0x00: 정상, 0x01: 재실행
+
+        this.cboxTmpr    = byteBuffer.get() & 0xFF;     //온도		                1	N	127 ~ -127, -128 : Unknown
+        this.cboxHum     = byteBuffer.get() & 0xFF;     //습도		                1	N	0 ~ 100, 101: Unknown
+        this.cboxDoor    = byteBuffer.get() & 0xFF;     //Door 상태		            1	N	0x00: Open, 0x01: Close, 0x09: Unknown
+        this.cboxFan     = byteBuffer.get() & 0xFF;     //Fan 동작 상태		        1	N	0x00: On, 0x01: Off, 0x09: Unknown
+        this.cboxHetr    = byteBuffer.get() & 0xFF;     //Heater 동작 상태		    1	N	0x00: On, 0x01: Off, 0x09: Unknown
+        this.tmpr        = byteBuffer.get() & 0xFF;     //온도		                1	N	127 ~ -127, -128 : Unknown
+        this.hum         = byteBuffer.get() & 0xFF;     //습도		                1	N	0 ~ 100, 101: Unknown
+        this.door        = byteBuffer.get() & 0xFF;     //Door 상태		            1	N	0x00: Open, 0x01: Close, 0x09: Unknown
+        this.fan         = byteBuffer.get() & 0xFF;     //Fan 동작 상태		        1	N	0x00: On, 0x01: Off, 0x09: Unknown
+        this.power       = byteBuffer.get() & 0xFF;     //전원 ON/OFF 상태		    1	N	0x00: On, 0x01: Off, 0x09: Unknown
+        this.brghMode    = byteBuffer.get() & 0xFF;     //화면의 밝기	휘도 모드	1	N	0x00:주간, 0x01:야간, 0x02:Auto, 0x03:수동
+        this.brghCurr    = byteBuffer.get() & 0xFF;     //현재 휘도값	            1	N	0~100
+        this.brghWeek    = byteBuffer.get() & 0xFF;     //주간 휘도값	            1	N	0~100
+        this.brghNght    = byteBuffer.get() & 0xFF;     //야간 휘도값	            1	N	0~100
+        this.powerSupply = byteBuffer.get() & 0xFF;     //전원공급장치 상태		    1	N	0x00: 정상, 0x01: 에러, 0x02: Unknown
+        this.ledModl     = byteBuffer.get() & 0xFF;     //LED 모듈 상태		        1	N	0x00: 정상, 0x01: 불량, 0x02: Unknown
 
         if (this.vmsObj.getDebug().isDebug()) {
             log.info("{}", toString());
@@ -99,44 +99,45 @@ public class VmsResStatus implements VmsResponse {
     }
 
     public String toString() {
+        String lineSeparator = System.getProperty("line.separator");
         StringBuilder data = new StringBuilder();
         data.append(String.format("RESPONSE-%s. VMS %d", eVmsOpCode.OP_VMS_STATUS_REQ, this.vmsObj.getVmsCtlrNmbr()));
-        data.append(System.getProperty("line.separator"));
+        data.append(lineSeparator);
 
         data.append(String.format("표출 폼 번호(0x%02X), ", this.formNo)); //표출 폼 번호, 현재 표출중인 폼 번호 : 0~9999
-        data.append(System.getProperty("line.separator"));
+        data.append(lineSeparator);
         data.append(String.format("재실행 여부(0x%02X), ", this.reboot)); //재실행 여부, 0x00: 정상, 0x01: 재실행
-        data.append(System.getProperty("line.separator"));
+        data.append(lineSeparator);
         data.append(String.format("제어기 - 온도(%d), ", this.cboxTmpr));       //온도		1	N	127 ~ -127, -128 : Unknown
-        data.append(System.getProperty("line.separator"));
+        data.append(lineSeparator);
         data.append(String.format("제어기 - 습도(%d), ", this.cboxHum));        //습도		1	N	0 ~ 100, 101: Unknown
-        data.append(System.getProperty("line.separator"));
+        data.append(lineSeparator);
         data.append(String.format("제어기 - Door 상태(0x%02X), ", this.cboxDoor));       //Door 상태		1	N	0x00: Open, 0x01: Close, 0x09: Unknown
-        data.append(System.getProperty("line.separator"));
+        data.append(lineSeparator);
         data.append(String.format("제어기 - Fan 동작 상태(0x%02X), ", this.cboxFan));        //Fan 동작 상태		1	N	0x00: On, 0x01: Off, 0x09: Unknown
-        data.append(System.getProperty("line.separator"));
+        data.append(lineSeparator);
         data.append(String.format("제어기 - Heater 동작 상태(0x%02X), ", this.cboxHetr));       //Heater 동작 상태		1	N	0x00: On, 0x01: Off, 0x09: Unknown
-        data.append(System.getProperty("line.separator"));
+        data.append(lineSeparator);
         data.append(String.format("표출부 - 온도(%d), ", this.tmpr));           //온도		1	N	127 ~ -127, -128 : Unknown
-        data.append(System.getProperty("line.separator"));
+        data.append(lineSeparator);
         data.append(String.format("표출부 - 습도(%d), ", this.hum));            //습도		1	N	0 ~ 100, 101: Unknown
-        data.append(System.getProperty("line.separator"));
+        data.append(lineSeparator);
         data.append(String.format("표출부 - Door 상태(0x%02X), ", this.door));           //Door 상태		1	N	0x00: Open, 0x01: Close, 0x09: Unknown
-        data.append(System.getProperty("line.separator"));
+        data.append(lineSeparator);
         data.append(String.format("표출부 - Fan 동작 상태(0x%02X), ", this.fan));            //Fan 동작 상태		1	N	0x00: On, 0x01: Off, 0x09: Unknown
-        data.append(System.getProperty("line.separator"));
+        data.append(lineSeparator);
         data.append(String.format("표출부 - 전원 ON/OFF 상태(0x%02X), ", this.power));          //전원 ON/OFF 상태		1	N	0x00: On, 0x01: Off, 0x09: Unknown
-        data.append(System.getProperty("line.separator"));
+        data.append(lineSeparator);
         data.append(String.format("표출부 - 휘도 모드(%d), ", this.brghMode));       //화면의 밝기	휘도 모드	1	N	0x00:주간, 0x01:야간, 0x02:Auto, 0x03:수동
-        data.append(System.getProperty("line.separator"));
+        data.append(lineSeparator);
         data.append(String.format("표출부 - 현재 휘도값(%d), ", this.brghCurr));       //현재 휘도값	1	N	0~100
-        data.append(System.getProperty("line.separator"));
+        data.append(lineSeparator);
         data.append(String.format("표출부 - 주간 휘도값(%d), ", this.brghWeek));       //주간 휘도값	1	N	0~100
-        data.append(System.getProperty("line.separator"));
+        data.append(lineSeparator);
         data.append(String.format("표출부 - 야간 휘도값(%d), ", this.brghNght));       //야간 휘도값	1	N	0~100
-        data.append(System.getProperty("line.separator"));
+        data.append(lineSeparator);
         data.append(String.format("표출부 - 전원공급장치 상태(0x%02X), ", this.powerSupply));    //전원공급장치 상태		1	N	0x00: 정상, 0x01: 에러, 0x02: Unknown
-        data.append(System.getProperty("line.separator"));
+        data.append(lineSeparator);
         data.append(String.format("표출부 - LED 모듈 상태(0x%02X), ", this.ledModl));        //LED 모듈 상태		1	N	0x00: 정상, 0x01: 불량, 0x02: Unknown
         return data.toString();
     }