package BaoWen; import Frame.TcpIpManage; import JNADell.DellJAN; import Method.BaoWenShow; import Method.GetNowTime; import Method.StringToHex; import anchor.Anchor; import anchor.Anchor_Dell; import person.Person; import person.person_Dell; import tag.Tag; import tag.Tag_Dell; import tbDataModel_Dell.Read_Write_Anchor_Message; public class Dell_55AA1A { static String tagid; static String anchorid; static String[] hex; static int hz; static int power;//ÐźÅÇ¿¶È static String tagstate; static String move_open;//¿ªÆôÕñ¶¯01 static String sleep_open;//¿ªÆôÐÝÃß01 static String button;//°´¼ü״̬01±íʾ°´Ï static String version;//±êÇ©°æ±¾ºÅ static int gonglv;//±êÇ©µÄ¹¦ÂÊ static int speed;//±êÇ©µÄ¼ÓËÙ¼ÆãÐÖµ static int sleep_time;//±êÇ©¾²Ö¹ÐÝÃßʱ¼ä static int gas; static int port; static String ip; static Person person; /**yang20230814 * ´¦Àí55AA1AµÄ×¢²á±¨ÎÄ*/ public static void dell(String infom,String ip1,int port1) { ip=ip1; port=port1; BaoWenShow.show(infom, "55AA0A",""); hex=StringToHex.hex(infom); anchorid=hex[5]+hex[4]; tagid=hex[7]+hex[6]; tagstate=DellMessage.bytes2BinaryStr(DellMessage.HexStringToBinary(hex[8])); move_open=tagstate.substring(7,8);//¿ªÆôÕñ¶¯01 sleep_open=tagstate.substring(6,7);//¿ªÆôÐÝÃß01 button=tagstate.substring(5,6);//°´¼ü״̬01±íʾ°´Ï version=get_versoin(hex[10],hex[9]);//±êÇ©°æ±¾ºÅ hz=get_value(hex[11]);//±êÇ©µÄƵÂÊ gonglv=get_value(hex[12]);//±êÇ©µÄ¹¦ÂÊ speed=get_value((hex[14]+hex[13]));//±êÇ©µÄ¼ÓËÙ¼ÆãÐÖµ sleep_time=get_value((hex[16]+hex[15]));//±êÇ©¾²Ö¹ÐÝÃßʱ¼ä power=get_value((hex[17]));//±êÇ©ÐźÅÇ¿¶È gas= Integer.valueOf(hex[19]+hex[18], 16).shortValue();//ÆøÑ¹¼ÆÖµ get_dell_hz();//´¦ÀíÆµÂÊ´óÓÚ20HzµÄÎÊÌâ show_baowen(tagstate,move_open,sleep_open,version,gonglv,speed,sleep_time);//ÏÔʾ±¨ÎÄ Tag_Dell.alert_tag(tagid,version, move_open, sleep_open, button,gonglv,speed,sleep_time,power,gas); fen_pian();//·ÖÅäʱ¼äƬ } /**yang20230723 */ public static String get_versoin(String hex1,String hex2) { String vers="V"+Integer.parseInt(hex1,16)+"."+Integer.parseInt(hex2,16); return vers; } /**yang20230723 */ public static int get_value(String hex) { return Integer.parseInt(hex,16); } /**yang20230723 */ public static void get_dell_hz() { if(hz>20) { hz=1; } } /**yang20230723 */ public static void show_baowen(String tagstate,String move_open,String sleep_open, String version,int gonglv,int speed,int sleep_time) { if(TcpIpManage.getStar()) {//ÏÔʾ±êǩע²áÐÅÏ¢ String tagid0=tagid; Tag tag=Tag_Dell.get_tag(tagid); if(tag==null) { tagid0=tagid+"δÌí¼Ó±êÇ©"; } String a=tagid0+"×¢²á"+ ", À´×Ô:"+anchorid+ ", ״̬:"+tagstate+ ", Õñ¶¯:"+move_open+ ", ÐÝÃß:"+sleep_open+ ", °æ±¾:"+version+ ", ƵÂÊ:"+hz+ ", ¹¦ÂÊ:"+gonglv+ ", IMU:"+speed+ ", ÐÝÃßʱ¼ä:"+sleep_time+ ", Ç¿¶È£º"+power+ ","+GetNowTime.timestamp2(); BaoWenShow.show(a, "×¢²á±¨ÎÄ",tagid); } } /**·ÖÅäʱ¼äƬ*/ public static void fen_pian() { person = person_Dell.get_Person(tagid); String a="·ÖƬ£º"+tagid+"£¬ÆµÂÊ"+hz+"£¬¸ø»ùÕ¾"+anchorid; if(person !=null) { int tagidint=Integer.parseInt(tagid,16); int timestamp=GetNowTime.timestamp(); Anchor anchor=Anchor_Dell.get_anchor(anchorid); if(anchor !=null) {//Èç¹ûÖ¸¶¨Á˸øÄ³¸ö»ùվϷ¢×¢²áÐÅÏ¢ int shijianpian=DellJAN.get_slotted_aloha(timestamp,tagidint,hz);//Ë÷ȡʱ¼äƬ if(shijianpian>-1) { person.setPian(shijianpian); byte[] byt=Read_Write_Anchor_Message.write_timestamp(tagid, hz, shijianpian);//¼ÆËã³öʱ¼äƬºó½«Êý¾Ý¸øµ½»ùÕ¾ Udp_Receive.out(byt,byt.length,anchor,"´¦Àí×¢²áÐÅÏ¢"); } a="·ÖƬ£º"+tagid+"£¬ÆµÂÊ"+hz+"£¬¸ø»ùÕ¾"+anchorid+",Ƭ"+shijianpian; }else { anchorid=anchorid+"»ùÕ¾²»´æÔÚ"; } }else { tagid=tagid+"±êǩδÌí¼Ó"; } BaoWenShow.show(a,"×¢²á±¨ÎÄ",tagid); } }