From 664bb4d0b7799328667ffc47e39da711a77ddbfa Mon Sep 17 00:00:00 2001 From: jiazx0107@163.com <jiazx0107@163.com> Date: 星期一, 28 八月 2023 12:05:33 +0800 Subject: [PATCH] 更新MODBUS-TCP协议,调整配置2 --- igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/ServerUtil.java | 19 ++++++++++++++----- 1 files changed, 14 insertions(+), 5 deletions(-) diff --git a/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/ServerUtil.java b/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/ServerUtil.java index b31119c..84352e8 100644 --- a/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/ServerUtil.java +++ b/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/ServerUtil.java @@ -1,5 +1,6 @@ package com.ld.igds.protocol.modbus; +import com.ld.igds.constant.Constant; import com.ld.igds.util.ContextUtil; import java.util.HashMap; @@ -10,11 +11,6 @@ */ public class ServerUtil { - - /** - * 鐢ㄦ潵缂撳瓨锛孴CP璁惧鎵ц鏃堕棿璁板綍key = TCP鍞竴鏍囧織锛寁alue = 褰撳墠鎵ц鏃堕棿 - */ - public static Map<String, Long> contextExeModbusTcp = new HashMap<>(); /** @@ -38,4 +34,17 @@ return contextStatusMap; } + + + + + + public static int getAddrExe(String temp) { + if (Constant.YN_N.equals(temp)) return 65535; + if (temp.length() > 4) { + temp = temp.substring(temp.length() - 4); + } + return Integer.valueOf(temp) - 1; + } + } -- Gitblit v1.9.3