From dd75b36c03049be232a94d97eff1c4a5cc751fb5 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期二, 31 十月 2023 22:08:39 +0800
Subject: [PATCH] 支持设备ID切换

---
 constvar/const.go |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/constvar/const.go b/constvar/const.go
index 6cb9a3e..bb73e7e 100644
--- a/constvar/const.go
+++ b/constvar/const.go
@@ -50,7 +50,7 @@
 }
 
 func (slf *PlcMethod) Valid() bool {
-	return *slf == PlcMethodModbusTCP || *slf == PlcMethodSerial
+	return *slf == PlcMethodModbusTCP || *slf == PlcMethodSerial || *slf == PlcMethodModbusRTU
 }
 
 const (
@@ -79,3 +79,21 @@
 	ParityOdd  Parity = 2 //鍋舵牎楠�
 	ParityNull Parity = 3 //鏃犳牎楠�
 )
+
+func (p Parity) String() string {
+	switch p {
+	case ParityEven:
+		return "E"
+	case ParityOdd:
+		return "O"
+	case ParityNull:
+		return "N"
+	}
+	return ""
+}
+
+const (
+	SerfClusterStatusNull   = ""       //鏈姞鍏ラ泦缇�
+	SerfClusterStatusMaster = "master" //闆嗙兢master
+	SerfClusterStatusSlave  = "slave"  //闆嗙兢slave
+)

--
Gitblit v1.8.0