Changeset 511 in ntrip


Ignore:
Timestamp:
Oct 16, 2007, 4:30:58 PM (17 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNC
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/RTCM3/RTCM3Decoder.cpp

    r509 r511  
    4444#include "RTCM3Decoder.h"
    4545#include "bncconst.h"
     46#include "bncapp.h"
    4647
    4748using namespace std;
     
    5051#  define isinf(x) 0
    5152#endif
     53
     54//
     55////////////////////////////////////////////////////////////////////////////
     56ephSender::ephSender() {
     57  connect(this, SIGNAL(newGPSEph(gpsephemeris*)),
     58          (bncApp*) qApp, SLOT(slotNewGPSEph(gpsephemeris*)));
     59  connect(this, SIGNAL(newGlonassEph(glonassephemeris*)),
     60          (bncApp*) qApp, SLOT(slotNewGlonassEph(glonassephemeris*)));
     61}
    5262
    5363// Error Handling
     
    6373// Constructor
    6474////////////////////////////////////////////////////////////////////////////
    65 RTCM3Decoder::RTCM3Decoder(const QByteArray& staID) : GPSDecoder() {
     75RTCM3Decoder::RTCM3Decoder() : GPSDecoder() {
    6676
    6777  const int LEAPSECONDS = 14; /* only needed for approx. time */
     
    7383  _Parser.GPSWeek = tim/(7*24*60*60);
    7484  _Parser.GPSTOW  = tim%(7*24*60*60);
    75 
    76   // _Parser2 is used for direct file output
    77   // ---------------------------------------
    78   memset(&_Parser2, 0, sizeof(_Parser2));
    79   _Parser2.GPSWeek = tim/(7*24*60*60);
    80   _Parser2.GPSTOW  = tim%(7*24*60*60);
    81 
    82   _Parser2.headerfile       = 0;
    83   _Parser2.glonassephemeris = 0;
    84   _Parser2.gpsephemeris     = strdup((staID + ".EPH").data());
    85   _Parser2.rinex3           = 1;
    8685}
    8786
     
    8988////////////////////////////////////////////////////////////////////////////
    9089RTCM3Decoder::~RTCM3Decoder() {
    91   if (_Parser2.glonassfile) {
    92     fclose(_Parser2.glonassfile);
    93   }
    94   if (_Parser2.gpsfile) {
    95     fclose(_Parser2.gpsfile);
    96   }
    9790}
    9891
     
    10194void RTCM3Decoder::Decode(char* buffer, int bufLen) {
    10295
    103   // Direct file output
    104   // ------------------
    105   for (int ii = 0; ii < bufLen; ii++) {
    106     HandleByte(&_Parser2, (unsigned int) buffer[ii]);
    107     if (_Parser2.glonassfile) {
    108       fflush(_Parser2.glonassfile);
    109     }
    110     if (_Parser2.gpsfile) {
    111       fflush(_Parser2.gpsfile);
    112     }
    113   }
    114 
    115   // Fill the obs structure
    116   // ----------------------
    11796  for (int ii = 0; ii < bufLen; ii++) {
    11897
     
    122101      while(int rr = RTCM3Parser(&_Parser)) {
    123102
    124         if (!_Parser.init) {
    125           HandleHeader(&_Parser);
    126           _Parser.init = 1;
    127         }
     103        // GNSS Observations
     104        // -----------------
     105        if (rr == 1 || rr == 2) {
    128106
    129         if (rr == 2) {
    130           std::cerr << "No valid RINEX! All values are modulo 299792.458!\n";
    131         }
    132 
    133         for (int ii = 0; ii < _Parser.Data.numsats; ii++) {
    134           Observation* obs = new Observation();
    135           if (_Parser.Data.satellites[ii] <= PRN_GPS_END) {
    136             obs->satSys = 'G';
    137             obs->satNum = _Parser.Data.satellites[ii];
    138           }
    139           else {
    140             obs->satSys = 'R';
    141             obs->satNum = _Parser.Data.satellites[ii] - PRN_GLONASS_START + 1;
    142           }
    143           obs->GPSWeek  = _Parser.Data.week;
    144           obs->GPSWeeks = _Parser.Data.timeofweek / 1000.0;
    145 
    146           for (int jj = 0; jj < _Parser.numdatatypesGPS; jj++) {
    147             int v = 0;
    148             int df = _Parser.dataflag[jj];
    149             int pos = _Parser.datapos[jj];
    150             if ( (_Parser.Data.dataflags[ii] & df)
    151                  && !isnan(_Parser.Data.measdata[ii][pos])
    152                  && !isinf(_Parser.Data.measdata[ii][pos])) {
    153               v = 1;
    154             }
    155             else {
    156               df = _Parser.dataflagGPS[jj];
    157               pos = _Parser.dataposGPS[jj];
     107          if (!_Parser.init) {
     108            HandleHeader(&_Parser);
     109            _Parser.init = 1;
     110          }
     111         
     112          if (rr == 2) {
     113            std::cerr << "No valid RINEX! All values are modulo 299792.458!\n";
     114          }
     115         
     116          for (int ii = 0; ii < _Parser.Data.numsats; ii++) {
     117            Observation* obs = new Observation();
     118            if (_Parser.Data.satellites[ii] <= PRN_GPS_END) {
     119              obs->satSys = 'G';
     120              obs->satNum = _Parser.Data.satellites[ii];
     121            }
     122            else {
     123              obs->satSys = 'R';
     124              obs->satNum = _Parser.Data.satellites[ii] - PRN_GLONASS_START + 1;
     125            }
     126            obs->GPSWeek  = _Parser.Data.week;
     127            obs->GPSWeeks = _Parser.Data.timeofweek / 1000.0;
     128         
     129            for (int jj = 0; jj < _Parser.numdatatypesGPS; jj++) {
     130              int v = 0;
     131              int df = _Parser.dataflag[jj];
     132              int pos = _Parser.datapos[jj];
    158133              if ( (_Parser.Data.dataflags[ii] & df)
    159134                   && !isnan(_Parser.Data.measdata[ii][pos])
    160135                   && !isinf(_Parser.Data.measdata[ii][pos])) {
    161               v = 1;
     136                v = 1;
     137              }
     138              else {
     139                df = _Parser.dataflagGPS[jj];
     140                pos = _Parser.dataposGPS[jj];
     141                if ( (_Parser.Data.dataflags[ii] & df)
     142                     && !isnan(_Parser.Data.measdata[ii][pos])
     143                     && !isinf(_Parser.Data.measdata[ii][pos])) {
     144                v = 1;
     145                }
     146              }
     147            if(!v)
     148            { continue; }
     149            else
     150            {
     151              if      (_Parser.dataflag[jj] & GNSSDF_C1DATA) {
     152                obs->C1 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
     153              }
     154              else if (_Parser.dataflag[jj] & GNSSDF_C2DATA) {
     155                obs->C2 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
     156              }
     157              else if (_Parser.dataflag[jj] & GNSSDF_P1DATA) {
     158                obs->P1 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
     159              }
     160              else if (_Parser.dataflag[jj] & GNSSDF_P2DATA) {
     161                obs->P2 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
     162              }
     163              else if (df & (GNSSDF_L1CDATA|GNSSDF_L1PDATA)) {
     164                obs->L1   = _Parser.Data.measdata[ii][pos];
     165                obs->SNR1 = _Parser.Data.snrL1[ii];
     166              }
     167              else if (df & (GNSSDF_L2CDATA|GNSSDF_L2PDATA)) {
     168                obs->L2   = _Parser.Data.measdata[ii][pos];
     169                obs->SNR2 = _Parser.Data.snrL2[ii];
     170              }
     171              else if (df & (GNSSDF_S1CDATA|GNSSDF_S1PDATA)) {
     172                obs->S1   = _Parser.Data.measdata[ii][pos];
     173              }
     174              else if (df & (GNSSDF_S2CDATA|GNSSDF_S2PDATA)) {
     175                obs->S2   = _Parser.Data.measdata[ii][pos];
    162176              }
    163177            }
    164           if(!v)
    165           { continue; }
    166           else
    167           {
    168             if      (_Parser.dataflag[jj] & GNSSDF_C1DATA) {
    169               obs->C1 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
    170178            }
    171             else if (_Parser.dataflag[jj] & GNSSDF_C2DATA) {
    172               obs->C2 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
    173             }
    174             else if (_Parser.dataflag[jj] & GNSSDF_P1DATA) {
    175               obs->P1 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
    176             }
    177             else if (_Parser.dataflag[jj] & GNSSDF_P2DATA) {
    178               obs->P2 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
    179             }
    180             else if (df & (GNSSDF_L1CDATA|GNSSDF_L1PDATA)) {
    181               obs->L1   = _Parser.Data.measdata[ii][pos];
    182               obs->SNR1 = _Parser.Data.snrL1[ii];
    183             }
    184             else if (df & (GNSSDF_L2CDATA|GNSSDF_L2PDATA)) {
    185               obs->L2   = _Parser.Data.measdata[ii][pos];
    186               obs->SNR2 = _Parser.Data.snrL2[ii];
    187             }
    188             else if (df & (GNSSDF_S1CDATA|GNSSDF_S1PDATA)) {
    189               obs->S1   = _Parser.Data.measdata[ii][pos];
    190             }
    191             else if (df & (GNSSDF_S2CDATA|GNSSDF_S2PDATA)) {
    192               obs->S2   = _Parser.Data.measdata[ii][pos];
    193             }
     179            _obsList.push_back(obs);
    194180          }
    195           }
    196           _obsList.push_back(obs);
     181        }
     182
     183        // GPS Ephemeris
     184        // -------------
     185        else if (rr == 1019) {
     186          gpsephemeris* ep = new gpsephemeris(_Parser.ephemerisGPS);
     187          emit _ephSender.newGPSEph(ep);
     188        }
     189
     190        // GLONASS Ephemeris
     191        // -----------------
     192        else if (rr == 1020) {
     193          glonassephemeris* ep = new glonassephemeris(_Parser.ephemerisGLONASS);
     194          emit _ephSender.newGlonassEph(ep);
    197195        }
    198196      }
  • trunk/BNC/RTCM3/RTCM3Decoder.h

    r508 r511  
    3333}
    3434
     35class ephSender : public QObject {
     36Q_OBJECT
     37public:
     38  ephSender();
     39  friend class RTCM3Decoder;
     40signals:
     41  void newGPSEph(gpsephemeris* gpseph);
     42  void newGlonassEph(glonassephemeris* glonasseph);
     43} ;
     44
    3545class RTCM3Decoder : public GPSDecoder {
    3646public:
    37   RTCM3Decoder(const QByteArray& staID);
     47  RTCM3Decoder();
    3848  ~RTCM3Decoder();
    3949  void Decode(char* buffer = 0, int bufLen = 0);
    4050private:
    4151  struct RTCM3ParserData _Parser;
    42   struct RTCM3ParserData _Parser2;
     52  ephSender _ephSender;
    4353} ;
    4454
  • trunk/BNC/RTIGS/rtstruct.h

    r305 r511  
    2020/* Purpose : structure definitions for the wide area prototype             */
    2121
    22 /* RCS: $Header: /usr/local/cvsroot/BNC/RTIGS/rtstruct.h,v 1.1 2006/08/20 13:36:49 mervart Exp $ */
     22/* RCS: $Header: /usr/local/cvsroot/BNC/RTIGS/rtstruct.h,v 1.3 2006/11/13 11:42:14 mervart Exp $ */
    2323
    2424/* Externals :                                                             */
     
    8080
    8181#define  MAX_STA             (24)               /* maximum stations        */
     82#ifndef PI
    8283#define  PI   (3.141592653589793)               /* value of PI             */
     84#endif
    8385#define  DTR  (0.017453292519943)               /* deg to rad conversion con. */
    8486#define  C         (299792458.00)               /* speed of light in vaccuum  */
  • trunk/BNC/bncapp.cpp

    r476 r511  
    100100  }
    101101}
     102
     103//
     104////////////////////////////////////////////////////////////////////////////
     105void bncApp::slotNewGPSEph(gpsephemeris* gpseph) {
     106}
     107   
     108//
     109////////////////////////////////////////////////////////////////////////////
     110void bncApp::slotNewGlonassEph(glonassephemeris* glonasseph) {
     111}
     112
  • trunk/BNC/bncapp.h

    r464 r511  
    3131
    3232#include "bnccaster.h"
     33#include "RTCM3/RTCM3Decoder.h"
    3334
    3435class bncApp : public QApplication {
     
    4041  public slots:
    4142    void slotMessage(const QByteArray msg);
     43    void slotNewGPSEph(gpsephemeris* gpseph);
     44    void slotNewGlonassEph(glonassephemeris* glonasseph);
    4245  private:
    4346    QFile*       _logFile;
  • trunk/BNC/bncgetthread.cpp

    r508 r511  
    333333    else if (_format.indexOf("RTCM_3") != -1) {
    334334      emit(newMessage("Get Data: " + _staID + " in RTCM 3.0 format"));
    335       _decoder = new RTCM3Decoder(_staID);
     335      _decoder = new RTCM3Decoder();
    336336    }
    337337    else if (_format.indexOf("RTIGS") != -1) {
Note: See TracChangeset for help on using the changeset viewer.