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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
package BaoWen;
import Frame.Gps_data_hui_fang;
import Frame.Julidebug;
import Frame.Tagstate;
import Frame.TcpIpManage;
import JNADell.DataToJnaDell;
import JNADell.Dell_usetaganchor;
import Judge.JugeNumber;
import Method.AddTagZidong;
import Method.BaoWenShow;
import Method.ControTag;
import Method.GetNowTime;
import Method.InsertData;
import Method.JudgeTagOrAnchorOffline;
import Method.PutPosInHistoryDataBase;
import Method.StringToHex;
import PbuliClass.Shi_jian_cha_sss;
import PbuliClass.ShowMessage;
import PbuliClass.Systems;
import ToolBarS.ToolBarModel;
import VectroData.ForwardDatas;
import anchor.Anchor;
import anchor.Anchor_Dell;
import engbs.Bs_look_baowen;
import jiekou.Warnig;
import person.Person;
import person.person_Dell;
import tag.Tag;
import tag.Tag_Dell;
import tbDataModel.Tb_gas_anchor;
import tbDataModel.Tb_tag_gas_jiaozhun_value;
import tbDataModel_Dell.Dell_tag_gas_jiaozhun_value;
import tbDataModel_Dell.Dell_tb_gas_anchor;
import tbDataModel_Dell.Dell_tb_suanfa2;
 
/**
 * 1°üÍ·  55AA0C£»
 * 2¡¢Ö¸ÁîÀàÐÍ£¨1Byte£©    0x0c£»¡¾2¡¿
 * 3¡¢ Êý¾Ý¶Î³¤¶È£¨1Byte£©15+6*»ùÕ¾ÊýÁ¿£»¡¾3
 * 4¡¢ ±êÇ©ID£¨2Byte£©    £»¡¾4£¬5¡¿
 * 6¡¢±êÇ©°üÐò£¨2Byte£©    £»¡¾6£¬7¡¿
 * 8¡¢µçÁ¿£¨1Byte£©    £»¡¾8¡¿
 * 9¡¢°´¼ü£¨1Byte£©    £»¡¾9¡¿
 * 10¡¢±êÇ©Ïà¶Ô¸ß¶È£¨2Byte£©µ¥Î»cm£¬Ïà¶Ô²Î¿¼»ùÕ¾¸ß¶È¡££»¡¾10,11¡¿
 * 12¡¢±êǩƵÂÊ£¨1Byte£©£»¡¾12¡¿
 * 13¡¢±êǩʱ¼äƬ£¨1Byte£©£»¡¾13¡¿
 * 14¡¢±£Áô£¨2Byte£©    £»¡¾14,15¡¿
 * 16¡¢»ùÕ¾ÊýÁ¿£¨1Byte£©£»¡¾16¡¿
 * 17¡¢»ùÕ¾ID£¨2*»ùÕ¾ÊýÁ¿ Byte£©£»¡¾17£¬16+2*»ùÕ¾ÊýÁ¿¡¿
 * 17+2*num »ùÕ¾¾àÀ루4*»ùÕ¾ÊýÁ¿Byte£©µÍλÔÚǰ£¬µ¥Î»cm£¬ÓëÇ°Ãæ»ùÕ¾ID¶ÔÓ¦
 * 18+6*num»ùÕ¾ÐźÅÇ¿¶È£¨2*»ùÕ¾ÊýÁ¿ Byte£©
 * Ð£Ñ飨2Byte£©
 **/
public class Dell_55AA0C {
    static int biaozhi = 0;
    static int k = 0;
    static int num = 0;
    static int baoxu0 = 0;//³õʼʱºò°üÐò
    static int baoxunow = 0;//µ±Ç°°üÐò
    static int b = 0;//µ±Ç°°üÐò
    static float c = 0;
    static int biaozhi2 = 0;
    static boolean datashow = false;
    static String[] hex;
    static String button;
    static String jingzhi;
    static String xiumian;
    static String tagoff;//±êÇ©±»²ð³ý
    static Tb_gas_anchor ancgas = null;
    static String receiveoled = "0";
    static int gaserro = 0;    
    static String tag_gao_sanwei = Dell_tb_suanfa2.getSuanfa2().getBaoliu2();//±êÇ©µÄ×Ô¶¯½ÃÕýĬÈÏ·ÅÖø߶È
    static boolean urtopen = Systems.sys().getCs_udp().length() > 3;//¿ªÆôURT¼àÌý
    static boolean urtgoodstate = false;
    static StringBuffer data = new StringBuffer();
    static StringBuffer anchids = new StringBuffer();
    static StringBuffer distances = new StringBuffer();
    static StringBuffer qiangdu1s = new StringBuffer();
    static StringBuffer qiangdu2s = new StringBuffer();
    static String tagid = null;
    static int power = -1;
    static int baoxu;
    static int stationary_flag;
    static int tag_hz;
    static int shijianpian;
    static int anchornum;
    static int heart;//ÐÄÂÊ
    static String nowzhendong;//Õð¶¯×´Ì¬
    static int sanwei_tag_gao;//±êǩʵʱ¸ß¶È
    static String gas_anchorid;//Èýά²Î¿¼»ùÕ¾ID
    static int gas_anchor_qiya_zhi;
    static int gascha;
    static int gasancgao;
    static String tag_qiyazhi;//ÆøÑ¹¼ÆÖµ
    static int tag_now_gas_zhi;//±êÇ©µ±Ç°ÆøÑ¹Öµ+У׼ֵ
    static int tag_now_gas;//±êÇ©µ±Ç°µÄÆøÑ¹Öµ
    static String[] anchorid;//»ùÕ¾µÄ¼¯ºÏ20230708
    static Tag tag;
    static Person person;
    static int tagid_int;
    static int[] anchorid_int ;//»ñÈ¡²â¾à»ùÕ¾µÄ¼¯ºÏintÐÍ»ùÕ¾ID20230708
    static int[] distance ;//»ñÈ¡¾àÀëµÄ¼¯ºÏ20230708yang
    static int[] anchorxinhao;//»ùÕ¾ÐźÅÇ¿¶ÈµÄ¼¯ºÏ120230708yang
    static int[] anchorxinhao2;//»ùÕ¾ÐźÅÇ¿¶ÈµÄ¼¯ºÏ220230708yang
    static int tagspeed_limit;//20230708yang
    static int tag_heigh;//20230708yang
    static String ancrid0;//µ±Ç°²â¾àÖ÷»ùÕ¾20230708yang
    static String ip;
    static int port;
    static Tb_tag_gas_jiaozhun_value tggas;//±êÇ©ºÍÆøÑ¹»ùվУ׼ֵ¶ÔÏó
    static String receivetime;
    static String receiveoledno;//ÊÕµ½ÁËLEDÆÁÄ»»Ø¸´
 
    @SuppressWarnings("unused")
    public static void dell(String ip1, String intime, String message, int timestamp, int port1) {
        receivetime=intime;
        ip=ip1;
        port=port1;
        message = message.replaceAll("\r\n|\r|\n", "");//È¡³öËùÓГQÐкͻسµ
        int lenth = message.length();
        if (lenth > 10) {
            isshow();//ÊÇ·ñÐèÒªÏÔʾ±¨ÎÄ            
            hex = StringToHex.hex(message);//ԭʼÊý¾Ý
            String type = hex[2];//Ö¸ÁîÀàÐÍ
            int datalenth1 = DellMessage.decodeHEX(hex[3]);//Êý¾Ý³¤¶È
            datalenth1 = datalenth1 * 2 + 8;
            if (lenth == datalenth1) {
                tagid = hex[5] + hex[4];//±êÇ©ID
                power = getpower(hex[8]);//µçÁ¿
                baoxu = DellMessage.decodeHEX(hex[7] + hex[6]);//°üÐò                
                receiveoledno =get_anjian_value(hex[9],0);//ÊÕµ½ÁËLEDÆÁÄ»»Ø¸´
                receiveoled =get_anjian_value(hex[9],1); //ÊÕµ½ÁËLEDÆÁÄ»»Ø¸´yes
                nowzhendong = get_anjian_value(hex[9],2);//Õð¶¯×´Ì¬
                tagoff =get_anjian_value(hex[9],4);//±êÇ©·À²ð
                xiumian =get_anjian_value(hex[9],5);//±êÇ©ÐÝÃß
                jingzhi =get_anjian_value(hex[9],6);//±êÇ©¾²Ö¹
                button = get_anjian_value(hex[9],7);//°´¼ü°´ÏÂ
                stationary_flag = Integer.parseInt(jingzhi);//±êÇ©¾²Ö¹×´Ì¬
                tag_hz = DellMessage.decodeHEX(hex[12]);//±êǩƵÂÊ
                heart = DellMessage.decodeHEX(hex[15]);//±êÇ©ÐÄÂÊ
                anchornum = DellMessage.decodeHEX(hex[16]);//»ùÕ¾ÊýÁ¿
                shijianpian = DellMessage.decodeHEX(hex[14]+hex[13]);//±êǩʱ¼äƬ
                ancrid0 = hex[18] + hex[17];//µ±Ç°²â¾àµÄÖ÷»ùÕ¾
                anchorid = new String[anchornum];//»ùÕ¾ID¼¯ºÏ
                anchorid_int = get_anchorids_int();//»ñÈ¡²â¾à»ùÕ¾µÄ¼¯ºÏintÐÍ»ùÕ¾ID20230708
                distance = get_distance_int();//»ñÈ¡¾àÀëµÄ¼¯ºÏ
                anchorxinhao =qiangdu1();//»ùÕ¾ÐźÅÇ¿¶ÈµÄ¼¯ºÏ1
                anchorxinhao2 =qiangdu2();//»ùÕ¾ÐźÅÇ¿¶ÈµÄ¼¯ºÏ2                
                jixi_ok(timestamp);//½âÎöÊý¾Ý
                showdata(ip, port);//±¨ÎÄÏÔʾ
            } else {
                Dell_uanshi_byt.intsert(ip, message, intime, timestamp, port);
            }
        } else {
            Dell_uanshi_byt.intsert(ip, message, intime, timestamp, port);
        }
    }
 
    /**20230709Êý¾Ý½âÎöÍê³ÉºóÐèÒª×öµÄÊÂÇé*/
    public static void jixi_ok(int timestamp) {
        add_tag_auto(tagid,power);//×Ô¶¯Ìí¼Ó±êÇ©·½·¨
        person = get_person() ;
        if (person != null) {
            tagid_int = person.getTagidint();
            tag = Tag_Dell.get_tag(tagid);
            send_time_id_to_oled();//·¢ËÍʱ¼äºÍID¸øÐÄÂÊ´øÆÁÄ»±êÇ©
            button_do(button);//°´¼ü°´ÏºóÐèÒª´¦ÀíµÄÊÂÇé
            dell_pian(ip,port);//´¦Àíʱ¼äƬ·½·¨
            alert_taghz_auto();//×Ô¶¯Ð޸ıêǩƵÂÊ·½·¨    
            if (tag != null) {
                dell_baoxu();//´¦Àí°üÐò                
                tagspeed_limit = gettagspeed_limit();//±êÇ©µÄËÙ¶ÈÏÞÖÆÖµ
                String baoxustr = String.valueOf(baoxu);
                dellsos();//ÏÔʾ°´¼ü°´ÏµÄÐÅÏ¢Èç¹ûºǫ́ģʽ²»ÏÔʾ
                Tag_Dell.have550c_alert_tag(tag, tagid, button, xiumian, power);
                alert_person(ip,port,nowzhendong);//¸üÐÂÈËԱһЩÐÅÏ¢                    
                alerthz();//¿ªÆô×Ô¶¯ÐÞ¸ÄÆµÂʹ¦ÄÜ
                costom1();//Èç¹û´æÔÚ¶¨ÖÆ×ª·¢Êý¾Ýcostm1
                sanwei();//ÈýάģʽÐèÒª×öµÄÊÂÇé
                have_acrdo();//»ñÈ¡µ½²â¾à»ùÕ¾IDÐèÒª×öµÄÊÂÇé
                have_distance_do();//Óвâ¾àÐÅÏ¢ºóÐèÒª×öµÄÊÂÇé
                mohujisuan();//Ä£ºýλÖüÆËã
                /**SOS¸æ¾¯**/
                Warnig.sos(tag, tagoff, button, jingzhi, xiumian, tagid,receivetime, String.valueOf(baoxu), person);
                Have_ceju_message_do.dosometing(tagid, String.valueOf(power), ip,
                        button, anchorid, tagoff, distance, xiumian, jingzhi, person);
                anchor_onlie_record(ancrid0);//ÉèÖÃÖ÷»ùÕ¾                
                AA0CToJNA.ToJNA(//Êý¾Ý¸øµ½JNA
                        person,
                        tagid,
                        receivetime,//²åÈëʱ¼ä
                        baoxustr,//°üÐò
                        baoxu,//°üÐòÕûÊý
                        String.valueOf(power),//µç³ØµçÁ¿
                        String.valueOf(button),//SOS¸æ¾¯
                        timestamp,// Ê±¼ä´Á
                        Anchor_Dell.anchor_xyz(anchorid, "x"),// »ùÕ¾x×ø±ê¼¯ºÏ
                        Anchor_Dell.anchor_xyz(anchorid, "y"),
                        Anchor_Dell.anchor_xyz(anchorid, "z"),
                        distance,// ¾àÀëµÄ¼¯ºÏ
                        anchornum,// »ùÕ¾ÊýÁ¿
                        anchorid_int,//»ùÕ¾id
                        tagid_int,// ±êÇ©ID
                        dell_tagheigt(),//±êÇ©Åå´÷¸ß¶È,// ±êÇ©¸ß¶È
                        tag_hz,//±êǩƵÂÊ
                        tagspeed_limit,// ±êÇ©ËÙ¶ÈÏÞÖÆ
                        distance, //»ùÕ¾¾àÀë
                        stationary_flag,//±êǩֹ״̬
                        anchorxinhao,//µÚ1·ÐźÅÇ¿¶È
                        anchorxinhao2,//µÚ2·ÐźÅÇ¿¶È
                        Anchor_Dell.anchor_floor(anchorid),//»ùÕ¾ËùÔڵIJã
                        tag_now_gas_zhi,//ÆøÑ¹¼ÆÖµ
                        anchorid//»ùÕ¾ID¼¯ºÏ
                        );
            }
        } else {
            notagdo(tagid, ancrid0);//±êÇ©²»´æÔÚÐèÒª×öµÄÊÂÇé
        }
 
    }
 
 
    /**2023.07.08yang»ñÈ¡µçÁ¿*/
    public static int getpower(String hexpower) {
        int power1 = DellMessage.decodeHEX(hexpower);//µçÁ¿
        if (power1 > 100) {
            power1 = 100;
        }
        return power1;
    }
 
    /**×Ô¶¯Ìí¼Ó±êÇ©2023.07.08*/
    public static void add_tag_auto(String tagid1,int power1) {
        if (ToolBarModel.isAddtagzidong()) {    //Èç¹ûÆô¶¯×Ô¶¯Ìí¼Ó±êÇ©,×Ô¶¯Ìí¼Ó±êÇ©
            AddTagZidong.auto_addtag(tagid1, String.valueOf(power1));
        }
    }
 
    /**¸üÐÂÈËÔ±ÐÅÏ¢2023.07.08*/
    public static void alert_person(String ip,int port,String nowzhendong) {
        if(person !=null ) {
            person.setXinhaotime(GetNowTime.now());//ÉèÖÃÊÕµ½ÐźÅʱ¼ä
            person.setHave_uwbxinhao(1);
            person.setBaoliu8(ip);
            person.setBaoliu9(String.valueOf(port));
            person.setRealhz(tag_hz);
            person.setHavexinhao(true);
            person.setP_power(String.valueOf(power));//¸üÐÂÈËÔ±µçÁ¿
            if (anchorid.length != 0) {
                person.setNow_ceju_anchorid(anchorid[0]);//ÉèÖõ±Ç°²â¾àµÄÖ÷»ùÕ¾
            }
            person.setBaoliu16(String.valueOf(heart));//ÉèÖÃÐÄÂÊÊý¾Ý
            person.setNowzhendong(Integer.parseInt(nowzhendong));
            person.setUwbopen(1);
        }
    }
 
    /**20230708ÊÕµ½°´¼üÐÅÏ¢ºó×öµÄÊÂÇé*/
    public static void button_do(String button) {
        //ÏÔʾ°´¼ü°´ÏµÄÐÅÏ¢
        if (button.equals("1")) {
            ShowMessage.zidingyi(GetNowTime.now2() + ": " + tagid + " °´¼ü°´ÏÂ" + button);
            /*  Tag tag1 = Tag_Dell.get_tag(tagid);
            String tagtype = tag1.getTagtype();
            if (tagtype.equals("¹¤ÅÆ´øÆÁ")) {
                String s = GetNowTime.timestamp4();
                Dell_usetaganchor.message_to_Lora(tagid, s, "¹¤ÅÆ´øÆÁ", "88");
            }*/
        }
    }
 
    /**20230708¶¯Ì¬Ð޸ıêǩƵÂÊ·½·¨*/
    public static void alert_taghz_auto() {
        if (!Systems.isZidongshijianpian()) {//Èç¹û¿ªÆô×Ô¶¯Ê±¼äƬģʽ
            int needhh = person.getTagneedhz();
            if (tag_hz != needhh && stationary_flag == 0) {//¶¯Ì¬Ð޸ıêǩƵÂÊ
                person_Dell.autor_alert_hz(person);
            }
        }
    }
 
    /**´¦Àí°üÐòµÄ·½·¨20230708yang*/
    public static void  dell_baoxu() {
        if (BaoxuID.get_bxid(tagid_int) != null) {
            int lastbaoxu = BaoxuID.get_bxid(tagid_int).getLastbaoxu();
            if (baoxu > lastbaoxu || baoxu < (lastbaoxu - 10)) {
                BaoxuID.add_idbaoxu(tagid_int, baoxu, lastbaoxu);
            }
        } else {
            BaoxuID.add_idbaoxu(tagid_int, baoxu, baoxu);
        }
    }
 
    /**´¦Àí±êÇ©µÄ¸ß¶È20230708*/
    public static int dell_tagheigt() {
        int tag_heigh = 150;
        if(Systems.isIssanwei()) {    //Èç¹û¿ªÆôÈýάģʽµÄʱºò±êÇ©¸ß¶È        
            if(sanwei_tag_gao>200) {
                tag_heigh =150;
            }else if(sanwei_tag_gao<0){
                tag_heigh =0;
            }else {
                tag_heigh =sanwei_tag_gao;
            }            
        }else if (JugeNumber.isDigit(tag.getTag_pos_z())) {
            tag_heigh = Integer.parseInt(tag.getTag_pos_z());
        }
        return tag_heigh;
    }
 
    /**20230807»ñÈ¡²â¾à»ùÕ¾µÄ¼¯ºÏ*/
    public static int[] get_anchorids_int() {
        int[] anchorid_int = new int[anchornum];
        for (int i = 0; i < anchornum; i++) {
            anchorid[i] = hex[18 + i * 2] + hex[17 + i * 2];            
            anchorid_int[i] = Integer.parseInt(anchorid[i], 16);            
            addbuf(anchids, i, anchorid[i]);
        }
        return anchorid_int;
    }
 
    public static void have_acrdo() {
        if(tag !=null) {
            tag.setAnchorid(anchorid[0]);//Èç¹û¿ªÆô×Ô½âËãģʽÉèÖÃÖ÷»úÕ¾ID
            for (int i = 0; i < anchornum; i++) {                    
                anchorid_int[i] = Integer.parseInt(anchorid[i], 16);
                Anchor acr = Anchor_Dell.get_anchor(anchorid[i]);
                if (acr == null && biaozhi2 == 0) {
                    ControTag.restore_tag(tagid);
                    biaozhi2 = 1;
                }
            }
        }
    }
 
    /**20230708»ñÈ¡²â¾à»ùÕ¾¾àÀëµÄ¼¯ºÏ*/
    public static int[] get_distance_int() {
        int dis1 = anchornum *2 + 17;
        int dis2 = dis1 + 1;
        int dis3 = dis1 + 2;
        int dis4 = dis1 + 3;                    
        int[] distance = new int[anchornum];        
        for (int j = 0; j < anchornum; j++) {
            distance[j] = DellMessage.decodeHEX(hex[dis4 + j * 4] + hex[dis3 + j * 4] + hex[dis2 + j * 4] + hex[dis1 + j * 4]);
            addbuf(distances, j, String.valueOf(distance[j]));
        }        
        return distance;
    }
 
    public static void have_distance_do() {
        if (Dell_tb_suanfa2.isJuli_juge_in()) {//Èç¹û¿ªÆôͨ¹ý¾àÀëÅжÏÊÒÄÚÍâ
            for (int j = 0; j < anchornum; j++) {
                if (distance[j] != 131071 && distance[j] != 0) {
                    distance[j] = distance[j] - tag.getBaoliu3();
                }            
                if (distance[j] > 900000 || distance[j] < -10000) {
                    continue; //Ìø³öµ±Ç°µÄÑ­»·£¬¼ÌÐøÖ´ÐÐforÑ­»·µÄÏÂÒ»¸öÑ­»·Ìå
                }
            }
            juli_juge_indoor(anchorid, distance,person);//ͨ¹ý¾àÀëÅжÏÊÇ·ñÔÚÊÒÄÚ
        }
        if (Julidebug.isStart_test()) {
            Julidebug.cejifenxi(tagid, baoxu0, baoxu, baoxunow, anchornum, anchorid, distance);
        }
    }
 
 
 
    /**20230708µÚ1·ÐźÅÇ¿¶È*/
    public static int[] qiangdu1() {
        int[] anchorxinhao = new int[anchornum];
        int k1 = anchornum * 6 + 17;
        int k2 = k1 + 1;
        for (int j = 0; j < anchornum; j++) {
            anchorxinhao[j] = -DellMessage.decodeHEX(hex[k2 + j * 2]);
            addbuf(qiangdu1s, j, String.valueOf(anchorxinhao[j]));
        }
        return anchorxinhao;
    }
 
    /**20230708µÚ2·ÐźÅÇ¿¶È*/
    public static int[] qiangdu2() {
        int[] anchorxinhao2 = new int[anchornum];
        int k1 = anchornum * 6 + 17;
        for (int j = 0; j < anchornum; j++) {
            anchorxinhao2[j] = -DellMessage.decodeHEX(hex[k1 + j * 2]);
            addbuf(qiangdu2s, j, String.valueOf(anchorxinhao2[j]));
        }
        return anchorxinhao2;
    }
    /**»ñÈ¡±êÇ©ËÙ¶ÈÏÞÖÆ20230708*/
    public static int gettagspeed_limit() {
        int tagspeed_limit = 100000;//±êÇ©µÄËÙ¶ÈÏÞÖÆÖµ
        String sulv = tag.getTag_sulv();
        if (JugeNumber.isDigit(sulv)) {
            tagspeed_limit = Integer.parseInt(sulv);
        }
        return tagspeed_limit;
    }
    /**
     * ÏÔʾµ÷ÊÔÊý¾Ý
     */
    public static void show_debugmessage(
            int counter, // °üÐò
            int stamp, // Ê±¼ä´Á
            String tagid, // ±êÇ©id
            int tagpz, // ±êÇ©¸ß¶È
            int taghz, // ±êǩƵÂÊ
            int speed, // ±êÇ©×î´óËÙ¶È
            int nmove, // ±êÇ©¾²Ö¹×´Ì¬flag
            int tbaro, // ÆøÑ¹¸ß¶È, Ô­À´µÄ¸ß¶ÈÐÅÏ¢Ïȱ£Áô²»¶¯
            int annum, // »ùÕ¾ÊýÄ¿
            String[] an_id, // »ùÕ¾id, Óëannum¶ÔÓ¦
            int[] andis, // ²â¾à, Óëannum¶ÔÓ¦
            int[] power, // ÐźÅÇ¿¶È, Óëannum¶ÔÓ¦
            int[] powerd, // ÐźÅÇ¿¶È²î, Óëannum¶ÔÓ¦
            int[] pos
            ) {
 
 
        /**Èç¹ûµ÷ÊÔģʽ¿ªÆô*/
        if (TcpIpManage.getStar() && TcpIpManage.getDatatypeis().equals("µ÷ÊÔÊý¾Ý")) {
            StringBuffer text_str = new StringBuffer();
            text_str.append("DATA2," +
                    String.valueOf(counter) + ","//°üÐò0-65535Ñ­»·
                    + String.valueOf(stamp) + ","//ʱ¼ä´Á
                    + tagid + ","//±êÇ©ID
                    + String.valueOf(tagpz) + ","//±êÇ©¸ß¶È
                    + String.valueOf(taghz) + ","//±êǩƵÂÊ
                    + String.valueOf(speed) + ","//ËÙ¶ÈÏÞÖÆ100000´ú±íÎÞÏÞÖÆ
                    + String.valueOf(nmove) + ","//±êÇ©¾²Ö¹×´Ì¬£¬1´ú±í¾²Ö¹£¬0´ú±íû¾²Ö¹
                    + String.valueOf(tbaro) + ","//±êÇ©ÆøÑ¹¼ÆÖµ
                    + String.valueOf(annum) + ","//»ùÕ¾ÊýÁ¿
                    + DataToJnaDell.getbufString(an_id) + ","//»ùÕ¾ID¼¯ºÏ
                    + DataToJnaDell.getbuf(andis) + ","//¾àÀ뼯ºÏ
                    + DataToJnaDell.getbuf(power) + ","//»ùÕ¾µÚһ·ÐźÅÇ¿¶È¼¯ºÏ
                    + DataToJnaDell.getbuf(powerd) + ","//    »ùÕ¾µÚ¶þ·ÐźÅÇ¿¶È¼¯ºÏ
                    + DataToJnaDell.getbuf(pos)//½âËã½á¹û4,(x,y,z,floor)
                    );
            TcpIpManage.get_text_area().append(text_str + "\n");
            TcpIpManage.get_text_area().setCaretPosition(TcpIpManage.get_text_area().getText().length());
            text_str = null;
        }
 
    }
 
 
    public static void setNum(int num) {
        Dell_55AA0C.num = num;
    }
 
 
    public static void setB(int b) {
        Dell_55AA0C.b = b;
    }
 
    /**ÈýάģʽÐèÒª×öµÄÊÂÇé20230708*/
    public static void sanwei() {
        if (Systems.isIssanwei()) {//Èç¹û¿ªÆôµÄÊÇ3άģʽ
            tag_now_gas=DellMessage.decodeHEX(hex[11] + hex[10]);            
            Tb_gas_anchor ancgas1=Dell_tb_gas_anchor.get_Tb_gas_anchor(tagid);
            if(ancgas1 !=null) {//²»Îª¿Õ˵Ã÷ÊÇÆøÑ¹»ùÕ¾
                //                DellJAN.qiya(tagid_int, tag_now_gas_zhi);//¸üÐÂJNA²Î¿¼»ùÕ¾µÄÆøÑ¹Öµ
                sanwei_tag_gao = Integer.parseInt(ancgas1.getAnchorz());
                Dell_tb_gas_anchor.alert_state(ancgas1,tag_now_gas+"");//ÐÞ¸ÄÆøÑ¹»ùÕ¾ÔÚÏß״̬ºÍʵʱֵ
            }else {//Èç¹û²»ÊÇÆøÑ¹»ùÕ¾
                Anchor acr=Anchor_Dell.get_anchor(ancrid0);
                if(acr !=null) {//Èç¹û¸Ã»ùÕ¾²»´æÔÚ
                    gas_anchorid=acr.getBaoliu1();//ͨ¹ýÖ÷»ùÕ¾ÕÒµ½¶ÔÓ¦µÄÆøÑ¹»ùÕ¾
                    tggas=Dell_tag_gas_jiaozhun_value.get_Tb_gas_anchor(tagid,gas_anchorid);
                    if(tggas !=null) {//Èç¹û±êÇ©ºÍ»ùÕ¾¶ÔÏó´æÔÚ    
                        int tag_jiao_zhun_zhi=tggas.getValue();//µ±Ç°±êÇ©ºÍµ±Ç°ÆøÑ¹»ùÕ¾µÄУ׼ֵ
                        tag_now_gas_zhi=tag_now_gas+tag_jiao_zhun_zhi;//±êÇ©µ±Ç°ÆøÑ¹¼ÆÖµ+±ê׼У׼ֵ
                        ancgas =Dell_tb_gas_anchor.get_Tb_gas_anchor(gas_anchorid);//ͨ¹ýÖ÷»ùÕ¾ÕÒµ½ÆøÑ¹²Î¿¼»ùÕ¾¶ÔÏó
                        Dell_tag_gas_jiaozhun_value.jiaozhun_tag_gasvalue(tagid,tag,tag_now_gas); //У׼±êÇ©ÆøÑ¹·½·¨
                        if(ancgas !=null) {
                            gas_anchor_qiya_zhi = ancgas.getAnchorqiyagaodu();//²Î¿¼»ùÕ¾ÆøÑ¹¼Æ¸ß¶È
                            gascha = tag_now_gas_zhi - gas_anchor_qiya_zhi;//ÆøÑ¹¸ß¶È²î=±êÇ©µ±Ç°ÆøÑ¹¼ÆÖµ-»ùÕ¾ÆøÑ¹¼ÆÖµ
                            gasancgao = Integer.parseInt(ancgas.getAnchorz());    //ÆøÑ¹»ùÕ¾°²×°¸ß¶È
                            sanwei_tag_gao = gasancgao + gascha;//±êÇ©¸ß¶È=ÆøÑ¹»ùÕ¾°²×°¸ß¶È+ÆøÑ¹²î
                            tggas.setTag_gas(tag_now_gas);
                            tggas.setTag_now_gao(sanwei_tag_gao+"cm");
                            PutPosInHistoryDataBase.inset_tag_gas_in_history(ancgas, tagid, gas_anchorid,tag_now_gas+"",
                                    sanwei_tag_gao+"", receivetime);//½«Êý¾Ý±£´æ½øÈëÊý¾Ý¿â
                        }
                    }
                }
            }
        }
    }
 
 
 
    public static void setGaserro(int gaserro) {
        Dell_55AA0C.gaserro = gaserro;
    }
 
 
    /**
     * ´¦Àí°´¼ü°´Ïºóʼþ
     */
    public static void dellsos() {
        if (button.equals("1") && !Stac.isHoutai()) {
            boolean a3 = tag.getTag_sos().equals("0");
            if (a3) {
                String tip = tagid + "°´¼ü°´ÏÂ";
                ShowMessage.zidingyi(tip);
                Person person = person_Dell.get_Person(tagid);
                person.setP_sos("1");
                String type = person.getBaoliu19();
                if (type == null || !type.equals("ÐÄÂÊ´øÆÁ")) {
                    InsertData.sosin_tbwarnig(tagid, "");
                }
 
            }
        }
    }
 
    /**
     * ±¨ÎÄÊÇ·ñÒªÏÔʾ
     */
    public static void isshow() {
        boolean baowen = TcpIpManage.getDatatypeis().equals("±¨ÎÄÊý¾Ý");
        if (TcpIpManage.getStar() && baowen) {
            datashow = true;
        } else {
            datashow = false;
        }
    }
 
 
    /**
     * ±¨ÎÄÏÔʾµ÷ÓÃ
     */
    public static void showdata(String ip, int port) {
        if(!TcpIpManage.getStar() ) {
            return;
        }
        if (!TcpIpManage.isShowfrom()) {//Èç¹ûÏÔʾÊý¾ÝÀ´Ô´
            data.append(GetNowTime.timestamp2() + ",from:" + ip + ":" + port + ",");
        }
        data.append("ID:" + tagid + ",");
        String a1 = "ƵÂÊ:" + tag_hz + ",";
        data.append(a1);
        data.append("¾²Ö¹:" + jingzhi + ",");
        data.append("°´¼ü:" + button + ",");
        data.append("°üÐò:" + baoxu + ",");
        data.append("µçÁ¿:" + power + ",");        
        data.append("ÐÝÃß:" + xiumian + ",");
        data.append("IMU:" + stationary_flag + ",");
        data.append("Ƭ:" + shijianpian + ",");        
        data.append("»ùÕ¾:" + anchornum + ",");
        data.append("»ùÕ¾:" + anchids + ",");
        data.append("¾àÀë:" + distances + ",");
        data.append("²ð³ý:" + tagoff + ",");
        data.append("ÐÄÂÊ:" + heart + ",");
        data.append("Ç¿¶È1:" + qiangdu1s + ",");
        data.append("Ç¿¶È2:" + qiangdu2s);
        if (Systems.isIssanwei()) {
            if(Dell_tb_gas_anchor.get_Tb_gas_anchor(tagid) !=null) {
                String anchrz=Dell_tb_gas_anchor.get_Tb_gas_anchor(tagid).getAnchorz();
                data.append(",°²×°¸ß¶È:"+anchrz+",²Î¿¼»ùÕ¾Aѹ:" +tag_now_gas);
            }else {
                data.append(",ʵʱ¸ß:" + sanwei_tag_gao + ",");
                data.append("[²Î¿¼»ùÕ¾" + gas_anchorid + ",Aѹ" + gas_anchor_qiya_zhi + ",Tѹ" + tag_now_gas + ",ʵʱ¸ß" 
                        + sanwei_tag_gao + "]");
            }
        }
 
        String as = data.toString() + "\n ";
        BaoWenShow.showbaowen4("±¨ÎÄÊý¾Ý",as, tagid);
        Bs_look_baowen.insert_all(ip+":"+port+","+data.toString(),tagid);//BS¶Ë²é¿´±¨ÎÄyang20230725        
        data.setLength(0);
        anchids.setLength(0);
        distances.setLength(0);
        qiangdu1s.setLength(0);
        qiangdu2s.setLength(0);
    }
 
    /**
     * Ìí¼Ó»ùÕ¾½øÈ뱨ÎÄ
     */
    public static void addbuf(StringBuffer buf, int i, String anchorid) {
 
        if (anchornum == 1) {
            buf.append("[" + anchorid + "]");
        } else {
            if (i == 0) {
                buf.append("[" + anchorid + ",");
            } else if (i == (anchornum - 1)) {
                buf.append(anchorid + "]");
            } else {
                buf.append(anchorid + ",");
            }
 
        }
    }
 
    /**
     * Èç¹û´æÔÚcostom1µÄÊý¾Ýת·¢ÀàÐÍÔòÖ´ÐÐÏÂÃæ²Ù×÷20230708
     */
    public static void costom1() {
        if (ForwardDatas.isCutom1()) {
            person.setAnchors(anchorid);
            person.setSn(String.valueOf(baoxu));
        }
    }
 
    /**
     * ±êÇ©²»´æÔÚµÄʱºòÖ´Ðеķ½·¨
     */
    public static void notagdo(String tagid, String anchorid) {
        String as = tagid + " is null \n";
        if (Tagstate.isFanjihuo()) {
            ControTag.noinkonghzitag(0, tagid, (byte) 0x44, anchorid);//Ï·¢Í£Ö¹¼¤»î
            as = anchorid + "Ï·¢Í£Ö¹¼¤»î" + tagid + "\n";
        }
        BaoWenShow.showbaowen4("±¨ÎÄÊý¾Ý", as, tagid);
    }
 
    /**
     * ±êǩƵÂʺÍʵ¼Ê²»Ò»ÖÂÐ޸ıêǩƵÂÊ
     */
    public static void alerthz() {
        if (!Tagstate.isAutoalerthz()) {
            return;
        }
        String hz = String.valueOf(tag_hz);
        Tag tag = Tag_Dell.get_tag(tagid);
        String pinlv = tag.getTag_pinglv();
        if (hz.equals(pinlv)) {
            return;
        }
        String time = person.getAlerthztime();
        if (time == null) {
            ControTag.set_tag_hz(pinlv, tagid);
            person.setAlerthztime(GetNowTime.now());
        } else {
            boolean aa = Shi_jian_cha_sss.shijiancha(time, 60);
            if (aa) {
                ControTag.set_tag_hz(pinlv, tagid);
                person.setAlerthztime(GetNowTime.now());
            }
        }
 
    }
 
    /**
     * ·¢ËÍʱ¼äºÍID¸øÐÄÂÊ´øÆÁÄ»±êÇ©
     */
    public static void send_time_id_to_oled() {
        if (person==null||!person.getBaoliu19().equals("ÐÄÂÊ´øÆÁ")) {
            return;
        }
        if (receiveoled.equals("1")) {
            Dell_usetaganchor.sendid_time(tagid, person);
        }
    }
 
 
    /**
     * Í¨¹ý¾àÀëÅжϱêÇ©ÊÇ·ñÔÚÊÒÄÚ
     */
    public static void juli_juge_indoor(String[] anchorid, int[] distance,Person person) {
        int size = anchorid.length;
        for (int i = 0; i < size; i++) {
            Anchor acr = Anchor_Dell.get_anchor(anchorid[i]);
            if (acr != null) {
                int juli = acr.getBaoliu5();
                if (distance[i] > 0 && distance[i] < juli) {
                    person.setdistance_juge_indoor(1);
                    return;
                }
            }
        }
        person.setdistance_juge_indoor(0);
    }
 
    /**
     * ´¦Àíʱ¼äƬ
     */
    public static void dell_pian(String ip, int port) {
        if(person !=null) {
            boolean huifang = Gps_data_hui_fang.isStartok();//ÊÇ·ñ¿ªÆô±¨ÎĻطÅ
            if (!huifang) {
                if (!Systems.isZidongshijianpian()) {//ÊÇ·ñ¿ªÆô×Ô¶¯Ê±¼äƬ¹¦ÄÜ
                    if(Dell_tb_gas_anchor.get_Tb_gas_anchor(tagid) !=null) {//Èç¹û±êÇ©ÊÇÆøÑ¹»ùÕ¾Ôò·µ»Ø
                        return;
                    }
                    if (person.getPian() != shijianpian) {//Èç¹ûʱ¼äƬ²»µÈÓÚ·Öµ½µÄƬ
                        ControTag.konghzitag(1, tagid, (byte) 0x60, "", tagid + "Óвâ¾àµ«Ê±¼äƬ²»ÊÇϵͳ·ÖÅäµÄÖØÆô");//ÖØÆôÕâ¸ö±êÇ©
                        data.append("±êÇ©ID:"+tagid+"£¬°üÐò:"+baoxu + ",ƵÂÊ:" + tag_hz + "£¬»ùÕ¾Êý:" + anchornum + "£¬ÊµÊ±Æ¬:" 
                                +shijianpian+"ºÍϵͳ·ÖÅ䯬£º"+person.getPian()+"²»Æ¥Åäreturn \n");
                        showdata(ip, port);
                    }
                } else {
                    person.setPian(shijianpian);
                }
            }
        }
    }
 
 
    /**»ùÕ¾ÉÏÏ߼Ǽ*/
    public static void anchor_onlie_record(String aid){        
        Anchor anchor1 = Anchor_Dell.get_anchor(aid);//¸ù¾ÝÖ÷»ùÕ¾ID»ñÈ¡»ùÕ¾¶ÔÏó        
        if (anchor1 != null ) {//Èç¹ûÊÇÖ÷»ùÕ¾²¢ÇÒ´Ë»ùÕ¾ÀëÏßÔòÉèÖÃΪÔÚÏß
            String state=anchor1.getAnc_status() ;
            String tagid=anchor1.getAnc_id();            
            if(state.equals("0")) {
                if(!Systems.isWuxian()) {//¶¨Î»Ä£Ê½·ÇÎÞÏßģʽÉúЧ
                    String tm=anchor1.getAnc_cteatetime();
                    int a= Shi_jian_cha_sss.get_time_cha_s(GetNowTime.now(),tm);                
                    JudgeTagOrAnchorOffline.insert_indata_shangxian(tagid,"ÀëÏߺó»ùÕ¾ÉÏÏß","ÀëÏßʱ³¤:"+a);//»ùÕ¾ÀëÏß²åÈëÀëÏ߼ǼÊý¾Ý¿â    
                }else {
                    JudgeTagOrAnchorOffline.insert_power_into_database(tagid,
                            anchor1.getBaoliu8(), anchor1,0);
                }
                anchor1.setAnc_status("1");
                Anchor_Dell.set_anchor_image(1,aid);
            }else if(state.equals("-1")) {
                JudgeTagOrAnchorOffline.insert_indata_shangxian(tagid,"ÖØÆôÈí¼þ»ùÕ¾ÉÏÏß","Èí¼þÖØÆô");
                if(Systems.isWuxian()) {
                    JudgeTagOrAnchorOffline.insert_power_into_database(tagid,
                            anchor1.getBaoliu8(), anchor1,-1);
                }
                anchor1.setAnc_status("1");
                Anchor_Dell.set_anchor_image(1,aid);
            }
        }
    }
 
    /**»ñÈ¡°´¼üµÄÖµ*/
    public static String  get_anjian_value(String hex,int wei) {
        byte[] byt = DellMessage.HexStringToBinary(hex);
        String ac = DellMessage.bytes2BinaryStr(byt);//°´¼ü
        String value= String.valueOf(ac.charAt(wei));
        return value;
    }
 
    /**»ñÈ¡ÈËÔ±*/
    public static Person get_person() {
        Person person1 = person_Dell.get_Person(tagid);
        if (person1 == null) {
            //ControTag.konghzitag(1, tagid, (byte) 0x60, "", "±êÇ©²»´æÔÚÖØÆô");//ÖØÆôÕâ¸ö±êÇ©
            String a=tagid+"δÌí¼ÓµÄ±êÇ©²â¾à"+","+GetNowTime.now();
            BaoWenShow.show(a, "±¨ÎÄÊý¾Ý",tagid);
        }
        return person1;
    }
 
    /**Ä£ºý¼ÆËãλÖ÷½·¨*/
    public static void mohujisuan() {
        if(Dell_tb_suanfa2.isIs_open_mohujisuan()) {
            Anchor acr=Anchor_Dell.get_anchor(ancrid0);
            if(acr==null) {
                return;
            }
            int x=Integer.parseInt(acr.getAnc_x());
            int y=Integer.parseInt(acr.getAnc_x());
            int floor=Integer.parseInt(acr.getAnc_floor());
            if(person !=null) {
                person.setMohux(x);
                person.setMohuy(y);
                person.setMohufloor(floor);
            }
        }
    }
 
}