Changeset 1065 in ntrip


Ignore:
Timestamp:
Aug 27, 2008, 12:09:31 PM (16 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNS
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNS/bns.cpp

    r1064 r1065  
    7979          this, SLOT(slotMessage(const QByteArray)));
    8080
     81  // Log File
     82  // --------
    8183  QIODevice::OpenMode oMode;
    8284  if (Qt::CheckState(settings.value("fileAppend").toInt()) == Qt::Checked) {
     
    8789  }
    8890
    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 File
    102   // --------
    10391  QString logFileName = settings.value("logFile").toString();
    10492  if (logFileName.isEmpty()) {
     
    159147  delete _clkSocket;
    160148  delete _caster;
    161   delete _outStream;
    162149  delete _logStream;
    163   delete _outFile;
    164150  delete _logFile;
    165151  QMapIterator<QString, t_ephPair*> it(_ephList);
     
    357343          }
    358344          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);
    360349          }
    361350        }
    362351      }
    363352   
    364       if ( (_caster->used() || _outFile) &&
     353      if ( _caster->used() &&
    365354           (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) ) {
    366355        char obuffer[CLOCKORBIT_BUFFERSIZE];
     
    379368void t_bns::processSatellite(int oldEph, t_eph* ep, int GPSweek, double GPSweeks,
    380369                             const QString& prn, const ColumnVector& xx,
    381                              struct ClockOrbit::SatData* sd) {
     370                             struct ClockOrbit::SatData* sd,
     371                             QString& outLine) {
    382372
    383373  ColumnVector xB(4);
     
    407397  }
    408398
    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
    418404  if (!oldEph) {
    419405    if (_rnx) {
  • trunk/BNS/bns.h

    r1062 r1065  
    6161  void processSatellite(int oldEph, t_eph* ep, int GPSweek, double GPSweeks,
    6262                        const QString& prn, const ColumnVector& xx,
    63                         struct ClockOrbit::SatData* sd);
     63                        struct ClockOrbit::SatData* sd, QString& outLine);
    6464  void crdTrafo(int GPSWeek, ColumnVector& xyz);
    6565
     
    6767  QTcpSocket*               _clkSocket;
    6868  t_bnscaster*              _caster;
    69   QFile*                    _outFile;
    7069  QFile*                    _logFile;
    71   QTextStream*              _outStream;
    7270  QTextStream*              _logStream;
    7371  t_bnseph*                 _bnseph;
  • trunk/BNS/bnscaster.cpp

    r1064 r1065  
    2626  _outSocket          = 0;
    2727  _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  }
    2850}
    2951
     
    3254t_bnscaster::~t_bnscaster() {
    3355  delete _outSocket;
     56  delete _outStream;
     57  delete _outFile;
    3458}
    3559
     
    101125  }
    102126}
     127
     128// Print Ascii Output
     129////////////////////////////////////////////////////////////////////////////
     130void t_bnscaster::printAscii(const QString& line) {
     131  if (_outStream) {
     132    *_outStream << line;
     133     _outStream->flush();
     134  }
     135}
  • trunk/BNS/bnscaster.h

    r1062 r1065  
    1111  void open();
    1212  void write(char* buffer, unsigned len);
    13   bool used() {return _outSocket;}
     13  void printAscii(const QString& line);
     14  bool used() {return _outSocket || _outFile;}
    1415
    1516 signals:
     
    1819
    1920 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;
    2427};
    2528
Note: See TracChangeset for help on using the changeset viewer.