Changeset 1065 in ntrip
- Timestamp:
- Aug 27, 2008, 12:09:31 PM (16 years ago)
- Location:
- trunk/BNS
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNS/bns.cpp
r1064 r1065 79 79 this, SLOT(slotMessage(const QByteArray))); 80 80 81 // Log File 82 // -------- 81 83 QIODevice::OpenMode oMode; 82 84 if (Qt::CheckState(settings.value("fileAppend").toInt()) == Qt::Checked) { … … 87 89 } 88 90 89 QString outFileName = settings.value("outFile").toString();90 if (outFileName.isEmpty()) {91 _outFile = 0;92 _outStream = 0;93 }94 else {95 _outFile = new QFile(outFileName);96 if (_outFile->open(oMode)) {97 _outStream = new QTextStream(_outFile);98 }99 }100 101 // Log File102 // --------103 91 QString logFileName = settings.value("logFile").toString(); 104 92 if (logFileName.isEmpty()) { … … 159 147 delete _clkSocket; 160 148 delete _caster; 161 delete _outStream;162 149 delete _logStream; 163 delete _outFile;164 150 delete _logFile; 165 151 QMapIterator<QString, t_ephPair*> it(_ephList); … … 357 343 } 358 344 if (sd) { 359 processSatellite(oldEph, ep, GPSweek, GPSweeks, prn, xx, sd); 345 QString outLine; 346 processSatellite(oldEph, ep, GPSweek, GPSweeks, prn, xx, 347 sd, outLine); 348 _caster->printAscii(line); 360 349 } 361 350 } 362 351 } 363 352 364 if ( (_caster->used() || _outFile) &&353 if ( _caster->used() && 365 354 (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) ) { 366 355 char obuffer[CLOCKORBIT_BUFFERSIZE]; … … 379 368 void t_bns::processSatellite(int oldEph, t_eph* ep, int GPSweek, double GPSweeks, 380 369 const QString& prn, const ColumnVector& xx, 381 struct ClockOrbit::SatData* sd) { 370 struct ClockOrbit::SatData* sd, 371 QString& outLine) { 382 372 383 373 ColumnVector xB(4); … … 407 397 } 408 398 409 if (_outStream) { 410 QString line; 411 char oldCh = (oldEph ? '!' : ' '); 412 line.sprintf("%c %d %.1f %s %3d %10.3f %8.3f %8.3f %8.3f\n", 413 oldCh, GPSweek, GPSweeks, ep->prn().toAscii().data(), 414 ep->IOD(), dClk, rsw(1), rsw(2), rsw(3)); 415 *_outStream << line; 416 _outStream->flush(); 417 } 399 char oldCh = (oldEph ? '!' : ' '); 400 outLine.sprintf("%c %d %.1f %s %3d %10.3f %8.3f %8.3f %8.3f\n", 401 oldCh, GPSweek, GPSweeks, ep->prn().toAscii().data(), 402 ep->IOD(), dClk, rsw(1), rsw(2), rsw(3)); 403 418 404 if (!oldEph) { 419 405 if (_rnx) { -
trunk/BNS/bns.h
r1062 r1065 61 61 void processSatellite(int oldEph, t_eph* ep, int GPSweek, double GPSweeks, 62 62 const QString& prn, const ColumnVector& xx, 63 struct ClockOrbit::SatData* sd );63 struct ClockOrbit::SatData* sd, QString& outLine); 64 64 void crdTrafo(int GPSWeek, ColumnVector& xyz); 65 65 … … 67 67 QTcpSocket* _clkSocket; 68 68 t_bnscaster* _caster; 69 QFile* _outFile;70 69 QFile* _logFile; 71 QTextStream* _outStream;72 70 QTextStream* _logStream; 73 71 t_bnseph* _bnseph; -
trunk/BNS/bnscaster.cpp
r1064 r1065 26 26 _outSocket = 0; 27 27 _outSocketOpenTrial = 0; 28 29 QSettings settings; 30 31 QIODevice::OpenMode oMode; 32 if (Qt::CheckState(settings.value("fileAppend").toInt()) == Qt::Checked) { 33 oMode = QIODevice::WriteOnly | QIODevice::Unbuffered | QIODevice::Append; 34 } 35 else { 36 oMode = QIODevice::WriteOnly | QIODevice::Unbuffered; 37 } 38 39 QString outFileName = settings.value("outFile").toString(); 40 if (outFileName.isEmpty()) { 41 _outFile = 0; 42 _outStream = 0; 43 } 44 else { 45 _outFile = new QFile(outFileName); 46 if (_outFile->open(oMode)) { 47 _outStream = new QTextStream(_outFile); 48 } 49 } 28 50 } 29 51 … … 32 54 t_bnscaster::~t_bnscaster() { 33 55 delete _outSocket; 56 delete _outStream; 57 delete _outFile; 34 58 } 35 59 … … 101 125 } 102 126 } 127 128 // Print Ascii Output 129 //////////////////////////////////////////////////////////////////////////// 130 void t_bnscaster::printAscii(const QString& line) { 131 if (_outStream) { 132 *_outStream << line; 133 _outStream->flush(); 134 } 135 } -
trunk/BNS/bnscaster.h
r1062 r1065 11 11 void open(); 12 12 void write(char* buffer, unsigned len); 13 bool used() {return _outSocket;} 13 void printAscii(const QString& line); 14 bool used() {return _outSocket || _outFile;} 14 15 15 16 signals: … … 18 19 19 20 private: 20 QString _mountpoint; 21 QTcpSocket* _outSocket; 22 int _outSocketOpenTrial; 23 QDateTime _outSocketOpenTime; 21 QString _mountpoint; 22 QTcpSocket* _outSocket; 23 int _outSocketOpenTrial; 24 QDateTime _outSocketOpenTime; 25 QFile* _outFile; 26 QTextStream* _outStream; 24 27 }; 25 28
Note:
See TracChangeset
for help on using the changeset viewer.