From e6c81b3916494ef51edc21774a27402d0f16c49c Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期四, 24 八月 2023 17:21:04 +0800 Subject: [PATCH] plc配置支持serial和modbusTCP两种方式 --- constvar/const.go | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diff --git a/constvar/const.go b/constvar/const.go index 20868e5..087eeb5 100644 --- a/constvar/const.go +++ b/constvar/const.go @@ -11,7 +11,8 @@ type PlcStartAddressType string const ( - PlcStartAddressTypeFinishNumber = "1" + PlcStartAddressTypeFinishNumber = 1 + PlcStartAddressTypeTotalNumber = 2 ) const ( @@ -19,3 +20,14 @@ PlcAddressDataKeyFileName = "plc_address_key" PlcAddressDataValueFileName = "plc_address_value" ) + +type PlcMethod string + +const ( + PlcMethodModbusTCP PlcMethod = "modbusTCP" + PlcMethodSerial PlcMethod = "serial" +) + +func (slf PlcMethod) Valid() bool { + return slf == PlcMethodModbusTCP || slf == PlcMethodSerial +} -- Gitblit v1.8.0