18 changed files with 520 additions and 12 deletions
@ -0,0 +1,110 @@ |
|||||
|
package org.mobidgim.mobidigimproject.model.register; |
||||
|
|
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonInclude; |
||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
|
import lombok.Getter; |
||||
|
import lombok.Setter; |
||||
|
import org.mobidgim.mobidigimproject.model.register.enums.*; |
||||
|
import org.mobidgim.mobidigimproject.model.register.sebDTO.BoolToString; |
||||
|
import org.mobidgim.mobidigimproject.model.register.sebDTO.CanField; |
||||
|
import org.mobidgim.mobidigimproject.model.register.sebDTO.ModbusField; |
||||
|
import org.mobidgim.mobidigimproject.model.register.sebDTO.OpcUaField; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Getter |
||||
|
@Setter |
||||
|
@JsonInclude(JsonInclude.Include.NON_NULL) |
||||
|
public class RegisterDTO { |
||||
|
|
||||
|
private AnalogInputLevel AnalogInputLevel; |
||||
|
|
||||
|
private boolean ai0; |
||||
|
|
||||
|
private boolean ai1; |
||||
|
|
||||
|
private boolean ai2; |
||||
|
|
||||
|
private boolean ai3; |
||||
|
|
||||
|
private boolean di0; |
||||
|
|
||||
|
private boolean di1; |
||||
|
|
||||
|
private boolean di2; |
||||
|
|
||||
|
private boolean di3; |
||||
|
|
||||
|
private CanInput canInput; |
||||
|
|
||||
|
private DeviceType deviceType; |
||||
|
|
||||
|
private DR drOn; |
||||
|
|
||||
|
private Equipment equipment; |
||||
|
|
||||
|
private TwoByte twoByte; |
||||
|
|
||||
|
private FourByte fourByte; |
||||
|
|
||||
|
private InputDataType inputDataType; |
||||
|
|
||||
|
private OutputDataType outputDataType; |
||||
|
|
||||
|
private Protocol protocol; |
||||
|
|
||||
|
private SpeedDataSource speedDataSource; |
||||
|
|
||||
|
private String version; |
||||
|
|
||||
|
private String equipmentId; |
||||
|
|
||||
|
private String meid; |
||||
|
|
||||
|
private List<ModbusField> modbusField; |
||||
|
|
||||
|
private List<OpcUaField> opcUaField; |
||||
|
|
||||
|
private List<CanField> canField; |
||||
|
|
||||
|
@JsonProperty("ai0") |
||||
|
public String getAi0AsString(){ |
||||
|
return BoolToString.convertToAnalogPortValue(ai0); |
||||
|
} |
||||
|
|
||||
|
@JsonProperty("ai1") |
||||
|
public String getAi1AsString(){ |
||||
|
return BoolToString.convertToAnalogPortValue(ai1); |
||||
|
} |
||||
|
|
||||
|
@JsonProperty("ai2") |
||||
|
public String getAi2AsString(){ |
||||
|
return BoolToString.convertToAnalogPortValue(ai2); |
||||
|
} |
||||
|
|
||||
|
@JsonProperty("ai3") |
||||
|
public String getAi3AsString(){ |
||||
|
return BoolToString.convertToAnalogPortValue(ai3); |
||||
|
} |
||||
|
|
||||
|
@JsonProperty("di0") |
||||
|
public String getDi0AsString(){ |
||||
|
return BoolToString.convertToAnalogPortValue(di0); |
||||
|
} |
||||
|
|
||||
|
@JsonProperty("di1") |
||||
|
public String getDi1AsString(){ |
||||
|
return BoolToString.convertToAnalogPortValue(di1); |
||||
|
} |
||||
|
|
||||
|
@JsonProperty("di2") |
||||
|
public String getDi2AsString(){ |
||||
|
return BoolToString.convertToAnalogPortValue(di2); |
||||
|
} |
||||
|
|
||||
|
@JsonProperty("di3") |
||||
|
public String getDi3AsString(){ |
||||
|
return BoolToString.convertToAnalogPortValue(di3); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
package org.mobidgim.mobidigimproject.model.register.enums; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonValue; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
|
||||
|
@AllArgsConstructor |
||||
|
public enum AnalogInputLevel { |
||||
|
two("2"), |
||||
|
four("4"), |
||||
|
six("6"), |
||||
|
; |
||||
|
|
||||
|
private final String analogInput; |
||||
|
|
||||
|
@JsonValue |
||||
|
public String getAnalogInput() { |
||||
|
return analogInput; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,38 @@ |
|||||
|
package org.mobidgim.mobidigimproject.model.register.enums; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonCreator; |
||||
|
import com.fasterxml.jackson.annotation.JsonValue; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
|
||||
|
@AllArgsConstructor |
||||
|
public enum AnalogPort { |
||||
|
|
||||
|
NOT_UseD("0", false), |
||||
|
USED("1", true); |
||||
|
|
||||
|
private final String portValue; |
||||
|
private final boolean boolValue; |
||||
|
|
||||
|
@JsonCreator |
||||
|
public static AnalogPort fromPortValue(String portValue) { |
||||
|
for(AnalogPort analogPort : AnalogPort.values()) { |
||||
|
if(analogPort.portValue.equals(portValue)) { |
||||
|
return analogPort; |
||||
|
} |
||||
|
} |
||||
|
throw new IllegalArgumentException("Invalid port value: " + portValue); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@JsonValue |
||||
|
public String getPortValue() { |
||||
|
return portValue; |
||||
|
} |
||||
|
|
||||
|
public boolean toBoolValue() { |
||||
|
return boolValue; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
package org.mobidgim.mobidigimproject.model.register.enums; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonValue; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
|
||||
|
@AllArgsConstructor |
||||
|
public enum CanInput { |
||||
|
On("on"), |
||||
|
Off("off"); |
||||
|
private final String canInput; |
||||
|
|
||||
|
@JsonValue |
||||
|
public String getCanInput() { |
||||
|
return canInput; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
package org.mobidgim.mobidigimproject.model.register.enums; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonValue; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
|
||||
|
@AllArgsConstructor |
||||
|
public enum DR { |
||||
|
On("on"), |
||||
|
Off("off"); |
||||
|
|
||||
|
private final String DR; |
||||
|
|
||||
|
@JsonValue |
||||
|
public String getDR() { |
||||
|
return DR; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
package org.mobidgim.mobidigimproject.model.register.enums; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonValue; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
|
||||
|
@AllArgsConstructor |
||||
|
public enum DeviceType { |
||||
|
TIOT("TIOT"), |
||||
|
RTLS("RTLS"); |
||||
|
private final String Device; |
||||
|
|
||||
|
@JsonValue |
||||
|
public String getType() { |
||||
|
return Device; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package org.mobidgim.mobidigimproject.model.register.enums; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonValue; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
|
||||
|
@AllArgsConstructor |
||||
|
public enum Equipment { |
||||
|
ITV("ITV"), |
||||
|
RS("RS"), |
||||
|
ECH("ECH"), |
||||
|
RTG("RTG"), |
||||
|
RMG("RMG"), |
||||
|
MHC("MHC"), |
||||
|
STS("STS"); |
||||
|
private final String equipment; |
||||
|
|
||||
|
@JsonValue |
||||
|
public String getEquipment() { |
||||
|
return equipment; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
package org.mobidgim.mobidigimproject.model.register.enums; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonValue; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
|
||||
|
@AllArgsConstructor |
||||
|
public enum FourByte { |
||||
|
little("little"), |
||||
|
littleSwap("littleSwap"), |
||||
|
bigSwap("bigSwap"), |
||||
|
big("big"); |
||||
|
private final String fourByte; |
||||
|
|
||||
|
@JsonValue |
||||
|
public String getFourByte() { |
||||
|
return fourByte; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
package org.mobidgim.mobidigimproject.model.register.enums; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonValue; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
|
||||
|
@AllArgsConstructor |
||||
|
public enum InputDataType { |
||||
|
integer("integer"), |
||||
|
flo("float"), |
||||
|
bool("boolean"), |
||||
|
unsignedInteger("unsignedInteger"), |
||||
|
shor("short"), |
||||
|
unsignedShort("unsignedShort"); |
||||
|
private final String idt; |
||||
|
|
||||
|
@JsonValue |
||||
|
public String getIdt() { |
||||
|
return idt; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
package org.mobidgim.mobidigimproject.model.register.enums; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonValue; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
|
||||
|
@AllArgsConstructor |
||||
|
public enum OutputDataType { |
||||
|
integer("integer"), |
||||
|
float64("float64"), |
||||
|
bool("boolean"), |
||||
|
String("string"); |
||||
|
private final String odt; |
||||
|
|
||||
|
@JsonValue |
||||
|
public String getOdt() { |
||||
|
return odt; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
package org.mobidgim.mobidigimproject.model.register.enums; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonValue; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
|
||||
|
@AllArgsConstructor |
||||
|
public enum Protocol { |
||||
|
MODBUS("MODBUS"), |
||||
|
OPC_UA("OPC_UA"), |
||||
|
CAN("CAN"); |
||||
|
private final String protocol; |
||||
|
|
||||
|
@JsonValue |
||||
|
public String getProtocol() { |
||||
|
return protocol; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
package org.mobidgim.mobidigimproject.model.register.enums; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonValue; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
|
||||
|
@AllArgsConstructor |
||||
|
public enum SpeedDataSource { |
||||
|
CAN("CAN"), |
||||
|
GPS("GPS"); |
||||
|
private final String dataSource; |
||||
|
|
||||
|
@JsonValue |
||||
|
public String getDataSource() { |
||||
|
return dataSource; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
package org.mobidgim.mobidigimproject.model.register.enums; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonValue; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
|
||||
|
@AllArgsConstructor |
||||
|
public enum TwoByte { |
||||
|
little("little"), |
||||
|
big("big"); |
||||
|
private final String twoByte; |
||||
|
|
||||
|
@JsonValue |
||||
|
public String getTwoByte() { |
||||
|
return twoByte; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
package org.mobidgim.mobidigimproject.model.register.sebDTO; |
||||
|
|
||||
|
import org.mobidgim.mobidigimproject.model.register.enums.AnalogPort; |
||||
|
|
||||
|
public class BoolToString { |
||||
|
|
||||
|
public static String convert(boolean value){ |
||||
|
return String.valueOf(value); |
||||
|
} |
||||
|
|
||||
|
public static String convertToAnalogPortValue(boolean value){ |
||||
|
if(value){ |
||||
|
return AnalogPort.USED.getPortValue(); |
||||
|
} |
||||
|
else { |
||||
|
return AnalogPort.NOT_UseD.getPortValue(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
package org.mobidgim.mobidigimproject.model.register.sebDTO; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonInclude; |
||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
|
import lombok.Getter; |
||||
|
import lombok.Setter; |
||||
|
|
||||
|
@Getter |
||||
|
@Setter |
||||
|
@JsonInclude(JsonInclude.Include.NON_NULL) |
||||
|
public class CanField { |
||||
|
|
||||
|
private String field; |
||||
|
|
||||
|
private String id; |
||||
|
|
||||
|
@JsonProperty("odt") // output data type
|
||||
|
private String outputDataType; |
||||
|
|
||||
|
@JsonProperty("dv") // default value
|
||||
|
private String defaultValue; |
||||
|
|
||||
|
private int shift; |
||||
|
|
||||
|
private String mask; |
||||
|
|
||||
|
private String expr; // expression
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,32 @@ |
|||||
|
package org.mobidgim.mobidigimproject.model.register.sebDTO; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonInclude; |
||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
|
import lombok.Getter; |
||||
|
import lombok.Setter; |
||||
|
|
||||
|
@Getter |
||||
|
@Setter |
||||
|
@JsonInclude(JsonInclude.Include.NON_NULL) |
||||
|
public class ModbusField { |
||||
|
|
||||
|
private String field; |
||||
|
|
||||
|
@JsonProperty("idt") // input data type
|
||||
|
private String inputDataType; |
||||
|
|
||||
|
private String addr; // address
|
||||
|
|
||||
|
@JsonProperty("odt") // output data type
|
||||
|
private String outputDataType; |
||||
|
|
||||
|
@JsonProperty("dv") // default value
|
||||
|
private String defaultValue; |
||||
|
|
||||
|
private int shift; |
||||
|
|
||||
|
private String mask; |
||||
|
|
||||
|
private String expr; // expression
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,32 @@ |
|||||
|
package org.mobidgim.mobidigimproject.model.register.sebDTO; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonInclude; |
||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
|
import lombok.Getter; |
||||
|
import lombok.Setter; |
||||
|
|
||||
|
@Getter |
||||
|
@Setter |
||||
|
@JsonInclude(JsonInclude.Include.NON_NULL) // null 값 필드는 JSON에 포함하지 않음
|
||||
|
public class OpcUaField { |
||||
|
|
||||
|
private String field; |
||||
|
|
||||
|
private String ns; // name space
|
||||
|
|
||||
|
private String addr; // address
|
||||
|
|
||||
|
@JsonProperty("odt") // output data type
|
||||
|
private String outputDataType; |
||||
|
|
||||
|
@JsonProperty("dv") // default value
|
||||
|
private String defaultValue; |
||||
|
|
||||
|
private int shift; |
||||
|
|
||||
|
private String mask; |
||||
|
|
||||
|
private String expr; // expression
|
||||
|
|
||||
|
|
||||
|
} |
||||
Loading…
Reference in new issue