Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
| | |
| | | for (int i = 0; i < 4; i++) { |
| | | bs[from + i] = Integer.valueOf(value & 0xff).byteValue();// å°æä½ä½ä¿åå¨ä½åè |
| | | value = value >> 8; // åå³ç§»8ä½ |
| | | if(value == 0){ |
| | | break ; |
| | | } |
| | | if(value == 0){ |
| | | break ; |
| | | } |
| | | } |
| | | } else { |
| | | throw new Exception("int2Bytesæ¶æ°ç»è¶ç"); |
| | |
| | | } |
| | | |
| | | /** |
| | | * å°ç«¯æ¨¡å¼ãæ°æ®ä½ä½å¨æ°ç»ä½åèã |
| | | * æ´å½¢è½¬æBCDç¼ç ï¼åèé¡ºåºæ¯åç |
| | | * @param i |
| | | * @param bs |
| | | * @param from |
| | | * @return è¿å |
| | | */ |
| | | public static void int2BCD_LE(int i, byte[] bs, int from)throws Exception { |
| | | String str = "" + i; |
| | | byte[] b = null; |
| | | if (str.length() % 2 == 0) { |
| | | b = new byte[str.length() / 2]; |
| | | } else { |
| | | b = new byte[(str.length() / 2) + 1]; |
| | | } |
| | | encodeBCD_LE(str, b, 0, b.length); |
| | | |
| | | int len = bs.length ; |
| | | int bLen = b.length ; |
| | | for(int j = 0; (j < len && j < bLen); j++){ |
| | | bs[from + j] = b[j] ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 大端模å¼ãæ°æ®ä½ä½å¨æ°ç»é«åèã |
| | | * é¿æ´å½¢è½¬æBCDç¼ç |
| | | * @param l |
| | |
| | | } |
| | | boolean b = isOutOfArrLength(bs.length, (from - 1) + len); |
| | | if (!b) { |
| | | for (int i = 0; i > len ; i++) { |
| | | for (int i = 0; i <= len ; i++) { |
| | | bs[from + i] = Integer.valueOf(temp & 0xff).byteValue();// å°æä½ä½ä¿åå¨ä½åè |
| | | temp = temp >> 8; // åå³ç§»8ä½ |
| | | } |
| | |
| | | log.error("æªå¾å°RTU主å¨ä¸æ¥æ°æ®å¤çä»»å¡ï¼"); |
| | | } |
| | | }catch(Exception e){ |
| | | log.error("ä¸è¡æ°æ®ä»»å¡æ± å¤çæ°æ®æ¶åçå¼å¸¸", e); |
| | | }finally { |
| | | if(task != null){ |
| | | //彿å¼å¸¸æ¶ï¼try catchä¸ç代ç 坿²¡ææ§è¡freeAndCleanTask |
| | | TaskPool.freeAndCleanTask(task); |
| | | } |
| | | } |
| | |
| | | poHistory = this.updateRmClientAmountBySameDateNewData(clientVo, poHistory, poLast, dV1_0_1, cdData); |
| | | sv.updateRmClientAmountDay(poHistory); |
| | | } |
| | | sv.saveRmClientAmountLast(poLast); |
| | | }else if(upYmd.after(poLast.dt)){ |
| | | //æ°çæ¥æ |
| | | poLast = this.updateRmClientAmountLastByNewDateNewData(clientVo, dV1_0_1, cdData, poLast); |
| | | this.newAndSaveHistoryDataDeal(sv, clientVo, dV1_0_1, cdData, poLast); |
| | | sv.saveRmClientAmountLast(poLast); |
| | | }else{ |
| | | //è¿ç§æ
åµä¸åå¨ |
| | | } |
| | |
| | | package com.dy.rtuMw.server.rtuData.p206V1_0_0; |
| | | |
| | | import com.dy.common.mw.protocol.Data; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.DataV1_0_1; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.upVos.DataCd02Vo; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrControllerTramp; |
| | | import com.dy.rtuMw.server.rtuData.TaskSurpport; |
| | | import com.dy.rtuMw.server.rtuData.dbSv.DbSv; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public void execute(Object data) { |
| | | Data d = (Data)data ; |
| | | Object[] objs = this.getTaskResults(TkPreGenObjs.taskId) ; |
| | | PrControllerTramp tramp = (PrControllerTramp)objs[2] ; |
| | | if(tramp == null){ |
| | | this.toNextTasks(data); |
| | | boolean toNext = true ; |
| | | if(d.getSubData() != null) { |
| | | DataV1_0_1 dataV1_0_1 = (DataV1_0_1)d.getSubData() ; |
| | | if(dataV1_0_1 != null && dataV1_0_1.subData != null && dataV1_0_1.subData instanceof DataCd02Vo){ |
| | | //è¿æ»¤æå¿è·³æ°æ® |
| | | toNext = false ; |
| | | } |
| | | } |
| | | if(toNext){ |
| | | this.toNextTasks(data); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | poLast = this.updateRmIntakeAmountLastByControllerChange(poLast, controller, rtuAddr, dV1_0_1, dataVo); |
| | | this.newAndSaveHistoryDataDeal(sv, controller, rtuAddr, dV1_0_1, dataVo, poLast); |
| | | } |
| | | sv.saveRmIntakeAmountLast(poLast); |
| | | }else{ |
| | | //æªæ´æ¢æ§å¶å¨ |
| | | if(DateTime.dateFrom_yyyy_MM_dd1(dV1_0_1.dt).equals(poLast.dt)){ |
| | |
| | | poHistory = this.updateRmIntakeAmountBySameDateNewData(poHistory, poLast, controller, rtuAddr, dV1_0_1, dataVo); |
| | | sv.updateRmIntakeAmountDay(poHistory); |
| | | } |
| | | sv.saveRmIntakeAmountLast(poLast); |
| | | }else if(DateTime.dateFrom_yyyy_MM_dd1(dV1_0_1.dt).after(poLast.dt)){ |
| | | //æ°çæ¥æ |
| | | poLast = this.updateRmIntakeAmountLastByNewDateNewData(poLast, controller, rtuAddr, dV1_0_1, dataVo); |
| | | this.newAndSaveHistoryDataDeal(sv, controller, rtuAddr, dV1_0_1, dataVo, poLast); |
| | | sv.saveRmIntakeAmountLast(poLast); |
| | | }else{ |
| | | //è¿ç§æ
åµä¸åå¨ |
| | | } |
| | |
| | | //lastPo.dt = DateTime.dateFrom_yyyy_MM_dd1(dV1_0_1.dt);//æ¥ææ²¡å |
| | | lastPo.dtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt); |
| | | lastPo.rtuDtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(cdData.rtuDt); |
| | | Double difference = cdData.totalAmount - lastPo.totalAmountLast ; |
| | | if(difference > 0){ |
| | | lastPo.amount = difference; |
| | | Double added = cdData.totalAmount - lastPo.totalAmountLast ; |
| | | if(added > 0){ |
| | | if(lastPo.amount == null){ |
| | | lastPo.amount = added ; |
| | | }else{ |
| | | lastPo.amount += added ; |
| | | } |
| | | }else{ |
| | | //po.amount = po.amount ; //æ¥ç´¯è®¡åæ°´éä¸å |
| | | } |
| | |
| | | lastPo.dt = DateTime.dateFrom_yyyy_MM_dd1(dV1_0_1.dt);//æ¥æåäº |
| | | lastPo.dtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(dV1_0_1.dt); |
| | | lastPo.rtuDtLast = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(cdData.rtuDt); |
| | | Double difference = cdData.totalAmount - lastPo.totalAmountLast ; |
| | | if(difference > 0){ |
| | | lastPo.amount = difference; |
| | | Double added = cdData.totalAmount - lastPo.totalAmountLast ; |
| | | if(added > 0){ |
| | | //æ°çä¸å¤©çå¤çæ¹å¼ä¸åä¸å¤©çå¤çæ¹å¼ä¸ä¸æ · |
| | | lastPo.amount = added; |
| | | }else{ |
| | | lastPo.amount = 0.0D; //æ¥ç´¯è®¡æ°´éå½0 |
| | | } |
| | |
| | | po.dtLast = lastPo.dtLast; |
| | | po.rtuDtLast = lastPo.rtuDtLast; |
| | | |
| | | po.amount = lastPo.amount ; |
| | | po.amount = lastPo.amount ;//æ¤æ¶lastPo.amountå·²ç»å¢å ä¸äºå¢é |
| | | po.totalAmountLast = lastPo.totalAmountLast ; |
| | | |
| | | return po ; |
| | |
| | | Data d = (Data)data ; |
| | | if(d.getProtocol() != null && d.getProtocol().equals(ProtocolConstantV206V1_0_0.protocolName)){ |
| | | //è¯å«åºæ¯P206V1.0.0åè®®æ°æ® |
| | | //æ å½ä»¤ID |
| | | boolean toNext = true ; |
| | | if(d.getSubData() != null) { |
| | | DataV1_0_1 dataV1_0_1 = (DataV1_0_1)d.getSubData() ; |
| | | if(dataV1_0_1 != null && dataV1_0_1.subData != null && dataV1_0_1.subData instanceof DataCd02Vo){ |
| | | //è¿æ»¤æå¿è·³æ°æ® |
| | | toNext = false ; |
| | | } |
| | | } |
| | | if(toNext){ |
| | | this.toNextTasks(data); |
| | | } |
| | | this.toNextTasks(data); |
| | | }else{ |
| | | //䏿¯æ¬åè®®çæ°æ® |
| | | } |
| | |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | public class TkPreGenObjs extends TaskSurpport { |
| | | |
| | | private static final Map<String, Boolean> onceUpDataRtus = new HashMap<>(); |
| | | |
| | | private static final Logger log = LogManager.getLogger(TkPreGenObjs.class.getName()) ; |
| | | |
| | |
| | | public void execute(Object data) throws ParseException { |
| | | Data d = (Data)data ; |
| | | String rtuAddr = d.getRtuAddr() ;//TkRtuDataé夿äºrtuAddr为空 |
| | | if(d.subData != null && d.subData instanceof DataV1_0_1){ |
| | | DataV1_0_1 dataV1_0_1 = (DataV1_0_1)d.subData ; |
| | | if(dataV1_0_1.subData != null && dataV1_0_1.subData instanceof DataCd02Vo){ |
| | | //è¿æ»¤æå¿è·³æ°æ® |
| | | if(onceUpDataRtus.containsKey(rtuAddr)){ |
| | | return ; |
| | | } |
| | | } |
| | | } |
| | | if(!onceUpDataRtus.containsKey(rtuAddr)){ |
| | | onceUpDataRtus.put(rtuAddr, true) ; |
| | | } |
| | | |
| | | DbSv sv = (DbSv)SpringContextUtil.getBean(DbSv.class) ; |
| | | if(sv != null){ |
| | | PrController controller = sv.getControllersByRtuAddrAndIntakeNotNull(rtuAddr) ; |
| | |
| | | } |
| | | }else{ |
| | | if(d.subData != null && d.subData instanceof DataV1_0_1){ |
| | | DataV1_0_1 d1 = (DataV1_0_1)d.subData ; |
| | | clientVo = this.getClient(sv, d1); |
| | | clientVo = this.getClient(sv, (DataV1_0_1)d.subData); |
| | | } |
| | | } |
| | | //ä¸è®ºæ¯å¦ä¸ºæµæµªæ§å¶å¨ï¼RTUå®ä½ï¼ï¼é½è¦è¿è¡ä¸æ¥å·¥ä½ï¼è®°å½å
¶ä¸æ¥çä¸äºæ°æ®ï¼å½ç»å®æ§å¶å¨åï¼æ°æ®èªå¨æäºå½å± |
| | |
| | | package com.dy.rtuMw.server.rtuData.p206V202404; |
| | | |
| | | import com.dy.common.mw.protocol.Data; |
| | | import com.dy.common.mw.protocol.p206V202404.DataV202404; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd02Vo; |
| | | import com.dy.pipIrrGlobal.pojoPr.PrControllerTramp; |
| | | import com.dy.rtuMw.server.rtuData.TaskSurpport; |
| | | import com.dy.rtuMw.server.rtuData.dbSv.DbSv; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public void execute(Object data) { |
| | | Data d = (Data)data ; |
| | | Object[] objs = this.getTaskResults(TkPreGenObjsV202404.taskId) ; |
| | | PrControllerTramp tramp = (PrControllerTramp)objs[2] ; |
| | | if(tramp == null){ |
| | | this.toNextTasks(data); |
| | | //æ å½ä»¤ID |
| | | boolean toNext = true ; |
| | | if(d.getSubData() != null) { |
| | | DataV202404 dataV202404 = (DataV202404)d.getSubData() ; |
| | | if(dataV202404 != null && dataV202404.subData != null && dataV202404.subData instanceof DataCd02Vo){ |
| | | //è¿æ»¤æå¿è·³æ°æ® |
| | | toNext = false ; |
| | | } |
| | | } |
| | | if(toNext){ |
| | | this.toNextTasks(data); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | Data d = (Data)data ; |
| | | if(d.getProtocol() != null && d.getProtocol().equals(ProtocolConstantV206V202404.protocolName)){ |
| | | //è¯å«åºæ¯P206V202404åè®®æ°æ® |
| | | //æ å½ä»¤ID |
| | | boolean toNext = true ; |
| | | if(d.getSubData() != null) { |
| | | DataV202404 dataV202404 = (DataV202404)d.getSubData() ; |
| | | if(dataV202404 != null && dataV202404.subData != null && dataV202404.subData instanceof DataCd02Vo){ |
| | | //è¿æ»¤æå¿è·³æ°æ® |
| | | toNext = false ; |
| | | } |
| | | } |
| | | if(toNext){ |
| | | this.toNextTasks(data); |
| | | } |
| | | this.toNextTasks(data); |
| | | }else{ |
| | | //䏿¯æ¬åè®®çæ°æ® |
| | | } |
| | |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | # url: jdbc:mysql://192.168.40.166:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | url: jdbc:mysql://127.0.0.1:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | # url: jdbc:mysql://8.140.179.55:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | url: jdbc:mysql://192.168.40.166:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull |
| | | username: root |
| | | password: dysql,;.abc!@# |
| | | druid: |
| | |
| | | package com.dy.pipIrrMwTestRtu; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.CommandLineRunner; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
| | |
| | | }) |
| | | } |
| | | ) |
| | | public class PipIrrMwTestRtuApplication{ |
| | | public class PipIrrMwTestRtuApplication implements CommandLineRunner { |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(PipIrrMwTestRtuApplication.class, args); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Spring容å¨å¯å¨å®æåï¼æ§è¡ä¸é¢æ¹æ³ |
| | | * @param args åæ° |
| | | * @throws Exception å¼å¸¸ |
| | | */ |
| | | @Override |
| | | public void run(String... args) throws Exception { |
| | | try{ |
| | | //çå¾
ä¸ä¸ |
| | | Thread.sleep(500L); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | finally { |
| | | this.startMwSv() ; |
| | | } |
| | | } |
| | | |
| | | private void startMwSv(){ |
| | | if(sv != null){ |
| | | sv.startServer(); |
| | | } |
| | | } |
| | | |
| | | |
| | | private Server sv ; |
| | | |
| | | @Autowired |
| | | public void setSv(Server sv){ |
| | | this.sv = sv ; |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.dy.pipIrrMwTestRtu; |
| | | |
| | | import com.dy.common.mw.UnitInterface; |
| | | import com.dy.common.util.ConfigXml; |
| | | import com.dy.pipIrrMwTestRtu.tcpClient.TcpClUnit; |
| | | import com.dy.pipIrrMwTestRtu.tcpClient.TcpClUnitConfigVo; |
| | | import org.jdom2.Document; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/7/12 8:50 |
| | | * @Description |
| | | */ |
| | | |
| | | @Component |
| | | public class Server { |
| | | |
| | | private ConfigXml conf = null ; |
| | | private Document doc = null ; |
| | | private boolean showStartInfo = false ; |
| | | |
| | | private String mwServerUrl ; |
| | | |
| | | private List<UnitInterface> units = new ArrayList<UnitInterface>() ; |
| | | |
| | | /* |
| | | * @param args åæ° |
| | | public static void main(String[] args) { |
| | | new Server().startServer(); |
| | | } |
| | | */ |
| | | /** |
| | | * å¯å¨æå¡ |
| | | */ |
| | | public void startServer(){ |
| | | long start = System.currentTimeMillis() ; |
| | | try { |
| | | //ConfigProperties.init(this.getClass().getResourceAsStream("/config/config.properties"), false); |
| | | |
| | | this.conf = new ConfigXml() ; |
| | | this.doc = this.conf.createDom(this.getClass(), "config.xml") ; |
| | | //////////////// |
| | | //æå¡ é
ç½® |
| | | this.showStartInfo = this.conf.getSetAttrBoolean(this.doc, "config.server", "showStartInfo", null, null) ; |
| | | |
| | | this.startUnits() ; |
| | | |
| | | String svName ; |
| | | try{ |
| | | svName = this.conf.getSetAttrTxt(this.doc, "config.server", "name", null, false, null) ; |
| | | }catch(Exception e){ |
| | | svName = "" ; |
| | | } |
| | | |
| | | String company ; |
| | | try{ |
| | | company = this.conf.getSetAttrTxt(this.doc, "config.server", "company", null, true, null) ; |
| | | }catch(Exception e){ |
| | | company = "" ; |
| | | } |
| | | System.out.println("OOOOOOOOOO OOOOOOOO OOOOOOOO") ; |
| | | System.out.println("@@@@@@@@@@@@@@@@#O $@@@@@@@@& @@@@@@@@#") ; |
| | | System.out.println("@@@@@@@@@@@@@@@@@@@# @@@@@@@@# $@@@@@@@@&") ; |
| | | System.out.println("@@@@@@@@@@@@@@@@@@@@@# #@@@@@@@@@@@@@@@@O") ; |
| | | System.out.println("@@@@@@@@@@@@@@@@@@@@@@@ &@@@@@@@@@@@@@@") ; |
| | | System.out.println("@@@@@@$ $@@@@@@@@@& O@@@@@@@@@@@#") ; |
| | | System.out.println("@@@@@@$ @@@@@@@@@ @@@@@@@@@& " + svName ) ; |
| | | System.out.println("@@@@@@$ O@@@@@@@@@ &@@@@@@@@") ; |
| | | |
| | | if(this.mwServerUrl != null){ |
| | | System.out.println("@@@@@@$ O@@@@@@@@@ &@@@@@@@@ ä¸é´ä»¶æå¡ç«¯ " + this.mwServerUrl ) ; |
| | | }else{ |
| | | System.out.println("@@@@@@$ O@@@@@@@@@ &@@@@@@@@") ; |
| | | } |
| | | System.out.println("@@@@@@$ #@@@@@@@@@$ &@@@@@@@@" ) ; |
| | | System.out.println("@@@@@@@@@@@@@@@@@@@@@@# &@@@@@@@@ Runing in standalone mode" ) ; |
| | | System.out.println("@@@@@@@@@@@@@@@@@@@@@& &@@@@@@@@ Startup in " + (System.currentTimeMillis() - start) + " MS" ) ; |
| | | System.out.println("@@@@@@@@@@@@@@@@@@@# &@@@@@@@@ " + company) ; |
| | | System.out.println("@@@@@@@@@@@@@@@@#O &@@@@@@@@") ; |
| | | |
| | | }catch(Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | private void startUnits() { |
| | | try { |
| | | |
| | | // /////////////// |
| | | // åºç¡é
ç½® |
| | | ServerProperties.rtuAddr = conf.getSetAttrTxt(doc, "config.base", "rtuAddr", null, false, null); |
| | | ServerProperties.icCardAddr = conf.getSetAttrTxt(doc, "config.base", "icCardAddr", null, false, null); |
| | | ServerProperties.icCardNo = conf.getSetAttrTxt(doc, "config.base", "icCardNo", null, false, null); |
| | | |
| | | // /////////////// |
| | | // TCP 模å |
| | | TcpClUnitConfigVo tcpVo = new TcpClUnitConfigVo(); |
| | | tcpVo.mwServerIp = conf.getSetAttrTxt(doc, "config.tcpCl", "mwServerIp", null, false, null); |
| | | tcpVo.mwServerPort = conf.getSetAttrPlusInt(doc, "config.tcpCl", "mwServerPort", null, 100, 65535, null); |
| | | tcpVo.connectTimeout = conf.getSetAttrPlusInt(doc, "config.tcpCl", "connectTimeout", null, 1000, 10000, null); |
| | | this.mwServerUrl = tcpVo.mwServerIp + ":" + tcpVo.mwServerPort ; |
| | | AdapterImp_TcpClUnit tcpAdap = new AdapterImp_TcpClUnit(); |
| | | tcpAdap.setConfig(tcpVo); |
| | | TcpClUnit tcpUnit = TcpClUnit.getInstance(); |
| | | tcpUnit.setAdapter(tcpAdap); |
| | | tcpUnit.start(obj -> { |
| | | }); |
| | | units.add(tcpUnit) ; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrMwTestRtu; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/7/12 8:19 |
| | | * @Description |
| | | */ |
| | | public class ServerProperties { |
| | | public static String rtuAddr ; |
| | | public static String icCardAddr ; |
| | | public static String icCardNo ; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrMwTestRtu.p206V1_0_0; |
| | | |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.pipIrrMwTestRtu.tcpClient.upData.UpCd83Close; |
| | | import com.dy.pipIrrMwTestRtu.tcpClient.upData.UpCd83Open; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/6/29 6:46 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping(path="rtuP206V1_0_0") |
| | | @SuppressWarnings("unchecked")//javaçæ¬è¶é«ï¼å¯¹æ³å约æè¶ä¸¥ï¼æä»¥é
ç½®SuppressWarnings("unchecked") |
| | | public class RtuP206V1_0_0Ctrl { |
| | | |
| | | @GetMapping(path = "test") |
| | | public BaseResponse<String> test(String com) { |
| | | if(com.equals("83Open")){ |
| | | this.cd83Open() ; |
| | | }else if(com.equals("83Close")){ |
| | | this.cd83Close() ; |
| | | } |
| | | BaseResponse<String> rt = new BaseResponse<String>() ; |
| | | rt.setCode("001") ; |
| | | rt.setMsg("å·²ç»ä¸æ¥æ°æ®") ; |
| | | rt.setSuccess(true) ; |
| | | return rt ; |
| | | } |
| | | |
| | | |
| | | private void cd83Open(){ |
| | | UpCd83Open.upCd83Data(); |
| | | } |
| | | |
| | | |
| | | private void cd83Close(){ |
| | | UpCd83Close.upCd83Data(); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | */ |
| | | public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws IOException, Exception{ |
| | | byte[] data = (byte[])message; |
| | | log.info("ä¸è¡æ°æ®ï¼" + ByteUtil.bytes2Hex(data, true)); |
| | | //log.info("ä¸è¡æ°æ®ï¼" + ByteUtil.bytes2Hex(data, true)); |
| | | |
| | | out.write(IoBuffer.allocate((data==null?0:data.length), false).put(data).flip()); |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrMwTestRtu.tcpClient; |
| | | |
| | | import com.dy.common.mw.UnitAdapterInterface; |
| | | import com.dy.common.mw.UnitInterface; |
| | | import com.dy.common.mw.UnitStartedCallbackInterface; |
| | | import com.dy.common.util.Callback; |
| | | import com.dy.pipIrrMwTestRtu.ServerProperties; |
| | | import com.dy.pipIrrMwTestRtu.tcpClient.upData.UpData; |
| | | import com.dy.pipIrrMwTestRtu.tcpClient.upData.UpHeartBeat; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | import org.apache.mina.core.session.IoSession; |
| | | |
| | | |
| | | public class TcpClUnit implements UnitInterface { |
| | | |
| | | private static final Logger log = LogManager.getLogger(TcpClUnit.class) ; |
| | | |
| | | private static TcpClUnit instance = new TcpClUnit() ; |
| | | |
| | | public static TcpClUnitAdapter adapter ; |
| | | public static TcpClUnitConfigVo confVo ; |
| | | |
| | | public static IoSession session ; |
| | | |
| | | private TcpClUnit(){} ; |
| | | |
| | | public static TcpClUnit getInstance(){ |
| | | return instance ; |
| | | } |
| | | |
| | | @Override |
| | | public void setAdapter(UnitAdapterInterface adapter) throws Exception { |
| | | if(adapter == null){ |
| | | throw new Exception("Tcp Client模åéé
å¨å¯¹è±¡ä¸è½ä¸ºç©ºï¼") ; |
| | | } |
| | | TcpClUnit.adapter = (TcpClUnitAdapter)adapter ; |
| | | TcpClUnit.confVo = TcpClUnit.adapter.getConfig() ; |
| | | if(TcpClUnit.confVo == null){ |
| | | throw new Exception("Tcp Client模åé
置对象ä¸è½ä¸ºç©ºï¼") ; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void start(UnitStartedCallbackInterface callback) throws Exception { |
| | | System.out.println("Tcp Client模åæåå¯å¨"); |
| | | this.doStart(); |
| | | callback.call(null) ; |
| | | } |
| | | |
| | | @Override |
| | | public void stop(UnitStartedCallbackInterface callback) throws Exception { |
| | | callback.call(null); |
| | | } |
| | | |
| | | private void doStart(){ |
| | | new Thread(new Runnable(){ |
| | | @Override |
| | | public void run() { |
| | | Exception ex = null ; |
| | | while(true){ |
| | | ex = null ; |
| | | try { |
| | | new TcpConnect().createSession( |
| | | confVo.mwServerIp, |
| | | confVo.mwServerPort, |
| | | confVo.connectTimeout, |
| | | new TcpHandler(), |
| | | new Callback() { |
| | | @Override |
| | | public void call(Object obj) { |
| | | if (obj == null) { |
| | | log.error("å建ç½ç»ä¼è¯è¿å为null"); |
| | | } else { |
| | | TcpClUnit.session = (IoSession) obj; |
| | | log.info("æåå建ä¸éä¿¡ä¸é´ä»¶çç½ç»è¿æ¥"); |
| | | UpData.setSession(TcpClUnit.session); |
| | | heartBeat() ; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void call(Object... objs) { |
| | | } |
| | | |
| | | @Override |
| | | public void exception(Exception e) { |
| | | } |
| | | }); |
| | | }catch (Exception e){ |
| | | ex = e ; |
| | | } |
| | | if(ex == null){ |
| | | break ; |
| | | }else{ |
| | | try{ |
| | | Thread.sleep(100); |
| | | }catch (Exception e){ |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | |
| | | |
| | | private void heartBeat(){ |
| | | new Thread(new Runnable(){ |
| | | @Override |
| | | public void run() { |
| | | while(true){ |
| | | try { |
| | | UpHeartBeat.upCd02Data(ServerProperties.rtuAddr); |
| | | Thread.sleep(30000L); |
| | | //Thread.sleep(30000000L); |
| | | }catch (Exception e){ |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | |
| | | } |
| | |
| | | public class TcpClUnitConfigVo { |
| | | public String mwServerIp ; |
| | | public Integer mwServerPort ; |
| | | public Integer connectTimeout ; |
| | | } |
| | |
| | | package com.dy.pipIrrMwTestRtu.tcpClient; |
| | | |
| | | import com.dy.common.util.ByteUtil; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | import org.apache.mina.core.service.IoHandlerAdapter; |
| | |
| | | */ |
| | | @Override |
| | | public void sessionCreated(IoSession session) throws Exception { |
| | | super.sessionCreated(session); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public void sessionOpened(IoSession session) throws Exception { |
| | | super.sessionOpened(session); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public void sessionClosed(IoSession session) throws Exception { |
| | | super.sessionClosed(session); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public void sessionIdle(IoSession session, IdleStatus status) throws Exception { |
| | | super.sessionIdle(session, status); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public void messageReceived(IoSession session, Object message) throws Exception { |
| | | if(message != null){ |
| | | byte[] bs = (byte[])message ; |
| | | log.info("æ¶å°ä¸é´ä»¶æ°æ®ï¼" + ByteUtil.bytes2Hex(bs, true)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public void messageSent(IoSession session, Object message) throws Exception { |
| | | log.info("ç½ç»åéäºæ°æ®ï¼" |
| | | + (session==null?"":(session.getRemoteAddress() != null?("ä¸é´ä»¶ç½åæ¯ï¼" + session.getRemoteAddress().toString()):"")) ); |
| | | if(message != null){ |
| | | byte[] bs = (byte[])message ; |
| | | log.info("ç½ç»åéäºæ°æ®ï¼" + ByteUtil.bytes2Hex(bs, true)); |
| | | } |
| | | } |
| | | |
| | | /** |
New file |
| | |
| | | package com.dy.pipIrrMwTestRtu.tcpClient.upData; |
| | | |
| | | import com.dy.common.mw.protocol.p206V1_0_0.parse.global.GlCreate; |
| | | import com.dy.common.util.ByteUtil; |
| | | import com.dy.common.util.ByteUtilUnsigned; |
| | | import com.dy.pipIrrMwTestRtu.ServerProperties; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/7/15 14:58 |
| | | * @Description |
| | | */ |
| | | public class UpCd83Close extends UpData { |
| | | |
| | | private static final Logger log = LogManager.getLogger(UpCd83Close.class); |
| | | |
| | | public static void upCd83Data() { |
| | | 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 { |
| | | UpConstant.closeValve(); |
| | | byte[] bytes = creatHead(rtuAddr, "83", (byte)0xB0); |
| | | |
| | | byte[] bs = new byte[1] ; |
| | | bs[0] = (byte)0x02 ;//å·å¡å
³é |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | bs = new byte[5] ;//累计æµé |
| | | ByteUtil.int2BCD_LE(UpConstant.totalAmount, bs, 0); |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | bs = new byte[8] ;//ICå¡ç¼å· |
| | | GlCreate.createIcCardNo(ServerProperties.icCardNo, bs, 0); |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | bs = new byte[4] ;//ICå¡å°å |
| | | ByteUtil.hex2Bytes_LE(ServerProperties.icCardAddr, bs, 0); |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | bs = new byte[4] ;//ç¨æ°´æ·ä½é¢ |
| | | ByteUtil.int2BCD_LE(UpConstant.remainMoney, bs, 0); |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | bs = new byte[6] ;//å¼éæ¶é´ |
| | | GlCreate.createTp(UpConstant.openValveDt(), bs, 0); |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | UpConstant.clearOpenValveDt();//æ¸
空å¼éæ¶é´ |
| | | |
| | | bs = new byte[6] ;//å
³éæ¶é´ |
| | | GlCreate.createTp(UpConstant.closeValveDt(), bs, 0); |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | bs = new byte[5] ;//ç¨æ°´æ·æ¬æ¬¡ç¨æ°´é |
| | | ByteUtil.int2BCD_LE(UpConstant.thisAmount, bs, 0); |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | bs = new byte[4] ;//ç¨æ°´æ·æ¬æ¬¡æ¶è´¹éé¢ |
| | | ByteUtil.int2BCD_LE(UpConstant.thisMoney, bs, 0); |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | bs = new byte[2] ;//ç¨æ°´æ·æ¬æ¬¡ç¨æ°´æ¶é¿ |
| | | ByteUtil.int2BCD_LE(UpConstant.thisTime, bs, 0); |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | bs = new byte[1] ;//æ°´ä»·ç±»å |
| | | bs[0] = ByteUtil.int2BCD_LE (1)[0] ; |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | bs = new byte[2] ;//æ°´ä»· |
| | | ByteUtil.int2BCD_LE(UpConstant.thisPrice, bs, 0); |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | bs = new byte[1] ;//å¡ç±»å |
| | | bs[0] = ByteUtil.int2BCD_LE (1)[0] ; |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | bs = new byte[6] ;//æ§å¶å¨æ¶é |
| | | GlCreate.createTp(bs, 0); |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | GlCreate.createLen(bytes);//é¿åº¦æ¾åèæ°ç»ä¸ |
| | | |
| | | byte[] bsTail = GlCreate.createCrcTail(bytes) ;//CRCåå°¾å å åèæ°ç»ä¸ |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bsTail) ; |
| | | |
| | | return bytes ; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrMwTestRtu.tcpClient.upData; |
| | | |
| | | import com.dy.common.mw.protocol.p206V1_0_0.parse.global.GlCreate; |
| | | import com.dy.common.util.ByteUtil; |
| | | import com.dy.common.util.ByteUtilUnsigned; |
| | | import com.dy.pipIrrMwTestRtu.ServerProperties; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/7/15 14:58 |
| | | * @Description |
| | | */ |
| | | public class UpCd83Open extends UpData { |
| | | |
| | | private static final Logger log = LogManager.getLogger(UpCd83Open.class); |
| | | |
| | | public static void upCd83Data() { |
| | | 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, "83", (byte)0xB0); |
| | | |
| | | byte[] bs = new byte[1] ; |
| | | bs[0] = (byte)0x01 ;//å·å¡å¼é |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | bs = new byte[5] ;//累计æµé |
| | | ByteUtil.int2BCD_LE(UpConstant.totalAmount, bs, 0); |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | bs = new byte[8] ;//ICå¡ç¼å· |
| | | GlCreate.createIcCardNo(ServerProperties.icCardNo, bs, 0); |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | bs = new byte[4] ;//ICå¡å°å |
| | | ByteUtil.hex2Bytes_LE(ServerProperties.icCardAddr, bs, 0); |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | bs = new byte[4] ;//ç¨æ°´æ·ä½é¢ |
| | | ByteUtil.int2BCD_LE(UpConstant.remainMoney, bs, 0); |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | bs = new byte[6] ;//å¼éæ¶é´ |
| | | GlCreate.createTp(UpConstant.openValveDt(), bs, 0); |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | bs = new byte[6] ;//æ§å¶å¨æ¶é |
| | | GlCreate.createTp(bs, 0); |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | GlCreate.createLen(bytes);//é¿åº¦æ¾åèæ°ç»ä¸ |
| | | |
| | | byte[] bsTail = GlCreate.createCrcTail(bytes) ;//CRCåå°¾å å åèæ°ç»ä¸ |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bsTail) ; |
| | | |
| | | return bytes ; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrMwTestRtu.tcpClient.upData; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Locale; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/7/15 15:02 |
| | | * @Description |
| | | */ |
| | | public class UpConstant { |
| | | |
| | | private static String openValveDt ; |
| | | private static String closeValveDt ; |
| | | |
| | | public static Integer totalAmount = 1234567;//å®ä¸º12345.67 |
| | | public static Integer remainMoney = 56789;//å®ä¸º567.89 |
| | | public static Integer thisAmount = 1000;//å®ä¸º10.00 |
| | | public static Integer thisMoney = 1000;//å®ä¸º10.00 |
| | | public static Integer thisTime = 10;//å®ä¸º10 |
| | | public static Integer thisPrice = 100;//å®ä¸º1.00 |
| | | |
| | | public static Integer perAmount = thisAmount; |
| | | public static Integer perMoney = thisMoney; |
| | | |
| | | |
| | | public static void clearOpenValveDt(){ |
| | | openValveDt = null ; |
| | | } |
| | | |
| | | public static String openValveDt(){ |
| | | if(openValveDt == null){ |
| | | openValveDt = new SimpleDateFormat("yyMMddHHmmss", Locale.CHINA).format(System.currentTimeMillis()); |
| | | } |
| | | return openValveDt ; |
| | | } |
| | | |
| | | public static String closeValveDt(){ |
| | | closeValveDt = new SimpleDateFormat("yyMMddHHmmss", Locale.CHINA).format(System.currentTimeMillis()); |
| | | return closeValveDt ; |
| | | } |
| | | |
| | | public static void closeValve(){ |
| | | totalAmount = totalAmount + perAmount ; |
| | | remainMoney = remainMoney - perMoney ; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrMwTestRtu.tcpClient.upData; |
| | | |
| | | import com.dy.common.mw.protocol.p206V1_0_0.ProtocolConstantV206V1_0_0; |
| | | import com.dy.common.mw.protocol.p206V1_0_0.parse.global.GlCreate; |
| | | import com.dy.common.util.ByteUtil; |
| | | import org.apache.mina.core.session.IoSession; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/7/15 14:20 |
| | | * @Description |
| | | */ |
| | | public class UpData { |
| | | |
| | | protected static IoSession session ; |
| | | |
| | | private static Object synObj = new Object() ; |
| | | |
| | | public static void setSession(IoSession session){ |
| | | UpData.session = session ; |
| | | } |
| | | |
| | | protected static void upSend(byte[] bs) throws Exception{ |
| | | synchronized (synObj){ |
| | | session.write(bs) ; |
| | | } |
| | | } |
| | | |
| | | protected static byte[] creatHead(String rtuAddr, String code, byte ctrl)throws Exception { |
| | | byte[] bsHead = new byte[ProtocolConstantV206V1_0_0.lenHead2Code] ; |
| | | byte index = 0 ; |
| | | bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; |
| | | |
| | | index++ ; |
| | | bsHead[index] = 0 ;//帧é¿åº¦ |
| | | |
| | | index++ ; |
| | | bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; |
| | | |
| | | index++ ; |
| | | bsHead[index] = ctrl; //æ§å¶ååè½ç |
| | | |
| | | index++ ; |
| | | GlCreate.createRtuAddr(rtuAddr, bsHead, index); |
| | | index += 5 ; |
| | | |
| | | ByteUtil.hex2Bytes(code, bsHead, index) ; |
| | | |
| | | return bsHead ; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrMwTestRtu.tcpClient.upData; |
| | | |
| | | import com.dy.common.mw.protocol.p206V1_0_0.parse.global.GlCreate; |
| | | import com.dy.common.util.ByteUtil; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2024/7/15 14:18 |
| | | * @Description |
| | | */ |
| | | public class UpHeartBeat extends UpData { |
| | | |
| | | private static final Logger log = LogManager.getLogger(UpHeartBeat.class) ; |
| | | |
| | | public static void upCd02Data(String rtuAddr){ |
| | | try{ |
| | | if(UpData.session != null && UpData.session.isConnected()){ |
| | | byte[] bs = createData(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, "02", (byte)0xB0); |
| | | |
| | | byte[] bs = new byte[1] ; |
| | | bs[0] = (byte)0xF2 ;//æ°æ®åï¼ 1 个åèï¼F0 ç»å½ï¼ F1 éåºç»å½ï¼F2 å¨çº¿ä¿æã |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bs) ; |
| | | |
| | | GlCreate.createLen(bytes);//é¿åº¦æ¾åèæ°ç»ä¸ |
| | | |
| | | byte[] bsTail = GlCreate.createCrcTail(bytes) ;//CRCåå°¾å å åèæ°ç»ä¸ |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bsTail) ; |
| | | |
| | | return bytes ; |
| | | } |
| | | } |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <config> |
| | | <server name="RTU模æ" showStartInfo="true" company="http://www.dyjs.com"/> |
| | | <server name="RTU模æå¨" showStartInfo="true" company="http://www.dyjs.com"/> |
| | | |
| | | <!-- |
| | | enable:æ¯å¦å¯å¨ |
| | | --> |
| | | <tcpCl mwServerIp="127.0.0.1" mwServerPort="60000" /> |
| | | <base rtuAddr="532328059995" icCardAddr="3B7D1E1A" icCardNo="61181622830147821"></base> |
| | | <!-- --> |
| | | <tcpCl mwServerIp="127.0.0.1" mwServerPort="60000" connectTimeout="3000" /> |
| | | </config> |
New file |
| | |
| | | 模æweb端åéä¿¡ä¸é´ä»¶ä¸åå½ä»¤ |