liurunyu
2024-02-27 4342b12d28b15e61bbed4d4d5e64a6a2bacae952
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CommonV1_0_1.java
@@ -82,12 +82,30 @@
   public String parseRtuAddr(byte[] bs)throws Exception{
      String rtuAddrBCD = "" + ByteUtil.BCD2Long_BE(bs, ProtocolConstantV206V1_0_0.rtuAddr1Index_start, ProtocolConstantV206V1_0_0.rtuAddr1Index_end) ;
      String rtuAddrStr = "" + ByteUtilUnsigned.bytes2Short_BE(bs, ProtocolConstantV206V1_0_0.rtuAddr2Index_start) ;
      while(rtuAddrStr.length() < 4){
      while(rtuAddrStr.length() < 5){
         rtuAddrStr = "0" + rtuAddrStr ;
      }
      return rtuAddrBCD + rtuAddrStr ;
   }
   /**
    * 分析Rtu地址
    * @param bs 上行字节数组
    * @param index 启始位
    * @return 控制器地址
    * @throws Exception 异常
    */
   public String parseRtuAddr(byte[] bs, int index)throws Exception{
      String rtuAddrBCD = "" + ByteUtil.BCD2Long_BE(bs, index, index + 2) ;
      String rtuAddrStr = "" + ByteUtilUnsigned.bytes2Short_BE(bs, index + 3) ;
      while(rtuAddrStr.length() < 5){
         rtuAddrStr = "0" + rtuAddrStr ;
      }
      return rtuAddrBCD + rtuAddrStr ;
   }
   /**
    * 分析功能码
    * @param bs 上行字节数组