-
Notifications
You must be signed in to change notification settings - Fork 0
/
rvp900.cpp
1090 lines (922 loc) · 25.9 KB
/
rvp900.cpp
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
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "rvp900.h"
RVP900::RVP900()
{
}
RVP900::~RVP900()
{
}
int RVP900::reset(){
// if(int s= comboCmdMsg(RESET_FIFO,"2",8) != 0){//Reset out FIFO
// return s;
// }
// if(int s = readSocketResp()!=0){
// return s;
// }
/*status of FIFO
*1 means has data avalible in output buffer
*/
// if(int s= comboCmdMsg(STAT_FIFO,"2",8) != 0){
// return s;
// }
// if(int s = readSocketResp()!=0){
// return s;
// }
// if(((recvBuffer[4]-'0')&0x1)==0){
sendBuffer[0] = 0;
strcat(sendBuffer,RESET_PREFIX);//8bit
strcat(sendBuffer,COMMAND_WRITE);//4bit
strcat(sendBuffer,COMMAND_SEP);//1bit
sendBuffer[13] = RESET_LOW8BIT;
sendBuffer[14] = RESET_HIGH8BIT;
sendBuffer[RESET_LEN] = 0;
if(int s = sendMsg(sendBuffer,RESET_LEN) !=RVP_NO_ERR){
return s ;
}return RVP_NO_ERR;
// }
}
int RVP900::IOTest(){
sendBuffer[0] = 0;
strcat(sendBuffer,IOTEST_PREFIX);//8bit
strcat(sendBuffer,COMMAND_WRITE);//4bit
strcat(sendBuffer,COMMAND_SEP);//1bit
sendBuffer[13] = IOTEST_LOW8BIT;
sendBuffer[14] = IOTEST_HIGH8BIT;
for(int i=COMMAND_PREFIX_LEN + COMM_WRIT_LEN;i<IOTEST_COMM_LEN;i++){
sendBuffer[i] = i;
}
sendBuffer[IOTEST_COMM_LEN]=0;
if(sendMsg(sendBuffer,IOTEST_COMM_LEN)!=RVP_NO_ERR){
return SOCKET_SEND_ERR;
}
if(int s = readSocketResp()!= RVP_NO_ERR){
return s;
}
if(int s = comboCmdMsg(COMMAND_READ,"32",9)!=RVP_NO_ERR){
return s;
}
if(int s = readSocketResp()!= RVP_NO_ERR){
recvBuffer[4+32] = 0;
printf("%s\n",recvBuffer);
return SOCKET_READ_ERR;
}
for(int i=0;i<32;i++){
if(recvBuffer[4+i] != i){
return IOTEST_ERR;
}
}
return RVP_NO_ERR;
}
int RVP900::loadSync(){
sendBuffer[0]=0;
strcat(sendBuffer,LSYNC_PREFIX);//8bit
strcat(sendBuffer,COMMAND_WRITE);//4bit
strcat(sendBuffer,COMMAND_SEP);//1bit
sendBuffer[13] = LSYNC_LOW8BIT;
sendBuffer[14] = LSYNC_HIGH8BIT;
if(int s = sendMsg(sendBuffer,LSYNC_LEN)!= RVP_NO_ERR){
return s;
}
if(int s= readSocketResp()!=RVP_NO_ERR){
return s;
}
//以下不明白什么原因
sendBuffer[0]=0;
strcat(sendBuffer,"00000011WRIT|");//OP_LSYNC
sendBuffer[13]=0x11;
sendBuffer[14]=0x01;
sendBuffer[15]=0x68;
sendBuffer[16]=0x01;
sendBuffer[17]=0x0;
sendBuffer[18]=0x0;
if ((sendMsg(sendBuffer,19))!=0)
return -16;
if (readSocketResp()!=0)
return -17;
sendBuffer[0]=0;
strcat (sendBuffer,"00000725WRIT|");//OP_LSYNC
for (int i=0;i<360;i++)
{
float ang=(float)i*65536.0/360.0;
int iang=ang;
sendBuffer[13+i*2+0]=iang%256;
sendBuffer[13+i*2+1]=iang/256;
}
if ((sendMsg(sendBuffer,733))!=0)
return -18;
if (readSocketResp()!=0)
return -19;
sendBuffer[0]=0;
strcat (sendBuffer,"00000007WRIT|");//OP_LSYNC
sendBuffer[13]=0x11;
sendBuffer[14]=0x20;
if ((sendMsg(sendBuffer,15))!=0)
return -20;
if (readSocketResp()!=0)
return -21;
return RVP_NO_ERR;
}
/*
* 设置操作参数
*/
int RVP900::setOperPRM(){
sendBuffer[0]=0;
strcat (sendBuffer,SOPRM_PREFIX);//OP_SOPRM
strcat (sendBuffer,COMMAND_WRITE);
strcat (sendBuffer,COMMAND_SEP);
for (int i=0;i<52;i++)
sendBuffer[13+i]=soprm[i];
if ((sendMsg(sendBuffer,65))!=0)
return SOCKET_READ_ERR;
if (readSocketResp()!=0)
return SOCKET_READ_ERR;
return RVP_NO_ERR;
}
/*
*CFGHDR 配置射线头字节
*/
int RVP900::CFGHDR(){
sendBuffer[0]=0;
low8Bits = 0x00;
high8Bits = 0x00;
strcat(sendBuffer,CFGHDR_PREFIX);//OP_CFGHDR
strcat(sendBuffer,COMMAND_WRITE);
strcat(sendBuffer,COMMAND_SEP);
low8Bits = CFGHDR_OPCODE;
sendBuffer[13]=low8Bits;
sendBuffer[14]=high8Bits;
if(cfghdrTag){
inputNBuff += CFGHDR_TAG;
}
if(cfghdrPRT){
inputNBuff += CFGHDR_PRT;
}
if(cfghdrPul){
inputNBuff += CFGHDR_PUL;
}
if(cfghdrPul){
inputNBuff += CFGHDR_TIM;
}
if(cfghdrGpm){
inputNBuff += CFGHDR_GPM;
}
if(cfghdrFlg){
inputNBuff += CFGHDR_FLG;
}
if(cfghdrUTC){
inputNBuff += CFGHDR_UTC;
}
sendBuffer[15]=inputNBuff;
inputNBuff = 0x00;
if(cfghdrMMT){
inputNBuff += CFGHDR_MMT;
}
if(cfghdrSYT){
inputNBuff += CFGHDR_SYT;
}
if(cfghdrPBN){
inputNBuff += CFGHDR_PBN;
}
if(cfghdrTID){
inputNBuff += CFGHDR_TID;
}
sendBuffer[16] = inputNBuff;
sendBuffer[17] = BYTE_CLEAR;
sendBuffer[18] = BYTE_CLEAR;
hdrBytesNum = calHdrBytes();
if ((sendMsg(sendBuffer,19))!=0)
return SOCKET_SEND_ERR;
if (readSocketResp()!=0)
return SOCKET_READ_ERR;
return RVP_NO_ERR;
}
//load range mask
int RVP900::loadRangeMsk(){
sendBuffer[0]=0;
//距离掩码设置的掩码位个数
int markNums = (distance % resolution ==0)?(distance/resolution):(distance/resolution+1);
strcat (sendBuffer,(char*)lrmskCommLen);//lrmsk指令的长度
strcat (sendBuffer,(char*)commandWrite);
strcat (sendBuffer,(char*)commandSep);
//sendBuffer[12] = commandSep;
sendBuffer[13]=lrmskOpCode; //距离掩码指令操作码
sendBuffer[14]= lrmskRangeAvg; //距离平均
lrmskBinsNum = markNums / (lrmskRangeAvg+1);//计算出输出的库个数
// /*要先发一次???**/
// if ((sendMsg(sendBuffer,15))!=0)
// return SOCKET_SEND_ERR;
// if (readSocketResp()!=0)
// return SOCKET_READ_ERR;
// sendBuffer[0]=0;
// strcat (sendBuffer,LRMSK_IN_PREFIX);//距离掩码输入参数
// strcat (sendBuffer,COMMAND_WRITE);//写入指令
// strcat (sendBuffer,COMMAND_SEP);//指令参数分隔符
for (int i=0;i<markNums;i++) //设置对应的距离掩码位
{
sendBuffer[13+i]=0xff;
//sendBuffer[13+i*2+1]=0xff;
}
for (int i=markNums;i<512;i++)
{
sendBuffer[13+i*2+0]=0;
sendBuffer[13+i*2+1]=0;
}
//8个字节的长度,4个字节的“WRIT”,1个字节的“|”,2个字节的命令字,1024个字节的输入数据
if ((sendMsg(sendBuffer,1039))!=0)//发送信息
return SOCKET_SEND_ERR;
if (readSocketResp()!=0)
return SOCKET_READ_ERR;
return RVP_NO_ERR;
}
int RVP900::setLFILT( ){
sendBuffer[0]=0;
strcat(sendBuffer,LFILT_PREFIX);
strcat(sendBuffer,COMMAND_WRITE);
strcat(sendBuffer,COMMAND_SEP);
sendBuffer[13]=lfiltL8Bit;
sendBuffer[14]=lfiltH8Bit;
if ((sendMsg(sendBuffer,15))!=0)
return SOCKET_SEND_ERR;
if (readSocketResp()!=0)
return SOCKET_READ_ERR;
sendBuffer[0]=0;
strcat (sendBuffer,LFILT_INP_PRE);//OP_LRFILT
strcat (sendBuffer,COMMAND_WRITE);
strcat (sendBuffer,COMMAND_SEP);
for (int i=0;i<lfiltInptLength;i++)
{
sendBuffer[13+i*2+0]=dopFilter;
sendBuffer[13+i*2+1]=0;
}
if ((sendMsg(sendBuffer,lfiltLength))!=0)
return SOCKET_SEND_ERR;
if (readSocketResp()!=0)
return SOCKET_READ_ERR;
return RVP_NO_ERR;
}
int RVP900::setPwPrf()
{
char pw_c;
sprintf(&pw_c,"%0x",pulseWidth);
sendBuffer[0]=0;
strcat(sendBuffer,SETPWF_PREFIX);
strcat(sendBuffer,COMMAND_WRITE);
strcat(sendBuffer,COMMAND_SEP);
sendBuffer[13]= setpwfOpCode;
sendBuffer[14]= pw_c;
sendBuffer[15]= pulsePRT[0];
sendBuffer[16]= pulsePRT[1];
if ((sendMsg(sendBuffer,17))!=RVP_NO_ERR)
return SOCKET_SEND_ERR;
if (readSocketResp()!=RVP_NO_ERR)
return SOCKET_READ_ERR;
return RVP_NO_ERR;
}
int RVP900::sampleNoise(){
sendBuffer[0]=0;
strcat(sendBuffer,SNOISE_PREFIX);
strcat(sendBuffer,COMMAND_WRITE);
strcat(sendBuffer,COMMAND_SEP);
sendBuffer[13]=snoiseL8Bit;
sendBuffer[14]=0;
sendBuffer[15]=0;
sendBuffer[16]=0;
sendBuffer[17]=0;
sendBuffer[18]=0;
if((sendMsg(sendBuffer,19))!=RVP_NO_ERR)
return SOCKET_SEND_ERR;
if(readSocketResp()!=RVP_NO_ERR)
return SOCKET_READ_ERR;
return RVP_NO_ERR;
}
int RVP900::PROC(){
low8Bits = 0x00;
high8Bits = 0x00;
sendBuffer[0]=0;
strcat(sendBuffer,PROC_FREFIX);
strcat(sendBuffer,COMMAND_WRITE);
strcat(sendBuffer,COMMAND_SEP);
low8Bits = procOpCode; //PROC command opcode0x06 0-4
//8-9
high8Bits = +procUnfold;
// if(procUnfold == PRF_NONE){//双PRF比率
// high8Bits += PROC_UNFOLD_NONE;
// }else if(procUnfold = PRF_2TO3){
// high8Bits += PROC_UNFOLD_2TO3;
// }else if(procUnfold = PRF_3TO4){
// high8Bits += PROC_UNFOLD_3TO4;
// }else if(procUnfold = PRF_4TO5){
// high8Bits += PROC_UNFOLD_4TO5;
// }
//5-6
if(procMode == procTimeSerisModec){//时间序列模式
low8Bits += 0x11<<5;
//10-13
if(procTSSubType){
high8Bits += procTSOUT<<2;
}
//14-15
/*
* TSOUT Selects type of data to be output
00 : 8-bit Time Series 01 : Power Spectrum
10 : 16-bit Time Series 11 : Unused
*/
if(procTSOUT){
high8Bits += procTSOUT<<6;
}
}else{
//5-6
if(procMode == procSyncModec){
low8Bits += 0x01<<5;
}else if(procMode == procFreeRunModec){
low8Bits += 0x10<<5;
}
//7
if(procKDP){
low8Bits += 0x01<<7;//KDP第7位
}
sendBuffer[13] = low8Bits;
//10th bit
if(procZDR){
high8Bits += 0x01<<2;
}
//11th bit
if(procW){
high8Bits += 0x01<<3;
}
//12
if(procV){
high8Bits += 0x01<<4;
}
//13
if(procT){
high8Bits += 0x01<<5;
}
//14
if(procZ){
high8Bits += 0x01<<6;
}
//15
if(procArc){
high8Bits += 0x01<<7;
}
sendBuffer[14]=high8Bits;
}
if ((sendMsg(sendBuffer,15))!=0)
return SOCKET_SEND_ERR;
if (readSocketResp()!=0)
return SOCKET_READ_ERR;
//设置数据长度
sprintf(formatBuffer,"%d",dataBytesNum);
if (comboCmdMsg(COMMAND_READ,formatBuffer,10)!= RVP_NO_ERR)//Read Proc data
return SOCKET_SEND_ERR;
char sSize[10];
int iSize,iRecvSize;
iRecvSize = recv(clientSocket,sSize,8,0);
if (iRecvSize!=8)
return SOCKET_RECV_NOT_CMPLT_ERR;
sSize[8]=0;
sscanf(sSize,"%d",&iSize);// = strtol(sSize,&sEnd,10);
if (iSize<=0)
return SOCKET_RECV_ERR;
iRecvSize = recv (clientSocket,recvBuffer,iSize,0);
if ((strncmp(recvBuffer,"Ack",3))!=0)
return SOCKET_RECV_ERR;
if (iRecvSize!=iSize)
{
int lenn=iSize-iRecvSize;
iRecvSize = recv (clientSocket,recvBuffer+iRecvSize,lenn,0);
if (iRecvSize!=lenn)
return iRecvSize;
memcpy(outbuff,recvBuffer+4,dataBytesNum);
return lenn;
}
else
memcpy(outbuff,recvBuffer+4,dataBytesNum);
return RVP_NO_ERR;
}
int RVP900::GPARM(){
sendBuffer[0]=0;
strcat(sendBuffer,GPARM_PREFIX);//构造写命令
strcat(sendBuffer,COMMAND_SEP);
strcat(sendBuffer,COMMAND_WRITE);
sendBuffer[13]=gparmL8bit;
sendBuffer[14]=gparmH8bit;
if ((sendMsg(sendBuffer,15))!=0)
return SOCKET_SEND_ERR;
if (readSocketResp()!=0)
return SOCKET_READ_ERR;
if (int s = comboCmdMsg("READ","128",10)==-1)//Read PARAM
return SOCKET_SEND_ERR;
if (readSocketResp()!=0)
return SOCKET_READ_ERR;
memcpy(statusBuff,recvBuffer+4,128);
return RVP_NO_ERR;
}
int RVP900::sendMsg(char *buffer,int length)//向RVP900发送数据
{
if (send(clientSocket,buffer,length,0)!= RVP_NO_ERR)//将buffer指向的length个字符发送到clientSocket
return SOCKET_SEND_ERR;
return RVP_NO_ERR;
}
int RVP900::connectRVP9(){//连接到RVP900
struct sockaddr_in adrin,adrins;
memset (&adrin,0,sizeof(adrin));
adrin.sin_family = AF_INET;
adrin.sin_port = htons(RVP900_PORT);
if ((clientSocket = socket(AF_INET,SOCK_STREAM,0))==-1)
return SOCKET_CREATE_ERR;
adrins.sin_family = AF_INET;
adrins.sin_addr.s_addr = inet_addr("127.0.0.1");
adrins.sin_port = htons(8000);
bind(clientSocket,(const sockaddr *)&adrins,sizeof(adrins));
if (connect(clientSocket,(const sockaddr *)&adrin,sizeof(adrin))==-1)
return SOCKET_CONN_ERR;
if (readSocketResp()!=0)
return SOCKET_READ_ERR;
if (int s= comboCmdMsg("INFO","ByteOrder=LittleEndian,WillCompress=0,Version=8.04",56)==-1)
return SOCKET_SEND_ERR;
if (readSocketResp()!=0)
return SOCKET_READ_ERR;
}
int RVP900::readSocketResp(){//读取rvp900响应信息
char *sEnd;
char sSize[10];
int iSize,iRecvSize;
iRecvSize = recv (clientSocket,sSize,8,0);//接收8个字节到sSize中
if (iRecvSize<8)
return SOCKET_RECV_ERR;
sSize[8]=0;
iSize = strtol(sSize,&sEnd,10);//将读取的数据转换为10进制数 该十进制数表示返回数据的大小
if (iSize<=0)
return RVP_NO_ERR;
iRecvSize = recv (clientSocket,recvBuffer,iSize,0);//再读取十进制数个大小到recvBuffer中
if ((strncmp(recvBuffer,"Ack",3))!=0)//比较读取到的数据的前3个字符是否为“Ack”
return NOT_ACK_ERR;
if (iRecvSize!=iSize)//若不相等 表明数据未读取完
{
int lenn=iSize-iRecvSize;
iRecvSize = recv (clientSocket,recvBuffer+iRecvSize,lenn,0);//再次读取剩下的数据
if (iRecvSize!=lenn)
return SOCKET_RECV_NOT_CMPLT_ERR;//iRecvSize;
printf("Ack=%d\n",lenn);
}
return RVP_NO_ERR;
}
int RVP900::assembleCmdMsg(int length,char *cmd,char *data){//构造发送的指令信息
int len;
sprintf(sendBuffer,"%08d",length);//8位字符指示要发送数据的长度
strcat(sendBuffer,cmd);//发送的指令
strcat(sendBuffer,data);//发送的数据
len=COMMAND_PREFIX_LEN+length;//总的长度
if ((sendMsg(sendBuffer,len))!=0)//发送sendBuffer指向的长度为len的数据
return SOCKET_SEND_ERR;
return RVP_NO_ERR;
}
int RVP900::comboCmdMsg(char *cmd,char *data,int length){//构造发送的指令信息
sprintf(sendBuffer,"%08d",length);//8位字符指示要发送数据的长度
strcat(sendBuffer,cmd);//发送的指令
strcat(sendBuffer,COMMAND_SEP);//添加分隔符
strcat(sendBuffer,data);//发送的数据
strcat(sendBuffer,COMMAND_SEP);//添加分隔符
int len=COMMAND_PREFIX_LEN+length;//总的长度
if ((sendMsg(sendBuffer,len))!=0)//发送sendBuffer指向的长度为len的数据
return SOCKET_SEND_ERR;
return RVP_NO_ERR;
}
int RVP900::RVP9Initialize(){
//采集数据种类 dBz,dBt,dBw,v,默认为Z、T、V、W
procZDR = false;
procZ = true;
procT = true;
procV = true;
procW = true;
procArc = false;
procKDP = false;
//采集的数据是否包含 头部TAG,默认为true
soprmNHD = true;
//距离量程 distance range,目前仅设置六个距离范围
distance = disrange_10;
//脉冲重复频率
pulsePRF = 300;
/*数据采集方式 collect mode,有三种Synchronous,
*free running,time series,默认是time series
*/
procMode = procSyncModec;
//脉冲宽度
pulseWidth = 1;
//双PRF,脉冲重复比,此处不是真实比率
procUnfold = procUnfoldNone;
//多普勒滤波器 doppler filter
dopFilter = 0;
//处理模式 processing mode
soprmProcessMode = soprmProcessModePPP;
//脉冲累积数 pulse accummunate
soprmPulseAcc = 16;
//Threshold of LOG、SIG、CCOR、SQI,门限值
soprmLOGThr=0.0,soprmSIGThr=0.0,soprmCCORThr=0.0,soprmSQIThr=0.0;
//R2使能 r2 enable
soprmR2Enable = false;
//距离平均 distance averaging
lrmskRangeAvg = 0x0;
//距离分辨率 125m
resolution = 125;
//雷达工作波长 λ = 0.032m
waveLen = 0.032;
//最大不模糊速度
Vmax = 2.4;
//信号质量系数
soprmSQI = 0.4;
//socket
clientSocket = -1;
isWorking = false;
return 0;
}
//对命令进行必要的初始化
int RVP900::iniCommand(){
}
/*计算最大不模糊速度*/
int RVP900::calculateVmax(){
Vmax = 0.25 * pulsePRF * waveLen;
//2:3
if(procUnfold2To3 == procUnfold){
Vmax *= 2;
}
else if(procUnfold3To4 == procUnfold){
Vmax *= 3;
}
else if(procUnfold4To5 == procUnfold){
Vmax *= 4;
}
return Vmax;
}
/*计算输出数据中 头数据所占的字节数**/
int RVP900::calHdrBytes(){
hdrBytesNum = 0;
if(procArc){//只会以8bit的形式输出
if(procZ){
hdrBytesNum += lrmskBinsNum;
}
if(procT){
hdrBytesNum += lrmskBinsNum;
}
if(procV){
hdrBytesNum += lrmskBinsNum;
}
if(procW){
hdrBytesNum += lrmskBinsNum;
}
}
if(procZ){
hdrBytesNum += lrmskBinsNum;
}
if(procT){
hdrBytesNum += lrmskBinsNum;
}
if(procV){
hdrBytesNum += lrmskBinsNum;
}
if(procW){
hdrBytesNum += lrmskBinsNum;
}
if(cfghdrTag){
hdrBytesNum += 8;
}
//其他的头数据……
}
/*get 、 set 方法**/
inline const char* RVP900::getAntennaBuf() const {
return antennaBuf;
}
inline double RVP900::getAzimuth() const {
return azimuth;
}
inline void RVP900::setAzimuth(double azimuth) {
this->azimuth = azimuth;
}
inline int RVP900::getClientSocket() const {
return clientSocket;
}
inline void RVP900::setClientSocket(int clientSocket) {
this->clientSocket = clientSocket;
}
inline int RVP900::getDataBytesNum() const {
return dataBytesNum;
}
inline void RVP900::setDataBytesNum(int dataBytesNum) {
this->dataBytesNum = dataBytesNum;
}
inline int RVP900::getDistance() const {
return distance;
}
inline void RVP900::setDistance(int distance) {
this->distance = distance;
}
inline unsigned char RVP900::getDopFilter() const {
return dopFilter;
}
inline void RVP900::setDopFilter(unsigned char dopFilter) {
this->dopFilter = dopFilter;
}
inline double RVP900::getElevation() const {
return elevation;
}
inline void RVP900::setElevation(double elevation) {
this->elevation = elevation;
}
inline const unsigned char* RVP900::getElevationBuff() const {
return elevationBuff;
}
inline const char* RVP900::getFormatBuffer() const {
return formatBuffer;
}
inline int RVP900::getHdrBytesNum() const {
return hdrBytesNum;
}
inline void RVP900::setHdrBytesNum(int hdrBytesNum) {
this->hdrBytesNum = hdrBytesNum;
}
inline unsigned char RVP900::getHigh8Bits() const {
return high8Bits;
}
inline void RVP900::setHigh8Bits(unsigned char high8Bits) {
this->high8Bits = high8Bits;
}
inline unsigned char RVP900::getInputNBuff() const {
return inputNBuff;
}
inline void RVP900::setInputNBuff(unsigned char inputNBuff) {
this->inputNBuff = inputNBuff;
}
inline bool RVP900::isIsWorking() const {
return isWorking;
}
inline void RVP900::setIsWorking(bool isWorking) {
this->isWorking = isWorking;
}
inline unsigned char RVP900::getLow8Bits() const {
return low8Bits;
}
inline void RVP900::setLow8Bits(unsigned char low8Bits) {
this->low8Bits = low8Bits;
}
inline int RVP900::getLrmskBinsNum() const {
return lrmskBinsNum;
}
inline void RVP900::setLrmskBinsNum(int lrmskBinsNum) {
this->lrmskBinsNum = lrmskBinsNum;
}
inline unsigned char RVP900::getLrmskRangeAvg() const {
return lrmskRangeAvg;
}
inline void RVP900::setLrmskRangeAvg(unsigned char lrmskRangeAvg) {
this->lrmskRangeAvg = lrmskRangeAvg;
}
inline const unsigned char* RVP900::getOutbuff() const {
return outbuff;
}
inline bool RVP900::isProcArc() const {
return procArc;
}
inline void RVP900::setProcArc(bool procArc) {
this->procArc = procArc;
}
inline bool RVP900::isProcKdp() const {
return procKDP;
}
inline void RVP900::setProcKdp(bool procKdp) {
procKDP = procKdp;
}
inline unsigned char RVP900::getProcMode() const {
return procMode;
}
inline void RVP900::setProcMode(unsigned char procMode) {
this->procMode = procMode;
}
inline bool RVP900::isProcT() const {
return procT;
}
inline void RVP900::setProcT(bool procT) {
this->procT = procT;
}
inline unsigned char RVP900::getProcTsout() const {
return procTSOUT;
}
inline void RVP900::setProcTsout(unsigned char procTsout) {
procTSOUT = procTsout;
}
inline unsigned char RVP900::getProcTsSubType() const {
return procTSSubType;
}
inline void RVP900::setProcTsSubType(unsigned char procTsSubType) {
procTSSubType = procTsSubType;
}
inline unsigned char RVP900::getProcUnfold() const {
return procUnfold;
}
inline void RVP900::setProcUnfold(unsigned char procUnfold) {
this->procUnfold = procUnfold;
}
inline bool RVP900::isProcV() const {
return procV;
}
inline void RVP900::setProcV(bool procV) {
this->procV = procV;
}
inline bool RVP900::isProcW() const {
return procW;
}
inline void RVP900::setProcW(bool procW) {
this->procW = procW;
}
inline bool RVP900::isProcZ() const {
return procZ;
}
inline void RVP900::setProcZ(bool procZ) {
this->procZ = procZ;
}
inline bool RVP900::isProcZdr() const {
return procZDR;
}
inline void RVP900::setProcZdr(bool procZdr) {
procZDR = procZdr;
}
inline int RVP900::getRadioFrequency() const {
return radioFrequency;
}
inline void RVP900::setRadioFrequency(int radioFrequency) {
this->radioFrequency = radioFrequency;
}
inline const char* RVP900::getRcverStatus() const {
return rcverStatus;
}
inline const char* RVP900::getRecvBuffer() const {
return recvBuffer;
}
inline int RVP900::getResolution() const {
return resolution;
}
inline void RVP900::setResolution(int resolution) {
this->resolution = resolution;
}
inline const char* RVP900::getSendBuffer() const {
return sendBuffer;
}
inline int RVP900::getPulsePRF() const {
return pulsePRF;
}
inline void RVP900::setPulsePRF(int pwfPrf ) {
pulsePRF = pwfPrf;
}
inline int RVP900::getPulseWidth() const {
return pulseWidth;
}
inline void RVP900::setPulseWidth(int pulseWidth) {
this->pulseWidth = pulseWidth;
}
inline const unsigned char* RVP900::getSoprm() const {
return soprm;
}
inline float RVP900::getSoprmCcorThr() const {
return soprmCCORThr;
}
inline void RVP900::setSoprmCcorThr(float soprmCcorThr) {
soprmCCORThr = soprmCcorThr;
}
inline float RVP900::getSoprmLogThr() const {
return soprmLOGThr;
}
inline void RVP900::setSoprmLogThr(float soprmLogThr) {
soprmLOGThr = soprmLogThr;
}
inline bool RVP900::isSoprmNhd() const {
return soprmNHD;
}
inline void RVP900::setSoprmNhd(bool soprmNhd) {
soprmNHD = soprmNhd;
}
inline bool RVP900::isSoprmNth() const {
return soprmNth;
}
inline void RVP900::setSoprmNth(bool soprmNth) {
this->soprmNth = soprmNth;
}
inline unsigned short RVP900::getSoprmProcessMode() const {
return soprmProcessMode;
}
inline void RVP900::setSoprmProcessMode(unsigned short soprmProcessMode) {
this->soprmProcessMode = soprmProcessMode;
}
inline unsigned short RVP900::getSoprmPulseAcc() const {
return soprmPulseAcc;
}
inline void RVP900::setSoprmPulseAcc(unsigned short soprmPulseAcc) {
this->soprmPulseAcc = soprmPulseAcc;
}
inline bool RVP900::isSoprmR2Enable() const {
return soprmR2Enable;
}
inline void RVP900::setSoprmR2Enable(bool soprmR2Enable) {
this->soprmR2Enable = soprmR2Enable;
}
inline float RVP900::getSoprmSigThr() const {
return soprmSIGThr;
}
inline void RVP900::setSoprmSigThr(float soprmSigThr) {
soprmSIGThr = soprmSigThr;
}
inline float RVP900::getSoprmSqi() const {
return soprmSQI;
}
inline void RVP900::setSoprmSqi(float soprmSqi ) {
soprmSQI = soprmSqi;
}
inline float RVP900::getSoprmSqiThr() const {
return soprmSQIThr;
}
inline void RVP900::setSoprmSqiThr(float soprmSqiThr) {
soprmSQIThr = soprmSqiThr;
}
inline bool RVP900::isThreadFlag() const {
return ThreadFlag;
}
inline void RVP900::setThreadFlag(bool threadFlag ) {
ThreadFlag = threadFlag;
}
float RVP900::getVmax() const {
return Vmax;
}
inline void RVP900::setVmax(float vmax) {
Vmax = vmax;
}
inline float RVP900::getWaveLen() const {
return waveLen;
}
inline void RVP900::setWaveLen(float waveLen) {
this->waveLen = waveLen;
}