-
Notifications
You must be signed in to change notification settings - Fork 11
/
ubx.c
6975 lines (6567 loc) · 219 KB
/
ubx.c
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
/*
* ubxproto
* Copyright (c) 2014, Alexey Edelev aka semlanik, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*
* Additionally to GNU Lesser General Public License you MUST NOT
* static link this library and MUST add link to author
* and source of this library in your application.
*
* Actual LGPL text https://www.gnu.org/licenses/lgpl.html
*
* File: ubx.c
*/
#include "portable_endian.h"
#include "ubxmessage.h"
#include "ubx.h"
#include "malloc.h"
#include "memory.h"
void fletcherChecksum(unsigned char* buffer, int size, unsigned char* checkSumA, unsigned char* checkSumB)
{
int i = 0;
*checkSumA = 0;
*checkSumB = 0;
for(; i < size; i++)
{
*checkSumA += buffer[i];
*checkSumB += *checkSumA;
}
}
extern void clearUBXMsgBuffer(const UBXMsgBuffer* buffer)
{
free(buffer->data);
}
void completeMsg(UBXMsgBuffer* buffer, int payloadSize)
{
unsigned char* checkSumA = (unsigned char*)(buffer->data + UBX_HEADER_SIZE + payloadSize);
unsigned char* checkSumB = (unsigned char*)(buffer->data + UBX_HEADER_SIZE + payloadSize + 1);
fletcherChecksum((unsigned char*)(buffer->data + sizeof(UBX_PREAMBLE)), payloadSize + 4, checkSumA, checkSumB);
}
void initMsg(UBXMsg* msg, int payloadSize, UBXMessageClass msgClass, UBXMessageId msgId)
{
msg->preamble = htobe16(UBX_PREAMBLE);
msg->hdr.msgClass = msgClass;
msg->hdr.msgId = msgId;
msg->hdr.length = payloadSize;
}
UBXMsgBuffer createBuffer(int payloadSize)
{
UBXMsgBuffer buffer = {0, 0};
buffer.size = UBX_HEADER_SIZE + payloadSize + UBX_CHECKSUM_SIZE;
buffer.data = (char*)malloc(buffer.size);
memset(buffer.data, 0, buffer.size);
return buffer;
}
UBXMsgBuffer getAID_ALPSRV(UBXMsg* clientMgs, const UBXAlpFileInfo *fileInfo)
{
int requestedAlpSize = (clientMgs->payload.AID_ALPSRV.size << 1);
int alpMsgSize = 0;
int payloadSize = 0;
UBXMsgBuffer buffer;
UBXMsg* msg = 0;
if(fileInfo->dataSize < (clientMgs->payload.AID_ALPSRV.offset + requestedAlpSize))
{
requestedAlpSize = fileInfo->dataSize - clientMgs->payload.AID_ALPSRV.offset - 1;
}
alpMsgSize = sizeof(UBXAID_ALPSRV);
payloadSize = alpMsgSize + requestedAlpSize;
buffer = createBuffer(payloadSize);
msg = (UBXMsg*) buffer.data;
if(requestedAlpSize < 0)
{
return buffer;
}
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_ALPSRV);
msg->payload.AID_ALPSRV.idSize = clientMgs->payload.AID_ALPSRV.idSize;
msg->payload.AID_ALPSRV.type = clientMgs->payload.AID_ALPSRV.type;
msg->payload.AID_ALPSRV.offset = clientMgs->payload.AID_ALPSRV.offset;
msg->payload.AID_ALPSRV.size = clientMgs->payload.AID_ALPSRV.size;
msg->payload.AID_ALPSRV.fileId = fileInfo->fileId;
msg->payload.AID_ALPSRV.dataSize = requestedAlpSize;
msg->payload.AID_ALPSRV.id1 = clientMgs->payload.AID_ALPSRV.id1;
msg->payload.AID_ALPSRV.id2 = clientMgs->payload.AID_ALPSRV.id2;
msg->payload.AID_ALPSRV.id3 = clientMgs->payload.AID_ALPSRV.id3;
memcpy(buffer.data + UBX_HEADER_SIZE + alpMsgSize, fileInfo->alpData + msg->payload.AID_ALPSRV.offset, requestedAlpSize);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_MSG_POLL(UBXMessageClass msgClass, UBXMessageId msgId)
{
int payloadSize = sizeof(UBXCFG_MSG_POLL);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_MSG);
msg->payload.CFG_MSG_POLL.msgClass = msgClass;
msg->payload.CFG_MSG_POLL.msgId = msgId;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_MSG_RATE(UBXMessageClass msgClass, UBXMessageId msgId, UBXU1_t rate)
{
int payloadSize = sizeof(UBXCFG_MSG_RATE);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_MSG);
msg->payload.CFG_MSG_RATE.msgClass = msgClass;
msg->payload.CFG_MSG_RATE.msgId = msgId;
msg->payload.CFG_MSG_RATE.rate = rate;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_MSG_RATES(UBXMessageClass msgClass, UBXMessageId msgId, UBXU1_t rate[])
{
int payloadSize = sizeof(UBXCFG_MSG_RATES);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_MSG);
msg->payload.CFG_MSG_RATES.msgClass = msgClass;
msg->payload.CFG_MSG_RATES.msgId = msgId;
memcpy(msg->payload.CFG_MSG_RATES.rate, rate, 6*sizeof(UBXU1_t));
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_RST(int mode, UBXU2_t mask)
{
int payloadSize = sizeof(UBXCFG_RST);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_RST);
msg->payload.CFG_RST.resetMode = mode;
msg->payload.CFG_RST.navBBRMask = mask;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_RST_OPT(int mode, UBXBBRSpecialSets special)
{
int payloadSize = sizeof(UBXCFG_RST);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_RST);
msg->payload.CFG_RST.resetMode = mode;
msg->payload.CFG_RST.navBBRMask = special;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_TP5_POLL_OPT(UBXCFGTimepulses tpIdx)
{
int payloadSize = sizeof(UBXCFG_TP5_POLL_OPT);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_TP5);
msg->payload.CFG_TP5_POLL_OPT.tpIdx = tpIdx;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_TP5(UBXCFGTimepulses tpIdx, UBXI2_t antCableDelay, UBXI2_t rfGroupDelay,
UBXU4_t freqPeriod, UBXU4_t freqPeriodLock, UBXU4_t pulseLenRatio,
UBXU4_t pulseLenRatioLock, UBXU4_t userConfigDelay, UBXU4_t flags)
{
int payloadSize = sizeof(UBXCFG_TP5);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_TP5);
msg->payload.CFG_TP5.tpIdx = tpIdx;
msg->payload.CFG_TP5.antCableDelay = antCableDelay;
msg->payload.CFG_TP5.rfGroupDelay = rfGroupDelay;
msg->payload.CFG_TP5.freqPeriod = freqPeriod;
msg->payload.CFG_TP5.freqPeriodLock = freqPeriodLock;
msg->payload.CFG_TP5.pulseLenRatio = pulseLenRatio;
msg->payload.CFG_TP5.pulseLenRatioLock = pulseLenRatioLock;
msg->payload.CFG_TP5.userConfigDelay = userConfigDelay;
msg->payload.CFG_TP5.flags = flags;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getAID_ALM_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_ALP);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getAID_ALM_POLL_OPT(UBXU1_t svid)
{
int payloadSize = sizeof(UBXAID_ALM_POLL_OPT);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_ALP);
msg->payload.AID_ALM_POLL_OPT.svid = svid;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getAID_ALM(UBXU4_t svid, UBXU4_t week)
{
int payloadSize = sizeof(UBXAID_ALM);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_ALM);
msg->payload.AID_ALM.svid = svid;
msg->payload.AID_ALM.week = week;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getAID_ALM_OPT(UBXU4_t svid, UBXU4_t week, UBXU4_t dwrd[8])
{
int payloadSize = sizeof(UBXAID_ALM_OPT);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_ALM);
msg->payload.AID_ALM_OPT.svid = svid;
msg->payload.AID_ALM_OPT.week = week;
memcpy(msg->payload.AID_ALM_OPT.dwrd, dwrd, 8*sizeof(UBXU4_t));
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getAID_ALP_POLL(UBXU4_t predTow,
UBXU4_t predDur,
UBXI4_t age,
UBXU2_t predWno,
UBXU2_t almWno,
UBXU1_t svs)
{
int payloadSize = sizeof(UBXAID_ALP_POLL);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_ALP);
msg->payload.AID_ALP_POLL.predTow = predTow;
msg->payload.AID_ALP_POLL.predDur = predDur;
msg->payload.AID_ALP_POLL.age = age;
msg->payload.AID_ALP_POLL.predWno = predWno;
msg->payload.AID_ALP_POLL.almWno = almWno;
msg->payload.AID_ALP_POLL.svs = svs;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getAID_ALP_END()
{
int payloadSize = sizeof(UBXAID_ALP_END);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_ALP);
msg->payload.AID_ALP_END.dummy = 0xAA;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getAID_ALP(UBXU2_t* chunk, int chunkSize)
{
int payloadSize = chunkSize;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_ALP);
memcpy(((char*)&(msg->payload)) + sizeof(UBXAID_ALP), chunk, chunkSize);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getAID_AOP_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_AOP);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getAID_AOP_POLL_OPT(UBXU1_t svid)
{
int payloadSize = sizeof(UBXAID_AOP_POLL_OPT);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_AOP);
msg->payload.AID_AOP_POLL_OPT.svid = svid;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getAID_AOP(UBXU1_t svid, UBXU1_t data[59])
{
int payloadSize = sizeof(UBXAID_AOP);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_AOP);
msg->payload.AID_AOP.svid = svid;
memcpy(msg->payload.AID_AOP.data, data, 59*sizeof(UBXU1_t));
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getAID_AOP_OPT(UBXU1_t svid, UBXU1_t data[59], UBXU1_t optional0[48], UBXU1_t optional1[48], UBXU1_t optional2[48])
{
int payloadSize = sizeof(UBXAID_AOP_OPT);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_AOP);
msg->payload.AID_AOP_OPT.svid = svid;
memcpy(msg->payload.AID_AOP_OPT.data, data, 59*sizeof(UBXU1_t));
memcpy(msg->payload.AID_AOP_OPT.optional0, optional0, 48*sizeof(UBXU1_t));
memcpy(msg->payload.AID_AOP_OPT.optional1, optional1, 48*sizeof(UBXU1_t));
memcpy(msg->payload.AID_AOP_OPT.optional2, optional2, 48*sizeof(UBXU1_t));
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getAID_DATA_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_DATA);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getAID_EPH_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_EPH);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getAID_EPH_POLL_OPT(UBXU1_t svid)
{
int payloadSize = sizeof(UBXAID_EPH_POLL_OPT);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_EPH);
msg->payload.AID_EPH_POLL_OPT.svid = svid;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getAID_EPH(UBXU4_t svid, UBXU4_t how)
{
int payloadSize = sizeof(UBXAID_EPH);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_EPH);
msg->payload.AID_EPH.svid = svid;
msg->payload.AID_EPH.how = how;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getAID_EPH_OPT(UBXU4_t svid, UBXU4_t how, UBXU4_t sf1d[8], UBXU4_t sf2d[8], UBXU4_t sf3d[8])
{
int payloadSize = sizeof(UBXAID_EPH_OPT);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_EPH);
msg->payload.AID_EPH_OPT.svid = svid;
msg->payload.AID_EPH_OPT.how = how;
memcpy(msg->payload.AID_EPH_OPT.sf1d, sf1d, 8*sizeof(UBXU4_t));
memcpy(msg->payload.AID_EPH_OPT.sf2d, sf2d, 8*sizeof(UBXU4_t));
memcpy(msg->payload.AID_EPH_OPT.sf3d, sf3d, 8*sizeof(UBXU4_t));
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getAID_HUI_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_HUI);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getAID_HUI(UBXI4_t health, UBXR4_t utcA0, UBXR4_t utcA1,
UBXI4_t utcTOW, UBXI2_t utcWNT, UBXI2_t utcLS,
UBXI2_t utcWNF, UBXI2_t utcDN, UBXI2_t utcLSF,
UBXI2_t utcSpare, UBXR4_t klobA0, UBXR4_t klobA1,
UBXR4_t klobA2, UBXR4_t klobA3, UBXR4_t klobB0,
UBXR4_t klobB1, UBXR4_t klobB2, UBXR4_t klobB3,
UBXX2_t flags)
{
int payloadSize = sizeof(UBXAID_HUI);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_HUI);
msg->payload.AID_HUI.health = health;
msg->payload.AID_HUI.utcA0 = utcA0;
msg->payload.AID_HUI.utcA1 = utcA1;
msg->payload.AID_HUI.utcTOW = utcTOW;
msg->payload.AID_HUI.utcWNT = utcWNT;
msg->payload.AID_HUI.utcLS = utcLS;
msg->payload.AID_HUI.utcWNF = utcWNF;
msg->payload.AID_HUI.utcDN = utcDN;
msg->payload.AID_HUI.utcLSF = utcLSF;
msg->payload.AID_HUI.utcSpare = utcSpare;
msg->payload.AID_HUI.klobA0 = klobA0;
msg->payload.AID_HUI.klobA1 = klobA1;
msg->payload.AID_HUI.klobA2 = klobA2;
msg->payload.AID_HUI.klobA3 = klobA3;
msg->payload.AID_HUI.klobA0 = klobB0;
msg->payload.AID_HUI.klobA1 = klobB1;
msg->payload.AID_HUI.klobA2 = klobB2;
msg->payload.AID_HUI.klobA3 = klobB3;
msg->payload.AID_HUI.flags = flags;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getAID_INI_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_INI);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getAID_INI(UBXI1_t ecefXOrLat,
UBXI1_t ecefYOrLat,
UBXI1_t ecefZOrLat,
UBXU1_t posAcc,
UBXI1_t tmCfg,
UBXU2_t wnoOrDate,
UBXU4_t towOrDate,
UBXI4_t towNs,
UBXU4_t tAccMS,
UBXU4_t tAccNS,
UBXI4_t clkDOrFreq,
UBXU4_t clkDAccOrFreqAcc,
UBXX4_t flags)
{
int payloadSize = sizeof(UBXAID_INI);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassAID, UBXMsgIdAID_INI);
msg->payload.AID_INI.ecefXOrLat = ecefXOrLat;
msg->payload.AID_INI.ecefYOrLat = ecefYOrLat;
msg->payload.AID_INI.ecefZOrLat = ecefZOrLat;
msg->payload.AID_INI.posAcc = posAcc;
msg->payload.AID_INI.tmCfg = tmCfg;
msg->payload.AID_INI.wnoOrDate = wnoOrDate;
msg->payload.AID_INI.towOrDate = towOrDate;
msg->payload.AID_INI.towNs = towNs;
msg->payload.AID_INI.tAccMS = tAccMS;
msg->payload.AID_INI.tAccNS = tAccNS;
msg->payload.AID_INI.clkDOrFreq = clkDOrFreq;
msg->payload.AID_INI.clkDAccOrFreqAcc = clkDAccOrFreqAcc;
msg->payload.AID_INI.flags = flags;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_ANT(UBXX2_t flags, UBXANTPins pins)
{
int payloadSize = sizeof(UBXCFG_ANT);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_ANT);
msg->payload.CFG_ANT.flags = flags;
msg->payload.CFG_ANT.pins = pins;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_ANT_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_ANT);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_CFG(UBXX4_t clearMask, UBXX4_t saveMask, UBXX4_t loadMask)
{
int payloadSize = sizeof(UBXCFG_CFG);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_CFG);
msg->payload.CFG_CFG.clearMask = clearMask;
msg->payload.CFG_CFG.saveMask = saveMask;
msg->payload.CFG_CFG.loadMask = loadMask;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_CFG_OPT(UBXX4_t clearMask, UBXX4_t saveMask, UBXX4_t loadMask, UBXX1_t deviceMask)
{
int payloadSize = sizeof(UBXCFG_CFG_OPT);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_CFG);
msg->payload.CFG_CFG_OPT.clearMask = clearMask;
msg->payload.CFG_CFG_OPT.saveMask = saveMask;
msg->payload.CFG_CFG_OPT.loadMask = loadMask;
msg->payload.CFG_CFG_OPT.deviceMask = deviceMask;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_DAT_IN(UBXR8_t majA, UBXR8_t flat, UBXR4_t dX, UBXR4_t dY, UBXR4_t dZ, UBXR4_t rotX, UBXR4_t rotY, UBXR4_t rotZ, UBXR4_t scale)
{
int payloadSize = sizeof(UBXCFG_DAT_IN);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_CFG);
msg->payload.CFG_DAT_IN.majA = majA;
msg->payload.CFG_DAT_IN.flat = flat;
msg->payload.CFG_DAT_IN.dX = dX;
msg->payload.CFG_DAT_IN.dY = dY;
msg->payload.CFG_DAT_IN.dZ = dZ;
msg->payload.CFG_DAT_IN.rotX = rotX;
msg->payload.CFG_DAT_IN.rotY = rotY;
msg->payload.CFG_DAT_IN.rotZ = rotZ;
msg->payload.CFG_DAT_IN.scale = scale;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_DAT_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_DAT);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_GNSS_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_GNSS);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_GNSS(UBXU1_t msgVer,
UBXU1_t numTrkChHw,
UBXU1_t numTrkChUse,
UBXU1_t numConfigBlocks,
UBXCFG_GNSS_PART* gnssPart)
{
int payloadSize = sizeof(UBXCFG_GNSS) + numConfigBlocks*sizeof(UBXCFG_GNSS_PART);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_GNSS);
msg->payload.CFG_GNSS.msgVer = msgVer;
msg->payload.CFG_GNSS.numTrkChHw = numTrkChHw;
msg->payload.CFG_GNSS.numTrkChUse = numTrkChUse;
msg->payload.CFG_GNSS.numConfigBlocks = numConfigBlocks;
memcpy(((char*)&(msg->payload.CFG_GNSS)) + sizeof(UBXCFG_GNSS), gnssPart, numConfigBlocks*sizeof(UBXCFG_GNSS_PART));
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_INF_POLL(UBXU1_t protocolId)
{
int payloadSize = sizeof(UBXCFG_INF_POLL);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_INF);
msg->payload.CFG_INF_POLL.protocolId = protocolId;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_INF(UBXCFG_INF_PART* infPart, int infPartCount)
{
int payloadSize = sizeof(UBXCFG_INF_PART)*infPartCount;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_INF);
memcpy(&(msg->payload.CFG_INF), infPart, infPartCount*sizeof(UBXCFG_INF_PART));
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_ITFM_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_ITFM);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_ITFM(UBXITFMConfig config,
UBXITFMConfig2 config2)
{
int payloadSize = sizeof(UBXCFG_ITFM);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_ITFM);
msg->payload.CFG_ITFM.config = config;
msg->payload.CFG_ITFM.config2 = config2;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_LOGFILTER_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_LOGFILTER);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_LOGFILTER(UBXU1_t version,
UBXX1_t flags,
UBXU2_t minIterval,
UBXU2_t timeThreshold,
UBXU2_t speedThreshold,
UBXU4_t positionThreshold)
{
int payloadSize = sizeof(UBXCFG_LOGFILTER);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_LOGFILTER);
msg->payload.CFG_LOGFILTER.version = version;
msg->payload.CFG_LOGFILTER.flags = flags;
msg->payload.CFG_LOGFILTER.minIterval = minIterval;
msg->payload.CFG_LOGFILTER.timeThreshold = timeThreshold;
msg->payload.CFG_LOGFILTER.speedThreshold = speedThreshold;
msg->payload.CFG_LOGFILTER.positionThreshold = positionThreshold;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_NAV5_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_NAV5);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_NAV5(UBXX2_t mask,
UBXNAV5Model dynModel,
UBXNAV5FixMode fixMode,
UBXI4_t fixedAlt,
UBXU4_t fixedAltVar,
UBXI1_t minElev,
UBXU2_t pDop,
UBXU2_t tDop,
UBXU2_t pAcc,
UBXU2_t tAcc,
UBXU1_t staticHoldThresh,
UBXU1_t dgpsTimeOut,
UBXU1_t cnoThreshNumSVs,
UBXU1_t cnoThresh)
{
int payloadSize = sizeof(UBXCFG_NAV5);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_NAV5);
msg->payload.CFG_NAV5.mask = mask;
msg->payload.CFG_NAV5.dynModel = dynModel;
msg->payload.CFG_NAV5.fixMode = fixMode;
msg->payload.CFG_NAV5.fixedAlt = fixedAlt;
msg->payload.CFG_NAV5.fixedAltVar = fixedAltVar;
msg->payload.CFG_NAV5.minElev = minElev;
msg->payload.CFG_NAV5.pDop = pDop;
msg->payload.CFG_NAV5.tDop = tDop;
msg->payload.CFG_NAV5.pAcc = pAcc;
msg->payload.CFG_NAV5.tAcc = tAcc;
msg->payload.CFG_NAV5.staticHoldThresh = staticHoldThresh;
msg->payload.CFG_NAV5.dgpsTimeOut = dgpsTimeOut;
msg->payload.CFG_NAV5.cnoThreshNumSVs = cnoThreshNumSVs;
msg->payload.CFG_NAV5.cnoThresh = cnoThresh;
msg->payload.CFG_NAV5.reserved2 = 0;
msg->payload.CFG_NAV5.reserved3 = 0;
msg->payload.CFG_NAV5.reserved4 = 0;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_NAVX5_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_NAVX5);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_NAVX5(UBXU2_t version,
UBXX2_t mask1,
UBXU1_t minSVs,
UBXU1_t maxSVs,
UBXU1_t minCNO,
UBXU1_t iniFix3D,
UBXU2_t wknRollover,
UBXU1_t usePPP,
UBXU1_t aopCFG,
UBXU1_t aopOrbMaxErr)
{
int payloadSize = sizeof(UBXCFG_NAVX5);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_NAVX5);
msg->payload.CFG_NAVX5.version = version;
msg->payload.CFG_NAVX5.mask1 = mask1;
msg->payload.CFG_NAVX5.reserved0 = 0;
msg->payload.CFG_NAVX5.reserved1 = 0;
msg->payload.CFG_NAVX5.reserved2 = 0;
msg->payload.CFG_NAVX5.minSVs = minSVs;
msg->payload.CFG_NAVX5.maxSVs = maxSVs;
msg->payload.CFG_NAVX5.minCNO = minCNO;
msg->payload.CFG_NAVX5.reserved5 = 0;
msg->payload.CFG_NAVX5.iniFix3D = iniFix3D;
msg->payload.CFG_NAVX5.reserved6 = 0;
msg->payload.CFG_NAVX5.reserved7 = 0;
msg->payload.CFG_NAVX5.reserved8 = 0;
msg->payload.CFG_NAVX5.wknRollover = wknRollover;
msg->payload.CFG_NAVX5.reserved9 = 0;
msg->payload.CFG_NAVX5.reserved10 = 0;
msg->payload.CFG_NAVX5.reserved11 = 0;
msg->payload.CFG_NAVX5.usePPP = usePPP;
msg->payload.CFG_NAVX5.aopCFG = aopCFG;
msg->payload.CFG_NAVX5.reserved12 = 0;
msg->payload.CFG_NAVX5.reserved13 = 0;
msg->payload.CFG_NAVX5.aopOrbMaxErr = aopOrbMaxErr;
msg->payload.CFG_NAVX5.reserved14 = 0;
msg->payload.CFG_NAVX5.reserved15 = 0;
msg->payload.CFG_NAVX5.reserved3 = 0;
msg->payload.CFG_NAVX5.reserved4 = 0;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_NMEA_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_NMEA);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_NMEA(UBXX1_t filter,
UBXU1_t nmeaVersion,
UBXU1_t numSV,
UBXX1_t flags,
UBXX4_t gnssToFilter,
UBXNMEASVNumbering svNumbering,
UBXNMEATalkerIds mainTalkerId,
UBXNMEAGSVTalkerIds gsvTalkerId)
{
int payloadSize = sizeof(UBXCFG_NMEA);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_NMEA);
msg->payload.CFG_NMEA.filter = filter;
msg->payload.CFG_NMEA.nmeaVersion = nmeaVersion;
msg->payload.CFG_NMEA.numSV = numSV;
msg->payload.CFG_NMEA.flags = flags;
msg->payload.CFG_NMEA.gnssToFilter = gnssToFilter;
msg->payload.CFG_NMEA.svNumbering = svNumbering;
msg->payload.CFG_NMEA.mainTalkerId = mainTalkerId;
msg->payload.CFG_NMEA.gsvTalkerId = gsvTalkerId;
msg->payload.CFG_NMEA.reserved = 0;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_NVS(UBXX4_t clearMask,
UBXX4_t saveMask,
UBXX4_t loadMask,
UBXX1_t deviceMask)
{
int payloadSize = sizeof(UBXCFG_NVS);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_NVS);
msg->payload.CFG_NVS.clearMask = clearMask;
msg->payload.CFG_NVS.saveMask = saveMask;
msg->payload.CFG_NVS.loadMask = loadMask;
msg->payload.CFG_NVS.deviceMask = deviceMask;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_PM2_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_PM2);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_PM2(UBXCFG_PM2Flags flags, UBXU4_t updatePeriod, UBXU4_t searchPeriod, UBXU4_t gridOffset, UBXU2_t onTime, UBXU2_t minAcqTime)
{
int payloadSize = sizeof(UBXCFG_PM2);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_PM2);
msg->payload.CFG_PM2.flags = flags;
msg->payload.CFG_PM2.updatePeriod = updatePeriod;
msg->payload.CFG_PM2.searchPeriod = searchPeriod;
msg->payload.CFG_PM2.gridOffset = gridOffset;
msg->payload.CFG_PM2.onTime = onTime;
msg->payload.CFG_PM2.minAcqTime = minAcqTime;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_PRT_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_PRT);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_PRT_POLL_OPT(UBXU1_t portId)
{
int payloadSize = sizeof(UBXCFG_PRT_POLL_OPT);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_PRT);
msg->payload.CFG_PRT_POLL_OPT.portId = portId;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_PRT_UART()
{
//TODO
UBXMsgBuffer buffer = createBuffer(0);
return buffer;
}
UBXMsgBuffer getCFG_PRT_USB()
{
//TODO
UBXMsgBuffer buffer = createBuffer(0);
return buffer;
}
UBXMsgBuffer getCFG_PRT_SPI()
{
//TODO
UBXMsgBuffer buffer = createBuffer(0);
return buffer;
}
UBXMsgBuffer getCFG_PRT_DDC()
{
//TODO
UBXMsgBuffer buffer = createBuffer(0);
return buffer;
}
UBXMsgBuffer getCFG_RATE_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_RATE);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_RATE(UBXU2_t measRate, UBXU2_t navRate, UBXU2_t timeRef)
{
int payloadSize = sizeof(UBXCFG_RATE);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_RATE);
msg->payload.CFG_RATE.measRate = measRate;
msg->payload.CFG_RATE.navRate = navRate;
msg->payload.CFG_RATE.timeRef = timeRef;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_RINV(UBXX1_t flags, UBXU1_t* data, int dataSize)
{
int payloadSize = sizeof(UBXCFG_RINV) + dataSize*sizeof(UBXU1_t);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_RINV);
msg->payload.CFG_RINV.flags = flags;
memcpy(((char*)&(msg->payload.CFG_RINV)) + sizeof(UBXCFG_RINV), data, dataSize*sizeof(UBXU1_t));
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_RINV_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_RINV);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_RXM(UBXU1_t lpMode)
{
int payloadSize = sizeof(UBXCFG_RXM);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_RXM);
msg->payload.CFG_RXM.reserved1 = 8;
msg->payload.CFG_RXM.lpMode = lpMode;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_RXM_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_RXM);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_SBAS(UBXX1_t mode, UBXX1_t usage, UBXU1_t maxSBAS, UBXX1_t scanmode2, UBXX4_t scanmode1)
{
int payloadSize = sizeof(UBXCFG_SBAS);
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_SBAS);
msg->payload.CFG_SBAS.mode = mode;
msg->payload.CFG_SBAS.usage = usage;
msg->payload.CFG_SBAS.maxSBAS = maxSBAS;
msg->payload.CFG_SBAS.scanmode2 = scanmode2;
msg->payload.CFG_SBAS.scanmode1 = scanmode1;
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_SBAS_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);
UBXMsg* msg = (UBXMsg*)buffer.data;
initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_SBAS);
completeMsg(&buffer, payloadSize);
return buffer;
}
UBXMsgBuffer getCFG_TP5_POLL()
{
int payloadSize = 0;
UBXMsgBuffer buffer = createBuffer(payloadSize);