Changeset 2523 in ntrip for trunk/BNC/bncrawfile.cpp


Ignore:
Timestamp:
Aug 3, 2010, 1:13:59 PM (14 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 "";
Note: See TracChangeset for help on using the changeset viewer.