wenzheng.yang
2023-06-13 963ab41dff2876c091ff0405931aa5d3f8f71780
src/baowen/Udp_Receive.java
@@ -89,12 +89,18 @@
            int port=packet.getPort();   
            String datas=Tools.Bytes2HexString(byt);
            String upinfo=datas.toUpperCase();
            if(Index1.getTagid().equals("原始数据")){
               if(Index1.isShoware()) {
                  Index1.ara_show(upinfo);
               }
            }
            i=i+1;
            Index1.getUdpnum().setText(i+"条");   
            if(i==100000) {
               i=0;
            }
            dell55aa0c_start(upinfo,ip,port);
            Dell_55AA01.dell55aa01_start(upinfo, ip, port);
            byt=null;
         } catch (Exception e) {
            e.printStackTrace(); // 输出异常信息
@@ -112,8 +118,11 @@
      System.arraycopy(src, begin, bs, 0, count);
      return bs;
   }
   public static void dell55aa0c_start(String message,String ip,int port) {
      if(!message.startsWith("55AA0C")) {
         return;
      }
      message=message.replaceAll("\r\n|\r|\n", "");//取出所有換行和回车
      String[] aa0=message.split("55AA");
      int size=aa0.length;
@@ -124,13 +133,17 @@
   }
   //处理55AAOC开头的报文
   public static void dell_55aa0c(String message,String ip,int port) {
   public static void dell_55aa0c(String message,String ip,int port) {
      int lenth=message.length();
      int timestamp=GetNowTime.timestamp();
      String intime=GetNowTime.timestamp2();
      if(lenth>10) {
         hex=hex(message);
         String type= hex[2] ;//指令类型
         if(!type.equals("0C")) {
            return;
         }
         int datalenth1=decodeHEX(hex[3]) ;//数据长度
         datalenth1=datalenth1*2+8;
         if(lenth==datalenth1) {                  
@@ -162,7 +175,7 @@
      }
   }
   /**处理测距数据方法*/
   public static void dellceju(String anchorid ,int dis) {
      fzdata=Dell_fangzhuang.get_anchor(anchorid);
@@ -218,24 +231,34 @@
      return numb;
   }
   /**报文显示调用*/
   public static void showdata() {
      if(Index1.getTagid().equals("原始数据")) {
         return;
      }
      if(Index1.isShoware()) {
         data.append("ID:"+tagid+",");
         data.append("包序:"+baoxu+",");
         data.append("电量:"+power+",");
         data.append("基站:"+anchornum+",");
         data.append("基站:"+anchids+",");
         data.append("基站数:"+anchornum+",");
         data.append("编号:"+anchids+",");
         data.append("距离:"+distances+",");         
         String as=data.toString();
         Index1.ara_show(as);
         String as=data.toString();
         if(Index1.getTagid().equals("0")) {
            Index1.ara_show(as);
         }else {
            if(Index1.getTagid().equals(tagid)) {
               Index1.ara_show(as);
            }
         }
         data.setLength(0);
         anchids.setLength(0);
         distances.setLength(0);
      }
   }
   /**添加基站进入报文*/
   public static void addbuf(StringBuffer buf,int i,String anchorid) {
      if(Index1.isShoware()) {