- Timestamp:
- Aug 8, 2014, 10:02:53 AM (10 years ago)
- 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 57 57 ////////////////////////////////////////////////////////////////////////////// 58 58 t_pppMain::~t_pppMain() { 59 s top();59 slotStop(); 60 60 } 61 61 … … 81 81 catch (t_except exc) { 82 82 _running = true; 83 s top();83 slotStop(); 84 84 } 85 85 } … … 87 87 // 88 88 ////////////////////////////////////////////////////////////////////////////// 89 void t_pppMain::s top() {89 void t_pppMain::slotStop() { 90 90 if (!_running) { 91 91 return; -
trunk/BNC/src/PPP/pppMain.h
r5814 r5860 8 8 namespace BNC_PPP { 9 9 10 class t_pppMain {10 class t_pppMain : public QObject { 11 11 public: 12 12 t_pppMain(); 13 13 ~t_pppMain(); 14 14 void start(); 15 void stop(); 15 public slots: 16 void slotStop(); 16 17 17 18 private: -
trunk/BNC/src/PPP/pppThread.cpp
r5854 r5860 56 56 //////////////////////////////////////////////////////////////////////////// 57 57 t_pppThread::t_pppThread(const t_pppOptions* opt) : QThread(0) { 58 _opt = opt;59 _pppRun = 0;58 _opt = opt; 59 _pppRunRealTime = 0; 60 60 connect(this, SIGNAL(finished()), this, SLOT(deleteLater())); 61 61 … … 67 67 //////////////////////////////////////////////////////////////////////////// 68 68 t_pppThread::~t_pppThread() { 69 delete _pppRun ;69 delete _pppRunRealTime; 70 70 } 71 71 … … 74 74 void t_pppThread::run() { 75 75 try { 76 _pppRun = new t_pppRun(_opt);76 _pppRunRealTime = new t_pppRunRealTime(_opt); 77 77 QThread::exec(); 78 78 } 79 79 catch (t_except exc) { 80 _pppRun = 0;80 _pppRunRealTime = 0; 81 81 emit newMessage(QByteArray(exc.what().c_str()), true); 82 82 } 83 83 } 84 84 85 // Constructor86 ////////////////////////////////////////////////////////////////////////////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 // Destructor120 ////////////////////////////////////////////////////////////////////////////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 one171 // -----------------------------------------------------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 epoch189 // --------------------------------------------------------------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 epochs224 // ------------------------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 test235 cout << output._log << endl; cout.flush();236 //// end test237 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 9 9 #include "pppOptions.h" 10 10 #include "pppClient.h" 11 #include "pppRunRealTime.h" 11 12 12 13 namespace BNC_PPP { 13 14 class t_pppRun : public QObject {15 Q_OBJECT16 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 };51 14 52 15 class t_pppThread : public QThread { … … 62 25 private: 63 26 const t_pppOptions* _opt; 64 t_pppRun * _pppRun;27 t_pppRunRealTime* _pppRunRealTime; 65 28 }; 66 29 -
trunk/BNC/src/bncwindow.cpp
r5815 r5860 2084 2084 if (iRet == QMessageBox::Yes) { 2085 2085 if (_pppMain) { 2086 _pppMain->s top();2086 _pppMain->slotStop(); 2087 2087 } 2088 2088 BNC_CORE->stopCombination(); … … 2115 2115 2116 2116 if (_pppMain) { 2117 _pppMain->s top();2117 _pppMain->slotStop(); 2118 2118 } 2119 2119 -
trunk/BNC/src/src.pri
r5852 r5860 44 44 bncnetqueryudp0.h bncudpport.h bnctime.h pppopt.h \ 45 45 bncserialport.h bncnetquerys.h bncfigure.h \ 46 bncfigurelate.h bnc pppclient.h bncversion.h\47 bancroft.h bnc model.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 \ 49 49 bncephuser.h bncoutf.h bncclockrinex.h bncsp3.h \ 50 50 bncbytescounter.h bncsslconfig.h reqcdlg.h \ … … 62 62 PPP/pppObsPool.h PPP/pppStation.h PPP/pppFilter.h \ 63 63 PPP/pppEphPool.h PPP/pppModel.h PPP/pppParlist.h \ 64 PPP/pppSatObs.h 64 PPP/pppSatObs.h PPP/pppRunRealTime.h 65 65 66 66 HEADERS += serial/qextserialbase.h serial/qextserialport.h … … 76 76 bncnetqueryudp0.cpp bncudpport.cpp pppopt.cpp \ 77 77 bncserialport.cpp bncnetquerys.cpp bncfigure.cpp \ 78 bncfigurelate.cpp bnc pppclient.cpp bnctime.cpp\79 bancroft.cpp bnc model.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 \ 81 81 bncephuser.cpp bncoutf.cpp bncclockrinex.cpp bncsp3.cpp \ 82 82 bncbytescounter.cpp bncsslconfig.cpp reqcdlg.cpp \ … … 94 94 PPP/pppObsPool.cpp PPP/pppStation.cpp PPP/pppFilter.cpp \ 95 95 PPP/pppEphPool.cpp PPP/pppModel.cpp PPP/pppParlist.cpp \ 96 PPP/pppSatObs.cpp 96 PPP/pppSatObs.cpp PPP/pppRunRealTime.cpp 97 97 98 98 SOURCES += serial/qextserialbase.cpp serial/qextserialport.cpp … … 112 112 exists(rinex/bncpostprocess.h) { 113 113 DEFINES += USE_POSTPROCESSING 114 HEADERS += rinex/ bncpostprocess.h rinex/rnxobsfile.h\114 HEADERS += rinex/rnxobsfile.h \ 115 115 rinex/rnxnavfile.h rinex/corrfile.h \ 116 116 rinex/reqcedit.h rinex/reqcanalyze.h \ … … 118 118 rinex/availplot.h rinex/eleplot.h \ 119 119 rinex/dopplot.h 120 SOURCES += rinex/ bncpostprocess.cpp rinex/rnxobsfile.cpp\120 SOURCES += rinex/rnxobsfile.cpp \ 121 121 rinex/rnxnavfile.cpp rinex/corrfile.cpp \ 122 122 rinex/reqcedit.cpp rinex/reqcanalyze.cpp \
Note:
See TracChangeset
for help on using the changeset viewer.