Changeset 305 in ntrip


Ignore:
Timestamp:
Nov 13, 2006, 12:42:14 PM (17 years ago)
Author:
mervart
Message:

* empty log message *

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 and
    2 // converting GNSS data streams from NTRIP broadcasters,
    3 // written by Leos Mervart.
    4 //
    5 // Copyright (C) 2006
    6 // German Federal Agency for Cartography and Geodesy (BKG)
    7 // http://www.bkg.bund.de
    8 // Czech Technical University Prague, Department of Advanced Geodesy
    9 // http://www.fsv.cvut.cz
    10 //
    11 // Email: euref-ip@bkg.bund.de
    12 //
    13 // This program is free software; you can redistribute it and/or
    14 // modify it under the terms of the GNU General Public License
    15 // 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 of
    19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    20 // GNU General Public License for more details.
    21 //
    22 // You should have received a copy of the GNU General Public License
    23 // along with this program; if not, write to the Free Software
    24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    251
    262/* -------------------------------------------------------------------------
     
    284 * -------------------------------------------------------------------------
    295 *
    30  * Class:      RTIGSDecoder
     6 * Class:      rtigs
    317 *
    328 * Purpose:    RTIGS Decoder
     
    4016 * -----------------------------------------------------------------------*/
    4117
    42 #include "RTIGSDecoder.h"
     18#include "rtigs.h"
    4319#include "bncconst.h"
    44 #include "rtigs.h"
    4520
    4621using namespace std;
    4722
     23#undef L1
     24#undef L2
     25
    4826// Constructor
    4927////////////////////////////////////////////////////////////////////////////
    50 RTIGSDecoder::RTIGSDecoder() {
     28rtigs::rtigs() {
    5129}
    5230
    5331// Destructor
    5432////////////////////////////////////////////////////////////////////////////
    55 RTIGSDecoder::~RTIGSDecoder() {
     33rtigs::~rtigs() {
    5634}
    5735
    5836//
    5937////////////////////////////////////////////////////////////////////////////
    60 void RTIGSDecoder::Decode(char* buffer, int bufLen) {
     38void rtigs::Decode(char* buffer, int bufLen) {
    6139
    6240  // Append the incomming data to the internal buffer
     
    7048    unsigned short xx;
    7149    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    }
    7353    if (xx == 200) {
    7454      _buffer = _buffer.mid(ii);
     
    7757    }
    7858  }
     59
    7960  if (! found) {
    8061    _buffer.clear();
     
    8263  }
    8364
    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(); 
    9166
    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) {
    9673    return;
    9774  }
    9875
    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);
    10481
    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++) {
    10983      Observation* obs = new Observation();
    11084
    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);
    12195
    12296      _obsList.push_back(obs);
     
    126100  // Unprocessed bytes remain in buffer
    127101  // ----------------------------------
    128   _buffer = _buffer.mid(numBytes);
     102  _buffer = _buffer.mid(numbytes);
    129103}
  • trunk/BNC/RTIGS/RTIGSDecoder.h

    r297 r305  
    1 // Part of BNC, a utility for retrieving decoding and
    2 // converting GNSS data streams from NTRIP broadcasters,
    3 // written by Leos Mervart.
    4 //
    5 // Copyright (C) 2006
    6 // German Federal Agency for Cartography and Geodesy (BKG)
    7 // http://www.bkg.bund.de
    8 // Czech Technical University Prague, Department of Advanced Geodesy
    9 // http://www.fsv.cvut.cz
    10 //
    11 // Email: euref-ip@bkg.bund.de
    12 //
    13 // This program is free software; you can redistribute it and/or
    14 // modify it under the terms of the GNU General Public License
    15 // 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 of
    19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    20 // GNU General Public License for more details.
    21 //
    22 // You should have received a copy of the GNU General Public License
    23 // along with this program; if not, write to the Free Software
    24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    251
    26 #ifndef RTIGSDECODER_H
    27 #define RTIGSDECODER_H
     2#ifndef RTIGS_H
     3#define RTIGS_H
    284
    295#include <QByteArray>
    306
    317#include "../RTCM/GPSDecoder.h"
     8#include "cgps_transform.h"
    329
    33 class RTIGSDecoder : public GPSDecoder {
     10class rtigs : public GPSDecoder {
    3411public:
    35   RTIGSDecoder();
    36   ~RTIGSDecoder();
     12  rtigs();
     13  ~rtigs();
    3714  void Decode(char* buffer = 0, int bufLen = 0);
    3815private:
    39   QByteArray _buffer;
     16  CGPS_Transform _GPSTrans;
     17  QByteArray     _buffer;
    4018} ;
    4119
Note: See TracChangeset for help on using the changeset viewer.