Changeset 7889 in ntrip for trunk/BNC/src/upload


Ignore:
Timestamp:
Apr 28, 2016, 1:04:18 PM (9 years ago)
Author:
stuerze
Message:

BNC's ephemeris upload is extended to allows an upload of more than one stream and to choose a single satellite system

Location:
trunk/BNC/src/upload
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/upload/bncephuploadcaster.cpp

    r7717 r7889  
    2727bncEphUploadCaster::bncEphUploadCaster() : bncEphUser(true) {
    2828  bncSettings settings;
     29  int     sampl    = settings.value("uploadSamplRtcmEph").toInt();
    2930
    30   QString mountpoint = settings.value("uploadEphMountpoint").toString();
    31   if (mountpoint.isEmpty()) {
    32     _ephUploadCaster = 0;
    33   }
    34   else {
    35     QString outHost  = settings.value("uploadEphHost").toString();
    36     int     outPort  = settings.value("uploadEphPort").toInt();
    37     QString password = settings.value("uploadEphPassword").toString();
    38     int     sampl    = settings.value("uploadEphSample").toInt();
     31  // List of upload casters
     32  // ----------------------
     33  int iRow = -1;
     34  QListIterator<QString> it(settings.value("uploadEphMountpointsOut").toStringList());
     35  while (it.hasNext()) {
     36    QStringList hlp = it.next().split(",");
     37    if (hlp.size() > 3) {
     38      ++iRow;
     39      int  outPort = hlp[1].toInt();
     40      bncUploadCaster* newCaster = new bncUploadCaster(hlp[2], hlp[0], outPort,
     41                                                       hlp[3], iRow, sampl);
    3942
    40     _ephUploadCaster = new bncUploadCaster(mountpoint, outHost, outPort,
    41                                            password, -1, sampl);
     43      connect(newCaster, SIGNAL(newBytes(QByteArray,double)),
     44              this, SIGNAL(newBytes(QByteArray,double)));
    4245
    43     connect(_ephUploadCaster, SIGNAL(newBytes(QByteArray,double)),
    44           this, SIGNAL(newBytes(QByteArray,double)));
    45 
    46     _ephUploadCaster->start();
     46      newCaster->start();
     47      _casters.push_back(newCaster);
     48    }
    4749  }
    4850}
     
    5153////////////////////////////////////////////////////////////////////////////
    5254bncEphUploadCaster::~bncEphUploadCaster() {
    53   if (_ephUploadCaster) {
    54     _ephUploadCaster->deleteSafely();
     55  for (int ic = 0; ic < _casters.size(); ic++) {
     56    _casters[ic]->deleteSafely();
    5557  }
    5658}
     
    5961////////////////////////////////////////////////////////////////////////////
    6062void bncEphUploadCaster::ephBufferChanged() {
    61   if (_ephUploadCaster) {
    62     QByteArray outBuffer;
     63  bncSettings settings;
     64  int iRow = -1;
     65  QListIterator<QString> it(settings.value("uploadEphMountpointsOut").toStringList());
     66  while (it.hasNext()) {
     67    QStringList hlp = it.next().split(",");
     68    if (hlp.size() > 3) {
     69      ++iRow;
     70      QString system = hlp[4];
     71      QByteArray outBuffer;
    6372
    64     QDateTime now = currentDateAndTimeGPS();
    65     bncTime currentTime(now.toString(Qt::ISODate).toStdString());
     73      QDateTime now = currentDateAndTimeGPS();
     74      bncTime currentTime(now.toString(Qt::ISODate).toStdString());
    6675
    67     QListIterator<QString> it(prnList());
    68     while (it.hasNext()) {
    69       const t_eph* eph = ephLast(it.next());
     76      QListIterator<QString> it(prnList());
     77      while (it.hasNext()) {
     78        const t_eph* eph = ephLast(it.next());
    7079
    71       bncTime toc = eph->TOC();
    72       double timeDiff = fabs(toc - currentTime);
     80        bncTime toc = eph->TOC();
     81        double timeDiff = fabs(toc - currentTime);
    7382
    74       const t_ephGPS*  ephGPS  = dynamic_cast<const t_ephGPS*>(eph);
    75       const t_ephGlo*  ephGlo  = dynamic_cast<const t_ephGlo*>(eph);
    76       const t_ephGal*  ephGal  = dynamic_cast<const t_ephGal*>(eph);
    77       const t_ephSBAS* ephSBAS = dynamic_cast<const t_ephSBAS*>(eph);
    78       const t_ephBDS*  ephBDS  = dynamic_cast<const t_ephBDS*>(eph);
     83        const t_ephGPS*  ephGPS  = dynamic_cast<const t_ephGPS*>(eph);
     84        const t_ephGlo*  ephGlo  = dynamic_cast<const t_ephGlo*>(eph);
     85        const t_ephGal*  ephGal  = dynamic_cast<const t_ephGal*>(eph);
     86        const t_ephSBAS* ephSBAS = dynamic_cast<const t_ephSBAS*>(eph);
     87        const t_ephBDS*  ephBDS  = dynamic_cast<const t_ephBDS*>(eph);
    7988
    80       unsigned char Array[80];
    81       int size = 0;
     89        unsigned char Array[80];
     90        int size = 0;
    8291
    83       if (ephGPS) {
    84         if (timeDiff <= 4*3600) {
    85           size = t_ephEncoder::RTCM3(*ephGPS, Array);
     92        if (ephGPS && ephGPS->type() == t_eph::GPS &&
     93            (system == "ALL" || system == "GPS")) {
     94          if (timeDiff <= 4*3600) {
     95            size = t_ephEncoder::RTCM3(*ephGPS, Array);
     96          }
     97        }
     98        else if (ephGPS && ephGPS->type() == t_eph::QZSS &&
     99            (system == "ALL" || system == "QZSS")) {
     100          if (timeDiff <= 4*3600) {
     101            size = t_ephEncoder::RTCM3(*ephGPS, Array);
     102          }
     103        }
     104        else if (ephGlo && (system == "ALL" || system == "GLONASS")) {
     105          if (timeDiff <= 1*3600) {
     106            size = t_ephEncoder::RTCM3(*ephGlo, Array);
     107          }
     108        }
     109        else if (ephGal && (system == "ALL" || system == "Galileo")) {
     110          if (timeDiff <= 4*3600) {
     111            size = t_ephEncoder::RTCM3(*ephGal, Array);
     112          }
     113        }
     114        else if (ephSBAS && (system == "ALL" || system == "SBAS")) {
     115          if (timeDiff <= 600) {
     116            size = t_ephEncoder::RTCM3(*ephSBAS, Array);
     117          }
     118        }
     119        else if (ephBDS && (system == "ALL" || system == "BDS")) {
     120          if (timeDiff <= 6*3600) {
     121            size = t_ephEncoder::RTCM3(*ephBDS, Array);
     122          }
     123        }
     124        if (size > 0) {
     125          outBuffer += QByteArray((char*) Array, size);
    86126        }
    87127      }
    88       else if (ephGlo) {
    89         if (timeDiff <= 1*3600) {
    90           size = t_ephEncoder::RTCM3(*ephGlo, Array);
    91         }
     128      if (outBuffer.size() > 0) {
     129        _casters.at(iRow)->setOutBuffer(outBuffer);
    92130      }
    93       else if (ephGal) {
    94         if (timeDiff <= 4*3600) {
    95           size = t_ephEncoder::RTCM3(*ephGal, Array);
    96         }
    97       }
    98       else if (ephSBAS) {
    99         if (timeDiff <= 600) {
    100           size = t_ephEncoder::RTCM3(*ephSBAS, Array);
    101         }
    102       }
    103       else if (ephBDS) {
    104         if (timeDiff <= 6*3600) {
    105           size = t_ephEncoder::RTCM3(*ephBDS, Array);
    106         }
    107       }
    108       if (size > 0) {
    109         outBuffer += QByteArray((char*) Array, size);
    110       }
    111     }
    112     if (outBuffer.size() > 0) {
    113       _ephUploadCaster->setOutBuffer(outBuffer);
    114131    }
    115132  }
  • trunk/BNC/src/upload/bncephuploadcaster.h

    r3254 r7889  
    1616  virtual void ephBufferChanged();
    1717 private:
    18   bncUploadCaster* _ephUploadCaster;
     18//  bncUploadCaster* _ephUploadCaster;
     19  QVector<bncUploadCaster*> _casters;
    1920};
    2021
Note: See TracChangeset for help on using the changeset viewer.