source: ntrip/trunk/BNC/RTIGS/rtigs.cpp@ 69

Last change on this file since 69 was 69, checked in by mervart, 18 years ago

* empty log message *

File size: 3.0 KB
Line 
1
2/* -------------------------------------------------------------------------
3 * Bernese NTRIP Client
4 * -------------------------------------------------------------------------
5 *
6 * Class: rtigs
7 *
8 * Purpose: RTIGS Decoder
9 *
10 * Author: L. Mervart
11 *
12 * Created: 24-Aug-2006
13 *
14 * Changes:
15 *
16 * -----------------------------------------------------------------------*/
17
18#include "rtigs.h"
19
20using namespace std;
21
22#undef L1
23#undef L2
24
25// Constructor
26////////////////////////////////////////////////////////////////////////////
27rtigs::rtigs() : GPSDecoder() {
28}
29
30// Destructor
31////////////////////////////////////////////////////////////////////////////
32rtigs::~rtigs() {
33}
34
35//
36////////////////////////////////////////////////////////////////////////////
37void rtigs::Decode(char* buffer, int bufLen) {
38
39 // Append the incomming data to the internal buffer
40 // ------------------------------------------------
41 _buffer.append( QByteArray(buffer, bufLen) );
42
43 // Find the beginning of the message
44 // ---------------------------------
45 bool found = false;
46 for (int ii = 0; ii < _buffer.size(); ii++) {
47 unsigned short xx;
48 memcpy( (void*) &xx, &_buffer.data()[ii], sizeof(xx) );
49 SwitchBytes( (char*) &xx, sizeof(xx) );
50 if (xx == 200) {
51 _buffer = _buffer.mid(ii);
52 found = true;
53 break;
54 }
55 }
56 if (! found) {
57 cout << "Message not found\n";
58 _buffer.clear();
59 return;
60 }
61
62 unsigned char* p_buf = (unsigned char*) _buffer.data();
63
64 unsigned short messType = _GPSTrans.GetRTIGSHdrRecType(p_buf);
65 unsigned short numbytes = _GPSTrans.GetRTIGSHdrRecBytes(p_buf);
66
67 // Not enough new data, return
68 // ---------------------------
69 if (_buffer.size() < numbytes) {
70 return;
71 }
72
73 // Decode the epoch
74 // ----------------
75 if (messType == 200) {
76 RTIGSO_T rtigs_obs;
77 short numObs = _GPSTrans.Decode_RTIGS_Obs(p_buf, numbytes, rtigs_obs);
78
79//// if (numObs > 0) {
80//// _GPSTrans.print_CMEAS();
81//// }
82
83 for (short ii = 0; ii < numObs; ii++) {
84 Observation* obs = new Observation();
85
86//// obs->statID =
87 obs->SVPRN = _GPSTrans.DecObs.Obs[ii].sat_prn;
88 obs->GPSWeek = _GPSTrans.DecObs.Obs[ii].GPSTime / 7 / 86400;
89 obs->GPSWeeks = _GPSTrans.DecObs.Obs[ii].GPSTime -
90 obs->GPSWeek * 7 * 86400;
91//// obs->sec =
92 obs->C1 = _GPSTrans.DecObs.Obs[ii].l1_pseudo_range;
93//// obs->P1 = _GPSTrans.DecObs.Obs[ii].p1_pseudo_range;
94 obs->P2 = _GPSTrans.DecObs.Obs[ii].p2_pseudo_range;
95 obs->L1 = _GPSTrans.DecObs.Obs[ii].p1_phase;
96 obs->L2 = _GPSTrans.DecObs.Obs[ii].p2_phase;
97 obs->SNR1 = (short) _GPSTrans.DecObs.Obs[ii].l1_sn * 10;
98 obs->SNR2 = (short) _GPSTrans.DecObs.Obs[ii].l2_sn * 10;
99//// obs->pCodeIndicator =
100//// obs->cumuLossOfCont =
101
102 m_lObsList.push_back(obs);
103 }
104 }
105
106 // Unprocessed bytes remain in buffer
107 // ----------------------------------
108 _buffer = _buffer.mid(numbytes);
109}
Note: See TracBrowser for help on using the repository browser.