Changeset 5860 in ntrip


Ignore:
Timestamp:
Aug 8, 2014, 10:02:53 AM (10 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/src
Files:
2 added
4 deleted
6 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/PPP/pppMain.cpp

    r5847 r5860  
    5757//////////////////////////////////////////////////////////////////////////////
    5858t_pppMain::~t_pppMain() {
    59   stop();
     59  slotStop();
    6060}
    6161
     
    8181  catch (t_except exc) {
    8282    _running = true;
    83     stop();
     83    slotStop();
    8484  }
    8585}
     
    8787//
    8888//////////////////////////////////////////////////////////////////////////////
    89 void t_pppMain::stop() {
     89void t_pppMain::slotStop() {
    9090  if (!_running) {
    9191    return;
  • trunk/BNC/src/PPP/pppMain.h

    r5814 r5860  
    88namespace BNC_PPP {
    99
    10 class t_pppMain {
     10class t_pppMain : public QObject {
    1111 public:
    1212  t_pppMain();                                                     
    1313  ~t_pppMain();
    1414  void start();                                                     
    15   void stop();                                                     
     15 public slots:
     16  void slotStop();                                                     
    1617
    1718 private:
  • trunk/BNC/src/PPP/pppThread.cpp

    r5854 r5860  
    5656////////////////////////////////////////////////////////////////////////////
    5757t_pppThread::t_pppThread(const t_pppOptions* opt) : QThread(0) {
    58   _opt   = opt;
    59   _pppRun = 0;
     58  _opt            = opt;
     59  _pppRunRealTime = 0;
    6060  connect(this, SIGNAL(finished()), this, SLOT(deleteLater()));
    6161
     
    6767////////////////////////////////////////////////////////////////////////////
    6868t_pppThread::~t_pppThread() {
    69   delete _pppRun;
     69  delete _pppRunRealTime;
    7070}
    7171
     
    7474void t_pppThread::run() {
    7575  try {
    76     _pppRun = new t_pppRun(_opt);
     76    _pppRunRealTime = new t_pppRunRealTime(_opt);
    7777    QThread::exec();
    7878  }
    7979  catch (t_except exc) {
    80     _pppRun = 0;
     80    _pppRunRealTime = 0;
    8181    emit newMessage(QByteArray(exc.what().c_str()), true);
    8282  }
    8383}
    8484
    85 // Constructor
    86 ////////////////////////////////////////////////////////////////////////////
    87 t_pppRun::t_pppRun(const t_pppOptions* opt) {
    88   _opt = opt;
    89   connect(this, SIGNAL(newMessage(QByteArray,bool)),
    90           BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
    91   if (_opt->_realTime) {
    92     connect(BNC_CORE->caster(), SIGNAL(newObs(QByteArray, QList<t_obs>)),
    93             this, SLOT(slotNewObs(QByteArray, QList<t_obs>)));
    94 
    95     connect(BNC_CORE, SIGNAL(newEphGPS(gpsephemeris)),
    96             this, SLOT(slotNewEphGPS(gpsephemeris)));
    97  
    98     connect(BNC_CORE, SIGNAL(newEphGlonass(glonassephemeris)),
    99             this, SLOT(slotNewEphGlonass(glonassephemeris)));
    100  
    101     connect(BNC_CORE, SIGNAL(newEphGalileo(galileoephemeris)),
    102             this, SLOT(slotNewEphGalileo(galileoephemeris)));
    103 
    104     connect(BNC_CORE, SIGNAL(newCorrections(QStringList)),
    105             this, SLOT(slotNewCorrections(QStringList)));
    106 
    107     for (unsigned iPrn = 0; iPrn <= t_prn::MAXPRN; iPrn++) {
    108       _lastOrbCorrIOD[iPrn]   = -1;
    109       _lastClkCorrValue[iPrn] = 0.0;
    110     }
    111 
    112     _pppClient = new t_pppClient(_opt);
    113   }
    114   else {
    115     throw t_except("t_pppRun: post-processing not yet implemented");
    116   }
    117 }
    118 
    119 // Destructor
    120 ////////////////////////////////////////////////////////////////////////////
    121 t_pppRun::~t_pppRun() {
    122 }
    123 
    124 //
    125 ////////////////////////////////////////////////////////////////////////////
    126 void t_pppRun::slotNewEphGPS(gpsephemeris gpseph) {
    127   QMutexLocker locker(&_mutex);
    128   t_ephGPS eph;
    129   eph.set(&gpseph);
    130   _pppClient->putEphemeris(&eph);
    131 }
    132 
    133 //
    134 ////////////////////////////////////////////////////////////////////////////
    135 void t_pppRun::slotNewEphGlonass(glonassephemeris gloeph) {
    136   QMutexLocker locker(&_mutex);
    137   t_ephGlo eph;
    138   eph.set(&gloeph);
    139   _pppClient->putEphemeris(&eph);
    140 }
    141  
    142 //
    143 ////////////////////////////////////////////////////////////////////////////
    144 void t_pppRun::slotNewEphGalileo(galileoephemeris galeph) {
    145   QMutexLocker locker(&_mutex);
    146   t_ephGal eph;
    147   eph.set(&galeph);
    148   _pppClient->putEphemeris(&eph);
    149 }
    150 
    151 //
    152 ////////////////////////////////////////////////////////////////////////////
    153 void t_pppRun::slotNewObs(QByteArray staID, QList<t_obs> obsList) {
    154   QMutexLocker locker(&_mutex);
    155 
    156   if (string(staID.data()) != _opt->_roverName) {
    157     return;
    158   }
    159 
    160   // Loop over all obsevations (possible different epochs)
    161   // -----------------------------------------------------
    162   QListIterator<t_obs> it(obsList);
    163   while (it.hasNext()) {
    164     const t_obs& oldObs = it.next();
    165     t_satObs* newObs = new t_satObs;
    166    
    167     newObs->_prn.set(oldObs.satSys, oldObs.satNum);
    168     newObs->_time.set(oldObs.GPSWeek, oldObs.GPSWeeks);
    169 
    170     // Find the corresponding data epoch or create a new one
    171     // -----------------------------------------------------
    172     t_epoData* epoch = 0;
    173     deque<t_epoData*>::const_iterator it;
    174     for (it = _epoData.begin(); it != _epoData.end(); it++) {
    175       if (newObs->_time == (*it)->_time) {
    176         epoch = *it;
    177         break;
    178       }
    179     }
    180     if (epoch == 0) {
    181       if (_epoData.empty() || newObs->_time > _epoData.back()->_time) {
    182         epoch = new t_epoData;
    183         epoch->_time = newObs->_time;
    184         _epoData.push_back(epoch);
    185       }
    186     }
    187 
    188     // Fill the new observation and add it to the corresponding epoch
    189     // --------------------------------------------------------------
    190     if (epoch != 0) {
    191       epoch->_satObs.push_back(newObs);
    192       map<string, t_frqObs*> frqObsMap;
    193       for (unsigned iEntry = 0; iEntry < GNSSENTRY_NUMBER; iEntry++) {
    194         string hlp(oldObs.rnxStr(iEntry).toAscii().data());
    195         if (hlp.length() == 3) {
    196           char   obsType    = hlp[0];
    197           string rnxType2ch = hlp.substr(1);
    198           if (obsType == 'C' || obsType == 'L') {
    199             t_frqObs* frqObs = 0;
    200             if (frqObsMap.find(rnxType2ch) == frqObsMap.end()) {
    201               frqObs                = new t_frqObs();
    202               frqObsMap[rnxType2ch] = frqObs;
    203               frqObs->_rnxType2ch   = rnxType2ch;
    204               newObs->_obs.push_back(frqObs);
    205             }
    206             else {
    207               frqObs = frqObsMap[rnxType2ch];
    208             }
    209             if      (obsType == 'C') {
    210               frqObs->_code      = oldObs._measdata[iEntry];
    211               frqObs->_codeValid = true;
    212             }
    213             else if (obsType == 'L') {
    214               frqObs->_phase      = oldObs._measdata[iEntry];
    215               frqObs->_phaseValid = true;
    216             }
    217           }
    218         }
    219       }
    220     }
    221   }
    222 
    223   // Process the oldest epochs
    224   // ------------------------
    225   while (_epoData.size() && _epoData.front()->_time < _lastClkCorrTime + 10.0) {
    226 
    227     const vector<t_satObs*>& satObs = _epoData.front()->_satObs;
    228 
    229     t_output output;
    230     _pppClient->processEpoch(satObs, &output);
    231 
    232     delete _epoData.front(); _epoData.pop_front();
    233 
    234     //// beg test
    235     cout << output._log << endl; cout.flush();
    236     //// end test
    237    
    238     emit newMessage(QByteArray(output._log.c_str()), true);
    239   }
    240 }
    241    
    242 //
    243 ////////////////////////////////////////////////////////////////////////////
    244 void t_pppRun::slotNewCorrections(QStringList corrList) {
    245   QMutexLocker locker(&_mutex);
    246 
    247   if (_opt->_corrMount.empty()) {
    248     return;
    249   }
    250 
    251   // Check the Mountpoint (source of corrections)
    252   // --------------------------------------------
    253   QMutableListIterator<QString> itm(corrList);
    254   while (itm.hasNext()) {
    255     QStringList hlp = itm.next().split(" ");
    256     if (hlp.size() > 0) {
    257       QString mountpoint = hlp[hlp.size()-1];
    258       if (mountpoint != QString(_opt->_corrMount.c_str())) {
    259         itm.remove();     
    260       }
    261     }
    262   }
    263 
    264   if (corrList.size() == 0) {
    265     return;
    266   }
    267 
    268   vector<t_orbCorr*> orbCorr;
    269   vector<t_clkCorr*> clkCorr;
    270   vector<t_satBias*> satBias;
    271 
    272   QListIterator<QString> it(corrList);
    273   while (it.hasNext()) {
    274     QString line = it.next();
    275 
    276     QTextStream in(&line);
    277     int     messageType;
    278     int     updateInterval;
    279     int     GPSweek;
    280     double  GPSweeks;
    281     QString prn;
    282     in >> messageType >> updateInterval >> GPSweek >> GPSweeks >> prn;
    283 
    284     if ( t_corr::relevantMessageType(messageType) ) {
    285       t_corr corr;
    286       corr.readLine(line);
    287       if      (messageType == COTYPE_GPSCOMBINED || messageType == COTYPE_GLONASSCOMBINED ||
    288                messageType == COTYPE_GPSORBIT    || messageType == COTYPE_GLONASSORBIT    ) {
    289         t_orbCorr* cc = new t_orbCorr();
    290         cc->_prn.set(corr.prn.toAscii().data());
    291         cc->_iod       = corr.iod;
    292         cc->_time      = corr.tRao;
    293         cc->_system    = 'R';
    294         cc->_xr[0]     = corr.rao[0];
    295         cc->_xr[1]     = corr.rao[1];
    296         cc->_xr[2]     = corr.rao[2];
    297         cc->_dotXr[0]  = corr.dotRao[0];
    298         cc->_dotXr[0]  = corr.dotRao[1];
    299         cc->_dotXr[0]  = corr.dotRao[2];
    300         orbCorr.push_back(cc);
    301 
    302         _lastOrbCorrIOD[cc->_prn.toInt()] = cc->_iod;
    303       }
    304       else if (messageType == COTYPE_GPSCOMBINED || messageType == COTYPE_GLONASSCOMBINED ||
    305                messageType == COTYPE_GPSCLOCK    || messageType == COTYPE_GLONASSCLOCK    ) {
    306         t_clkCorr* cc = new t_clkCorr();
    307         cc->_prn.set(corr.prn.toAscii().data());
    308         cc->_iod         = corr.iod;
    309         cc->_time        = corr.tClk;
    310         cc->_dClk        = corr.dClk;
    311         cc->_dotDClk     = corr.dotDClk;
    312         cc->_dotDotDClk  = corr.dotDotDClk;
    313         cc->_clkPartial  = 0.0;
    314         if (messageType == COTYPE_GPSCLOCK || messageType == COTYPE_GLONASSCLOCK) {
    315           int lastIOD = _lastOrbCorrIOD[cc->_prn.toInt()];
    316           if (lastIOD != -1) {
    317             cc->_iod = lastIOD;
    318           }
    319           else {
    320             delete cc;
    321             cc = 0;
    322           }
    323         }
    324         if (cc) {
    325           clkCorr.push_back(cc);       
    326           if (_lastClkCorrTime.undef() || cc->_time > _lastClkCorrTime) {
    327             _lastClkCorrTime = cc->_time;
    328           }
    329         }
    330       }
    331     }
    332     else if ( messageType == BTYPE_GPS || messageType == BTYPE_GLONASS ) {
    333       t_bias bias;
    334       bias.readLine(line);
    335     }
    336   }
    337 
    338   _pppClient->putOrbCorrections(orbCorr);
    339   _pppClient->putClkCorrections(clkCorr);
    340   _pppClient->putBiases(satBias);   
    341 
    342   for (unsigned ii = 0; ii < orbCorr.size(); ii++) {
    343     delete orbCorr[ii];
    344   }
    345   for (unsigned ii = 0; ii < clkCorr.size(); ii++) {
    346     delete clkCorr[ii];
    347   }
    348   for (unsigned ii = 0; ii < satBias.size(); ii++) {
    349     delete satBias[ii];
    350   }
    351 }
  • trunk/BNC/src/PPP/pppThread.h

    r5850 r5860  
    99#include "pppOptions.h"
    1010#include "pppClient.h"
     11#include "pppRunRealTime.h"
    1112
    1213namespace BNC_PPP {
    13 
    14 class t_pppRun : public QObject {
    15  Q_OBJECT
    16  public:
    17   t_pppRun(const t_pppOptions* opt);
    18   ~t_pppRun();
    19 
    20  signals:
    21   void newMessage(QByteArray msg, bool showOnScreen);
    22 
    23  public slots:
    24   void slotNewEphGPS(gpsephemeris gpseph);
    25   void slotNewEphGlonass(glonassephemeris gloeph);
    26   void slotNewEphGalileo(galileoephemeris galeph);
    27   void slotNewCorrections(QStringList corrList);
    28   void slotNewObs(QByteArray staID, QList<t_obs> obsList);
    29 
    30  private:
    31   class t_epoData {
    32    public:
    33     t_epoData() {}
    34     ~t_epoData() {
    35       for (unsigned ii = 0; ii < _satObs.size(); ii++) {
    36         delete _satObs[ii];
    37       }
    38     }
    39     bncTime                _time;
    40     std::vector<t_satObs*> _satObs;
    41   };
    42 
    43   QMutex                 _mutex;
    44   const t_pppOptions*    _opt;
    45   t_pppClient*           _pppClient;
    46   std::deque<t_epoData*> _epoData;
    47   int                    _lastOrbCorrIOD[t_prn::MAXPRN+1];
    48   double                 _lastClkCorrValue[t_prn::MAXPRN+1];
    49   bncTime                _lastClkCorrTime;
    50 };
    5114
    5215class t_pppThread : public QThread {
     
    6225 private:
    6326  const t_pppOptions* _opt;
    64   t_pppRun*           _pppRun;
     27  t_pppRunRealTime*   _pppRunRealTime;
    6528};
    6629
  • trunk/BNC/src/bncwindow.cpp

    r5815 r5860  
    20842084  if (iRet == QMessageBox::Yes) {
    20852085    if (_pppMain) {
    2086       _pppMain->stop();
     2086      _pppMain->slotStop();
    20872087    }
    20882088    BNC_CORE->stopCombination();
     
    21152115
    21162116  if (_pppMain) {
    2117     _pppMain->stop();
     2117    _pppMain->slotStop();
    21182118  }
    21192119
  • trunk/BNC/src/src.pri

    r5852 r5860  
    4444          bncnetqueryudp0.h bncudpport.h bnctime.h pppopt.h           \
    4545          bncserialport.h bncnetquerys.h bncfigure.h                  \
    46           bncfigurelate.h bncpppclient.h bncversion.h                 \
    47           bancroft.h bncmodel.h bncfigureppp.h bncrawfile.h           \
    48           bncmap.h bncantex.h                              \
     46          bncfigurelate.h bncversion.h                                \
     47          bancroft.h bncfigureppp.h bncrawfile.h                      \
     48          bncmap.h bncantex.h                                         \
    4949          bncephuser.h bncoutf.h bncclockrinex.h bncsp3.h             \
    5050          bncbytescounter.h bncsslconfig.h reqcdlg.h                  \
     
    6262          PPP/pppObsPool.h   PPP/pppStation.h   PPP/pppFilter.h       \
    6363          PPP/pppEphPool.h   PPP/pppModel.h     PPP/pppParlist.h      \
    64           PPP/pppSatObs.h
     64          PPP/pppSatObs.h    PPP/pppRunRealTime.h
    6565
    6666HEADERS       += serial/qextserialbase.h serial/qextserialport.h
     
    7676          bncnetqueryudp0.cpp bncudpport.cpp pppopt.cpp               \
    7777          bncserialport.cpp bncnetquerys.cpp bncfigure.cpp            \
    78           bncfigurelate.cpp bncpppclient.cpp bnctime.cpp              \
    79           bancroft.cpp bncmodel.cpp bncfigureppp.cpp bncrawfile.cpp   \
    80           bncmap_svg.cpp bncantex.cpp                    \
     78          bncfigurelate.cpp bnctime.cpp                               \
     79          bancroft.cpp bncfigureppp.cpp bncrawfile.cpp                \
     80          bncmap_svg.cpp bncantex.cpp                                 \
    8181          bncephuser.cpp bncoutf.cpp bncclockrinex.cpp bncsp3.cpp     \
    8282          bncbytescounter.cpp bncsslconfig.cpp reqcdlg.cpp            \
     
    9494          PPP/pppObsPool.cpp PPP/pppStation.cpp PPP/pppFilter.cpp     \
    9595          PPP/pppEphPool.cpp PPP/pppModel.cpp   PPP/pppParlist.cpp    \
    96           PPP/pppSatObs.cpp
     96          PPP/pppSatObs.cpp  PPP/pppRunRealTime.cpp
    9797
    9898SOURCES       += serial/qextserialbase.cpp serial/qextserialport.cpp
     
    112112exists(rinex/bncpostprocess.h) {
    113113  DEFINES += USE_POSTPROCESSING
    114   HEADERS += rinex/bncpostprocess.h   rinex/rnxobsfile.h   \
     114  HEADERS += rinex/rnxobsfile.h                            \
    115115             rinex/rnxnavfile.h       rinex/corrfile.h     \
    116116             rinex/reqcedit.h         rinex/reqcanalyze.h  \
     
    118118             rinex/availplot.h        rinex/eleplot.h      \
    119119             rinex/dopplot.h
    120   SOURCES += rinex/bncpostprocess.cpp rinex/rnxobsfile.cpp  \
     120  SOURCES += rinex/rnxobsfile.cpp                           \
    121121             rinex/rnxnavfile.cpp     rinex/corrfile.cpp    \
    122122             rinex/reqcedit.cpp       rinex/reqcanalyze.cpp \
Note: See TracChangeset for help on using the changeset viewer.