From 3c6efb35ff0ebcca6e7104c20cde64825fddd59d Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期四, 07 九月 2023 19:35:24 +0800
Subject: [PATCH] 添加数据
---
igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/data/ModbusTcp.java | 78 +++++++++++++++++++++++++++++++++++----
1 files changed, 70 insertions(+), 8 deletions(-)
diff --git a/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/data/ModbusTcp.java b/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/data/ModbusTcp.java
index 6b1ddb0..88d5d63 100644
--- a/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/data/ModbusTcp.java
+++ b/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/data/ModbusTcp.java
@@ -1,5 +1,6 @@
package com.ld.igds.protocol.modbus.data;
+import com.ld.igds.constant.Constant;
import lombok.Data;
/**
@@ -10,7 +11,10 @@
@Data
public class ModbusTcp {
- private String deviceId;
+
+ private String companyId;
+
+ private String deviceCode;
private String serId;
@@ -18,18 +22,76 @@
private int port;
- private int addrOpen;
+ /**
+ * 寮�鍦板潃
+ **/
+ private String addrOpen = Constant.YN_N;
- private int addrClose;
+ /**
+ * 鍏冲湴鍧�
+ **/
+ private String addrClose = Constant.YN_N;
- private int addrStop;
+ /**
+ * 鍋滃湴鍧�
+ **/
+ private String addrStop = Constant.YN_N;
- private int addrOpenEnd;
+ /**
+ * 寮�鍒颁綅鍦板潃
+ **/
+ private String addrOpenEnd = Constant.YN_N;
- private int addrCloseEnd;
+ /**
+ * 鍏冲埌浣嶅湴鍧�
+ **/
+ private String addrCloseEnd = Constant.YN_N;
- private int addrOpenError;
+ /**
+ * 寮�鏁呴殰鍦板潃
+ **/
+ private String addrOpenError = Constant.YN_N;
- private int addrCloseError;
+ /**
+ * 鍏虫晠闅滃湴鍧�
+ **/
+ private String addrCloseError = Constant.YN_N;
+ private int addrExe = 65535;
+
+
+ public ModbusTcp() {
+ super();
+ }
+
+ public ModbusTcp(String modbusStr) {
+ //modbus瑙勫垯锛氬紑鍦板潃-鍏冲湴鍧�-鍋滃湴鍧�-寮�鍒颁綅-鍏冲埌浣�-寮�鏁呴殰-鍏虫晠闅滐紝鏃犲湴鍧�鐢∟浠f浛
+ String[] addr = modbusStr.split("-");
+ this.addrOpen = addr[0];
+ this.addrClose = addr[1];
+ this.addrStop = addr[2];
+ this.addrOpenEnd = addr[3];
+ this.addrCloseEnd = addr[4];
+ this.addrOpenError = addr[5];
+ this.addrCloseError = addr[6];
+ }
+//
+// public ModbusTcp(String modbusStr) {
+// //modbus瑙勫垯锛氬紑鍦板潃-鍏冲湴鍧�-鍋滃湴鍧�-寮�鍒颁綅-鍏冲埌浣�-寮�鏁呴殰-鍏虫晠闅滐紝鏃犲湴鍧�鐢∟浠f浛
+// String[] addr = modbusStr.split("-");
+// String temp = addr[0];
+// if (!Constant.YN_N.equals(temp)) this.addrOpen = temp;
+// temp = addr[1];
+// if (!Constant.YN_N.equals(temp)) this.addrClose = temp;
+// temp = addr[2];
+// if (!Constant.YN_N.equals(temp)) this.addrStop = temp;
+// temp = addr[3];
+// if (!Constant.YN_N.equals(temp)) this.addrOpenEnd = temp;
+// temp = addr[4];
+// if (!Constant.YN_N.equals(temp)) this.addrCloseEnd = temp;
+// temp = addr[5];
+// if (!Constant.YN_N.equals(temp)) this.addrOpenError = temp;
+// temp = addr[6];
+// if (!Constant.YN_N.equals(temp)) this.addrCloseError = temp;
+// }
}
--
Gitblit v1.9.3