wenzheng.yang
2023-06-19 8d3a46d346ef028acc16e267fe5c812c76a754e5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package baowen;
import data_model.Dell_shebei;
import frame.Index1;
import publicclass.JugeNumber;
import publicclass.ShowMessage;
 
/**´¦ÀíÐÄÌøÊý¾Ý*/
public class Dell_55AA02 {
    static int ok=0;
    
    
    
    public static void dell_55aa02_start(String message,String ip,int port) {
        if(!message.startsWith("55AA02")) {            
            return;
        }
        if(Index1.isShoware()) {
            Index1.ara_show(message);
        }
        message=message.replaceAll("\r\n|\r|\n", "");//È¡³öËùÓГQÐкͻسµ
        String[] aa0=message.split("55AA02");
        int size=aa0.length;
        for(int i=0;i<size;i++) {
            String info="55AA02"+aa0[i];
            dellrgs(info,ip,port);
        }
    }
 
    /**´¦Àí»ùÕ¾ÐÄÌøÊý¾Ý
     * 2¡¢Ö¸ÁîÀàÐÍ£¨1byte£©
     * 3¡¢Êý¾Ý³¤¶È£¨1byte£©
     * 4¡¢»ùÕ¾ID£¨2byte£©
     * 6¡¢»ùվͬ²½×´Ì¬£¨1byte£©
     * 7¡¢»ùÕ¾ÆøÑ¹¼Æ¸ß¶È£¨4byte£©µ¥Î»ÀåÃ×
     * 11¡¢±£Áô£¨4BYTE£©*/
    public static void dellrgs(String infom,String ip,int port) {        
        String[] hex=hex(infom);
        if(infom.length()<10) {
            return;
        }
        String anchorid=hex[5]+hex[4];
        String b3="ÐÄÌø°ü:"+anchorid+","+infom;
        if(Index1.isShoware()) {
            Index1.ara_show(b3);
        }
        if(!JugeNumber.isLetterDigit(anchorid)) {
            if(ok==0) {
                ok++;
                ShowMessage.zidingyi_24(anchorid+"»ùÕ¾ID±ØÐëHEX¸ñʽ£¡");
            }
            return;
        }
 
        //»ùվͬ²½×´Ì¬
//        int tongbu=Integer.parseInt(hex[6],16);
//        String tongbustate=String.valueOf(tongbu) ;
        Dell_shebei.add_shebei(anchorid, ip,"","δ°ó");
        
 
    }
    
    public static String[] hex(String message) {
        int size=message.length()/2;        
        String[] hex=new String[size];
        for(int i=0;i<size;i++) {
            hex[i]=message.substring(i*2, 2+i*2);
        }
        
        return hex;
    }
}