src/baowen/Dell_uanshi_byt.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/baowen/Udp_Receive.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/data_model/Dell_door.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/frame/Index1.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/home/DabaseInitialize.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/baowen/Dell_uanshi_byt.java
@@ -123,7 +123,7 @@ String type=ysbyt.getType(); switch(type) { case "01"://测距信息 Dell_55AA01.dell55AA01(ysbyt.getPack().toString(), ip, port); break; case "0A"://0A注册包 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()) { src/data_model/Dell_door.java
@@ -4,7 +4,7 @@ import java.util.Vector; import DataBase.DatabaseManagement; public class Dell_door { static Vector<Tb_door> Tb_doorvc=new Vector<Tb_door>(); @SuppressWarnings("rawtypes") public static Vector<Tb_door> getvec() { Vector<Tb_door> jiancevc=new Vector<Tb_door>(); @@ -42,4 +42,23 @@ } return jiancevc; } public static Vector<Tb_door> getTb_doorvc() { return Tb_doorvc; } public static void insert_tbdoor(String tagid,String anchorid,String distance,String power,String addtime) { Tb_door data=new Tb_door(); data.setTagid(tagid); data.setAnchorid(anchorid); data.setDistance(distance); data.setPower(power); data.setAddtime(addtime); Tb_doorvc.add(data); } public void setTb_doorvc(Vector<Tb_door> tb_doorvc) { Tb_doorvc = tb_doorvc; } } src/frame/Index1.java
@@ -79,6 +79,7 @@ static String datatypeis="全部数据类型"; static boolean chushi_enhd=false; static boolean start_jiexi=false; static String tagid="0"; public Index1() {//构造方法 Toolkit toolkit = getToolkit();// 获得窗体工具包 @@ -434,7 +435,8 @@ search.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String serch=getSearchFileld().getText().trim(); if(getSearchFileld().getText().length()>=1) { tagid=serch; if(serch.length()>=1) { int size=Dell_door.serch(serch).size(); ShowMessage.zidingyi("搜索到数据"+size); updateSerch(serch); @@ -485,6 +487,7 @@ but_shuaxin1=new JButtonModel("刷新表格"); but_shuaxin1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { tagid="0"; updateTable(); } }); @@ -513,6 +516,10 @@ Index1.showare = showare; } public static String getTagid() { return tagid; } src/home/DabaseInitialize.java
@@ -1,4 +1,5 @@ package home; import baowen.Insertdatabase; import baowen.Udp_Receive; import data_model.Dell_door; import data_model.Dell_fangzhuang; @@ -14,7 +15,8 @@ new Dell_door();//初始化系统 new Index1(); // ChuShiHua.ding_shi_qi();//启动定时器// new Udp_Receive().startThread(); new Udp_Receive().startThread(); new Insertdatabase().startThread(); // new Dell_message24().startThread();//启动处理报文线程2 }