Changeset 7574 in ntrip


Ignore:
Timestamp:
Nov 23, 2015, 5:46:50 PM (8 years ago)
Author:
stuerze
Message:

minor changes to prevent a crash

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/BNC_2.11.0/src/bnccore.cpp

    r5577 r7574  
    3535 * Created:    29-Aug-2006
    3636 *
    37  * Changes:   
     37 * Changes:
    3838 *
    3939 * -----------------------------------------------------------------------*/
     
    4343#include <cmath>
    4444
    45 #include "bnccore.h" 
    46 #include "bncutils.h" 
    47 #include "bncrinex.h" 
    48 #include "bncsettings.h" 
    49 #include "bncversion.h" 
    50 #include "RTCM3/ephemeris.h" 
    51 #include "rinex/rnxobsfile.h" 
    52 #include "rinex/rnxnavfile.h" 
     45#include "bnccore.h"
     46#include "bncutils.h"
     47#include "bncrinex.h"
     48#include "bncsettings.h"
     49#include "bncversion.h"
     50#include "RTCM3/ephemeris.h"
     51#include "rinex/rnxobsfile.h"
     52#include "rinex/rnxnavfile.h"
    5353
    5454#ifdef USE_COMBINATION
    55 #include "combination/bnccomb.h" 
     55#include "combination/bnccomb.h"
    5656#endif
    5757
    5858using namespace std;
    5959
    60 // Singleton 
     60// Singleton
    6161////////////////////////////////////////////////////////////////////////////
    6262t_bncCore& bncCoreInstance() {
     
    191191    if ( !logFileName.isEmpty() ) {
    192192      expandEnvVar(logFileName);
    193       _logFile = new QFile(logFileName + "_" + 
     193      _logFile = new QFile(logFileName + "_" +
    194194                          currDate.toString("yyMMdd").toAscii().data());
    195195      _fileDate = currDate;
     
    218218}
    219219
    220 // New GPS Ephemeris 
     220// New GPS Ephemeris
    221221////////////////////////////////////////////////////////////////////////////
    222222void t_bncCore::slotNewGPSEph(gpsephemeris* gpseph) {
     
    231231  gpsephemeris** ee = &_gpsEph[gpseph->satellite-1];
    232232
    233   if ( *ee != 0 && 
     233  if ( *ee != 0 &&
    234234       gpseph->GPSweek == (*ee)->GPSweek && gpseph->TOC == (*ee)->TOC ) {
    235235    checkEphemeris(*ee, gpseph);
    236236  }
    237237
    238   if ( *ee == 0                         || 
     238  if ( *ee == 0                         ||
    239239       gpseph->GPSweek > (*ee)->GPSweek ||
    240240       (gpseph->GPSweek == (*ee)->GPSweek && gpseph->TOC > (*ee)->TOC) ) {
     
    248248  }
    249249}
    250    
     250
    251251// New Glonass Ephemeris
    252252////////////////////////////////////////////////////////////////////////////
     
    257257  // Check wrong Ephemerides
    258258  // -----------------------
    259   if (glonasseph->x_pos == 0.0 && 
    260       glonasseph->y_pos == 0.0 && 
     259  if (glonasseph->x_pos == 0.0 &&
     260      glonasseph->y_pos == 0.0 &&
    261261      glonasseph->z_pos == 0.0) {
    262262    delete glonasseph;
    263263    return;
    264   } 
     264  }
    265265
    266266  glonassephemeris copy_glonasseph = *glonasseph;
     
    274274  if (*ee != 0) {
    275275    wwOld  = (*ee)->GPSWeek;
    276     towOld = (*ee)->GPSTOW; 
     276    towOld = (*ee)->GPSTOW;
    277277    updatetime(&wwOld, &towOld, (*ee)->tb*1000, 0);  // Moscow -> GPS
    278278
    279279    wwNew  = glonasseph->GPSWeek;
    280     towNew = glonasseph->GPSTOW; 
     280    towNew = glonasseph->GPSTOW;
    281281    updatetime(&wwNew, &towNew, glonasseph->tb*1000, 0); // Moscow -> GPS
    282282  }
    283283
    284   if ( *ee == 0      || 
     284  if ( *ee == 0      ||
    285285       wwNew > wwOld ||
    286286       (wwNew == wwOld && towNew > towOld) ) {
     
    312312  if (galIndex < 0 || galIndex > PRN_GALILEO_END - PRN_GALILEO_START) {
    313313    emit( newMessage("Wrong Galileo Satellite Number", true) );
    314     exit(1);
     314    delete galileoeph;
     315    return;
    315316  }
    316317
    317318  galileoephemeris** ee = &_galileoEph[galIndex];
    318319
    319   if ( *ee == 0                       || 
     320  if ( *ee == 0                       ||
    320321       galileoeph->Week > (*ee)->Week ||
    321322       (galileoeph->Week == (*ee)->Week && galileoeph->TOC > (*ee)->TOC) ) {
     
    341342
    342343    if ( Qt::CheckState(settings.value("ephV3").toInt()) == Qt::Checked) {
    343       _rinexVers = 3;   
     344      _rinexVers = 3;
    344345    }
    345346    else {
     
    363364    QDateTime datTim = currentDateAndTimeGPS();
    364365
    365     QString ephFileNameGPS = _ephPath + "BRDC" + 
     366    QString ephFileNameGPS = _ephPath + "BRDC" +
    366367               QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0'));
    367368
    368     QString hlpStr = bncRinex::nextEpochStr(datTim, 
     369    QString hlpStr = bncRinex::nextEpochStr(datTim,
    369370                         settings.value("ephIntr").toString());
    370371
     
    444445        QString line;
    445446        line.sprintf(
    446           "%9.2f%11sN: GNSS NAV DATA    M: Mixed%12sRINEX VERSION / TYPE\n", 
     447          "%9.2f%11sN: GNSS NAV DATA    M: Mixed%12sRINEX VERSION / TYPE\n",
    447448          3.0, "", "");
    448449        *_ephStreamGPS << line;
    449        
     450
    450451        QString hlp = currentDateAndTimeGPS().toString("yyyyMMdd hhmmss UTC").leftJustified(20, ' ', true);
    451         *_ephStreamGPS << _pgmName.toAscii().data() 
    452                        << _userName.toAscii().data() 
    453                        << hlp.toAscii().data() 
     452        *_ephStreamGPS << _pgmName.toAscii().data()
     453                       << _userName.toAscii().data()
     454                       << hlp.toAscii().data()
    454455                       << "PGM / RUN BY / DATE" << endl;
    455456
    456457        line.sprintf("%60sEND OF HEADER\n", "");
    457458        *_ephStreamGPS << line;
    458        
     459
    459460        _ephStreamGPS->flush();
    460461      }
     
    469470                     t_rnxNavFile::defaultRnxNavVersion2, "", "");
    470471        *_ephStreamGPS << line;
    471          
     472
    472473        QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
    473         *_ephStreamGPS << _pgmName.toAscii().data() 
    474                        << _userName.toAscii().data() 
    475                        << hlp.toAscii().data() 
     474        *_ephStreamGPS << _pgmName.toAscii().data()
     475                       << _userName.toAscii().data()
     476                       << hlp.toAscii().data()
    476477                       << "PGM / RUN BY / DATE" << endl;
    477478
     
    486487                     t_rnxNavFile::defaultRnxNavVersion2, "", "");
    487488        *_ephStreamGlonass << line;
    488        
     489
    489490        QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
    490         *_ephStreamGlonass << _pgmName.toAscii().data() 
    491                            << _userName.toAscii().data() 
    492                            << hlp.toAscii().data() 
     491        *_ephStreamGlonass << _pgmName.toAscii().data()
     492                           << _userName.toAscii().data()
     493                           << hlp.toAscii().data()
    493494                           << "PGM / RUN BY / DATE" << endl;
    494495
     
    627628}
    628629
    629 // 
     630//
    630631////////////////////////////////////////////////////////////////////////////
    631632void t_bncCore::slotQuit() {
     
    635636}
    636637
    637 // 
     638//
    638639////////////////////////////////////////////////////////////////////////////
    639640void t_bncCore::slotNewCorrLine(QString line, QString staID, bncTime coTime) {
     
    715716}
    716717
    717 // Dump List of Corrections 
     718// Dump List of Corrections
    718719////////////////////////////////////////////////////////////////////////////
    719720void t_bncCore::dumpCorrs(const QList<QString>& allCorrs) {
     
    723724    while (it.hasNext()) {
    724725      QString corrLine = it.next() + "\n";
    725    
     726
    726727      QMutableListIterator<QTcpSocket*> is(*_socketsCorr);
    727728      while (is.hasNext()) {
     
    742743}
    743744
    744 // 
     745//
    745746////////////////////////////////////////////////////////////////////////////
    746747void t_bncCore::setConfFileName(const QString& confFileName) {
    747748  if (confFileName.isEmpty()) {
    748     _confFileName = QDir::homePath() + QDir::separator() 
     749    _confFileName = QDir::homePath() + QDir::separator()
    749750                  + ".config" + QDir::separator()
    750751                  + qApp->organizationName() + QDir::separator()
     
    802803}
    803804
    804 // 
     805//
    805806////////////////////////////////////////////////////////////////////////////
    806807void t_bncCore::initCombination() {
     
    814815}
    815816
    816 // 
     817//
    817818////////////////////////////////////////////////////////////////////////////
    818819void t_bncCore::stopCombination() {
Note: See TracChangeset for help on using the changeset viewer.