Changeset 2316 in ntrip


Ignore:
Timestamp:
Feb 20, 2010, 9:17:00 AM (14 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNC
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bnccaster.cpp

    r2312 r2316  
    121121  _epochs = new QMultiMap<long, p_obs>;
    122122
    123   _lastDumpSecXrate = 0;
     123  _lastDumpSec  = 0;
    124124
    125125  _confInterval = -1;
     
    159159  obs->_status = t_obs::received;
    160160
    161   long iSecXrate    = long(floor(obs->_o.GPSWeeks * _maxRate + 0.5));
    162   long newTimeXrate = obs->_o.GPSWeek * 7*24*3600 * _maxRate + iSecXrate;
     161  long iSec    = long(floor(obs->_o.GPSWeeks+0.5));
     162  long newTime = obs->_o.GPSWeek * 7*24*3600 + iSec;
    163163
    164164  // Rename the Station
     
    199199  // First time, set the _lastDumpSec immediately
    200200  // --------------------------------------------
    201   if (_lastDumpSecXrate == 0) {
    202     _lastDumpSecXrate = newTimeXrate - 1;
     201  if (_lastDumpSec == 0) {
     202    _lastDumpSec = newTime - 1;
    203203  }
    204204
    205205  // An old observation - throw it away
    206206  // ----------------------------------
    207   if (newTimeXrate <= _lastDumpSecXrate) {
     207  if (newTime <= _lastDumpSec) {
    208208    if (firstObs) {
    209209      bncSettings settings;
     
    211211           !settings.value("outPort").toString().isEmpty() ) {
    212212
    213         QTime enomtime = QTime(0,0,0).addMSecs(iSecXrate/_maxRate/1000);
     213        QTime enomtime = QTime(0,0,0).addSecs(iSec);
    214214
    215215        emit( newMessage(QString("%1: Old epoch %2 (%3) thrown away")
    216                          .arg(staID.data()).arg(iSecXrate/_maxRate)
     216                         .arg(staID.data()).arg(iSec)
    217217                         .arg(enomtime.toString("HH:mm:ss"))
    218218                         .toAscii(), true) );
     
    225225  // Save the observation
    226226  // --------------------
    227   _epochs->insert(newTimeXrate, obs);
     227  _epochs->insert(newTime, obs);
    228228
    229229  // Dump Epochs
    230230  // -----------
    231   if (newTimeXrate - _waitTimeXrate > _lastDumpSecXrate) {
    232     dumpEpochs(_lastDumpSecXrate + 1, newTimeXrate - _waitTimeXrate);
    233     _lastDumpSecXrate = newTimeXrate - _waitTimeXrate;
     231  if (newTime - _waitTime > _lastDumpSec) {
     232    dumpEpochs(_lastDumpSec + 1, newTime - _waitTime);
     233    _lastDumpSec = newTime - _waitTime;
    234234  }
    235235}
     
    303303// Dump Complete Epochs
    304304////////////////////////////////////////////////////////////////////////////
    305 void bncCaster::dumpEpochs(long minTimeXrate, long maxTimeXrate) {
     305void bncCaster::dumpEpochs(long minTime, long maxTime) {
    306306
    307307  const char begEpoch[] = "BEGEPOCH";
     
    311311  const int endEpochNBytes = sizeof(endEpoch) - 1;
    312312
    313   for (long secXrate = minTimeXrate; secXrate <= maxTimeXrate; ++secXrate) {
     313  for (long sec = minTime; sec <= maxTime; sec++) {
    314314
    315315    bool first = true;
    316     QList<p_obs> allObs = _epochs->values(secXrate);
     316    QList<p_obs> allObs = _epochs->values(sec);
    317317
    318318    QListIterator<p_obs> it(allObs);
     
    320320      p_obs obs = it.next();
    321321
    322       if (_samplingRate == 0 || (secXrate/_maxRate) % _samplingRate == 0) {
     322      if (_samplingRate == 0 || sec % _samplingRate == 0) {
    323323
    324324        if (first) {
     
    401401
    402402      delete obs;
    403       _epochs->remove(secXrate);
     403      _epochs->remove(sec);
    404404      first = false;
    405405    }
     
    415415  // Reread several options
    416416  // ----------------------
    417   _maxRate = 20;
    418 
    419   _samplingRate  = settings.value("binSampl").toInt();
    420   _waitTimeXrate = settings.value("waitTime").toInt() * _maxRate;
    421   if (_waitTimeXrate < 1) {
    422     _waitTimeXrate = 1;
     417  _samplingRate = settings.value("binSampl").toInt();
     418  _waitTime     = settings.value("waitTime").toInt();
     419  if (_waitTime < 1) {
     420    _waitTime = 1;
    423421  }
    424422
  • trunk/BNC/bnccaster.h

    r2312 r2316  
    6060
    6161 private:
    62    void dumpEpochs(long minTimeXrate, long maxTimeXrate);
     62   void dumpEpochs(long minTime, long maxTime);
    6363   static int myWrite(QTcpSocket* sock, const char* buf, int bufLen);
    6464
     
    6767   QTextStream*            _out;
    6868   QMultiMap<long, p_obs>* _epochs;
    69    long                    _lastDumpSecXrate;
     69   long                    _lastDumpSec;
    7070   QTcpServer*             _server;
    7171   QTcpServer*             _uServer;
     
    7777   QList<bncGetThread*>    _threads;
    7878   int                     _samplingRate;
    79    long                    _waitTimeXrate;
     79   long                    _waitTime;
    8080   QMutex                  _mutex;
    8181   int                     _confInterval;
    82    int                     _maxRate;
    8382};
    8483
Note: See TracChangeset for help on using the changeset viewer.