Changeset 858 in ntrip for trunk/BNS


Ignore:
Timestamp:
Apr 26, 2008, 10:37:49 AM (17 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNS
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNS/bns.cpp

    r857 r858  
    1515 * -----------------------------------------------------------------------*/
    1616
     17#include <math.h>
    1718#include <iostream>
    1819#include <newmatio.h>
     
    5455  // Socket and file for outputting the results
    5556  // -------------------------------------------
    56   _outSocket = 0;
     57  _outSocket          = 0;
     58  _outSocketOpenTrial = 0;
    5759
    5860  QString outFileName = settings.value("outFile").toString();
     
    173175////////////////////////////////////////////////////////////////////////////
    174176void t_bns::openCaster() {
    175  
     177
     178  delete _outSocket; _outSocket = 0;
     179
     180  double minDt = exp2(_outSocketOpenTrial);
     181  if (++_outSocketOpenTrial > 8) {
     182    _outSocketOpenTrial = 8;
     183  }
     184  if (_outSocketOpenTime.isValid() &&
     185      _outSocketOpenTime.secsTo(QDateTime::currentDateTime()) < minDt) {
     186    return;
     187  }
     188  else {
     189    _outSocketOpenTime = QDateTime::currentDateTime();
     190  }
     191
    176192  QSettings settings;
    177 
    178   delete _outSocket;
    179193  _outSocket = new QTcpSocket();
    180194  _outSocket->connectToHost(settings.value("outHost").toString(),
     
    209223  else {
    210224    slotMessage("bns::openCaster socket OK");
     225    _outSocketOpenTrial = 0;
    211226  }
    212227}
  • trunk/BNS/bns.h

    r848 r858  
    5757  QTcpSocket*               _clkSocket;
    5858  QTcpSocket*               _outSocket;
     59  int                       _outSocketOpenTrial;
     60  QDateTime                 _outSocketOpenTime;
    5961  QFile*                    _outFile;
    6062  QFile*                    _logFile;
  • trunk/BNS/bnsrinex.cpp

    r857 r858  
    3535}
    3636
    37 // Write Header
    38 ////////////////////////////////////////////////////////////////////////////
    39 void bnsRinex::writeHeader(const QDateTime& datTim) {
    40   _out << "THIS IS A DUMMY CLOCK RINEX HEADER" << endl;
    41 }
    42 
    4337// Write One Epoch
    4438////////////////////////////////////////////////////////////////////////////
     
    6357  }
    6458}
     59
     60// Write Header
     61////////////////////////////////////////////////////////////////////////////
     62void bnsRinex::writeHeader(const QDateTime& datTim) {
     63
     64  _out << "     3.00           C                                       "
     65       << "RINEX VERSION / TYPE" << endl;
     66
     67  _out << "BNS                                     "
     68       << datTim.toString("yyyyMMdd hhmmss").leftJustified(20, ' ', true).toAscii().data()
     69       << "PGM / RUN BY / DATE" << endl;
     70
     71  _out << "     1    AS                                                "
     72       << "# / TYPES OF DATA" << endl;
     73
     74  _out << "                                                            "
     75       << "END OF HEADER" << endl;
     76}
     77
Note: See TracChangeset for help on using the changeset viewer.