Changeset 140 in ntrip


Ignore:
Timestamp:
Sep 8, 2006, 10:45:48 AM (18 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bnccaster.cpp

    r139 r140  
    9898  }
    9999
    100   // Check the sampling rate
    101   // -----------------------
    102   if (_samplingRate != 0) {
    103     if ( newTime % _samplingRate ) {
    104       delete obs;
    105       return;
    106     }
    107   }
    108 
    109100  // Rename the station and save the observation
    110101  // -------------------------------------------
     
    157148
    158149  for (long sec = minTime; sec <= maxTime; sec++) {
    159    
     150
    160151    bool first = true;
    161152    QList<Observation*> allObs = _epochs->values(sec);
     
    164155      Observation* obs = it.next();
    165156
    166       // Output into the file
    167       // --------------------
    168       if (_out) {
    169         if (first) {
    170           *_out << begEpoch << endl;;
    171         }
    172         *_out <<       obs->StatID    << " "
    173               << (int) obs->SVPRN     << " "
    174               << (int) obs->GPSWeek   << " "
    175               <<       obs->GPSWeeks  << " "
    176               <<       obs->sec       << " "
    177               <<       obs->pCodeIndicator << " "
    178               <<       obs->cumuLossOfCont << " "
    179               <<       obs->C1        << " "
    180               <<       obs->P2        << " "
    181               <<       obs->L1        << " "
    182               <<       obs->L2        << endl;
    183         if (!it.hasNext()) {
    184           *_out << endEpoch << endl;
    185         }
    186       }
    187 
    188       // Output into the socket
    189       // ----------------------
    190       if (_sockets) {
    191         int numBytes = sizeof(*obs);
    192         QListIterator<QTcpSocket*> is(*_sockets);
    193         while (is.hasNext()) {
    194           QTcpSocket* sock = is.next();
     157      if (_samplingRate == 0 || sec % _samplingRate == 0) {
     158   
     159        // Output into the file
     160        // --------------------
     161        if (_out) {
    195162          if (first) {
    196             sock->write(&begEpoch, 1);
     163            *_out << begEpoch << endl;;
    197164          }
    198           sock->write(&begObs, 1);
    199           sock->write((char*) obs, numBytes);
     165          *_out <<       obs->StatID    << " "
     166                << (int) obs->SVPRN     << " "
     167                << (int) obs->GPSWeek   << " "
     168                <<       obs->GPSWeeks  << " "
     169                <<       obs->sec       << " "
     170                <<       obs->pCodeIndicator << " "
     171                <<       obs->cumuLossOfCont << " "
     172                <<       obs->C1        << " "
     173                <<       obs->P2        << " "
     174                <<       obs->L1        << " "
     175                <<       obs->L2        << endl;
    200176          if (!it.hasNext()) {
    201             sock->write(&endEpoch, 1);
     177            *_out << endEpoch << endl;
    202178          }
    203179        }
    204       }
    205 
    206       // Prepare RINEX Output
    207       // --------------------
    208       if (1) {
     180       
     181        // Output into the socket
     182        // ----------------------
     183        if (_sockets) {
     184          int numBytes = sizeof(*obs);
     185          QListIterator<QTcpSocket*> is(*_sockets);
     186          while (is.hasNext()) {
     187            QTcpSocket* sock = is.next();
     188            if (first) {
     189              sock->write(&begEpoch, 1);
     190            }
     191            sock->write(&begObs, 1);
     192            sock->write((char*) obs, numBytes);
     193            if (!it.hasNext()) {
     194              sock->write(&endEpoch, 1);
     195            }
     196          }
     197        }
     198       
     199        // Prepare RINEX Output
     200        // --------------------
    209201        if (_rinexWriters.find(obs->StatID) == _rinexWriters.end()) {
    210202          _rinexWriters.insert(obs->StatID, new bncRinex(obs->StatID));
Note: See TracChangeset for help on using the changeset viewer.