| | |
| | | package com.dy.common.mw.protocol.p206V202404.parse; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.mw.protocol.p206V202404.CodeV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.ParseParamsForDownV202404; |
| | |
| | | |
| | | MidResultToRtu midRs = new MidResultToRtu() ; |
| | | midRs.protocolName = para.protocolName ;//协议名称 |
| | | midRs.rtuResultSendWebUrl = para.rtuResultSendWebUrl ; |
| | | midRs.rtuAddr = para.rtuAddr ;//Rtu地址 |
| | | midRs.commandId = para.commandId ;//命令ID,发起命令的客户端(web端)生成,以匹配命令结果 |
| | | midRs.downCode = para.commandCode ;//下行命令功能码; |
| | |
| | | public byte[] doParse(ParseParamsForDownV202404 para) throws Exception { |
| | | byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode); |
| | | if(para.param != null){ |
| | | String json = (String)para.param; |
| | | JSONObject obj = (JSONObject)para.param; |
| | | String json = obj.toJSONString(); |
| | | ComCd24Vo cvo = JSON.parseObject(json, ComCd24Vo.class) ; |
| | | if(cvo == null){ |
| | | throw new Exception("json转ComCd24Vo为null") ; |
| | |
| | | bytes = ByteUtil.bytesMerge(bytes, bsRg) ; |
| | | |
| | | byte[] bs1 = new byte[7] ; |
| | | index ++ ; |
| | | index = 0 ; |
| | | GlCreate.createPw(bs1, index); |
| | | |
| | | index += 2 ; |