Changeset 2310 in ntrip for trunk/BNC/bnccaster.cpp


Ignore:
Timestamp:
Feb 19, 2010, 3:43:42 PM (15 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bnccaster.cpp

    r2186 r2310  
    4949#include "RTCM/GPSDecoder.h"
    5050
     51static const int MAXRATE = 20; // Hz
     52
    5153// Constructor
    5254////////////////////////////////////////////////////////////////////////////
     
    121123  _epochs = new QMultiMap<long, p_obs>;
    122124
    123   _lastDumpSec  = 0;
     125  _lastDumpSecXrate = 0;
    124126
    125127  _confInterval = -1;
     
    159161  obs->_status = t_obs::received;
    160162
    161   long iSec    = long(floor(obs->_o.GPSWeeks+0.5));
    162   long newTime = obs->_o.GPSWeek * 7*24*3600 + iSec;
     163  long iSecXrate    = long(floor(obs->_o.GPSWeeks * MAXRATE + 0.5));
     164  long newTimeXrate = obs->_o.GPSWeek * 7*24*3600 * MAXRATE + iSecXrate;
    163165
    164166  // Rename the Station
     
    199201  // First time, set the _lastDumpSec immediately
    200202  // --------------------------------------------
    201   if (_lastDumpSec == 0) {
    202     _lastDumpSec = newTime - 1;
     203  if (_lastDumpSecXrate == 0) {
     204    _lastDumpSecXrate = newTimeXrate - 1;
    203205  }
    204206
    205207  // An old observation - throw it away
    206208  // ----------------------------------
    207   if (newTime <= _lastDumpSec) {
     209  if (newTimeXrate <= _lastDumpSecXrate) {
    208210    if (firstObs) {
    209211      bncSettings settings;
     
    211213           !settings.value("outPort").toString().isEmpty() ) {
    212214
    213         QTime enomtime = QTime(0,0,0).addSecs(iSec);
     215        QTime enomtime = QTime(0,0,0).addMSecs(iSecXrate/MAXRATE/1000);
    214216
    215217        emit( newMessage(QString("%1: Old epoch %2 (%3) thrown away")
    216                          .arg(staID.data()).arg(iSec)
     218                         .arg(staID.data()).arg(iSecXrate/MAXRATE)
    217219                         .arg(enomtime.toString("HH:mm:ss"))
    218220                         .toAscii(), true) );
     
    225227  // Save the observation
    226228  // --------------------
    227   _epochs->insert(newTime, obs);
     229  _epochs->insert(newTimeXrate, obs);
    228230
    229231  // Dump Epochs
    230232  // -----------
    231   if (newTime - _waitTime > _lastDumpSec) {
    232     dumpEpochs(_lastDumpSec + 1, newTime - _waitTime);
    233     _lastDumpSec = newTime - _waitTime;
     233  if (newTimeXrate - _waitTimeXrate > _lastDumpSecXrate) {
     234    dumpEpochs(_lastDumpSecXrate + 1, newTimeXrate - _waitTimeXrate);
     235    _lastDumpSecXrate = newTimeXrate - _waitTimeXrate;
    234236  }
    235237}
     
    415417  // Reread several options
    416418  // ----------------------
    417   _samplingRate = settings.value("binSampl").toInt();
    418   _waitTime     = settings.value("waitTime").toInt();
    419   if (_waitTime < 1) {
    420     _waitTime = 1;
     419  _samplingRate  = settings.value("binSampl").toInt();
     420  _waitTimeXrate = settings.value("waitTime").toInt() * MAXRATE;
     421  if (_waitTimeXrate < 1) {
     422    _waitTimeXrate = 1;
    421423  }
    422424
Note: See TracChangeset for help on using the changeset viewer.