- Timestamp:
- Nov 13, 2006, 12:42:14 PM (18 years ago)
- Location:
- trunk/BNC/RTIGS
- Files:
-
- 5 added
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/RTIGS/RTIGSDecoder.cpp
r297 r305 1 // Part of BNC, a utility for retrieving decoding and2 // converting GNSS data streams from NTRIP broadcasters,3 // written by Leos Mervart.4 //5 // Copyright (C) 20066 // German Federal Agency for Cartography and Geodesy (BKG)7 // http://www.bkg.bund.de8 // Czech Technical University Prague, Department of Advanced Geodesy9 // http://www.fsv.cvut.cz10 //11 // Email: euref-ip@bkg.bund.de12 //13 // This program is free software; you can redistribute it and/or14 // modify it under the terms of the GNU General Public License15 // as published by the Free Software Foundation, version 2.16 //17 // This program is distributed in the hope that it will be useful,18 // but WITHOUT ANY WARRANTY; without even the implied warranty of19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the20 // GNU General Public License for more details.21 //22 // You should have received a copy of the GNU General Public License23 // along with this program; if not, write to the Free Software24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.25 1 26 2 /* ------------------------------------------------------------------------- … … 28 4 * ------------------------------------------------------------------------- 29 5 * 30 * Class: RTIGSDecoder6 * Class: rtigs 31 7 * 32 8 * Purpose: RTIGS Decoder … … 40 16 * -----------------------------------------------------------------------*/ 41 17 42 #include " RTIGSDecoder.h"18 #include "rtigs.h" 43 19 #include "bncconst.h" 44 #include "rtigs.h"45 20 46 21 using namespace std; 47 22 23 #undef L1 24 #undef L2 25 48 26 // Constructor 49 27 //////////////////////////////////////////////////////////////////////////// 50 RTIGSDecoder::RTIGSDecoder() {28 rtigs::rtigs() { 51 29 } 52 30 53 31 // Destructor 54 32 //////////////////////////////////////////////////////////////////////////// 55 RTIGSDecoder::~RTIGSDecoder() {33 rtigs::~rtigs() { 56 34 } 57 35 58 36 // 59 37 //////////////////////////////////////////////////////////////////////////// 60 void RTIGSDecoder::Decode(char* buffer, int bufLen) {38 void rtigs::Decode(char* buffer, int bufLen) { 61 39 62 40 // Append the incomming data to the internal buffer … … 70 48 unsigned short xx; 71 49 memcpy( (void*) &xx, &_buffer.data()[ii], sizeof(xx) ); 72 revbytes( (unsigned char*) &xx, sizeof(xx) ); 50 if (_GPSTrans.f_IsLittleEndian) { 51 SwitchBytes( (char*) &xx, sizeof(xx) ); 52 } 73 53 if (xx == 200) { 74 54 _buffer = _buffer.mid(ii); … … 77 57 } 78 58 } 59 79 60 if (! found) { 80 61 _buffer.clear(); … … 82 63 } 83 64 84 // Read the Header 85 // --------------- 86 if (_buffer.size() < (int) sizeof(RTIGSH)) { 87 return; 88 } 89 RTIGSH rtigs_header; 90 bytes_to_rtigsh(&rtigs_header, (unsigned char*) _buffer.data()); 65 unsigned char* p_buf = (unsigned char*) _buffer.data(); 91 66 92 // Read the Observations 93 // --------------------- 94 int numBytes = sizeof(RTIGSH) + rtigs_header.num_bytes; 95 if (_buffer.size() < numBytes) { 67 unsigned short messType = _GPSTrans.GetRTIGSHdrRecType(p_buf); 68 unsigned short numbytes = _GPSTrans.GetRTIGSHdrRecBytes(p_buf); 69 70 // Not enough new data, return 71 // --------------------------- 72 if (_buffer.size() < numbytes) { 96 73 return; 97 74 } 98 75 99 if (rtigs_header.rec_id == 200) {100 RTIGSO rtigs_obs;101 memcpy(&rtigs_obs, &rtigs_header, sizeof(RTIGSH));102 memcpy((unsigned char*) &rtigs_obs.data, _buffer.data(),103 rtigs_header.num_bytes - sizeof(RTIGSH));76 // Decode the epoch 77 // ---------------- 78 if (messType == 200) { 79 RTIGSO_T rtigs_obs; 80 short numObs = _GPSTrans.Decode_RTIGS_Obs(p_buf, numbytes, rtigs_obs); 104 81 105 GPSEpoch epoch; 106 rtigso_to_raw(&rtigs_obs, &epoch); 107 108 for (short ii = 0; ii < epoch.num_sv; ii++) { 82 for (short ii = 0; ii < numObs; ii++) { 109 83 Observation* obs = new Observation(); 110 84 111 obs->SVPRN = epoch.sv[ii].prn;112 obs->GPSWeek = epoch.GPSTime / (7 * 86400);113 obs->GPSWeeks = epoch.GPSTime % (7 * 86400);114 obs->C1 = epoch.sv[ii].CARange;115 obs->P1 = epoch.sv[ii].P1Range;116 obs->P2 = epoch.sv[ii].P2Range;117 obs->L1 = epoch.sv[ii].L1Phase;118 obs->L2 = epoch.sv[ii].L2Phase;119 obs->SNR1 = int( epoch.sv[ii].L1Snr* 10);120 obs->SNR2 = int( epoch.sv[ii].L2Snr* 10);85 obs->SVPRN = _GPSTrans.DecObs.Obs[ii].sat_prn; 86 obs->GPSWeek = _GPSTrans.DecObs.Obs[ii].GPSTime / (7 * 86400); 87 obs->GPSWeeks = _GPSTrans.DecObs.Obs[ii].GPSTime % (7 * 86400); 88 obs->C1 = _GPSTrans.DecObs.Obs[ii].l1_pseudo_range; 89 obs->P1 = _GPSTrans.DecObs.Obs[ii].p1_pseudo_range; 90 obs->P2 = _GPSTrans.DecObs.Obs[ii].p2_pseudo_range; 91 obs->L1 = _GPSTrans.DecObs.Obs[ii].p1_phase; 92 obs->L2 = _GPSTrans.DecObs.Obs[ii].p2_phase; 93 obs->SNR1 = int(_GPSTrans.DecObs.Obs[ii].l1_sn * 10); 94 obs->SNR2 = int(_GPSTrans.DecObs.Obs[ii].l2_sn * 10); 121 95 122 96 _obsList.push_back(obs); … … 126 100 // Unprocessed bytes remain in buffer 127 101 // ---------------------------------- 128 _buffer = _buffer.mid(num Bytes);102 _buffer = _buffer.mid(numbytes); 129 103 } -
trunk/BNC/RTIGS/RTIGSDecoder.h
r297 r305 1 // Part of BNC, a utility for retrieving decoding and2 // converting GNSS data streams from NTRIP broadcasters,3 // written by Leos Mervart.4 //5 // Copyright (C) 20066 // German Federal Agency for Cartography and Geodesy (BKG)7 // http://www.bkg.bund.de8 // Czech Technical University Prague, Department of Advanced Geodesy9 // http://www.fsv.cvut.cz10 //11 // Email: euref-ip@bkg.bund.de12 //13 // This program is free software; you can redistribute it and/or14 // modify it under the terms of the GNU General Public License15 // as published by the Free Software Foundation, version 2.16 //17 // This program is distributed in the hope that it will be useful,18 // but WITHOUT ANY WARRANTY; without even the implied warranty of19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the20 // GNU General Public License for more details.21 //22 // You should have received a copy of the GNU General Public License23 // along with this program; if not, write to the Free Software24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.25 1 26 #ifndef RTIGS DECODER_H27 #define RTIGS DECODER_H2 #ifndef RTIGS_H 3 #define RTIGS_H 28 4 29 5 #include <QByteArray> 30 6 31 7 #include "../RTCM/GPSDecoder.h" 8 #include "cgps_transform.h" 32 9 33 class RTIGSDecoder: public GPSDecoder {10 class rtigs : public GPSDecoder { 34 11 public: 35 RTIGSDecoder();36 ~ RTIGSDecoder();12 rtigs(); 13 ~rtigs(); 37 14 void Decode(char* buffer = 0, int bufLen = 0); 38 15 private: 39 QByteArray _buffer; 16 CGPS_Transform _GPSTrans; 17 QByteArray _buffer; 40 18 } ; 41 19
Note:
See TracChangeset
for help on using the changeset viewer.