浏览代码

first dev commit

shjung 2 年之前
父节点
当前提交
9d772b9582

+ 3 - 3
conf/debug.properties

@@ -1,5 +1,5 @@
-#system debug config setting
-#Fri Aug 11 12:57:57 KST 2023
-packet-info=x
+#system debug setting configuration...
+#Fri Aug 11 16:25:40 KST 2023
+packet-info=10005
 packet-dump=x
 system-debug=true

+ 65 - 15
src/main/java/com/its/vms/api/controller/VmsControlController.java

@@ -7,13 +7,11 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang.StringUtils;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.validation.Valid;
-import java.util.NoSuchElementException;
 
 @Slf4j
 @Api(tags = "1.VMS-0.제어")
@@ -28,26 +26,78 @@ public class VmsControlController {
     @ApiOperation(value = "VMS 제어기 리셋", response = VmsControlDto.VmsControlRes.class)
     @PostMapping(value = "/reset/{ctlrNmbr}", produces = {"application/json; charset=utf8"})
     public VmsControlDto.VmsControlRes controlReset(
-            @ApiParam(name = "ctlrNmbr", value = "제어기번호", example = "10021", required = true)
+            @ApiParam(name = "ctlrNmbr", value = "제어기번호", example = "10005", required = true)
             @PathVariable("ctlrNmbr") Long ctlrNmbr,
             @ApiParam(name = "req", value = "VMS 제어기 제어 정보", example = "[ADMIN]", required = true)
-            @RequestBody @Valid final VmsControlDto.VmsControlReq req,
+            @RequestBody @Valid final VmsControlDto.VmsControlResetReq req,
             HttpServletRequest request) {
         return this.service.controlReset(ctlrNmbr, req);
     }
-    @ApiOperation(value = "VMS 제어기 리셋(CS)", response = VmsControlDto.VmsControlRes.class)
-    @PostMapping(value = "/cs/reset/{key}/{ctlrNmbr}", produces = {"application/json; charset=utf8"})
-    public VmsControlDto.VmsControlRes controlReset(
-            @PathVariable final String key,
-            @ApiParam(name = "ctlrNmbr", value = "제어기번호", example = "10021", required = true)
+
+    @ApiOperation(value = "VMS 제어기 전광판 ON/OFF 제어", response = VmsControlDto.VmsControlRes.class)
+    @PostMapping(value = "/power/{ctlrNmbr}", produces = {"application/json; charset=utf8"})
+    public VmsControlDto.VmsControlRes controlPower(
+            @ApiParam(name = "ctlrNmbr", value = "제어기번호", example = "10005", required = true)
             @PathVariable("ctlrNmbr") Long ctlrNmbr,
             @ApiParam(name = "req", value = "VMS 제어기 제어 정보", example = "[ADMIN]", required = true)
-            @RequestBody @Valid final VmsControlDto.VmsControlReq req) throws NoSuchElementException {
-        log.warn("Vms reset: {}, {}, {}", key, ctlrNmbr, req);
-        if (!StringUtils.equals(key, "abcdefg1234567890x")) {
-            throw new NoSuchElementException("Authentication key mismatched: " + ctlrNmbr);
-        }
-        return this.service.controlReset(ctlrNmbr, req);
+            @RequestBody @Valid final VmsControlDto.VmsControlPanlOnOfReq req,
+            HttpServletRequest request) {
+        return this.service.controlPanlOnOff(ctlrNmbr, req);
+    }
+
+    @ApiOperation(value = "VMS 제어기 밝기 제어", response = VmsControlDto.VmsControlRes.class)
+    @PostMapping(value = "/bright/{ctlrNmbr}", produces = {"application/json; charset=utf8"})
+    public VmsControlDto.VmsControlRes controlBright(
+            @ApiParam(name = "ctlrNmbr", value = "제어기번호", example = "10005", required = true)
+            @PathVariable("ctlrNmbr") Long ctlrNmbr,
+            @ApiParam(name = "req", value = "VMS 제어기 제어 정보", example = "[ADMIN]", required = true)
+            @RequestBody @Valid final VmsControlDto.VmsControlBrightReq req,
+            HttpServletRequest request) {
+        return this.service.controlBright(ctlrNmbr, req);
+    }
+
+    @ApiOperation(value = "VMS 제어기 FAN 제어", response = VmsControlDto.VmsControlRes.class)
+    @PostMapping(value = "/fan/{ctlrNmbr}", produces = {"application/json; charset=utf8"})
+    public VmsControlDto.VmsControlRes controlFan(
+            @ApiParam(name = "ctlrNmbr", value = "제어기번호", example = "10005", required = true)
+            @PathVariable("ctlrNmbr") Long ctlrNmbr,
+            @ApiParam(name = "req", value = "VMS 제어기 제어 정보", example = "[ADMIN]", required = true)
+            @RequestBody @Valid final VmsControlDto.VmsControlFanReq req,
+            HttpServletRequest request) {
+        return this.service.controlFan(ctlrNmbr, req);
+    }
+
+    @ApiOperation(value = "VMS 제어기 HEATER 제어", response = VmsControlDto.VmsControlRes.class)
+    @PostMapping(value = "/heater/{ctlrNmbr}", produces = {"application/json; charset=utf8"})
+    public VmsControlDto.VmsControlRes controlHeater(
+            @ApiParam(name = "ctlrNmbr", value = "제어기번호", example = "10005", required = true)
+            @PathVariable("ctlrNmbr") Long ctlrNmbr,
+            @ApiParam(name = "req", value = "VMS 제어기 제어 정보", example = "[ADMIN]", required = true)
+            @RequestBody @Valid final VmsControlDto.VmsControlHeaterReq req,
+            HttpServletRequest request) {
+        return this.service.controlHeater(ctlrNmbr, req);
+    }
+
+    @ApiOperation(value = "VMS 제어기 동작온도 설정", response = VmsControlDto.VmsControlRes.class)
+    @PostMapping(value = "/run-temp/{ctlrNmbr}", produces = {"application/json; charset=utf8"})
+    public VmsControlDto.VmsControlRes controlRunTemp(
+            @ApiParam(name = "ctlrNmbr", value = "제어기번호", example = "10005", required = true)
+            @PathVariable("ctlrNmbr") Long ctlrNmbr,
+            @ApiParam(name = "req", value = "VMS 제어기 제어 정보", example = "[ADMIN]", required = true)
+            @RequestBody @Valid final VmsControlDto.VmsControlRunTempReq req,
+            HttpServletRequest request) {
+        return this.service.controlRunTemp(ctlrNmbr, req);
+    }
+
+    @ApiOperation(value = "VMS 제어기 시간동기", response = VmsControlDto.VmsControlRes.class)
+    @PostMapping(value = "/time-sync/{ctlrNmbr}", produces = {"application/json; charset=utf8"})
+    public VmsControlDto.VmsControlRes controlTimeSync(
+            @ApiParam(name = "ctlrNmbr", value = "제어기번호", example = "10005", required = true)
+            @PathVariable("ctlrNmbr") Long ctlrNmbr,
+            @ApiParam(name = "req", value = "VMS 제어기 제어 정보", example = "[ADMIN]", required = true)
+            @RequestBody @Valid final VmsControlDto.VmsControlTimeSyncReq req,
+            HttpServletRequest request) {
+        return this.service.controlTimeSync(ctlrNmbr, req);
     }
 
 }

+ 176 - 28
src/main/java/com/its/vms/api/dto/VmsControlDto.java

@@ -7,6 +7,7 @@ import lombok.*;
 
 import javax.validation.constraints.NotEmpty;
 import javax.validation.constraints.Pattern;
+import javax.validation.constraints.PositiveOrZero;
 import javax.validation.constraints.Size;
 import java.io.Serializable;
 
@@ -19,12 +20,12 @@ import java.io.Serializable;
 public class VmsControlDto implements Serializable {
     private static final long serialVersionUID = 1L;
 
-    @ApiModel("VmsControlReq(VMS 제어기 제어 정보)")
+    @ApiModel("VmsControlResetReq(VMS 제어기 리셋)")
     @Getter
     @Setter
     @ToString
     @NoArgsConstructor//(access = AccessLevel.PROTECTED)
-    public static class VmsControlReq {
+    public static class VmsControlResetReq {
 
         @ApiModelProperty("로그인 사용자 ID")
         @JsonProperty("user_id")
@@ -33,31 +34,193 @@ public class VmsControlDto implements Serializable {
         private String userId;
 
         @Builder
-        public VmsControlReq(String user_id) {
+        public VmsControlResetReq(String user_id) {
             this.userId = user_id;
         }
     }
 
-    @ApiModel("VmsControlParamReq(VDS 제어기 파라미터설정)")
+    @ApiModel("VmsControlTimeSyncReq(VMS 제어기 시간동기)")
     @Getter
     @Setter
     @ToString
     @NoArgsConstructor//(access = AccessLevel.PROTECTED)
-    public static class VmsControlParamReq {
+    public static class VmsControlTimeSyncReq {
+
+        @ApiModelProperty("로그인 사용자 ID")
+        @JsonProperty("user_id")
+        @NotEmpty
+        @Size(min=1)
+        private String userId;
+
+        @Builder
+        public VmsControlTimeSyncReq(String user_id) {
+            this.userId = user_id;
+        }
+    }
+
+    @ApiModel("VmsControlResetReq(VMS 제어기 리셋)")
+    @Getter
+    @Setter
+    @ToString
+    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
+    public static class VmsControlPanlOnOfReq {
+
+        @ApiModelProperty("로그인 사용자 ID")
+        @JsonProperty("user_id")
+        @NotEmpty
+        @Size(min=1)
+        private String userId;
+
+        @ApiModelProperty("전광판 OnOff(0: 전원꺼짐, 1: 전원켜짐)")
+        @JsonProperty("on_off")
+        //@NotEmpty
+        //private eVmsReqBoardPower onOff;
+        @PositiveOrZero
+        private int onOff;
+
+        @Builder
+        public VmsControlPanlOnOfReq(String user_id, int on_off) {
+            this.userId = user_id;
+            this.onOff = on_off;
+        }
+    }
+
+    @ApiModel("VmsControlBrightReq(VMS 제어기 밝기 제어)")
+    @Getter
+    @Setter
+    @ToString
+    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
+    public static class VmsControlBrightReq {
+
+        @ApiModelProperty("로그인 사용자 ID")
+        @JsonProperty("user_id")
+        @NotEmpty
+        @Size(min=1)
+        private String userId;
+
+        @ApiModelProperty("밝기 제어 구분(0: 주간, 1: 야간, 2: 자동, 3: 수동)")
+        @JsonProperty("type")
+        //@NotEmpty
+        //private eVmsReqBrightControl type;
+        @PositiveOrZero
+        private int type;
+
+        @ApiModelProperty("제어값")
+        @JsonProperty("value")
+        @NotEmpty
+        private int value;
+
+        @Builder
+        public VmsControlBrightReq(String user_id, int type, int value) {
+            this.userId = user_id;
+            this.type = type;
+            this.value = value;
+        }
+    }
+
+    @ApiModel("VmsControlFanReq(VMS 제어기 FAN 제어)")
+    @Getter
+    @Setter
+    @ToString
+    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
+    public static class VmsControlFanReq {
 
         @ApiModelProperty("로그인 사용자 ID")
         @JsonProperty("user_id")
+        @NotEmpty
+        @Size(min=1)
         private String userId;
 
-        //@ApiModelProperty("계획된 메시지 동작시간")
-        //@JsonProperty("sch_msg_time")
-        //@JsonIgnore
-        //private Integer schMsgTime;
+        @ApiModelProperty("Fan 제어 구분(0: 꺼짐, 1: 켜짐, 2: 자동)")
+        @JsonProperty("type")
+        //@ApiModelProperty(dataType = "string", allowableValues = "vms_req_fan_off, vms_req_fan_on, vms_req_fan_auto", value = "Fan 제어 구분")
+        //private eVmsReqFanControl type;
+        @PositiveOrZero
+        private int type;
 
-        //@ApiModelProperty("모듈전원 OFF 온도")
-        //@JsonProperty("module_temp")
-        //@JsonIgnore
-        //private Integer moduleTemp;
+        @ApiModelProperty("제어값")
+        @JsonProperty("value")
+        @PositiveOrZero
+        private int value;
+
+        @Builder
+        public VmsControlFanReq(String user_id, int type, int value) {
+            this.userId = user_id;
+            this.type = type;
+            this.value = value;
+        }
+    }
+
+    @ApiModel("VmsControlHeaterReq(VMS 제어기 HEATER 제어)")
+    @Getter
+    @Setter
+    @ToString
+    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
+    public static class VmsControlHeaterReq {
+
+        @ApiModelProperty("로그인 사용자 ID")
+        @JsonProperty("user_id")
+        @NotEmpty
+        @Size(min=1)
+        private String userId;
+
+        @ApiModelProperty("Heater 제어 구분(0: 꺼짐, 1: 켜짐, 2: 자동)")
+        @JsonProperty("type")
+        //private eVmsReqHeaterControl type;
+        @PositiveOrZero
+        private int type;
+
+        @ApiModelProperty("제어값")
+        @JsonProperty("value")
+        private int value;
+
+        @Builder
+        public VmsControlHeaterReq(String user_id, int type, int value) {
+            this.userId = user_id;
+            this.type = type;
+            this.value = value;
+        }
+    }
+
+    @ApiModel("VmsControlRunTempReq(VMS 제어기 동작온도 설정)")
+    @Getter
+    @Setter
+    @ToString
+    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
+    public static class VmsControlRunTempReq {
+
+        @ApiModelProperty("로그인 사용자 ID")
+        @JsonProperty("user_id")
+        @NotEmpty
+        @Size(min=1)
+        private String userId;
+
+        @ApiModelProperty("FAN 동작온도값")
+        @JsonProperty("fan_run_temp")
+        private int fanRunTemp;
+
+        @ApiModelProperty("HEATER 동작온도값")
+        @JsonProperty("heater_run_temp")
+        private int heaterRunTemp;
+
+        @Builder
+        public VmsControlRunTempReq(String user_id, int fan_run_temp, int heaterRunTemp) {
+            this.userId = user_id;
+            this.fanRunTemp = fan_run_temp;
+            this.heaterRunTemp = heaterRunTemp;
+        }
+    }
+
+    @ApiModel("VmsControlParamReq(VDS 제어기 파라미터설정)")
+    @Getter
+    @Setter
+    @ToString
+    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
+    public static class VmsControlParamReq {
+
+        @ApiModelProperty("로그인 사용자 ID")
+        @JsonProperty("user_id")
+        private String userId;
 
         @ApiModelProperty("Fan 동작 기준온도")
         @JsonProperty("fan_run_tmpr")
@@ -67,21 +230,6 @@ public class VmsControlDto implements Serializable {
         @JsonProperty("hetr_run_tmpr")
         private Integer hetrRunTmpr;
 
-        //@ApiModelProperty("모듈장애 판단율")
-        //@JsonProperty("module_fail")
-        //@JsonIgnore
-        //private Integer moduleFail;
-
-        //@ApiModelProperty("재시도 횟수")
-        //@JsonProperty("retry_count")
-        //@JsonIgnore
-        //private Integer retryCount;
-
-        //@ApiModelProperty("최대응답대기시간")
-        //@JsonProperty("timeout")
-        //@JsonIgnore
-        //private Integer timeOut;
-
         @ApiModelProperty("ON 시각")
         @JsonProperty("panl_on_time")
         private String panlOnTime;

+ 256 - 47
src/main/java/com/its/vms/api/service/VmsControlService.java

@@ -1,50 +1,137 @@
 package com.its.vms.api.service;
 
 import com.its.app.utils.ItsUtils;
+import com.its.app.utils.SysUtils;
 import com.its.vms.api.dto.VmsControlDto;
+import com.its.vms.dao.mapper.VmsCtlrMapper;
 import com.its.vms.domain.NET;
 import com.its.vms.dto.TbVmsCtlrDto;
 import com.its.vms.entity.TbVmsCtrlHs;
 import com.its.vms.service.AppRepositoryService;
+import com.its.vms.xnettcp.vms.process.TcpServerSendData;
+import com.its.vms.xnettcp.vms.protocol.enums.*;
+import com.its.vms.xnettcp.vms.protocol.impl.VmsReqStatusControl;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 
 @Slf4j
 @RequiredArgsConstructor
 @Service
 public class VmsControlService {
 
+    private final VmsCtlrMapper mapper;
     private final AppRepositoryService repoService;
-    //제어유형(V01:전광판ON,V02:전광판OFF,V03:제어기리셋,V04:함체환경설정,V05:전광판ON/OFF시각설정)
-//    if      (sCtlType == "V01") sCtlType = lblV01->Caption;//"전광판ON";
-//    else if (sCtlType == "V02") sCtlType = lblV02->Caption;//"전광판OFF";
-//    else if (sCtlType == "V03") sCtlType = lblV03->Caption;//"제어기리셋";
-//    else if (sCtlType == "V04") sCtlType = lblV04->Caption;//"함체환경설정";
-//    else if (sCtlType == "V05") sCtlType = lblV05->Caption;//"전광판ON/OFF시각설정";
-//    else if (sCtlType == "V06") sCtlType = lblV06->Caption;//"운영모드변경";
-//    else if (sCtlType == "V07") sCtlType = lblV07->Caption;//"휘도제어";
-//    else if (sCtlType == "V08") sCtlType = lblV08->Caption;//"기본메시지다운로드";
-//    else if (sCtlType == "V09") sCtlType = lblV09->Caption;//"폼 표출주기";
-//    else if (sCtlType == "V10") sCtlType = lblV10->Caption;//"폼 즉시 다운로드";
 
     /**
-     * VMS 제어 이력 저장
-     * @param dto
+     * 잘못된 제어기 관리번호로 요청이 들어온 경우
+     * @param command
+     * @param userId
+     * @param vmsCtlrNmbr
+     * @return
      */
-    @Transactional
-    public void saveCtrlHs(TbVmsCtrlHs dto) {
-        //this.repoCtrlHs.insertHs(dto.getCtrlDt(), dto.getVmsCtlrNmbr(), dto.getCtrlType(), dto.getCtrlVal(), dto.getCtrlResult(), dto.getUserId());
+    public VmsControlDto.VmsControlRes unknownControlNmbr(eVmsStatusControl command, String userId, Long vmsCtlrNmbr) {
+        String ctrlType = String.format("V%02X", command.getByteValue());
+        return saveControlResult(8, "알수 없는 제어기 관리번호 입니다.", userId, vmsCtlrNmbr, ctrlType, "Unknown Nmbr: " + vmsCtlrNmbr);
     }
 
     /**
-     * VMS 정보를 메모리에서 찾는다.
+     * VMS 제어 유형별 유형 타입이 잘못된 경우
+     * @param command
+     * @param type
+     * @param userId
      * @param vmsCtlrNmbr
      * @return
      */
-    public TbVmsCtlrDto findVms(Long vmsCtlrNmbr) {
-        return this.repoService.getCtlrMap(vmsCtlrNmbr);
+    public VmsControlDto.VmsControlRes unknownControlType(eVmsStatusControl command, int type, String userId, Long vmsCtlrNmbr) {
+        String ctrlType = String.format("V%02X", command.getByteValue());
+        return saveControlResult(7, "알수 없는 제어유형 입니다.", userId, vmsCtlrNmbr, ctrlType, "Unknown Type: " + type);
+    }
+
+    /**
+     * VMS 제어 이력 저장 및 결과 리튼
+     * @param error
+     * @param message
+     * @param userId
+     * @param vmsCtlrNmbr
+     * @param ctrlType
+     * @param ctrlVal
+     * @return
+     */
+    public VmsControlDto.VmsControlRes saveControlResult(int error, String message, String userId, Long vmsCtlrNmbr, String ctrlType, String ctrlVal) {
+        this.mapper.insertVmsCtrlHs(TbVmsCtrlHs.builder()
+                .ctrlDt(ItsUtils.getSysTime())
+                .vmsCtlrNmbr(vmsCtlrNmbr)
+                .ctrlType(ctrlType)
+                .ctrlVal(ctrlVal)
+                .ctrlResult(error)
+                .userId(userId)
+                .build());
+
+        return new VmsControlDto.VmsControlRes(error, message);
+    }
+
+    /**
+     * VMS 제어기 상태 제어
+     * @param userId
+     * @param controlType
+     * @param controlData
+     * @return
+     */
+    public VmsControlDto.VmsControlRes statusControlReq(String userId, eVmsStatusControl controlType, VmsReqStatusControl controlData) {
+        byte[] body = controlData.getBody();
+        String ctrlType = String.format("V%02X", body[0]);
+        String ctrlVal = "";
+        switch(controlType) {
+            case CONTROL_SIGNBOARD_POWER: //           (0x01, "0x00.전광판 전원제어"),
+                ctrlVal  = (body[1] == (byte)(eVmsReqBoardPower.vms_req_board_power_on.getValue() & 0xFF)) ? "Board Panel Power ON" : "Board Panel Power OFF";
+                break;
+            case CONTROL_RESET: //                     (0x02, "0x02.제어기 리셋트"),
+                ctrlVal  = "Controller Reset";
+                break;
+            case CONTROL_RETRY_COUNT: //               (0x03, "0x03.통신 재시도 횟수"),
+                ctrlVal  = String.format("Retry Count 0x%02X", body[1]);
+                break;
+            case CONTROL_SYSTEM_TIME: //               (0x04, "0x04.제어기 시간 설정"),
+                byte[] sysTimeArr = new byte[14];
+                System.arraycopy(body, 1, sysTimeArr, 0, 14);
+                ctrlVal  = "System Time " + SysUtils.byteArrayToString(sysTimeArr);
+                break;
+            case CONTROL_BLINK_CYCLE: //               (0x05, "0x05.점멸시간 주기"),
+                ctrlVal  = String.format("Blink Cycle 0x%02X", body[1]);
+                break;
+            case CONTROL_BRIGHT: //                    (0x06, "0x06.밝기 제어"),
+                ctrlVal  = String.format("Bright 0x%02X, 0x%02X", body[1], body[2]);
+                break;
+            case CONTROL_FAN: //                       (0x07, "0x07.Fan 제어"),
+                ctrlVal  = String.format("Fan Control 0x%02X, 0x%02X", body[1], body[2]);
+                break;
+            case CONTROL_HEATER: //                    (0x08, "0x08.Heater 제어"),
+                ctrlVal  = String.format("Heater Control 0x%02X, 0x%02X", body[1], body[2]);
+                break;
+            case CONTROL_SCREEN_COLOR: //              (0x09, "0x09.화면 배색 제어"),
+                ctrlVal  = String.format("Screen Color 0x%02X", body[1]);
+                break;
+            case CONTROL_MODULE_ERROR_RATIO: //        (0x0A, "0x0A.장애 모듈비율(%)"),
+                ctrlVal  = String.format("Module Error Ratio 0x%02X", body[1]);
+                break;
+            case CONTROL_DEFAULT_SCENARIO_RUN_TIME: // (0x0B, "0x0B.디폴트 시나리오 동작 시간")
+                ctrlVal  = String.format("Default Scenario Run Time 0x%02X", body[1]);
+                break;
+        }
+
+        TbVmsCtlrDto vmsObj = controlData.getVmsObj();
+        if (vmsObj.getNetState() == NET.CLOSED) {
+            return saveControlResult(1, "통신이 연결되어 있지 않습니다.", userId, vmsObj.getVmsCtlrNmbr(), ctrlType, ctrlVal);
+        }
+        else {
+            /**
+             * 제어기로 상태제어 명령을 요청
+             */
+            vmsObj.addRequestData(new TcpServerSendData(eVmsOpCode.OP_VMS_STATUS_CONTROL, controlData));
+        }
+
+        return saveControlResult(0, "success: 명령을 정상적으로 전송하였습니다.", userId, vmsObj.getVmsCtlrNmbr(), ctrlType, ctrlVal);
     }
 
     /**
@@ -53,38 +140,160 @@ public class VmsControlService {
      * @param req
      * @return
      */
-    public VmsControlDto.VmsControlRes controlReset(Long vmsCtlrNmbr, VmsControlDto.VmsControlReq req) {
-        log.warn("controlReset: VMS {}, controlReset {}.", vmsCtlrNmbr, req);
-        TbVmsCtlrDto vmsObj = findVms(vmsCtlrNmbr);
-        Integer error = 0;
-        String message = "success";
+    public VmsControlDto.VmsControlRes controlReset(Long vmsCtlrNmbr, VmsControlDto.VmsControlResetReq req) {
+        log.warn("VmsControlService.controlReset: VMS {}, {}.", vmsCtlrNmbr, req);
+        eVmsStatusControl command = eVmsStatusControl.CONTROL_RESET;
+        TbVmsCtlrDto vmsObj = this.repoService.getCtlrMap(vmsCtlrNmbr);
+        if (vmsObj == null) {
+            return unknownControlNmbr(command, req.getUserId(), vmsCtlrNmbr);
+        }
+
+        VmsReqStatusControl controlData = new VmsReqStatusControl(vmsObj);
+        controlData.controlReset();
+        return statusControlReq(req.getUserId(), command, controlData);
+    }
 
+    /**
+     * VMS 제어기 리셋
+     * @param vmsCtlrNmbr
+     * @param req
+     * @return
+     */
+    public VmsControlDto.VmsControlRes controlPanlOnOff(Long vmsCtlrNmbr, VmsControlDto.VmsControlPanlOnOfReq req) {
+        log.warn("VmsControlService.controlPanlOnOff: VMS {}, {}.", vmsCtlrNmbr, req);
+        eVmsStatusControl command = eVmsStatusControl.CONTROL_SIGNBOARD_POWER;
+        TbVmsCtlrDto vmsObj = this.repoService.getCtlrMap(vmsCtlrNmbr);
         if (vmsObj == null) {
-            error = 8;
-            message = "알수 없는 제어기 입니다.";
+            return unknownControlNmbr(command, req.getUserId(), vmsCtlrNmbr);
         }
-        else {
-            if (vmsObj.getNetState() == NET.CLOSED) {
-                error = 1;
-                message = "통신이 연결되어 있지 않습니다.";
-            }
-            else {
-                if (!vmsObj.reset()) {
-                    error = 2;
-                    message = "데이터 전송 중 오류가 발생 했습니다.";
-                }
-            }
+
+        byte onOff = req.getOnOff() == 0 ? eVmsReqBoardPower.vms_req_board_power_off.getByteValue() : eVmsReqBoardPower.vms_req_board_power_on.getByteValue();
+        VmsReqStatusControl controlData = new VmsReqStatusControl(vmsObj);
+        controlData.controlSignboardPower(onOff);
+        return statusControlReq(req.getUserId(), command, controlData);
+    }
+
+    /**
+     * VMS 제어기 시간동기
+     * @param vmsCtlrNmbr
+     * @param req
+     * @return
+     */
+    public VmsControlDto.VmsControlRes controlTimeSync(Long vmsCtlrNmbr, VmsControlDto.VmsControlTimeSyncReq req) {
+        log.warn("VmsControlService.controlTimeSync: VMS {}, {}.", vmsCtlrNmbr, req);
+        eVmsStatusControl command = eVmsStatusControl.CONTROL_SYSTEM_TIME;
+        TbVmsCtlrDto vmsObj = this.repoService.getCtlrMap(vmsCtlrNmbr);
+        if (vmsObj == null) {
+            return unknownControlNmbr(command, req.getUserId(), vmsCtlrNmbr);
         }
 
-        saveCtrlHs(TbVmsCtrlHs.builder()
-                .ctrlDt(ItsUtils.getSysTime())
-                .vmsCtlrNmbr(vmsCtlrNmbr)
-                .ctrlType("V03")
-                .ctrlVal("Reset")
-                .ctrlResult(error)
-                .userId(req.getUserId())
-                .build());
-        return new VmsControlDto.VmsControlRes(error, message);
+        VmsReqStatusControl controlData = new VmsReqStatusControl(vmsObj);
+        controlData.controlSystemTime();
+        return statusControlReq(req.getUserId(), command, controlData);
+    }
+
+    /**
+     * VMS 제어기 밝기 제어
+     * @param vmsCtlrNmbr
+     * @param req
+     * @return
+     */
+    public VmsControlDto.VmsControlRes controlBright(Long vmsCtlrNmbr, VmsControlDto.VmsControlBrightReq req) {
+        log.warn("VmsControlService.controlBright: VMS {}, {}.", vmsCtlrNmbr, req);
+        eVmsStatusControl command = eVmsStatusControl.CONTROL_BRIGHT;
+        TbVmsCtlrDto vmsObj = this.repoService.getCtlrMap(vmsCtlrNmbr);
+        if (vmsObj == null) {
+            return unknownControlNmbr(command, req.getUserId(), vmsCtlrNmbr);
+        }
+
+        eVmsReqBrightControl controlType = eVmsReqBrightControl.getValue(req.getType());
+        if (controlType == null) {
+            return unknownControlType(command, req.getType(), req.getUserId(), vmsCtlrNmbr);
+        }
+
+        VmsReqStatusControl controlData = new VmsReqStatusControl(vmsObj);
+        controlData.controlBright(controlType.getByteValue(), (byte)(req.getValue() & 0xFF));
+        return statusControlReq(req.getUserId(), command, controlData);
+    }
+
+    /**
+     * VMS 제어기 FAN 제어
+     * @param vmsCtlrNmbr
+     * @param req
+     * @return
+     */
+    public VmsControlDto.VmsControlRes controlFan(Long vmsCtlrNmbr, VmsControlDto.VmsControlFanReq req) {
+        log.warn("VmsControlService.controlFan: VMS {}, {}.", vmsCtlrNmbr, req);
+        eVmsStatusControl command = eVmsStatusControl.CONTROL_FAN;
+        TbVmsCtlrDto vmsObj = this.repoService.getCtlrMap(vmsCtlrNmbr);
+        if (vmsObj == null) {
+            return unknownControlNmbr(command, req.getUserId(), vmsCtlrNmbr);
+        }
+
+        eVmsReqFanControl controlType = eVmsReqFanControl.getValue(req.getType());
+        if (controlType == null) {
+            return unknownControlType(command, req.getType(), req.getUserId(), vmsCtlrNmbr);
+        }
+
+        VmsReqStatusControl controlData = new VmsReqStatusControl(vmsObj);
+        controlData.controlFan(controlType.getByteValue(), (byte)(req.getValue() & 0xFF));
+        return statusControlReq(req.getUserId(), command, controlData);
+    }
+
+    /**
+     * VMS 제어기 HEATER 제어
+     * @param vmsCtlrNmbr
+     * @param req
+     * @return
+     */
+    public VmsControlDto.VmsControlRes controlHeater(Long vmsCtlrNmbr, VmsControlDto.VmsControlHeaterReq req) {
+        log.warn("VmsControlService.controlHeater: VMS {}, {}.", vmsCtlrNmbr, req);
+        eVmsStatusControl command = eVmsStatusControl.CONTROL_HEATER;
+        TbVmsCtlrDto vmsObj = this.repoService.getCtlrMap(vmsCtlrNmbr);
+        if (vmsObj == null) {
+            return unknownControlNmbr(command, req.getUserId(), vmsCtlrNmbr);
+        }
+
+        eVmsReqHeaterControl controlType = eVmsReqHeaterControl.getValue(req.getType());
+        if (controlType == null) {
+            return unknownControlType(command, req.getType(), req.getUserId(), vmsCtlrNmbr);
+        }
+
+        VmsReqStatusControl controlData = new VmsReqStatusControl(vmsObj);
+        controlData.controlHeater(controlType.getByteValue(), (byte)(req.getValue() & 0xFF));
+        return statusControlReq(req.getUserId(), command, controlData);
+    }
+
+    /**
+     * VMS 제어기 동작온도 설정
+     * @param vmsCtlrNmbr
+     * @param req
+     * @return
+     */
+    public VmsControlDto.VmsControlRes controlRunTemp(Long vmsCtlrNmbr, VmsControlDto.VmsControlRunTempReq req) {
+        log.warn("VmsControlService.controlRunTemp: VMS {}, {}.", vmsCtlrNmbr, req);
+        eVmsStatusControl command = eVmsStatusControl.CONTROL_FAN;
+        TbVmsCtlrDto vmsObj = this.repoService.getCtlrMap(vmsCtlrNmbr);
+        if (vmsObj == null) {
+            return unknownControlNmbr(command, req.getUserId(), vmsCtlrNmbr);
+        }
+
+        // TODO: VMS 파라미터 제어 명령이 없어서 상태제어 명령으로 처리하고 있음.
+        // 제어기 업체와 협의하여 상태제어 명령으로 처리하는 것이 맞는지 확인 필요함.
+        // 필요할 경우 파라미터 설정(다운로드) 명령을 새롭게 추가해서 처리해야 함.
+        VmsReqStatusControl controlFan = new VmsReqStatusControl(vmsObj);
+        controlFan.controlFan(eVmsReqFanControl.vms_req_fan_auto.getByteValue(), (byte)(req.getFanRunTemp() & 0xFF));
+        statusControlReq(req.getUserId(), command, controlFan);
+
+        try {
+            Thread.sleep(1000);
+        } catch (InterruptedException e) {
+            log.error("{}", e.getMessage());
+        }
+
+        VmsReqStatusControl controlHeater = new VmsReqStatusControl(vmsObj);
+        controlHeater.controlHeater(eVmsReqHeaterControl.vms_req_heater_auto.getByteValue(), (byte)(req.getHeaterRunTemp() & 0xFF));
+        return statusControlReq(req.getUserId(), command, controlHeater);
     }
 
 }

+ 8 - 11
src/main/java/com/its/vms/config/DebugConfig.java

@@ -26,27 +26,19 @@ public class DebugConfig {
 
     @PostConstruct
     private void init() {
+        loadDebugInfo();
     }
 
     public void loadDebugInfo() {
         try
         {
-            AppRepositoryService repoService = (AppRepositoryService) AppUtils.getBean(AppRepositoryService.class);
-            if (repoService == null) {
-                return;
-            }
-
-            repoService.getCtlrMap().forEach((ctlrNmbr, vmsObj) -> {
-                vmsObj.getDebug().init();
-            });
-
             String workingDir = System.getProperty("user.dir");
             FileInputStream in = null;
             try {
                 in = new FileInputStream(workingDir + "/conf/debug.properties");
             }
             catch(Exception e) {
-                log.error("{}.loadDebugInfo: Exception: {}", this.getClass().getSimpleName(), e.toString());
+                log.error("{}.loadDebugInfo: Exception1: {}", this.getClass().getSimpleName(), e.toString());
                 return;
             }
 
@@ -57,6 +49,11 @@ public class DebugConfig {
             String isDebug  = props.getProperty("system-debug",  "false").trim();
             this.isDebug = "true".equalsIgnoreCase(isDebug);
 
+            AppRepositoryService repoService = (AppRepositoryService) AppUtils.getBean(AppRepositoryService.class);
+            repoService.getCtlrMap().forEach((ctlrNmbr, vmsObj) -> {
+                vmsObj.getDebug().init();
+            });
+
             String packetDump  = props.getProperty("packet-dump",  "x").trim();
             if (!packetDump.equals("x")) {
                 List<String> packetDumps = StringUtils.split(packetDump, ",");
@@ -81,7 +78,7 @@ public class DebugConfig {
             }
         }
         catch(Exception e) {
-            log.error("{}.loadDebugInfo: Exception: {}", this.getClass().getSimpleName(), e.toString());
+            log.error("{}.loadDebugInfo: Exception2: {}", this.getClass().getSimpleName(), e.toString());
         }
     }
 

+ 1 - 1
src/main/java/com/its/vms/domain/VmsModule.java

@@ -1,6 +1,6 @@
 package com.its.vms.domain;
 
-import com.its.vms.domain.enums.eVmsReqBoardPower;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsReqBoardPower;
 import lombok.Data;
 
 import java.io.Serializable;

+ 0 - 44
src/main/java/com/its/vms/domain/enums/eVmsReqControl.java

@@ -1,44 +0,0 @@
-package com.its.vms.domain.enums;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public enum eVmsReqControl {
-
-    vms_req_control_signboard  ((byte)0x01, "0x01.signboard control"),
-    vms_req_control_initialize ((byte)0x02, "0x02.initialize(reset)"),
-    vms_req_control_luminance  ((byte)0x06, "0x03.luminance control");
-
-    private final byte value;
-    private final String string;
-
-    private static final Map<Integer, eVmsReqControl> map;
-    static {
-        map = new HashMap<>();
-        for (eVmsReqControl e : values()) {
-            map.put((int) e.value, e);
-        }
-    }
-
-    public static eVmsReqControl getValue(int value) {
-        return map.get(value);
-    }
-    public static eVmsReqControl getValue(byte value) {
-        int intValue = (value & 0xFF);
-        return map.get(intValue);
-    }
-
-    eVmsReqControl(byte value, String string) {
-        this.value  = value;
-        this.string = string;
-    }
-
-    public byte getValue() {
-        return this.value;
-    }
-
-    @Override
-    public String toString() {
-        return this.string;
-    }
-}

+ 1 - 1
src/main/java/com/its/vms/service/VmsDisplayOnOffService.java

@@ -3,7 +3,7 @@ package com.its.vms.service;
 import com.its.app.utils.Elapsed;
 import com.its.app.utils.ItsUtils;
 import com.its.vms.dao.mapper.VmsDisplayOnOffMapper;
-import com.its.vms.domain.enums.eVmsReqBoardPower;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsReqBoardPower;
 import com.its.vms.dto.TbVmsCtlrDto;
 import com.its.vms.entity.TbVmsOnOffTime;
 import com.its.vms.xnettcp.vms.process.TcpServerSendData;

+ 14 - 8
src/main/java/com/its/vms/ui/SubUI.form

@@ -390,7 +390,7 @@
         <properties/>
         <border type="none"/>
         <children>
-          <grid id="28ac8" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+          <grid id="28ac8" layout-manager="GridLayoutManager" row-count="1" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
             <margin top="2" left="0" bottom="0" right="2"/>
             <constraints>
               <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -409,25 +409,31 @@
                   <text value="제어 로그"/>
                 </properties>
               </component>
-              <component id="8bdd0" class="javax.swing.JButton" binding="btnLogClear">
+              <component id="c4e24" class="javax.swing.JCheckBox" binding="chkDebug">
                 <constraints>
-                  <grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
+                  <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
                 </constraints>
                 <properties>
                   <font name="Malgun Gothic" size="12" style="0"/>
-                  <horizontalTextPosition value="0"/>
-                  <text value="지우기"/>
+                  <text value="Debug Info "/>
                 </properties>
               </component>
-              <component id="c4e24" class="javax.swing.JCheckBox" binding="chkDebug">
+              <component id="8bdd0" class="javax.swing.JButton" binding="btnLogClear">
                 <constraints>
-                  <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+                  <grid row="0" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
                 </constraints>
                 <properties>
                   <font name="Malgun Gothic" size="12" style="0"/>
-                  <text value="Debug Info "/>
+                  <horizontalAlignment value="0"/>
+                  <horizontalTextPosition value="0"/>
+                  <text value="지우기"/>
                 </properties>
               </component>
+              <hspacer id="186c4">
+                <constraints>
+                  <grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+                </constraints>
+              </hspacer>
             </children>
           </grid>
           <scrollpane id="149c1">

+ 12 - 8
src/main/java/com/its/vms/ui/SubUI.java

@@ -2,8 +2,9 @@ package com.its.vms.ui;
 
 import com.intellij.uiDesigner.core.GridConstraints;
 import com.intellij.uiDesigner.core.GridLayoutManager;
+import com.intellij.uiDesigner.core.Spacer;
 import com.its.vms.domain.NET;
-import com.its.vms.domain.enums.eVmsReqBoardPower;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsReqBoardPower;
 import com.its.vms.dto.TbVmsCtlrDto;
 import com.its.vms.entity.TbVmsCtlrStts;
 import com.its.vms.xnettcp.vms.process.TcpServerSendData;
@@ -522,7 +523,7 @@ public abstract class SubUI {
         panel3.setLayout(new GridLayoutManager(2, 1, new Insets(0, 4, 0, 4), -1, -1));
         rootPanel.add(panel3, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, new Dimension(-1, 200), null, null, 0, false));
         final JPanel panel4 = new JPanel();
-        panel4.setLayout(new GridLayoutManager(1, 3, new Insets(2, 0, 0, 2), -1, -1));
+        panel4.setLayout(new GridLayoutManager(1, 4, new Insets(2, 0, 0, 2), -1, -1));
         panel3.add(panel4, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
         final JLabel label10 = new JLabel();
         Font label10Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label10.getFont());
@@ -531,17 +532,20 @@ public abstract class SubUI {
         label10.setIcon(new ImageIcon(getClass().getResource("/static/image/logging.png")));
         label10.setText("제어 로그");
         panel4.add(label10, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
-        btnLogClear = new JButton();
-        Font btnLogClearFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogClear.getFont());
-        if (btnLogClearFont != null) btnLogClear.setFont(btnLogClearFont);
-        btnLogClear.setHorizontalTextPosition(0);
-        btnLogClear.setText("지우기");
-        panel4.add(btnLogClear, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         chkDebug = new JCheckBox();
         Font chkDebugFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, chkDebug.getFont());
         if (chkDebugFont != null) chkDebug.setFont(chkDebugFont);
         chkDebug.setText("Debug Info ");
         panel4.add(chkDebug, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        btnLogClear = new JButton();
+        Font btnLogClearFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogClear.getFont());
+        if (btnLogClearFont != null) btnLogClear.setFont(btnLogClearFont);
+        btnLogClear.setHorizontalAlignment(0);
+        btnLogClear.setHorizontalTextPosition(0);
+        btnLogClear.setText("지우기");
+        panel4.add(btnLogClear, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final Spacer spacer1 = new Spacer();
+        panel4.add(spacer1, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
         final JScrollPane scrollPane1 = new JScrollPane();
         panel3.add(scrollPane1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
         taLog = new JTextArea();

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

@@ -113,23 +113,23 @@ public class VmsResStatus implements VmsResponse {
         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(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("Door(0x%02X), ", this.door));
+        data.append(String.format("Power(0x%02X), ", this.power));
+        data.append(String.format("Fan(0x%02X), ", this.fan));
+        data.append(String.format("Heater(0x%02X), ", this.heater));
         data.append(String.format("FormNo(%d), ", this.formNo));
-        data.append(String.format("ReBoot(%02X), ", this.reboot));
+        data.append(String.format("ReBoot(0x%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-Mode(0x%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));
+        data.append(String.format("PowerModuleStts(0x%02X), ", this.powerModuleStts));
+        data.append(String.format("ModuleStts(0x%02X), ", this.moduleStts));
+        data.append(String.format("CboxFan(0x%02X), ", this.cboxFan));
+        data.append(String.format("CboxHeater(0x%02X)", this.cboxHeather));
         return data.toString();
     }
 

+ 4 - 1
src/main/java/com/its/vms/domain/enums/eVmsReqBoardPower.java → src/main/java/com/its/vms/xnettcp/vms/protocol/enums/eVmsReqBoardPower.java

@@ -1,4 +1,4 @@
-package com.its.vms.domain.enums;
+package com.its.vms.xnettcp.vms.protocol.enums;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -35,6 +35,9 @@ public enum eVmsReqBoardPower {
     public int getValue() {
         return this.value;
     }
+    public byte getByteValue() {
+        return (byte)(this.value & 0xFF);
+    }
 
     @Override
     public String toString() {

+ 49 - 0
src/main/java/com/its/vms/xnettcp/vms/protocol/enums/eVmsReqBrightControl.java

@@ -0,0 +1,49 @@
+package com.its.vms.xnettcp.vms.protocol.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum eVmsReqBrightControl {
+
+    vms_req_bright_week   (0x00, "0.weekly"),
+    vms_req_bright_night  (0x01, "1.nighttime"),
+    vms_req_bright_auto   (0x02, "2.auto"),
+    vms_req_bright_manual (0x03, "3.manual");
+
+    private final int value;
+    private final String string;
+
+    private static final Map<Integer, eVmsReqBrightControl> map;
+    static {
+        map = new HashMap<>();
+        for (eVmsReqBrightControl e : values()) {
+            map.put(e.value, e);
+        }
+    }
+
+    public static eVmsReqBrightControl getValue(int value) {
+        return map.get(value);
+    }
+    public static eVmsReqBrightControl getValue(byte value) {
+        int intValue = (value & 0xFF);
+        return map.get(intValue);
+    }
+
+    eVmsReqBrightControl(int value, String string) {
+        this.value  = value;
+        this.string = string;
+    }
+
+    public int getValue() {
+        return this.value;
+    }
+
+    public byte getByteValue() {
+        return (byte)(this.value & 0xFF);
+    }
+
+    @Override
+    public String toString() {
+        return this.string;
+    }
+}

+ 51 - 0
src/main/java/com/its/vms/xnettcp/vms/protocol/enums/eVmsReqFanControl.java

@@ -0,0 +1,51 @@
+package com.its.vms.xnettcp.vms.protocol.enums;
+
+import io.swagger.annotations.ApiModel;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@ApiModel
+public enum eVmsReqFanControl {
+
+    vms_req_fan_off  (0x00, "0.off"),
+    vms_req_fan_on   (0x01, "1.on"),
+    vms_req_fan_auto (0x02, "2.auto");
+
+    private final int value;
+    private final String string;
+
+    private static final Map<Integer, eVmsReqFanControl> map;
+    static {
+        map = new HashMap<>();
+        for (eVmsReqFanControl e : values()) {
+            map.put(e.value, e);
+        }
+    }
+
+    public static eVmsReqFanControl getValue(int value) {
+        return map.get(value);
+    }
+    public static eVmsReqFanControl getValue(byte value) {
+        int intValue = (value & 0xFF);
+        return map.get(intValue);
+    }
+
+    eVmsReqFanControl(int value, String string) {
+        this.value  = value;
+        this.string = string;
+    }
+
+    public int getValue() {
+        return this.value;
+    }
+
+    public byte getByteValue() {
+        return (byte)(this.value & 0xFF);
+    }
+
+    @Override
+    public String toString() {
+        return this.string;
+    }
+}

+ 48 - 0
src/main/java/com/its/vms/xnettcp/vms/protocol/enums/eVmsReqHeaterControl.java

@@ -0,0 +1,48 @@
+package com.its.vms.xnettcp.vms.protocol.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum eVmsReqHeaterControl {
+
+    vms_req_heater_off  (0x00, "0.off"),
+    vms_req_heater_on   (0x01, "1.on"),
+    vms_req_heater_auto (0x02, "2.auto");
+
+    private final int value;
+    private final String string;
+
+    private static final Map<Integer, eVmsReqHeaterControl> map;
+    static {
+        map = new HashMap<>();
+        for (eVmsReqHeaterControl e : values()) {
+            map.put(e.value, e);
+        }
+    }
+
+    public static eVmsReqHeaterControl getValue(int value) {
+        return map.get(value);
+    }
+    public static eVmsReqHeaterControl getValue(byte value) {
+        int intValue = (value & 0xFF);
+        return map.get(intValue);
+    }
+
+    eVmsReqHeaterControl(int value, String string) {
+        this.value  = value;
+        this.string = string;
+    }
+
+    public int getValue() {
+        return this.value;
+    }
+
+    public byte getByteValue() {
+        return (byte)(this.value & 0xFF);
+    }
+
+    @Override
+    public String toString() {
+        return this.string;
+    }
+}

+ 1 - 1
src/main/java/com/its/vms/xnettcp/vms/protocol/enums/eVmsStatusControl.java

@@ -44,7 +44,7 @@ public enum eVmsStatusControl {
         return this.value;
     }
 
-    public int getByteValue() {
+    public byte getByteValue() {
         return (byte)(this.value & 0xFF);
     }
     @Override

+ 22 - 16
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqStatusControl.java

@@ -4,11 +4,10 @@ import com.its.app.utils.SysUtils;
 import com.its.vms.dto.TbVmsCtlrDto;
 import com.its.vms.xnettcp.vms.protocol.VmsFramePacket;
 import com.its.vms.xnettcp.vms.protocol.VmsReqFramePacket;
-import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
-import com.its.vms.xnettcp.vms.protocol.enums.eVmsProtocolVersion;
-import com.its.vms.xnettcp.vms.protocol.enums.eVmsStatusControl;
+import com.its.vms.xnettcp.vms.protocol.enums.*;
 import com.its.vms.xnettcp.vms.protocol.impl.dle.VmsDleFramePacket;
 import com.its.vms.xnettcp.vms.protocol.impl.std.VmsStdFramePacket;
+import lombok.Getter;
 import lombok.extern.slf4j.Slf4j;
 
 import java.nio.ByteBuffer;
@@ -17,6 +16,7 @@ import java.nio.ByteOrder;
 /**
  * Status Control 요청
  */
+@Getter
 @Slf4j
 public class VmsReqStatusControl extends VmsReqFramePacket {
 
@@ -43,21 +43,21 @@ public class VmsReqStatusControl extends VmsReqFramePacket {
 
     public void controlSignboardPower(int onOff) {
         this.body = new byte[2];
-        this.body[0] = (byte) eVmsStatusControl.CONTROL_SIGNBOARD_POWER.getByteValue();
+        this.body[0] = eVmsStatusControl.CONTROL_SIGNBOARD_POWER.getByteValue();
         this.body[1] = (byte)(onOff & 0xFF);
         this.framePacket.setBody(this.body);
         log.info("VmsReqStatusControl.controlSignboardPower: VMS {}, {}", this.vmsObj.getVmsCtlrNmbr(), String.format("0x%02X", this.body[1]));
     }
     public void controlReset() {
         this.body = new byte[2];
-        this.body[0] = (byte) eVmsStatusControl.CONTROL_RESET.getByteValue();
+        this.body[0] = eVmsStatusControl.CONTROL_RESET.getByteValue();
         this.body[1] = 0x00;
         this.framePacket.setBody(this.body);
         log.info("VmsReqStatusControl.controlReset: VMS {}", this.vmsObj.getVmsCtlrNmbr());
     }
     public void controlRetryCount(byte count) {
         this.body = new byte[2];
-        this.body[0] = (byte) eVmsStatusControl.CONTROL_RETRY_COUNT.getByteValue();
+        this.body[0] = eVmsStatusControl.CONTROL_RETRY_COUNT.getByteValue();
         this.body[1] = (byte)(count & 0xFF);
         this.framePacket.setBody(this.body);
         log.info("VmsReqStatusControl.controlRetryCount: VMS {}, {}", this.vmsObj.getVmsCtlrNmbr(), String.format("0x%02X", this.body[1]));
@@ -71,7 +71,7 @@ public class VmsReqStatusControl extends VmsReqFramePacket {
         ByteBuffer buffer = ByteBuffer.allocate(this.body.length);
         buffer.order(ByteOrder.BIG_ENDIAN);
 
-        buffer.put((byte) eVmsStatusControl.CONTROL_SYSTEM_TIME.getByteValue());
+        buffer.put(eVmsStatusControl.CONTROL_SYSTEM_TIME.getByteValue());
         buffer.put(tempTime);
 
         buffer.get(this.body, 0, this.body.length);
@@ -81,46 +81,52 @@ public class VmsReqStatusControl extends VmsReqFramePacket {
     }
     public void controlBlinkCycle(byte count) {
         this.body = new byte[2];
-        this.body[0] = (byte) eVmsStatusControl.CONTROL_BLINK_CYCLE.getByteValue();
+        this.body[0] = eVmsStatusControl.CONTROL_BLINK_CYCLE.getByteValue();
         this.body[1] = (byte)(count & 0xFF);
         this.framePacket.setBody(this.body);
         log.info("VmsReqStatusControl.controlBlinkCycle: VMS {}, {}", this.vmsObj.getVmsCtlrNmbr(), String.format("0x%02X", this.body[1]));
     }
     public void controlBright(byte type, byte value) {
         this.body = new byte[3];
-        this.body[0] = (byte) eVmsStatusControl.CONTROL_BRIGHT.getByteValue();
+        this.body[0] = eVmsStatusControl.CONTROL_BRIGHT.getByteValue();
         this.body[1] = (byte)(type & 0xFF);
-        this.body[2] = (byte)(value & 0xFF);
+        if (type != eVmsReqBrightControl.vms_req_bright_auto.getByteValue()) {
+            this.body[2] = (byte) (value & 0xFF);
+        }
         this.framePacket.setBody(this.body);
         log.info("VmsReqStatusControl.controlBright: VMS {}, {}, {}", this.vmsObj.getVmsCtlrNmbr(), String.format("0x%02X", this.body[1]), String.format("0x%02X", this.body[2]));
     }
     public void controlFan(byte type, byte temp) {
         this.body = new byte[3];
-        this.body[0] = (byte) eVmsStatusControl.CONTROL_FAN.getByteValue();
+        this.body[0] = eVmsStatusControl.CONTROL_FAN.getByteValue();
         this.body[1] = (byte)(type & 0xFF);
-        this.body[2] = (byte)(temp & 0xFF);
+        if (type == eVmsReqFanControl.vms_req_fan_auto.getByteValue()) {
+            this.body[2] = (byte)(temp & 0xFF);
+        }
         this.framePacket.setBody(this.body);
         log.info("VmsReqStatusControl.controlFan: VMS {}, {}, {}", this.vmsObj.getVmsCtlrNmbr(), String.format("0x%02X", this.body[1]), String.format("0x%02X", this.body[2]));
     }
     public void controlHeater(byte type, byte temp) {
         this.body = new byte[3];
-        this.body[0] = (byte) eVmsStatusControl.CONTROL_HEATER.getByteValue();
+        this.body[0] = eVmsStatusControl.CONTROL_HEATER.getByteValue();
         this.body[1] = (byte)(type & 0xFF);
-        this.body[2] = (byte)(temp & 0xFF);
+        if (type == eVmsReqHeaterControl.vms_req_heater_auto.getByteValue()) {
+            this.body[2] = (byte)(temp & 0xFF);
+        }
         this.framePacket.setBody(this.body);
         log.info("VmsReqStatusControl.controlHeater: VMS {}, {}, {}", this.vmsObj.getVmsCtlrNmbr(), String.format("0x%02X", this.body[1]), String.format("0x%02X", this.body[2]));
     }
     public void controlScreenColor(byte color) {
         // 0x01:Red, 0x02:Green, 0x03:Amber
         this.body = new byte[2];
-        this.body[0] = (byte) eVmsStatusControl.CONTROL_SCREEN_COLOR.getByteValue();
+        this.body[0] = eVmsStatusControl.CONTROL_SCREEN_COLOR.getByteValue();
         this.body[1] = (byte)(color & 0xFF);
         this.framePacket.setBody(this.body);
         log.info("VmsReqStatusControl.controlScreenColor: VMS {}, {}", this.vmsObj.getVmsCtlrNmbr(), String.format("0x%02X", this.body[1]));
     }
     public void controlModuleErrorRatio(byte percent) {
         this.body = new byte[2];
-        this.body[0] = (byte) eVmsStatusControl.CONTROL_MODULE_ERROR_RATIO.getByteValue();
+        this.body[0] = eVmsStatusControl.CONTROL_MODULE_ERROR_RATIO.getByteValue();
         this.body[1] = (byte)(percent & 0xFF);
         this.framePacket.setBody(this.body);
         log.info("VmsReqStatusControl.controlModuleErrorRatio: VMS {}, {}", this.vmsObj.getVmsCtlrNmbr(), String.format("0x%02X", this.body[1]));