zhangqian
2023-09-17 81cf60c31e0c4dc07704c517e001a89e8432d2f6
constvar/const.go
@@ -34,12 +34,23 @@
type PlcMethod string
const (
   PlcMethodModbusTCP PlcMethod = "modbusTCP"
   PlcMethodSerial    PlcMethod = "serial"
   PlcMethodModbusTCP        PlcMethod = "modbusTCP"
   PlcMethodSerial           PlcMethod = "serial"
   PlcMethodModbusTCPChinese PlcMethod = "网络"
   PlcMethodSerialChinese    PlcMethod = "串口"
)
func (slf PlcMethod) Valid() bool {
   return slf == PlcMethodModbusTCP || slf == PlcMethodSerial
func (slf *PlcMethod) ConvertToEnglish() {
   if *slf == PlcMethodModbusTCPChinese {
      *slf = PlcMethodModbusTCP
   }
   if *slf == PlcMethodSerialChinese {
      *slf = PlcMethodSerial
   }
}
func (slf *PlcMethod) Valid() bool {
   return *slf == PlcMethodModbusTCP || *slf == PlcMethodSerial
}
const (