From 7243e0b4bd9a267a633d2e481e17646509b6868d Mon Sep 17 00:00:00 2001 From: YYC <1833023622@qq.com> Date: 星期四, 07 九月 2023 19:36:37 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/data/ModbusTcp.java | 85 ++++++++---------------------------------- 1 files changed, 17 insertions(+), 68 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 88d5d63..f743c9d 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,6 +1,6 @@ package com.ld.igds.protocol.modbus.data; -import com.ld.igds.constant.Constant; +import com.ld.igds.models.DeviceModbus; import lombok.Data; /** @@ -13,8 +13,9 @@ private String companyId; - - private String deviceCode; + + //涓氬姟鐩稿叧缂栫爜 + private String bizCode; private String serId; @@ -22,76 +23,24 @@ private int port; - /** - * 寮�鍦板潃 - **/ - private String addrOpen = Constant.YN_N; + private DeviceModbus deviceModbus; - /** - * 鍏冲湴鍧� - **/ - private String addrClose = Constant.YN_N; - - /** - * 鍋滃湴鍧� - **/ - private String addrStop = Constant.YN_N; - - /** - * 寮�鍒颁綅鍦板潃 - **/ - private String addrOpenEnd = Constant.YN_N; - - /** - * 鍏冲埌浣嶅湴鍧� - **/ - private String addrCloseEnd = Constant.YN_N; - - /** - * 寮�鏁呴殰鍦板潃 - **/ - private String addrOpenError = Constant.YN_N; - - /** - * 鍏虫晠闅滃湴鍧� - **/ - private String addrCloseError = Constant.YN_N; - - private int addrExe = 65535; - + private int addrExe; 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(DeviceModbus deviceModbus) { + this.deviceModbus = deviceModbus; } -// -// 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; -// } + + public ModbusTcp(String companyId, String bizCode, String serId, String ip, int port, DeviceModbus deviceModbus) { + this.companyId = companyId; + this.bizCode = bizCode; + this.serId = serId; + this.ip = ip; + this.port = port; + this.deviceModbus = deviceModbus; + } } -- Gitblit v1.9.3