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

Last change on this file since 10541 was 10534, checked in by stuerze, 3 months ago

Service and RTCM CRS encoding and decoding as well as Helmert parameter decoding added + some re-organisation

File size: 1.7 KB
RevLine 
[10534]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
68 ENDBLOCK
69 return ressize;
70}
71
Note: See TracBrowser for help on using the repository browser.