- Timestamp:
- Oct 20, 2007, 2:32:15 PM (17 years ago)
- Location:
- trunk/BNC
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncapp.cpp
r532 r533 49 49 using namespace std; 50 50 51 const int RINEX_3 = 1;52 53 51 struct converttimeinfo { 54 52 int second; /* seconds of GPS time [0..59] */ … … 72 70 QApplication(argc, argv, GUIenabled) { 73 71 72 _bncVersion = "BNC 1.4"; 73 74 74 _logFileFlag = 0; 75 75 _logFile = 0; 76 76 _logStream = 0; 77 77 78 _bncVersion = "BNC 1.4";79 80 78 // Lists of Ephemeris 81 79 // ------------------ 82 _ephFile = 0;83 _ephStream = 0;84 80 for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) { 85 81 _gpsEph[ii-PRN_GPS_START] = 0; … … 89 85 } 90 86 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; 105 94 } 106 95 … … 110 99 delete _logStream; 111 100 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 } 114 107 for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) { 115 108 delete _gpsEph[ii-PRN_GPS_START]; … … 160 153 QMutexLocker locker(&_mutex); 161 154 162 if (!_ephStream ) {155 if (!_ephStreamGPS) { 163 156 delete gpseph; 164 157 return; … … 182 175 QMutexLocker locker(&_mutex); 183 176 184 if (!_ephStream ) {177 if (!_ephStreamGlonass) { 185 178 delete glonasseph; 186 179 return; … … 203 196 //////////////////////////////////////////////////////////////////////////// 204 197 void 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 } 219 284 } 220 285 } … … 225 290 void bncApp::printGPSEph(gpsephemeris* ep) { 226 291 227 if (_ephStream) { 292 printEphHeader(); 293 294 if (_ephStreamGPS) { 228 295 229 296 QString line; … … 232 299 converttime(&cti, ep->GPSweek, ep->TOC); 233 300 234 if (RINEX_3) {301 if (_rinex3 == 1) { 235 302 line.sprintf("G%02d %04d %02d %02d %02d %02d %02d%19.12e%19.12e%19.12e", 236 303 ep->satellite, cti.year, cti.month, cti.day, cti.hour, … … 238 305 ep->clock_driftrate); 239 306 } 240 else {307 else if (_rinex3 == 0) { 241 308 line.sprintf("%02d %02d %02d %02d %02d %02d%05.1f%19.12e%19.12e%19.12e", 242 309 ep->satellite, cti.year%100, cti.month, cti.day, cti.hour, … … 244 311 ep->clock_drift, ep->clock_driftrate); 245 312 } 246 *_ephStream << line << endl;313 *_ephStreamGPS << line << endl; 247 314 248 315 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", (double)ep->IODE, 249 316 ep->Crs, ep->Delta_n, ep->M0); 250 *_ephStream << line << endl;317 *_ephStreamGPS << line << endl; 251 318 252 319 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->Cuc, 253 320 ep->e, ep->Cus, ep->sqrt_A); 254 *_ephStream << line << endl;321 *_ephStreamGPS << line << endl; 255 322 256 323 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", 257 324 (double) ep->TOE, ep->Cic, ep->OMEGA0, ep->Cis); 258 *_ephStream << line << endl;325 *_ephStreamGPS << line << endl; 259 326 260 327 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->i0, 261 328 ep->Crc, ep->omega, ep->OMEGADOT); 262 *_ephStream << line << endl;329 *_ephStreamGPS << line << endl; 263 330 264 331 double dd = 0; … … 270 337 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->IDOT, dd, 271 338 (double) ep->GPSweek, ii & GPSEPHF_L2PCODEDATA ? 1.0 : 0.0); 272 *_ephStream << line << endl;339 *_ephStreamGPS << line << endl; 273 340 274 341 if(ep->URAindex <= 6) /* URA index */ … … 278 345 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", dd, 279 346 ((double) ep->SVhealth), ep->TGD, ((double) ep->IODC)); 280 *_ephStream << line << endl;347 *_ephStreamGPS << line << endl; 281 348 282 349 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(); 286 353 } 287 354 } … … 291 358 void bncApp::printGlonassEph(glonassephemeris* ep) { 292 359 293 if (_ephStream) { 360 printEphHeader(); 361 362 if (_ephStreamGlonass) { 294 363 int ww = ep->GPSWeek; 295 364 int tow = ep->GPSTOW; … … 306 375 QString line; 307 376 308 if (RINEX_3) {377 if (_rinex3 == 1) { 309 378 line.sprintf("R%02d %04d %02d %02d %02d %02d %02d%19.12e%19.12e%19.12e", 310 379 ep->almanac_number, cti.year, cti.month, cti.day, cti.hour, 311 380 cti.minute, cti.second, -ep->tau, ep->gamma, (double) ii); 312 381 } 313 else {382 else if (_rinex3 == 0) { 314 383 line.sprintf("%02d %02d %02d %02d %02d %02d%5.1f%19.12e%19.12e%19.12e", 315 384 ep->almanac_number, cti.year%100, cti.month, cti.day, … … 317 386 ep->gamma, (double) ii); 318 387 } 319 *_ephStream << line << endl;388 *_ephStreamGlonass << line << endl; 320 389 321 390 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->x_pos, 322 391 ep->x_velocity, ep->x_acceleration, 323 392 (ep->flags & GLOEPHF_UNHEALTHY) ? 1.0 : 0.0); 324 *_ephStream << line << endl;393 *_ephStreamGlonass << line << endl; 325 394 326 395 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->y_pos, 327 396 ep->y_velocity, ep->y_acceleration, 328 397 (double) ep->frequency_number); 329 *_ephStream << line << endl;398 *_ephStreamGlonass << line << endl; 330 399 331 400 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->z_pos, 332 401 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 53 53 QString _bncVersion; 54 54 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; 57 62 gpsephemeris* _gpsEph[PRN_GPS_END - PRN_GPS_START + 1]; 58 63 glonassephemeris* _glonassEph[PRN_GLONASS_END - PRN_GLONASS_START + 1]; -
trunk/BNC/bncmain.cpp
r464 r533 61 61 } 62 62 63 bncApp app(argc, argv, GUIenabled);64 65 63 QCoreApplication::setOrganizationName("BKG"); 66 64 QCoreApplication::setOrganizationDomain("www.ifag.de"); … … 77 75 settings.setValue("waitTime", 2); 78 76 } 77 78 bncApp app(argc, argv, GUIenabled); 79 79 80 80 // Interactive Mode - open the main window -
trunk/BNC/bncwindow.cpp
r476 r533 150 150 _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>")); 151 151 _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())); 153 159 _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.")); 155 161 _rnxSkelLineEdit = new QLineEdit(settings.value("rnxSkel").toString()); 156 162 _rnxSkelLineEdit->setMaximumWidth(5*ww); … … 272 278 273 279 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); 275 284 276 285 layout->addWidget(new QLabel("RINEX script (full path)"), 5, 0, 1, 2); … … 288 297 layout->addWidget(_rnxAppendCheckBox, 7, 4); 289 298 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); 297 312 } 298 313 … … 423 438 settings.setValue("outPort", _outPortLineEdit->text()); 424 439 settings.setValue("rnxPath", _rnxPathLineEdit->text()); 440 settings.setValue("ephPath", _ephPathLineEdit->text()); 425 441 settings.setValue("rnxScript", _rnxScrpLineEdit->text()); 426 442 settings.setValue("rnxIntr", _rnxIntrComboBox->currentText()); … … 428 444 settings.setValue("rnxSkel", _rnxSkelLineEdit->text()); 429 445 settings.setValue("rnxAppend", _rnxAppendCheckBox->checkState()); 446 settings.setValue("rnxV3", _rnxV3CheckBox->checkState()); 447 settings.setValue("ephV3", _ephV3CheckBox->checkState()); 430 448 settings.setValue("logFile", _logFileLineEdit->text()); 431 449 -
trunk/BNC/bncwindow.h
r464 r533 80 80 QLineEdit* _outPortLineEdit; 81 81 QLineEdit* _rnxPathLineEdit; 82 QLineEdit* _ephPathLineEdit; 83 QCheckBox* _rnxV3CheckBox; 84 QCheckBox* _ephV3CheckBox; 82 85 QLineEdit* _rnxSkelLineEdit; 83 86 QLineEdit* _rnxScrpLineEdit;
Note:
See TracChangeset
for help on using the changeset viewer.