zhangqian
2023-09-14 d93d2bc56ed06b3c060ff48f49591e8c5d779230
constvar/const.go
@@ -36,10 +36,21 @@
const (
   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 (