source: ntrip/trunk/BNC/src/RTCM3/crsEncoder.cpp@ 10583

Last change on this file since 10583 was 10551, checked in by stuerze, 3 months ago

minor changes

File size: 2.8 KB
Line 
1/*
2 * crsEncoder.cpp
3 *
4 * Created on: Jun 18, 2024
5 * Author: stuerze
6 */
7
8
9#include "crsEncoder.h"
10
11using namespace std;
12
13// build up RTCM3 for serviceCrs
14////////////////////////////////////////////////////////////////////////////
15int t_crsEncoder::RTCM3(const t_serviceCrs& serviceCrs, char *buffer, size_t size) {
16 STARTDATA
17 INITBLOCK
18 ADDBITS(12, 1300)
19 int N = sizeof(serviceCrs._name) / sizeof(serviceCrs._name[0]);
20 if (N > 31) {N = 31;}
21 ADDBITS(5, N)
22 for(int i = 0; i < N; i++) {
23 ADDBITS(8, serviceCrs._name[i])
24 }
25 SCALEADDBITS(16, 100, serviceCrs._CE)
26 ENDBLOCK
27 return ressize;
28}
29
30// build up RTCM3 for rtcmCrs
31////////////////////////////////////////////////////////////////////////////
32int t_crsEncoder::RTCM3(const t_rtcmCrs& rtcmCrs, char *buffer, size_t size) {
33 STARTDATA
34 INITBLOCK
35
36 ADDBITS(12, 1302)
37 int N = sizeof(rtcmCrs._name) / sizeof(rtcmCrs._name[0]);
38 if (N > 31) {N = 31;}
39 ADDBITS(5, N)
40 for(int i = 0; i < N; i++) {
41 ADDBITS(8, rtcmCrs._name[i])
42 }
43 ADDBITS(1, rtcmCrs._anchor)
44 ADDBITS(5, rtcmCrs._plateNumber)
45 int dblinknum = rtcmCrs._databaseLinks.size();
46 ADDBITS(3, dblinknum);
47 if (dblinknum) {
48 for(int d = 0; d < dblinknum; d++) {
49 N = sizeof(rtcmCrs._databaseLinks[d]) / sizeof(rtcmCrs._databaseLinks[d][0]);
50 for(int i = 0; i < N; i++) {
51 ADDBITS(8, rtcmCrs._databaseLinks[d].toLatin1()[i])
52 }
53 }
54 }
55 ENDBLOCK
56 return ressize;
57}
58
59// build up RTCM3 for
60////////////////////////////////////////////////////////////////////////////
61int t_crsEncoder::RTCM3(const t_helmertPar& helmertPar, char *buffer, size_t size) {
62
63 STARTDATA
64 INITBLOCK
65
66 ADDBITS(12, 1301)
67 int N = sizeof(helmertPar._sourceName) / sizeof(helmertPar._sourceName[0]);
68 if (N > 31) {N = 31;}
69 ADDBITS(5, N)
70 for(int i = 0; i < N; i++) {
71 ADDBITS(8, helmertPar._sourceName[i])
72 }
73 N = sizeof(helmertPar._targetName) / sizeof(helmertPar._targetName[0]);
74 if (N > 31) {N = 31;}
75 ADDBITS(5, N)
76 for(int i = 0; i < N; i++) {
77 ADDBITS(8, helmertPar._targetName[i])
78 }
79 ADDBITS(8 , helmertPar._sysIdentNum)
80 ADDBITS(10, helmertPar._utilTrafoMessageIndicator)
81 ADDBITS(16, (helmertPar._mjd - 44244))
82
83 SCALEADDBITS(23, 1000.0, helmertPar._dx)
84 SCALEADDBITS(23, 1000.0, helmertPar._dy)
85 SCALEADDBITS(23, 1000.0, helmertPar._dz)
86
87 CRSADDBITSFLOAT(32, helmertPar._ox, 50000.0)
88 CRSADDBITSFLOAT(32, helmertPar._oy, 50000.0)
89 CRSADDBITSFLOAT(32, helmertPar._oz, 50000.0)
90
91 SCALEADDBITS(25, 100000.0, helmertPar._sc)
92
93 SCALEADDBITS(17, 50000.0, helmertPar._dxr)
94 SCALEADDBITS(17, 50000.0, helmertPar._dyr)
95 SCALEADDBITS(17, 50000.0, helmertPar._dzr)
96
97 SCALEADDBITS(17, 2500000.0, helmertPar._oxr)
98 SCALEADDBITS(17, 2500000.0, helmertPar._oyr)
99 SCALEADDBITS(17, 2500000.0, helmertPar._ozr)
100
101 SCALEADDBITS(14, 5000000.0, helmertPar._scr)
102
103 ENDBLOCK
104 return ressize;
105}
106
Note: See TracBrowser for help on using the repository browser.