826220679@qq.com
2023-07-22 674747e1ccde2707bf4d4c02d52b7ef5af5a97dc
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
package baowen;
import java.math.BigInteger;
import java.nio.ByteBuffer;
 
import frame.Index1;
import publicclass.GetNowTime;
import publicclass.JugeNumber;
 
 
public class Dell_AACC {
    static String time;
    static String HC_header;
    static String week;
    static String second;
    static String lat;
    static String lon;
    static String alt;
    static String undulation;
    static String ve;
    static String vn;
    static String vu;
    static String pitch;
    static String roll;
    static String yaw;
    static String std_lat;
    static String std_lon;
    static String std_alt;
    static String std_ve;
    static String std_vn;
    static String std_vu;
    static String std_pitch;
    static String std_roll;
    static String std_yaw;
    static String vgyro_x;
    static String vgyro_y;
    static String vgyro_z;
    static String vacccar_x;
    static String vacccar_y;
    static String vacccar_z;
    static String speed;
    static String heading;
    static String heading2;
    static String stat;
    static String age;
    static String ns;
    static String ns2;
    static String leaps;
    static String hdop;
    static String warning;
    static String sensor_used;
    static String vacc_x;
    static String vacc_y;
    static String vacc_z;
    static String TimeValid;
    static String receiver;
    static String CRC32;
    static int lenth;
    static String mess;
 
    public static void dell_AACC(String message,String ip,int port) {
        if(message.startsWith("AACC")) {
            time=GetNowTime.gethm();
            String[] gnggns=message.split("AACC");
            int size=gnggns.length;
            if(size>2) {                
                for(int i=0;i<size;i++) {
                    if(gnggns[i].length()>5) {
                        jiexi_AACC("AACC"+gnggns[i],ip,port);
                    }
                }
            }else {
                jiexi_AACC(message,ip,port);    
            }
        }
    }
 
    public static void jiexi_AACC(String infom,String ip,int port) {        
        String[] hex=hex(infom);//ԭʼÊý¾Ý    
        String lenth0=hex[5]+hex[4];
        String lat0=hex[39]+hex[38]+hex[37]+hex[36]+hex[35]+hex[34]+hex[33]+hex[32];
        String lon0=hex[47]+hex[46]+hex[45]+hex[44]+hex[43]+hex[42]+hex[41]+hex[40];        
        String alt0=hex[51]+hex[50]+hex[49]+hex[48];
        String pitch0=hex[71]+hex[70]+hex[69]+hex[68];
        String roll0=hex[75]+hex[74]+hex[73]+hex[72];
        String yaw0=hex[79]+hex[78]+hex[77]+hex[76];
        String stat0=hex[153]+hex[152];
        String age0=hex[157]+hex[156]+hex[155]+hex[154];
        String ns0=hex[161]+hex[160];
        lenth=decodeHEX(lenth0);        
        lat=doubelttohex(lat0);        
        lon=doubelttohex(lon0);        
        alt=hextofloat(alt0);
        pitch=hextofloat(pitch0);
        roll=hextofloat(roll0);
        yaw=hextofloat(yaw0);
        stat=String.valueOf(decodeHEX(stat0));
        age=hextofloat(age0);
        ns=String.valueOf(decodeHEX(ns0));
 
        if(Index1.isShoware() ) {            
            if(Index1.getXieyi_type().equals("2")) {
                mess=time+",¾­¶È:"+lat+",γ¶È:"+lon+",¸ß³Ì:"+alt+",¸©Ñö½Ç:"+pitch
                        +",ºá¹ö½Ç:"+roll+",º½Ïò½Ç:"+yaw+",״̬:"+stat+",²î·ÖÁäÆÚ:"+age+",ÎÀÐÇ¿ÅÊý:"+ns;
            }else if(Index1.getXieyi_type().equals("1")) {
                mess=time+","+infom;
            }else if(Index1.getXieyi_type().equals("3")) {
                mess=time+",¾­¶È:"+lat0+",γ¶È:"+lon0+",¸ß³Ì:"+alt0+",¸©Ñö½Ç:"+pitch0
                        +",ºá¹ö½Ç:"+roll0+",º½Ïò½Ç:"+yaw0+",״̬:"+stat0+",²î·ÖÁäÆÚ:"+age0+",ÎÀÐÇ¿ÅÊý:"+ns0;
            }
            Index1.ara_show(mess);
        }        
 
    }
 
 
    /**16½øÖÆ×ªÎª10½øÖÆ*/
    public static int decodeHEX(String hexs){
        String hex=hexs.trim();
        boolean a=JugeNumber.isLetterDigit(hex);
        int numb=0;
        if(a) {
            BigInteger bigint=new BigInteger(hex,16);
            numb=bigint.intValue();
        }else {
            //ShowMessage.zidingyi("16½øÖÆ×ª10½øÖƳö´í,ÊÕµ½:"+hex);
        }
        return numb;
 
    }
 
 
    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;
    }
 
 
    /**16½øÖÆ×ªÎªdouble*/
    public static String doubelttohex(String hexString) {
        long longValue = Long.parseLong(hexString, 16);
        longValue = Long.parseUnsignedLong(hexString, 16);
        double doubleValue = Double.longBitsToDouble(longValue);
        byte[] bytes = hexStringToByteArray(hexString);
        doubleValue = ByteBuffer.wrap(bytes).getDouble();
        String a1=String.format("%.8f",doubleValue);
        return a1;
    }
 
    public static byte[] hexStringToByteArray(String s) {
        int len = s.length();
        byte[] data = new byte[len / 2];
        for (int i = 0; i < len; i += 2) {
            data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i + 1), 16));
        }
        return data;
    }
 
    /**16½øÖÆ×ªÎªfloat*/
    public static String hextofloat(String hex) {
        Float f = Float.intBitsToFloat(new BigInteger(hex, 16).intValue());
        String a1=String.format("%.4f",f);        
        return a1;
 
    }
 
}