Changeset 2523 in ntrip


Ignore:
Timestamp:
Aug 3, 2010, 1:13:59 PM (14 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncgetthread.cpp

    r2519 r2523  
    387387      }
    388388      else if (_rawFile) {
    389         data = _rawFile->read();
     389        data = _rawFile->readChunk();
    390390
    391391        if (data.isEmpty()) {
  • trunk/BNC/bncrawfile.cpp

    r2522 r2523  
    5252  _format     = format;
    5353  _staID      = fileName.mid(fileName.lastIndexOf(QDir::separator())+1,5); 
    54   _inpOutFlag = ioFlg;
     54  _inpFile    = 0;
    5555  _outFile    = 0;
     56  _version    = 0;
    5657
    57   // Initialize
    58   // ----------
    59   if (_inpOutFlag == input) {
     58  // Initialize for Input
     59  // --------------------
     60  if (ioFlg == input) {
     61    _inpFile = new QFile(_fileName);
     62    _inpFile->open(QIODevice::ReadOnly);
     63    QString line = _inpFile->readLine();
     64    QStringList lst1 = line.split(' ');
     65    _version = lst1.value(0).toInt();
     66
     67    line = _inpFile->readLine();
    6068    bncApp* app = (bncApp*) qApp;
    61     // TODO: set date and time
     69    app->_currentDateAndTimeGPS =
     70                   new QDateTime(QDateTime::fromString(line, Qt::ISODate));
     71  }
     72
     73  // Initialize for Output
     74  // ---------------------
     75  else {
     76    _outFile = new QFile(_fileName);
     77    _outFile->open(QIODevice::WriteOnly);
     78    QByteArray header = "1 Version of BNC raw file\n" +
     79                        currentDateAndTimeGPS().toString(Qt::ISODate).toAscii();
     80    _outFile->write(header);
    6281  }
    6382}
     
    7392void bncRawFile::writeRawData(const QByteArray& data, const QByteArray& staID,
    7493                              const QByteArray& format) {
    75 
    76   if ( !_outFile && !_fileName.isEmpty() ) {
    77     _outFile = new QFile(_fileName);
    78     _outFile->open(QIODevice::WriteOnly);
    79     QByteArray header = "1 Version of BNC raw file\n" +
    80                         currentDateAndTimeGPS().toString(Qt::ISODate).toAscii();
    81     _outFile->write(header);
    82   }
    83 
    8494  if (_outFile) {
    8595    QString chunkHeader =
     
    94104// Raw Input
    95105////////////////////////////////////////////////////////////////////////////
    96 QByteArray bncRawFile::read() {
     106QByteArray bncRawFile::readChunk() {
    97107
    98108  return "";
  • trunk/BNC/bncrawfile.h

    r2520 r2523  
    4343  QByteArray format() const {return _format;}
    4444  QByteArray staID() const {return _staID;}
    45   QByteArray read();
     45  QByteArray readChunk();
    4646  void writeRawData(const QByteArray& data, const QByteArray& staID,
    4747                    const QByteArray& format);
     
    5050  QByteArray _format;
    5151  QByteArray _staID;
     52  QFile*     _inpFile;
    5253  QFile*     _outFile;
    53   inpOutFlag _inpOutFlag; // whether used for input or output
     54  int        _version;
    5455};
    5556#endif
Note: See TracChangeset for help on using the changeset viewer.