9.1
15832144755
2021-09-01 c6d9be2aac4965e847fd958288170e26e79b219d
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
package com.hxzkoa.udp;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Vector;
 
import com.hxzkoa.json.tb_achor;
import com.hxzkoa.json.tb_person;
import com.hxzkoa.json.tb_suanfa;
import com.hxzkoa.json.tb_system;
import com.hxzkoa.json.tb_tag;
import com.hxzkoa.util.Config;
import com.hxzkoa.util.HttpUtil;
import com.hxzkoa.util.ModifyConfig;
 
import net.sf.json.JSONObject;
 
 
public class DataToJnaDell {
    static int jianzhi=0;
 
 
//  public static void  do_dell_JAN(Vector<Ceju> vccj, int lenth,String baoxu) {        
//      int[] an_x=new int[lenth];
//      int[] an_y=new int[lenth];
//      int[] an_z=new int[lenth];
//      int[] distance =new int[lenth];
//      int[] anchorid=new int[lenth];
//      int[] anchordistance=new int[lenth];
//      //基站维度
//      int[] dimension=new int[lenth];
//      //基站所在的组
//      int[] zu=new int[lenth];
//      int i=0;
//      String layer="0000";
//
//      //标签的高度
//      int tag_heigh=0;
//
//      String tagidstr="0000";
//
//      int tagid=0;    
//      @SuppressWarnings("unused")
//      String tag_heighstr="";
//
//      //信号强度
//      int signal_power=0;
//
//      //电量
//      String batarry="0";
//
//      //速度限制
//      int tagspeed_limit=0;
//
//      //标签静止状态
//      int stationary_flag=0;
//
//      //时间戳
//      int timestamp=GetNowTime.timestamp();
//
//      //标签频率
//      int taghz=0;
//
//      //第1路信号强度
//      int[] power=new int[lenth];
//
//      //第2路信号强度
//      int[] power_diff=new int[lenth];
//
//      String sos="0";
//
//      Iterator<Ceju> it=vccj.iterator();
//      
//      while(it.hasNext()) {
//          
//          Ceju tag_raw=it.next(); 
//          
//          //标签id
//          tagidstr=tag_raw.getCe_tagid();
//          
//          //判断标签id中是否含有字母
//          if(JugeHaveZimu.haszimu(tag_raw.getCe_tagid())) {
//              
//              tagid=Have_55AA03_do.decodeHEX(tag_raw.getCe_tagid());
//          }else {
//              tagid=Integer.parseInt(tag_raw.getCe_tagid());
//          }
//          
//          //标签频率
//          taghz=tag_raw.getCe_taghz();
//
//
//          //标签电量
//          batarry=tag_raw.getCe_battery();
//          
//          //基站id
//          String anchoid=tag_raw.getCe_anchorid();
//          String postUrl = Config.getPostUrl();
//          String anchor_search_Url = postUrl + "anchorManagement_search.do";
//          String messageJson = "{\"input\":\"" + anchorid + "\"}";
//          JSONObject jsonObject = JSONObject.fromObject(messageJson);
//          JSONObject re_tb_anchor = HttpUtil.doPost(anchor_search_Url, jsonObject.toString(), Config.getCharset());
//          tb_achor re_anchor = (tb_achor) JSONObject.toBean(JSONObject.fromObject(re_tb_anchor.get("result").toString()),
//                  tb_achor.class);
//          //基站x坐标
//          an_x[i]=Integer.parseInt(re_anchor.getPOSX());
//          
//          //基站y坐标
//          an_y[i]=Integer.parseInt(re_anchor.getPOSY());
//          
//          //基站z坐标
//          an_z[i]=Integer.parseInt(re_anchor.getPOSZ());
//          
//          //基站的量程
//          String liangcheng=re_anchor.getJiaozhundistance();
//          if(liangcheng.equals("无限制")) {
//              liangcheng="1000000";
//          }
//          
//          anchordistance[i]=Integer.parseInt(liangcheng);
//          
//          //判断基站id中是否含有字母
//          int inanchorid=Integer.parseInt(anchoid);
//          
//          if(JugeHaveZimu.haszimu(anchoid)) {
//              
//              inanchorid=Have_55AA03_do.decodeHEX(anchoid);
//          }
//          
//          //基站的id
//          anchorid[i]=inanchorid;
//          
//          //基站和标签的距离
//          distance[i]=Integer.parseInt(tag_raw.getCe_distance());
//          
//          String suanfaUrl = postUrl + "anchorManagement_search.do";
//          String suanfaJson = "{\"input\":\"" + anchorid + "\"}";
//          JSONObject suanfaObject = JSONObject.fromObject(suanfaJson);
//          JSONObject re_tb_suanfa = HttpUtil.doPost(suanfaUrl, suanfaObject.toString(), Config.getCharset());
//          tb_suanfa re_suanfa = (tb_suanfa) JSONObject.toBean(JSONObject.fromObject(re_tb_suanfa.get("result").toString()),
//                  tb_suanfa.class);
//          
//          //基站的维度
//          int anchor_suanfa=2;
//          if(re_suanfa !=null) {
//              if(re_suanfa.getAnchor_num().equals("1")) {
//                  anchor_suanfa=1;
//              }else if(re_suanfa.getAnchor_num().equals("0")){
//                  anchor_suanfa=0;
//              }
//          }
//          dimension[i]=anchor_suanfa;
//          
//          //基站所在的组
//          zu[i]=Integer.parseInt(re_suanfa.getZu());
//          
//          String url_tag_bw = postUrl + "labelManagement_search.do";
//          tb_tag tag = new tb_tag();
//          tag.setTag_id(tagidstr);
//          JSONObject tagObject = JSONObject.fromObject(tag);
//          JSONObject re_tag_bw = HttpUtil.doPost(url_tag_bw, tagObject.toString(), Config.getCharset());
//          tb_tag re_tag = (tb_tag) JSONObject.toBean(JSONObject.fromObject(re_tag_bw.get("result").toString()),
//                  tb_tag.class);
//          
//          //标签高度
//          tag_heigh=Integer.parseInt(re_tag.getGaodu());
//          
//          //标签静止状态
//          stationary_flag=Integer.parseInt(tag_raw.getCe_jingzhi());
//          
//          //标签高度字符串
//          tag_heighstr=String.valueOf(tag_heigh);
//          
//          //标签速度限制
//          
//          if(re_tag.getSudu().equals("无")) {
//              tagspeed_limit=100000;
//          }else {                 
//          tagspeed_limit=Integer.parseInt(re_tag.getSudu());
//          }
//          
//          //sos
//          sos=tag_raw.getCe_button();
//          //
//          String url_person_bw = postUrl + "personManagement_search.do";
//          JSONObject re_person_bw = HttpUtil.doPost(url_person_bw, tagObject.toString(), Config.getCharset());
//          tb_person person = (tb_person) JSONObject.toBean(JSONObject.fromObject(re_person_bw.get("result").toString()),
//                  tb_person.class);
//          //层
//          layer=person.getP_floor();
//
//          //第一路信号强度
//          power[i]=Integer.parseInt(tag_raw.getCe_power());
//
//          //第二路信号强度
//          power_diff[i]=Integer.parseInt(tag_raw.getCe_power_diff());
//
//          i++;
//      }
//      
//      String postUrl = Config.getPostUrl();
//      String url_setting_bw = postUrl + "getSysSetting.do";
//      JSONObject re_tb_setting = HttpUtil.doPost(url_setting_bw, "", Config.getCharset());
//      tb_system re_setting = (tb_system) JSONObject.toBean(JSONObject.fromObject(re_tb_setting.get("result").toString()),
//              tb_system.class);
//
//      //静止时输出固定坐标如果没勾选
//      if(re_setting.getQuiet().equals("0")) {
//          stationary_flag=0;          
//      }
//
//
//      /**包序,时间戳,(基站X坐标集合),(基站Y坐标集合),(基站z坐标集合),(基站标签距离),基站数量,(基站ID),标签ID,标签高度,
//       * 信号强度,标签速度限制,(基站量程),(基站维度),标签静止状态,(第一路信号强度),(第二路信号强度),标签频率**/
//      /**如果调试模式开启*/
//      String filePath = Config.getBaowenConfig();
//      String baowenSwitch = ModifyConfig.readData(filePath,"baowenSwitch").toString(); //进入查看报文页面打开开关
//      String debugSwitch = ModifyConfig.readData(filePath,"debugSwitch").toString();;//调试页面打开
//      if(baowenSwitch.contentEquals("1")&& debugSwitch.contentEquals("1")) {
//          StringBuffer text_str=new StringBuffer();
//          text_str.append("  "+
//                  baoxu+","//包序
//                  +timestamp+","//时间戳
//                  +getbuf(an_x)+","//基站X坐标
//                  +getbuf(an_y)+","//基站Y坐标
//                  +getbuf(an_z)+","//基站Z坐标
//                  +getbuf(distance)+","//基站和标签距离
//                  +lenth+","//基站数量
//                  +getbuf(anchorid)+","//基站ID
//                  +tagidstr+","//标签ID
//                  +tag_heigh+","//标签高度
//                  +taghz+","//标签频率
//                  +tagspeed_limit+","//速度限制100000代表无限制
//                  +getbuf(anchordistance)+","//基站量程限制100000代表不限制(超出量程不参与计算)
//                  +getbuf(dimension)+","//基站的维度
//                  +stationary_flag+","//标签静止状态,1代表静止,0代表没静止
//                  +getbuf(power)+","//第一路信号强度
//                  +getbuf(power_diff)+","
//                  +taghz+","
//                  +getbuf(zu)
//                  );//    第二路信号强度
//          String debugUrl=postUrl+"debugMessage.do";
//          String messageJson = "{\"result\":\""+ text_str + "\"}";
//          JSONObject json = JSONObject.fromObject(messageJson);
//          HttpUtil.doPost(debugUrl, json, "UTF-8");
//      }
//
//
//
//      /**将数据给到动态库JNA处理*/
//      
//      int[] pos=DellJAN.get_tag_pos(
//              timestamp, 
//              an_x, 
//              an_y, 
//              an_z, 
//              distance, 
//              lenth,
//              anchorid,
//              tagid,
//              tag_heigh,
//              taghz,
//              tagspeed_limit,
//              anchordistance,
//              dimension,
//              stationary_flag,
//              power,
//              power_diff,
//              zu);
//
//      
//
//      //如果是有效的位置信息
//      if(DellJAN.getYouxiao()==1) {
//          
//          HaveOkPosDo.do_something(tagidstr.toString(), baoxu, pos[0], pos[1], "0", String.valueOf(tag_heigh));
//          Have_55AA01_do.dell_gui();
//          
//          //UDP转发位置报文
//
//          /**
//           * UWB标签上传的位置报文
//           * display,[lenth],[tagid],[baoxu],[timestamp],[layer],[x],[y],[z], [vbat],[state],[sos],[mark]
//           * 示例:
//           * display,64,2012,70,2020-12-14 13:08:33.479,0,648,367,150,32,0,0,1
//           * 说明:
//           * 1    display:包头
//           * 2    [length]:报文长度
//           * 3    [tagid] :标签的ID号,唯一编号
//           * 4    [baoxu] :包序(0~255循环)
//           * 5    [timestamp] :时间戳(这条报文发出的时间)
//           * 6    [layer] :标签所在的层
//           * 7    [x] :标签的X坐标,单位厘米
//           * 8    [y] :标签的Y坐标,单位厘米
//           * 9    [z] :标签的Z坐标,单位厘米
//           * 10   [vbat] :标签的电量信息,(0~100)
//           * 11   [state] :标签的状态,静止为1,运动为0
//           * 12   [sos] :标签的SOS按键状态,按下为1,没有按下为0
//           * 13   [mark] :标志位,区别从哪个引擎上传数据,适用于多个项目传入一个平台,默认为0**/           
//
//          int len=0;      
//          StringBuffer addtime=new StringBuffer(GetNowTime.timestamp2());
//          StringBuffer display0=new StringBuffer("display,"
//                  +len+","
//                  +tagidstr+","
//                  +baoxu+","
//                  +addtime+","
//                  +layer+","
//                  +pos[0]+","
//                  +pos[1]+","
//                  +tag_heigh+","
//                  +batarry+","
//                  +stationary_flag+","
//                  +sos+","
//                  +Systems.sys().getBiaozhi()
//                  );
//
//          len=display0.length()+1;
//
//
//
//          StringBuffer display=new StringBuffer("display,"
//                  +len+","
//                  +tagidstr+","
//                  +baoxu+","
//                  +addtime+","
//                  +layer+","
//                  +pos[0]+","
//                  +pos[1]+","
//                  +tag_heigh+","
//                  +batarry+","
//                  +stationary_flag+","
//                  +sos+","
//                  +Systems.sys().getBiaozhi()
//                  );
//          
//          int length=display.toString().getBytes().length;
//
//          /**如果存在需要UDP转发位置信息**/
//          if((ForwardDatas.have_udp("位置数据") || ForwardDatas.have_udp("全部数据")  ) 
//                  && length>20) {
//
//              if(ForwardDatas.have_udp("位置数据")) {
//                  Udp_Out.udp_out(display.toString().getBytes(), length,"位置数据");
//                  
//              }else if(ForwardDatas.have_udp("全部数据")) {
//                  
//                  Udp_Out.udp_out(display.toString().getBytes(),length,"全部数据");
//                  
//              }
//
//              //显示UDP转发的数据
//              if(TcpIpManage.getStar()&& TcpIpManage.getDatatypeis().equals("UDP转发")) {
//
//                  //显示UDP转发的数据
//                  BaoWenShow.show(display.toString(), "UDP转发");
//              }
//
//          }
//
//          /**如果存在需要TCP转发位置信息**/
//          if((ForwardDatas.have_tcp("位置数据") || ForwardDatas.have_tcp("全部数据") )&& length>20) {
//              TcpClientOneToMany.send(display.toString());
//          }
//
//          //实时保存位置报文
//          if(Systems.sys().getOpensave().equals("1") && Systems.sys().getDatatype().equals("UDP转发")) {
//              SaveFIleInTxt.insert_intxt(display.toString());
//          }
//
//          addtime=new StringBuffer();
//          display0=new StringBuffer();
//          display=new StringBuffer();
//
//          //如果没有计算得到位置执行下面的操作
//      }else {
//
//          //status2: [LEN],[tagid],[SEQ],[TimeStamp],[ANCHORID],[distance]
//          /**:该 类报文仅在无法计算出位置且启用该状态上功能时,
//           *  在位置数据类型中输出 在位置数据类型中输出 !
//           *  上述示例中表D345 标签与 69A6基站最近,且距离值为 437cm。**/
//
//          if(distance.length>0) {
//
//
//
//              for(int h=0;i<anchorid.length;i++) {
//                  Dell_AnchorAndDistance.insert_anc_dis(distance[h], String.valueOf(anchorid[h]));
//              }
//
//              //实现数组从大到小排序
//              Arrays.sort(distance);
//
//              int distances=distance[distance.length-1];
//              String anchoid=Dell_AnchorAndDistance.get_anchorid(distances);
//
//              int len=0;
//              String status="status2: "+len+","+tagidstr+","+baoxu+","+GetNowTime.timestamp2()+","+anchoid+","+distances;
//
//              len=status.length()+1;
//
//              String status2="status2: "+len+","+tagidstr+","+baoxu+","+GetNowTime.timestamp2()+","+anchoid+","+distances;
//              
//              int length1=status2.toString().getBytes().length;
//
//              if((ForwardDatas.have_udp("位置数据") || ForwardDatas.have_udp("全部数据") ) && length1>20) {
//
//                  if(ForwardDatas.have_udp("位置数据")) {
//                      Udp_Out.udp_out(status2.toString().getBytes(), length1,"位置数据");
//                  }else {
//                      Udp_Out.udp_out(status2.toString().getBytes(), length1,"全部数据");
//                  }
//
//                  //显示UDP转发的数据
//                  if(TcpIpManage.getStar()&& TcpIpManage.getDatatypeis().equals("UDP转发")) {
//
//                      //显示UDP转发的数据
//                      BaoWenShow.show(status2.toString(), "UDP转发");
//                  }
//
//              }
//
//              /**如果存在需要TCP转发位置信息**/
//              if((ForwardDatas.have_tcp("位置数据") || ForwardDatas.have_tcp("全部数据") )&& length1>20) {
//                  TcpClientOneToMany.send(status2.toString());
//              }
//
//              //实时保存位置报文
//              if(Systems.sys().getOpensave().equals("1") && Systems.sys().getDatatype().equals("UDP转发")) {
//                  SaveFIleInTxt.insert_intxt(status2.toString());
//              }
//
//          }
//
//          tagidstr=null;
//          
//          Dell_AnchorAndDistance.delete_all();
//      }
//  }
//
//
//  /*16进制转为10进制*/
//  public static int decodeHEX(String hexs){
//      BigInteger bigint=new BigInteger(hexs, 16);
//      int numb=bigint.intValue();
//      return numb;
//  }
//
//  /**此函数用于输出整形数组中的值*/
//  public static StringBuffer getbuf(int[] mes) {
//      StringBuffer strbuf=new StringBuffer();
//      int size=mes.length;
//
//      if(size>2) {
//          for(int h=0;h<size;h++) {
//              if(h==0) {
//                  strbuf.append("("+mes[h]+",");
//              }else if(h !=0 && h !=mes.length-1) {
//                  strbuf.append(mes[h]+",");  
//              }else {
//                  strbuf.append(mes[h]+")");  
//              }
//          }
//      }
//
//      if(size==2) {
//          for(int h=0;h<size;h++) {
//              if(h==0) {
//                  strbuf.append("("+mes[h]+",");
//              }else {
//                  strbuf.append(mes[h]+")");  
//              }
//          }
//      }
//
//      if(size==1) {
//          for(int h=0;h<size;h++) {
//              if(h==0) {
//                  strbuf.append("("+mes[h]+")");
//              }
//          }
//      }       
//
//      return strbuf;
//  }
//
//
//  public static int getJianzhi() {
//      return jianzhi;
//  }
//
//
//  public static void setJianzhi(int jianzhi) {
//      DataToJnaDell.jianzhi = jianzhi;
//  }
 
 
 
 
 
}