Changeset 2519 in ntrip


Ignore:
Timestamp:
Aug 3, 2010, 12:10:19 PM (14 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bnc.pro

    r2492 r2519  
    4040          bncserialport.h bncnetquerys.h bncfigure.h                  \
    4141          bncfigurelate.h bncpppclient.h bncversion.h                 \
    42           bancroft.h bncmodel.h bncfigureppp.h                        \
     42          bancroft.h bncmodel.h bncfigureppp.h bncrawfile.h           \
    4343          RTCM/GPSDecoder.h RTCM/RTCM2.h RTCM/RTCM2Decoder.h          \
    4444          RTCM/RTCM2_2021.h RTCM/rtcm_utils.h                         \
     
    6969          bncserialport.cpp bncnetquerys.cpp bncfigure.cpp            \
    7070          bncfigurelate.cpp bncpppclient.cpp bnctime.cpp              \
    71           bancroft.cpp bncmodel.cpp bncfigureppp.cpp                  \
     71          bancroft.cpp bncmodel.cpp bncfigureppp.cpp bncrawfile.cpp   \
    7272          RTCM/RTCM2.cpp RTCM/RTCM2Decoder.cpp                        \
    7373          RTCM/RTCM2_2021.cpp RTCM/rtcm_utils.cpp                     \
  • trunk/BNC/bncapp.cpp

    r2518 r2519  
    6060  _logStream   = 0;
    6161  _caster      = 0;
    62   _rawOutFile  = 0;
     62  _rawFile     = 0;
    6363
    6464  // Lists of Ephemeris
     
    129129  delete _currentDateAndTimeGPS;
    130130
    131   delete _rawOutFile;
     131  delete _rawFile;
    132132}
    133133
     
    713713  QMutexLocker locker(&_mutex);
    714714
    715   if (!_rawOutFile) {
     715  if (!_rawFile) {
    716716    bncSettings settings;
    717     QString rawOutFileName = settings.value("rawOutFile").toString();
    718     if (!rawOutFileName.isEmpty()) {
    719       _rawOutFile = new QFile(rawOutFileName);
    720       _rawOutFile->open(QIODevice::WriteOnly);
    721 
    722       QByteArray header =
    723         "1 Version of BNC raw file\n" +
    724         currentDateAndTimeGPS().toString(Qt::ISODate).toAscii();
    725 
    726       _rawOutFile->write(header);
    727     }
    728   }
    729 
    730   if (_rawOutFile) {
    731     QString chunkHeader =
    732       QString("\n%1 %2 %3\n").arg(QString(staID)).arg(QString(format)).arg(data.size());
    733     _rawOutFile->write(chunkHeader.toAscii());
    734     _rawOutFile->write(data);
    735     _rawOutFile->flush();
    736   }
    737 }
     717    QByteArray fileName = settings.value("rawOutFile").toByteArray();
     718    if (!fileName.isEmpty()) {
     719      _rawFile = new bncRawFile(fileName, format, bncRawFile::output);
     720    }
     721  }
     722
     723  if (_rawFile) {
     724    _rawFile->writeRawData(data, staID, format);
     725  }
     726}
  • trunk/BNC/bncapp.h

    r2518 r2519  
    3131
    3232#include "bnccaster.h"
     33#include "bncrawfile.h"
    3334#include "RTCM3/RTCM3Decoder.h"
    3435
     
    7576
    7677    QFile*            _logFile;
    77     QFile*            _rawOutFile;
    7878    QTextStream*      _logStream;
    7979    int               _logFileFlag;
     
    105105    QMultiMap<long, QString>* _corrs;
    106106    QString             _confFileName;
    107     QDate          _fileDate;
     107    QDate               _fileDate;
     108    bncRawFile*         _rawFile;
    108109};
    109110#endif
  • trunk/BNC/bncgetthread.cpp

    r2518 r2519  
    7575// Constructor 1
    7676////////////////////////////////////////////////////////////////////////////
    77 bncGetThread::bncGetThread(const QByteArray& rawInpFileName,
    78                            const QByteArray& format) {
    79 
    80   _rawInpFile = new QFile(rawInpFileName);
    81   _rawInpFile->open(QIODevice::ReadOnly);
    82   _format     = format;
    83   _staID      = rawInpFileName.mid(
    84                        rawInpFileName.lastIndexOf(QDir::separator())+1,5); 
    85 
    86   _rawOutput = false;
    87 
     77bncGetThread::bncGetThread(bncRawFile* rawFile) {
     78
     79  _rawFile      = rawFile;
     80  _format       = rawFile->format();
     81  _staID        = rawFile->staID();
     82  _rawOutput    = false;
    8883  _ntripVersion = "N";
    8984
     
    9994                           const QByteArray& nmea,
    10095                           const QByteArray& ntripVersion, const QByteArray& extraStaID) {
    101   _rawInpFile   = 0;
     96  _rawFile      = 0;
    10297  _mountPoint   = mountPoint;
    10398  _staID        = (extraStaID.size() == 0 ? mountPoint.path().mid(1).toAscii() : extraStaID);
     
    305300           _format.indexOf("RTCM 3") != -1 ) {
    306301    emit(newMessage(_staID + ": Get data in RTCM 3.x format", true));
    307     bool inputFromFile = false;
    308     if (_rawInpFile != 0) {
    309       inputFromFile = true;
    310     }
    311     _decoder = new RTCM3Decoder(_staID, inputFromFile);
     302    _decoder = new RTCM3Decoder(_staID, bool(_rawFile != 0));
    312303    connect((RTCM3Decoder*) _decoder, SIGNAL(newMessage(QByteArray,bool)),
    313304            this, SIGNAL(newMessage(QByteArray,bool)));
     
    348339  delete _decoder;
    349340  delete _rnx;
    350   delete _rawInpFile;
     341  delete _rawFile;
    351342  delete _serialOutFile;
    352343  delete _serialPort;
     
    395386        _query->waitForReadyRead(data);
    396387      }
    397       else if (_rawInpFile) {
    398         const qint64 maxBytes = 1024;
    399         data = _rawInpFile->read(maxBytes);
    400 
    401         //// beg test
    402         msleep(10);
    403         //// end test
     388      else if (_rawFile) {
     389        data = _rawFile->read();
    404390
    405391        if (data.isEmpty()) {
     
    457443        // Check observation epoch
    458444        // -----------------------
    459         if (!_rawInpFile && !dynamic_cast<gpssDecoder*>(_decoder)) {
     445        if (!_rawFile && !dynamic_cast<gpssDecoder*>(_decoder)) {
    460446          int week;
    461447          double sec;
     
    525511  // Start a new query
    526512  // -----------------
    527   if (!_rawInpFile) {
     513  if (!_rawFile) {
    528514
    529515    sleep(_nextSleep);
  • trunk/BNC/bncgetthread.h

    r2492 r2519  
    3636#include "bncnetquery.h"
    3737#include "bnctime.h"
     38#include "bncrawfile.h"
    3839
    3940class bncRinex;
     
    4647
    4748 public:
    48    bncGetThread(const QByteArray&  rawInpFileName, const QByteArray& format);
     49   bncGetThread(bncRawFile* rawFile);
    4950   bncGetThread(const QUrl& mountPoint,
    5051                const QByteArray& format,
     
    117118   int             _samplingRate;
    118119   bncRinex*       _rnx;
    119    QFile*          _rawInpFile;
     120   bncRawFile*     _rawFile;
    120121   QextSerialPort* _serialPort;
    121122   bool            _isToBeDeleted;
  • trunk/BNC/bncmain.cpp

    r2012 r2519  
    6464  QByteArray rawFileName;
    6565  QByteArray format;
    66   QString    dateString;
    67   QString    timeString;
    6866  QString    confFileName;
    6967
     
    8280      if (QByteArray(argv[ii]).indexOf("-format") != -1) {
    8381        format = QByteArray(argv[ii+1]);
    84       }
    85       if (QByteArray(argv[ii]).indexOf("-date")   != -1) {
    86         dateString = QString(argv[ii+1]);
    87       }
    88       if (QByteArray(argv[ii]).indexOf("-time")   != -1) {
    89         timeString = QString(argv[ii+1]);
    9082      }
    9183    }
     
    158150    // -----------------------------
    159151    else {
    160       if ( format.isEmpty() || dateString.isEmpty() || timeString.isEmpty() ) {
     152      if ( format.isEmpty() ) {
    161153        cout << printHelp.toAscii().data() << endl;
    162154        exit(0);
    163155      }
    164156
    165       app._currentDateAndTimeGPS =
    166         new QDateTime(QDate::fromString(dateString, Qt::ISODate),
    167                       QTime::fromString(timeString, Qt::ISODate), Qt::UTC);
     157      bncRawFile* rawFile = new bncRawFile(rawFileName, format,
     158                                           bncRawFile::input);
    168159
    169       bncGetThread* getThread = new bncGetThread(rawFileName, format);
     160      bncGetThread* getThread = new bncGetThread(rawFile);
    170161      caster->addGetThread(getThread);
    171162    }
Note: See TracChangeset for help on using the changeset viewer.