package BaoWen; import java.util.LinkedHashMap; import Frame.Gps_data_hui_fang; import Judge.JugeNumber; import Method.BaoWenShow; import Method.GetNowTime; import PbuliClass.Systems; import VectroData.ForwardDatas; import engbs.BS_urt_add_fence; import engbs.Bs_look_baowen; import fence.Pointoutwaringbaidu; import http.HTTP_Post; import monitorGas.Dell_co; import person.Person; import person.person_Dell; import rtkanchor.Dell_jizhan; import rtkanchor.Jizhan; import tag.Tag_Dell; import tbDataModel.Tb_gps; import tbDataModel_Dell.Dell_tb_suanfa2; import urt.Control_urt; import urt.Dell_gps; import urt.GnssToXY; import urt.HistoryGNGGA; import urt.xytognss; public class Dell_GNGGA { //ÊÇ·ñ´æÔÚÊý¾Ýת·¢ static int size=ForwardDatas.get_tb_forward_datas().size(); static int[] xyhf=new int[4]; static boolean weizhiok=true;//λÖùýÂË¶Ô static boolean urtmode1=false;//URTģʽϲÉÓõ¥µã¶¨Î» static String gps_utc_time;//×Ö¶Î1£ºUTC ʱ¼ä£¬hhmmss.sss£¬Ê±·ÖÃë¸ñʽ static String gps_weidu;//×Ö¶Î2£ºÎ³¶Èddmm.mmmm£¬¶È·Ö¸ñʽ£¨Ç°µ¼Î»Êý²»×ãÔò²¹0£© static String gps_NS;//×Ö¶Î3£ºÎ³¶ÈN£¨±±Î³£©»òS£¨ÄÏ㣩 static String gsp_jingdu;//×Ö¶Î4£º¾­¶Èdddmm.mmmm£¬¶È·Ö¸ñʽ£¨Ç°µ¼Î»Êý²»×ãÔò²¹0£© static String gps_EW;//×Ö¶Î5£º¾­¶ÈE£¨¶«¾­£©»òW£¨Î÷¾­£© //×Ö¶Î6£º¶¨Î»ÖÊÁ¿GPS״̬£¬0³õʼ»¯£¬ 1µ¥µã¶¨Î»£¬ 2Âë²î·Ö£¬ 3ÎÞЧPPS£¬ //4¹Ì¶¨½â£¬ 5¸¡µã½â£¬ 6ÕýÔÚ¹ÀËã 7£¬È˹¤ÊäÈë¹Ì¶¨Öµ£¬ 8Ä£Äâģʽ£¬ 9WAAS²î·Ö static String gps_state="0"; static String state="³õʼ»¯"; static String gps_num;//×Ö¶Î7£ºÕýÔÚʹÓõÄÎÀÐÇÊýÁ¿£¨00 - 12£©£¨Ç°µ¼Î»Êý²»×ãÔò²¹0£© static String gps_hdop;//×Ö¶Î8£ºHDOPˮƽ¾«¶ÈÒò×Ó£¨0.5 - 99.9£© static String gps_haiba_gao;//×Ö¶Î9£ºº£°Î¸ß¶È£¨-9999.9 - 99999.9£© static String gao_danwei;//¸ß¶Èµ¥Î»M±íʾÃ× static String gps_tuoqiu;//×Ö¶Î10£ºµØÇòÍÖÇòÃæÏà¶Ô´óµØË®×¼ÃæµÄ¸ß¶È static String gps_chafen_time;//×Ö¶Î11£º²î·Öʱ¼ä£¨´Ó×î½üÒ»´Î½ÓÊÕµ½²î·ÖÐźſªÊ¼µÄÃëÊý£¬Èç¹û²»ÊDzî·Ö¶¨Î»½«Îª¿Õ£© static String gps_chafen_id;//×Ö¶Î12£º²î·ÖÕ¾IDºÅ0000 - 1023£¨Ç°µ¼Î»Êý²»×ãÔò²¹0£¬Èç¹û²»ÊDzî·Ö¶¨Î»½«Îª¿Õ£© static String gps_jiaoyan;//×Ö¶Î13£ºÐ£ÑéÖµ static String tagid="0000";//É豸id static String power="-1";//É豸µçÁ¿ static String gpsxinhao="0";//GPSÐźÅÇ¿¶È static String baoliu1="0";//±£Áô×Ö¶Î1£¬CO+URTµÄʱºòΪCOµÄŨ¶È static String baoliu2="0";//±£Áô×Ö¶Î2 static String baoliu3="0";//±£Áô×Ö¶Î3 static int dianliang; static Person person; /*** *gps¾­Î³¶ÈÊý¾Ý *$GNGGA,[utc_time],[ weidu],[ NS],[ jingdu],[ EW],[state],[num],[hdop],[haiba_gao], *[gao_danwei],[tuoqiu],[chafen_time],[chafen_id],[jiaoyan],[tagid],[power],[ÐźÅÇ¿¶È],[±£Áô1],[±£Áô2],[±£Áô3] *ʾÁУº$GNGGA£¬043310.44,3951.73773,N,11615.40420,E,4,12,0.71,53.0,M,-8.9,M,1.4,1935*41,1234,2d *ʾÀýУº$GNGGA,045449.000,3951.764319,N,11615.386554,E,2,19,0.70,57.726,M,-9.89,M,11,0000*69,1872,2d,19,0,0,0 *˵Ã÷£º *1.$GNGGA;//°üÍ· *2.utc_time;//×Ö¶Î1£ºUTC ʱ¼ä£¬hhmmss.sss£¬Ê±·ÖÃë¸ñʽ *3.weidu;//×Ö¶Î2£ºÎ³¶Èddmm.mmmm£¬¶È·Ö¸ñʽ£¨Ç°µ¼Î»Êý²»×ãÔò²¹0£© *4.NS;//×Ö¶Î3£ºÎ³¶ÈN£¨±±Î³£©»òS£¨ÄÏ㣩 *5.jingdu;//×Ö¶Î4£º¾­¶Èdddmm.mmmm£¬¶È·Ö¸ñʽ£¨Ç°µ¼Î»Êý²»×ãÔò²¹0£© *6.EW;//×Ö¶Î5£º¾­¶ÈE£¨¶«¾­£©»òW£¨Î÷¾­£© *7.state;//×Ö¶Î6£º¶¨Î»ÖÊÁ¿GPS״̬£¬0³õʼ»¯£¬ 1µ¥µã¶¨Î»£¬ 2Âë²î·Ö£¬ 3ÎÞЧPPS£¬ 4¹Ì¶¨½â£¬ 5¸¡µã½â£¬ 6ÕýÔÚ¹ÀËã 7£¬È˹¤ÊäÈë¹Ì¶¨Öµ£¬ 8Ä£Äâģʽ£¬ 9WAAS²î·Ö *8.num;//×Ö¶Î7£ºÕýÔÚʹÓõÄÎÀÐÇÊýÁ¿£¨00 - 12£©£¨Ç°µ¼Î»Êý²»×ãÔò²¹0£© *9.hdop;//×Ö¶Î8£ºHDOPˮƽ¾«¶ÈÒò×Ó£¨0.5 - 99.9£© *10.haiba_gao;//×Ö¶Î9£ºÌìÏß¾àÀëº£Æ½Ãæ¸ß¶È£¨-9999.9 - 99999.9£© *11.gao_danwei;//×Ö¶Î10£º¸ß¶Èµ¥Î»M±íʾÃ× *12.tuoqiu;//×Ö¶Î11£ºµØÇòÍÖÇòÃæÏà¶Ô´óµØË®×¼ÃæµÄ¸ß¶È *13.chafen_time;//×Ö¶Î12£º²î·Öʱ¼ä£¨´Ó×î½üÒ»´Î½ÓÊÕµ½²î·ÖÐźſªÊ¼µÄÃëÊý£¬Èç¹û²»ÊDzî·Ö¶¨Î»½«Îª¿Õ£© *14.chafen_id;//×Ö¶Î13£º²î·ÖÕ¾IDºÅ0000 - 1023£¨Ç°µ¼Î»Êý²»×ãÔò²¹0£¬Èç¹û²»ÊDzî·Ö¶¨Î»½«Îª¿Õ£© *15.jiaoyan;//×Ö¶Î14£ºÐ£ÑéÖµ *16.tagid;//×Ö¶Î15,£ºÉ豸id,µÍλÔÚǰ¸ßλÔÚºóHEX¸ñʽ *17.power;//×Ö¶Î16£»µçÁ¿£¬HEX¸ñʽ£¬0~100 *18.ÐźÅÇ¿¶È *19.±£Áô1 *20. ±£Áô2 *21.±£Áô3* */ @SuppressWarnings("unused") public static void dell_GNGGA(String message0,String ip,int port) { hui_fu_ggaok(ip,port); String time=GetNowTime.now(); String message=message0.replaceAll("\r\n", ""); String[] gpgga=message.split(","); int lenth=gpgga.length; if(lenth==17 || lenth==18 || lenth>=21 ) { gps_utc_time=gpgga[1];//×Ö¶Î1£ºUTC ʱ¼ä£¬hhmmss.sss£¬Ê±·ÖÃë¸ñʽ gps_weidu=gpgga[2];//×Ö¶Î2£ºÎ³¶Èddmm.mmmm£¬¶È·Ö¸ñʽ£¨Ç°µ¼Î»Êý²»×ãÔò²¹0£© gps_NS=gpgga[3];//×Ö¶Î3£ºÎ³¶ÈN£¨±±Î³£©»òS£¨ÄÏ㣩 gsp_jingdu=gpgga[4];//×Ö¶Î4£º¾­¶Èdddmm.mmmm£¬¶È·Ö¸ñʽ£¨Ç°µ¼Î»Êý²»×ãÔò²¹0£© gps_EW=gpgga[5]; gps_state=gpgga[6]; state=get_gps_state(gpgga[6],lenth);//ÎÀÐǶ¨Î»×´Ì¬ÎÄ×Ö gps_num=gpgga[7];//×Ö¶Î7£ºÕýÔÚʹÓõÄÎÀÐÇÊýÁ¿£¨00 - 12£©£¨Ç°µ¼Î»Êý²»×ãÔò²¹0£© gps_hdop=gpgga[8];//×Ö¶Î8£ºHDOPˮƽ¾«¶ÈÒò×Ó£¨0.5 - 99.9£© gps_haiba_gao=gpgga[9];//×Ö¶Î9£ºº£°Î¸ß¶È£¨-9999.9 - 99999.9£© gao_danwei=gpgga[10];//¸ß¶Èµ¥Î»M±íʾÃ× gps_tuoqiu=gpgga[11];//×Ö¶Î10£ºµØÇòÍÖÇòÃæÏà¶Ô´óµØË®×¼ÃæµÄ¸ß¶È gps_chafen_time=gpgga[12];//×Ö¶Î11£º²î·Öʱ¼ä£¨´Ó×î½üÒ»´Î½ÓÊÕµ½²î·ÖÐźſªÊ¼µÄÃëÊý£¬Èç¹û²»ÊDzî·Ö¶¨Î»½«Îª¿Õ£© gps_chafen_id=gpgga[13];//×Ö¶Î12£º²î·ÖÕ¾IDºÅ0000 - 1023£¨Ç°µ¼Î»Êý²»×ãÔò²¹0£¬Èç¹û²»ÊDzî·Ö¶¨Î»½«Îª¿Õ£© gps_jiaoyan=gpgga[14];//×Ö¶Î13£ºÐ£ÑéÖµ tagid=gettagid(gpgga[15]);//É豸id power=getpower(gpgga[16]);//É豸µçÁ¿ gpsxinhao=get_gps_xinhao(gpgga[17],lenth);//GPSÐźÅÇ¿¶È baoliu1=get_gps_baoliu(gpgga[18],lenth);//±£Áô×Ö¶Î1£¬CO+URTµÄʱºòΪCOµÄŨ¶È baoliu2=get_gps_baoliu(gpgga[19],lenth);//±£Áô×Ö¶Î2 baoliu3=get_gps_baoliu(gpgga[20],lenth);//±£Áô×Ö¶Î3 person=person_Dell.get_Person(tagid); if(person==null) { Tag_Dell.add_tag(tagid,"×Ô¶¯Ìí¼Ó","150","1000","1",0,"ÈÚºÏÖÕ¶Ë",0);//×Ô¶¯Ìí¼Ó±êÇ© person_Dell.add_person(tagid, "ϵͳĬÈÏ", "×Ô¶¯Ìí¼Ó", "ÄÐ", " ","1000","ÈÚºÏÖÕ¶Ë"); return; } gps_dell_baoliu2(lenth); jingweidu_2_du();//¾­Î³¶ÈתΪ¶È¸ñʽÊä³ö weidu_is_ok_neeedo(ip,port,time);//¾­Î³¶ÈºÏ·¨ÐèÒª×öµÄÊÂÇé zhuanfa_gngga(message,tagid);//ת·¢GNGGAÊý¾Ý } BaoWenShow.show3(message, "GNSS", ip, String.valueOf(port),tagid);//ÏÔʾGNSSÊý¾Ý Bs_look_baowen.insert_all(message,tagid);//BS¶Ë²é¿´±¨ÎÄ gpgga=null; } /**20230711yang*/ public static String gettagid(String tagid1) { String tagid2=tagid1; if(tagid1.length()==1) { tagid2="000"+tagid1; } return tagid2; } /**20230711yang*/ public static String getpower(String aa2) { String dianl=aa2; dianliang=DellMessage.decodeHEX(aa2);//µçÁ¿HEXת10½øÖÆ if(dianliang>100) { dianliang=100; } dianl=String.valueOf(dianliang); return dianl; } /**20230711yang*/ public static String get_gps_xinhao(String aa3,int lenth) { String nowstate="0"; if(lenth==18){ nowstate=aa3;//ÐźÅÇ¿¶È person_Dell.dell_tagtakeoff(nowstate, tagid); } return nowstate; } /**20230711yang*/ public static String get_gps_state(String aa4,int lenth) { String state1="0"; if(JugeNumber.isDigit(aa4)) { state1=Dell_gps.gnss_state(aa4);//ÎÀÐǶ¨Î»Êý¾Ý״̬ } return state1; } /**20230711yang*/ public static String get_gps_baoliu(String aa5,int lenth) { String baoliu="0"; if(lenth==21){//Èç¹û³¤¶ÈµÈÓÚ21 baoliu=aa5; } return baoliu; } /**20230711yang*/ public static void gps_dell_baoliu2(int lenth) { if(lenth==21){//Èç¹û³¤¶ÈµÈÓÚ21 baoliu2(person,baoliu2); } } /**20230711yang*/ public static void weidu_is_ok_neeedo(String ip,int port,String time) { int gpsgood=gps_weidu.length(); if(gpsgood>3) { person.setBaoliu5("3");//½«±êÇ©ÉèÖÃΪ´øgnss±êÇ© person.setBaoliu8(ip);//ÉèÖñêÇ©µÄIPµØÖ· person.setBaoliu9(port+"");//ÉèÖñêÇ©¶Ë¿Ú person_Dell.change_person_online(person,tagid);//¸Ä±äÈËÔ±ÔÚÏß״̬ person.setJingdu(gsp_jingdu); person.setWeidu(gps_weidu); person.setGao(gps_haiba_gao); person.setGpsstate(state); int c1=Integer.parseInt(gps_state); person.setGngga_state(c1); person.setGpson_off(1); person.setXinhaotime(time); person.setReceive_gngga_time(time);//ÐÞ¸ÄÊÕµ½ºÏ·¨GNGGAÊý¾Ýʱ¼ä jwd_to_do(gps_weidu,gsp_jingdu);//¾­Î³¶Èת¶È¸ñʽ String type=person.getBaoliu19(); Dell_co.alertco(type, baoliu1, tagid, person); urtstatedo(person,gps_state,tagid);//»ñµÃgps״̬×öµÄÊÂÇé,Ãâ²¼ÏßģʽÐèÒª×öµÄÊÂÇé dell_needbaseid(person,gsp_jingdu,gps_weidu);//¿ªÆô×Ô½¨²î·Ö»ù×¼Õ¾ÐèÒª×öµÄÊÂÇé Dell_gps.add_or_alert_gps(gps_utc_time,gps_weidu,gps_NS,gsp_jingdu, gps_EW, gps_state,gps_num, gps_hdop,gps_haiba_gao,gps_tuoqiu,gps_chafen_time, gps_chafen_id, gps_jiaoyan,tagid,power,"3"); Tb_gps gps=Dell_gps.get_tb_gps(tagid); Dell_gps.alertjwd(tagid, gsp_jingdu, gps_weidu); double wd=Double.parseDouble(gps_weidu); double jd=Double.parseDouble(gsp_jingdu); double h=Double.parseDouble(gps_haiba_gao); person_Dell.have_ok_gnggan_alertperson(tagid); Pointoutwaringbaidu.is_out_fence_baidu(tagid,gps_weidu, gsp_jingdu,h);//ÅжÏÊÇ·ñÔڰٶȵØÍ¼³öÈ¥¸æ¾¯ÇøÓò if (Dell_tb_suanfa2.isGnss2xyopen()) { gnsstoxy_needdo(gps, person, tagid, wd, jd, gps_weidu, gsp_jingdu, gps_haiba_gao, gps_state, power, gps_utc_time, gps_num, gps_hdop, gps_chafen_id, state, h); } Juge_indoor.data_from_gps(person, gps, gpsxinhao, tagid); person_Dell.alert_gpsonoff(tagid, 1);//±êÇ©GPS´¦ÓÚ¿ªÆô״̬ Dell_gps.alert_ipport(tagid, ip, port); if(BS_urt_add_fence.isDrawfence()) {//ͨ¹ýURT»æÖƵç×ÓΧÀ¸ BS_urt_add_fence.addfence(tagid,jd, wd,gps_state,h); } }else {//Èç¹û¾­Î³¶È³¤¶È²»ºÏ·¨ Dell_gps.alert(tagid, power,gps_state, ip, String.valueOf(port)); } } /**20230711yang¾­Î³¶ÈתΪ¶È¸ñʽÊä³ö*/ public static void jingweidu_2_du() { if(Gps_data_hui_fang.isD2dd()) {//¾­Î³¶ÈתΪ¶È¸ñʽÊä³ö String mes=xytognss.jwdzd(gps_weidu,gsp_jingdu); BaoWenShow.show4("¶È¸ñʽ:"+mes,"GNSS",tagid);//ÏÔʾGNSSÊý¾Ý } } /**Èç¹û¿ªÆôURT×ö»ùվģʽͬʱ´¦Óڹ̶¨½âģʽ*/ public static void open_urt_to_jizhan() { if(Systems.isUrtopen()) { Dell_gps.urt_moshi(tagid, gsp_jingdu, gps_weidu, gps_state, gps_haiba_gao, gps_num, power); urtdo(gps_weidu,gps_state,tagid,gsp_jingdu); } } /**λÖùýÂËËã·¨*/ public static void weizhiok(Tb_gps gps,int xnow,int ynow ) { //Èç¹û¿ªÆôλÖùýÂË //ÉÏÒ»¸ö×ø±ê int x=gps.getGpslastx(); int y=gps.getGpslasty(); //µ±Ç°×ø±ê int x1=xnow; int y1=ynow; if(x==0 && y==0) {//Èç¹û´¦ÓÚ³õʼ»¯ gps.setGpslastx(x1); gps.setGpslasty(y1); }else { double a3=(x1-x)*(x1-x)+(y1-y)*(y1-y); double a4=Math.sqrt(a3); if(a410) {//¿ªÆôλÖùýÂ˹¦ÄÜ£¬Í¨¹ý¾­Î³¶ÈתΪXY±È½Ï2µãλÖÃÌ«´ó¾ÍÂ˵ô weizhiok(gps,xyhf[0],xyhf[1]); } } boolean b = weizhiok2(gps, xyhf[0], xyhf[1]); if (b) { HistoryGNGGA.putInHistory(gps, gps_utc_time, gps_weidu, gsp_jingdu, gps_num, gps_haiba_gao, tagid, power, "1", state, gps_hdop, gps_chafen_time,//²î·Öʱ¼ä GetNowTime.timestamp2() ); } } /**URTģʽÏÂÐèÒª×öµÄÊÂÇé*/ public static void urtdo(String gps_weidu,String gps_state,String tagid,String gsp_jingdu) { if(gps_weidu.length()>4) { if( gps_state.equals("4") || gps_state.equals("5") ||urtmode1) { GnssToXY.gps2xyurt(tagid,gps_weidu,gsp_jingdu,gps_state); } } } public static boolean isUrtmode1() { return urtmode1; } public static void setUrtmode1(boolean urtmode1) { Dell_GNGGA.urtmode1 = urtmode1; } /**±êǩijÖÖ״̬ÏÂ×öµÄÊÂÇé*/ //0.³õʼ»¯,1.µ¥µã¶¨Î»,2.Âë²î·Ö,3.ÎÞЧPPS,4.¹Ì¶¨½â,5.¸¡µã½â, 6.ÕýÔÚ¹ÀËã, 7.È˹¤ÊäÈë¹Ì¶¨Öµ,8.Ä£Äâģʽ,9.WAAS²î·Ö public static void urtstatedo(Person person,String state,String tagid) { if(Systems.isWuxian()) {//Èç¹û¿ªÆôÎÞÏßģʽ if(Dell_tb_suanfa2.closeuwb(state)) { wuxiando(person,tagid,"0");//¹Ø±ÕUWB }else { wuxiando(person,tagid,"1");//¿ªÆôUWB } } } /**Ãâ²¼Ïßģʽ×öµÄÊÂÇé*/ public static void wuxiando(Person person,String tagid,String enable) { String uwbisopen=String.valueOf(person.getUwbopen()); if(!uwbisopen.equals(enable)) { Control_urt.open_or_close_uwb(person,tagid, enable); } } /*´¦Àí±£Áô2Êý¾Ý*/ public static void baoliu2(Person person,String bl2){ if(person==null) { return; } String ac=DellMessage.bytes2BinaryStr(DellMessage.HexStringToBinary(bl2));//°´¼ü if(ac.length()<3) { return; } //String sos=String.valueOf(ac.charAt(7));//°´¼üSOS״̬ String jingzhi=String.valueOf(ac.charAt(6));//»ñÈ¡±êÇ©¾²Ö¹×´Ì¬ String xm=String.valueOf(ac.charAt(5));//»ñÈ¡±êÇ©ÐÝÃß״̬ String zhendong=String.valueOf(ac.charAt(2));//»ñÈ¡±êÇ©Õ𶯷äÃù״̬ String uwb=String.valueOf(ac.charAt(1));//uwb¿ª¹Ø int uwb1 = Integer.parseInt(uwb); int zd1 = Integer.parseInt(zhendong); person.setJingzhi(jingzhi); person.setXiumian(xm); person.setUwbopen(uwb1); person.setNowzhendong(zd1); } /**ת·¢GNGGAÊý¾Ý*/ public static void zhuanfa_gngga(String message,String tagid) { if(Systems.isGps2000()) {//Èç¹û¿ªÆôxyתgnss return; } if(weizhiok) {//λÖùýÂËûÎÊÌâ Udp_Out.GNGGA_udptcp_out(message, tagid); if(ForwardDatas.have_http("GNGGA")) {//HTTPת·¢Î»ÖÃÊý¾Ý LinkedHashMap display=new LinkedHashMap(); display.put("positionmsg", message); HTTP_Post.gngga("", "", display); } } } /**×Ô½¨²î·Ö»ùÕ¾µÄʱºò¼ÆËã±êÇ©ÐèÒªµÄ²î·Ö»ùÕ¾*/ public static void dell_needbaseid(Person person,String jd0,String wd0) { if(!Systems.isBiandianzhan()) {//Èç¹ûÊÇ×Ô½¨²î·Ö»ù׼վģʽ return; } int size=Dell_jizhan.getJizhan_vector().size();//»ñÈ¡²î·Ö»ù×¼Õ¾µÄÊýÁ¿ if(size>1) { for(int i=0;i