| | |
| | | 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(); // 输出异常信息 |
| | |
| | | } |
| | | |
| | | 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; |
| | |
| | | |
| | | //处理55AAOC开头的报文 |
| | | 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) { |
| | |
| | | |
| | | /**报文显示调用*/ |
| | | 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(); |
| | | 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); |
| | | } |
| | | |
| | | } |
| | | |
| | | /**添加基站进入报文*/ |