From 016d28eba8f0d8f8632828c4589a3b39274a5f02 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期三, 07 五月 2025 14:58:37 +0800
Subject: [PATCH] 1、协议命令生成器增量开发,增加实现几个设置与对应的查询命令; 2、修改陈旧bug。
---
pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd50.java | 23 -
pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd92.java | 13
pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd67.java | 23 -
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/parse/Cd_21_Down.java | 12
pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd21.java | 87 +++++++
pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd93.java | 13
pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd.java | 5
pipIrr-platform/pipIrr-mw/pipIrr-com-creator/说明.txt | 1
pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd37.java | 75 ++++++
pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd02.java | 14
pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd65.java | 23 -
pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd91.java | 23 -
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_21_Down.java | 12
pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/console/Command.java | 107 +--------
pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd66.java | 23 -
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IPUtils.java | 7
pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd3C.java | 76 ++++++
pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Deal.java | 96 ++++++++
pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd10.java | 7
19 files changed, 450 insertions(+), 190 deletions(-)
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_21_Down.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_21_Down.java
index 9bb2c88..79b2dd8 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_21_Down.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_21_Down.java
@@ -97,12 +97,12 @@
ByteUtil.hex2Bytes(para.commandCode, bsHead, index) ;
index = 0 ;
- byte[] bs = new byte[13] ;
- String[] ipPorts = cvo.ip.split(".") ;
- ByteUtilUnsigned.short2Bytes_LE(bs, (byte) Integer.parseInt(ipPorts[0]), index++);
- ByteUtilUnsigned.short2Bytes_LE(bs, (byte) Integer.parseInt(ipPorts[1]), index++);
- ByteUtilUnsigned.short2Bytes_LE(bs, (byte) Integer.parseInt(ipPorts[2]), index++);
- ByteUtilUnsigned.short2Bytes_LE(bs, (byte) Integer.parseInt(ipPorts[3]), index++);
+ byte[] bs = new byte[14] ;
+ String[] ip = cvo.ip.split("\\.") ;
+ ByteUtilUnsigned.byte2Byte(bs, (byte) Integer.parseInt(ip[0]), index++);
+ ByteUtilUnsigned.byte2Byte(bs, (byte) Integer.parseInt(ip[1]), index++);
+ ByteUtilUnsigned.byte2Byte(bs, (byte) Integer.parseInt(ip[2]), index++);
+ ByteUtilUnsigned.byte2Byte(bs, (byte) Integer.parseInt(ip[3]), index++);
ByteUtilUnsigned.short2Bytes_LE(bs, cvo.port, index);
index += 2 ;
GlCreate.createPw(bs, index);
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/parse/Cd_21_Down.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/parse/Cd_21_Down.java
index 431b97f..315c5af 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/parse/Cd_21_Down.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/parse/Cd_21_Down.java
@@ -90,12 +90,12 @@
ByteUtil.hex2Bytes(para.commandCode, bsHead, index) ;
index = 0 ;
- byte[] bs = new byte[13] ;
- String[] ipPorts = cvo.ip.split(".") ;
- ByteUtilUnsigned.short2Bytes_LE(bs, (byte) Integer.parseInt(ipPorts[0]), index++);
- ByteUtilUnsigned.short2Bytes_LE(bs, (byte) Integer.parseInt(ipPorts[1]), index++);
- ByteUtilUnsigned.short2Bytes_LE(bs, (byte) Integer.parseInt(ipPorts[2]), index++);
- ByteUtilUnsigned.short2Bytes_LE(bs, (byte) Integer.parseInt(ipPorts[3]), index++);
+ byte[] bs = new byte[14] ;
+ String[] ip = cvo.ip.split("\\.") ;
+ ByteUtilUnsigned.byte2Byte(bs, (byte) Integer.parseInt(ip[0]), index++);
+ ByteUtilUnsigned.byte2Byte(bs, (byte) Integer.parseInt(ip[1]), index++);
+ ByteUtilUnsigned.byte2Byte(bs, (byte) Integer.parseInt(ip[2]), index++);
+ ByteUtilUnsigned.byte2Byte(bs, (byte) Integer.parseInt(ip[3]), index++);
ByteUtilUnsigned.short2Bytes_LE(bs, cvo.port, index);
index += 2 ;
GlCreate.createPw(bs, index);
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IPUtils.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IPUtils.java
index c9fdac3..57af327 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IPUtils.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IPUtils.java
@@ -338,4 +338,11 @@
public static int length(final CharSequence cs) {
return cs == null ? 0 : cs.length();
}
+
+ public static void main(String[] args) {
+ String ip = "1.2.3.4";
+ if(internalIp(ip)){
+ System.out.println("鍐呴儴IP");
+ }
+ }
}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/console/Command.java b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/console/Command.java
index 9a1622a..3a2aaa6 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/console/Command.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/console/Command.java
@@ -3,14 +3,9 @@
import com.dy.common.mw.protocol.p206V1.CodeV1;
import com.dy.common.mw.protocol.p206V1.ProtocolConstantV206V1;
import com.dy.pipirrComCreator.ServerProperties;
-import com.dy.pipirrComCreator.p206V1.Cd02;
-import com.dy.pipirrComCreator.p206V1.Cd10;
-import com.dy.pipirrComCreator.p206V1.Cd92;
-import com.dy.pipirrComCreator.p206V1.Cd93;
+import com.dy.pipirrComCreator.p206V1.P206V1Deal;
import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
public class Command {
@@ -20,6 +15,7 @@
commands = new String[]{
"config 鏌ョ湅閰嶇疆淇℃伅",
"XY ... 鍗忚鍛戒护",
+ "XY -h 鍗忚鍛戒护甯姪",
"exit 閫�鍑�",
};
}
@@ -35,13 +31,17 @@
}else if(command.equals("exit")){
exit = true ;
}else if(isProtocolCom(command)){
- dealProtocolCom(command, prtWrt);
+ if(ServerProperties.protocolName.equals(ProtocolConstantV206V1.protocolName)){
+ P206V1Deal.dealProtocolCom(command, prtWrt);
+ }else{
+ out("褰撳墠涓嶆敮鎸佸崗璁�" + ServerProperties.protocolName, prtWrt) ;
+ }
}else {
outNoIdentify(prtWrt);
}
return exit ;
}
- private static boolean isProtocolCom(String command){
+ public static boolean isProtocolCom(String command){
if(ServerProperties.protocolName.equals(ProtocolConstantV206V1.protocolName)){
String[] coms = command.split(" ");
for (String com : coms){
@@ -56,89 +56,8 @@
}
return false ;
}
- private static void dealProtocolCom(String command, PrintWriter prtWrt) throws Exception{
- String[] coms = command.split(" ");
- List<String> comList = new ArrayList<>();
- for (String com : coms){
- if(!com.equals("")){
- comList.add(com) ;
- }
- }
- String com = comList.get(0) ;
- switch (com) {
- case CodeV1.cd_02: cd02(comList, prtWrt); break;
- case CodeV1.cd_10: cd10(comList, prtWrt); break;
- case CodeV1.cd_92: cd92(comList, prtWrt); break;
- case CodeV1.cd_93: cd93(comList, prtWrt); break;
- default: outNoIdentify(prtWrt); break;
- }
- }
- private static void cd02(List<String> comList, PrintWriter prtWrt)throws Exception{
- if(comList.size() > 1){
- String p = comList.get(1);
- if(p.equals("-h")){
- prtWrt.println("02[Enter](蹇冭烦鍛戒护搴旂瓟锛堥摼璺淮鎸佹姤搴旂瓟锛�)");
- }else{
- outNoIdentify(prtWrt) ;
- }
- }else{
- out(new Cd02().hex(ServerProperties.rtuAddr), prtWrt);
- }
- }
- private static void cd10(List<String> comList, PrintWriter prtWrt)throws Exception{
- if(comList.size() > 1){
- String p1 = comList.get(1);
- if(p1.equals("-h")){
- prtWrt.println("10 *...*[Enter](璁剧疆鎺у埗鍣ㄥ湴鍧�)");
- }else{
- String[] ps = params2Grp(comList) ;
- Cd10 cd = new Cd10() ;
- String msg = cd.checkParams(ps) ;
- if(msg == null){
- out(new Cd10().hex(ServerProperties.rtuAddr, ps), prtWrt);
- }else{
- out(msg, prtWrt);
- }
- }
- }else{
- outNoParams(prtWrt); ;
- }
- }
- private static void cd92(List<String> comList, PrintWriter prtWrt)throws Exception{
- if(comList.size() > 1){
- String p = comList.get(1);
- if(p.equals("-h")){
- prtWrt.println("92[Enter](骞冲彴杩滅▼寮�鍚榾闂�)");
- }else{
- outNoIdentify(prtWrt) ;
- }
- }else{
- out(new Cd92().hex(ServerProperties.rtuAddr), prtWrt);
- }
- }
- private static void cd93(List<String> comList, PrintWriter prtWrt)throws Exception{
- if(comList.size() > 1){
- String p = comList.get(1);
- if(p.equals("-h")){
- prtWrt.println("93[Enter](骞冲彴杩滅▼鍏抽棴闃�闂�)");
- }else{
- outNoIdentify(prtWrt) ;
- }
- }else{
- out(new Cd93().hex(ServerProperties.rtuAddr), prtWrt);
- }
- }
-
- private static String[] params2Grp(List<String> comList){
- String[] ps = new String[comList.size()-1] ;
- for(int i = 1; i < comList.size(); i++){
- ps[i-1] = comList.get(i) ;
- }
- return ps ;
- }
-
- private static void out(String str, PrintWriter prtWrt){
+ public static void out(String str, PrintWriter prtWrt){
prtWrt.println(str==null?"":str);
}
private static void outHelp(PrintWriter prtWrt){
@@ -149,7 +68,7 @@
}
prtWrt.println("");
}
- private static void outConfig(PrintWriter prtWrt){
+ public static void outConfig(PrintWriter prtWrt){
prtWrt.println("");
prtWrt.println("棰勫厛璁剧疆");
prtWrt.println(" 鍗忚锛�" + ServerProperties.protocolName);
@@ -159,18 +78,16 @@
prtWrt.println(" IC鍗$紪鍙凤細" + ServerProperties.icCardNo);
prtWrt.println("");
}
- private static void outNoIdentify(PrintWriter prtWrt){
+ public static void outNoIdentify(PrintWriter prtWrt){
prtWrt.println("");
prtWrt.println("鍛戒护涓嶅彲璇嗗埆锛�");
prtWrt.println("");
}
- private static void outNoParams(PrintWriter prtWrt){
+ public static void outNoParams(PrintWriter prtWrt){
prtWrt.println("");
prtWrt.println("璇疯緭鍏ュ懡浠ゅ弬鏁帮紒");
prtWrt.println("");
}
-
-
public static void main(String[] args) {
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd.java b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd.java
similarity index 87%
rename from pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd.java
rename to pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd.java
index c9e4624..b44595f 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd.java
@@ -9,11 +9,14 @@
* @Date: 2025/5/7 8:43
* @Description
*/
-public abstract class Cd {
+public abstract class P206V1Cd {
protected static final byte CTRL = (byte)0xB0 ;//鎺у埗鍩�
public abstract String checkParams(String ...params) ;
+ public abstract String helpInfo() ;
+ public abstract String hex(String rtuAddr, String ...params) throws Exception ;
+ public abstract byte[] bs(String rtuAddr, String ...params) throws Exception ;
public byte[] createHead(String rtuAddr, String code, byte ctrl)throws Exception {
byte[] bsHead = new byte[ProtocolConstantV206V1.lenHead2Code] ;
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd02.java b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd02.java
similarity index 71%
rename from pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd02.java
rename to pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd02.java
index 466312f..55bec70 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd02.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd02.java
@@ -8,20 +8,24 @@
* @Date: 2025/5/7 8:42
* @Description
*/
-public class Cd02 extends Cd {
+public class P206V1Cd02 extends P206V1Cd {
public static final String ComCode = "02" ;
public String checkParams(String ...params){
return null ;
}
+
+ public String helpInfo() {
+ return ComCode + "[Enter](蹇冭烦鍛戒护搴旂瓟锛堥摼璺淮鎸佹姤搴旂瓟锛�)" ;
+ }
/**
* 鏋勯�犲績璺虫暟鎹�
* @return 瀛楄妭鏁扮粍
* @throws Exception 寮傚父
*/
- public String hex(String rtuAddr) throws Exception {
- byte[] bytes = bs(rtuAddr) ;
+ public String hex(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = bs(rtuAddr, params) ;
String hex = ByteUtil.bytes2Hex(bytes, false) ;
return hex ;
}
@@ -31,8 +35,8 @@
* @return 瀛楄妭鏁扮粍
* @throws Exception 寮傚父
*/
- public byte[] bs(String rtuAddr) throws Exception {
- byte[] bytes = createHead(rtuAddr, ComCode, Cd.CTRL);
+ public byte[] bs(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = createHead(rtuAddr, ComCode, P206V1Cd.CTRL);
byte[] bs = new byte[1] ;
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd10.java b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd10.java
similarity index 88%
rename from pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd10.java
rename to pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd10.java
index 35d1763..33d2bff 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd10.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd10.java
@@ -9,7 +9,7 @@
* @Date: 2025/5/7 9:30
* @Description
*/
-public class Cd10 extends Cd {
+public class P206V1Cd10 extends P206V1Cd {
public static final String ComCode = "10" ;
@@ -24,6 +24,9 @@
return "鎺у埗鍣ㄥ湴鍧�鍙傛暟蹇呴』鏄�12浣嶆暟瀛�" ;
}
return null ;
+ }
+ public String helpInfo() {
+ return ComCode + " *...*[Enter](璁剧疆鎺у埗鍣ㄥ湴鍧�)" ;
}
/**
* 鏋勯�犲績璺虫暟鎹�
@@ -42,7 +45,7 @@
* @throws Exception 寮傚父
*/
public byte[] bs(String rtuAddr, String ...params) throws Exception {
- byte[] bytes = createHead(rtuAddr, ComCode, Cd.CTRL);
+ byte[] bytes = createHead(rtuAddr, ComCode, P206V1Cd.CTRL);
byte n = 0;
byte[] bs = new byte[13];
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd21.java b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd21.java
new file mode 100644
index 0000000..21375ee
--- /dev/null
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd21.java
@@ -0,0 +1,87 @@
+package com.dy.pipirrComCreator.p206V1;
+
+import com.dy.common.mw.protocol.p206V1.parse.global.GlCreate;
+import com.dy.common.util.ByteUtil;
+import com.dy.common.util.ByteUtilUnsigned;
+import com.dy.common.util.IPUtils;
+import com.dy.common.util.NumUtil;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2025/5/7 11:25
+ * @Description
+ */
+public class P206V1Cd21 extends P206V1Cd {
+
+ public static final String ComCode = "21" ;
+
+ public String checkParams(String ...params){
+ if(params.length != 2){
+ return "鍙湁IP鍜岀鍙d袱涓弬鏁�" ;
+ }
+ if(!IPUtils.ipValid(params[0])){
+ return "IP鍦板潃涓嶆纭�" ;
+ }
+ if(IPUtils.internalIp(params[0])){
+ return "IP鍦板潃蹇呴』鏄缃慖P" ;
+ }
+ if(!NumUtil.isPlusIntNumber(params[1])){
+ return "绔彛鍙峰繀椤绘槸姝f暣鏁�" ;
+ }
+ int port = Integer.parseInt(params[1]) ;
+ if(port < 1 || port > 65535){
+ return "绔彛鍙峰繀椤诲湪1-65535涔嬮棿" ;
+ }
+ return null ;
+ }
+ public String helpInfo() {
+ return ComCode + " *...* *...*[Enter](璁剧疆鏈嶅姟绔疘P鍜岀鍙�)" ;
+ }
+ /**
+ * 鏋勯�犲績璺虫暟鎹�
+ * @return 瀛楄妭鏁扮粍
+ * @throws Exception 寮傚父
+ */
+ public String hex(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = bs(rtuAddr, params) ;
+ String hex = ByteUtil.bytes2Hex(bytes, false) ;
+ return hex ;
+ }
+
+ /**
+ * 鏋勯�犲績璺虫暟鎹�
+ * @return 瀛楄妭鏁扮粍
+ * @throws Exception 寮傚父
+ */
+ public byte[] bs(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = createHead(rtuAddr, ComCode, P206V1Cd.CTRL);
+
+ byte n = 0 ;
+ byte[] bs = new byte[14] ;
+ String[] ip = params[0].split("\\.") ;
+ ByteUtilUnsigned.byte2Byte(bs, Byte.parseByte(ip[0]), n++);
+ ByteUtilUnsigned.byte2Byte(bs, Byte.parseByte(ip[1]), n++);
+ ByteUtilUnsigned.byte2Byte(bs, Byte.parseByte(ip[2]), n++);
+ ByteUtilUnsigned.byte2Byte(bs, Byte.parseByte(ip[3]), n++);
+ ByteUtilUnsigned.short2Bytes_LE(bs, Short.parseShort(params[1]), n);
+ n += 2 ;
+ GlCreate.createPw(bs, n);
+ n += 2 ;
+ GlCreate.createTp(bs, n);
+
+ bytes = ByteUtil.bytesMerge(bytes, bs);
+
+ GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑
+
+ byte[] bsTail = GlCreate.createCrcTail4P206(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓�
+
+ bytes = ByteUtil.bytesMerge(bytes, bsTail) ;
+
+ return bytes ;
+ }
+
+ public static void main(String[] args) throws Exception {
+ String[] ps = new String[]{"1.2.3.4", "123"} ;
+ new P206V1Cd21().hex("530115059980", ps) ;
+ }
+}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd37.java b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd37.java
new file mode 100644
index 0000000..206d721
--- /dev/null
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd37.java
@@ -0,0 +1,75 @@
+package com.dy.pipirrComCreator.p206V1;
+
+import com.dy.common.mw.protocol.p206V1.parse.global.GlCreate;
+import com.dy.common.util.ByteUtil;
+import com.dy.common.util.ByteUtilUnsigned;
+import com.dy.common.util.NumUtil;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2025/5/7 14:42
+ * @Description
+ */
+public class P206V1Cd37 extends P206V1Cd {
+
+ public static final String ComCode = "37" ;
+
+ public String checkParams(String ...params){
+ if(params.length != 1){
+ return "鍙湁娴侀噺閲囬泦鍛ㄦ湡涓�涓弬鏁�" ;
+ }
+ if(!NumUtil.isPlusIntNumber(params[0])){
+ return "娴侀噺閲囬泦鍛ㄦ湡蹇呴』鏄鏁存暟" ;
+ }
+ int cycle = Integer.parseInt(params[0]) ;
+ if(cycle < 1 || cycle > 32767){
+ return "娴侀噺閲囬泦鍛ㄦ湡蹇呴』鍦�1-32767涔嬮棿" ;
+ }
+ return null ;
+ }
+ public String helpInfo() {
+ return ComCode + " *...*[Enter](璁剧疆娴侀噺閲囬泦鍛ㄦ湡)" ;
+ }
+ /**
+ * 鏋勯�犲績璺虫暟鎹�
+ * @return 瀛楄妭鏁扮粍
+ * @throws Exception 寮傚父
+ */
+ public String hex(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = bs(rtuAddr, params) ;
+ String hex = ByteUtil.bytes2Hex(bytes, false) ;
+ return hex ;
+ }
+
+ /**
+ * 鏋勯�犲績璺虫暟鎹�
+ * @return 瀛楄妭鏁扮粍
+ * @throws Exception 寮傚父
+ */
+ public byte[] bs(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = createHead(rtuAddr, ComCode, P206V1Cd.CTRL);
+
+ byte n = 0 ;
+ byte[] bs = new byte[10];
+ ByteUtilUnsigned.short2Bytes_LE(bs, Short.parseShort(params[0]), n);
+ n += 2;
+ GlCreate.createPw(bs, n);
+ n += 2;
+ GlCreate.createTp(bs, n);
+
+ bytes = ByteUtil.bytesMerge(bytes, bs);
+
+ GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑
+
+ byte[] bsTail = GlCreate.createCrcTail4P206(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓�
+
+ bytes = ByteUtil.bytesMerge(bytes, bsTail) ;
+
+ return bytes ;
+ }
+
+ public static void main(String[] args) throws Exception {
+ String[] ps = new String[]{"1.2.3.4", "123"} ;
+ new P206V1Cd3C().hex("530115059980", ps) ;
+ }
+}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd3C.java b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd3C.java
new file mode 100644
index 0000000..ce36e93
--- /dev/null
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd3C.java
@@ -0,0 +1,76 @@
+package com.dy.pipirrComCreator.p206V1;
+
+import com.dy.common.mw.protocol.p206V1.parse.global.GlCreate;
+import com.dy.common.util.ByteUtil;
+import com.dy.common.util.ByteUtilUnsigned;
+import com.dy.common.util.IPUtils;
+import com.dy.common.util.NumUtil;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2025/5/7 11:25
+ * @Description
+ */
+public class P206V1Cd3C extends P206V1Cd {
+
+ public static final String ComCode = "3C" ;
+
+ public String checkParams(String ...params){
+ if(params.length != 1){
+ return "鍙湁鑷姤鍛ㄦ湡涓�涓弬鏁�" ;
+ }
+ if(!NumUtil.isPlusIntNumber(params[0])){
+ return "鑷姤鍛ㄦ湡蹇呴』鏄鏁存暟" ;
+ }
+ int cycle = Integer.parseInt(params[0]) ;
+ if(cycle < 1 || cycle > 32767){
+ return "鑷姤鍛ㄦ湡蹇呴』鍦�1-32767涔嬮棿" ;
+ }
+ return null ;
+ }
+ public String helpInfo() {
+ return ComCode + " *...*[Enter](璁剧疆鑷姤鍛ㄦ湡)" ;
+ }
+ /**
+ * 鏋勯�犲績璺虫暟鎹�
+ * @return 瀛楄妭鏁扮粍
+ * @throws Exception 寮傚父
+ */
+ public String hex(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = bs(rtuAddr, params) ;
+ String hex = ByteUtil.bytes2Hex(bytes, false) ;
+ return hex ;
+ }
+
+ /**
+ * 鏋勯�犲績璺虫暟鎹�
+ * @return 瀛楄妭鏁扮粍
+ * @throws Exception 寮傚父
+ */
+ public byte[] bs(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = createHead(rtuAddr, ComCode, P206V1Cd.CTRL);
+
+ byte n = 0 ;
+ byte[] bs = new byte[10];
+ ByteUtilUnsigned.short2Bytes_LE(bs, Short.parseShort(params[0]), n);
+ n += 2;
+ GlCreate.createPw(bs, n);
+ n += 2;
+ GlCreate.createTp(bs, n);
+
+ bytes = ByteUtil.bytesMerge(bytes, bs);
+
+ GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑
+
+ byte[] bsTail = GlCreate.createCrcTail4P206(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓�
+
+ bytes = ByteUtil.bytesMerge(bytes, bsTail) ;
+
+ return bytes ;
+ }
+
+ public static void main(String[] args) throws Exception {
+ String[] ps = new String[]{"1.2.3.4", "123"} ;
+ new P206V1Cd3C().hex("530115059980", ps) ;
+ }
+}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd02.java b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd50.java
similarity index 61%
copy from pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd02.java
copy to pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd50.java
index 466312f..f37e7ac 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd02.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd50.java
@@ -5,23 +5,26 @@
/**
* @Author: liurunyu
- * @Date: 2025/5/7 8:42
+ * @Date: 2025/5/7 14:08
* @Description
*/
-public class Cd02 extends Cd {
+public class P206V1Cd50 extends P206V1Cd {
- public static final String ComCode = "02" ;
+ public static final String ComCode = "50" ;
public String checkParams(String ...params){
return null ;
+ }
+ public String helpInfo() {
+ return ComCode + "[Enter](鏌ヨ鎺у埗鍣ㄥ湴鍧�)" ;
}
/**
* 鏋勯�犲績璺虫暟鎹�
* @return 瀛楄妭鏁扮粍
* @throws Exception 寮傚父
*/
- public String hex(String rtuAddr) throws Exception {
- byte[] bytes = bs(rtuAddr) ;
+ public String hex(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = bs(rtuAddr, params) ;
String hex = ByteUtil.bytes2Hex(bytes, false) ;
return hex ;
}
@@ -31,14 +34,8 @@
* @return 瀛楄妭鏁扮粍
* @throws Exception 寮傚父
*/
- public byte[] bs(String rtuAddr) throws Exception {
- byte[] bytes = createHead(rtuAddr, ComCode, Cd.CTRL);
-
- byte[] bs = new byte[1] ;
-
- bs[0] = (byte)0xF2 ;//鏁版嵁鍩燂細 1 涓瓧鑺傦紝F0 鐧诲綍锛� F1 閫�鍑虹櫥褰曪紝F2 鍦ㄧ嚎淇濇寔銆�
-
- bytes = ByteUtil.bytesMerge(bytes, bs) ;
+ public byte[] bs(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = createHead(rtuAddr, ComCode, P206V1Cd.CTRL);
GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd02.java b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd65.java
similarity index 61%
copy from pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd02.java
copy to pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd65.java
index 466312f..4e977ad 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd02.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd65.java
@@ -5,23 +5,26 @@
/**
* @Author: liurunyu
- * @Date: 2025/5/7 8:42
+ * @Date: 2025/5/7 14:08
* @Description
*/
-public class Cd02 extends Cd {
+public class P206V1Cd65 extends P206V1Cd {
- public static final String ComCode = "02" ;
+ public static final String ComCode = "65" ;
public String checkParams(String ...params){
return null ;
+ }
+ public String helpInfo() {
+ return ComCode + "[Enter](鏌ヨ鑷姤鍛ㄦ湡)" ;
}
/**
* 鏋勯�犲績璺虫暟鎹�
* @return 瀛楄妭鏁扮粍
* @throws Exception 寮傚父
*/
- public String hex(String rtuAddr) throws Exception {
- byte[] bytes = bs(rtuAddr) ;
+ public String hex(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = bs(rtuAddr, params) ;
String hex = ByteUtil.bytes2Hex(bytes, false) ;
return hex ;
}
@@ -31,14 +34,8 @@
* @return 瀛楄妭鏁扮粍
* @throws Exception 寮傚父
*/
- public byte[] bs(String rtuAddr) throws Exception {
- byte[] bytes = createHead(rtuAddr, ComCode, Cd.CTRL);
-
- byte[] bs = new byte[1] ;
-
- bs[0] = (byte)0xF2 ;//鏁版嵁鍩燂細 1 涓瓧鑺傦紝F0 鐧诲綍锛� F1 閫�鍑虹櫥褰曪紝F2 鍦ㄧ嚎淇濇寔銆�
-
- bytes = ByteUtil.bytesMerge(bytes, bs) ;
+ public byte[] bs(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = createHead(rtuAddr, ComCode, P206V1Cd.CTRL);
GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd02.java b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd66.java
similarity index 61%
copy from pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd02.java
copy to pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd66.java
index 466312f..66a9275 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd02.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd66.java
@@ -5,23 +5,26 @@
/**
* @Author: liurunyu
- * @Date: 2025/5/7 8:42
+ * @Date: 2025/5/7 14:08
* @Description
*/
-public class Cd02 extends Cd {
+public class P206V1Cd66 extends P206V1Cd {
- public static final String ComCode = "02" ;
+ public static final String ComCode = "66" ;
public String checkParams(String ...params){
return null ;
+ }
+ public String helpInfo() {
+ return ComCode + "[Enter](鏌ヨ鏈嶅姟绔疘P鍜岀鍙�)" ;
}
/**
* 鏋勯�犲績璺虫暟鎹�
* @return 瀛楄妭鏁扮粍
* @throws Exception 寮傚父
*/
- public String hex(String rtuAddr) throws Exception {
- byte[] bytes = bs(rtuAddr) ;
+ public String hex(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = bs(rtuAddr, params) ;
String hex = ByteUtil.bytes2Hex(bytes, false) ;
return hex ;
}
@@ -31,14 +34,8 @@
* @return 瀛楄妭鏁扮粍
* @throws Exception 寮傚父
*/
- public byte[] bs(String rtuAddr) throws Exception {
- byte[] bytes = createHead(rtuAddr, ComCode, Cd.CTRL);
-
- byte[] bs = new byte[1] ;
-
- bs[0] = (byte)0xF2 ;//鏁版嵁鍩燂細 1 涓瓧鑺傦紝F0 鐧诲綍锛� F1 閫�鍑虹櫥褰曪紝F2 鍦ㄧ嚎淇濇寔銆�
-
- bytes = ByteUtil.bytesMerge(bytes, bs) ;
+ public byte[] bs(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = createHead(rtuAddr, ComCode, P206V1Cd.CTRL);
GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd02.java b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd67.java
similarity index 61%
copy from pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd02.java
copy to pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd67.java
index 466312f..b5754f8 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd02.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd67.java
@@ -5,23 +5,26 @@
/**
* @Author: liurunyu
- * @Date: 2025/5/7 8:42
+ * @Date: 2025/5/7 14:08
* @Description
*/
-public class Cd02 extends Cd {
+public class P206V1Cd67 extends P206V1Cd {
- public static final String ComCode = "02" ;
+ public static final String ComCode = "67" ;
public String checkParams(String ...params){
return null ;
+ }
+ public String helpInfo() {
+ return ComCode + "[Enter](鏌ヨ鏌ヨ娴侀噺閲囬泦鍛ㄦ湡)" ;
}
/**
* 鏋勯�犲績璺虫暟鎹�
* @return 瀛楄妭鏁扮粍
* @throws Exception 寮傚父
*/
- public String hex(String rtuAddr) throws Exception {
- byte[] bytes = bs(rtuAddr) ;
+ public String hex(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = bs(rtuAddr, params) ;
String hex = ByteUtil.bytes2Hex(bytes, false) ;
return hex ;
}
@@ -31,14 +34,8 @@
* @return 瀛楄妭鏁扮粍
* @throws Exception 寮傚父
*/
- public byte[] bs(String rtuAddr) throws Exception {
- byte[] bytes = createHead(rtuAddr, ComCode, Cd.CTRL);
-
- byte[] bs = new byte[1] ;
-
- bs[0] = (byte)0xF2 ;//鏁版嵁鍩燂細 1 涓瓧鑺傦紝F0 鐧诲綍锛� F1 閫�鍑虹櫥褰曪紝F2 鍦ㄧ嚎淇濇寔銆�
-
- bytes = ByteUtil.bytesMerge(bytes, bs) ;
+ public byte[] bs(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = createHead(rtuAddr, ComCode, P206V1Cd.CTRL);
GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd02.java b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd91.java
similarity index 61%
copy from pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd02.java
copy to pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd91.java
index 466312f..7bba4d7 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd02.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd91.java
@@ -5,23 +5,26 @@
/**
* @Author: liurunyu
- * @Date: 2025/5/7 8:42
+ * @Date: 2025/5/7 14:08
* @Description
*/
-public class Cd02 extends Cd {
+public class P206V1Cd91 extends P206V1Cd {
- public static final String ComCode = "02" ;
+ public static final String ComCode = "91" ;
public String checkParams(String ...params){
return null ;
+ }
+ public String helpInfo() {
+ return ComCode + "[Enter](娓呯┖鍘嗗彶璁板綍)" ;
}
/**
* 鏋勯�犲績璺虫暟鎹�
* @return 瀛楄妭鏁扮粍
* @throws Exception 寮傚父
*/
- public String hex(String rtuAddr) throws Exception {
- byte[] bytes = bs(rtuAddr) ;
+ public String hex(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = bs(rtuAddr, params) ;
String hex = ByteUtil.bytes2Hex(bytes, false) ;
return hex ;
}
@@ -31,14 +34,8 @@
* @return 瀛楄妭鏁扮粍
* @throws Exception 寮傚父
*/
- public byte[] bs(String rtuAddr) throws Exception {
- byte[] bytes = createHead(rtuAddr, ComCode, Cd.CTRL);
-
- byte[] bs = new byte[1] ;
-
- bs[0] = (byte)0xF2 ;//鏁版嵁鍩燂細 1 涓瓧鑺傦紝F0 鐧诲綍锛� F1 閫�鍑虹櫥褰曪紝F2 鍦ㄧ嚎淇濇寔銆�
-
- bytes = ByteUtil.bytesMerge(bytes, bs) ;
+ public byte[] bs(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = createHead(rtuAddr, ComCode, P206V1Cd.CTRL);
GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd92.java b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd92.java
similarity index 74%
rename from pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd92.java
rename to pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd92.java
index 245fc8c..cc9dd02 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd92.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd92.java
@@ -8,7 +8,7 @@
* @Date: 2025/5/7 10:36
* @Description
*/
-public class Cd92 extends Cd {
+public class P206V1Cd92 extends P206V1Cd {
public static final String ComCode = "92" ;
@@ -20,13 +20,16 @@
public String checkParams(String ...params){
return null ;
}
+ public String helpInfo() {
+ return ComCode + "[Enter](骞冲彴杩滅▼寮�鍚榾闂�)" ;
+ }
/**
* 鏋勯�犲績璺虫暟鎹�
* @return 瀛楄妭鏁扮粍
* @throws Exception 寮傚父
*/
- public String hex(String rtuAddr) throws Exception {
- byte[] bytes = bs(rtuAddr) ;
+ public String hex(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = bs(rtuAddr,params) ;
String hex = ByteUtil.bytes2Hex(bytes, false) ;
return hex ;
}
@@ -36,8 +39,8 @@
* @return 瀛楄妭鏁扮粍
* @throws Exception 寮傚父
*/
- public byte[] bs(String rtuAddr) throws Exception {
- byte[] bytes = createHead(rtuAddr, ComCode, Cd.CTRL);
+ public byte[] bs(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = createHead(rtuAddr, ComCode, P206V1Cd.CTRL);
byte n = 0 ;
byte[] bs = new byte[9] ;
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd93.java b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd93.java
similarity index 74%
rename from pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd93.java
rename to pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd93.java
index 0000b59..b011e30 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/Cd93.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Cd93.java
@@ -8,7 +8,7 @@
* @Date: 2025/5/7 10:38
* @Description
*/
-public class Cd93 extends Cd {
+public class P206V1Cd93 extends P206V1Cd {
public static final String ComCode = "93" ;
@@ -20,13 +20,16 @@
public String checkParams(String ...params){
return null ;
}
+ public String helpInfo() {
+ return ComCode + "[Enter](骞冲彴杩滅▼鍏抽棴闃�闂�)" ;
+ }
/**
* 鏋勯�犲績璺虫暟鎹�
* @return 瀛楄妭鏁扮粍
* @throws Exception 寮傚父
*/
- public String hex(String rtuAddr) throws Exception {
- byte[] bytes = bs(rtuAddr) ;
+ public String hex(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = bs(rtuAddr, params) ;
String hex = ByteUtil.bytes2Hex(bytes, false) ;
return hex ;
}
@@ -36,8 +39,8 @@
* @return 瀛楄妭鏁扮粍
* @throws Exception 寮傚父
*/
- public byte[] bs(String rtuAddr) throws Exception {
- byte[] bytes = createHead(rtuAddr, ComCode, Cd.CTRL);
+ public byte[] bs(String rtuAddr, String ...params) throws Exception {
+ byte[] bytes = createHead(rtuAddr, ComCode, P206V1Cd.CTRL);
byte n = 0 ;
byte[] bs = new byte[9] ;
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Deal.java b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Deal.java
new file mode 100644
index 0000000..29184d3
--- /dev/null
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/src/main/java/com/dy/pipirrComCreator/p206V1/P206V1Deal.java
@@ -0,0 +1,96 @@
+package com.dy.pipirrComCreator.p206V1;
+
+import com.dy.common.mw.protocol.p206V1.CodeV1;
+import com.dy.pipirrComCreator.ServerProperties;
+import com.dy.pipirrComCreator.console.Command;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2025/5/7 11:17
+ * @Description
+ */
+public class P206V1Deal {
+
+ public static void dealProtocolCom(String command, PrintWriter prtWrt) throws Exception{
+ String[] coms = command.split(" ");
+ List<String> comList = new ArrayList<>();
+ for (String com : coms){
+ if(!com.equals("")){
+ comList.add(com) ;
+ }
+ }
+ String com = comList.get(0) ;
+ switch (com) {
+ case CodeV1.cd_02: cdWithoutParam(new P206V1Cd02(), comList, prtWrt); break;
+ case CodeV1.cd_10: cdWithParam(new P206V1Cd10(), comList, prtWrt); break;
+ case CodeV1.cd_21: cdWithParam(new P206V1Cd21(), comList, prtWrt); break;
+ case CodeV1.cd_37: cdWithParam(new P206V1Cd37(), comList, prtWrt); break;
+ case CodeV1.cd_3C: cdWithParam(new P206V1Cd3C(), comList, prtWrt); break;
+ case CodeV1.cd_50: cdWithoutParam(new P206V1Cd50(), comList, prtWrt); break;
+ case CodeV1.cd_65: cdWithoutParam(new P206V1Cd65(), comList, prtWrt); break;
+ case CodeV1.cd_66: cdWithoutParam(new P206V1Cd66(), comList, prtWrt); break;
+ case CodeV1.cd_67: cdWithoutParam(new P206V1Cd67(), comList, prtWrt); break;
+ case CodeV1.cd_91: cdWithoutParam(new P206V1Cd91(), comList, prtWrt); break;
+ case CodeV1.cd_92: cdWithoutParam(new P206V1Cd92(), comList, prtWrt); break;
+ case CodeV1.cd_93: cdWithoutParam(new P206V1Cd93(), comList, prtWrt); break;
+ default: Command.outNoIdentify(prtWrt); break;
+ }
+ }
+
+ private static void cd02(List<String> comList, PrintWriter prtWrt)throws Exception{
+ P206V1Cd cd = new P206V1Cd02() ;
+ if(comList.size() > 1){
+ String p = comList.get(1);
+ if(p.equals("-h")){
+ prtWrt.println(cd.helpInfo());
+ }else{
+ Command.outNoIdentify(prtWrt) ;
+ }
+ }else{
+ Command.out(cd.hex(ServerProperties.rtuAddr), prtWrt);
+ }
+ }
+
+ private static void cdWithoutParam(P206V1Cd cd, List<String> comList, PrintWriter prtWrt)throws Exception{
+ if(comList.size() > 1){
+ String p = comList.get(1);
+ if(p.equals("-h")){
+ prtWrt.println(cd.helpInfo());
+ }else{
+ Command.outNoIdentify(prtWrt) ;
+ }
+ }else{
+ Command.out(cd.hex(ServerProperties.rtuAddr), prtWrt);
+ }
+ }
+
+ private static void cdWithParam(P206V1Cd cd, List<String> comList, PrintWriter prtWrt)throws Exception{
+ if(comList.size() > 1){
+ String p1 = comList.get(1);
+ if(p1.equals("-h")){
+ prtWrt.println(cd.helpInfo());
+ }else{
+ String[] ps = params2Grp(comList) ;
+ String msg = cd.checkParams(ps) ;
+ if(msg == null){
+ Command.out(cd.hex(ServerProperties.rtuAddr, ps), prtWrt);
+ }else{
+ Command.out(msg, prtWrt);
+ }
+ }
+ }else{
+ Command.outNoParams(prtWrt); ;
+ }
+ }
+ private static String[] params2Grp(List<String> comList){
+ String[] ps = new String[comList.size()-1] ;
+ for(int i = 1; i < comList.size(); i++){
+ ps[i-1] = comList.get(i) ;
+ }
+ return ps ;
+ }
+}
diff --git "a/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/\350\257\264\346\230\216.txt" "b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/\350\257\264\346\230\216.txt"
new file mode 100644
index 0000000..6b9123a
--- /dev/null
+++ "b/pipIrr-platform/pipIrr-mw/pipIrr-com-creator/\350\257\264\346\230\216.txt"
@@ -0,0 +1 @@
+鍗忚鍛戒护鐢熸垚鍣紝鐢熸垚杩滅▼鍛戒护锛圚EX锛変覆锛屼互鏂逛究涓嬪彂閫忎紶鍛戒护
\ No newline at end of file
--
Gitblit v1.8.0