Changeset 934 in ntrip
- Timestamp:
- Jun 8, 2008, 4:33:04 PM (16 years ago)
- Location:
- trunk/BNC
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/RTCM3/RTCM3coDecoder.cpp
r920 r934 44 44 #include "RTCM3coDecoder.h" 45 45 #include "bncutils.h" 46 #include "bncrinex.h" 46 47 47 48 using namespace std; … … 49 50 // Constructor 50 51 //////////////////////////////////////////////////////////////////////////// 51 RTCM3coDecoder::RTCM3coDecoder(const QString& fileName) 52 : bncZeroDecoder(fileName) { 52 RTCM3coDecoder::RTCM3coDecoder(const QString& fileName) { 53 54 // File Output 55 // ----------- 56 QSettings settings; 57 QString path = settings.value("corrPath").toString(); 58 if (!path.isEmpty()) { 59 expandEnvVar(path); 60 if ( path.length() > 0 && path[path.length()-1] != QDir::separator() ) { 61 path += QDir::separator(); 62 } 63 _fileNameSkl = path + fileName; 64 } 65 _out = 0; 66 67 // Socket Server 68 // ------------- 69 int port = settings.value("corrPort").toInt(); 70 if (port != 0) { 71 _server = new QTcpServer; 72 _server->listen(QHostAddress::Any, port); 73 connect(_server, SIGNAL(newConnection()), this, SLOT(slotNewConnection())); 74 _sockets = new QList<QTcpSocket*>; 75 } 76 else { 77 delete _sockets; 78 delete _server; 79 } 53 80 } 54 81 … … 56 83 //////////////////////////////////////////////////////////////////////////// 57 84 RTCM3coDecoder::~RTCM3coDecoder() { 85 } 86 87 // Reopen Output File 88 //////////////////////////////////////////////////////////////////////// 89 void RTCM3coDecoder::reopen() { 90 91 if (!_fileNameSkl.isEmpty()) { 92 93 QSettings settings; 94 95 QDateTime datTim = QDateTime::currentDateTime().toUTC(); 96 97 QString hlpStr = bncRinex::nextEpochStr(datTim, 98 settings.value("corrIntr").toString()); 99 100 QString fileName = _fileNameSkl 101 + QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0')) 102 + datTim.toString(".yyC"); 103 104 if (_fileName == fileName) { 105 return; 106 } 107 else { 108 _fileName = fileName; 109 } 110 111 delete _out; 112 _out = new ofstream( _fileName.toAscii().data() ); 113 } 114 } 115 116 // New Connection 117 //////////////////////////////////////////////////////////////////////////// 118 void RTCM3coDecoder::slotNewConnection() { 119 _sockets->push_back( _server->nextPendingConnection() ); 58 120 } 59 121 … … 126 188 _co.Sat[ii].Orbit.DeltaAlongTrack, 127 189 _co.Sat[ii].Orbit.DeltaCrossTrack); 128 *_out << line.toAscii().data();190 printLine(line); 129 191 } 130 192 for(int ii = CLOCKORBIT_NUMGPS; … … 137 199 _co.Sat[ii].Orbit.DeltaAlongTrack, 138 200 _co.Sat[ii].Orbit.DeltaCrossTrack); 139 *_out << line.toAscii().data(); 140 } 141 _out->flush(); 201 printLine(line); 202 } 142 203 _buffer = _buffer.substr(bytesused); 143 204 return success; … … 151 212 } 152 213 } 214 215 // 216 //////////////////////////////////////////////////////////////////////////// 217 void RTCM3coDecoder::printLine(const QString& line) { 218 219 if (_out) { 220 *_out << line.toAscii().data(); 221 _out->flush(); 222 } 223 224 if (_sockets) { 225 QMutableListIterator<QTcpSocket*> is(*_sockets); 226 while (is.hasNext()) { 227 QTcpSocket* sock = is.next(); 228 if (sock->state() == QAbstractSocket::ConnectedState) { 229 if (sock->write(line.toAscii()) == -1) { 230 delete sock; 231 is.remove(); 232 } 233 } 234 else if (sock->state() != QAbstractSocket::ConnectingState) { 235 delete sock; 236 is.remove(); 237 } 238 } 239 } 240 } -
trunk/BNC/RTCM3/RTCM3coDecoder.h
r908 r934 26 26 #define RTCM3CODECODER_H 27 27 28 #include "bnczerodecoder.h" 28 #include <fstream> 29 30 #include <QtCore> 31 #include <QtNetwork> 32 33 #include "RTCM/GPSDecoder.h" 29 34 30 35 extern "C" { … … 32 37 } 33 38 34 class RTCM3coDecoder : public bncZeroDecoder { 35 public: 39 class RTCM3coDecoder : public QObject, public GPSDecoder { 40 Q_OBJECT 41 public: 36 42 RTCM3coDecoder(const QString& fileName); 37 43 virtual ~RTCM3coDecoder(); 38 44 virtual t_irc Decode(char* buffer = 0, int bufLen = 0); 39 private: 40 std::string _buffer; 41 ClockOrbit _co; 42 Bias _bias; 43 } ; 45 46 private slots: 47 void slotNewConnection(); 48 49 private: 50 void reopen(); 51 void printLine(const QString& line); 52 53 std::ofstream* _out; 54 QString _fileNameSkl; 55 QString _fileName; 56 std::string _buffer; 57 ClockOrbit _co; 58 Bias _bias; 59 QTcpServer* _server; 60 QList<QTcpSocket*>* _sockets; 61 }; 44 62 45 63 #endif -
trunk/BNC/bncapp.cpp
r901 r934 457 457 QTcpSocket* sock = is.next(); 458 458 if (sock->state() == QAbstractSocket::ConnectedState) { 459 int fd = sock->socketDescriptor(); 460 if (::write(fd, allLines.data(), allLines.size()) != allLines.size()) { 459 if (sock->write(allLines) == -1) { 461 460 delete sock; 462 461 is.remove(); … … 531 530 QTcpSocket* sock = is.next(); 532 531 if (sock->state() == QAbstractSocket::ConnectedState) { 533 int fd = sock->socketDescriptor(); 534 if (::write(fd, allLines.data(), allLines.size()) != allLines.size()) { 532 if (sock->write(allLines) == -1) { 535 533 delete sock; 536 534 is.remove(); -
trunk/BNC/bncwindow.cpp
r919 r934 117 117 _outEphPortLineEdit = new QLineEdit(settings.value("outEphPort").toString()); 118 118 _outEphPortLineEdit->setMaximumWidth(9*ww); 119 _corrPortLineEdit = new QLineEdit(settings.value("corrPort").toString()); 120 _corrPortLineEdit->setMaximumWidth(9*ww); 119 121 _rnxPathLineEdit = new QLineEdit(settings.value("rnxPath").toString()); 120 122 _ephPathLineEdit = new QLineEdit(settings.value("ephPath").toString()); 123 _corrPathLineEdit = new QLineEdit(settings.value("ephPath").toString()); 121 124 122 125 _rnxV3CheckBox = new QCheckBox(); … … 145 148 if (jj != -1) { 146 149 _ephIntrComboBox->setCurrentIndex(jj); 150 } 151 _corrIntrComboBox = new QComboBox(); 152 _corrIntrComboBox->setMaximumWidth(9*ww); 153 _corrIntrComboBox->setEditable(false); 154 _corrIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(",")); 155 int mm = _corrIntrComboBox->findText(settings.value("corrIntr").toString()); 156 if (mm != -1) { 157 _corrIntrComboBox->setCurrentIndex(mm); 147 158 } 148 159 _rnxSamplSpinBox = new QSpinBox(); … … 282 293 _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.")); 283 294 _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.")); 295 _corrPortLineEdit->setWhatsThis(tr("BNC can produce ephemeris corrections on your local host through an IP port. Specify a port number here to activate this function.")); 284 296 _rnxPathLineEdit->setWhatsThis(tr("Here you specify the path to where the RINEX Observation files will be stored. If the specified directory does not exist, BNC will not create RINEX Observation files.")); 285 297 _ephPathLineEdit->setWhatsThis(tr("Specify the path for saving Broadcast Ephemeris data as RINEX Navigation files. If the specified directory does not exist, BNC will not create RINEX Navigation files.")); 298 _corrPathLineEdit->setWhatsThis(tr("Specify the path for saving Broadcast Ephemeris corrections. If the specified directory does not exist, BNC will not create the files.")); 286 299 _rnxScrpLineEdit->setWhatsThis(tr("<p>Whenever a RINEX Observation file is saved, you might want to compress, copy or upload it immediately via FTP. BNC allows you to execute a script/batch file to carry out these operations. To do that specify the full path of the script/batch file here. BNC will pass the full RINEX Observation file path to the script as a command line parameter (%1 on Windows systems, $1 onUnix/Linux systems).</p><p>The triggering event for calling the script or batch file is the end of a RINEX Observation file 'Interval'. If that is overridden by a stream outage, the triggering event is the stream reconnection.</p>")); 287 300 _rnxSkelLineEdit->setWhatsThis(tr("<p>Whenever BNC starts generating RINEX Observation files (and then once every day at midnight), it first tries to retrieve information needed for RINEX headers from so-called public RINEX header skeleton files which are derived from sitelogs. However, sometimes public RINEX header skeleton files are not available, its contents is not up to date, or you need to put additional/optional records in the RINEX header.</p><p>For that BNC allows using personal skeleton files that contain the header records you would like to include. You can derive a personal RINEX header skeleton file from the information given in an up to date sitelog. A file in the RINEX 'Directory' with the RINEX 'Skeleton extension' is interpreted by BNC as a personal RINEX header skeleton file for the corresponding stream.</p>")); … … 289 302 _rnxIntrComboBox->setWhatsThis(tr("<p>Select the length of the RINEX Observation file.</p>")); 290 303 _ephIntrComboBox->setWhatsThis(tr("<p>Select the length of the RINEX Navigation file.</p>")); 304 _corrIntrComboBox->setWhatsThis(tr("<p>Select the length of the correction file.</p>")); 291 305 _rnxSamplSpinBox->setWhatsThis(tr("<p>Select the RINEX Observation sampling interval in seconds. A value of zero '0' tells BNC to store all received epochs into RINEX.</p>")); 292 306 _binSamplSpinBox->setWhatsThis(tr("<p>Select the Observation sampling interval in seconds. A value of zero '0' tells BNC to send/store all received epochs.</p>")); … … 314 328 QWidget* egroup = new QWidget(); 315 329 QWidget* agroup = new QWidget(); 330 QWidget* cgroup = new QWidget(); 316 331 QWidget* ogroup = new QWidget(); 317 332 aogroup->addTab(pgroup,tr("Proxy")); … … 320 335 aogroup->addTab(egroup,tr("RINEX Ephemeris")); 321 336 aogroup->addTab(sgroup,tr("Synchronized Observations")); 337 aogroup->addTab(cgroup,tr("Ephemeris Corrections")); 322 338 aogroup->addTab(agroup,tr("Monitor")); 323 339 … … 415 431 ogroup->setLayout(oLayout); 416 432 433 QGridLayout* cLayout = new QGridLayout; 434 cLayout->setColumnMinimumWidth(0,12*ww); 435 cLayout->addWidget(new QLabel("Directory"), 0, 0); 436 cLayout->addWidget(_corrPathLineEdit, 0, 1); 437 cLayout->addWidget(new QLabel("Interval"), 1, 0); 438 cLayout->addWidget(_corrIntrComboBox, 1, 1); 439 cLayout->addWidget(new QLabel("Port"), 2, 0); 440 cLayout->addWidget(_corrPortLineEdit, 2, 1); 441 cLayout->addWidget(new QLabel("Saving ephemeris correction files and correction output through IP port."),3,0,1,2,Qt::AlignLeft); 442 cLayout->addWidget(new QLabel(" "),4,0); 443 cgroup->setLayout(cLayout); 444 417 445 QVBoxLayout* mLayout = new QVBoxLayout; 418 446 mLayout->addWidget(aogroup); … … 555 583 settings.setValue("outPort", _outPortLineEdit->text()); 556 584 settings.setValue("outEphPort", _outEphPortLineEdit->text()); 585 settings.setValue("corrPort", _corrPortLineEdit->text()); 557 586 settings.setValue("rnxPath", _rnxPathLineEdit->text()); 558 587 settings.setValue("ephPath", _ephPathLineEdit->text()); 588 settings.setValue("corrPath", _corrPathLineEdit->text()); 559 589 settings.setValue("rnxScript", _rnxScrpLineEdit->text()); 560 590 settings.setValue("rnxIntr", _rnxIntrComboBox->currentText()); 561 591 settings.setValue("ephIntr", _ephIntrComboBox->currentText()); 592 settings.setValue("corrIntr", _corrIntrComboBox->currentText()); 562 593 settings.setValue("rnxSampl", _rnxSamplSpinBox->value()); 563 594 settings.setValue("binSampl", _binSamplSpinBox->value()); -
trunk/BNC/bncwindow.h
r740 r934 90 90 QLineEdit* _outPortLineEdit; 91 91 QLineEdit* _outEphPortLineEdit; 92 QLineEdit* _corrPortLineEdit; 92 93 QLineEdit* _rnxPathLineEdit; 93 94 QLineEdit* _ephPathLineEdit; 95 QLineEdit* _corrPathLineEdit; 94 96 QCheckBox* _rnxV3CheckBox; 95 97 QCheckBox* _ephV3CheckBox; … … 99 101 QComboBox* _rnxIntrComboBox; 100 102 QComboBox* _ephIntrComboBox; 103 QComboBox* _corrIntrComboBox; 101 104 QSpinBox* _rnxSamplSpinBox; 102 105 QSpinBox* _binSamplSpinBox; -
trunk/BNC/bnczerodecoder.cpp
r881 r934 48 48 //////////////////////////////////////////////////////////////////////// 49 49 bncZeroDecoder::bncZeroDecoder(const QString& fileName) { 50 50 51 QSettings settings; 51 52 QString path = settings.value("rnxPath").toString(); -
trunk/BNC/bnczerodecoder.h
r875 r934 35 35 ~bncZeroDecoder(); 36 36 virtual t_irc Decode(char* buffer, int bufLen); 37 pr otected:37 private: 38 38 void reopen(); 39 39 QString _fileName; 40 40 std::ofstream* _out; 41 private:42 41 QDate _fileDate; 43 42 };
Note:
See TracChangeset
for help on using the changeset viewer.