| | |
| | | "com.dy.common.aop..*", |
| | | "com.dy.common.apiDoc..*", |
| | | "com.dy.common.multiDataSource..*", |
| | | "com.dy.common.mybatis..*", |
| | | "com.dy.common.singleDataSource..*", |
| | | "com.dy.common.mybatis..*", |
| | | "com.dy.common.webFilter..*", |
| | | "com.dy.common.webListener..*", |
| | | "com.dy.pipIrrGlobal.config..*", |
| | | "com.dy.pipIrrGlobal.webCtrls..*" |
| | | }) |
| | | } |
| | |
| | | } |
| | | } |
| | | private void dealP206V1(byte[] bs){ |
| | | //应该是链路检测数据 |
| | | String cdPre = ByteUtil.bytes2Hex(bs, false, ProtocolConstantV206V1.codeIndex, 1); |
| | | if(cdPre.equals("92")){ |
| | | UpCd92.upData() ; |
| | | } |
| | | } |
| | | private void dealUpgrade(byte[] bs){ |
| | | String cdPre = ByteUtil.bytes2Hex(bs, false, ProtocolConstantV206V1.UG_codeIndex, 1); |
New file |
| | |
| | | package com.dy.simRtu.tcpClient.upData; |
| | | |
| | | import com.dy.common.mw.protocol.p206V1.parse.global.GlCreate; |
| | | import com.dy.common.util.ByteUtil; |
| | | import com.dy.simRtu.ServerProperties; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/5/7 15:05 |
| | | * @Description |
| | | */ |
| | | public class UpCd92 extends UpData { |
| | | |
| | | private static final Logger log = LogManager.getLogger(UpCd92.class); |
| | | |
| | | public static void upData() { |
| | | try { |
| | | if (UpData.session != null && UpData.session.isConnected()) { |
| | | byte[] bs = createData(ServerProperties.rtuAddr); |
| | | UpData.upSend(bs); |
| | | } else { |
| | | log.error("未连接通信中间件,不能发送数据"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("向通信中间件发送数据产生异常", e); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 构造数据 |
| | | * |
| | | * @return 字节数组 |
| | | * @throws Exception 异常 |
| | | */ |
| | | private static byte[] createData(String rtuAddr) throws Exception { |
| | | byte[] bytes = creatHead(rtuAddr, "92",(byte)0xB0); |
| | | |
| | | byte[] bs = new byte[1]; |
| | | bs[0] = (byte) 0xAA;//0xAA表示命令接收成功,0x00表示命令不能执行 |
| | | bytes = ByteUtil.bytesMerge(bytes, bs); |
| | | |
| | | GlCreate.createLen(bytes);//长度放字节数组中 |
| | | |
| | | byte[] bsTail = GlCreate.createCrcTail4P206(bytes);//CRC和尾叠加字节数组中 |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bsTail); |
| | | |
| | | return bytes; |
| | | } |
| | | } |
| | |
| | | "com.dy.common.aop..*", |
| | | "com.dy.common.apiDoc..*", |
| | | "com.dy.common.multiDataSource..*", |
| | | "com.dy.common.mybatis..*", |
| | | "com.dy.common.singleDataSource..*", |
| | | "com.dy.common.mybatis..*", |
| | | "com.dy.common.webFilter..*", |
| | | "com.dy.common.webListener..*", |
| | | "com.dy.pipIrrGlobal.config..*", |
| | | "com.dy.pipIrrGlobal.webCtrls..*" |
| | | }) |
| | | } |