Changeset 533 in ntrip


Ignore:
Timestamp:
Oct 20, 2007, 2:32:15 PM (17 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNC
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncapp.cpp

    r532 r533  
    4949using namespace std;
    5050
    51 const int RINEX_3 = 1;
    52 
    5351struct converttimeinfo {
    5452  int second;    /* seconds of GPS time [0..59] */
     
    7270  QApplication(argc, argv, GUIenabled) {
    7371
     72  _bncVersion  = "BNC 1.4";
     73
    7474  _logFileFlag = 0;
    7575  _logFile     = 0;
    7676  _logStream   = 0;
    7777
    78   _bncVersion  = "BNC 1.4";
    79 
    8078  // Lists of Ephemeris
    8179  // ------------------
    82   _ephFile     = 0;
    83   _ephStream   = 0;
    8480  for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
    8581    _gpsEph[ii-PRN_GPS_START] = 0;
     
    8985  }
    9086
    91   // Eph file
    92   // --------
    93   _ephFile   = 0;
    94   _ephStream = 0;
    95   QString ephFileName = "TEST.EPH";
    96   ////  QString ephFileName = settings.value("ephFile").toString();
    97   if ( !ephFileName.isEmpty() ) {
    98     expandEnvVar(ephFileName);
    99     _ephFile = new QFile(ephFileName);
    100     _ephFile->open(QIODevice::WriteOnly);
    101     _ephStream = new QTextStream();
    102     _ephStream->setDevice(_ephFile);
    103     printEphHeader();
    104   }
     87  // Eph file(s)
     88  // -----------
     89  _rinex3 = -1;
     90  _ephFileGPS       = 0;
     91  _ephStreamGPS     = 0;
     92  _ephFileGlonass   = 0;
     93  _ephStreamGlonass = 0;
    10594}
    10695
     
    11099  delete _logStream;
    111100  delete _logFile;
    112   delete _ephStream;
    113   delete _ephFile;
     101  delete _ephStreamGPS;
     102  delete _ephFileGPS;
     103  if (_rinex3 == 0) {
     104    delete _ephStreamGlonass;
     105    delete _ephFileGlonass;
     106  }
    114107  for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
    115108    delete _gpsEph[ii-PRN_GPS_START];
     
    160153  QMutexLocker locker(&_mutex);
    161154
    162   if (!_ephStream) {
     155  if (!_ephStreamGPS) {
    163156    delete gpseph;
    164157    return;
     
    182175  QMutexLocker locker(&_mutex);
    183176
    184   if (!_ephStream) {
     177  if (!_ephStreamGlonass) {
    185178    delete glonasseph;
    186179    return;
     
    203196////////////////////////////////////////////////////////////////////////////
    204197void bncApp::printEphHeader() {
    205   if (_ephStream) {
    206     QString line;
    207 
    208     line.sprintf(
    209           "%9.2f%11sN: GNSS NAV DATA    M: Mixed%12sRINEX VERSION / TYPE\n",
    210           3.0, "", "");
    211     *_ephStream << line;
    212 
    213     char buffer[100];
    214     HandleRunBy(buffer, sizeof(buffer), 0, RINEX_3);
    215     line.sprintf("%s\n%60sEND OF HEADER\n", buffer, "");
    216     *_ephStream << line;
    217 
    218     _ephStream->flush();
     198
     199  if (_rinex3 == -1) {
     200    QSettings settings;
     201
     202    if ( Qt::CheckState(settings.value("ephV3").toInt()) == Qt::Checked) {
     203      _rinex3 = 1;   
     204    }
     205    else {
     206      _rinex3 = 0;
     207    }
     208
     209    _ephPath = settings.value("ephPath").toString();
     210
     211    if ( !_ephPath.isEmpty() ) {
     212      if ( _ephPath[_ephPath.length()-1] != QDir::separator() ) {
     213        _ephPath += QDir::separator();
     214      }
     215      expandEnvVar(_ephPath);
     216    }
     217  }
     218
     219  if (!_ephPath.isEmpty()) {
     220
     221    QDate date = QDate::currentDate();
     222
     223    QString ephFileNameGPS = _ephPath + "GPS_" +
     224          QString("%1").arg(date.dayOfYear(), 3, 10, QChar('0')) +
     225                            date.toString("0.yyN");
     226
     227    cout << ephFileNameGPS.toAscii().data() << endl;
     228
     229    if (_ephFileNameGPS == ephFileNameGPS) {
     230      return;
     231    }
     232    else {
     233      _ephFileNameGPS = ephFileNameGPS;
     234    }
     235
     236    delete _ephStreamGPS;
     237    delete _ephFileGPS;
     238
     239    _ephFileGPS = new QFile(ephFileNameGPS);
     240    _ephFileGPS->open(QIODevice::WriteOnly);
     241    _ephStreamGPS = new QTextStream();
     242    _ephStreamGPS->setDevice(_ephFileGPS);
     243
     244    if      (_rinex3 == 1) {
     245      _ephFileGlonass   = _ephFileGPS;
     246      _ephStreamGlonass = _ephStreamGPS;
     247    }
     248    else if (_rinex3 == 0) {
     249      QString ephFileNameGlonass = _ephPath + "GLO_" +
     250          QString("%1").arg(date.dayOfYear(), 3, 10, QChar('0')) +
     251                            date.toString("0.yyN");
     252
     253      cout << ephFileNameGlonass.toAscii().data() << endl;
     254
     255      delete _ephStreamGlonass;
     256      delete _ephFileGlonass;
     257
     258      _ephFileGlonass = new QFile(ephFileNameGlonass);
     259      _ephFileGlonass->open(QIODevice::WriteOnly);
     260      _ephStreamGlonass = new QTextStream();
     261      _ephStreamGlonass->setDevice(_ephFileGlonass);
     262
     263    }
     264
     265
     266    if (_rinex3 == 1) {
     267      QString line;
     268
     269      line.sprintf(
     270            "%9.2f%11sN: GNSS NAV DATA    M: Mixed%12sRINEX VERSION / TYPE\n",
     271            3.0, "", "");
     272      *_ephStreamGPS << line;
     273
     274      char buffer[100];
     275      HandleRunBy(buffer, sizeof(buffer), 0, _rinex3);
     276      line.sprintf("%s\n%60sEND OF HEADER\n", buffer, "");
     277      *_ephStreamGPS << line;
     278
     279      _ephStreamGPS->flush();
     280    }
     281    else if (_rinex3 == 0) {
     282
     283    }
    219284  }
    220285}
     
    225290void bncApp::printGPSEph(gpsephemeris* ep) {
    226291
    227   if (_ephStream) {
     292  printEphHeader();
     293
     294  if (_ephStreamGPS) {
    228295
    229296    QString line;
     
    232299    converttime(&cti, ep->GPSweek, ep->TOC);
    233300
    234     if (RINEX_3) {
     301    if      (_rinex3 == 1) {
    235302      line.sprintf("G%02d %04d %02d %02d %02d %02d %02d%19.12e%19.12e%19.12e",
    236303                   ep->satellite, cti.year, cti.month, cti.day, cti.hour,
     
    238305                   ep->clock_driftrate);
    239306    }
    240     else {
     307    else if (_rinex3 == 0) {
    241308      line.sprintf("%02d %02d %02d %02d %02d %02d%05.1f%19.12e%19.12e%19.12e",
    242309                   ep->satellite, cti.year%100, cti.month, cti.day, cti.hour,
     
    244311                   ep->clock_drift, ep->clock_driftrate);
    245312    }
    246     *_ephStream << line << endl;
     313    *_ephStreamGPS << line << endl;
    247314
    248315    line.sprintf("   %19.12e%19.12e%19.12e%19.12e", (double)ep->IODE,
    249316                 ep->Crs, ep->Delta_n, ep->M0);
    250     *_ephStream << line << endl;
     317    *_ephStreamGPS << line << endl;
    251318   
    252319    line.sprintf("   %19.12e%19.12e%19.12e%19.12e", ep->Cuc,
    253320                 ep->e, ep->Cus, ep->sqrt_A);
    254     *_ephStream << line << endl;
     321    *_ephStreamGPS << line << endl;
    255322
    256323    line.sprintf("   %19.12e%19.12e%19.12e%19.12e",
    257324                 (double) ep->TOE, ep->Cic, ep->OMEGA0, ep->Cis);
    258     *_ephStream << line << endl;
     325    *_ephStreamGPS << line << endl;
    259326   
    260327    line.sprintf("   %19.12e%19.12e%19.12e%19.12e", ep->i0,
    261328                 ep->Crc, ep->omega, ep->OMEGADOT);
    262     *_ephStream << line << endl;
     329    *_ephStreamGPS << line << endl;
    263330
    264331    double dd = 0;
     
    270337    line.sprintf("   %19.12e%19.12e%19.12e%19.12e", ep->IDOT, dd,
    271338                 (double) ep->GPSweek, ii & GPSEPHF_L2PCODEDATA ? 1.0 : 0.0);
    272     *_ephStream << line << endl;
     339    *_ephStreamGPS << line << endl;
    273340
    274341    if(ep->URAindex <= 6) /* URA index */
     
    278345    line.sprintf("   %19.12e%19.12e%19.12e%19.12e", dd,
    279346                 ((double) ep->SVhealth), ep->TGD, ((double) ep->IODC));
    280     *_ephStream << line << endl;
     347    *_ephStreamGPS << line << endl;
    281348
    282349    line.sprintf("   %19.12e%19.12e", ((double)ep->TOW), 0.0);
    283     *_ephStream << line << endl;
    284 
    285     _ephStream->flush();
     350    *_ephStreamGPS << line << endl;
     351
     352    _ephStreamGPS->flush();
    286353  }
    287354}
     
    291358void bncApp::printGlonassEph(glonassephemeris* ep) {
    292359
    293   if (_ephStream) {
     360  printEphHeader();
     361
     362  if (_ephStreamGlonass) {
    294363    int ww  = ep->GPSWeek;
    295364    int tow = ep->GPSTOW;
     
    306375    QString line;
    307376
    308     if (RINEX_3) {
     377    if      (_rinex3 == 1) {
    309378      line.sprintf("R%02d %04d %02d %02d %02d %02d %02d%19.12e%19.12e%19.12e",
    310379                   ep->almanac_number, cti.year, cti.month, cti.day, cti.hour,
    311380                   cti.minute, cti.second, -ep->tau, ep->gamma, (double) ii);
    312381    }
    313     else {
     382    else if (_rinex3 == 0) {
    314383      line.sprintf("%02d %02d %02d %02d %02d %02d%5.1f%19.12e%19.12e%19.12e",
    315384                   ep->almanac_number, cti.year%100, cti.month, cti.day,
     
    317386                   ep->gamma, (double) ii);
    318387    }
    319     *_ephStream << line << endl;
     388    *_ephStreamGlonass << line << endl;
    320389   
    321390    line.sprintf("   %19.12e%19.12e%19.12e%19.12e", ep->x_pos,
    322391                 ep->x_velocity, ep->x_acceleration,
    323392                 (ep->flags & GLOEPHF_UNHEALTHY) ? 1.0 : 0.0);
    324     *_ephStream << line << endl;
     393    *_ephStreamGlonass << line << endl;
    325394     
    326395    line.sprintf("   %19.12e%19.12e%19.12e%19.12e", ep->y_pos,
    327396                 ep->y_velocity, ep->y_acceleration,
    328397                 (double) ep->frequency_number);
    329     *_ephStream << line << endl;
     398    *_ephStreamGlonass << line << endl;
    330399   
    331400    line.sprintf("   %19.12e%19.12e%19.12e%19.12e", ep->z_pos,
    332401                 ep->z_velocity, ep->z_acceleration, (double) ep->E);
    333     *_ephStream << line << endl;
    334 
    335     _ephStream->flush();
    336   }
    337 }
     402    *_ephStreamGlonass << line << endl;
     403
     404    _ephStreamGlonass->flush();
     405  }
     406}
  • trunk/BNC/bncapp.h

    r516 r533  
    5353    QString           _bncVersion;
    5454    QMutex            _mutex;
    55     QFile*            _ephFile;
    56     QTextStream*      _ephStream;
     55    QString           _ephPath;
     56    QString           _ephFileNameGPS;
     57    int               _rinex3;
     58    QFile*            _ephFileGPS;
     59    QTextStream*      _ephStreamGPS;
     60    QFile*            _ephFileGlonass;
     61    QTextStream*      _ephStreamGlonass;
    5762    gpsephemeris*     _gpsEph[PRN_GPS_END - PRN_GPS_START + 1];
    5863    glonassephemeris* _glonassEph[PRN_GLONASS_END - PRN_GLONASS_START + 1];
  • trunk/BNC/bncmain.cpp

    r464 r533  
    6161  }
    6262
    63   bncApp app(argc, argv, GUIenabled);
    64 
    6563  QCoreApplication::setOrganizationName("BKG");
    6664  QCoreApplication::setOrganizationDomain("www.ifag.de");
     
    7775    settings.setValue("waitTime",   2);
    7876  }
     77
     78  bncApp app(argc, argv, GUIenabled);
    7979
    8080  // Interactive Mode - open the main window
  • trunk/BNC/bncwindow.cpp

    r476 r533  
    150150  _outPortLineEdit->setWhatsThis(tr("<p>BNC makes synchronized observations available in a binary format on your local host (IP 127.0.0.1) through an IP port. Enter an IP port number to activate this function.</p><p>Default is an empty option field, meaning that no binary output is generated.</p>"));
    151151  _rnxPathLineEdit    = new QLineEdit(settings.value("rnxPath").toString());
    152 _rnxPathLineEdit->setWhatsThis(tr("<p>Observations can be converted to RINEX Version 2.11. Enter a path for saving the RINEX files in a directory. If this directory does not exist, BNC will not create RINEX files.</p><p>Default value for 'RINEX directory' is an empty option field, meaning that streams are not converted to RINEX.</p>"));
     152  _rnxPathLineEdit->setWhatsThis(tr("<p>Observations can be converted to RINEX Version 2.11. Enter a path for saving the RINEX files in a directory. If this directory does not exist, BNC will not create RINEX files.</p><p>Default value for 'RINEX directory' is an empty option field, meaning that streams are not converted to RINEX.</p>"));
     153  _ephPathLineEdit    = new QLineEdit(settings.value("ephPath").toString());
     154  _ephPathLineEdit->setWhatsThis(tr("<p>Navigation messages can be converted to RINEX files. Enter a path for saving the files in a directory.</p>"));
     155  _rnxV3CheckBox = new QCheckBox();
     156  _rnxV3CheckBox->setCheckState(Qt::CheckState(settings.value("rnxV3").toInt()));
     157  _ephV3CheckBox = new QCheckBox();
     158  _ephV3CheckBox->setCheckState(Qt::CheckState(settings.value("ephV3").toInt()));
    153159  _rnxScrpLineEdit    = new QLineEdit(settings.value("rnxScript").toString());
    154 _rnxScrpLineEdit->setWhatsThis(tr("<p>Whenever a RINEX file is saved, you may like to compress, copy or upload it immediately via FTP. For that you enter the full path of a script or batch file which is then called to carry out these operations. The full RINEX file path will be passed to the script as a command line parameter (%1 on Windows systems, $1 on Unix/Linux systems).</p><p>The triggering event for calling the script or batch file is the end of the 'RINEX file interval'. If that is superposed by a stream outage, the triggering event is the stream reconnect.</p><p>Default value for 'RINEX script' is an empty option field, meaning that no script or batch file shall be called."));
     160  _rnxScrpLineEdit->setWhatsThis(tr("<p>Whenever a RINEX file is saved, you may like to compress, copy or upload it immediately via FTP. For that you enter the full path of a script or batch file which is then called to carry out these operations. The full RINEX file path will be passed to the script as a command line parameter (%1 on Windows systems, $1 on Unix/Linux systems).</p><p>The triggering event for calling the script or batch file is the end of the 'RINEX file interval'. If that is superposed by a stream outage, the triggering event is the stream reconnect.</p><p>Default value for 'RINEX script' is an empty option field, meaning that no script or batch file shall be called."));
    155161  _rnxSkelLineEdit    = new QLineEdit(settings.value("rnxSkel").toString());
    156162  _rnxSkelLineEdit->setMaximumWidth(5*ww);
     
    272278
    273279  layout->addWidget(new QLabel("RINEX directory"),               4, 0, 1, 2);
    274   layout->addWidget(_rnxPathLineEdit,                            4, 2, 1, 3);
     280  layout->addWidget(_rnxPathLineEdit,                            4, 2);
     281
     282  layout->addWidget(new QLabel("RINEX v3"),                      4, 3, 1, 2);
     283  layout->addWidget(_rnxV3CheckBox,                              4, 4);
    275284
    276285  layout->addWidget(new QLabel("RINEX script (full path)"),      5, 0, 1, 2);
     
    288297  layout->addWidget(_rnxAppendCheckBox,                          7, 4);
    289298
    290   layout->addWidget(new QLabel("Mountpoints"),                   8, 0, 1, 2);
    291 
    292   layout->addWidget(_mountPointsTable,                           9, 0, 1, 5);
    293 
    294   layout->addWidget(new QLabel("Log (full path)"),              10, 0, 1, 2);
    295   layout->addWidget(_logFileLineEdit,                           10, 2, 1, 3);
    296   layout->addWidget(_log,                                       11, 0, 1, 5);
     299  layout->addWidget(new QLabel("Ephemeris directory"),           8, 0, 1, 2);
     300  layout->addWidget(_ephPathLineEdit,                            8, 2);
     301
     302  layout->addWidget(new QLabel("RINEX v3"),                      8, 3, 1, 2);
     303  layout->addWidget(_ephV3CheckBox,                              8, 4);
     304
     305  layout->addWidget(new QLabel("Mountpoints"),                   9, 0, 1, 2);
     306
     307  layout->addWidget(_mountPointsTable,                          10, 0, 1, 5);
     308
     309  layout->addWidget(new QLabel("Log (full path)"),              11, 0, 1, 2);
     310  layout->addWidget(_logFileLineEdit,                           11, 2, 1, 3);
     311  layout->addWidget(_log,                                       12, 0, 1, 5);
    297312}
    298313
     
    423438  settings.setValue("outPort",     _outPortLineEdit->text());
    424439  settings.setValue("rnxPath",     _rnxPathLineEdit->text());
     440  settings.setValue("ephPath",     _ephPathLineEdit->text());
    425441  settings.setValue("rnxScript",   _rnxScrpLineEdit->text());
    426442  settings.setValue("rnxIntr",     _rnxIntrComboBox->currentText());
     
    428444  settings.setValue("rnxSkel",     _rnxSkelLineEdit->text());
    429445  settings.setValue("rnxAppend",   _rnxAppendCheckBox->checkState());
     446  settings.setValue("rnxV3",       _rnxV3CheckBox->checkState());
     447  settings.setValue("ephV3",       _ephV3CheckBox->checkState());
    430448  settings.setValue("logFile",     _logFileLineEdit->text());
    431449 
  • trunk/BNC/bncwindow.h

    r464 r533  
    8080    QLineEdit* _outPortLineEdit;
    8181    QLineEdit* _rnxPathLineEdit;
     82    QLineEdit* _ephPathLineEdit;
     83    QCheckBox* _rnxV3CheckBox;
     84    QCheckBox* _ephV3CheckBox;
    8285    QLineEdit* _rnxSkelLineEdit;
    8386    QLineEdit* _rnxScrpLineEdit;
Note: See TracChangeset for help on using the changeset viewer.