Changeset 1222 in ntrip for trunk


Ignore:
Timestamp:
Nov 22, 2008, 2:09:45 PM (16 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNC
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/RTCM3/RTCM3coDecoder.cpp

    r1218 r1222  
    109109//
    110110////////////////////////////////////////////////////////////////////////////
    111 t_irc RTCM3coDecoder::Decode(char* buffer, int bufLen, vector<string>& errmsg) {
     111t_irc RTCM3coDecoder::Decode(char* buffer, int /* bufLen */,
     112                             vector<string>& errmsg) {
    112113
    113114  errmsg.clear();
    114115
    115   _buffer.append(buffer, bufLen);
     116  _buffer.append(buffer);
    116117
    117118  t_irc retCode = failure;
     
    198199        printLine(line, coTime);
    199200      }
    200       _buffer = _buffer.substr(bytesused);
     201      _buffer = _buffer.mid(bytesused);
    201202      retCode = success;
    202203    }
     
    205206    // ---------------
    206207    else {
    207       _buffer = _buffer.substr(1);
     208      _buffer = _buffer.mid(1);
    208209    }
    209210  }
  • trunk/BNC/RTCM3/RTCM3coDecoder.h

    r1218 r1222  
    5656  QString             _fileNameSkl;
    5757  QString             _fileName;
    58   std::string         _buffer;
     58  QByteArray          _buffer;
    5959  ClockOrbit          _co;
    6060  Bias                _bias;
  • trunk/BNC/bnccaster.cpp

    r1200 r1222  
    8787  }
    8888
     89  int uPort = settings.value("outUPort").toInt();
     90  if (uPort != 0) {
     91    _uServer = new QTcpServer;
     92    _uServer->listen(QHostAddress::Any, uPort);
     93    connect(_uServer, SIGNAL(newConnection()), this, SLOT(slotNewUConnection()));
     94    _uSockets = new QList<QTcpSocket*>;
     95  }
     96  else {
     97    _uServer  = 0;
     98    _uSockets = 0;
     99  }
     100
    89101  _epochs = new QMultiMap<long, p_obs>;
    90102
     
    111123  delete _server;
    112124  delete _sockets;
     125  delete _uServer;
     126  delete _uSockets;
    113127  if (_epochs) {
    114128    QListIterator<p_obs> it(_epochs->values());
     
    136150  obs->_o.StatID[sizeof(obs->_o.StatID)-1] = '\0';
    137151       
     152  const char begObs[] = "BEGOBS";
     153  const int begObsNBytes = sizeof(begObs) - 1;
     154
     155  // Output into the socket
     156  // ----------------------
     157  if (_uSockets) {
     158    QMutableListIterator<QTcpSocket*> is(*_uSockets);
     159    while (is.hasNext()) {
     160      QTcpSocket* sock = is.next();
     161      if (sock->state() == QAbstractSocket::ConnectedState) {
     162        bool ok = true;
     163        if (myWrite(sock, begObs, begObsNBytes) != begObsNBytes) {
     164          ok = false;
     165        }
     166        int numBytes = sizeof(obs->_o);
     167        if (myWrite(sock, (const char*)(&obs->_o), numBytes) != numBytes) {
     168          ok = false;
     169        }
     170        if (!ok) {
     171          delete sock;
     172          is.remove();
     173        }
     174      }
     175      else if (sock->state() != QAbstractSocket::ConnectingState) {
     176        delete sock;
     177        is.remove();
     178      }
     179    }
     180  }
     181
    138182  // First time, set the _lastDumpSec immediately
    139183  // --------------------------------------------
     
    175219  emit( newMessage(QString("New Connection # %1")
    176220                   .arg(_sockets->size()).toAscii()) );
     221}
     222
     223void bncCaster::slotNewUConnection() {
     224  _uSockets->push_back( _uServer->nextPendingConnection() );
     225  emit( newMessage(QString("New Connection (usync) # %1")
     226                   .arg(_uSockets->size()).toAscii()) );
    177227}
    178228
     
    273323          while (is.hasNext()) {
    274324            QTcpSocket* sock = is.next();
    275             int myFlag = 0;
    276325            if (sock->state() == QAbstractSocket::ConnectedState) {
    277326              bool ok = true;
    278327              if (first) {
    279328                if (myWrite(sock, begEpoch, begEpochNBytes) != begEpochNBytes) {
    280                   myFlag = 1;
    281329                  ok = false;
    282330                }
     
    284332              int numBytes = sizeof(obs->_o);
    285333              if (myWrite(sock, (const char*)(&obs->_o), numBytes) != numBytes) {
    286                 myFlag = 2;
    287334                ok = false;
    288335              }
    289336              if (!it.hasNext()) {
    290337                if (myWrite(sock, endEpoch, endEpochNBytes) != endEpochNBytes) {
    291                   myFlag = 3;
    292338                  ok = false;
    293339                }
  • trunk/BNC/bnccaster.h

    r1182 r1222  
    5454 private slots:
    5555   void slotNewConnection();
     56   void slotNewUConnection();
    5657   void slotGetThreadError(QByteArray staID);
    5758
     
    6667   long                    _lastDumpSec;
    6768   QTcpServer*             _server;
     69   QTcpServer*             _uServer;
    6870   QList<QTcpSocket*>*     _sockets;
     71   QList<QTcpSocket*>*     _uSockets;
    6972   QList<QByteArray>       _staIDs;
    7073   QList<bncGetThread*>    _threads;
  • trunk/BNC/bncwindow.cpp

    r1218 r1222  
    125125  _outPortLineEdit    = new QLineEdit(settings.value("outPort").toString());
    126126  _outPortLineEdit->setMaximumWidth(9*ww);
     127  _outUPortLineEdit   = new QLineEdit(settings.value("outUPort").toString());
     128  _outUPortLineEdit->setMaximumWidth(9*ww);
    127129  _outEphPortLineEdit    = new QLineEdit(settings.value("outEphPort").toString());
    128130  _outEphPortLineEdit->setMaximumWidth(9*ww);
     
    264266  _outFileLineEdit->setWhatsThis(tr("Specify the full path to a file where synchronized observations are saved in plain ASCII format. Beware that the size of this file can rapidly increase depending on the number of incoming streams."));
    265267  _outPortLineEdit->setWhatsThis(tr("BNC can produce synchronized observations in binary format on your local host through an IP port. Specify a port number here to activate this function."));
     268  _outPortLineEdit->setWhatsThis(tr("Unsynchronized observations in binary format on your local host through an IP port. Specify a port number here to activate this function."));
    266269  _outEphPortLineEdit->setWhatsThis(tr("BNC can produce ephemeris data in RINEX ASCII format on your local host through an IP port. Specify a port number here to activate this function."));
    267270  _corrPortLineEdit->setWhatsThis(tr("BNC can produce Broadcast Ephemeris Corrections on your local host through an IP port. Specify a port number here to activate this function."));
     
    345348  sLayout->addWidget(new QLabel("Port"),                          0, 0);
    346349  sLayout->addWidget(_outPortLineEdit,                            0, 1);
     350  sLayout->addWidget(new QLabel("Port (Unsynchronized)"),         0, 2);
     351  sLayout->addWidget(_outUPortLineEdit,                           0, 3);
    347352  sLayout->addWidget(new QLabel("Wait for full epoch"),           1, 0);
    348353  sLayout->addWidget(_waitTimeSpinBox,                            1, 1);
    349354  sLayout->addWidget(new QLabel("File (full path)"),              2, 0);
    350   sLayout->addWidget(_outFileLineEdit,                            2, 1);
     355  sLayout->addWidget(_outFileLineEdit,                            2, 1, 1, 3);
    351356  sLayout->addWidget(new QLabel("Sampling"),                      3, 0, Qt::AlignLeft);
    352357  sLayout->addWidget(_binSamplSpinBox,                            3, 1, Qt::AlignLeft);
    353   sLayout->addWidget(new QLabel("Output synchronized observations epoch by epoch."),4,0,1,2,Qt::AlignLeft);
     358  sLayout->addWidget(new QLabel("Output synchronized observations epoch by epoch."),4,0,1,4,Qt::AlignLeft);
    354359  sLayout->addWidget(new QLabel("    "),5,0);
    355360  sLayout->addWidget(new QLabel("    "),6,0);
     
    634639  settings.setValue("perfIntr",    _perfIntrComboBox->currentText());
    635640  settings.setValue("outPort",     _outPortLineEdit->text());
     641  settings.setValue("outUPort",    _outUPortLineEdit->text());
    636642  settings.setValue("outEphPort",  _outEphPortLineEdit->text());
    637643  settings.setValue("corrPort",    _corrPortLineEdit->text());
  • trunk/BNC/bncwindow.h

    r1179 r1222  
    102102    QLineEdit* _outFileLineEdit;
    103103    QLineEdit* _outPortLineEdit;
     104    QLineEdit* _outUPortLineEdit;
    104105    QLineEdit* _outEphPortLineEdit;
    105106    QLineEdit* _corrPortLineEdit;
Note: See TracChangeset for help on using the changeset viewer.