zsh_root
2024-01-02 7b595546af704983dbafcd0d385c8768ddacefc2
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
package rtkanchor;
import java.math.BigInteger;
import Netty.SendMessageToClient;
import PbuliClass.ShowMessage;
import person.Person;
import person.person_Dell;
import urt.xytognss;
public class SendMessage  implements Runnable {    
    static boolean jishi=false;
    static int jishu1=1;
    static int jishu2=1;
 
    /*** ½«16½øÖÆ×Ö·û´®×ª»»Îªbyte[]
     ** @param str
     * @return
     */
    public static byte[] toBytes(String str) {
        if (str == null || str.trim().equals("")) {
            return new byte[0];
        }
 
        byte[] bytes = new byte[str.length() / 2];
        for (int i = 0; i < str.length() / 2; i++) {
            String subStr = str.substring(i * 2, i * 2 + 2);
            bytes[i] = (byte) Integer.parseInt(subStr, 16);
        }
 
        return bytes;
    }
 
 
 
    public static void setJishi(boolean jishi) {
        SendMessage.jishi = jishi;
    }
 
 
 
    public static int getJishu2() {
        return jishu2;
    }
 
 
 
    public static void setJishu2(int jishu2) {
        SendMessage.jishu2 = jishu2;
    }
 
 
    /**B5 62 ;°üÍ·
     * 06 ;Àà
     * 71 ;ID 
     * 28 ;length 
     * 00 ;°æ±¾ºÅ
     * 00 ;±£Áôλ
     * 00 02 01 
     * 80 4F 50 49 (4-7×Ö½Ú)γ¶È
     * 00 14 CC 0F(8-11×Ö½Ú)¾­¶È
     * 10 27 00 00 (12-15×Ö½Ú)¸ß¶ÈÀåÃ× 
     * 00 00 00 00 E8 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1B 17
     * B562067128000000020108584B455481C2171027000000000000E80300000000000000000000000000000000000062B3
     * */
 
    public static void send_info_to_anchor(Jizhan ac,String wd,String jd,String gd) {
        StringBuffer a0=new StringBuffer();
        StringBuffer a1=new StringBuffer();
        a0.append("B5620671280000000201");
        a1.append("0671280000000201");
        double[] jwd=xytognss.dd2d_double(wd,jd);
        double wd0= jwd[1]*10000000;
        double jd0= jwd[0]*10000000;
        int wd1=new Double(wd0).intValue();
        int jd1=new Double(jd0).intValue();
        double gd0=Double.parseDouble(gd)*100;
        int gd1=(int)gd0;
        String wdhex=Bytes2HexString(int2hex(wd1));
        String jdhex=Bytes2HexString(int2hex(jd1));
        String gdhex=Bytes2HexString(int2hex(gd1));
        a0.append(wdhex+jdhex+gdhex);
        a1.append(wdhex+jdhex+gdhex);
        String a2="000000006400000000000000000000000000000000000000";
        a0.append(a2);
        a1.append(a2);
        byte[] byt2=toBytes(a1.toString());
        String jiaoyanzhi=jiaoyan(byt2);
        a0.append(jiaoyanzhi);
        if(ac !=null) {
            byte[] data=toBytes(a0.toString());
            String ip=ac.getBaoliu1();//»ù×¼Õ¾µØÖ·
            if(ip !=null) {
                SendMessageToClient.send(data, ip);
                ShowMessage.zidingyi_24(ip+":·¢Ëͳɹ¦");
            }else {
                ShowMessage.zidingyi_24("·¢ËÍʧ°Ü£¬ipµØÖ·´íÎó£º"+ip);
 
            }
        }
    }
 
 
    /**·¢ËÍÐÅÏ¢¸øURT±êÇ©*/
    public static void sendmessage_to_urt(Jizhan jz,String a1) {
        if(!Rtkac_manage.isPeizhijizhan()) {//µ±»ùÕ¾²»ÔÚÅäÖÃģʽʱºò
            if(a1.length()>5) {                
                int size1=Dell_jizhan.getJizhan_vector().size();//»ñÈ¡²î·Ö»ù×¼Õ¾µÄÊýÁ¿
                int size2=person_Dell.getPerson_vector().size();
                for(int i=0;i<size2;i++) {
                    Person prs=person_Dell.getPerson_vector().get(i);
                    String onlie=prs.getP_online();
                    if(onlie.equals("0")) {//»ùÕ¾²»ÔÚÏß·µ»Ø
                        return;
                    }                    
                    if(size1==1) {
                        String ip=prs.getBaoliu8();//±êÇ©µ±Ç°µÄIPµØÖ·
                        byte[] data=toBytes(a1);
                        SendMessageToClient.send(data, ip);
                    }else {
                        String needbasid=prs.getNeedbaseid();
                        String jzacid=jz.getAcid();
                        if(needbasid.equals(jzacid)) {//Èç¹ûÈËÔ±ÔÚÏßͬʱÐèÒªµÄ»ùÕ¾IDµÈÓÚµ±Ç°»ùÕ¾ID
                            String ip=prs.getBaoliu8();//±êÇ©µ±Ç°µÄIPµØÖ·
                            byte[] data=toBytes(a1);
                            SendMessageToClient.send(data, ip);
                            //System.out.println(jzacid+"·¢Ëͳɹ¦"+ip+"needbasid"+needbasid);
                        }
                    }
                }
            }
        }
    }
 
 
    public static boolean isJishi() {
        return jishi;
    }
 
    
 
    /**½«¶È·ÖÃë¸ñʽתΪ¶È¸ñʽ*/
    public static String todufen(String Du,String Fen,String Miao){
        double strDu = Double.parseDouble(Du);
        double strFen = Double.parseDouble(Fen) / 60;
        double strMiao = Double.parseDouble(Miao) / 60;
        double dufenmiao = strDu+strFen+strMiao;
        String format = String.format("%.7f", dufenmiao);
        return format;
    }
 
    public static  byte[] intToRegisters(int v) {
        byte[] registers = new byte[4];
        registers[0] = (byte) (0xff & (v >> 24));
        registers[1] = (byte) (0xff & (v >> 16));
        registers[2] = (byte) (0xff & (v >> 8));
        registers[3] = (byte) (0xff & v);
        return registers;
    }
 
    /**½«intתΪ4×Ö½Ú16½øÖƵÍλÔÚǰ¸ßλÔÚºó*/
    public static byte[] int2hex(int n) {
        byte[] ba = new byte[4];
        ba[0] = (byte)(n & 0xff);
        ba[1] = (byte)((n>>8) & 0xff);
        ba[2] = (byte)((n>>16) & 0xff);
        ba[3] = (byte)((n>>24) & 0xff);
        return ba;
    }
 
    /**½«×Ö½ÚÊý×éתΪ16½øÖÆ×Ö·û´®*/ 
    public static String Bytes2HexString(byte[] b) { 
        String ret = ""; 
        for (int i = 0; i < b.length; i++) { 
            String hex = Integer.toHexString(b[i] & 0xFF); 
            if (hex.length() == 1) { 
                hex = '0' + hex; 
            } 
            ret += hex.toUpperCase(); 
        }
        return ret;
    }
 
 
 
    /**УÑé*/
    public static String jiaoyan(byte[] byt) {
        String hexa=null;
        //×Ö½ÚÊý×éתΪ16½øÖÆ×Ö·û´®/2ºóµÄ³¤¶È
        int size=Bytes2HexString(byt).length()/2;
        String[] hex=hex(Bytes2HexString(byt));
        //ÇóºÍ
        int CK_A=0;
        int CK_B=0;
        for(int i=0;i<size;i++) {
            CK_A=CK_A+decodeHEX(hex[i]);
            CK_B=CK_B+CK_A;
        }
 
        String a1= Integer.toHexString(CK_A);
        String b1= Integer.toHexString(CK_B);
        String cka=CK_AB(a1);
        String ckb=CK_AB(b1);
        hexa=cka+ckb;
        return hexa;        
 
    }
 
    public static String CK_AB(String a) {
        String ck="";
        int size=a.length();
        if(size>=2) {
            ck=a.substring(size-2, size);
        }else if(size==1) {
            ck=0+a;
        }
        return ck;
 
    }
 
    /**½«16½øÖÆ×Ö·û´®×ªÎªhex×Ö·û´®Êý×é2¸ö×Ö·û´®Ò»¸ö*/
    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½øÖÆ×ªÎª10½øÖÆ*/
    public static int decodeHEX(String hexs){
        BigInteger bigint=new BigInteger(hexs, 16);
        int numb=bigint.intValue();
        return numb;
 
    }
 
 
    @Override
    public void run() {
        // TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
 
    }
 
}