Index: trunk/BNC/bancroft.cpp
===================================================================
--- trunk/BNC/bancroft.cpp (revision 4277)
+++ (revision )
@@ -1,79 +1,0 @@
-
-#include
-
-#include "bancroft.h"
-#include "bncconst.h"
-
-void bancroft(const Matrix& BBpass, ColumnVector& pos) {
-
- if (pos.Nrows() != 4) {
- pos.ReSize(4);
- }
- pos = 0.0;
-
- for (int iter = 1; iter <= 2; iter++) {
- Matrix BB = BBpass;
- int mm = BB.Nrows();
- for (int ii = 1; ii <= mm; ii++) {
- double xx = BB(ii,1);
- double yy = BB(ii,2);
- double traveltime = 0.072;
- if (iter > 1) {
- double zz = BB(ii,3);
- double rho = sqrt( (xx-pos(1)) * (xx-pos(1)) +
- (yy-pos(2)) * (yy-pos(2)) +
- (zz-pos(3)) * (zz-pos(3)) );
- traveltime = rho / t_CST::c;
- }
- double angle = traveltime * t_CST::omega;
- double cosa = cos(angle);
- double sina = sin(angle);
- BB(ii,1) = cosa * xx + sina * yy;
- BB(ii,2) = -sina * xx + cosa * yy;
- }
-
- Matrix BBB;
- if (mm > 4) {
- SymmetricMatrix hlp; hlp << BB.t() * BB;
- BBB = hlp.i() * BB.t();
- }
- else {
- BBB = BB.i();
- }
- ColumnVector ee(mm); ee = 1.0;
- ColumnVector alpha(mm); alpha = 0.0;
- for (int ii = 1; ii <= mm; ii++) {
- alpha(ii) = lorentz(BB.Row(ii).t(),BB.Row(ii).t())/2.0;
- }
- ColumnVector BBBe = BBB * ee;
- ColumnVector BBBalpha = BBB * alpha;
- double aa = lorentz(BBBe, BBBe);
- double bb = lorentz(BBBe, BBBalpha)-1;
- double cc = lorentz(BBBalpha, BBBalpha);
- double root = sqrt(bb*bb-aa*cc);
-
- Matrix hlpPos(4,2);
- hlpPos.Column(1) = (-bb-root)/aa * BBBe + BBBalpha;
- hlpPos.Column(2) = (-bb+root)/aa * BBBe + BBBalpha;
-
- ColumnVector omc(2);
- for (int pp = 1; pp <= 2; pp++) {
- hlpPos(4,pp) = -hlpPos(4,pp);
- omc(pp) = BB(1,4) -
- sqrt( (BB(1,1)-hlpPos(1,pp)) * (BB(1,1)-hlpPos(1,pp)) +
- (BB(1,2)-hlpPos(2,pp)) * (BB(1,2)-hlpPos(2,pp)) +
- (BB(1,3)-hlpPos(3,pp)) * (BB(1,3)-hlpPos(3,pp)) ) -
- hlpPos(4,pp);
- }
- if ( fabs(omc(1)) > fabs(omc(2)) ) {
- pos = hlpPos.Column(2);
- }
- else {
- pos = hlpPos.Column(1);
- }
- }
-}
-
-double lorentz(const ColumnVector& aa, const ColumnVector& bb) {
- return aa(1)*bb(1) + aa(2)*bb(2) + aa(3)*bb(3) - aa(4)*bb(4);
-}
Index: trunk/BNC/bancroft.h
===================================================================
--- trunk/BNC/bancroft.h (revision 4277)
+++ (revision )
@@ -1,12 +1,0 @@
-
-#ifndef BANCROFT_H
-#define BANCROFT_H
-
-#include
-
-void bancroft(const Matrix& BBpass, ColumnVector& pos);
-
-inline double lorentz(const ColumnVector& aa, const ColumnVector& bb);
-
-#endif
-
Index: trunk/BNC/bnc.pro
===================================================================
--- trunk/BNC/bnc.pro (revision 4277)
+++ (revision )
@@ -1,123 +1,0 @@
-
-# Switch to debug configuration
-# -----------------------------
-CONFIG -= debug
-CONFIG += release
-
-DEFINES += NO_RTCM3_MAIN
-###DEFINES += DEBUG_RTCM2_2021
-unix:DEFINES += _TTY_POSIX_
-win32:DEFINES += _TTY_WIN_
-
-RESOURCES += bnc.qrc
-
-unix:QMAKE_CFLAGS_RELEASE -= -O2
-unix:QMAKE_CXXFLAGS_RELEASE -= -O2
-
-# Get rid of mingwm10.dll and libgcc_s_dw2-1.dll
-# ----------------------------------------------
-win32 {
- QMAKE_LFLAGS += -static-libgcc
- QMAKE_LFLAGS -= -mthreads
- QMAKE_CXXFLAGS_EXCEPTIONS_ON -= -mthreads
- QMAKE_LFLAGS_EXCEPTIONS_ON -= -mthreads
-}
-
-debug:OBJECTS_DIR=.obj/debug
-debug:MOC_DIR=.moc/debug
-release:OBJECTS_DIR=.obj/release
-release:MOC_DIR=.moc/release
-
-# Include Path
-# ------------
-INCLUDEPATH = . ./newmat ./RTCM3 ./RTCM3/clock_and_orbit ./RTCM3/rtcm3torinex
-
-HEADERS = bnchelp.html bncgetthread.h bncwindow.h bnctabledlg.h \
- bnccaster.h bncrinex.h bncapp.h bncutils.h bnchlpdlg.h \
- bncconst.h bnchtml.h bnctableitem.h bnczerodecoder.h \
- bncnetquery.h bncnetqueryv1.h bncnetqueryv2.h \
- bncnetqueryrtp.h bncsettings.h latencychecker.h \
- bncipport.h bncnetqueryv0.h bncnetqueryudp.h \
- bncnetqueryudp0.h bncudpport.h bnctime.h pppopt.h \
- bncserialport.h bncnetquerys.h bncfigure.h \
- bncfigurelate.h bncpppclient.h bncversion.h \
- bancroft.h bncmodel.h bncfigureppp.h bncrawfile.h \
- bnctides.h bncmap.h bncmapview.h bncantex.h \
- bncephuser.h bncoutf.h bncclockrinex.h bncsp3.h \
- bncbytescounter.h bncsslconfig.h reqcdlg.h \
- upload/bncrtnetdecoder.h upload/bncuploadcaster.h \
- upload/bncrtnetuploadcaster.h upload/bnccustomtrafo.h \
- upload/bncephuploadcaster.h bnccomb.h qtfilechooser.h \
- RTCM/GPSDecoder.h RTCM/RTCM2.h RTCM/RTCM2Decoder.h \
- RTCM/RTCM2_2021.h RTCM/rtcm_utils.h \
- RTCM3/RTCM3Decoder.h RTCM3/rtcm3torinex/rtcm3torinex.h \
- RTCM3/RTCM3coDecoder.h \
- RTCM3/clock_and_orbit/clock_orbit_rtcm.h \
- RTCM3/ephemeris.h RTCM3/timeutils.h \
- GPSS/gpssDecoder.h GPSS/hassDecoder.h
-
-HEADERS += serial/qextserialbase.h serial/qextserialport.h
-unix:HEADERS += serial/posix_qextserialport.h
-win32:HEADERS += serial/win_qextserialport.h
-
-HEADERS += newmat/controlw.h newmat/include.h newmat/myexcept.h \
- newmat/newmatap.h newmat/newmat.h newmat/newmatio.h \
- newmat/newmatrc.h newmat/newmatrm.h newmat/precisio.h
-
-SOURCES = bncmain.cpp bncgetthread.cpp bncwindow.cpp bnctabledlg.cpp \
- bnccaster.cpp bncrinex.cpp bncapp.cpp bncutils.cpp \
- bncconst.cpp bnchtml.cpp bnchlpdlg.cpp bnctableitem.cpp \
- bnczerodecoder.cpp bncnetqueryv1.cpp bncnetqueryv2.cpp \
- bncnetqueryrtp.cpp bncsettings.cpp latencychecker.cpp \
- bncipport.cpp bncnetqueryv0.cpp bncnetqueryudp.cpp \
- bncnetqueryudp0.cpp bncudpport.cpp pppopt.cpp \
- bncserialport.cpp bncnetquerys.cpp bncfigure.cpp \
- bncfigurelate.cpp bncpppclient.cpp bnctime.cpp \
- bancroft.cpp bncmodel.cpp bncfigureppp.cpp bncrawfile.cpp \
- bnctides.cpp bncmap.cpp bncmapview.cpp bncantex.cpp \
- bncephuser.cpp bncoutf.cpp bncclockrinex.cpp bncsp3.cpp \
- bncbytescounter.cpp bncsslconfig.cpp reqcdlg.cpp \
- upload/bncrtnetdecoder.cpp upload/bncuploadcaster.cpp \
- upload/bncrtnetuploadcaster.cpp upload/bnccustomtrafo.cpp \
- upload/bncephuploadcaster.cpp qtfilechooser.cpp \
- RTCM/GPSDecoder.cpp RTCM/RTCM2.cpp RTCM/RTCM2Decoder.cpp \
- RTCM/RTCM2_2021.cpp RTCM/rtcm_utils.cpp \
- RTCM3/RTCM3Decoder.cpp RTCM3/rtcm3torinex/rtcm3torinex.c \
- RTCM3/RTCM3coDecoder.cpp \
- RTCM3/clock_and_orbit/clock_orbit_rtcm.c \
- RTCM3/ephemeris.cpp RTCM3/timeutils.cpp \
- GPSS/gpssDecoder.cpp GPSS/hassDecoder.cpp
-
-SOURCES += serial/qextserialbase.cpp serial/qextserialport.cpp
-unix:SOURCES += serial/posix_qextserialport.cpp
-win32:SOURCES += serial/win_qextserialport.cpp
-
-SOURCES += newmat/bandmat.cpp newmat/cholesky.cpp newmat/evalue.cpp \
- newmat/fft.cpp newmat/hholder.cpp newmat/jacobi.cpp \
- newmat/myexcept.cpp newmat/newfft.cpp newmat/newmat1.cpp \
- newmat/newmat2.cpp newmat/newmat3.cpp newmat/newmat4.cpp \
- newmat/newmat5.cpp newmat/newmat6.cpp newmat/newmat7.cpp \
- newmat/newmat8.cpp newmat/newmat9.cpp newmat/newmatex.cpp \
- newmat/newmatrm.cpp newmat/nm_misc.cpp newmat/sort.cpp \
- newmat/submat.cpp newmat/svd.cpp
-
-RC_FILE = bnc.rc
-
-QT += network
-
-exists(combination/bnccomb.h) {
- DEFINES += USE_COMBINATION
- HEADERS += combination/bnccomb.h
- SOURCES += combination/bnccomb.cpp
-}
-
-exists(rinex/bncpostprocess.h) {
- DEFINES += USE_POSTPROCESSING
- HEADERS += rinex/bncpostprocess.h rinex/rnxobsfile.h \
- rinex/rnxnavfile.h rinex/corrfile.h \
- rinex/reqcedit.h rinex/reqcanalyze.h
- SOURCES += rinex/bncpostprocess.cpp rinex/rnxobsfile.cpp \
- rinex/rnxnavfile.cpp rinex/corrfile.cpp \
- rinex/reqcedit.cpp rinex/reqcanalyze.cpp
-}
-
Index: trunk/BNC/bncantex.cpp
===================================================================
--- trunk/BNC/bncantex.cpp (revision 4277)
+++ (revision )
@@ -1,275 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncAntex
- *
- * Purpose: Antenna Phase Centers and Variations from ANTEX File
- *
- * Author: L. Mervart
- *
- * Created: 26-Jan-2011
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-#include
-
-#include "bncantex.h"
-#include "bnctides.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncAntex::bncAntex() {
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncAntex::~bncAntex() {
- QMapIterator it(_maps);
- while (it.hasNext()) {
- it.next();
- delete it.value();
- }
-}
-
-// Print
-////////////////////////////////////////////////////////////////////////////
-void bncAntex::print() const {
- QMapIterator it(_maps);
- while (it.hasNext()) {
- it.next();
- t_antMap* map = it.value();
- cout << map->antName.toAscii().data() << endl;
- cout << " " << map->zen1 << " " << map->zen2 << " " << map->dZen << endl;
- if (map->frqMapL1) {
- cout << " " << map->frqMapL1->neu[0] << " "
- << map->frqMapL1->neu[1] << " "
- << map->frqMapL1->neu[2] << endl;
- cout << " " << map->frqMapL1->pattern.t();
- }
- if (map->frqMapL2) {
- cout << " " << map->frqMapL2->neu[0] << " "
- << map->frqMapL2->neu[1] << " "
- << map->frqMapL2->neu[2] << endl;
- cout << " " << map->frqMapL2->pattern.t();
- }
- cout << endl;
- }
-}
-
-// Read ANTEX File
-////////////////////////////////////////////////////////////////////////////
-t_irc bncAntex::readFile(const QString& fileName) {
-
- QFile inFile(fileName);
- inFile.open(QIODevice::ReadOnly | QIODevice::Text);
-
- QTextStream in(&inFile);
-
- t_antMap* newAntMap = 0;
- t_frqMap* newFrqMap = 0;
-
- while ( !in.atEnd() ) {
- QString line = in.readLine();
-
- // Start of Antenna
- // ----------------
- if (line.indexOf("START OF ANTENNA") == 60) {
- if (newAntMap) {
- delete newAntMap;
- return failure;
- }
- else {
- delete newAntMap;
- newAntMap = new t_antMap();
- }
- }
-
- // End of Antenna
- // --------------
- else if (line.indexOf("END OF ANTENNA") == 60) {
- if (newAntMap) {
- if (_maps.contains(newAntMap->antName)) {
- delete _maps[newAntMap->antName];
- }
- _maps[newAntMap->antName] = newAntMap;
- newAntMap = 0;
- }
- else {
- delete newAntMap;
- return failure;
- }
- }
-
- // Antenna Reading in Progress
- // ---------------------------
- else if (newAntMap) {
- if (line.indexOf("TYPE / SERIAL NO") == 60) {
- if (line.indexOf("BLOCK I") == 0 ||
- line.indexOf("GLONASS") == 0) {
- newAntMap->antName = line.mid(20,3);
- }
- else {
- newAntMap->antName = line.mid(0,20);
- }
- }
- else if (line.indexOf("ZEN1 / ZEN2 / DZEN") == 60) {
- QTextStream inLine(&line, QIODevice::ReadOnly);
- inLine >> newAntMap->zen1 >> newAntMap->zen2 >> newAntMap->dZen;
- }
-
- // Start of Frequency
- // ------------------
- else if (line.indexOf("START OF FREQUENCY") == 60) {
- if (newFrqMap) {
- delete newFrqMap;
- delete newAntMap;
- return failure;
- }
- else {
- newFrqMap = new t_frqMap();
- }
- }
-
- // End of Frequency
- // ----------------
- else if (line.indexOf("END OF FREQUENCY") == 60) {
- if (newFrqMap) {
- if (line.indexOf("G01") == 3 || line.indexOf("R01") == 3) {
- delete newAntMap->frqMapL1;
- newAntMap->frqMapL1 = newFrqMap;
- }
- else if (line.indexOf("G02") == 3 || line.indexOf("R02") == 3) {
- delete newAntMap->frqMapL2;
- newAntMap->frqMapL2 = newFrqMap;
- }
- else {
- delete newFrqMap;
- }
- newFrqMap = 0;
- }
- else {
- delete newAntMap;
- return failure;
- }
- }
-
- // Frequency Reading in Progress
- // -----------------------------
- else if (newFrqMap) {
- if (line.indexOf("NORTH / EAST / UP") == 60) {
- QTextStream inLine(&line, QIODevice::ReadOnly);
- inLine >> newFrqMap->neu[0] >> newFrqMap->neu[1] >> newFrqMap->neu[2];
- newFrqMap->neu[0] *= 1e-3;
- newFrqMap->neu[1] *= 1e-3;
- newFrqMap->neu[2] *= 1e-3;
- }
- else if (line.indexOf("NOAZI") == 3) {
- QTextStream inLine(&line, QIODevice::ReadOnly);
- int nPat = int((newAntMap->zen2-newAntMap->zen1)/newAntMap->dZen) + 1;
- newFrqMap->pattern.ReSize(nPat);
- QString dummy;
- inLine >> dummy;
- for (int ii = 0; ii < nPat; ii++) {
- inLine >> newFrqMap->pattern[ii];
- }
- newFrqMap->pattern *= 1e-3;
- }
- }
- }
- }
-
- delete newFrqMap;
- delete newAntMap;
-
- return success;
-}
-
-// Satellite Antenna Offset
-////////////////////////////////////////////////////////////////////////////
-t_irc bncAntex::satCoMcorrection(const QString& prn, double Mjd,
- const ColumnVector& xSat, ColumnVector& dx) {
-
- QMap::const_iterator it = _maps.find(prn);
- if (it != _maps.end()) {
- t_antMap* map = it.value();
- double* neu = map->frqMapL1->neu;
-
- // Unit Vectors sz, sy, sx
- // -----------------------
- ColumnVector sz = -xSat;
- sz /= sqrt(DotProduct(sz,sz));
-
- ColumnVector xSun = Sun(Mjd);
- xSun /= sqrt(DotProduct(xSun,xSun));
-
- ColumnVector sy = crossproduct(sz, xSun);
- sy /= sqrt(DotProduct(sy,sy));
-
- ColumnVector sx = crossproduct(sy, sz);
-
- dx[0] = sx[0] * neu[0] + sy[0] * neu[1] + sz[0] * neu[2];
- dx[1] = sx[1] * neu[0] + sy[1] * neu[1] + sz[1] * neu[2];
- dx[2] = sx[2] * neu[0] + sy[2] * neu[1] + sz[2] * neu[2];
-
- return success;
- }
- else {
- return failure;
- }
-}
-
-// Phase Center Offset (Receiver Antenna and GPS only)
-////////////////////////////////////////////////////////////////////////////
-double bncAntex::pco(const QString& antName, double eleSat, bool& found) {
-
- static const double f1 = t_CST::freq1;
- static const double f2 = t_CST::freq2;
- static const double c1 = f1 * f1 / (f1 * f1 - f2 * f2);
- static const double c2 = - f2 * f2 / (f1 * f1 - f2 * f2);
-
- QMap::const_iterator it = _maps.find(antName);
- if (it != _maps.end()) {
- found = true;
- t_antMap* map = it.value();
- if (map->frqMapL1 && map->frqMapL2) {
- double corr1 = -map->frqMapL1->neu[2] * sin(eleSat);
- double corr2 = -map->frqMapL2->neu[2] * sin(eleSat);
- return c1 * corr1 + c2 * corr2;
- }
- }
- else {
- found = false;
- }
-
- return 0.0;
-}
Index: trunk/BNC/bncantex.h
===================================================================
--- trunk/BNC/bncantex.h (revision 4277)
+++ (revision )
@@ -1,74 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCANTEX_H
-#define BNCANTEX_H
-
-#include
-#include
-#include "bncconst.h"
-#include "bnctime.h"
-
-class bncAntex {
- public:
- bncAntex();
- ~bncAntex();
- t_irc readFile(const QString& fileName);
- void print() const;
- double pco(const QString& antName, double eleSat, bool& found);
- t_irc satCoMcorrection(const QString& prn, double Mjd,
- const ColumnVector& xSat, ColumnVector& dx);
-
- private:
-
- class t_frqMap {
- public:
- double neu[3];
- ColumnVector pattern;
- };
-
- class t_antMap {
- public:
- t_antMap() {
- frqMapL1 = 0;
- frqMapL2 = 0;
- }
- ~t_antMap() {
- delete frqMapL1;
- delete frqMapL2;
- }
- QString antName;
- double zen1;
- double zen2;
- double dZen;
- t_frqMap* frqMapL1;
- t_frqMap* frqMapL2;
- bncTime validFrom;
- bncTime validTo;
- };
-
- QMap _maps;
-};
-
-#endif
Index: trunk/BNC/bncapp.cpp
===================================================================
--- trunk/BNC/bncapp.cpp (revision 4277)
+++ (revision )
@@ -1,820 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncApp
- *
- * Purpose: This class implements the main application
- *
- * Author: L. Mervart
- *
- * Created: 29-Aug-2006
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-#include
-#include
-
-#include "bncapp.h"
-#include "bncutils.h"
-#include "bncrinex.h"
-#include "bncsettings.h"
-#include "bncversion.h"
-#include "RTCM3/ephemeris.h"
-
-#ifdef USE_COMBINATION
-#include "combination/bnccomb.h"
-#endif
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncApp::bncApp(int& argc, char* argv[], bool GUIenabled) :
- QApplication(argc, argv, GUIenabled) {
-
- _logFileFlag = 0;
- _logFile = 0;
- _logStream = 0;
- _caster = 0;
- _rawFile = 0;
-#ifdef USE_COMBINATION
- _bncComb = 0;
-#endif
-
- // Lists of Ephemeris
- // ------------------
- for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
- _gpsEph[ii-PRN_GPS_START] = 0;
- }
- for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
- _glonassEph[ii-PRN_GLONASS_START] = 0;
- }
- for (int ii = PRN_GALILEO_START; ii <= PRN_GALILEO_END; ii++) {
- _galileoEph[ii-PRN_GALILEO_START] = 0;
- }
-
- // Eph file(s)
- // -----------
- _rinexVers = 0;
- _ephFileGPS = 0;
- _ephStreamGPS = 0;
- _ephFileGlonass = 0;
- _ephStreamGlonass = 0;
- _ephFileGalileo = 0;
- _ephStreamGalileo = 0;
-
- _port = 0;
- _server = 0;
- _sockets = 0;
-
- _portCorr = 0;
- _serverCorr = 0;
- _socketsCorr = 0;
-
- _pgmName = QString(BNCPGMNAME).leftJustified(20, ' ', true);
-#ifdef WIN32
- _userName = QString("${USERNAME}");
-#else
- _userName = QString("${USER}");
-#endif
- expandEnvVar(_userName);
- _userName = _userName.leftJustified(20, ' ', true);
-
- _lastDumpCoSec = 0;
-
- _corrs = new QMultiMap;
-
- _currentDateAndTimeGPS = 0;
-
- for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
- _GLOFreq[ii] = 0;
- }
-
- _bncPPPclient = 0;
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncApp::~bncApp() {
- delete _logStream;
- delete _logFile;
- delete _ephStreamGPS;
- delete _ephFileGPS;
- delete _server;
- delete _sockets;
- delete _serverCorr;
- delete _socketsCorr;
- if (_rinexVers == 2) {
- delete _ephStreamGlonass;
- delete _ephFileGlonass;
- }
- for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
- delete _gpsEph[ii-PRN_GPS_START];
- }
- for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
- delete _glonassEph[ii-PRN_GLONASS_START];
- }
- for (int ii = PRN_GALILEO_START; ii <= PRN_GALILEO_END; ii++) {
- delete _galileoEph[ii-PRN_GALILEO_START];
- }
-
- delete _corrs;
-
- delete _currentDateAndTimeGPS;
-
- delete _rawFile;
-
-#ifdef USE_COMBINATION
- delete _bncComb;
-#endif
-}
-
-// Write a Program Message
-////////////////////////////////////////////////////////////////////////////
-void bncApp::slotMessage(QByteArray msg, bool showOnScreen) {
-
- QMutexLocker locker(&_mutexMessage);
-
- messagePrivate(msg);
- emit newMessage(msg, showOnScreen);
-}
-
-// Write a Program Message (private, no lock)
-////////////////////////////////////////////////////////////////////////////
-void bncApp::messagePrivate(const QByteArray& msg) {
-
- // First time resolve the log file name
- // ------------------------------------
- QDate currDate = currentDateAndTimeGPS().date();
- if (_logFileFlag == 0 || _fileDate != currDate) {
- delete _logStream; _logStream = 0;
- delete _logFile; _logFile = 0;
- _logFileFlag = 1;
- bncSettings settings;
- QString logFileName = settings.value("logFile").toString();
- if ( !logFileName.isEmpty() ) {
- expandEnvVar(logFileName);
- _logFile = new QFile(logFileName + "_" +
- currDate.toString("yyMMdd").toAscii().data());
- _fileDate = currDate;
- if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
- _logFile->open(QIODevice::WriteOnly | QIODevice::Append);
- }
- else {
- _logFile->open(QIODevice::WriteOnly);
- }
- _logStream = new QTextStream();
- _logStream->setDevice(_logFile);
- }
- }
-
- if (_logStream) {
- QByteArray msgLocal = msg;
- if (msg.indexOf('\n') == 0) {
- *_logStream << endl;
- msgLocal = msg.mid(1);
- }
- *_logStream << currentDateAndTimeGPS().toString("yy-MM-dd hh:mm:ss ").toAscii().data();
- *_logStream << msgLocal.data() << endl;
- _logStream->flush();
- _logFile->flush();
- }
-}
-
-// New GPS Ephemeris
-////////////////////////////////////////////////////////////////////////////
-void bncApp::slotNewGPSEph(gpsephemeris* gpseph) {
-
- QMutexLocker locker(&_mutex);
-
- gpsephemeris copy_gpseph = *gpseph;
- emit newEphGPS(copy_gpseph);
-
- printEphHeader();
-
- gpsephemeris** ee = &_gpsEph[gpseph->satellite-1];
-
- if ( *ee != 0 &&
- gpseph->GPSweek == (*ee)->GPSweek && gpseph->TOC == (*ee)->TOC ) {
- checkEphemeris(*ee, gpseph);
- }
-
- if ( *ee == 0 ||
- gpseph->GPSweek > (*ee)->GPSweek ||
- (gpseph->GPSweek == (*ee)->GPSweek && gpseph->TOC > (*ee)->TOC) ) {
- delete *ee;
- *ee = gpseph;
- printGPSEph(gpseph, true);
- }
- else {
- printGPSEph(gpseph, false);
- delete gpseph;
- }
-}
-
-// New Glonass Ephemeris
-////////////////////////////////////////////////////////////////////////////
-void bncApp::slotNewGlonassEph(glonassephemeris* glonasseph) {
-
- QMutexLocker locker(&_mutex);
-
- glonassephemeris copy_glonasseph = *glonasseph;
- emit newEphGlonass(copy_glonasseph);
-
- printEphHeader();
-
- glonassephemeris** ee = &_glonassEph[glonasseph->almanac_number-1];
-
- int wwOld, towOld, wwNew, towNew;
- if (*ee != 0) {
- wwOld = (*ee)->GPSWeek;
- towOld = (*ee)->GPSTOW;
- updatetime(&wwOld, &towOld, (*ee)->tb*1000, 0); // Moscow -> GPS
-
- wwNew = glonasseph->GPSWeek;
- towNew = glonasseph->GPSTOW;
- updatetime(&wwNew, &towNew, glonasseph->tb*1000, 0); // Moscow -> GPS
- }
-
- if ( *ee == 0 ||
- wwNew > wwOld ||
- (wwNew == wwOld && towNew > towOld) ) {
- delete *ee;
- *ee = glonasseph;
- printGlonassEph(glonasseph, true);
- }
- else {
- printGlonassEph(glonasseph, false);
- delete glonasseph;
- }
-}
-
-// New Galileo Ephemeris
-////////////////////////////////////////////////////////////////////////////
-void bncApp::slotNewGalileoEph(galileoephemeris* galileoeph) {
-
- QMutexLocker locker(&_mutex);
-
- galileoephemeris copy_galileoeph = *galileoeph;
- emit newEphGalileo(copy_galileoeph);
-
- printEphHeader();
-
- int galIndex = galileoeph->satellite;
- /* GIOVE */
- if(galIndex == 51) galIndex = 1;
- else if(galIndex == 52) galIndex = 16;
- if (galIndex < 0 || galIndex > PRN_GALILEO_END - PRN_GALILEO_START) {
- emit( newMessage("Wrong Galileo Satellite Number", true) );
- exit(1);
- }
-
- galileoephemeris** ee = &_galileoEph[galIndex];
-
- if ( *ee == 0 ||
- galileoeph->Week > (*ee)->Week ||
- (galileoeph->Week == (*ee)->Week && galileoeph->TOC > (*ee)->TOC) ) {
- delete *ee;
- *ee = galileoeph;
- printGalileoEph(galileoeph, true);
- }
- else {
- printGalileoEph(galileoeph, false);
- delete galileoeph;
- }
-}
-
-// Print Header of the output File(s)
-////////////////////////////////////////////////////////////////////////////
-void bncApp::printEphHeader() {
-
- bncSettings settings;
-
- // Initialization
- // --------------
- if (_rinexVers == 0) {
-
- if ( Qt::CheckState(settings.value("ephV3").toInt()) == Qt::Checked) {
- _rinexVers = 3;
- }
- else {
- _rinexVers = 2;
- }
-
- _ephPath = settings.value("ephPath").toString();
-
- if ( !_ephPath.isEmpty() ) {
- if ( _ephPath[_ephPath.length()-1] != QDir::separator() ) {
- _ephPath += QDir::separator();
- }
- expandEnvVar(_ephPath);
- }
- }
-
- // (Re-)Open output File(s)
- // ------------------------
- if (!_ephPath.isEmpty()) {
-
- QDateTime datTim = currentDateAndTimeGPS();
-
- QString ephFileNameGPS = _ephPath + "BRDC" +
- QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0'));
-
- QString hlpStr = bncRinex::nextEpochStr(datTim,
- settings.value("ephIntr").toString());
-
- if (_rinexVers == 3) {
- ephFileNameGPS += hlpStr + datTim.toString(".yyP");
- }
- else {
- ephFileNameGPS += hlpStr + datTim.toString(".yyN");
- }
-
- if (_ephFileNameGPS == ephFileNameGPS) {
- return;
- }
- else {
- _ephFileNameGPS = ephFileNameGPS;
- }
-
- for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
- delete _gpsEph[ii-PRN_GPS_START];
- _gpsEph[ii-PRN_GPS_START] = 0;
- }
- for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
- delete _glonassEph[ii-PRN_GLONASS_START];
- _glonassEph[ii-PRN_GLONASS_START] = 0;
- }
- for (int ii = PRN_GALILEO_START; ii <= PRN_GALILEO_END; ii++) {
- delete _galileoEph[ii-PRN_GALILEO_START];
- _galileoEph[ii-PRN_GALILEO_START] = 0;
- }
-
- delete _ephStreamGPS;
- delete _ephFileGPS;
-
- QFlags appendFlagGPS;
- QFlags appendFlagGlonass;
- QFlags appendFlagGalileo;
-
- if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked &&
- QFile::exists(ephFileNameGPS) ) {
- appendFlagGPS = QIODevice::Append;
- }
-
- _ephFileGPS = new QFile(ephFileNameGPS);
- _ephFileGPS->open(QIODevice::WriteOnly | appendFlagGPS);
- _ephStreamGPS = new QTextStream();
- _ephStreamGPS->setDevice(_ephFileGPS);
-
- if (_rinexVers == 3) {
- _ephFileGlonass = _ephFileGPS;
- _ephStreamGlonass = _ephStreamGPS;
- _ephFileGalileo = _ephFileGPS;
- _ephStreamGalileo = _ephStreamGPS;
- }
- else if (_rinexVers == 2) {
- QString ephFileNameGlonass = _ephPath + "BRDC" +
- QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0')) +
- hlpStr + datTim.toString(".yyG");
-
- delete _ephStreamGlonass;
- delete _ephFileGlonass;
-
- if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked &&
- QFile::exists(ephFileNameGlonass) ) {
- appendFlagGlonass = QIODevice::Append;
- }
-
- _ephFileGlonass = new QFile(ephFileNameGlonass);
- _ephFileGlonass->open(QIODevice::WriteOnly | appendFlagGlonass);
- _ephStreamGlonass = new QTextStream();
- _ephStreamGlonass->setDevice(_ephFileGlonass);
- }
-
- // Header - RINEX Version 3
- // ------------------------
- if (_rinexVers == 3) {
- if ( ! (appendFlagGPS & QIODevice::Append)) {
- QString line;
- line.sprintf(
- "%9.2f%11sN: GNSS NAV DATA M: Mixed%12sRINEX VERSION / TYPE\n",
- 3.0, "", "");
- *_ephStreamGPS << line;
-
- QString hlp = currentDateAndTimeGPS().toString("yyyyMMdd hhmmss UTC").leftJustified(20, ' ', true);
- *_ephStreamGPS << _pgmName.toAscii().data()
- << _userName.toAscii().data()
- << hlp.toAscii().data()
- << "PGM / RUN BY / DATE" << endl;
-
- line.sprintf("%60sEND OF HEADER\n", "");
- *_ephStreamGPS << line;
-
- _ephStreamGPS->flush();
- }
- }
-
- // Headers - RINEX Version 2
- // -------------------------
- else if (_rinexVers == 2) {
- if (! (appendFlagGPS & QIODevice::Append)) {
- QString line;
- line.sprintf(
- "%9.2f%11sN: GPS NAV DATA%25sRINEX VERSION / TYPE\n", 2.10, "", "");
- *_ephStreamGPS << line;
-
- QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
- *_ephStreamGPS << _pgmName.toAscii().data()
- << _userName.toAscii().data()
- << hlp.toAscii().data()
- << "PGM / RUN BY / DATE" << endl;
-
- line.sprintf("%60sEND OF HEADER\n", "");
- *_ephStreamGPS << line;
-
- _ephStreamGPS->flush();
- }
- if (! (appendFlagGlonass & QIODevice::Append)) {
- QString line;
- line.sprintf(
- "%9.2f%11sG: GLONASS NAV DATA%21sRINEX VERSION / TYPE\n",2.10,"","");
- *_ephStreamGlonass << line;
-
- QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
- *_ephStreamGlonass << _pgmName.toAscii().data()
- << _userName.toAscii().data()
- << hlp.toAscii().data()
- << "PGM / RUN BY / DATE" << endl;
-
- line.sprintf("%60sEND OF HEADER\n", "");
- *_ephStreamGlonass << line;
-
- _ephStreamGlonass->flush();
- }
- }
- }
-}
-
-// Print One GPS Ephemeris
-////////////////////////////////////////////////////////////////////////////
-void bncApp::printGPSEph(gpsephemeris* ep, bool printFile) {
-
- t_ephGPS eph;
- eph.set(ep);
-
- QString strV2 = eph.toString(2.11);
- QString strV3 = eph.toString(3.01);
-
- printOutput(printFile, _ephStreamGPS, strV2, strV3);
-}
-
-// Print One Glonass Ephemeris
-////////////////////////////////////////////////////////////////////////////
-void bncApp::printGlonassEph(glonassephemeris* ep, bool printFile) {
-
- t_ephGlo eph;
- eph.set(ep);
-
- QString strV2 = eph.toString(2.11);
- QString strV3 = eph.toString(3.01);
-
- printOutput(printFile, _ephStreamGlonass, strV2, strV3);
-}
-
-// Print One Galileo Ephemeris
-////////////////////////////////////////////////////////////////////////////
-void bncApp::printGalileoEph(galileoephemeris* ep, bool printFile) {
-
- t_ephGal eph;
- eph.set(ep);
-
- QString strV2 = eph.toString(2.11);
- QString strV3 = eph.toString(3.01);
-
- printOutput(printFile, _ephStreamGalileo, strV2, strV3);
-}
-
-// Output
-////////////////////////////////////////////////////////////////////////////
-void bncApp::printOutput(bool printFile, QTextStream* stream,
- const QString& strV2, const QString& strV3) {
-
- // Output into file
- // ----------------
- if (printFile && stream) {
- if (_rinexVers == 2) {
- *stream << strV2.toAscii();
- }
- else {
- *stream << strV3.toAscii();
- }
- stream->flush();
- }
-
- // Output into the socket
- // ----------------------
- if (_sockets) {
- QMutableListIterator is(*_sockets);
- while (is.hasNext()) {
- QTcpSocket* sock = is.next();
- if (sock->state() == QAbstractSocket::ConnectedState) {
- if (sock->write(strV3.toAscii()) == -1) {
- delete sock;
- is.remove();
- }
- }
- else if (sock->state() != QAbstractSocket::ConnectingState) {
- delete sock;
- is.remove();
- }
- }
- }
-}
-
-// Set Port Number
-////////////////////////////////////////////////////////////////////////////
-void bncApp::setPort(int port) {
- _port = port;
- if (_port != 0) {
- delete _server;
- _server = new QTcpServer;
- if ( !_server->listen(QHostAddress::Any, _port) ) {
- slotMessage("bncApp: Cannot listen on ephemeris port", true);
- }
- connect(_server, SIGNAL(newConnection()), this, SLOT(slotNewConnection()));
- delete _sockets;
- _sockets = new QList;
- }
-}
-
-// Set Port Number
-////////////////////////////////////////////////////////////////////////////
-void bncApp::setPortCorr(int port) {
- _portCorr = port;
- if (_portCorr != 0) {
- delete _serverCorr;
- _serverCorr = new QTcpServer;
- if ( !_serverCorr->listen(QHostAddress::Any, _portCorr) ) {
- slotMessage("bncApp: Cannot listen on correction port", true);
- }
- connect(_serverCorr, SIGNAL(newConnection()), this, SLOT(slotNewConnectionCorr()));
- delete _socketsCorr;
- _socketsCorr = new QList;
- }
-}
-
-// New Connection
-////////////////////////////////////////////////////////////////////////////
-void bncApp::slotNewConnection() {
- _sockets->push_back( _server->nextPendingConnection() );
-}
-
-// New Connection
-////////////////////////////////////////////////////////////////////////////
-void bncApp::slotNewConnectionCorr() {
- _socketsCorr->push_back( _serverCorr->nextPendingConnection() );
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncApp::slotQuit() {
- cout << "bncApp::slotQuit" << endl;
- delete _caster;
- quit();
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncApp::slotNewCorrLine(QString line, QString staID, long coTime) {
-
- QMutexLocker locker(&_mutex);
-
- // Combination of Corrections
- // --------------------------
-#ifdef USE_COMBINATION
- if (_bncComb) {
- _bncComb->processCorrLine(staID, line);
- }
-#endif
-
- bncSettings settings;
- _waitCoTime = settings.value("corrTime").toInt();
- if (_waitCoTime < 0) {
- _waitCoTime = 0;
- }
-
- // First time, set the _lastDumpSec immediately
- // --------------------------------------------
- if (_lastDumpCoSec == 0) {
- _lastDumpCoSec = coTime - 1;
- }
-
- // An old correction - throw it away
- // ---------------------------------
- if (_waitCoTime > 0 && coTime <= _lastDumpCoSec) {
- if (!_bncComb) {
- QString line = staID + ": Correction for one sat neglected because overaged by " +
- QString().sprintf(" %ld sec",
- _lastDumpCoSec - coTime + _waitCoTime);
- messagePrivate(line.toAscii());
- emit( newMessage(line.toAscii(), true) );
- }
- return;
- }
-
- _corrs->insert(coTime, QString(line + " " + staID));
-
- // Dump Corrections
- // ----------------
- if (_waitCoTime == 0) {
- dumpCorrs();
- }
- else if (coTime - _waitCoTime > _lastDumpCoSec) {
- dumpCorrs(_lastDumpCoSec + 1, coTime - _waitCoTime);
- _lastDumpCoSec = coTime - _waitCoTime;
- }
-}
-
-// Dump Complete Correction Epochs
-////////////////////////////////////////////////////////////////////////////
-void bncApp::dumpCorrs(long minTime, long maxTime) {
- for (long sec = minTime; sec <= maxTime; sec++) {
- QList allCorrs = _corrs->values(sec);
- dumpCorrs(allCorrs);
- _corrs->remove(sec);
- }
-}
-
-// Dump all corrections
-////////////////////////////////////////////////////////////////////////////
-void bncApp::dumpCorrs() {
- QList allCorrs;
- QMutableMapIterator it(*_corrs);
- while (it.hasNext()) {
- allCorrs << it.next().value();
- it.remove();
- }
- dumpCorrs(allCorrs);
-}
-
-// Dump List of Corrections
-////////////////////////////////////////////////////////////////////////////
-void bncApp::dumpCorrs(const QList& allCorrs) {
- emit newCorrections(allCorrs);
- if (_socketsCorr) {
- QListIterator it(allCorrs);
- while (it.hasNext()) {
- QString corrLine = it.next() + "\n";
-
- QMutableListIterator is(*_socketsCorr);
- while (is.hasNext()) {
- QTcpSocket* sock = is.next();
- if (sock->state() == QAbstractSocket::ConnectedState) {
- if (sock->write(corrLine.toAscii()) == -1) {
- delete sock;
- is.remove();
- }
- }
- else if (sock->state() != QAbstractSocket::ConnectingState) {
- delete sock;
- is.remove();
- }
- }
- }
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncApp::setConfFileName(const QString& confFileName) {
- if (confFileName.isEmpty()) {
- _confFileName = QDir::homePath() + QDir::separator()
- + ".config" + QDir::separator()
- + organizationName() + QDir::separator()
- + applicationName() + ".bnc";
- }
- else {
- _confFileName = confFileName;
- }
-}
-
-// Raw Output
-////////////////////////////////////////////////////////////////////////////
-void bncApp::writeRawData(const QByteArray& data, const QByteArray& staID,
- const QByteArray& format) {
-
- QMutexLocker locker(&_mutex);
-
- if (!_rawFile) {
- bncSettings settings;
- QByteArray fileName = settings.value("rawOutFile").toByteArray();
- if (!fileName.isEmpty()) {
- _rawFile = new bncRawFile(fileName, staID, bncRawFile::output);
- }
- }
-
- if (_rawFile) {
- _rawFile->writeRawData(data, staID, format);
- }
-}
-
-// Get Glonass Slot Numbers from Global Array
-////////////////////////////////////////////////////////////////////////////
-void bncApp::getGlonassSlotNums(int GLOFreq[]) {
-
- QMutexLocker locker(&_mutex);
-
- for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
- if (_GLOFreq[ii] != 0) {
- GLOFreq[ii] = _GLOFreq[ii];
- }
- }
-}
-
-// Store Glonass Slot Numbers to Global Array
-////////////////////////////////////////////////////////////////////////////
-void bncApp::storeGlonassSlotNums(const int GLOFreq[]) {
-
- QMutexLocker locker(&_mutex);
-
- for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
- if (GLOFreq[ii] != 0) {
- _GLOFreq[ii] = GLOFreq[ii];
- }
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncApp::initCombination() {
-#ifdef USE_COMBINATION
- _bncComb = new bncComb();
- if (_bncComb->nStreams() < 1) {
- delete _bncComb;
- _bncComb = 0;
- }
-#endif
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncApp::stopCombination() {
-#ifdef USE_COMBINATION
- delete _bncComb;
- _bncComb = 0;
-#endif
-}
-
-// Handling Events (virtual)
-////////////////////////////////////////////////////////////////////////////
-bool bncApp::event(QEvent* ev) {
-
- if (ev->type() == QEvent::FileOpen) { // currently happens on Mac only
- QString fileName = static_cast(ev)->file();
- setConfFileName(fileName);
- return true;
- }
-
- return QApplication::event(ev);
-}
-
-// Check Ephemeris Consistency
-////////////////////////////////////////////////////////////////////////////
-void bncApp::checkEphemeris(gpsephemeris* oldEph, gpsephemeris* newEph) {
- if (oldEph->clock_bias != newEph->clock_bias ||
- oldEph->clock_drift != newEph->clock_drift ||
- oldEph->clock_driftrate != newEph->clock_driftrate) {
- QString msg = currentDateAndTimeGPS().toString(Qt::ISODate) +
- QString(" %1 EPH DIFFERS\n").arg(oldEph->satellite);
- messagePrivate(msg.toAscii());
- }
-}
Index: trunk/BNC/bncapp.h
===================================================================
--- trunk/BNC/bncapp.h (revision 4277)
+++ (revision )
@@ -1,140 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCAPP_H
-#define BNCAPP_H
-
-#include
-
-#include "bnccaster.h"
-#include "bncrawfile.h"
-#include "RTCM3/RTCM3Decoder.h"
-
-class bncComb;
-class bncPPPclient;
-class bncTableItem;
-
-class bncApp : public QApplication {
- Q_OBJECT
-
- friend class bncSettings;
- QSettings::SettingsMap _settings;
-
- public:
- enum e_mode {interactive, nonInteractive, batchPostProcessing};
- bncApp(int& argc, char* argv[], bool GUIenabled);
- virtual ~bncApp();
- e_mode mode() const {return _mode;}
- void setMode(e_mode mode) {_mode = mode;}
- void setPort(int port);
- void setPortCorr(int port);
- void setCaster(bncCaster* caster) {_caster = caster;}
- QDateTime* _currentDateAndTimeGPS;
- void setConfFileName(const QString& confFileName);
- QString confFileName() const {return _confFileName;}
- void writeRawData(const QByteArray& data, const QByteArray& staID,
- const QByteArray& format);
- void storeGlonassSlotNums(const int GLOFreq[]);
- void getGlonassSlotNums(int GLOFreq[]);
- void initCombination();
- void stopCombination();
- const QString& pgmName() {return _pgmName;}
- const QString& userName() {return _userName;}
- protected:
- virtual bool event(QEvent* ev);
-
- public slots:
- void slotMessage(QByteArray msg, bool showOnScreen);
- void slotNewGPSEph(gpsephemeris* gpseph);
- void slotNewGlonassEph(glonassephemeris* glonasseph);
- void slotNewGalileoEph(galileoephemeris* galileoeph);
- void slotNewCorrLine(QString line, QString staID, long coTime);
- void slotQuit();
-
- signals:
- void newMessage(QByteArray msg, bool showOnScreen);
- void newEphGPS(gpsephemeris gpseph);
- void newEphGlonass(glonassephemeris glonasseph);
- void newEphGalileo(galileoephemeris galileoeph);
- void newCorrections(QList);
-
- private slots:
- void slotNewConnection();
- void slotNewConnectionCorr();
- private:
- void printEphHeader();
- void printGPSEph(gpsephemeris* ep, bool printFile);
- void printGlonassEph(glonassephemeris* ep, bool printFile);
- void printGalileoEph(galileoephemeris* ep, bool printFile);
- void printOutput(bool printFile, QTextStream* stream,
- const QString& strV2, const QString& strV3);
- void dumpCorrs(long minTime, long maxTime);
- void dumpCorrs();
- void dumpCorrs(const QList& allCorrs);
- void messagePrivate(const QByteArray& msg);
- void checkEphemeris(gpsephemeris* oldEph, gpsephemeris* newEph);
-
- QFile* _logFile;
- QTextStream* _logStream;
- int _logFileFlag;
- QMutex _mutex;
- QMutex _mutexMessage;
- QString _ephPath;
- QString _ephFileNameGPS;
- int _rinexVers;
- QFile* _ephFileGPS;
- QTextStream* _ephStreamGPS;
- QFile* _ephFileGlonass;
- QTextStream* _ephStreamGlonass;
- QFile* _ephFileGalileo;
- QTextStream* _ephStreamGalileo;
- gpsephemeris* _gpsEph[PRN_GPS_END - PRN_GPS_START + 1];
- glonassephemeris* _glonassEph[PRN_GLONASS_END - PRN_GLONASS_START + 1];
- galileoephemeris* _galileoEph[PRN_GALILEO_END - PRN_GALILEO_START + 1];
- QString _userName;
- QString _pgmName;
- int _port;
- QTcpServer* _server;
- QList* _sockets;
- int _portCorr;
- QTcpServer* _serverCorr;
- QList* _socketsCorr;
- int _portNMEA;
- QTcpServer* _serverNMEA;
- QList* _socketsNMEA;
- bncCaster* _caster;
- long _lastDumpCoSec;
- long _waitCoTime;
- QMultiMap* _corrs;
- QString _confFileName;
- QDate _fileDate;
- bncRawFile* _rawFile;
- int _GLOFreq[PRN_GLONASS_NUM];
- bncComb* _bncComb;
- e_mode _mode;
- public:
- bncPPPclient* _bncPPPclient;
- QMap _uploadTableItems;
-};
-#endif
Index: trunk/BNC/bncbytescounter.cpp
===================================================================
--- trunk/BNC/bncbytescounter.cpp (revision 4277)
+++ (revision )
@@ -1,72 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncBytesCounter
- *
- * Purpose: Re-Implements QLabel
- *
- * Author: L. Mervart
- *
- * Created: 03-Apr-2011
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include "bncbytescounter.h"
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncBytesCounter::bncBytesCounter() : QLabel() {
- _bytesRead = 0.0;
- setText(QString("%1 byte(s)").arg(0));
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncBytesCounter::~bncBytesCounter() {
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncBytesCounter::slotNewBytes(const QByteArray, double nbyte) {
-
- QMutexLocker locker(&_mutex);
-
- _bytesRead += nbyte;
-
- if (_bytesRead < 1e3) {
- setText(QString("%1 byte(s)").arg((int)_bytesRead));
- }
- else if (_bytesRead < 1e6) {
- setText(QString("%1 kB").arg(_bytesRead/1.e3, 5));
- }
- else {
- setText(QString("%1 MB").arg(_bytesRead/1.e6, 5));
- }
-}
Index: trunk/BNC/bncbytescounter.h
===================================================================
--- trunk/BNC/bncbytescounter.h (revision 4277)
+++ (revision )
@@ -1,45 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCBYTESCOUNTER_H
-#define BNCBYTESCOUNTER_H
-
-#include
-
-class bncBytesCounter : public QLabel {
- Q_OBJECT
-
- public:
- bncBytesCounter();
- ~bncBytesCounter();
-
- public slots:
- void slotNewBytes(const QByteArray staID, double nbyte);
-
- private:
- double _bytesRead;
- QMutex _mutex;
-};
-
-#endif
Index: trunk/BNC/bnccaster.cpp
===================================================================
--- trunk/BNC/bnccaster.cpp (revision 4277)
+++ (revision )
@@ -1,524 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncCaster
- *
- * Purpose: buffers and disseminates the data
- *
- * Author: L. Mervart
- *
- * Created: 24-Dec-2005
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-#include
-#include
-#include
-#include
-
-#include "bnccaster.h"
-#include "bncrinex.h"
-#include "bncapp.h"
-#include "bncgetthread.h"
-#include "bncutils.h"
-#include "bncsettings.h"
-#include "RTCM/GPSDecoder.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncCaster::bncCaster(const QString& outFileName, int port) {
-
- bncSettings settings;
-
- connect(this, SIGNAL(newMessage(QByteArray,bool)),
- (bncApp*) qApp, SLOT(slotMessage(const QByteArray,bool)));
-
- if ( !outFileName.isEmpty() ) {
- QString lName = outFileName;
- expandEnvVar(lName);
- _outFile = new QFile(lName);
- if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
- _outFile->open(QIODevice::WriteOnly | QIODevice::Append);
- }
- else {
- _outFile->open(QIODevice::WriteOnly);
- }
- _out = new QTextStream(_outFile);
- _out->setRealNumberNotation(QTextStream::FixedNotation);
- }
- else {
- _outFile = 0;
- _out = 0;
- }
-
- _port = port;
-
- if (_port != 0) {
- _server = new QTcpServer;
- if ( !_server->listen(QHostAddress::Any, _port) ) {
- emit newMessage("bncCaster: Cannot listen on sync port", true);
- }
- connect(_server, SIGNAL(newConnection()), this, SLOT(slotNewConnection()));
- _sockets = new QList;
- }
- else {
- _server = 0;
- _sockets = 0;
- }
-
- int uPort = settings.value("outUPort").toInt();
- if (uPort != 0) {
- _uServer = new QTcpServer;
- if ( !_uServer->listen(QHostAddress::Any, uPort) ) {
- emit newMessage("bncCaster: Cannot listen on usync port", true);
- }
- connect(_uServer, SIGNAL(newConnection()), this, SLOT(slotNewUConnection()));
- _uSockets = new QList;
- }
- else {
- _uServer = 0;
- _uSockets = 0;
- }
-
- int nmeaPort = settings.value("nmeaPort").toInt();
- if (nmeaPort != 0) {
- _nmeaServer = new QTcpServer;
- if ( !_nmeaServer->listen(QHostAddress::Any, nmeaPort) ) {
- emit newMessage("bncCaster: Cannot listen on port", true);
- }
- connect(_nmeaServer, SIGNAL(newConnection()), this, SLOT(slotNewNMEAConnection()));
- _nmeaSockets = new QList;
- }
- else {
- _nmeaServer = 0;
- _nmeaSockets = 0;
- }
-
- _epochs = new QMultiMap;
-
- _samplingRate = settings.value("binSampl").toInt();
- _waitTime = settings.value("waitTime").toInt();
- _lastDumpSec = 0;
- _confInterval = -1;
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncCaster::~bncCaster() {
-
- QMutexLocker locker(&_mutex);
-
- QListIterator it(_threads);
- while(it.hasNext()){
- bncGetThread* thread = it.next();
- thread->terminate();
- }
- delete _out;
- delete _outFile;
- delete _server;
- delete _sockets;
- delete _uServer;
- delete _uSockets;
- delete _nmeaServer;
- delete _nmeaSockets;
- delete _epochs;
-}
-
-// New Observations
-////////////////////////////////////////////////////////////////////////////
-void bncCaster::newObs(const QByteArray staID, bool firstObs, t_obs obs) {
-
- QMutexLocker locker(&_mutex);
-
- long iSec = long(floor(obs.GPSWeeks+0.5));
- long newTime = obs.GPSWeek * 7*24*3600 + iSec;
-
- // Rename the Station
- // ------------------
- strncpy(obs.StatID, staID.constData(),sizeof(obs.StatID));
- obs.StatID[sizeof(obs.StatID)-1] = '\0';
-
- // Output into the socket
- // ----------------------
- if (_uSockets) {
-
- ostringstream oStr;
- oStr.setf(ios::showpoint | ios::fixed);
- oStr << obs.StatID << " "
- << obs.GPSWeek << " "
- << setprecision(7) << obs.GPSWeeks << " "
- << bncRinex::asciiSatLine(obs) << endl;
-
- string hlpStr = oStr.str();
-
- QMutableListIterator is(*_uSockets);
- while (is.hasNext()) {
- QTcpSocket* sock = is.next();
- if (sock->state() == QAbstractSocket::ConnectedState) {
- int numBytes = hlpStr.length();
- if (myWrite(sock, hlpStr.c_str(), numBytes) != numBytes) {
- delete sock;
- is.remove();
- }
- }
- else if (sock->state() != QAbstractSocket::ConnectingState) {
- delete sock;
- is.remove();
- }
- }
- }
-
- // First time, set the _lastDumpSec immediately
- // --------------------------------------------
- if (_lastDumpSec == 0) {
- _lastDumpSec = newTime - 1;
- }
-
- // An old observation - throw it away
- // ----------------------------------
- if (newTime <= _lastDumpSec) {
- if (firstObs) {
- bncSettings settings;
- if ( !settings.value("outFile").toString().isEmpty() ||
- !settings.value("outPort").toString().isEmpty() ) {
-
- QTime enomtime = QTime(0,0,0).addSecs(iSec);
-
- emit( newMessage(QString("%1: Old epoch %2 (%3) thrown away")
- .arg(staID.data()).arg(iSec)
- .arg(enomtime.toString("HH:mm:ss"))
- .toAscii(), true) );
- }
- }
- return;
- }
-
- // Save the observation
- // --------------------
- _epochs->insert(newTime, obs);
-
- // Dump Epochs
- // -----------
- if (newTime - _waitTime > _lastDumpSec) {
- dumpEpochs(_lastDumpSec + 1, newTime - _waitTime);
- _lastDumpSec = newTime - _waitTime;
- }
-}
-
-// New Connection
-////////////////////////////////////////////////////////////////////////////
-void bncCaster::slotNewConnection() {
- _sockets->push_back( _server->nextPendingConnection() );
- emit( newMessage(QString("New client connection on sync port: # %1")
- .arg(_sockets->size()).toAscii(), true) );
-}
-
-void bncCaster::slotNewUConnection() {
- _uSockets->push_back( _uServer->nextPendingConnection() );
- emit( newMessage(QString("New client connection on usync port: # %1")
- .arg(_uSockets->size()).toAscii(), true) );
-}
-
-void bncCaster::slotNewNMEAConnection() {
- _nmeaSockets->push_back( _nmeaServer->nextPendingConnection() );
- emit( newMessage(QString("New PPP client on port: # %1")
- .arg(_nmeaSockets->size()).toAscii(), true) );
-}
-
-// Add New Thread
-////////////////////////////////////////////////////////////////////////////
-void bncCaster::addGetThread(bncGetThread* getThread, bool noNewThread) {
-
- qRegisterMetaType("t_obs");
- qRegisterMetaType("gpsephemeris");
- qRegisterMetaType("glonassephemeris");
- qRegisterMetaType("galileoephemeris");
-
- connect(getThread, SIGNAL(newObs(QByteArray, bool, t_obs)),
- this, SLOT(newObs(QByteArray, bool, t_obs)));
-
- connect(getThread, SIGNAL(getThreadFinished(QByteArray)),
- this, SLOT(slotGetThreadFinished(QByteArray)));
-
- connect(getThread, SIGNAL(newNMEAstr(QByteArray)),
- this, SLOT(slotNewNMEAstr(QByteArray)));
-
- _staIDs.push_back(getThread->staID());
- _threads.push_back(getThread);
-
- if (noNewThread) {
- getThread->run();
- }
- else {
- getThread->start();
- }
-}
-
-// Get Thread destroyed
-////////////////////////////////////////////////////////////////////////////
-void bncCaster::slotGetThreadFinished(QByteArray staID) {
- QMutexLocker locker(&_mutex);
-
- QListIterator it(_threads);
- while (it.hasNext()) {
- bncGetThread* thread = it.next();
- if (thread->staID() == staID) {
- _threads.removeOne(thread);
- }
- }
-
- _staIDs.removeAll(staID);
- emit( newMessage(
- QString("Decoding %1 stream(s)").arg(_staIDs.size()).toAscii(), true) );
- if (_staIDs.size() == 0) {
- emit(newMessage("bncCaster: Last get thread terminated", true));
- emit getThreadsFinished();
- }
-}
-
-// Dump Complete Epochs
-////////////////////////////////////////////////////////////////////////////
-void bncCaster::dumpEpochs(long minTime, long maxTime) {
-
- for (long sec = minTime; sec <= maxTime; sec++) {
-
- QList allObs = _epochs->values(sec);
-
- QListIterator it(allObs);
- while (it.hasNext()) {
- const t_obs& obs = it.next();
-
- if (_samplingRate == 0 || sec % _samplingRate == 0) {
-
- if (_out || _sockets) {
- ostringstream oStr;
- oStr.setf(ios::showpoint | ios::fixed);
- oStr << obs.StatID << " "
- << obs.GPSWeek << " "
- << setprecision(7) << obs.GPSWeeks << " "
- << bncRinex::asciiSatLine(obs) << endl;
- if (!it.hasNext()) {
- oStr << endl;
- }
- string hlpStr = oStr.str();
-
- // Output into the File
- // --------------------
- if (_out) {
- *_out << hlpStr.c_str();
- _out->flush();
- }
-
- // Output into the socket
- // ----------------------
- if (_sockets) {
- QMutableListIterator is(*_sockets);
- while (is.hasNext()) {
- QTcpSocket* sock = is.next();
- if (sock->state() == QAbstractSocket::ConnectedState) {
- int numBytes = hlpStr.length();
- if (myWrite(sock, hlpStr.c_str(), numBytes) != numBytes) {
- delete sock;
- is.remove();
- }
- }
- else if (sock->state() != QAbstractSocket::ConnectingState) {
- delete sock;
- is.remove();
- }
- }
- }
- }
- }
-
- _epochs->remove(sec);
- }
- }
-}
-
-// Reread configuration (private slot)
-////////////////////////////////////////////////////////////////////////////
-void bncCaster::slotReadMountPoints() {
-
- bncSettings settings;
- settings.reRead();
-
- readMountPoints();
-}
-
-// Read Mountpoints
-////////////////////////////////////////////////////////////////////////////
-void bncCaster::readMountPoints() {
-
- bncSettings settings;
-
- // Reread several options
- // ----------------------
- _samplingRate = settings.value("binSampl").toInt();
- _waitTime = settings.value("waitTime").toInt();
- if (_waitTime < 1) {
- _waitTime = 1;
- }
-
- // Add new mountpoints
- // -------------------
- int iMount = -1;
- QListIterator it(settings.value("mountPoints").toStringList());
- while (it.hasNext()) {
- ++iMount;
- QStringList hlp = it.next().split(" ");
- if (hlp.size() <= 1) continue;
- QUrl url(hlp[0]);
-
- // Does it already exist?
- // ----------------------
- bool existFlg = false;
- QListIterator iTh(_threads);
- while (iTh.hasNext()) {
- bncGetThread* thread = iTh.next();
- if (thread->mountPoint() == url) {
- existFlg = true;
- break;
- }
- }
-
- // New bncGetThread
- // ----------------
- if (!existFlg) {
- QByteArray format = hlp[1].toAscii();
- QByteArray latitude = hlp[2].toAscii();
- QByteArray longitude = hlp[3].toAscii();
- QByteArray nmea = hlp[4].toAscii();
- QByteArray ntripVersion = hlp[5].toAscii();
-
- bncGetThread* getThread = new bncGetThread(url, format, latitude,
- longitude, nmea, ntripVersion);
- addGetThread(getThread);
- }
- }
-
- // Remove mountpoints
- // ------------------
- QListIterator iTh(_threads);
- while (iTh.hasNext()) {
- bncGetThread* thread = iTh.next();
-
- bool existFlg = false;
- QListIterator it(settings.value("mountPoints").toStringList());
- while (it.hasNext()) {
- QStringList hlp = it.next().split(" ");
- if (hlp.size() <= 1) continue;
- QUrl url(hlp[0]);
-
- if (thread->mountPoint() == url) {
- existFlg = true;
- break;
- }
- }
-
- if (!existFlg) {
- disconnect(thread, 0, 0, 0);
- _staIDs.removeAll(thread->staID());
- _threads.removeAll(thread);
- thread->terminate();
- }
- }
-
- emit mountPointsRead(_threads);
- emit( newMessage(QString("Configuration read: "
- + ((bncApp*) qApp)->confFileName()
- + ", %1 stream(s)")
- .arg(_threads.count()).toAscii(), true) );
-
- // (Re-) Start the configuration timer
- // -----------------------------------
- int ms = 0;
-
- if (_confInterval != -1) {
- ms = 1000 * _confInterval;
- }
- else {
- QTime currTime = currentDateAndTimeGPS().time();
- QTime nextShotTime;
-
- if (settings.value("onTheFlyInterval").toString() == "1 min") {
- _confInterval = 60;
- nextShotTime = QTime(currTime.hour(), currTime.minute()+1, 0);
- }
- else if (settings.value("onTheFlyInterval").toString() == "1 hour") {
- _confInterval = 3600;
- nextShotTime = QTime(currTime.hour()+1, 0, 0);
- }
- else {
- _confInterval = 86400;
- nextShotTime = QTime(23, 59, 59, 999);
- }
-
- ms = currTime.msecsTo(nextShotTime);
- if (ms < 30000) {
- ms = 30000;
- }
- }
-
- QTimer::singleShot(ms, this, SLOT(slotReadMountPoints()));
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-int bncCaster::myWrite(QTcpSocket* sock, const char* buf, int bufLen) {
- sock->write(buf, bufLen);
- for (int ii = 1; ii <= 10; ii++) {
- if (sock->waitForBytesWritten(10)) { // wait 10 ms
- return bufLen;
- }
- }
- return -1;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncCaster::slotNewNMEAstr(QByteArray str) {
- if (_nmeaSockets) {
- QMutableListIterator is(*_nmeaSockets);
- while (is.hasNext()) {
- QTcpSocket* sock = is.next();
- if (sock->state() == QAbstractSocket::ConnectedState) {
- sock->write(str);
- }
- else if (sock->state() != QAbstractSocket::ConnectingState) {
- delete sock;
- is.remove();
- }
- }
- }
-}
Index: trunk/BNC/bnccaster.h
===================================================================
--- trunk/BNC/bnccaster.h (revision 4277)
+++ (revision )
@@ -1,85 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCCASTER_H
-#define BNCCASTER_H
-
-#include
-#include
-#include
-
-#include "RTCM/GPSDecoder.h"
-
-class bncGetThread;
-
-class bncCaster : public QObject {
- Q_OBJECT
-
- public:
- bncCaster(const QString& outFileName, int port);
- ~bncCaster();
- void addGetThread(bncGetThread* getThread, bool noNewThread = false);
- int numStations() const {return _staIDs.size();}
- void readMountPoints();
-
- public slots:
- void newObs(QByteArray staID, bool firstObs, t_obs obs);
- void slotNewNMEAstr(QByteArray str);
-
- signals:
- void mountPointsRead(QList);
- void getThreadsFinished();
- void newMessage(QByteArray msg, bool showOnScreen);
-
- private slots:
- void slotReadMountPoints();
- void slotNewConnection();
- void slotNewUConnection();
- void slotNewNMEAConnection();
- void slotGetThreadFinished(QByteArray staID);
-
- private:
- void dumpEpochs(long minTime, long maxTime);
- static int myWrite(QTcpSocket* sock, const char* buf, int bufLen);
-
- QFile* _outFile;
- int _port;
- QTextStream* _out;
- QMultiMap* _epochs;
- long _lastDumpSec;
- QTcpServer* _server;
- QTcpServer* _uServer;
- QTcpServer* _nmeaServer;
- QList* _sockets;
- QList* _uSockets;
- QList* _nmeaSockets;
- QList _staIDs;
- QList _threads;
- int _samplingRate;
- long _waitTime;
- QMutex _mutex;
- int _confInterval;
-};
-
-#endif
Index: trunk/BNC/bncclockrinex.cpp
===================================================================
--- trunk/BNC/bncclockrinex.cpp (revision 4277)
+++ (revision )
@@ -1,100 +1,0 @@
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Server
- * -------------------------------------------------------------------------
- *
- * Class: bncClockRinex
- *
- * Purpose: writes RINEX Clock files
- *
- * Author: L. Mervart
- *
- * Created: 29-Mar-2011
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-#include
-
-#include "bncclockrinex.h"
-#include "bncsettings.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncClockRinex::bncClockRinex(const QString& sklFileName, const QString& intr,
- int sampl)
- : bncoutf(sklFileName, intr, sampl) {
- bncSettings settings;
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncClockRinex::~bncClockRinex() {
-}
-
-// Write One Epoch
-////////////////////////////////////////////////////////////////////////////
-t_irc bncClockRinex::write(int GPSweek, double GPSweeks, const QString& prn,
- const ColumnVector& xx) {
-
- if (reopen(GPSweek, GPSweeks) == success) {
-
- QDateTime datTim = dateAndTimeFromGPSweek(GPSweek, GPSweeks);
- double sec = fmod(GPSweeks, 60.0);
-
- _out << "AS " << prn.toAscii().data()
- << datTim.toString(" yyyy MM dd hh mm").toAscii().data()
- << fixed << setw(10) << setprecision(6) << sec
- << " 1 "
- << scientific << setw(19) << setprecision(12) << xx(4) << endl;
-
- return success;
- }
- else {
- return failure;
- }
-}
-
-// Write Header
-////////////////////////////////////////////////////////////////////////////
-void bncClockRinex::writeHeader(const QDateTime& datTim) {
-
- _out << " 3.00 C "
- << "RINEX VERSION / TYPE" << endl;
-
- _out << "BNC "
- << datTim.toString("yyyyMMdd hhmmss").leftJustified(20, ' ', true).toAscii().data()
- << "PGM / RUN BY / DATE" << endl;
-
- _out << " 1 AS "
- << "# / TYPES OF DATA" << endl;
-
- _out << "unknown "
- << "ANALYSIS CENTER" << endl;
-
- _out << " 54 "
- << "# OF SOLN SATS" << endl;
-
- _out << "G01 G02 G03 G04 G05 G06 G07 G08 G09 G10 G11 G12 G13 G14 G15 "
- << "PRN LIST" << endl;
-
- _out << "G16 G17 G18 G19 G20 G21 G22 G23 G25 G26 G27 G28 G29 G30 G31 "
- << "PRN LIST" << endl;
-
- _out << "G32 R01 R02 R03 R05 R06 R07 R08 R09 R10 R11 R12 R13 R14 R15 "
- << "PRN LIST" << endl;
-
- _out << "R16 R17 R18 R19 R20 R21 R22 R23 R24 "
- << "PRN LIST" << endl;
-
- _out << " 0 IGS08 "
- << "# OF SOLN STA / TRF" << endl;
-
- _out << " "
- << "END OF HEADER" << endl;
-}
-
Index: trunk/BNC/bncclockrinex.h
===================================================================
--- trunk/BNC/bncclockrinex.h (revision 4277)
+++ (revision )
@@ -1,22 +1,0 @@
-#ifndef BNCCLOCKRINEX_H
-#define BNCCLOCKRINEX_H
-
-#include
-#include
-#include
-
-#include "bncoutf.h"
-
-class bncClockRinex : public bncoutf {
- public:
- bncClockRinex(const QString& sklFileName, const QString& intr, int sampl);
- virtual ~bncClockRinex();
- virtual t_irc write(int GPSweek, double GPSweeks, const QString& prn,
- const ColumnVector& xx);
-
- private:
- virtual void writeHeader(const QDateTime& datTim);
- bool _append;
-};
-
-#endif
Index: trunk/BNC/bnccomb.h
===================================================================
--- trunk/BNC/bnccomb.h (revision 4277)
+++ (revision )
@@ -1,63 +1,0 @@
-
-#ifndef BNCCOMB_H
-#define BNCCOMB_H
-
-template
-inline bool next_combination(BidIt n_begin, BidIt n_end,
- BidIt r_begin, BidIt r_end) {
-
- bool boolmarked=false;
- BidIt r_marked;
-
- BidIt n_it1=n_end;
- --n_it1;
-
-
- BidIt tmp_r_end=r_end;
- --tmp_r_end;
-
- for(BidIt r_it1=tmp_r_end; r_it1!=r_begin || r_it1==r_begin; --r_it1,--n_it1)
- {
- if(*r_it1==*n_it1 )
- {
- if(r_it1!=r_begin) //to ensure not at the start of r sequence
- {
- boolmarked=true;
- r_marked=(--r_it1);
- ++r_it1;//add it back again
- continue;
- }
- else // it means it is at the start the sequence, so return false
- return false;
- }
- else //if(*r_it1!=*n_it1 )
- {
- //marked code
- if(boolmarked==true)
- {
- //for loop to find which marked is in the first sequence
- BidIt n_marked;//mark in first sequence
- for (BidIt n_it2=n_begin;n_it2!=n_end;++n_it2)
- if(*r_marked==*n_it2) {n_marked=n_it2;break;}
-
-
- BidIt n_it3=++n_marked;
- for (BidIt r_it2=r_marked;r_it2!=r_end;++r_it2,++n_it3)
- {
- *r_it2=*n_it3;
- }
- return true;
- }
- for(BidIt n_it4=n_begin; n_it4!=n_end; ++n_it4)
- if(*r_it1==*n_it4)
- {
- *r_it1=*(++n_it4);
- return true;
- }
- }
- }
-
- return true;//will never reach here
-}
-
-#endif
Index: trunk/BNC/bncconst.cpp
===================================================================
--- trunk/BNC/bncconst.cpp (revision 4277)
+++ (revision )
@@ -1,36 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "bncconst.h"
-
-const double t_CST::c = 299792458.0;
-const double t_CST::freq1 = 1575420000.0; // GPS and Galileo E1
-const double t_CST::freq2 = 1227600000.0; // GPS only
-const double t_CST::freq5 = 1176450000.0; // GPS and Galileo E5a
-const double t_CST::lambda1 = c / freq1;
-const double t_CST::lambda2 = c / freq2;
-const double t_CST::lambda5 = c / freq5;
-const double t_CST::omega = 7292115.1467e-11;
-const double t_CST::aell = 6378137.000;
-const double t_CST::fInv = 298.2572236;
Index: trunk/BNC/bncconst.h
===================================================================
--- trunk/BNC/bncconst.h (revision 4277)
+++ (revision )
@@ -1,68 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCCONST_H
-#define BNCCONST_H
-
-enum t_irc {failure = -1, success, fatal}; // return code
-
-class t_CST {
- public:
- static double f1(char satSys, int slotNum) {
- if (satSys == 'G' || satSys == 'E') {
- return freq1;
- }
- else if (satSys == 'R') {
- return 1602000000.0 + 562500.0 * slotNum;
- }
- else {
- return 0.0;
- }
- }
- static double f2(char satSys, int slotNum) {
- if (satSys == 'G') {
- return freq2;
- }
- else if (satSys == 'R') {
- return 1246000000.0 + 437500.0 * slotNum;
- }
- else {
- return 0.0;
- }
- }
-
- static const double c;
- static const double freq1; // GPS and Galileo E1
- static const double freq2; // GPS only
- static const double freq5; // GPS and Galileo E5a
- static const double lambda1;
- static const double lambda2;
- static const double lambda5;
- static const double omega;
- static const double aell;
- static const double fInv;
-};
-
-
-#endif
Index: trunk/BNC/bncephuser.cpp
===================================================================
--- trunk/BNC/bncephuser.cpp (revision 4277)
+++ (revision )
@@ -1,270 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncEphUser
- *
- * Purpose: Base for Classes that use Ephemerides
- *
- * Author: L. Mervart
- *
- * Created: 27-Jan-2011
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-
-#include "bncephuser.h"
-#include "bncapp.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncEphUser::bncEphUser(bool connectSlots) {
-
- if (connectSlots) {
- connect(((bncApp*)qApp), SIGNAL(newEphGPS(gpsephemeris)),
- this, SLOT(slotNewEphGPS(gpsephemeris)), Qt::DirectConnection);
-
- connect(((bncApp*)qApp), SIGNAL(newEphGlonass(glonassephemeris)),
- this, SLOT(slotNewEphGlonass(glonassephemeris)), Qt::DirectConnection);
-
- connect(((bncApp*)qApp), SIGNAL(newEphGalileo(galileoephemeris)),
- this, SLOT(slotNewEphGalileo(galileoephemeris)), Qt::DirectConnection);
- }
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncEphUser::~bncEphUser() {
- QMapIterator it(_eph);
- while (it.hasNext()) {
- it.next();
- delete it.value();
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncEphUser::slotNewEphGPS(gpsephemeris gpseph) {
- QMutexLocker locker(&_mutex);
-
- QString prn = QString("G%1").arg(gpseph.satellite, 2, 10, QChar('0'));
-
- if (_eph.contains(prn)) {
- t_ephGPS* eLast = static_cast(_eph.value(prn)->last);
- bncTime toc(gpseph.GPSweek, gpseph.TOC);
- if (eLast->TOC() < toc) {
- delete static_cast(_eph.value(prn)->prev);
- _eph.value(prn)->prev = _eph.value(prn)->last;
- _eph.value(prn)->last = new t_ephGPS();
- static_cast(_eph.value(prn)->last)->set(&gpseph);
- }
- }
- else {
- t_ephGPS* eLast = new t_ephGPS();
- eLast->set(&gpseph);
- _eph.insert(prn, new t_ephPair(eLast));
- }
- ephBufferChanged();
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncEphUser::slotNewEphGlonass(glonassephemeris gloeph) {
- QMutexLocker locker(&_mutex);
-
- QString prn = QString("R%1").arg(gloeph.almanac_number, 2, 10, QChar('0'));
-
- if (_eph.contains(prn)) {
- int ww = gloeph.GPSWeek;
- int tow = gloeph.GPSTOW;
- updatetime(&ww, &tow, gloeph.tb*1000, 0); // Moscow -> GPS
- t_ephGlo* eLast = static_cast(_eph.value(prn)->last);
- bncTime toc(ww, tow);
- if (eLast->TOC() < toc) {
- delete static_cast(_eph.value(prn)->prev);
- _eph.value(prn)->prev = _eph.value(prn)->last;
- _eph.value(prn)->last = new t_ephGlo();
- static_cast(_eph.value(prn)->last)->set(&gloeph);
- }
- }
- else {
- t_ephGlo* eLast = new t_ephGlo();
- eLast->set(&gloeph);
- _eph.insert(prn, new t_ephPair(eLast));
- }
- ephBufferChanged();
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncEphUser::slotNewEphGalileo(galileoephemeris galeph) {
- QMutexLocker locker(&_mutex);
-
- QString prn = QString("E%1").arg(galeph.satellite, 2, 10, QChar('0'));
-
- if (_eph.contains(prn)) {
- t_ephGal* eLast = static_cast(_eph.value(prn)->last);
- bncTime toc(galeph.Week, galeph.TOC);
- if (eLast->TOC() < toc) {
- delete static_cast(_eph.value(prn)->prev);
- _eph.value(prn)->prev = _eph.value(prn)->last;
- _eph.value(prn)->last = new t_ephGal();
- static_cast(_eph.value(prn)->last)->set(&galeph);
- }
- }
- else {
- t_ephGal* eLast = new t_ephGal();
- eLast->set(&galeph);
- _eph.insert(prn, new t_ephPair(eLast));
- }
- ephBufferChanged();
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-t_irc bncEphUser::putNewEph(t_eph* newEph) {
-
- QMutexLocker locker(&_mutex);
-
- if (!newEph) {
- return failure;
- }
-
- QString prn = newEph->prn();
-
- t_irc irc = failure;
-
- if (_eph.contains(prn)) {
- t_eph* eLast = _eph.value(prn)->last;
- if (newEph->isNewerThan(eLast)) {
- delete _eph.value(prn)->prev;
- _eph.value(prn)->prev = _eph.value(prn)->last;
- _eph.value(prn)->last = newEph;
- irc = success;
- }
- }
- else {
- _eph.insert(prn, new t_ephPair(newEph));
- irc = success;
- }
-
- if (irc == success) {
- ephBufferChanged();
- }
-
- return irc;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-t_irc t_corr::readLine(const QString& line) {
-
- if (line[0] == '!') {
- return failure;
- }
-
- QTextStream in(line.toAscii());
-
- int messageType;
- in >> messageType;
-
- if (!relevantMessageType(messageType)) {
- return failure;
- }
-
- int updateInterval;
- int GPSweek;
- double GPSweeks;
- in >> updateInterval >> GPSweek >> GPSweeks >> prn;
-
- if ( messageType == COTYPE_GPSCOMBINED ||
- messageType == COTYPE_GLONASSCOMBINED ) {
- rao.ReSize(3); rao = 0.0;
- dotRao.ReSize(3); dotRao = 0.0;
- dotDotRao.ReSize(3); dotDotRao = 0.0;
- dClk = 0.0;
- dotDClk = 0.0;
- dotDotDClk = 0.0;
- in >> iod
- >> dClk >> rao[0] >> rao[1] >> rao[2]
- >> dotDClk >> dotRao[0] >> dotRao[1] >> dotRao[2]
- >> dotDotDClk >> dotDotRao[0] >> dotDotRao[1] >> dotDotRao[2];
- dClk /= t_CST::c;
- dotDClk /= t_CST::c;
- dotDotDClk /= t_CST::c;
-
- tClk.set(GPSweek, GPSweeks);
- tRao.set(GPSweek, GPSweeks);
- }
- else if ( messageType == COTYPE_GPSORBIT ||
- messageType == COTYPE_GLONASSORBIT ) {
- rao.ReSize(3); rao = 0.0;
- dotRao.ReSize(3); dotRao = 0.0;
- dotDotRao.ReSize(3); dotDotRao = 0.0;
- in >> iod
- >> rao[0] >> rao[1] >> rao[2]
- >> dotRao[0] >> dotRao[1] >> dotRao[2]
- >> dotDotRao[0] >> dotDotRao[1] >> dotDotRao[2];
-
- tRao.set(GPSweek, GPSweeks);
-
- if (tClk != tRao) {
- dClk = 0.0;
- dotDClk = 0.0;
- dotDotDClk = 0.0;
- tClk.reset();
- }
- }
- else if ( messageType == COTYPE_GPSCLOCK ||
- messageType == COTYPE_GLONASSCLOCK ) {
- int dummyIOD;
- dClk = 0.0;
- dotDClk = 0.0;
- dotDotDClk = 0.0;
- in >> dummyIOD >> dClk >> dotDClk >> dotDotDClk;
- dClk /= t_CST::c;
- dotDClk /= t_CST::c;
- dotDotDClk /= t_CST::c;
-
- tClk.set(GPSweek, GPSweeks);
- }
- else if ( messageType == COTYPE_GPSHR ||
- messageType == COTYPE_GLONASSHR ) {
- if (tRao.valid() && tClk.valid()) {
- int dummyIOD;
- in >> dummyIOD >> hrClk;
- hrClk /= t_CST::c;
- }
- }
-
- return success;
-}
Index: trunk/BNC/bncephuser.h
===================================================================
--- trunk/BNC/bncephuser.h (revision 4277)
+++ (revision )
@@ -1,130 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCEPHUSER_H
-#define BNCEPHUSER_H
-
-#include
-#include
-
-#include "bncconst.h"
-#include "bnctime.h"
-#include "RTCM3/ephemeris.h"
-
-extern "C" {
-#include "clock_orbit_rtcm.h"
-}
-
-class t_corr {
- public:
- t_corr() {
- rao.ReSize(3);
- dotRao.ReSize(3);
- dotDotRao.ReSize(3);
- iod = 0;
- dClk = 0.0;
- dotDClk = 0.0;
- dotDotDClk = 0.0;
- hrClk = 0.0;
- rao = 0.0;
- dotRao = 0.0;
- dotDotRao = 0.0;
- eph = 0;
- }
-
- ~t_corr() {}
-
- bool ready() {return tRao.valid() && tClk.valid();}
-
- static bool relevantMessageType(int msgType) {
- return ( msgType == COTYPE_GPSCOMBINED ||
- msgType == COTYPE_GLONASSCOMBINED ||
- msgType == COTYPE_GPSORBIT ||
- msgType == COTYPE_GPSCLOCK ||
- msgType == COTYPE_GLONASSORBIT ||
- msgType == COTYPE_GLONASSCLOCK ||
- msgType == COTYPE_GPSHR ||
- msgType == COTYPE_GLONASSHR );
- }
-
- t_irc readLine(const QString& line);
-
- QString prn;
- bncTime tClk;
- bncTime tRao;
- int iod;
- double dClk;
- double dotDClk;
- double dotDotDClk;
- double hrClk;
- ColumnVector rao;
- ColumnVector dotRao;
- ColumnVector dotDotRao;
- const t_eph* eph;
-};
-
-class bncEphUser : public QObject {
- Q_OBJECT
-
- public:
- bncEphUser(bool connectSlots = true);
- virtual ~bncEphUser();
-
- class t_ephPair {
- public:
- t_ephPair(t_eph* lastEph) {
- last = lastEph;
- prev = 0;
- }
- ~t_ephPair() {
- delete last;
- delete prev;
- }
- t_eph* last;
- t_eph* prev;
- };
-
- const t_ephPair* ephPair(const QString& prn) {
- if (_eph.contains(prn)) {
- return _eph[prn];
- }
- else {
- return 0;
- }
- }
-
- t_irc putNewEph(t_eph* eph);
-
- public slots:
- void slotNewEphGPS(gpsephemeris gpseph);
- void slotNewEphGlonass(glonassephemeris gloeph);
- void slotNewEphGalileo(galileoephemeris galeph);
-
- protected:
- virtual void ephBufferChanged() {}
- QMutex _mutex;
- QMap _eph;
-};
-
-#endif
Index: trunk/BNC/bncfigure.cpp
===================================================================
--- trunk/BNC/bncfigure.cpp (revision 4277)
+++ (revision )
@@ -1,205 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncFigure
- *
- * Purpose:
- *
- * Author: Perlt, Mervart
- *
- * Created: 11-Nov-2009
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-
-#include "bncfigure.h"
-#include "bncsettings.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncFigure::bncFigure(QWidget *parent) : QWidget(parent) {
- updateMountPoints();
- slotNextAnimationFrame();
- for (int ii = 0; ii <= 1000; ii++) {
- _ran[0][ii] = qrand() % 255;
- _ran[1][ii] = qrand() % 255;
- _ran[2][ii] = qrand() % 255;
- }
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncFigure::~bncFigure() {
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncFigure::updateMountPoints() {
- QMutexLocker locker(&_mutex);
-
- _counter = 0;
- _maxRate = 0;
-
- QMapIterator it1(_bytes);
- while (it1.hasNext()) {
- it1.next();
- delete it1.value();
- }
- _bytes.clear();
-
- bncSettings settings;
- QListIterator it(settings.value("mountPoints").toStringList());
- while (it.hasNext()) {
- QStringList hlp = it.next().split(" ");
- QUrl url(hlp[0]);
- QByteArray staID = url.path().mid(1).toAscii();
- _bytes[staID] = new sumAndMean();
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncFigure::slotNewData(const QByteArray staID, double nbyte) {
- QMutexLocker locker(&_mutex);
- QMap::const_iterator it = _bytes.find(staID);
- if (it != _bytes.end()) {
- it.value()->_sum += nbyte*8.;
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncFigure::slotNextAnimationFrame() {
- QMutexLocker locker(&_mutex);
-
- const static int MAXCOUNTER = 10;
-
- ++_counter;
-
- // If counter reaches its maximal value, compute the mean rate
- // -----------------------------------------------------------
- if (_counter == MAXCOUNTER) {
- _maxRate = 0.0;
- QMapIterator it(_bytes);
- while (it.hasNext()) {
- it.next();
- it.value()->_mean = it.value()->_sum / _counter;
- it.value()->_sum = 0.0;
- if (it.value()->_mean > _maxRate) {
- _maxRate = it.value()->_mean;
- }
- }
- _counter = 0;
- }
-
- update();
-
- QTimer::singleShot(1000, this, SLOT(slotNextAnimationFrame()));
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncFigure::paintEvent(QPaintEvent *) {
-
- int xMin = 0;
- int xMax = 640;
- int yMin = 0;
- int yMax = 140;
- float xLine = .60;
-
- QPainter painter(this);
-
- QFont font;
- font.setPointSize(int(font.QFont::pointSize()*0.8));
- painter.setFont(font);
-
- // y-axis
- // ------
- int yLength = int((yMax-yMin)*xLine) - (yMin+10);
- painter.drawLine(xMin+60, int((yMax-yMin)*xLine), xMin+60, yMin+10);
-
- double maxRateRounded;
- QString maxRateStr;
- if (_maxRate < 1e3) {
- maxRateRounded = int(_maxRate/200)*200 + 300;
- maxRateStr = QString("%1 bps ").arg(int(maxRateRounded/200)*200);
- painter.drawText(0, int((yMax-yMin)*xLine)-5, xMin+60,15,Qt::AlignRight,tr("0 bps "));
- }
- else if (_maxRate < 1e6) {
- maxRateRounded = int(_maxRate/1.e3)*1.e3 + 1500;
- maxRateStr = QString("%1 kbps ").arg(int(maxRateRounded/1.e3));
- painter.drawText(0, int((yMax-yMin)*xLine)-5, xMin+60,15,Qt::AlignRight,tr("0 kbps "));
- }
- else {
- maxRateRounded = int(_maxRate/1.e6)*1.e6 + 1500000;
- maxRateStr = QString("%1 Mbps ").arg(int(maxRateRounded/1.e6));
- painter.drawText(0, int((yMax-yMin)*xLine)-5, xMin+60,15,Qt::AlignRight,tr("0 Mbps "));
- }
-
- if(_maxRate > 0.0) {
- painter.drawText(0, yMin+20-5, xMin+60,15,Qt::AlignRight,maxRateStr);
- }
-
- // x-axis
- // ------
- painter.drawLine(xMin+60, int((yMax-yMin)*xLine), xMax*3, int((yMax-yMin)*xLine));
-
- int anchor = 0;
- QMapIterator it(_bytes);
- while (it.hasNext()) {
- it.next();
- QByteArray staID = it.key();
-
- int xx = xMin+80+anchor*12;
-
- if(_maxRate > 0.0) {
- int yy = int(yLength * (it.value()->_mean / maxRateRounded));
- QColor color = QColor::fromRgb(_ran[0][anchor],_ran[1][anchor],_ran[2][anchor],150);
- painter.fillRect(xx-13, int((yMax-yMin)*xLine)-yy, 9, yy,
- QBrush(color,Qt::SolidPattern));
- painter.setPen(Qt::black);
- if(it.value()->_mean<=0) {
- painter.setPen(Qt::red);
- }
- }
-
- painter.save();
- painter.translate(xx-13, int(yMax-yMin)*xLine+65);
- painter.rotate(-90);
- painter.drawText(0,0,65,50,Qt::AlignRight,staID.left(5) + " ");
- painter.restore();
-
- anchor++;
- }
-}
-
Index: trunk/BNC/bncfigure.h
===================================================================
--- trunk/BNC/bncfigure.h (revision 4277)
+++ (revision )
@@ -1,57 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCFIGURE_H
-#define BNCFIGURE_H
-
-#include
-
-class bncFigure : public QWidget {
- Q_OBJECT
- public:
- bncFigure(QWidget *parent);
- ~bncFigure();
- void updateMountPoints();
- public slots:
- void slotNewData(const QByteArray staID, double nbyte);
- protected:
- void paintEvent(QPaintEvent *event);
- private slots:
- void slotNextAnimationFrame();
- private:
- class sumAndMean {
- public:
- sumAndMean() {_mean = 0.0; _sum = 0.0;}
- ~sumAndMean() {}
- double _mean;
- double _sum;
- };
- QMap _bytes;
- QMutex _mutex;
- int _counter;
- double _maxRate;
- int _ran[3][1001];
-};
-
-#endif
Index: trunk/BNC/bncfigurelate.cpp
===================================================================
--- trunk/BNC/bncfigurelate.cpp (revision 4277)
+++ (revision )
@@ -1,183 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncFigureLate
- *
- * Purpose:
- *
- * Author: Perlt, Mervart
- *
- * Created: 11-Nov-2009
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-
-#include "bncfigurelate.h"
-#include "bncsettings.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncFigureLate::bncFigureLate(QWidget *parent) : QWidget(parent) {
- updateMountPoints();
- slotNextAnimationFrame();
- for (int ii = 0; ii <= 1000; ii++) {
- _ran[0][ii] = qrand() % 255;
- _ran[1][ii] = qrand() % 255;
- _ran[2][ii] = qrand() % 100;
- }
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncFigureLate::~bncFigureLate() {
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncFigureLate::updateMountPoints() {
- QMutexLocker locker(&_mutex);
-
- _latency.clear();
-
- bncSettings settings;
- QListIterator it(settings.value("mountPoints").toStringList());
- while (it.hasNext()) {
- QStringList hlp = it.next().split(" ");
- QUrl url(hlp[0]);
- QByteArray staID = url.path().mid(1).toAscii();
- _latency[staID] = 0.0;
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncFigureLate::slotNewLatency(const QByteArray staID, double clate) {
- QMutexLocker locker(&_mutex);
- if (_latency.find(staID) != _latency.end()) {
- _latency[staID] = fabs(clate)*1000.0;
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncFigureLate::slotNextAnimationFrame() {
- QMutexLocker locker(&_mutex);
- update();
- QTimer::singleShot(1000, this, SLOT(slotNextAnimationFrame()));
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncFigureLate::paintEvent(QPaintEvent *) {
-
- int xMin = 0;
- int xMax = 640;
- int yMin = 0;
- int yMax = 140;
- float xLine = .60;
-
- QPainter painter(this);
-
- QFont font;
- font.setPointSize(int(font.QFont::pointSize()*0.8));
- painter.setFont(font);
-
- // y-axis
- // ------
- int yLength = int((yMax-yMin)*xLine) - (yMin+10);
- painter.drawLine(xMin+60, int((yMax-yMin)*xLine), xMin+60, yMin+10);
-
- double maxLate = 0.0;
- QMapIterator it1(_latency);
- while (it1.hasNext()) {
- it1.next();
- if (it1.value() > maxLate) {
- maxLate = it1.value();
- }
- }
-
- double maxLateRounded;
- QString maxLateStr;
- if(maxLate < 1e3) {
- maxLateRounded = int(maxLate/200)*200 + 300;
- maxLateStr = QString("%1 ms ").arg(int(maxLateRounded/200)*200);
- painter.drawText(0, int((yMax-yMin)*xLine)-5, xMin+60,15,Qt::AlignRight,tr("0 ms "));
- }
- else if (maxLate < 6e4) {
- maxLateRounded = int(maxLate/1.e3)*1.e3 + 1500;
- maxLateStr = QString("%1 sec ").arg(int(maxLateRounded/1.e3));
- painter.drawText(0, int((yMax-yMin)*xLine)-5, xMin+60,15,Qt::AlignRight,tr("0 sec "));
- }
- else {
- maxLateRounded = int(maxLate / 6.e4)*6.e4 + 90000;
- maxLateStr = QString("%1 min ").arg(int(maxLateRounded/6.e4));
- painter.drawText(0, int((yMax-yMin)*xLine)-5, xMin+60,15,Qt::AlignRight,tr("0 min "));
- }
-
- if(maxLate > 0.0) {
- painter.drawText(0, yMin+20-5, xMin+60,15,Qt::AlignRight,maxLateStr);
- }
-
- // x-axis
- // ------
- painter.drawLine(xMin+60, int((yMax-yMin)*xLine), xMax*3, int((yMax-yMin)*xLine));
-
- int anchor = 0;
- QMapIterator it(_latency);
- while (it.hasNext()) {
- it.next();
- QByteArray staID = it.key();
-
- int xx = xMin+80+anchor*12;
-
- if(maxLate > 0.0) {
- int yy = int(yLength * (it.value() / maxLateRounded));
- QColor color = QColor::fromHsv(180,200,120+_ran[2][anchor]);
- painter.fillRect(xx-13, int((yMax-yMin)*xLine)-yy, 9, yy,
- QBrush(color,Qt::SolidPattern));
- painter.setPen(Qt::black);
- if(it.value()<=0) {
- painter.setPen(Qt::red);
- }
- }
-
- painter.save();
- painter.translate(xx-13, int(yMax-yMin)*xLine+65);
- painter.rotate(-90);
- painter.drawText(0,0,65,50,Qt::AlignRight,staID.left(5) + " ");
- painter.restore();
-
- anchor++;
- }
-}
-
Index: trunk/BNC/bncfigurelate.h
===================================================================
--- trunk/BNC/bncfigurelate.h (revision 4277)
+++ (revision )
@@ -1,48 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCFIGURELATE_H
-#define BNCFIGURELATE_H
-
-#include
-
-class bncFigureLate : public QWidget {
- Q_OBJECT
- public:
- bncFigureLate(QWidget *parent);
- ~bncFigureLate();
- void updateMountPoints();
- public slots:
- void slotNewLatency(const QByteArray staID, double clate);
- protected:
- void paintEvent(QPaintEvent *event);
- private slots:
- void slotNextAnimationFrame();
- private:
- QMap _latency;
- QMutex _mutex;
- int _ran[3][1001];
-};
-
-#endif
Index: trunk/BNC/bncfigureppp.cpp
===================================================================
--- trunk/BNC/bncfigureppp.cpp (revision 4277)
+++ (revision )
@@ -1,289 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncFigurePPP
- *
- * Purpose:
- *
- * Author: Mervart
- *
- * Created: 11-Nov-2009
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-
-#include "bncfigureppp.h"
-#include "bncsettings.h"
-#include "bncutils.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncFigurePPP::bncFigurePPP(QWidget *parent) : QWidget(parent) {
- reset();
-}
-
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncFigurePPP::~bncFigurePPP() {
- for (int ii = 0; ii < _pos.size(); ++ii) {
- delete _pos[ii];
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncFigurePPP::reset() {
- QMutexLocker locker(&_mutex);
-
- bncSettings settings;
-
- if (settings.value("pppRefCrdX").toString() != "" &&
- settings.value("pppRefCrdY").toString() != "" &&
- settings.value("pppRefCrdZ").toString() != "") {
- _xyzRef[0] = settings.value("pppRefCrdX").toDouble();
- _xyzRef[1] = settings.value("pppRefCrdY").toDouble();
- _xyzRef[2] = settings.value("pppRefCrdZ").toDouble();
- }
- else {
- _xyzRef[0] = 0.0;
- _xyzRef[1] = 0.0;
- _xyzRef[2] = 0.0;
- }
-
- for (int ii = 0; ii < _pos.size(); ++ii) {
- delete _pos[ii];
- }
- _pos.clear();
-
- update();
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncFigurePPP::slotNewPosition(bncTime time, double x, double y, double z){
-
- QMutexLocker locker(&_mutex);
-
- pppPos* newPos = new pppPos;
-
- newPos->time = time;
- newPos->xyz[0] = x;
- newPos->xyz[1] = y;
- newPos->xyz[2] = z;
-
- _pos.push_back(newPos);
-
- if (_pos.size() == 1) {
- _startTime = time;
- }
-
- QMutableVectorIterator it(_pos);
- while (it.hasNext()) {
- pppPos* pp = it.next();
- if ( (time - pp->time) > _tRange ) {
- delete pp;
- it.remove();
- }
- }
-
- update();
-}
-
-// Coordinate Transformation
-////////////////////////////////////////////////////////////////////////////
-QPoint bncFigurePPP::pltPoint(double tt, double yy) {
-
- double tScale = 0.90 * _width / _tRange;
- double yScale = 0.90 * _height / (2.0 * _neuMax);
- double tOffset = _tRange / 13.0;
- double yOffset = _neuMax / 10.0;
-
- int tNew = int( ( tt - _tMin + tOffset) * tScale );
- int yNew = int( (-yy + _neuMax + yOffset) * yScale );
-
- return QPoint(tNew, yNew);
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncFigurePPP::paintEvent(QPaintEvent *) {
-
- QPainter painter(this);
-
- _width = painter.viewport().width();
- _height = painter.viewport().height();
-
- QFont font = this->font();
- font.setPointSize(int(this->font().pointSize()*0.9));
- painter.setFont(font);
-
- // Plot X-coordinates as a function of time (in seconds)
- // -----------------------------------------------------
- if (_pos.size() > 1) {
- _tMin = _pos[0]->time.gpssec();
-
- // Reference Coordinates
- // ---------------------
- if (_xyzRef[0] == 0.0 && _xyzRef[1] == 0.0 && _xyzRef[2] == 0.0) {
- _xyzRef[0] = _pos[0]->xyz[0];
- _xyzRef[1] = _pos[0]->xyz[1];
- _xyzRef[2] = _pos[0]->xyz[2];
- }
- double ellRef[3];
- xyz2ell(_xyzRef, ellRef);
-
- // North, East and Up differences wrt Reference Coordinates
- // --------------------------------------------------------
- _neuMax = 0.0;
- double neu[_pos.size()][3];
- for (int ii = 0; ii < _pos.size(); ++ii) {
- double dXYZ[3];
- for (int ic = 0; ic < 3; ++ic) {
- dXYZ[ic] = _pos[ii]->xyz[ic] - _xyzRef[ic];
- }
- xyz2neu(ellRef, dXYZ, neu[ii]);
- for (int ic = 0; ic < 3; ++ic) {
- if (fabs(neu[ii][ic]) > _neuMax) {
- _neuMax = fabs(neu[ii][ic]);
- }
- }
- }
-
- if (_neuMax > 0.0) {
-
- if (_neuMax < 0.151) {
- _neuMax = 0.151;
- }
-
- unsigned hour, minute;
- double second;
- int ww = QFontMetrics(this->font()).width('w');
-
- // neu components
- // --------------
- for (int ii = 1; ii < _pos.size(); ++ii) {
- double t1 = _tMin + (_pos[ii-1]->time - _pos[0]->time);
- double t2 = _tMin + (_pos[ii]->time - _pos[0]->time);
-
-
- // dots
- // ----
- painter.setPen(QColor(Qt::gray));
- painter.drawLine(pltPoint(t1, neu[ii-1][0]), pltPoint(t2, neu[ii][0]));
- painter.setPen(QColor(Qt::red));
- painter.setBrush(QColor(Qt::red));
- painter.drawEllipse(pltPoint(t1,neu[ii-1][0]), ww/6, ww/6);
-
- painter.setPen(QColor(Qt::gray));
- painter.drawLine(pltPoint(t1, neu[ii-1][1]), pltPoint(t2, neu[ii][1]));
- painter.setPen(QColor(Qt::green));
- painter.setBrush(QColor(Qt::green));
- painter.drawEllipse(pltPoint(t1,neu[ii-1][1]), ww/6, ww/6);
-
- painter.setPen(QColor(Qt::gray));
- painter.drawLine(pltPoint(t1, neu[ii-1][2]), pltPoint(t2, neu[ii][2]));
- painter.setPen(QColor(Qt::blue));
- painter.setBrush(QColor(Qt::blue));
- painter.drawEllipse(pltPoint(t1,neu[ii-1][2]), ww/6, ww/6);
-
- // time-tics
- // ---------
- if ( fmod(_pos[ii-1]->time.daysec(), 60.0) == 0 ) {
- _pos[ii-1]->time.civil_time(hour, minute, second);
- QPoint pntTic = pltPoint(t1, 0.0);
- QString strTic = QString("%1:%2").arg(hour, 2, 10, QChar('0'))
- .arg(minute, 2, 10, QChar('0'));
- double xFirstCharTic = pntTic.x() - ww * 1.2;
- if ( xFirstCharTic > pltPoint(_tMin, 0.0).x()) {
- painter.setPen(QColor(Qt::black));
- painter.drawText(int(xFirstCharTic), int(pntTic.y() + ww * 1.7),
- strTic);
- painter.drawLine(pntTic.x(), pntTic.y(),
- pntTic.x(), pntTic.y()+ww/2);
- }
- }
- }
-
- // time-axis
- // ---------
- painter.setPen(QColor(Qt::black));
- painter.drawLine(pltPoint(_tMin, 0.0), pltPoint(_tMin+_tRange, 0.0));
-
- // neu-axis
- // --------
- painter.drawLine(pltPoint(_tMin, -_neuMax), pltPoint(_tMin, _neuMax));
-
- // neu-tics
- // --------
- double tic = floor(20.0 * (_neuMax - 0.05)) / 20.0;
- QString strP = QString("%1 m").arg( tic,0,'f',2);
- QString strM = QString("%1 m").arg(-tic,0,'f',2);
- QString strZ = QString("%1 m").arg(0.0,0,'f',2);
-
- QPoint pntP = pltPoint(_tMin, tic);
- QPoint pntM = pltPoint(_tMin,-tic);
- QPoint pntZ = pltPoint(_tMin, 0.0);
-
- painter.setPen(QColor(Qt::red));
- painter.drawText(0, ww, pntP.x() + 3*ww, pntP.x(), Qt::AlignRight, "N");
- painter.setPen(QColor(Qt::green));
- painter.drawText(0, ww, pntP.x() + 4*ww, pntP.x(), Qt::AlignRight, "E");
- painter.setPen(QColor(Qt::blue));
- painter.drawText(0, ww, pntP.x() + 5*ww, pntP.x(), Qt::AlignRight, "U");
-
- painter.setPen(QColor(Qt::black));
- painter.drawText(0, pntP.y()-ww/2, pntP.x()- ww/4, pntP.x(),
- Qt::AlignRight, strP);
- painter.drawText(0, pntM.y()-ww/2, pntM.x()- ww/4, pntM.x(),
- Qt::AlignRight, strM);
- painter.drawText(0, pntZ.y()-ww/2, pntZ.x()- ww/4, pntZ.x(),
- Qt::AlignRight, strZ);
-
- painter.drawLine(pntP.x(), pntP.y(), pntP.x()+ww, pntP.y());
- painter.drawLine(pntM.x(), pntM.y(), pntM.x()+ww, pntM.y());
-
- // Start Time
- // ----------
- _startTime.civil_time(hour, minute, second);
- QString startStr = QString("Start %1:%2:%3")
- .arg(hour, 2, 10, QChar('0'))
- .arg(minute, 2, 10, QChar('0'))
- .arg(int(second), 2, 10, QChar('0'));
- painter.setPen(QColor(Qt::black));
- painter.drawText(0, ww, pntP.x() + 16*ww, pntP.x(),
- Qt::AlignRight, startStr);
- }
- }
-}
-
Index: trunk/BNC/bncfigureppp.h
===================================================================
--- trunk/BNC/bncfigureppp.h (revision 4277)
+++ (revision )
@@ -1,65 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCFIGUREPPP_H
-#define BNCFIGUREPPP_H
-
-#include
-#include "bnctime.h"
-
-class bncFigurePPP : public QWidget {
- Q_OBJECT
- public:
- bncFigurePPP(QWidget *parent);
- ~bncFigurePPP();
- void reset();
-
- public slots:
- void slotNewPosition(bncTime time, double x, double y, double z);
-
- protected:
- void paintEvent(QPaintEvent *event);
-
- private:
- const static double _tRange = 300;
-
- class pppPos {
- public:
- bncTime time;
- double xyz[3];
- };
-
- QPoint pltPoint(double tt, double yy);
-
- QMutex _mutex;
- QVector _pos;
- bncTime _startTime;
- double _neuMax;
- double _tMin;
- int _width;
- int _height;
- double _xyzRef[3];
-};
-
-#endif
Index: trunk/BNC/bncgetthread.cpp
===================================================================
--- trunk/BNC/bncgetthread.cpp (revision 4277)
+++ (revision )
@@ -1,795 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncGetThread
- *
- * Purpose: Thread that retrieves data from NTRIP caster
- *
- * Author: L. Mervart
- *
- * Created: 24-Dec-2005
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-#include "bncgetthread.h"
-#include "bnctabledlg.h"
-#include "bncapp.h"
-#include "bncutils.h"
-#include "bnczerodecoder.h"
-#include "bncnetqueryv0.h"
-#include "bncnetqueryv1.h"
-#include "bncnetqueryv2.h"
-#include "bncnetqueryrtp.h"
-#include "bncnetqueryudp.h"
-#include "bncnetqueryudp0.h"
-#include "bncnetquerys.h"
-#include "bncsettings.h"
-#include "latencychecker.h"
-#include "bncpppclient.h"
-#ifdef PPP_DLL_INTERFACE
-#include "dllinterface.h"
-#endif
-#include "upload/bncrtnetdecoder.h"
-#include "RTCM/RTCM2Decoder.h"
-#include "RTCM3/RTCM3Decoder.h"
-#include "GPSS/gpssDecoder.h"
-#include "GPSS/hassDecoder.h"
-#include "serial/qextserialport.h"
-
-using namespace std;
-
-// Constructor 1
-////////////////////////////////////////////////////////////////////////////
-bncGetThread::bncGetThread(bncRawFile* rawFile) {
-
- _rawFile = rawFile;
- _format = rawFile->format();
- _staID = rawFile->staID();
- _rawOutput = false;
- _ntripVersion = "N";
-
- initialize();
-}
-
-// Constructor 2
-////////////////////////////////////////////////////////////////////////////
-bncGetThread::bncGetThread(const QUrl& mountPoint,
- const QByteArray& format,
- const QByteArray& latitude,
- const QByteArray& longitude,
- const QByteArray& nmea,
- const QByteArray& ntripVersion) {
- _rawFile = 0;
- _mountPoint = mountPoint;
- _staID = mountPoint.path().mid(1).toAscii();
- _format = format;
- _latitude = latitude;
- _longitude = longitude;
- _nmea = nmea;
- _ntripVersion = ntripVersion;
-
- bncSettings settings;
- if (!settings.value("rawOutFile").toString().isEmpty()) {
- _rawOutput = true;
- } else {
- _rawOutput = false;
- }
-
- initialize();
- initDecoder();
-}
-
-// Initialization (common part of the constructor)
-////////////////////////////////////////////////////////////////////////////
-void bncGetThread::initialize() {
-
- bncSettings settings;
-
- setTerminationEnabled(true);
-
- bncApp* app = (bncApp*) qApp;
-
- connect(this, SIGNAL(newMessage(QByteArray,bool)),
- app, SLOT(slotMessage(const QByteArray,bool)));
-
- _isToBeDeleted = false;
- _query = 0;
- _nextSleep = 0;
- _PPPclient = 0;
-#ifdef PPP_DLL_INTERFACE
- _dllInterface = 0;
-#endif
- _miscMount = settings.value("miscMount").toString();
- _decoder = 0;
-
- // Serial Port
- // -----------
- _serialNMEA = NO_NMEA;
- _serialOutFile = 0;
- _serialPort = 0;
-
- if (!_staID.isEmpty() &&
- settings.value("serialMountPoint").toString() == _staID) {
- _serialPort = new QextSerialPort(settings.value("serialPortName").toString() );
- _serialPort->setTimeout(0,100);
-
- // Baud Rate
- // ---------
- QString hlp = settings.value("serialBaudRate").toString();
- if (hlp == "110") {
- _serialPort->setBaudRate(BAUD110);
- }
- else if (hlp == "300") {
- _serialPort->setBaudRate(BAUD300);
- }
- else if (hlp == "600") {
- _serialPort->setBaudRate(BAUD600);
- }
- else if (hlp == "1200") {
- _serialPort->setBaudRate(BAUD1200);
- }
- else if (hlp == "2400") {
- _serialPort->setBaudRate(BAUD2400);
- }
- else if (hlp == "4800") {
- _serialPort->setBaudRate(BAUD4800);
- }
- else if (hlp == "9600") {
- _serialPort->setBaudRate(BAUD9600);
- }
- else if (hlp == "19200") {
- _serialPort->setBaudRate(BAUD19200);
- }
- else if (hlp == "38400") {
- _serialPort->setBaudRate(BAUD38400);
- }
- else if (hlp == "57600") {
- _serialPort->setBaudRate(BAUD57600);
- }
- else if (hlp == "115200") {
- _serialPort->setBaudRate(BAUD115200);
- }
-
- // Parity
- // ------
- hlp = settings.value("serialParity").toString();
- if (hlp == "NONE") {
- _serialPort->setParity(PAR_NONE);
- }
- else if (hlp == "ODD") {
- _serialPort->setParity(PAR_ODD);
- }
- else if (hlp == "EVEN") {
- _serialPort->setParity(PAR_EVEN);
- }
- else if (hlp == "SPACE") {
- _serialPort->setParity(PAR_SPACE);
- }
-
- // Data Bits
- // ---------
- hlp = settings.value("serialDataBits").toString();
- if (hlp == "5") {
- _serialPort->setDataBits(DATA_5);
- }
- else if (hlp == "6") {
- _serialPort->setDataBits(DATA_6);
- }
- else if (hlp == "7") {
- _serialPort->setDataBits(DATA_7);
- }
- else if (hlp == "8") {
- _serialPort->setDataBits(DATA_8);
- }
- hlp = settings.value("serialStopBits").toString();
- if (hlp == "1") {
- _serialPort->setStopBits(STOP_1);
- }
- else if (hlp == "2") {
- _serialPort->setStopBits(STOP_2);
- }
-
- // Flow Control
- // ------------
- hlp = settings.value("serialFlowControl").toString();
- if (hlp == "XONXOFF") {
- _serialPort->setFlowControl(FLOW_XONXOFF);
- }
- else if (hlp == "HARDWARE") {
- _serialPort->setFlowControl(FLOW_HARDWARE);
- }
- else {
- _serialPort->setFlowControl(FLOW_OFF);
- }
-
- // Open Serial Port
- // ----------------
- _serialPort->open(QIODevice::ReadWrite|QIODevice::Unbuffered);
- if (!_serialPort->isOpen()) {
- delete _serialPort;
- _serialPort = 0;
- emit(newMessage((_staID + ": Cannot open serial port\n"), true));
- }
- connect(_serialPort, SIGNAL(readyRead()),
- this, SLOT(slotSerialReadyRead()));
-
- // Automatic NMEA
- // --------------
- if (settings.value("serialAutoNMEA").toString() == "Auto") {
- _serialNMEA = AUTO_NMEA;
-
- QString fName = settings.value("serialFileNMEA").toString();
- if (!fName.isEmpty()) {
- _serialOutFile = new QFile(fName);
- if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
- _serialOutFile->open(QIODevice::WriteOnly | QIODevice::Append);
- }
- else {
- _serialOutFile->open(QIODevice::WriteOnly);
- }
- }
- }
-
- // Manual NMEA
- // -----------
- else {
- _serialNMEA = MANUAL_NMEA;
- }
- }
-
- if (!_staID.isEmpty()) {
- _latencyChecker = new latencyChecker(_staID);
- }
- else {
- _latencyChecker = 0;
- }
-}
-
-// Instantiate the decoder
-//////////////////////////////////////////////////////////////////////////////
-t_irc bncGetThread::initDecoder() {
-
- _decoder = 0;
-
- if (_format.indexOf("RTCM_2") != -1 || _format.indexOf("RTCM2") != -1 ||
- _format.indexOf("RTCM 2") != -1 ) {
- emit(newMessage(_staID + ": Get data in RTCM 2.x format", true));
- _decoder = new RTCM2Decoder(_staID.data());
- }
- else if (_format.indexOf("RTCM_3") != -1 || _format.indexOf("RTCM3") != -1 ||
- _format.indexOf("RTCM 3") != -1 ) {
- emit(newMessage(_staID + ": Get data in RTCM 3.x format", true));
- RTCM3Decoder* newDecoder = new RTCM3Decoder(_staID, _rawFile);
- _decoder = newDecoder;
- connect((RTCM3Decoder*) newDecoder, SIGNAL(newMessage(QByteArray,bool)),
- this, SIGNAL(newMessage(QByteArray,bool)));
- }
- else if (_format.indexOf("GPSS") != -1 || _format.indexOf("BNC") != -1) {
- emit(newMessage(_staID + ": Get Data in GPSS format", true));
- _decoder = new gpssDecoder();
- }
- else if (_format.indexOf("ZERO") != -1) {
- emit(newMessage(_staID + ": Get data in original format", true));
- _decoder = new bncZeroDecoder(_staID);
- }
- else if (_format.indexOf("RTNET") != -1) {
- emit(newMessage(_staID + ": Get data in RTNet format", true));
- _decoder = new bncRtnetDecoder();
- }
- else if (_format.indexOf("HASS2ASCII") != -1) {
- emit(newMessage(_staID + ": Get data in HASS2ASCII format", true));
- _decoder = new hassDecoder(_staID);
- }
- else {
- emit(newMessage(_staID + ": Unknown data format " + _format, true));
- _isToBeDeleted = true;
- return failure;
- }
-
- msleep(100); //sleep 0.1 sec
-
- _decoder->initRinex(_staID, _mountPoint, _latitude, _longitude,
- _nmea, _ntripVersion);
-
- if (_rawFile) {
- _decodersRaw[_staID] = _decoder;
- }
-
- // Initialize PPP Client?
- // ----------------------
-#ifndef MLS_SOFTWARE
- bncSettings settings;
- if (settings.value("pppMount").toString() == _staID) {
- _PPPclient = new bncPPPclient(_staID);
- bncApp* app = (bncApp*) qApp;
- app->_bncPPPclient = _PPPclient;
- qRegisterMetaType("bncTime");
- connect(_PPPclient, SIGNAL(newPosition(bncTime, double, double, double)),
- this, SIGNAL(newPosition(bncTime, double, double, double)));
- connect(_PPPclient, SIGNAL(newNMEAstr(QByteArray)),
- this, SIGNAL(newNMEAstr(QByteArray)));
-#ifdef PPP_DLL_INTERFACE
- _dllInterface = new t_dllInterface();
-#endif
- }
-#endif
-
- return success;
-}
-
-// Current decoder in use
-////////////////////////////////////////////////////////////////////////////
-GPSDecoder* bncGetThread::decoder() {
- if (!_rawFile) {
- return _decoder;
- }
- else {
- if (_decodersRaw.contains(_staID) || initDecoder() == success) {
- return _decodersRaw[_staID];
- }
- }
- return 0;
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncGetThread::~bncGetThread() {
- if (isRunning()) {
- wait();
- }
- if (_query) {
- _query->stop();
- _query->deleteLater();
- }
- delete _PPPclient;
-#ifdef PPP_DLL_INTERFACE
- delete _dllInterface;
-#endif
- if (_rawFile) {
- QMapIterator it(_decodersRaw);
- while (it.hasNext()) {
- it.next();
- delete it.value();
- }
- }
- else {
- delete _decoder;
- }
- delete _rawFile;
- delete _serialOutFile;
- delete _serialPort;
- delete _latencyChecker;
- emit getThreadFinished(_staID);
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncGetThread::terminate() {
- _isToBeDeleted = true;
- if (!isRunning()) {
- delete this;
- }
-}
-
-// Run
-////////////////////////////////////////////////////////////////////////////
-void bncGetThread::run() {
-
- while (true) {
- try {
- if (_isToBeDeleted) {
- QThread::exit(0);
- this->deleteLater();
- return;
- }
-
- if (tryReconnect() != success) {
- if (_latencyChecker) {
- _latencyChecker->checkReconnect();
- }
- continue;
- }
-
- // Delete old observations
- // -----------------------
- if (_rawFile) {
- QMapIterator itDec(_decodersRaw);
- while (itDec.hasNext()) {
- itDec.next();
- GPSDecoder* decoder = itDec.value();
- decoder->_obsList.clear();
- }
- }
- else {
- _decoder->_obsList.clear();
- }
-
- // Read Data
- // ---------
- QByteArray data;
- if (_query) {
- _query->waitForReadyRead(data);
- }
- else if (_rawFile) {
- data = _rawFile->readChunk();
- _format = _rawFile->format();
- _staID = _rawFile->staID();
-
- if (data.isEmpty()) {
- cout << "no more data" << endl;
- ((bncApp*) qApp)->stopCombination();
- QThread::exit(0);
- delete this;
- ::exit(0);
- }
- }
- qint64 nBytes = data.size();
-
- // Timeout, reconnect
- // ------------------
- if (nBytes == 0) {
- if (_latencyChecker) {
- _latencyChecker->checkReconnect();
- }
- emit(newMessage(_staID + ": Data timeout, reconnecting", true));
- msleep(10000); //sleep 10 sec, G. Weber
- continue;
- }
- else {
- emit newBytes(_staID, nBytes);
- }
-
- // Output Data
- // -----------
- if (_rawOutput) {
- bncApp* app = (bncApp*) qApp;
- app->writeRawData(data, _staID, _format);
- }
-
- if (_serialPort) {
- slotSerialReadyRead();
- _serialPort->write(data);
- }
-
- // Decode Data
- // -----------
- vector errmsg;
- if (!decoder()) {
- _isToBeDeleted = true;
- continue;
- }
- decoder()->_obsList.clear();
- t_irc irc = decoder()->Decode(data.data(), data.size(), errmsg);
-
- // Perform various scans and checks
- // --------------------------------
- if (_latencyChecker) {
- _latencyChecker->checkOutage(irc == success);
- _latencyChecker->checkObsLatency(decoder()->_obsList);
- _latencyChecker->checkCorrLatency(decoder()->corrGPSEpochTime());
-
- emit newLatency(_staID, _latencyChecker->currentLatency());
- }
-
- scanRTCM();
-
- // Loop over all observations (observations output)
- // ------------------------------------------------
- QListIterator it(decoder()->_obsList);
- bool firstObs = true;
- while (it.hasNext()) {
- const t_obs& obs = it.next();
-
- QString prn = QString("%1%2").arg(obs.satSys)
- .arg(obs.satNum, 2, 10, QChar('0'));
- long iSec = long(floor(obs.GPSWeeks+0.5));
- long obsTime = obs.GPSWeek * 7*24*3600 + iSec;
-
- // Check observation epoch
- // -----------------------
- if (!_rawFile && !dynamic_cast(decoder())) {
- int week;
- double sec;
- currentGPSWeeks(week, sec);
- long currTime = week * 7*24*3600 + long(sec);
- const double maxDt = 600.0;
- if (fabs(currTime - obsTime) > maxDt) {
- emit( newMessage(_staID + ": Wrong observation epoch(s)", false) );
- continue;
- }
- }
-
- // Check observations coming twice (e.g. KOUR0 Problem)
- // ----------------------------------------------------
- if (!_rawFile) {
- QMap::const_iterator it = _prnLastEpo.find(prn);
- if (it != _prnLastEpo.end()) {
- long oldTime = it.value();
- if (obsTime < oldTime) {
- emit( newMessage(_staID +
- ": old observation " + prn.toAscii(), false));
- continue;
- }
- else if (obsTime == oldTime) {
- emit( newMessage(_staID +
- ": observation coming more than once " + prn.toAscii(), false));
- continue;
- }
- }
- _prnLastEpo[prn] = obsTime;
- }
-
- decoder()->dumpRinexEpoch(obs, _format);
-
- // PPP Client
- // ----------
-#ifndef MLS_SOFTWARE
- if (_PPPclient && _staID == _PPPclient->staID()) {
- _PPPclient->putNewObs(obs);
-#ifdef PPP_DLL_INTERFACE
- _dllInterface->putNewObs(obs);
-#endif
- }
-#endif
-
- // Emit new observation signal
- // ---------------------------
- if (!_isToBeDeleted) {
- emit newObs(_staID, firstObs, obs);
- }
- firstObs = false;
- }
- decoder()->_obsList.clear();
- }
- catch (Exception& exc) {
- emit(newMessage(_staID + " " + exc.what(), true));
- _isToBeDeleted = true;
- }
- catch (...) {
- emit(newMessage(_staID + " bncGetThread exception", true));
- _isToBeDeleted = true;
- }
- }
-}
-
-// Try Re-Connect
-////////////////////////////////////////////////////////////////////////////
-t_irc bncGetThread::tryReconnect() {
-
- // Easy Return
- // -----------
- if (_query && _query->status() == bncNetQuery::running) {
- _nextSleep = 0;
- if (_rawFile) {
- QMapIterator itDec(_decodersRaw);
- while (itDec.hasNext()) {
- itDec.next();
- GPSDecoder* decoder = itDec.value();
- decoder->setRinexReconnectFlag(false);
- }
- }
- else {
- _decoder->setRinexReconnectFlag(false);
- }
- return success;
- }
-
- // Start a new query
- // -----------------
- if (!_rawFile) {
-
- sleep(_nextSleep);
- if (_nextSleep == 0) {
- _nextSleep = 1;
- }
- else {
- _nextSleep = 2 * _nextSleep;
- if (_nextSleep > 256) {
- _nextSleep = 256;
- }
-#ifdef MLS_SOFTWARE
- if (_nextSleep > 4) {
- _nextSleep = 4;
- }
-#endif
- }
-
- delete _query;
- if (_ntripVersion == "U") {
- _query = new bncNetQueryUdp();
- }
- else if (_ntripVersion == "R") {
- _query = new bncNetQueryRtp();
- }
- else if (_ntripVersion == "S") {
- _query = new bncNetQueryS();
- }
- else if (_ntripVersion == "N") {
- _query = new bncNetQueryV0();
- }
- else if (_ntripVersion == "UN") {
- _query = new bncNetQueryUdp0();
- }
- else if (_ntripVersion == "2") {
- _query = new bncNetQueryV2(false);
- }
- else if (_ntripVersion == "2s") {
- _query = new bncNetQueryV2(true);
- }
- else {
- _query = new bncNetQueryV1();
- }
- if (_nmea == "yes" && _serialNMEA != AUTO_NMEA) {
- QByteArray gga = ggaString(_latitude, _longitude, "100.0");
- _query->startRequest(_mountPoint, gga);
- }
- else {
- _query->startRequest(_mountPoint, "");
- }
- if (_query->status() != bncNetQuery::running) {
- return failure;
- }
- }
-
- if (_rawFile) {
- QMapIterator itDec(_decodersRaw);
- while (itDec.hasNext()) {
- itDec.next();
- GPSDecoder* decoder = itDec.value();
- decoder->setRinexReconnectFlag(false);
- }
- }
- else {
- _decoder->setRinexReconnectFlag(false);
- }
-
- return success;
-}
-
-// RTCM scan output
-//////////////////////////////////////////////////////////////////////////////
-void bncGetThread::scanRTCM() {
-
- if (!decoder()) {
- return;
- }
-
- bncSettings settings;
- if ( Qt::CheckState(settings.value("scanRTCM").toInt()) == Qt::Checked ) {
-
- if ( _miscMount == _staID || _miscMount == "ALL" ) {
-
- // RTCM message types
- // ------------------
- for (int ii = 0; ii _typeList.size(); ii++) {
- QString type = QString("%1 ").arg(decoder()->_typeList[ii]);
- emit(newMessage(_staID + ": Received message type " + type.toAscii(), true));
- }
-
- // RTCMv3 antenna descriptor
- // -------------------------
- for (int ii=0;ii_antType.size();ii++) {
- QString ant1 = QString("%1 ").arg(decoder()->_antType[ii]);
- emit(newMessage(_staID + ": Antenna descriptor " + ant1.toAscii(), true));
- }
-
- // RTCM Antenna Coordinates
- // ------------------------
- for (int ii=0; ii _antList.size(); ii++) {
- QByteArray antT;
- if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::ARP) {
- antT = "ARP";
- }
- else if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::APC) {
- antT = "APC";
- }
- QByteArray ant1, ant2, ant3;
- ant1 = QString("%1 ").arg(decoder()->_antList[ii].xx,0,'f',4).toAscii();
- ant2 = QString("%1 ").arg(decoder()->_antList[ii].yy,0,'f',4).toAscii();
- ant3 = QString("%1 ").arg(decoder()->_antList[ii].zz,0,'f',4).toAscii();
- emit(newMessage(_staID + ": " + antT + " (ITRF) X " + ant1 + "m", true));
- emit(newMessage(_staID + ": " + antT + " (ITRF) Y " + ant2 + "m", true));
- emit(newMessage(_staID + ": " + antT + " (ITRF) Z " + ant3 + "m", true));
- double hh = 0.0;
- if (decoder()->_antList[ii].height_f) {
- hh = decoder()->_antList[ii].height;
- QByteArray ant4 = QString("%1 ").arg(hh,0,'f',4).toAscii();
- emit(newMessage(_staID + ": Antenna height above marker " + ant4 + "m", true));
- }
- emit(newAntCrd(_staID, decoder()->_antList[ii].xx,
- decoder()->_antList[ii].yy, decoder()->_antList[ii].zz,
- hh, antT));
- }
- }
- }
-
-#ifdef MLS_SOFTWARE
- for (int ii=0; ii _antList.size(); ii++) {
- QByteArray antT;
- if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::ARP) {
- antT = "ARP";
- }
- else if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::APC) {
- antT = "APC";
- }
- double hh = 0.0;
- if (decoder()->_antList[ii].height_f) {
- hh = decoder()->_antList[ii].height;
- }
- emit(newAntCrd(_staID, decoder()->_antList[ii].xx,
- decoder()->_antList[ii].yy, decoder()->_antList[ii].zz,
- hh, antT));
- }
-
- for (int ii = 0; ii _typeList.size(); ii++) {
- emit(newRTCMMessage(_staID, decoder()->_typeList[ii]));
- }
-#endif
-
- decoder()->_typeList.clear();
- decoder()->_antType.clear();
- decoder()->_antList.clear();
-}
-
-// Handle Data from Serial Port
-////////////////////////////////////////////////////////////////////////////
-void bncGetThread::slotSerialReadyRead() {
- if (_serialPort) {
- int nb = _serialPort->bytesAvailable();
- if (nb > 0) {
- QByteArray data = _serialPort->read(nb);
-
- if (_serialNMEA == AUTO_NMEA) {
- int i1 = data.indexOf("$GPGGA");
- if (i1 != -1) {
- int i2 = data.indexOf("*", i1);
- if (i2 != -1 && data.size() > i2 + 1) {
- QByteArray gga = data.mid(i1,i2-i1+3);
- _query->sendNMEA(gga);
- }
- }
- }
-
- if (_serialOutFile) {
- _serialOutFile->write(data);
- _serialOutFile->flush();
- }
- }
- }
-}
Index: trunk/BNC/bncgetthread.h
===================================================================
--- trunk/BNC/bncgetthread.h (revision 4277)
+++ (revision )
@@ -1,135 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCGETTHREAD_H
-#define BNCGETTHREAD_H
-
-#include
-#include
-#include
-#include
-
-#include "RTCM/GPSDecoder.h"
-#include "rtcm3torinex.h"
-#include "bncconst.h"
-#include "bncnetquery.h"
-#include "bnctime.h"
-#include "bncrawfile.h"
-
-class QextSerialPort;
-class latencyChecker;
-class bncPPPclient;
-#ifdef PPP_DLL_INTERFACE
-class t_dllInterface;
-#endif
-
-class bncGetThread : public QThread {
- Q_OBJECT
-
- public:
- bncGetThread(bncRawFile* rawFile);
- bncGetThread(const QUrl& mountPoint,
- const QByteArray& format,
- const QByteArray& latitude,
- const QByteArray& longitude,
- const QByteArray& nmea,
- const QByteArray& ntripVersion);
-
- bncNetQuery::queryStatus queryStatus() {
- if (_query) {
- return _query->status();
- }
- else {
- return bncNetQuery::init;
- }
- }
-
- protected:
- ~bncGetThread();
-
- public:
- void terminate();
-
- QByteArray staID() const {return _staID;}
- QUrl mountPoint() const {return _mountPoint;}
- QByteArray latitude() const {return _latitude;}
- QByteArray longitude() const {return _longitude;}
- QByteArray ntripVersion() const {return _ntripVersion;}
-
- signals:
- void newBytes(QByteArray staID, double nbyte);
- void newLatency(QByteArray staID, double clate);
- void newObs(QByteArray staID, bool firstObs, t_obs obs);
- void newAntCrd(QByteArray staID, double xx, double yy, double zz,
- double hh, QByteArray antType);
- void newMessage(QByteArray msg, bool showOnScreen);
- void newRTCMMessage(QByteArray staID, int msgID);
- void getThreadFinished(QByteArray staID);
- void newPosition(bncTime time, double x, double y, double z);
- void newNMEAstr(QByteArray str);
-
- public:
- virtual void run();
-
- private slots:
- void slotSerialReadyRead();
-
- private:
- enum t_serialNMEA {NO_NMEA, MANUAL_NMEA, AUTO_NMEA};
- t_irc initDecoder();
- GPSDecoder* decoder();
-
- void initialize();
- t_irc tryReconnect();
- void scanRTCM();
-
- QMap _decodersRaw;
- GPSDecoder* _decoder;
- bncNetQuery* _query;
- QUrl _mountPoint;
- QByteArray _staID;
- QByteArray _format;
- QByteArray _latitude;
- QByteArray _longitude;
- QByteArray _height;
- QByteArray _nmea;
- QByteArray _ntripVersion;
- int _nextSleep;
- int _iMount;
- bncRawFile* _rawFile;
- QextSerialPort* _serialPort;
- bool _isToBeDeleted;
- latencyChecker* _latencyChecker;
- QString _miscMount;
- QFile* _serialOutFile;
- t_serialNMEA _serialNMEA;
- bncPPPclient* _PPPclient;
- bool _rawOutput;
- QMap _prnLastEpo;
-#ifdef PPP_DLL_INTERFACE
- t_dllInterface* _dllInterface;
-#endif
-};
-
-#endif
Index: trunk/BNC/bnchlpdlg.cpp
===================================================================
--- trunk/BNC/bnchlpdlg.cpp (revision 4277)
+++ (revision )
@@ -1,106 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncHlpDlg
- *
- * Purpose: Displays the help
- *
- * Author: L. Mervart
- *
- * Created: 24-Sep-2006
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include "bnchlpdlg.h"
-#include "bnchtml.h"
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncHlpDlg::bncHlpDlg(QWidget* parent, const QUrl& url) :
- QDialog(parent) {
-
- const int ww = QFontMetrics(font()).width('w');
-
- bncHtml* _tb = new bncHtml;
- setWindowTitle("Help Contents");
- _tb->setSource(url);
- _tb->setReadOnly(true);
- connect(_tb, SIGNAL(backwardAvailable(bool)),
- this, SLOT(backwardAvailable(bool)));
- connect(_tb, SIGNAL(forwardAvailable(bool)),
- this, SLOT(forwardAvailable(bool)));
-
- QVBoxLayout* dlgLayout = new QVBoxLayout;
- dlgLayout->addWidget(_tb);
-
- QHBoxLayout* butLayout = new QHBoxLayout;
-
- _backButton = new QPushButton("Backward");
- _backButton->setMaximumWidth(10*ww);
- _backButton->setEnabled(false);
- connect(_backButton, SIGNAL(clicked()), _tb, SLOT(backward()));
- butLayout->addWidget(_backButton);
-
- _forwButton = new QPushButton("Forward");
- _forwButton->setMaximumWidth(10*ww);
- _forwButton->setEnabled(false);
- connect(_forwButton, SIGNAL(clicked()), _tb, SLOT(forward()));
- butLayout->addWidget(_forwButton);
-
- _closeButton = new QPushButton("Close");
- _closeButton->setMaximumWidth(10*ww);
- butLayout->addWidget(_closeButton);
- connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
-
- dlgLayout->addLayout(butLayout);
-
- setLayout(dlgLayout);
- resize(60*ww, 60*ww);
- show();
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncHlpDlg::~bncHlpDlg() {
- delete _tb;
- delete _backButton;
- delete _forwButton;
- delete _closeButton;
-}
-
-// Slots
-////////////////////////////////////////////////////////////////////////////
-void bncHlpDlg::backwardAvailable(bool avail) {
- _backButton->setEnabled(avail);
-}
-
-void bncHlpDlg::forwardAvailable(bool avail) {
- _forwButton->setEnabled(avail);
-}
Index: trunk/BNC/bnchlpdlg.h
===================================================================
--- trunk/BNC/bnchlpdlg.h (revision 4277)
+++ (revision )
@@ -1,53 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCHLPDLG_H
-#define BNCHLPDLG_H
-
-#include
-#include
-
-class bncHtml;
-
-class bncHlpDlg : public QDialog {
- Q_OBJECT
-
- public:
- bncHlpDlg(QWidget* parent, const QUrl& url);
- ~bncHlpDlg();
-
- signals:
-
- public slots:
- void backwardAvailable(bool);
- void forwardAvailable(bool);
-
- private:
- bncHtml* _tb;
- QPushButton* _backButton;
- QPushButton* _forwButton;
- QPushButton* _closeButton;
-};
-
-#endif
Index: trunk/BNC/bnchtml.cpp
===================================================================
--- trunk/BNC/bnchtml.cpp (revision 4277)
+++ (revision )
@@ -1,69 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncHtml
- *
- * Purpose: HTML Browser
- *
- * Author: L. Mervart
- *
- * Created: 14-Sep-2006
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include "bnchtml.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncHtml::bncHtml() : QTextBrowser() {
-
- connect(this,SIGNAL(anchorClicked(const QUrl&)),
- this,SLOT(slotAnchorClicked(const QUrl&)));
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncHtml::~bncHtml() {
-
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncHtml::slotAnchorClicked(const QUrl& url) {
-
-
- QString href = url.toString();
- if (href.indexOf(':') != 0) {
- QUrl urlNew; urlNew.setPath(":bnchelp.html" + href);
- setSource(url);
- }
-}
Index: trunk/BNC/bnchtml.h
===================================================================
--- trunk/BNC/bnchtml.h (revision 4277)
+++ (revision )
@@ -1,40 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCHTML_H
-#define BNCHTML_H
-
-#include
-
-class bncHtml : public QTextBrowser {
- Q_OBJECT
-
- public:
- bncHtml();
- ~bncHtml();
-
- public slots:
- void slotAnchorClicked(const QUrl& url);
-};
-#endif
Index: trunk/BNC/bncipport.cpp
===================================================================
--- trunk/BNC/bncipport.cpp (revision 4277)
+++ (revision )
@@ -1,159 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2009
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncIpPort
- *
- * Purpose: Select host for stream retrieval without NTRIP
- *
- * Author: G. Weber
- *
- * Created: 18-Feb-2009
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-
-#include "bncipport.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncIpPort::bncIpPort(QWidget* parent) : QDialog(parent) {
-
- setMinimumSize(400,150);
- QVBoxLayout* mainLayout = new QVBoxLayout(this);
- QGridLayout* editLayout = new QGridLayout;
-
- setWindowTitle(tr("Add Stream from TCP/IP Port"));
-
- _ipHostLineEdit = new QLineEdit();
- _ipPortLineEdit = new QLineEdit();
- _ipMountLineEdit = new QLineEdit();
- _ipFormatLineEdit = new QLineEdit();
- _ipLatLineEdit = new QLineEdit();
- _ipLonLineEdit = new QLineEdit();
-
- int ww = QFontMetrics(font()).width('w');
- _ipPortLineEdit->setMaximumWidth(9*ww);
- _ipMountLineEdit->setMaximumWidth(9*ww);
- _ipFormatLineEdit->setMaximumWidth(9*ww);
- _ipLatLineEdit->setMaximumWidth(9*ww);
- _ipLonLineEdit->setMaximumWidth(9*ww);
-
- // WhatsThis
- // ---------
- _ipHostLineEdit->setWhatsThis(tr("If no proxy server is involed in the communication, BNC allows to retrieve streams via TCP directly from an IP address without using the NTRIP transport protocol.
Enter the IP address of the stream providing host.
"));
- _ipPortLineEdit->setWhatsThis(tr("Enter the IP port number of the stream providing host.
"));
- _ipMountLineEdit->setWhatsThis(tr("Specify a mountpoint.
Recommended is a 4-character station ID.
Example: FFMJ
"));
- _ipFormatLineEdit->setWhatsThis(tr("Specify the stream format.
Available options are 'RTCM_2', 'RTCM_3', RTNET, and 'ZERO'.
"));
- _ipLatLineEdit->setWhatsThis(tr("Enter the approximate latitude of the stream providing receiver in degrees.
Example: 45.32
"));
- _ipLonLineEdit->setWhatsThis(tr("Enter the approximate longitude of the stream providing receiver in degrees.
Example: -15.20"));
-
- editLayout->addWidget(new QLabel(tr("Host")), 0, 0, Qt::AlignRight);
- editLayout->addWidget(_ipHostLineEdit, 0, 1);
- editLayout->addWidget(new QLabel(tr("Port")), 0, 2, Qt::AlignRight);
- editLayout->addWidget(_ipPortLineEdit, 0, 3);
- editLayout->addWidget(new QLabel(tr("Mountpoint")),1, 0, Qt::AlignRight);
- editLayout->addWidget(_ipMountLineEdit, 1, 1);
- editLayout->addWidget(new QLabel(tr("Format")), 1, 2, Qt::AlignRight);
- editLayout->addWidget(_ipFormatLineEdit, 1, 3);
- editLayout->addWidget(new QLabel(tr("Latitude")), 2, 0, Qt::AlignRight);
- editLayout->addWidget(_ipLatLineEdit, 2, 1);
- editLayout->addWidget(new QLabel(tr("Longitude")), 2, 2, Qt::AlignRight);
- editLayout->addWidget(_ipLonLineEdit, 2, 3);
-
- mainLayout->addLayout(editLayout);
-
- _buttonWhatsThis = new QPushButton(tr("Help=Shift+F1"), this);
- connect(_buttonWhatsThis, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
-
- _buttonCancel = new QPushButton(tr("Cancel"), this);
- connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
-
- _buttonOK = new QPushButton(tr("OK"), this);
- connect(_buttonOK, SIGNAL(clicked()), this, SLOT(accept()));
-
- _buttonOK->setDefault(true);
-
- QHBoxLayout* buttonLayout = new QHBoxLayout;
-
- buttonLayout->addWidget(_buttonWhatsThis);
- buttonLayout->addStretch(1);
- buttonLayout->addWidget(_buttonCancel);
- buttonLayout->addWidget(_buttonOK);
-
- mainLayout->addLayout(buttonLayout);
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncIpPort::~bncIpPort() {
- delete _buttonCancel;
- delete _buttonOK;
- delete _buttonWhatsThis;
-}
-
-// Accept slot
-////////////////////////////////////////////////////////////////////////////
-void bncIpPort::accept() {
-
- QStringList* mountPoints = new QStringList;
-
- if ( !_ipHostLineEdit->text().isEmpty() &&
- !_ipPortLineEdit->text().isEmpty() &&
- !_ipMountLineEdit->text().isEmpty() &&
- !_ipFormatLineEdit->text().isEmpty() &&
- !_ipLatLineEdit->text().isEmpty() &&
- !_ipLonLineEdit->text().isEmpty() ) {
-
- mountPoints->push_back("//" + _ipHostLineEdit->text() + ":"
- + _ipPortLineEdit->text() + "/"
- + _ipMountLineEdit->text() + " "
- + _ipFormatLineEdit->text() + " "
- + _ipLatLineEdit->text() + " "
- + _ipLonLineEdit->text() + " "
- + "no N");
- } else {
- QMessageBox::warning(this, tr("Warning"),
- tr("Incomplete settings"),
- QMessageBox::Ok);
- }
-
- emit newMountPoints(mountPoints);
-
- QDialog::accept();
-}
-
-// Whats This Help
-void bncIpPort::slotWhatsThis() {
-QWhatsThis::enterWhatsThisMode();
-}
-
Index: trunk/BNC/bncipport.h
===================================================================
--- trunk/BNC/bncipport.h (revision 4277)
+++ (revision )
@@ -1,60 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2009
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCIPPORT_H
-#define BNCIPPORT_H
-
-#include
-#include
-#include
-
-class bncIpPort : public QDialog {
- Q_OBJECT
-
- public:
- bncIpPort(QWidget* parent);
- ~bncIpPort();
-
- signals:
- void newMountPoints(QStringList* mountPoints);
-
- private slots:
- virtual void accept();
- void slotWhatsThis();
-
- private:
- QLineEdit* _ipHostLineEdit;
- QLineEdit* _ipPortLineEdit;
- QLineEdit* _ipMountLineEdit;
- QLineEdit* _ipFormatLineEdit;
- QLineEdit* _ipLatLineEdit;
- QLineEdit* _ipLonLineEdit;
-
- QPushButton* _buttonGet;
- QPushButton* _buttonCancel;
- QPushButton* _buttonOK;
- QPushButton* _buttonWhatsThis;
-};
-
-#endif
Index: trunk/BNC/bncmain.cpp
===================================================================
--- trunk/BNC/bncmain.cpp (revision 4277)
+++ (revision )
@@ -1,216 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: main
- *
- * Purpose: Application starts here
- *
- * Author: L. Mervart
- *
- * Created: 24-Dec-2005
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-#include
-#include
-#include
-#include
-
-#include "bncapp.h"
-#include "bncwindow.h"
-#include "bncsettings.h"
-#include "bncversion.h"
-#include "upload/bncephuploadcaster.h"
-#ifdef USE_POSTPROCESSING
-# include "rinex/bncpostprocess.h"
-# include "rinex/reqcedit.h"
-# include "rinex/reqcanalyze.h"
-#endif
-
-using namespace std;
-
-void catch_signal(int) {
- cout << "Program Interrupted by Ctrl-C" << endl;
- exit(0);
-}
-
-// Main Program
-/////////////////////////////////////////////////////////////////////////////
-int main(int argc, char *argv[]) {
-
- bool GUIenabled = true;
- QByteArray rawFileName;
- QString confFileName;
-
- QByteArray printHelp = "Usage: bnc --nw \n"
- " --conf \n"
- " --file \n"
- " --key \n";
-
- for (int ii = 1; ii < argc; ii++) {
- if (QRegExp("--?help").exactMatch(argv[ii])) {
- cout << printHelp.data();
- exit(0);
- }
- if (QRegExp("--?nw").exactMatch(argv[ii])) {
- GUIenabled = false;
- }
- if (ii + 1 < argc) {
- if (QRegExp("--?conf").exactMatch(argv[ii])) {
- confFileName = QString(argv[ii+1]);
- }
- if (QRegExp("--?file").exactMatch(argv[ii])) {
- GUIenabled = false;
- rawFileName = QByteArray(argv[ii+1]);
- }
- }
- }
-
-#ifdef Q_OS_MAC
- if (argc== 3 && GUIenabled) {
- confFileName = QString(argv[2]);
- }
-#else
- if (argc == 2 && GUIenabled) {
- confFileName = QString(argv[1]);
- }
-#endif
-
- bncApp app(argc, argv, GUIenabled);
-
- app.setApplicationName("BNC");
- app.setOrganizationName("BKG");
- app.setOrganizationDomain("www.bkg.bund.de");
- app.setConfFileName( confFileName );
-
- bncSettings settings;
-
- for (int ii = 1; ii < argc - 2; ii++) {
- if (QRegExp("--?key").exactMatch(argv[ii])) {
- QString key(argv[ii+1]);
- QString val(argv[ii+2]);
- settings.setValue(key, val);
- }
- }
-
- // Interactive Mode - open the main window
- // ---------------------------------------
- if (GUIenabled) {
-
- app.setMode(bncApp::interactive);
-
- QString fontString = settings.value("font").toString();
- if ( !fontString.isEmpty() ) {
- QFont newFont;
- if (newFont.fromString(fontString)) {
- QApplication::setFont(newFont);
- }
- }
-
- app.setWindowIcon(QPixmap(":ntrip-logo.png"));
-
- bncWindow* bncWin = new bncWindow();
- bncWin->show();
- }
-
-#ifdef USE_POSTPROCESSING
-
- // Post-Processing PPP
- // -------------------
- else if (settings.value("pppSPP").toString() == "Post-Processing") {
- app.setMode(bncApp::batchPostProcessing);
- t_postProcessing* postProcessing = new t_postProcessing(0);
- postProcessing->start();
- }
-
- // Post-Processing reqc edit
- // -------------------------
- else if (settings.value("reqcAction").toString() == "Edit/Concatenate") {
- app.setMode(bncApp::batchPostProcessing);
- t_reqcEdit* reqcEdit = new t_reqcEdit(0);
- reqcEdit->start();
- }
-
- // Post-Processing reqc analyze
- // ----------------------------
- else if (settings.value("reqcAction").toString() == "Analyze") {
- app.setMode(bncApp::batchPostProcessing);
- t_reqcAnalyze* reqcAnalyze = new t_reqcAnalyze(0);
- reqcAnalyze->start();
- }
-
-#endif
-
- // Non-Interactive (data gathering)
- // --------------------------------
- else {
-
- signal(SIGINT, catch_signal);
-
- bncEphUploadCaster* casterEph = new bncEphUploadCaster(); (void) casterEph;
-
- bncCaster* caster = new bncCaster(settings.value("outFile").toString(),
- settings.value("outPort").toInt());
-
- app.setCaster(caster);
- app.setPort(settings.value("outEphPort").toInt());
- app.setPortCorr(settings.value("corrPort").toInt());
- app.initCombination();
-
- app.connect(caster, SIGNAL(getThreadsFinished()), &app, SLOT(quit()));
-
- ((bncApp*)qApp)->slotMessage("========== Start BNC v" BNCVERSION " =========", true);
-
- // Normal case - data from Internet
- // --------------------------------
- if ( rawFileName.isEmpty() ) {
- app.setMode(bncApp::nonInteractive);
- caster->readMountPoints();
- if (caster->numStations() == 0) {
- exit(0);
- }
- }
-
- // Special case - data from file
- // -----------------------------
- else {
- app.setMode(bncApp::batchPostProcessing);
- bncRawFile* rawFile = new bncRawFile(rawFileName, "",
- bncRawFile::input);
- bncGetThread* getThread = new bncGetThread(rawFile);
- caster->addGetThread(getThread, true);
- }
- }
-
- // Start the application
- // ---------------------
- return app.exec();
-}
Index: trunk/BNC/bncmap.cpp
===================================================================
--- trunk/BNC/bncmap.cpp (revision 4277)
+++ (revision )
@@ -1,296 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncmap
- *
- * Purpose: This class plots map from Ntrip source-table meta data
- *
- * Author: J. Dousa, Pecny, Czech Republic
- * Created: 21-may-2012
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-#include "bncmap.h"
-
-// ------------
-bncMap::bncMap(QWidget* parent) : QDialog(parent)
-{
- _LaOff = 25; // shift longitude
- _mapScen = new QGraphicsScene();
- _mapView = new BncMapView();
- _mapView->setScene(_mapScen);
- _mapView->resetScale();
- slotReadMap();
- slotCreateMap();
- _mapScen->setSceneRect(QRect(0,-90,360,180));
-
- setWindowTitle(tr("Source-Table Map [*]"));
-
- /* close button */
- QPushButton* buttClose = new QPushButton("Close");
- connect(buttClose, SIGNAL(clicked()), this, SLOT(close()));
-
- /* rescale button */
-// QPushButton* buttClean = new QPushButton("Clean");
-// connect(buttClean, SIGNAL(clicked()), this, SLOT(slotCleanMap()));
-
- /* zoom button */
- QPushButton* buttZoomIn = new QPushButton("Zoom +");
- connect(buttZoomIn, SIGNAL(clicked()), this, SLOT(slotZoomIn()));
-
- /* zoom button */
- QPushButton* buttZoomOut = new QPushButton("Zoom -");
- connect(buttZoomOut, SIGNAL(clicked()), this, SLOT(slotZoomOut()));
-
- /* reset button */
- QPushButton* buttReset = new QPushButton("World");
- connect(buttReset, SIGNAL(clicked()), this, SLOT(slotResetMap()));
-
- /* fit button */
- QPushButton* buttFit = new QPushButton("Fit Map");
- connect(buttFit, SIGNAL(clicked()), this, SLOT(slotFitMap()));
-
- /* font reset button */
- QPushButton* buttFont = new QPushButton("Fit Font");
- connect(buttFont, SIGNAL(clicked()), this, SLOT(slotFitFont()));
-
- /* layout */
- QVBoxLayout* MapLayout = new QVBoxLayout;
- QHBoxLayout* ButLayout = new QHBoxLayout;
-
- ButLayout->addWidget(buttZoomIn);
- ButLayout->addWidget(buttZoomOut);
-// ButLayout->addWidget(buttClean);
- ButLayout->addWidget(buttReset);
- ButLayout->addWidget(buttFit);
- ButLayout->addWidget(buttFont);
- ButLayout->addWidget(buttClose);
-
- MapLayout->addWidget(_mapView);
- MapLayout->addLayout(ButLayout);
-
- setLayout(MapLayout);
-
- this->show();
-}
-
-
-// ------------
-bncMap::~bncMap(){
- delete _mapView;
-}
-
-
-// ------------
-void bncMap::slotReadMap()
-{
- QFile world(":worldmap.dat");
- float fi, la;
-
- world.open(QIODevice::ReadOnly | QIODevice::Text);
-
- QTextStream in(&world);
- in.setRealNumberNotation(QTextStream::FixedNotation);
-
- while( ! in.atEnd() ){
-
- in >> la >> fi;
-
- // la = 0-360
- while( la < 0 ){ la += 360; }
- while( la >= 360 ){ la -= 360; }
-
- // fi opposite
- _worldMap << QPointF( la, -fi );
-
- }
- world.close();
-}
-
-
-// ------------
-void bncMap::slotCreateMap()
-{
- // _mapScen->setForegroundBrush(QBrush(Qt::lightGray, Qt::CrossPattern)); // grid
-
- int begIdx = 0;
- int endIdx = 0;
- for( int i=0; i < _worldMap.size(); i++ ){
- if( _worldMap.at(i).x() == 0.0 and _worldMap.at(i).y() == 0.0 ){
- if( i > 0 ){
- endIdx = i-1;
- while( begIdx < endIdx ){
-
- int l1 = 0;
- int l2 = 0;
-
- float la1 = _worldMap.at(begIdx+0).x() + _LaOff;
- float fi1 = _worldMap.at(begIdx+0).y();
- float la2 = _worldMap.at(begIdx+1).x() + _LaOff;
- float fi2 = _worldMap.at(begIdx+1).y();
- begIdx++;
-
- while( la1 < 0 ){ la1 += 360; l1++; }
- while( la1 >= 360 ){ la1 -= 360; l1--; }
- while( la2 < 0 ){ la2 += 360; l2++; }
- while( la2 >= 360 ){ la2 -= 360; l2--; }
-
- if( l1 != 0 and l2 == 0 ){ continue; } // break this line
- if( l2 != 0 and l1 == 0 ){ continue; } // break this line
-
- _mapScen->addLine(la1, fi1, la2, fi2, QPen(QBrush(Qt::gray),0.3));
- }
- }
- if( i+1 < _worldMap.size() ) begIdx = i+1;
- }
- }
-}
-
-
-// ------------
-void bncMap::slotCleanMap()
-{
- QMutexLocker locker(&_mutexMap);
- _mapScen->clear();
- slotCreateMap();
- slotResetMap();
- slotFitFont();
-}
-
-
-// ------------
-void bncMap::slotResetMap()
-{
- _mapView->resetScale();
-}
-
-
-// ------------
-void bncMap::slotFitMap()
-{
- QRectF reg = _allPoints.boundingRect().adjusted(-10,-10,10,10);
-
- _mapView->resetScale();
- _mapView->updateSceneRect(reg);
- _mapView->centerOn(reg.center());
- _mapView->fitInView(reg,Qt::KeepAspectRatio);
-
- slotFitFont();
-}
-
-
-// ------------
-void bncMap::slotFitFont()
-{
- _mapScen->clear();
- slotCreateMap();
-
- float fontrate = _mapView->scale_rate();
- float pointrate = _mapView->scale_rate();
-
- QMapIterator > it(_allNames);
- while( it.hasNext() ){
-
- it.next();
- QString name = it.key();
- QList tmp = it.value();
-
- double la = tmp.at(0).toPointF().x();
- double fi = tmp.at(0).toPointF().y();
- QPen pen = tmp.at(1).value();
- double basPT = tmp.at(2).toDouble();
- double basFT = tmp.at(3).toDouble();
-
- float tmpPT = pointrate * basPT;
- float tmpFT = fontrate * basFT;
-
- if( fontrate > 1 ){
- tmpPT = basPT;
- tmpFT = basFT;
- }
-
- QFont font(QFont("Arial",2));
- font.setPointSizeF( tmpFT );
- font.setStretch(QFont::Unstretched);
- font.setCapitalization(QFont::Capitalize);
-
- QGraphicsTextItem* nameItem = new QGraphicsTextItem( name );
- nameItem->setFont( font );
-
- nameItem->setPos( la - basFT, fi - basFT );
-
- if( tmpPT < 0.15 ) tmpPT = 0.15;
- pen.setWidthF(tmpPT);
-
- _mapScen->addItem( nameItem );
- _mapScen->addEllipse( la, fi, tmpPT, tmpPT, pen );
- }
- _mapView->zoom( 1.0 );
-}
-
-
-// ------------
-void bncMap::slotZoomIn()
-{
- _mapView->zoom( 1.2 );
- slotFitFont();
-}
-
-
-// ------------
-void bncMap::slotZoomOut()
-{
- _mapView->zoom( 1/1.2 );
- slotFitFont();
-}
-
-
-// ------------
-void bncMap::slotNewPoint(QPointF point, QString name, QPen pen, double size)
-{
- float la = point.x() + _LaOff;
- float fi = - point.y();
-
- while( la < 0 ){ la += 360; }
- while( la >= 360 ){ la -= 360; }
-
- QPointF tmppoint(la,fi);
- _allPoints << tmppoint;
-
- if( ! name.isEmpty() ){
-
- QList tmp;
- tmp << tmppoint // QPoint
- << pen // QPen
- << size << 4.5; // base pointsize, fontrate
- _allNames.insert( name, tmp );
- }
-}
Index: trunk/BNC/bncmap.h
===================================================================
--- trunk/BNC/bncmap.h (revision 4277)
+++ (revision )
@@ -1,61 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2012
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-//
-// Author's email: jan.dousa@pecny.cz
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCMAP_H
-#define BNCMAP_H
-
-#include
-#include "bncmapview.h"
-
-class bncMap : public QDialog
-{
- Q_OBJECT
-
- public:
- bncMap(QWidget* parent = 0 );
- ~bncMap();
-
- public slots:
- void slotNewPoint(QPointF, QString, QPen, double);
- void slotResetMap();
- void slotFitFont();
- void slotFitMap();
- void slotZoomIn();
- void slotZoomOut();
- void slotCreateMap();
- void slotCleanMap();
- void slotReadMap();
-
- private:
-
- double _LaOff;
-
- BncMapView* _mapView;
- QGraphicsScene* _mapScen;
- QPolygonF _worldMap;
- QPolygonF _allPoints;
- QMutex _mutexMap;
- QMultiMap< QString, QList > _allNames;
-
-};
-
-#endif
Index: trunk/BNC/bncmapview.cpp
===================================================================
--- trunk/BNC/bncmapview.cpp (revision 4277)
+++ (revision )
@@ -1,174 +1,0 @@
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "bncmapview.h"
-
-
-// -------------
-BncMapView::BncMapView(QWidget* parent) : QGraphicsView(parent)
-{
- setCursor(Qt::OpenHandCursor);
- setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
- resetScale();
-}
-
-/* -------------
- * Sets the current centerpoint. Also updates the scene's center point.
- * Unlike centerOn, which has no way of getting the floating point center
- * back, SetCenter() stores the center point. It also handles the special
- * sidebar case. This function will claim the centerPoint to sceneRec ie.
- * the centerPoint must be within the sceneRec.
- */
-void BncMapView::SetCenter(const QPointF& centerPoint)
-{
- // get the rectangle of the visible area in scene coords
- QRectF visibleArea = mapToScene(rect()).boundingRect();
-
- // get the scene area
- QRectF sceneBounds = sceneRect();
-
- double boundX = + visibleArea.width() / 2.0;
- double boundY = - visibleArea.height() / 2.0; // opposite sign for latitude !
-
- double boundWidth = sceneBounds.width() - boundX * 2.0;
- double boundHeight = sceneBounds.height() - boundY * 2.0;
-
- // the max boundary that the centerPoint can be to
- QRectF bounds(boundX, boundY, boundWidth, boundHeight);
-
- if( bounds.contains(centerPoint) ){
- // we are within the bounds
- _currentCenterPoint = centerPoint;
-
- }else{
-
- // we need to clamp or use the center of the screen
- if( visibleArea.contains(sceneBounds) ){
-
- // use the center of scene ie. we can see the whole scene
- _currentCenterPoint = sceneBounds.center();
-
- }else{
- _currentCenterPoint = centerPoint;
-
- // we need to clamp the center. The centerPoint is too large
- if( centerPoint.x() > bounds.x() + bounds.width() ){
- _currentCenterPoint.setX(bounds.x() + bounds.width());
-
- }else if( centerPoint.x() < bounds.x() ){
- _currentCenterPoint.setX(bounds.x());
- }
-
- // opposite sign for latitude !
- if( centerPoint.y() < - bounds.y() - bounds.height() ){
- _currentCenterPoint.setY( - bounds.y() - bounds.height());
-
- }else if( centerPoint.y() > - bounds.y() ){
- _currentCenterPoint.setY( - bounds.y());
- }
- }
- }
- // update the scrollbars
- centerOn(_currentCenterPoint);
-}
-
-
-// -------------
-void BncMapView::mousePressEvent(QMouseEvent* event)
-{
-// std::cout << " PRES " << event->pos().x() << " " << event->pos().y() << std::endl;
- _lastPanPoint = event->pos();
- setCursor(Qt::ClosedHandCursor);
-}
-
-
-// -------------
-void BncMapView::mouseReleaseEvent(QMouseEvent* /* event */)
-{
- setCursor(Qt::OpenHandCursor);
- _lastPanPoint = QPoint();
-}
-
-
-// -------------
-void BncMapView::mouseMoveEvent(QMouseEvent* event)
-{
- if( !_lastPanPoint.isNull() ){
-
- // get how much we panned
- QPointF delta = mapToScene(_lastPanPoint) - mapToScene(event->pos());
- _lastPanPoint = event->pos();
-
- // update the center ie. do the pan
- SetCenter(GetCenter() + delta);
- }
-}
-
-
-// -------------
-void BncMapView::wheelEvent(QWheelEvent* event)
-{
- // het the position of the mouse before scaling, in scene coords
- QPointF pointBeforeScale(mapToScene(event->pos()));
-
- // get the original screen centerpoint
- QPointF screenCenter = GetCenter();
-
- // scale the view ie. do the zoom
- double scaleFactor = 1.10; // how fast we zoom
- if( event->delta() > 0 ){
-
- // zooming in
- zoom( scaleFactor );
-
- }else{
-
- // zooming out
- zoom( 1.0/scaleFactor );
- }
-
- // get the position after scaling, in scene coords
- QPointF pointAfterScale(mapToScene(event->pos()));
-
- // get the offset of how the screen moved
- QPointF offset = pointBeforeScale - pointAfterScale;
-
- // adjust to the new center for correct zooming
- QPointF newCenter = screenCenter + offset;
- SetCenter(newCenter);
-}
-
-
-// -------------
-void BncMapView::resizeEvent(QResizeEvent* event)
-{
- // get the rectangle of the visible area in scene coords
- QRectF visibleArea = mapToScene(rect()).boundingRect();
- SetCenter(visibleArea.center());
-
- // call the subclass resize so the scrollbars are updated correctly
- QGraphicsView::resizeEvent(event);
-}
-
-
-// -------------
-void BncMapView::resetScale()
-{
- _scale = _scCur = 2.0;
- setMatrix(QMatrix(_scale,0,0,_scale,0,0));
-}
-
-
-// -------------
-void BncMapView::zoom(qreal scale)
-{
- QGraphicsView::scale( scale, scale );
- _scCur = _scCur * scale;
-}
Index: trunk/BNC/bncmapview.h
===================================================================
--- trunk/BNC/bncmapview.h (revision 4277)
+++ (revision )
@@ -1,42 +1,0 @@
-
-#ifndef BNCMAPVIEW_H
-#define BNCMAPVIEW_H
-
-#include
-#include
-#include
-
-class BncMapView : public QGraphicsView
-{
- Q_OBJECT;
-
- public:
- BncMapView(QWidget* parent = NULL);
-
- virtual void resetScale();
- virtual void zoom(qreal scale);
-
- double scale(){ return _scale; }
- double scale_curr(){ return _scCur; }
- double scale_rate(){ return _scale/_scCur; }
-
-
- protected:
- QPointF _currentCenterPoint; // centerpoint for for panning and zooming
- QPoint _lastPanPoint; // from panning the view
- void SetCenter(const QPointF& centerPoint); // set the current centerpoint in the
-
- QPointF GetCenter(){ return _currentCenterPoint; }
-
- virtual void mousePressEvent(QMouseEvent* event);
- virtual void mouseReleaseEvent(QMouseEvent* event);
- virtual void mouseMoveEvent(QMouseEvent* event);
- virtual void wheelEvent(QWheelEvent* event);
- virtual void resizeEvent(QResizeEvent* event);
-
- private:
- double _scale; // scale
- double _scCur; // current relative scale
-};
-
-#endif
Index: trunk/BNC/bncmodel.cpp
===================================================================
--- trunk/BNC/bncmodel.cpp (revision 4277)
+++ (revision )
@@ -1,1339 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncParam, bncModel
- *
- * Purpose: Model for PPP
- *
- * Author: L. Mervart
- *
- * Created: 01-Dec-2009
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-#include
-#include
-#include
-
-#include "bncmodel.h"
-#include "bncpppclient.h"
-#include "bncapp.h"
-#include "bncpppclient.h"
-#include "bancroft.h"
-#include "bncutils.h"
-#include "bnctides.h"
-#include "bncantex.h"
-#include "pppopt.h"
-
-using namespace std;
-
-const unsigned MINOBS = 5;
-const double MINELE = 10.0 * M_PI / 180.0;
-const double MAXRES_CODE = 15.0;
-const double MAXRES_PHASE_GPS = 0.04;
-const double MAXRES_PHASE_GLONASS = 0.08;
-const double GLONASS_WEIGHT_FACTOR = 5.0;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncParam::bncParam(bncParam::parType typeIn, int indexIn,
- const QString& prnIn) {
- type = typeIn;
- index = indexIn;
- prn = prnIn;
- index_old = 0;
- xx = 0.0;
- numEpo = 0;
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncParam::~bncParam() {
-}
-
-// Partial
-////////////////////////////////////////////////////////////////////////////
-double bncParam::partial(t_satData* satData, bool phase) {
-
- Tracer tracer("bncParam::partial");
-
- // Coordinates
- // -----------
- if (type == CRD_X) {
- return (xx - satData->xx(1)) / satData->rho;
- }
- else if (type == CRD_Y) {
- return (xx - satData->xx(2)) / satData->rho;
- }
- else if (type == CRD_Z) {
- return (xx - satData->xx(3)) / satData->rho;
- }
-
- // Receiver Clocks
- // ---------------
- else if (type == RECCLK) {
- return 1.0;
- }
-
- // Troposphere
- // -----------
- else if (type == TROPO) {
- return 1.0 / sin(satData->eleSat);
- }
-
- // Galileo Offset
- // --------------
- else if (type == GALILEO_OFFSET) {
- if (satData->prn[0] == 'E') {
- return 1.0;
- }
- else {
- return 0.0;
- }
- }
-
- // Ambiguities
- // -----------
- else if (type == AMB_L3) {
- if (phase && satData->prn == prn) {
- return 1.0;
- }
- else {
- return 0.0;
- }
- }
-
- // Default return
- // --------------
- return 0.0;
-}
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncModel::bncModel(bncPPPclient* pppClient) {
-
- _pppClient = pppClient;
- _staID = pppClient->staID();
- _opt = pppClient->opt();
-
- // NMEA Output
- // -----------
- if (_opt->nmeaFile.isEmpty()) {
- _nmeaFile = 0;
- _nmeaStream = 0;
- }
- else {
- QString hlpName = _opt->nmeaFile; expandEnvVar(hlpName);
- _nmeaFile = new QFile(hlpName);
- if (_opt->rnxAppend) {
- _nmeaFile->open(QIODevice::WriteOnly | QIODevice::Append);
- }
- else {
- _nmeaFile->open(QIODevice::WriteOnly);
- }
- _nmeaStream = new QTextStream();
- _nmeaStream->setDevice(_nmeaFile);
- }
-
- // Antenna Name, ANTEX File
- // ------------------------
- _antex = 0;
- if (!_opt->antexFile.isEmpty()) {
- _antex = new bncAntex();
- if (_antex->readFile(_opt->antexFile) != success) {
- _pppClient->emitNewMessage("wrong ANTEX file", true);
- delete _antex;
- _antex = 0;
- }
- }
-
- // Bancroft Coordinates
- // --------------------
- _xcBanc.ReSize(4); _xcBanc = 0.0;
- _ellBanc.ReSize(3); _ellBanc = 0.0;
-
- // Save copy of data (used in outlier detection)
- // ---------------------------------------------
- _epoData_sav = new t_epoData();
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncModel::~bncModel() {
- delete _nmeaStream;
- delete _nmeaFile;
- for (int ii = 0; ii < _posAverage.size(); ++ii) {
- delete _posAverage[ii];
- }
- delete _antex;
- for (int iPar = 1; iPar <= _params.size(); iPar++) {
- delete _params[iPar-1];
- }
- for (int iPar = 1; iPar <= _params_sav.size(); iPar++) {
- delete _params_sav[iPar-1];
- }
- delete _epoData_sav;
-}
-
-// Reset Parameters and Variance-Covariance Matrix
-////////////////////////////////////////////////////////////////////////////
-void bncModel::reset() {
-
- Tracer tracer("bncModel::reset");
-
- for (int iPar = 1; iPar <= _params.size(); iPar++) {
- delete _params[iPar-1];
- }
- _params.clear();
-
- int nextPar = 0;
- _params.push_back(new bncParam(bncParam::CRD_X, ++nextPar, ""));
- _params.push_back(new bncParam(bncParam::CRD_Y, ++nextPar, ""));
- _params.push_back(new bncParam(bncParam::CRD_Z, ++nextPar, ""));
- _params.push_back(new bncParam(bncParam::RECCLK, ++nextPar, ""));
- if (_opt->estTropo) {
- _params.push_back(new bncParam(bncParam::TROPO, ++nextPar, ""));
- }
- if (_opt->useGalileo) {
- _params.push_back(new bncParam(bncParam::GALILEO_OFFSET, ++nextPar, ""));
- }
-
- _QQ.ReSize(_params.size());
- _QQ = 0.0;
- for (int iPar = 1; iPar <= _params.size(); iPar++) {
- bncParam* pp = _params[iPar-1];
- pp->xx = 0.0;
- if (pp->isCrd()) {
- _QQ(iPar,iPar) = _opt->sigCrd0 * _opt->sigCrd0;
- }
- else if (pp->type == bncParam::RECCLK) {
- _QQ(iPar,iPar) = _opt->sigClk0 * _opt->sigClk0;
- }
- else if (pp->type == bncParam::TROPO) {
- _QQ(iPar,iPar) = _opt->sigTrp0 * _opt->sigTrp0;
- }
- else if (pp->type == bncParam::GALILEO_OFFSET) {
- _QQ(iPar,iPar) = _opt->sigGalileoOffset0 * _opt->sigGalileoOffset0;
- }
- }
-}
-
-// Bancroft Solution
-////////////////////////////////////////////////////////////////////////////
-t_irc bncModel::cmpBancroft(t_epoData* epoData) {
-
- Tracer tracer("bncModel::cmpBancroft");
-
- if (epoData->sizeSys('G') < MINOBS) {
- _log += "bncModel::cmpBancroft: not enough data\n";
- return failure;
- }
-
- Matrix BB(epoData->sizeSys('G'), 4);
-
- QMapIterator it(epoData->satData);
- int iObsBanc = 0;
- while (it.hasNext()) {
- it.next();
- t_satData* satData = it.value();
- if (satData->system() == 'G') {
- ++iObsBanc;
- QString prn = it.key();
- BB(iObsBanc, 1) = satData->xx(1);
- BB(iObsBanc, 2) = satData->xx(2);
- BB(iObsBanc, 3) = satData->xx(3);
- BB(iObsBanc, 4) = satData->P3 + satData->clk;
- }
- }
-
- bancroft(BB, _xcBanc);
-
- // Ellipsoidal Coordinates
- // ------------------------
- xyz2ell(_xcBanc.data(), _ellBanc.data());
-
- // Compute Satellite Elevations
- // ----------------------------
- QMutableMapIterator im(epoData->satData);
- while (im.hasNext()) {
- im.next();
- t_satData* satData = im.value();
- cmpEle(satData);
- if (satData->eleSat < MINELE) {
- delete satData;
- im.remove();
- }
- }
-
- return success;
-}
-
-// Computed Value
-////////////////////////////////////////////////////////////////////////////
-double bncModel::cmpValue(t_satData* satData, bool phase) {
-
- Tracer tracer("bncModel::cmpValue");
-
- ColumnVector xRec(3);
- xRec(1) = x();
- xRec(2) = y();
- xRec(3) = z();
-
- double rho0 = (satData->xx - xRec).norm_Frobenius();
- double dPhi = t_CST::omega * rho0 / t_CST::c;
-
- xRec(1) = x() * cos(dPhi) - y() * sin(dPhi);
- xRec(2) = y() * cos(dPhi) + x() * sin(dPhi);
- xRec(3) = z();
-
- tides(_time, xRec);
-
- satData->rho = (satData->xx - xRec).norm_Frobenius();
-
- double tropDelay = delay_saast(satData->eleSat) +
- trp() / sin(satData->eleSat);
-
- double wind = 0.0;
- if (phase) {
- wind = windUp(satData->prn, satData->xx, xRec) * satData->lambda3;
- }
-
- double offset = 0.0;
- if (satData->prn[0] == 'E') {
- offset = Galileo_offset();
- }
-
- double phaseCenter = 0.0;
- if (_antex) {
- bool found;
- phaseCenter = _antex->pco(_opt->antennaName, satData->eleSat, found);
- if (!found) {
- _pppClient->emitNewMessage("ANTEX: antenna >"
- + _opt->antennaName.toAscii() + "< not found", true);
- }
- }
-
- double antennaOffset = 0.0;
- if (_opt->antEccSet()) {
- double cosa = cos(satData->azSat);
- double sina = sin(satData->azSat);
- double cose = cos(satData->eleSat);
- double sine = sin(satData->eleSat);
- antennaOffset = -_opt->antEccNEU[0] * cosa*cose
- -_opt->antEccNEU[1] * sina*cose
- -_opt->antEccNEU[2] * sine;
- }
-
- return satData->rho + phaseCenter + antennaOffset + clk()
- + offset - satData->clk + tropDelay + wind;
-}
-
-// Tropospheric Model (Saastamoinen)
-////////////////////////////////////////////////////////////////////////////
-double bncModel::delay_saast(double Ele) {
-
- Tracer tracer("bncModel::delay_saast");
-
- double xyz[3];
- xyz[0] = x();
- xyz[1] = y();
- xyz[2] = z();
- double ell[3];
- xyz2ell(xyz, ell);
- double height = ell[2];
-
- double pp = 1013.25 * pow(1.0 - 2.26e-5 * height, 5.225);
- double TT = 18.0 - height * 0.0065 + 273.15;
- double hh = 50.0 * exp(-6.396e-4 * height);
- double ee = hh / 100.0 * exp(-37.2465 + 0.213166*TT - 0.000256908*TT*TT);
-
- double h_km = height / 1000.0;
-
- if (h_km < 0.0) h_km = 0.0;
- if (h_km > 5.0) h_km = 5.0;
- int ii = int(h_km + 1);
- double href = ii - 1;
-
- double bCor[6];
- bCor[0] = 1.156;
- bCor[1] = 1.006;
- bCor[2] = 0.874;
- bCor[3] = 0.757;
- bCor[4] = 0.654;
- bCor[5] = 0.563;
-
- double BB = bCor[ii-1] + (bCor[ii]-bCor[ii-1]) * (h_km - href);
-
- double zen = M_PI/2.0 - Ele;
-
- return (0.002277/cos(zen)) * (pp + ((1255.0/TT)+0.05)*ee - BB*(tan(zen)*tan(zen)));
-}
-
-// Prediction Step of the Filter
-////////////////////////////////////////////////////////////////////////////
-void bncModel::predict(int iPhase, t_epoData* epoData) {
-
- Tracer tracer("bncModel::predict");
-
- if (iPhase == 0) {
-
- bool firstCrd = false;
- if (!_lastTimeOK.valid() || (_opt->maxSolGap > 0 && _time - _lastTimeOK > _opt->maxSolGap)) {
- firstCrd = true;
- _startTime = epoData->tt;
- reset();
- }
-
- // Use different white noise for Quick-Start mode
- // ----------------------------------------------
- double sigCrdP_used = _opt->sigCrdP;
- if ( _opt->quickStart > 0.0 && _opt->quickStart > (epoData->tt - _startTime) ) {
- sigCrdP_used = 0.0;
- }
-
- // Predict Parameter values, add white noise
- // -----------------------------------------
- for (int iPar = 1; iPar <= _params.size(); iPar++) {
- bncParam* pp = _params[iPar-1];
-
- // Coordinates
- // -----------
- if (pp->type == bncParam::CRD_X) {
- if (firstCrd) {
- if (_opt->refCrdSet()) {
- pp->xx = _opt->refCrd[0];
- }
- else {
- pp->xx = _xcBanc(1);
- }
- }
- _QQ(iPar,iPar) += sigCrdP_used * sigCrdP_used;
- }
- else if (pp->type == bncParam::CRD_Y) {
- if (firstCrd) {
- if (_opt->refCrdSet()) {
- pp->xx = _opt->refCrd[1];
- }
- else {
- pp->xx = _xcBanc(2);
- }
- }
- _QQ(iPar,iPar) += sigCrdP_used * sigCrdP_used;
- }
- else if (pp->type == bncParam::CRD_Z) {
- if (firstCrd) {
- if (_opt->refCrdSet()) {
- pp->xx = _opt->refCrd[2];
- }
- else {
- pp->xx = _xcBanc(3);
- }
- }
- _QQ(iPar,iPar) += sigCrdP_used * sigCrdP_used;
- }
-
- // Receiver Clocks
- // ---------------
- else if (pp->type == bncParam::RECCLK) {
- pp->xx = _xcBanc(4);
- for (int jj = 1; jj <= _params.size(); jj++) {
- _QQ(iPar, jj) = 0.0;
- }
- _QQ(iPar,iPar) = _opt->sigClk0 * _opt->sigClk0;
- }
-
- // Tropospheric Delay
- // ------------------
- else if (pp->type == bncParam::TROPO) {
- _QQ(iPar,iPar) += _opt->sigTrpP * _opt->sigTrpP;
- }
-
- // Galileo Offset
- // --------------
- else if (pp->type == bncParam::GALILEO_OFFSET) {
- _QQ(iPar,iPar) += _opt->sigGalileoOffsetP * _opt->sigGalileoOffsetP;
- }
- }
- }
-
- // Add New Ambiguities if necessary
- // --------------------------------
- if (_opt->usePhase) {
-
- // Make a copy of QQ and xx, set parameter indices
- // -----------------------------------------------
- SymmetricMatrix QQ_old = _QQ;
-
- for (int iPar = 1; iPar <= _params.size(); iPar++) {
- _params[iPar-1]->index_old = _params[iPar-1]->index;
- _params[iPar-1]->index = 0;
- }
-
- // Remove Ambiguity Parameters without observations
- // ------------------------------------------------
- int iPar = 0;
- QMutableVectorIterator im(_params);
- while (im.hasNext()) {
- bncParam* par = im.next();
- bool removed = false;
- if (par->type == bncParam::AMB_L3) {
- if (epoData->satData.find(par->prn) == epoData->satData.end()) {
- removed = true;
- delete par;
- im.remove();
- }
- }
- if (! removed) {
- ++iPar;
- par->index = iPar;
- }
- }
-
- // Add new ambiguity parameters
- // ----------------------------
- QMapIterator it(epoData->satData);
- while (it.hasNext()) {
- it.next();
- t_satData* satData = it.value();
- addAmb(satData);
- }
-
- int nPar = _params.size();
- _QQ.ReSize(nPar); _QQ = 0.0;
- for (int i1 = 1; i1 <= nPar; i1++) {
- bncParam* p1 = _params[i1-1];
- if (p1->index_old != 0) {
- _QQ(p1->index, p1->index) = QQ_old(p1->index_old, p1->index_old);
- for (int i2 = 1; i2 <= nPar; i2++) {
- bncParam* p2 = _params[i2-1];
- if (p2->index_old != 0) {
- _QQ(p1->index, p2->index) = QQ_old(p1->index_old, p2->index_old);
- }
- }
- }
- }
-
- for (int ii = 1; ii <= nPar; ii++) {
- bncParam* par = _params[ii-1];
- if (par->index_old == 0) {
- _QQ(par->index, par->index) = _opt->sigAmb0 * _opt->sigAmb0;
- }
- par->index_old = par->index;
- }
- }
-}
-
-// Update Step of the Filter (currently just a single-epoch solution)
-////////////////////////////////////////////////////////////////////////////
-t_irc bncModel::update(t_epoData* epoData) {
-
- Tracer tracer("bncModel::update");
-
- _log.clear();
-
- _time = epoData->tt; // current epoch time
-
- if (_opt->pppMode) {
- _log += "Precise Point Positioning of Epoch "
- + QByteArray(_time.timestr(1).c_str()) +
- "\n---------------------------------------------------------------\n";
- }
- else {
- _log += "Single Point Positioning of Epoch "
- + QByteArray(_time.timestr(1).c_str()) +
- "\n--------------------------------------------------------------\n";
- }
-
- // Outlier Detection Loop
- // ----------------------
- if (update_p(epoData) != success) {
- _pppClient->emitNewMessage(_log, false);
- return failure;
- }
-
- // Remember the Epoch-specific Results for the computation of means
- // ----------------------------------------------------------------
- pppPos* newPos = new pppPos;
- newPos->time = epoData->tt;
-
- // Set Solution Vector
- // -------------------
- ostringstream strB;
- strB.setf(ios::fixed);
- QVectorIterator itPar(_params);
- while (itPar.hasNext()) {
- bncParam* par = itPar.next();
-
- if (par->type == bncParam::RECCLK) {
- strB << "\n clk = " << setw(10) << setprecision(3) << par->xx
- << " +- " << setw(6) << setprecision(3)
- << sqrt(_QQ(par->index,par->index));
- }
- else if (par->type == bncParam::AMB_L3) {
- ++par->numEpo;
- strB << "\n amb " << par->prn.toAscii().data() << " = "
- << setw(10) << setprecision(3) << par->xx
- << " +- " << setw(6) << setprecision(3)
- << sqrt(_QQ(par->index,par->index))
- << " nEpo = " << par->numEpo;
- }
- else if (par->type == bncParam::TROPO) {
- double aprTrp = delay_saast(M_PI/2.0);
- strB << "\n trp = " << par->prn.toAscii().data()
- << setw(7) << setprecision(3) << aprTrp << " "
- << setw(6) << setprecision(3) << showpos << par->xx << noshowpos
- << " +- " << setw(6) << setprecision(3)
- << sqrt(_QQ(par->index,par->index));
- newPos->xnt[6] = aprTrp + par->xx;
- }
- else if (par->type == bncParam::GALILEO_OFFSET) {
- strB << "\n offset = " << setw(10) << setprecision(3) << par->xx
- << " +- " << setw(6) << setprecision(3)
- << sqrt(_QQ(par->index,par->index));
- }
- }
- strB << '\n';
- _log += strB.str().c_str();
- _pppClient->emitNewMessage(_log, false);
-
- // Final Message (both log file and screen)
- // ----------------------------------------
- ostringstream strC;
- strC.setf(ios::fixed);
- strC << _staID.data() << " PPP "
- << epoData->tt.timestr(1) << " " << epoData->sizeAll() << " "
- << setw(14) << setprecision(3) << x() << " +- "
- << setw(6) << setprecision(3) << sqrt(_QQ(1,1)) << " "
- << setw(14) << setprecision(3) << y() << " +- "
- << setw(6) << setprecision(3) << sqrt(_QQ(2,2)) << " "
- << setw(14) << setprecision(3) << z() << " +- "
- << setw(6) << setprecision(3) << sqrt(_QQ(3,3));
-
- // NEU Output
- // ----------
- if (_opt->refCrdSet()) {
- newPos->xnt[0] = x() - _opt->refCrd[0];
- newPos->xnt[1] = y() - _opt->refCrd[1];
- newPos->xnt[2] = z() - _opt->refCrd[2];
-
- double ellRef[3];
- xyz2ell(_opt->refCrd, ellRef);
- xyz2neu(ellRef, newPos->xnt, &newPos->xnt[3]);
-
- strC << " NEU "
- << setw(8) << setprecision(3) << newPos->xnt[3] << " "
- << setw(8) << setprecision(3) << newPos->xnt[4] << " "
- << setw(8) << setprecision(3) << newPos->xnt[5] << endl;
-
- }
-
- _pppClient->emitNewMessage(QByteArray(strC.str().c_str()), true);
-
- if (_opt->pppAverage == 0.0) {
- delete newPos;
- }
- else {
-
- _posAverage.push_back(newPos);
-
- // Compute the Mean
- // ----------------
- ColumnVector mean(7); mean = 0.0;
-
- QMutableVectorIterator it(_posAverage);
- while (it.hasNext()) {
- pppPos* pp = it.next();
- if ( (epoData->tt - pp->time) >= _opt->pppAverage ) {
- delete pp;
- it.remove();
- }
- else {
- for (int ii = 0; ii < 7; ++ii) {
- mean[ii] += pp->xnt[ii];
- }
- }
- }
-
- int nn = _posAverage.size();
-
- if (nn > 0) {
-
- mean /= nn;
-
- // Compute the Deviation
- // ---------------------
- ColumnVector std(7); std = 0.0;
- QVectorIterator it2(_posAverage);
- while (it2.hasNext()) {
- pppPos* pp = it2.next();
- for (int ii = 0; ii < 7; ++ii) {
- std[ii] += (pp->xnt[ii] - mean[ii]) * (pp->xnt[ii] - mean[ii]);
- }
- }
- for (int ii = 0; ii < 7; ++ii) {
- std[ii] = sqrt(std[ii] / nn);
- }
-
- if (_opt->refCrdSet()) {
- ostringstream strD; strD.setf(ios::fixed);
- strD << _staID.data() << " AVE-XYZ "
- << epoData->tt.timestr(1) << " "
- << setw(13) << setprecision(3) << mean[0] + _opt->refCrd[0] << " +- "
- << setw(6) << setprecision(3) << std[0] << " "
- << setw(14) << setprecision(3) << mean[1] + _opt->refCrd[1] << " +- "
- << setw(6) << setprecision(3) << std[1] << " "
- << setw(14) << setprecision(3) << mean[2] + _opt->refCrd[2] << " +- "
- << setw(6) << setprecision(3) << std[2];
- _pppClient->emitNewMessage(QByteArray(strD.str().c_str()), true);
-
- ostringstream strE; strE.setf(ios::fixed);
- strE << _staID.data() << " AVE-NEU "
- << epoData->tt.timestr(1) << " "
- << setw(13) << setprecision(3) << mean[3] << " +- "
- << setw(6) << setprecision(3) << std[3] << " "
- << setw(14) << setprecision(3) << mean[4] << " +- "
- << setw(6) << setprecision(3) << std[4] << " "
- << setw(14) << setprecision(3) << mean[5] << " +- "
- << setw(6) << setprecision(3) << std[5];
- _pppClient->emitNewMessage(QByteArray(strE.str().c_str()), true);
-
- if (_opt->estTropo) {
- ostringstream strF; strF.setf(ios::fixed);
- strF << _staID.data() << " AVE-TRP "
- << epoData->tt.timestr(1) << " "
- << setw(13) << setprecision(3) << mean[6] << " +- "
- << setw(6) << setprecision(3) << std[6] << endl;
- _pppClient->emitNewMessage(QByteArray(strF.str().c_str()), true);
- }
- }
- }
- }
-
- // NMEA Output
- // -----------
- double xyz[3];
- xyz[0] = x();
- xyz[1] = y();
- xyz[2] = z();
- double ell[3];
- xyz2ell(xyz, ell);
- double phiDeg = ell[0] * 180 / M_PI;
- double lamDeg = ell[1] * 180 / M_PI;
-
- char phiCh = 'N';
- if (phiDeg < 0) {
- phiDeg = -phiDeg;
- phiCh = 'S';
- }
- char lamCh = 'E';
- if (lamDeg < 0) {
- lamDeg = -lamDeg;
- lamCh = 'W';
- }
-
- string datestr = epoData->tt.datestr(0); // yyyymmdd
- ostringstream strRMC;
- strRMC.setf(ios::fixed);
- strRMC << "GPRMC,"
- << epoData->tt.timestr(0,0) << ",A,"
- << setw(2) << setfill('0') << int(phiDeg)
- << setw(6) << setprecision(3) << setfill('0')
- << fmod(60*phiDeg,60) << ',' << phiCh << ','
- << setw(3) << setfill('0') << int(lamDeg)
- << setw(6) << setprecision(3) << setfill('0')
- << fmod(60*lamDeg,60) << ',' << lamCh << ",,,"
- << datestr[6] << datestr[7] << datestr[4] << datestr[5]
- << datestr[2] << datestr[3] << ",,";
-
- writeNMEAstr(QString(strRMC.str().c_str()));
-
- double dop = 2.0; // TODO
-
- ostringstream strGGA;
- strGGA.setf(ios::fixed);
- strGGA << "GPGGA,"
- << epoData->tt.timestr(0,0) << ','
- << setw(2) << setfill('0') << int(phiDeg)
- << setw(10) << setprecision(7) << setfill('0')
- << fmod(60*phiDeg,60) << ',' << phiCh << ','
- << setw(3) << setfill('0') << int(lamDeg)
- << setw(10) << setprecision(7) << setfill('0')
- << fmod(60*lamDeg,60) << ',' << lamCh
- << ",1," << setw(2) << setfill('0') << epoData->sizeAll() << ','
- << setw(3) << setprecision(1) << dop << ','
- << setprecision(3) << ell[2] << ",M,0.0,M,,";
-
- writeNMEAstr(QString(strGGA.str().c_str()));
-
- _lastTimeOK = _time; // remember time of last successful update
- return success;
-}
-
-// Outlier Detection
-////////////////////////////////////////////////////////////////////////////
-QString bncModel::outlierDetection(int iPhase, const ColumnVector& vv,
- QMap& satData) {
-
- Tracer tracer("bncModel::outlierDetection");
-
- QString prnGPS;
- QString prnGlo;
- double maxResGPS = 0.0;
- double maxResGlo = 0.0;
- findMaxRes(vv, satData, prnGPS, prnGlo, maxResGPS, maxResGlo);
-
- if (iPhase == 1) {
- if (maxResGlo > MAXRES_PHASE_GLONASS) {
- _log += "Outlier Phase " + prnGlo + " "
- + QByteArray::number(maxResGlo, 'f', 3) + "\n";
- return prnGlo;
- }
- else if (maxResGPS > MAXRES_PHASE_GPS) {
- _log += "Outlier Phase " + prnGPS + " "
- + QByteArray::number(maxResGPS, 'f', 3) + "\n";
- return prnGPS;
- }
- }
- else if (iPhase == 0 && maxResGPS > MAXRES_CODE) {
- _log += "Outlier Code " + prnGPS + " "
- + QByteArray::number(maxResGPS, 'f', 3) + "\n";
- return prnGPS;
- }
-
- return QString();
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncModel::writeNMEAstr(const QString& nmStr) {
-
- Tracer tracer("bncModel::writeNMEAstr");
-
- unsigned char XOR = 0;
- for (int ii = 0; ii < nmStr.length(); ii++) {
- XOR ^= (unsigned char) nmStr[ii].toAscii();
- }
-
- QString outStr = '$' + nmStr
- + QString("*%1\n").arg(int(XOR), 0, 16).toUpper();
-
- if (_nmeaStream) {
- *_nmeaStream << outStr;
- _nmeaStream->flush();
- }
-
- _pppClient->emitNewNMEAstr(outStr.toAscii());
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-void bncModel::kalman(const Matrix& AA, const ColumnVector& ll,
- const DiagonalMatrix& PP,
- SymmetricMatrix& QQ, ColumnVector& dx) {
-
- Tracer tracer("bncModel::kalman");
-
- int nObs = AA.Nrows();
- int nPar = AA.Ncols();
-
- UpperTriangularMatrix SS = Cholesky(QQ).t();
-
- Matrix SA = SS*AA.t();
- Matrix SRF(nObs+nPar, nObs+nPar); SRF = 0;
- for (int ii = 1; ii <= nObs; ++ii) {
- SRF(ii,ii) = 1.0 / sqrt(PP(ii,ii));
- }
-
- SRF.SubMatrix (nObs+1, nObs+nPar, 1, nObs) = SA;
- SRF.SymSubMatrix(nObs+1, nObs+nPar) = SS;
-
- UpperTriangularMatrix UU;
- QRZ(SRF, UU);
-
- SS = UU.SymSubMatrix(nObs+1, nObs+nPar);
- UpperTriangularMatrix SH_rt = UU.SymSubMatrix(1, nObs);
- Matrix YY = UU.SubMatrix(1, nObs, nObs+1, nObs+nPar);
-
- UpperTriangularMatrix SHi = SH_rt.i();
-
- Matrix KT = SHi * YY;
- SymmetricMatrix Hi; Hi << SHi * SHi.t();
-
- dx = KT.t() * ll;
- QQ << (SS.t() * SS);
-}
-
-// Phase Wind-Up Correction
-///////////////////////////////////////////////////////////////////////////
-double bncModel::windUp(const QString& prn, const ColumnVector& rSat,
- const ColumnVector& rRec) {
-
- Tracer tracer("bncModel::windUp");
-
- double Mjd = _time.mjd() + _time.daysec() / 86400.0;
-
- // First time - initialize to zero
- // -------------------------------
- if (!_windUpTime.contains(prn)) {
- _windUpSum[prn] = 0.0;
- }
-
- // Compute the correction for new time
- // -----------------------------------
- if (!_windUpTime.contains(prn) || _windUpTime[prn] != Mjd) {
- _windUpTime[prn] = Mjd;
-
- // Unit Vector GPS Satellite --> Receiver
- // --------------------------------------
- ColumnVector rho = rRec - rSat;
- rho /= rho.norm_Frobenius();
-
- // GPS Satellite unit Vectors sz, sy, sx
- // -------------------------------------
- ColumnVector sz = -rSat / rSat.norm_Frobenius();
-
- ColumnVector xSun = Sun(Mjd);
- xSun /= xSun.norm_Frobenius();
-
- ColumnVector sy = crossproduct(sz, xSun);
- ColumnVector sx = crossproduct(sy, sz);
-
- // Effective Dipole of the GPS Satellite Antenna
- // ---------------------------------------------
- ColumnVector dipSat = sx - rho * DotProduct(rho,sx)
- - crossproduct(rho, sy);
-
- // Receiver unit Vectors rx, ry
- // ----------------------------
- ColumnVector rx(3);
- ColumnVector ry(3);
-
- double recEll[3]; xyz2ell(rRec.data(), recEll) ;
- double neu[3];
-
- neu[0] = 1.0;
- neu[1] = 0.0;
- neu[2] = 0.0;
- neu2xyz(recEll, neu, rx.data());
-
- neu[0] = 0.0;
- neu[1] = -1.0;
- neu[2] = 0.0;
- neu2xyz(recEll, neu, ry.data());
-
- // Effective Dipole of the Receiver Antenna
- // ----------------------------------------
- ColumnVector dipRec = rx - rho * DotProduct(rho,rx)
- + crossproduct(rho, ry);
-
- // Resulting Effect
- // ----------------
- double alpha = DotProduct(dipSat,dipRec) /
- (dipSat.norm_Frobenius() * dipRec.norm_Frobenius());
-
- if (alpha > 1.0) alpha = 1.0;
- if (alpha < -1.0) alpha = -1.0;
-
- double dphi = acos(alpha) / 2.0 / M_PI; // in cycles
-
- if ( DotProduct(rho, crossproduct(dipSat, dipRec)) < 0.0 ) {
- dphi = -dphi;
- }
-
- _windUpSum[prn] = floor(_windUpSum[prn] - dphi + 0.5) + dphi;
- }
-
- return _windUpSum[prn];
-}
-
-//
-///////////////////////////////////////////////////////////////////////////
-void bncModel::cmpEle(t_satData* satData) {
- Tracer tracer("bncModel::cmpEle");
- ColumnVector rr = satData->xx - _xcBanc.Rows(1,3);
- double rho = rr.norm_Frobenius();
-
- double neu[3];
- xyz2neu(_ellBanc.data(), rr.data(), neu);
-
- satData->eleSat = acos( sqrt(neu[0]*neu[0] + neu[1]*neu[1]) / rho );
- if (neu[2] < 0) {
- satData->eleSat *= -1.0;
- }
- satData->azSat = atan2(neu[1], neu[0]);
-}
-
-//
-///////////////////////////////////////////////////////////////////////////
-void bncModel::addAmb(t_satData* satData) {
- Tracer tracer("bncModel::addAmb");
- bool found = false;
- for (int iPar = 1; iPar <= _params.size(); iPar++) {
- if (_params[iPar-1]->type == bncParam::AMB_L3 &&
- _params[iPar-1]->prn == satData->prn) {
- found = true;
- break;
- }
- }
- if (!found) {
- bncParam* par = new bncParam(bncParam::AMB_L3,
- _params.size()+1, satData->prn);
- _params.push_back(par);
- par->xx = satData->L3 - cmpValue(satData, true);
- }
-}
-
-//
-///////////////////////////////////////////////////////////////////////////
-void bncModel::addObs(int iPhase, unsigned& iObs, t_satData* satData,
- Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP) {
-
- Tracer tracer("bncModel::addObs");
-
- const double ELEWGHT = 20.0;
- double ellWgtCoef = 1.0;
- double eleD = satData->eleSat * 180.0 / M_PI;
- if (eleD < ELEWGHT) {
- ellWgtCoef = 1.5 - 0.5 / (ELEWGHT - 10.0) * (eleD - 10.0);
- }
-
- // Remember Observation Index
- // --------------------------
- ++iObs;
- satData->obsIndex = iObs;
-
- // Phase Observations
- // ------------------
- if (iPhase == 1) {
- ll(iObs) = satData->L3 - cmpValue(satData, true);
- double sigL3 = _opt->sigL3;
- if (satData->system() == 'R') {
- sigL3 *= GLONASS_WEIGHT_FACTOR;
- }
- PP(iObs,iObs) = 1.0 / (sigL3 * sigL3) / (ellWgtCoef * ellWgtCoef);
- for (int iPar = 1; iPar <= _params.size(); iPar++) {
- if (_params[iPar-1]->type == bncParam::AMB_L3 &&
- _params[iPar-1]->prn == satData->prn) {
- ll(iObs) -= _params[iPar-1]->xx;
- }
- AA(iObs, iPar) = _params[iPar-1]->partial(satData, true);
- }
- }
-
- // Code Observations
- // -----------------
- else {
- ll(iObs) = satData->P3 - cmpValue(satData, false);
- PP(iObs,iObs) = 1.0 / (_opt->sigP3 * _opt->sigP3) / (ellWgtCoef * ellWgtCoef);
- for (int iPar = 1; iPar <= _params.size(); iPar++) {
- AA(iObs, iPar) = _params[iPar-1]->partial(satData, false);
- }
- }
-}
-
-//
-///////////////////////////////////////////////////////////////////////////
-QByteArray bncModel::printRes(int iPhase, const ColumnVector& vv,
- const QMap& satDataMap) {
-
- Tracer tracer("bncModel::printRes");
-
- ostringstream str;
- str.setf(ios::fixed);
-
- QMapIterator it(satDataMap);
- while (it.hasNext()) {
- it.next();
- t_satData* satData = it.value();
- if (satData->obsIndex != 0) {
- str << _time.timestr(1)
- << " RES " << satData->prn.toAscii().data()
- << (iPhase ? " L3 " : " P3 ")
- << setw(9) << setprecision(4) << vv(satData->obsIndex) << endl;
- }
- }
-
- return QByteArray(str.str().c_str());
-}
-
-//
-///////////////////////////////////////////////////////////////////////////
-void bncModel::findMaxRes(const ColumnVector& vv,
- const QMap& satData,
- QString& prnGPS, QString& prnGlo,
- double& maxResGPS, double& maxResGlo) {
-
- Tracer tracer("bncModel::findMaxRes");
-
- maxResGPS = 0.0;
- maxResGlo = 0.0;
-
- QMapIterator it(satData);
- while (it.hasNext()) {
- it.next();
- t_satData* satData = it.value();
- if (satData->obsIndex != 0) {
- QString prn = satData->prn;
- if (prn[0] == 'R') {
- if (fabs(vv(satData->obsIndex)) > maxResGlo) {
- maxResGlo = fabs(vv(satData->obsIndex));
- prnGlo = prn;
- }
- }
- else {
- if (fabs(vv(satData->obsIndex)) > maxResGPS) {
- maxResGPS = fabs(vv(satData->obsIndex));
- prnGPS = prn;
- }
- }
- }
- }
-}
-
-// Update Step (private - loop over outliers)
-////////////////////////////////////////////////////////////////////////////
-t_irc bncModel::update_p(t_epoData* epoData) {
-
- Tracer tracer("bncModel::update_p");
-
- // Save Variance-Covariance Matrix, and Status Vector
- // --------------------------------------------------
- rememberState(epoData);
-
- QString lastOutlierPrn;
-
- // Try with all satellites, then with all minus one, etc.
- // ------------------------------------------------------
- while (selectSatellites(lastOutlierPrn, epoData->satData) == success) {
-
- QByteArray strResCode;
- QByteArray strResPhase;
-
- // Bancroft Solution
- // -----------------
- if (cmpBancroft(epoData) != success) {
- break;
- }
-
- // First update using code observations, then phase observations
- // -------------------------------------------------------------
- for (int iPhase = 0; iPhase <= (_opt->usePhase ? 1 : 0); iPhase++) {
-
- // Status Prediction
- // -----------------
- predict(iPhase, epoData);
-
- // Create First-Design Matrix
- // --------------------------
- unsigned nPar = _params.size();
- unsigned nObs = 0;
- if (iPhase == 0) {
- nObs = epoData->sizeAll() - epoData->sizeSys('R'); // Glonass code not used
- }
- else {
- nObs = epoData->sizeAll();
- }
-
- // Prepare first-design Matrix, vector observed-computed
- // -----------------------------------------------------
- Matrix AA(nObs, nPar); // first design matrix
- ColumnVector ll(nObs); // tems observed-computed
- DiagonalMatrix PP(nObs); PP = 0.0;
-
- unsigned iObs = 0;
- QMapIterator it(epoData->satData);
- while (it.hasNext()) {
- it.next();
- t_satData* satData = it.value();
- if (iPhase == 1 || satData->system() != 'R') {
- QString prn = satData->prn;
- addObs(iPhase, iObs, satData, AA, ll, PP);
- }
- }
-
- // Compute Filter Update
- // ---------------------
- ColumnVector dx;
- kalman(AA, ll, PP, _QQ, dx);
- ColumnVector vv = ll - AA * dx;
-
- // Print Residuals
- // ---------------
- if (iPhase == 0) {
- strResCode = printRes(iPhase, vv, epoData->satData);
- }
- else {
- strResPhase = printRes(iPhase, vv, epoData->satData);
- }
-
- // Check the residuals
- // -------------------
- lastOutlierPrn = outlierDetection(iPhase, vv, epoData->satData);
-
- // No Outlier Detected
- // -------------------
- if (lastOutlierPrn.isEmpty()) {
-
- QVectorIterator itPar(_params);
- while (itPar.hasNext()) {
- bncParam* par = itPar.next();
- par->xx += dx(par->index);
- }
-
- if (!_opt->usePhase || iPhase == 1) {
- if (_outlierGPS.size() > 0 || _outlierGlo.size() > 0) {
- _log += "Neglected PRNs: ";
- if (!_outlierGPS.isEmpty()) {
- _log += _outlierGPS.last() + ' ';
- }
- QStringListIterator itGlo(_outlierGlo);
- while (itGlo.hasNext()) {
- QString prn = itGlo.next();
- _log += prn + ' ';
- }
- }
- _log += '\n';
-
- _log += strResCode + strResPhase;
-
- return success;
- }
- }
-
- // Outlier Found
- // -------------
- else {
- restoreState(epoData);
- break;
- }
-
- } // for iPhase
-
- } // while selectSatellites
-
- restoreState(epoData);
- return failure;
-}
-
-// Remeber Original State Vector and Variance-Covariance Matrix
-////////////////////////////////////////////////////////////////////////////
-void bncModel::rememberState(t_epoData* epoData) {
-
- _QQ_sav = _QQ;
-
- QVectorIterator itSav(_params_sav);
- while (itSav.hasNext()) {
- bncParam* par = itSav.next();
- delete par;
- }
- _params_sav.clear();
-
- QVectorIterator it(_params);
- while (it.hasNext()) {
- bncParam* par = it.next();
- _params_sav.push_back(new bncParam(*par));
- }
-
- _epoData_sav->deepCopy(epoData);
-}
-
-// Restore Original State Vector and Variance-Covariance Matrix
-////////////////////////////////////////////////////////////////////////////
-void bncModel::restoreState(t_epoData* epoData) {
-
- _QQ = _QQ_sav;
-
- QVectorIterator it(_params);
- while (it.hasNext()) {
- bncParam* par = it.next();
- delete par;
- }
- _params.clear();
-
- QVectorIterator itSav(_params_sav);
- while (itSav.hasNext()) {
- bncParam* par = itSav.next();
- _params.push_back(new bncParam(*par));
- }
-
- epoData->deepCopy(_epoData_sav);
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-t_irc bncModel::selectSatellites(const QString& lastOutlierPrn,
- QMap& satData) {
-
- // First Call
- // ----------
- if (lastOutlierPrn.isEmpty()) {
- _outlierGPS.clear();
- _outlierGlo.clear();
- return success;
- }
-
- // Second and next trials
- // ----------------------
- else {
-
- if (lastOutlierPrn[0] == 'R') {
- _outlierGlo << lastOutlierPrn;
- }
-
- // Remove all Glonass Outliers
- // ---------------------------
- QStringListIterator it(_outlierGlo);
- while (it.hasNext()) {
- QString prn = it.next();
- if (satData.contains(prn)) {
- delete satData.take(prn);
- }
- }
-
- if (lastOutlierPrn[0] == 'R') {
- _outlierGPS.clear();
- return success;
- }
-
- // GPS Outlier appeared for the first time - try to delete it
- // ----------------------------------------------------------
- if (_outlierGPS.indexOf(lastOutlierPrn) == -1) {
- _outlierGPS << lastOutlierPrn;
- if (satData.contains(lastOutlierPrn)) {
- delete satData.take(lastOutlierPrn);
- }
- return success;
- }
-
- }
-
- return failure;
-}
Index: trunk/BNC/bncmodel.h
===================================================================
--- trunk/BNC/bncmodel.h (revision 4277)
+++ (revision )
@@ -1,157 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCMODEL_H
-#define BNCMODEL_H
-
-#include
-#include
-#include
-
-#include "bncconst.h"
-#include "bnctime.h"
-
-class t_epoData;
-class t_satData;
-class bncAntex;
-class t_pppOpt;
-class bncPPPclient;
-
-class bncParam {
- public:
- enum parType {CRD_X, CRD_Y, CRD_Z, RECCLK, TROPO, AMB_L3, GALILEO_OFFSET};
- bncParam(parType typeIn, int indexIn, const QString& prn);
- ~bncParam();
- double partial(t_satData* satData, bool phase);
- bool isCrd() const {
- return (type == CRD_X || type == CRD_Y || type == CRD_Z);
- }
- parType type;
- double xx;
- int index;
- int index_old;
- int numEpo;
- QString prn;
-};
-
-class bncModel {
- public:
- bncModel(bncPPPclient* pppClient);
- ~bncModel();
- t_irc update(t_epoData* epoData);
- bncTime time() const {return _time;}
- double x() const {return _params[0]->xx;}
- double y() const {return _params[1]->xx;}
- double z() const {return _params[2]->xx;}
- double clk() const {return _params[3]->xx;}
- double trp() const {
- for (int ii = 0; ii < _params.size(); ++ii) {
- bncParam* pp = _params[ii];
- if (pp->type == bncParam::TROPO) {
- return pp->xx;
- }
- }
- return 0.0;
- }
- double Galileo_offset() const {
- for (int ii = 0; ii < _params.size(); ++ii) {
- bncParam* pp = _params[ii];
- if (pp->type == bncParam::GALILEO_OFFSET) {
- return pp->xx;
- }
- }
- return 0.0;
- }
-
- static void kalman(const Matrix& AA, const ColumnVector& ll,
- const DiagonalMatrix& PP,
- SymmetricMatrix& QQ, ColumnVector& dx);
-
- private:
- t_irc cmpBancroft(t_epoData* epoData);
- void reset();
- void cmpEle(t_satData* satData);
- void addAmb(t_satData* satData);
- void addObs(int iPhase, unsigned& iObs, t_satData* satData,
- Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP);
- QByteArray printRes(int iPhase, const ColumnVector& vv,
- const QMap& satDataMap);
- void findMaxRes(const ColumnVector& vv,
- const QMap& satData,
- QString& prnGPS, QString& prnGlo,
- double& maxResGPS, double& maxResGlo);
- double cmpValue(t_satData* satData, bool phase);
- double delay_saast(double Ele);
- void predict(int iPhase, t_epoData* epoData);
- t_irc update_p(t_epoData* epoData);
- QString outlierDetection(int iPhase, const ColumnVector& vv,
- QMap& satData);
- void writeNMEAstr(const QString& nmStr);
-
- double windUp(const QString& prn, const ColumnVector& rSat,
- const ColumnVector& rRec);
-
- bncTime _startTime;
-
- void rememberState(t_epoData* epoData);
- void restoreState(t_epoData* epoData);
-
- t_irc selectSatellites(const QString& lastOutlierPrn,
- QMap& satData);
-
- class pppPos {
- public:
- pppPos() {
- for (int ii = 0; ii < 7; ++ii) {
- xnt[ii] = 0.0;
- }
- }
- bncTime time;
- double xnt[7];
- };
-
- bncPPPclient* _pppClient;
- const t_pppOpt* _opt;
- bncTime _time;
- bncTime _lastTimeOK;
- QByteArray _staID;
- QVector _params;
- SymmetricMatrix _QQ;
- QVector _params_sav;
- SymmetricMatrix _QQ_sav;
- t_epoData* _epoData_sav;
- ColumnVector _xcBanc;
- ColumnVector _ellBanc;
- QByteArray _log;
- QFile* _nmeaFile;
- QTextStream* _nmeaStream;
- QMap _windUpTime;
- QMap _windUpSum;
- QVector _posAverage;
- QStringList _outlierGPS;
- QStringList _outlierGlo;
- bncAntex* _antex;
-};
-
-#endif
Index: trunk/BNC/bncnetquery.h
===================================================================
--- trunk/BNC/bncnetquery.h (revision 4277)
+++ (revision )
@@ -1,43 +1,0 @@
-#ifndef BNCNETQUERY_H
-#define BNCNETQUERY_H
-
-#include
-#include "bncconst.h"
-#include "bncapp.h"
-
-class bncNetQuery : public QObject {
- Q_OBJECT
-
- public:
- enum queryStatus {init, running, finished, error};
-
- bncNetQuery() {
- connect(this, SIGNAL(newMessage(QByteArray,bool)),
- (bncApp*) qApp, SLOT(slotMessage(const QByteArray,bool)));
- }
- virtual ~bncNetQuery() {}
-
- virtual void stop() = 0;
- virtual void waitForRequestResult(const QUrl& url, QByteArray& outData) = 0;
- virtual void startRequest(const QUrl& url, const QByteArray& gga) = 0;
- virtual void waitForReadyRead(QByteArray& outData) = 0;
-
- void sendNMEA(const QByteArray& gga) {
- stop();
- startRequest(_url, gga);
- }
-
- queryStatus status() const {return _status;}
-
- signals:
- void newMessage(QByteArray msg, bool showOnScreen);
-
- private slots:
-
- protected:
- queryStatus _status;
- int _timeOut;
- QUrl _url;
-};
-
-#endif
Index: trunk/BNC/bncnetqueryrtp.cpp
===================================================================
--- trunk/BNC/bncnetqueryrtp.cpp (revision 4277)
+++ (revision )
@@ -1,238 +1,0 @@
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncNetQueryRtp
- *
- * Purpose: Blocking Network Requests (NTRIP Version 2 with RTSP)
- *
- * Author: L. Mervart
- *
- * Created: 27-Dec-2008
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-#include
-
-#include "bncnetqueryrtp.h"
-#include "bncsettings.h"
-#include "bncversion.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncNetQueryRtp::bncNetQueryRtp() {
- _socket = 0;
- _udpSocket = 0;
- _CSeq = 0;
- _eventLoop = new QEventLoop(this);
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncNetQueryRtp::~bncNetQueryRtp() {
- delete _eventLoop;
- delete _socket;
- delete _udpSocket;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryRtp::stop() {
- _eventLoop->quit();
- _status = finished;
- if (_socket) {
- QByteArray reqStr = "TEARDOWN " + _url.toEncoded() + " RTSP/1.0\r\n"
- + "CSeq: " + QString("%1").arg(++_CSeq).toAscii() + "\r\n"
- + "Session: " + _session + "\r\n"
- + "\r\n";
- _socket->write(reqStr, reqStr.length());
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryRtp::slotKeepAlive() {
- if (_socket) {
- QByteArray reqStr = "GET_PARAMETER " + _url.toEncoded() + " RTSP/1.0\r\n"
- + "CSeq: " + QString("%1").arg(++_CSeq).toAscii() + "\r\n"
- + "Session: " + _session + "\r\n"
- + "\r\n";
- _socket->write(reqStr, reqStr.length());
- }
- QTimer::singleShot(30000, this, SLOT(slotKeepAlive()));
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryRtp::waitForRequestResult(const QUrl&, QByteArray&) {
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryRtp::waitForReadyRead(QByteArray& outData) {
-
- // Wait Loop
- // ---------
- if (!_udpSocket->hasPendingDatagrams()) {
- _eventLoop->exec();
- }
-
- // Append Data
- // -----------
- QByteArray datagram;
- datagram.resize(_udpSocket->pendingDatagramSize());
- _udpSocket->readDatagram(datagram.data(), datagram.size());
-
- if (datagram.size() > 12) {
- outData.append(datagram.mid(12));
- }
-}
-
-// Connect to Caster, send the Request
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryRtp::startRequest(const QUrl& url, const QByteArray& gga) {
-
- const int timeOut = 5000;
-
- _status = running;
-
- delete _socket;
- _socket = new QTcpSocket();
-
- // Default scheme
- // --------------
- _url = url;
- _url.setScheme("rtsp");
-
- // Connect the Socket
- // ------------------
- bncSettings settings;
- QString proxyHost = settings.value("proxyHost").toString();
- int proxyPort = settings.value("proxyPort").toInt();
-
- if ( proxyHost.isEmpty() ) {
- _socket->connectToHost(_url.host(), _url.port());
- }
- else {
- _socket->connectToHost(proxyHost, proxyPort);
- }
-
- // Send Request 1
- // --------------
- if (_socket->waitForConnected(timeOut)) {
- QString uName = QUrl::fromPercentEncoding(_url.userName().toAscii());
- QString passW = QUrl::fromPercentEncoding(_url.password().toAscii());
- QByteArray userAndPwd;
-
- if(!uName.isEmpty() || !passW.isEmpty()) {
- userAndPwd = "Authorization: Basic " + (uName.toAscii() + ":" +
- passW.toAscii()).toBase64() + "\r\n";
- }
-
- // Setup the RTSP Connection
- // -------------------------
- delete _udpSocket;
- _udpSocket = new QUdpSocket();
- _udpSocket->bind(0);
- connect(_udpSocket, SIGNAL(readyRead()), _eventLoop, SLOT(quit()));
- QByteArray clientPort = QString("%1").arg(_udpSocket->localPort()).toAscii();
-
- QByteArray reqStr;
- reqStr = "SETUP " + _url.toEncoded() + " RTSP/1.0\r\n"
- + "CSeq: " + QString("%1").arg(++_CSeq).toAscii() + "\r\n"
- + "Ntrip-Version: Ntrip/2.0\r\n"
- + "Ntrip-Component: Ntripclient\r\n"
- + "User-Agent: NTRIP BNC/" BNCVERSION "\r\n"
- + "Transport: RTP/GNSS;unicast;client_port=" + clientPort + "\r\n"
- + userAndPwd;
- if (!gga.isEmpty()) {
- reqStr += "Ntrip-GGA: " + gga + "\r\n";
- }
- reqStr += "\r\n";
-
- _socket->write(reqStr, reqStr.length());
-
- // Read Server Answer 1
- // --------------------
- if (_socket->waitForBytesWritten(timeOut)) {
- if (_socket->waitForReadyRead(timeOut)) {
- QTextStream in(_socket);
- QByteArray serverPort;
- QString line = in.readLine();
- while (!line.isEmpty()) {
- if (line.indexOf("Session:") == 0) {
- _session = line.mid(9).toAscii();
- }
- int iSrv = line.indexOf("server_port=");
- if (iSrv != -1) {
- serverPort = line.mid(iSrv+12).toAscii();
- }
- line = in.readLine();
- }
-
- // Send Request 2
- // --------------
- if (!_session.isEmpty()) {
-
- // Send initial RTP packet for firewall handling
- // ---------------------------------------------
- if (!serverPort.isEmpty()) {
- unsigned sessInt = _session.toInt();
- char rtpbuffer[12];
- rtpbuffer[0] = 128;
- rtpbuffer[1] = 96;
- rtpbuffer[2] = 0;
- rtpbuffer[3] = 0;
- rtpbuffer[4] = 0;
- rtpbuffer[5] = 0;
- rtpbuffer[6] = 0;
- rtpbuffer[7] = 0;
- rtpbuffer[8] = (sessInt >> 24) & 0xFF;
- rtpbuffer[9] = (sessInt >> 16) & 0xFF;
- rtpbuffer[10] = (sessInt >> 8) & 0xFF;
- rtpbuffer[11] = (sessInt ) & 0xFF;
-
- _udpSocket->writeDatagram(rtpbuffer, 12,
- _socket->peerAddress(), serverPort.toInt());
- }
-
- reqStr = "PLAY " + _url.toEncoded() + " RTSP/1.0\r\n"
- + "CSeq: " + QString("%1").arg(++_CSeq).toAscii() + "\r\n"
- + "Session: " + _session + "\r\n"
- + "\r\n";
- _socket->write(reqStr, reqStr.length());
-
- // Read Server Answer 2
- // --------------------
- if (_socket->waitForBytesWritten(timeOut)) {
- if (_socket->waitForReadyRead(timeOut)) {
- QTextStream in(_socket);
- line = in.readLine();
- while (!line.isEmpty()) {
- if (line.indexOf("200 OK") != -1) {
- emit newMessage(_url.encodedPath().replace(0,1,"")
- + ": UDP connection established", true);
- slotKeepAlive();
- return;
- }
- line = in.readLine();
- }
- }
- }
- }
- }
- }
- }
-
- delete _socket;
- _socket = 0;
- _status = error;
- emit newMessage(_url.encodedPath().replace(0,1,"")
- + ": NetQuery, waiting for connect", true);
-}
-
Index: trunk/BNC/bncnetqueryrtp.h
===================================================================
--- trunk/BNC/bncnetqueryrtp.h (revision 4277)
+++ (revision )
@@ -1,28 +1,0 @@
-#ifndef BNCNETQUERYRTP_H
-#define BNCNETQUERYRTP_H
-
-#include "bncnetquery.h"
-
-class bncNetQueryRtp : public bncNetQuery {
- Q_OBJECT
- public:
- bncNetQueryRtp();
- virtual ~bncNetQueryRtp();
-
- virtual void stop();
- virtual void waitForRequestResult(const QUrl& url, QByteArray& outData);
- virtual void startRequest(const QUrl& url, const QByteArray& gga);
- virtual void waitForReadyRead(QByteArray& outData);
-
- private slots:
- void slotKeepAlive();
-
- private:
- QTcpSocket* _socket;
- QUdpSocket* _udpSocket;
- QEventLoop* _eventLoop;
- QByteArray _session;
- int _CSeq;
-};
-
-#endif
Index: trunk/BNC/bncnetquerys.cpp
===================================================================
--- trunk/BNC/bncnetquerys.cpp (revision 4277)
+++ (revision )
@@ -1,197 +1,0 @@
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncnetquerys
- *
- * Purpose: Serial Communication Requests, no NTRIP
- *
- * Author: G. Weber
- *
- * Created: 8-Mar-2009
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include "bncnetquerys.h"
-#include "bncversion.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncNetQueryS::bncNetQueryS() {
-
- _serialPort = 0;
-
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncNetQueryS::~bncNetQueryS() {
- delete _serialPort;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryS::stop() {
-#ifndef sparc
- if (_serialPort) {
- }
-#endif
- _status = finished;
-}
-
-//
-/////////////////////////////////////////////////////////////////////////////
-void bncNetQueryS::waitForRequestResult(const QUrl&, QByteArray&) {
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryS::waitForReadyRead(QByteArray& outData) {
- if (_serialPort) {
- while (true) {
- int nb = _serialPort->bytesAvailable();
- if (nb > 0) {
- outData = _serialPort->read(nb);
- return;
- }
- }
- }
-}
-
-// Connect to Serial Port
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryS::startRequest(const QUrl& url, const QByteArray& gga) {
-
- QByteArray dummy_gga = gga;
-
- _url = url;
- if (_url.scheme().isEmpty()) {
- _url.setScheme("http");
- }
- if (_url.path().isEmpty()) {
- _url.setPath("/");
- }
-
- QString hlp;
- QStringList hlpL;
- hlp = _url.host().toAscii().replace("-"," ");
- hlpL = hlp.split(" ");
-
- // Serial Port
- // -----------
- QString _portString;
- if (hlpL.size() == 6) {
- _portString = hlpL[hlpL.size()-6].replace("com","COM");
- } else {
- _portString = "/" + hlpL[hlpL.size()-7] + "/" + hlpL[hlpL.size()-6].replace("ttys","ttyS");
- }
- _serialPort = new QextSerialPort(_portString);
-
- // Baud Rate
- // ---------
- hlp = hlpL[hlpL.size()-1];
- if (hlp == "110") {
- _serialPort->setBaudRate(BAUD110);
- }
- else if (hlp == "300") {
- _serialPort->setBaudRate(BAUD300);
- }
- else if (hlp == "600") {
- _serialPort->setBaudRate(BAUD600);
- }
- else if (hlp == "1200") {
- _serialPort->setBaudRate(BAUD1200);
- }
- else if (hlp == "2400") {
- _serialPort->setBaudRate(BAUD2400);
- }
- else if (hlp == "4800") {
- _serialPort->setBaudRate(BAUD4800);
- }
- else if (hlp == "9600") {
- _serialPort->setBaudRate(BAUD9600);
- }
- else if (hlp == "19200") {
- _serialPort->setBaudRate(BAUD19200);
- }
- else if (hlp == "38400") {
- _serialPort->setBaudRate(BAUD38400);
- }
- else if (hlp == "57600") {
- _serialPort->setBaudRate(BAUD57600);
- }
- else if (hlp == "115200") {
- _serialPort->setBaudRate(BAUD115200);
- }
-
- // Parity
- // ------
- hlp = hlpL[hlpL.size()-4].toUpper();
- if (hlp == "NONE") {
- _serialPort->setParity(PAR_NONE);
- }
- else if (hlp == "ODD") {
- _serialPort->setParity(PAR_ODD);
- }
- else if (hlp == "EVEN") {
- _serialPort->setParity(PAR_EVEN);
- }
- else if (hlp == "SPACE") {
- _serialPort->setParity(PAR_SPACE);
- }
-
- // Data Bits
- // ---------
- hlp = hlpL[hlpL.size()-5];
- if (hlp == "5") {
- _serialPort->setDataBits(DATA_5);
- }
- else if (hlp == "6") {
- _serialPort->setDataBits(DATA_6);
- }
- else if (hlp == "7") {
- _serialPort->setDataBits(DATA_7);
- }
- else if (hlp == "8") {
- _serialPort->setDataBits(DATA_8);
- }
-
- // Stop Bits
- // ---------
- hlp = hlpL[hlpL.size()-3];
- if (hlp == "1") {
- _serialPort->setStopBits(STOP_1);
- }
- else if (hlp == "2") {
- _serialPort->setStopBits(STOP_2);
- }
-
- // Flow Control
- // ------------
- hlp = hlpL[hlpL.size()-2].toUpper();
- if (hlp == "XONXOFF") {
- _serialPort->setFlowControl(FLOW_XONXOFF);
- }
- else if (hlp == "HARDWARE") {
- _serialPort->setFlowControl(FLOW_HARDWARE);
- }
- else {
- _serialPort->setFlowControl(FLOW_OFF);
- }
-
- _status = running;
-
- _serialPort->open(QIODevice::ReadWrite|QIODevice::Unbuffered);
- if (!_serialPort->isOpen()) {
- delete _serialPort;
- _serialPort = 0;
- _status = error;
- emit newMessage(_url.path().toAscii().replace(0,1,"") + ": Cannot open serial port " + _portString.toAscii(), true);
- return;
- }
-}
-
Index: trunk/BNC/bncnetquerys.h
===================================================================
--- trunk/BNC/bncnetquerys.h (revision 4277)
+++ (revision )
@@ -1,21 +1,0 @@
-#ifndef BNCSNETQUERYS_H
-#define BNCSNETQUERYS_H
-
-#include "bncnetquery.h"
-#include "serial/qextserialport.h"
-
-class bncNetQueryS : public bncNetQuery {
- public:
- bncNetQueryS();
- virtual ~bncNetQueryS();
-
- virtual void stop();
- virtual void waitForRequestResult(const QUrl& url, QByteArray& outData);
- virtual void startRequest(const QUrl& url, const QByteArray& gga);
- virtual void waitForReadyRead(QByteArray& outData);
-
- private:
- QextSerialPort* _serialPort;
-};
-
-#endif
Index: trunk/BNC/bncnetqueryudp.cpp
===================================================================
--- trunk/BNC/bncnetqueryudp.cpp (revision 4277)
+++ (revision )
@@ -1,178 +1,0 @@
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncNetQueryUdp
- *
- * Purpose: Blocking Network Requests (NTRIP Version 2 with plain UDP)
- *
- * Author: L. Mervart
- *
- * Created: 04-Feb-2009
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-#include
-#include
-
-#include "bncnetqueryudp.h"
-#include "bncsettings.h"
-#include "bncversion.h"
-
-using namespace std;
-
-#define TIME_RESOLUTION 125
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncNetQueryUdp::bncNetQueryUdp() {
- _port = 0;
- _udpSocket = 0;
- _eventLoop = new QEventLoop(this);
-
- _keepAlive[ 0] = 128;
- _keepAlive[ 1] = 96;
- for (int ii = 2; ii <=11; ii++) {
- _keepAlive[ii] = 0;
- }
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncNetQueryUdp::~bncNetQueryUdp() {
- delete _eventLoop;
- delete _udpSocket;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryUdp::stop() {
- _eventLoop->quit();
- _status = finished;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryUdp::slotKeepAlive() {
- if (_udpSocket) {
- _udpSocket->writeDatagram(_keepAlive, 12, _address, _port);
- }
- QTimer::singleShot(15000, this, SLOT(slotKeepAlive()));
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryUdp::waitForRequestResult(const QUrl&, QByteArray&) {
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryUdp::waitForReadyRead(QByteArray& outData) {
-
- // Wait Loop
- // ---------
- if (!_udpSocket->hasPendingDatagrams()) {
- _eventLoop->exec();
- }
-
- // Append Data
- // -----------
- QByteArray datagram;
- datagram.resize(_udpSocket->pendingDatagramSize());
- _udpSocket->readDatagram(datagram.data(), datagram.size());
-
- if (datagram.size() > 12) {
- outData.append(datagram.mid(12));
- }
- else {
- _status = error;
- }
-}
-
-// Connect to Caster, send the Request
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryUdp::startRequest(const QUrl& url, const QByteArray& gga) {
-
- _status = running;
-
- // Default scheme and path
- // -----------------------
- _url = url;
- if (_url.scheme().isEmpty()) {
- _url.setScheme("http");
- }
- if (_url.path().isEmpty()) {
- _url.setPath("/");
- }
-
- _port = _url.port();
-
- delete _udpSocket;
- _udpSocket = new QUdpSocket();
- _udpSocket->bind(0);
- connect(_udpSocket, SIGNAL(readyRead()), _eventLoop, SLOT(quit()));
-
- QHostInfo hInfo = QHostInfo::fromName(url.host());
-
- if (!hInfo.addresses().isEmpty()) {
-
- _address = hInfo.addresses().first();
-
- // Send Request
- // ------------
- QString uName = QUrl::fromPercentEncoding(_url.userName().toAscii());
- QString passW = QUrl::fromPercentEncoding(_url.password().toAscii());
- QByteArray userAndPwd;
-
- if(!uName.isEmpty() || !passW.isEmpty()) {
- userAndPwd = "Authorization: Basic " + (uName.toAscii() + ":" +
- passW.toAscii()).toBase64() + "\r\n";
- }
-
- QByteArray reqStr = "GET " + _url.path().toAscii() + " HTTP/1.1\r\n"
- + "Host: " + _url.host().toAscii() + "\r\n"
- + "Ntrip-Version: Ntrip/2.0\r\n"
- + "User-Agent: NTRIP BNC/" BNCVERSION "\r\n";
- if (!gga.isEmpty()) {
- reqStr += "Ntrip-GGA: " + gga + "\r\n";
- }
- reqStr += userAndPwd + "Connection: close\r\n\r\n";
-
- char rtpbuffer[12 + reqStr.size()];
- rtpbuffer[0] = 128;
- rtpbuffer[1] = 97;
- for (int jj = 2; jj <= 11; jj++) {
- rtpbuffer[jj] = _keepAlive[jj];
- }
- for (int ii = 0; ii < reqStr.size(); ii++) {
- rtpbuffer[12+ii] = reqStr[ii];
- }
-
- _udpSocket->writeDatagram(rtpbuffer, 12 + reqStr.size(), _address, _port);
-
- // Wait for Reply, read Session Number
- // -----------------------------------
- QByteArray repl;
- waitForReadyRead(repl);
-
- QTextStream in(repl);
- QString line = in.readLine();
- while (!line.isEmpty()) {
- if (line.indexOf("Session:") == 0) {
- _session = line.mid(9).toUInt();
- _keepAlive[ 8] = (_session >> 24) & 0xFF;
- _keepAlive[ 9] = (_session >> 16) & 0xFF;
- _keepAlive[10] = (_session >> 8) & 0xFF;
- _keepAlive[11] = (_session) & 0xFF;
- break;
- }
- line = in.readLine();
- }
-
- QTimer::singleShot(15000, this, SLOT(slotKeepAlive()));
- }
-}
-
Index: trunk/BNC/bncnetqueryudp.h
===================================================================
--- trunk/BNC/bncnetqueryudp.h (revision 4277)
+++ (revision )
@@ -1,29 +1,0 @@
-#ifndef BNCNETQUERYUDP_H
-#define BNCNETQUERYUDP_H
-
-#include "bncnetquery.h"
-
-class bncNetQueryUdp : public bncNetQuery {
- Q_OBJECT
- public:
- bncNetQueryUdp();
- virtual ~bncNetQueryUdp();
-
- virtual void stop();
- virtual void waitForRequestResult(const QUrl& url, QByteArray& outData);
- virtual void startRequest(const QUrl& url, const QByteArray& gga);
- virtual void waitForReadyRead(QByteArray& outData);
-
- private slots:
- void slotKeepAlive();
-
- private:
- QUdpSocket* _udpSocket;
- QEventLoop* _eventLoop;
- QHostAddress _address;
- int _port;
- char _keepAlive[12];
- unsigned _session;
-};
-
-#endif
Index: trunk/BNC/bncnetqueryudp0.cpp
===================================================================
--- trunk/BNC/bncnetqueryudp0.cpp (revision 4277)
+++ (revision )
@@ -1,76 +1,0 @@
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncNetQueryUdp0
- *
- * Purpose: Blocking Network Requests (plain UDP, no NTRIP)
- *
- * Author: L. Mervart
- *
- * Created: 04-Feb-2009
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include "bncnetqueryudp0.h"
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncNetQueryUdp0::bncNetQueryUdp0() {
- _udpSocket = 0;
- _eventLoop = new QEventLoop(this);
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncNetQueryUdp0::~bncNetQueryUdp0() {
- delete _eventLoop;
- delete _udpSocket;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryUdp0::stop() {
- _eventLoop->quit();
- _status = finished;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryUdp0::waitForRequestResult(const QUrl&, QByteArray&) {
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryUdp0::waitForReadyRead(QByteArray& outData) {
-
- // Wait Loop
- // ---------
- if (!_udpSocket->hasPendingDatagrams()) {
- _eventLoop->exec();
- }
-
- // Append Data
- // -----------
- QByteArray datagram;
- datagram.resize(_udpSocket->pendingDatagramSize());
- _udpSocket->readDatagram(datagram.data(), datagram.size());
-
- outData.append(datagram);
-}
-
-// Connect to Caster, send the Request
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryUdp0::startRequest(const QUrl& url, const QByteArray& /* gga */) {
-
- _status = running;
-
- delete _udpSocket;
- _udpSocket = new QUdpSocket();
- _udpSocket->bind(url.port());
-
- connect(_udpSocket, SIGNAL(readyRead()), _eventLoop, SLOT(quit()));
-}
-
Index: trunk/BNC/bncnetqueryudp0.h
===================================================================
--- trunk/BNC/bncnetqueryudp0.h (revision 4277)
+++ (revision )
@@ -1,21 +1,0 @@
-#ifndef BNCNETQUERYUDP0_H
-#define BNCNETQUERYUDP0_H
-
-#include "bncnetquery.h"
-
-class bncNetQueryUdp0 : public bncNetQuery {
- Q_OBJECT
- public:
- bncNetQueryUdp0();
- virtual ~bncNetQueryUdp0();
-
- virtual void stop();
- virtual void waitForRequestResult(const QUrl& url, QByteArray& outData);
- virtual void startRequest(const QUrl& url, const QByteArray& gga);
- virtual void waitForReadyRead(QByteArray& outData);
- private:
- QUdpSocket* _udpSocket;
- QEventLoop* _eventLoop;
-};
-
-#endif
Index: trunk/BNC/bncnetqueryv0.cpp
===================================================================
--- trunk/BNC/bncnetqueryv0.cpp (revision 4277)
+++ (revision )
@@ -1,129 +1,0 @@
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncNetQueryV0
- *
- * Purpose: TCP/IP Network Requests, no NTRIP
- *
- * Author: G. Weber
- *
- * Created: 19-Feb-2009
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-#include
-
-#include "bncnetqueryv0.h"
-#include "bncsettings.h"
-#include "bncversion.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncNetQueryV0::bncNetQueryV0() {
- _socket = 0;
- _timeOut = 120000;
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncNetQueryV0::~bncNetQueryV0() {
- delete _socket;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryV0::stop() {
-#ifndef sparc
- if (_socket) {
- _socket->abort();
- }
-#endif
- _status = finished;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryV0::waitForRequestResult(const QUrl&, QByteArray&) {
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryV0::waitForReadyRead(QByteArray& outData) {
- if (_socket && _socket->state() == QAbstractSocket::ConnectedState) {
- while (true) {
- int nBytes = _socket->bytesAvailable();
- if (nBytes > 0) {
- outData = _socket->readAll();
- return;
- }
- else if (!_socket->waitForReadyRead(_timeOut)) {
- delete _socket;
- _socket = 0;
- _status = error;
- emit newMessage(_url.path().toAscii() + " read timeout", true);
- return;
- }
- }
- }
-}
-
-// Connect to Caster, send the Request
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryV0::startRequest(const QUrl& url, const QByteArray& /* gga */) {
-
- _status = running;
-
- delete _socket;
- _socket = new QTcpSocket();
-
- // Default scheme and path
- // -----------------------
- _url = url;
- if (_url.scheme().isEmpty()) {
- _url.setScheme("http");
- }
- if (_url.path().isEmpty()) {
- _url.setPath("/");
- }
-
- // Connect the Socket
- // ------------------
- bncSettings settings;
-
- _socket->connectToHost(_url.host(), _url.port());
- if (!_socket->waitForConnected(_timeOut)) {
- delete _socket;
- _socket = 0;
- _status = error;
- emit(newMessage(_url.path().toAscii().replace(0,1,"")
- + ": Connect timeout, reconnecting", true));
- return;
- }
-
- // Read Caster Response
- // --------------------
- QStringList response;
- while (true) {
- if (!_socket->waitForReadyRead(_timeOut)) {
- delete _socket;
- _socket = 0;
- _status = error;
- emit newMessage(_url.path().toAscii().replace(0,1,"")
- + ": Read timeout", true);
- return;
- }
- if (_socket->canReadLine()) {
- QString line = _socket->readLine();
- response.push_back(line);
- response.clear();
- break;
- }
- }
-}
-
Index: trunk/BNC/bncnetqueryv0.h
===================================================================
--- trunk/BNC/bncnetqueryv0.h (revision 4277)
+++ (revision )
@@ -1,20 +1,0 @@
-#ifndef BNCNETQUERYV0_H
-#define BNCNETQUERYV0_H
-
-#include "bncnetquery.h"
-
-class bncNetQueryV0 : public bncNetQuery {
- public:
- bncNetQueryV0();
- virtual ~bncNetQueryV0();
-
- virtual void stop();
- virtual void waitForRequestResult(const QUrl& url, QByteArray& outData);
- virtual void startRequest(const QUrl& url, const QByteArray& gga);
- virtual void waitForReadyRead(QByteArray& outData);
-
- private:
- QTcpSocket* _socket;
-};
-
-#endif
Index: trunk/BNC/bncnetqueryv1.cpp
===================================================================
--- trunk/BNC/bncnetqueryv1.cpp (revision 4277)
+++ (revision )
@@ -1,252 +1,0 @@
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncNetQueryV1
- *
- * Purpose: Blocking Network Requests (NTRIP Version 1)
- *
- * Author: L. Mervart
- *
- * Created: 27-Dec-2008
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-#include
-
-#include "bncnetqueryv1.h"
-#include "bncsettings.h"
-#include "bncversion.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncNetQueryV1::bncNetQueryV1() {
- _socket = 0;
- _eventLoop = new QEventLoop(this);
- _timeOut = 20000;
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncNetQueryV1::~bncNetQueryV1() {
- delete _socket;
- delete _eventLoop;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryV1::stop() {
- _eventLoop->quit();
-#ifndef sparc
- if (_socket) {
- _socket->abort();
- }
-#endif
- _status = finished;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryV1::waitForRequestResult(const QUrl& url, QByteArray& outData){
-
- delete _socket;
- _socket = new QTcpSocket();
-
- connect(_socket, SIGNAL(disconnected()), _eventLoop, SLOT(quit()));
-
- startRequestPrivate(url, "", true);
-
- QTimer::singleShot(10000, _eventLoop, SLOT(quit()));
-
- _eventLoop->exec();
-
- if (_socket) {
- outData = _socket->readAll();
- delete _socket; _socket = 0;
- _status = finished;
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryV1::waitForReadyRead(QByteArray& outData) {
- if (_socket && _socket->state() == QAbstractSocket::ConnectedState) {
- while (true) {
- int nBytes = _socket->bytesAvailable();
- if (nBytes > 0) {
- outData = _socket->readAll();
- return;
- }
- else if (!_socket->waitForReadyRead(_timeOut)) {
- QString errStr = _socket->errorString();
- if (errStr.isEmpty()) {
- errStr = "Read timeout";
- }
- delete _socket;
- _socket = 0;
- _status = error;
- emit newMessage(_url.path().toAscii().replace(0,1,"")
- + ": " + errStr.toAscii(), true);
- return;
- }
- }
- }
-}
-
-// Connect to Caster, send the Request
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryV1::startRequest(const QUrl& url, const QByteArray& gga) {
- startRequestPrivate(url, gga, false);
-}
-
-// Connect to Caster, send the Request
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryV1::startRequestPrivate(const QUrl& url,
- const QByteArray& gga,
- bool sendRequestOnly) {
-
- _status = running;
-
- if (!sendRequestOnly) {
- delete _socket;
- _socket = new QTcpSocket();
- }
-
- // Default scheme and path
- // -----------------------
- _url = url;
- if (_url.scheme().isEmpty()) {
- _url.setScheme("http");
- }
- if (_url.path().isEmpty()) {
- _url.setPath("/");
- }
-
- // Connect the Socket
- // ------------------
- bncSettings settings;
- QString proxyHost = settings.value("proxyHost").toString();
- int proxyPort = settings.value("proxyPort").toInt();
-
- if ( proxyHost.isEmpty() ) {
- _socket->connectToHost(_url.host(), _url.port());
- }
- else {
- _socket->connectToHost(proxyHost, proxyPort);
- }
- if (!_socket->waitForConnected(_timeOut)) {
- delete _socket;
- _socket = 0;
- _status = error;
- return;
- }
-
- // Send Request
- // ------------
- QString uName = QUrl::fromPercentEncoding(_url.userName().toAscii());
- QString passW = QUrl::fromPercentEncoding(_url.password().toAscii());
- QByteArray userAndPwd;
-
- if(!uName.isEmpty() || !passW.isEmpty()) {
- userAndPwd = "Authorization: Basic " + (uName.toAscii() + ":" +
- passW.toAscii()).toBase64() + "\r\n";
- }
-
- QByteArray reqStr;
- if ( proxyHost.isEmpty() ) {
- if (_url.path().indexOf("/") != 0) _url.setPath("/");
- reqStr = "GET " + _url.path().toAscii() + " HTTP/1.0\r\n"
- + "User-Agent: NTRIP BNC/" BNCVERSION "\r\n"
- + "Host: " + _url.host().toAscii() + "\r\n"
- + userAndPwd + "\r\n";
- } else {
- reqStr = "GET " + _url.toEncoded() + " HTTP/1.0\r\n"
- + "User-Agent: NTRIP BNC/" BNCVERSION "\r\n"
- + "Host: " + _url.host().toAscii() + "\r\n"
- + userAndPwd + "\r\n";
- }
-
- // NMEA string to handle VRS stream
- // --------------------------------
- if (!gga.isEmpty()) {
- reqStr += gga + "\r\n";
- }
-
- _socket->write(reqStr, reqStr.length());
-
- if (!_socket->waitForBytesWritten(_timeOut)) {
- delete _socket;
- _socket = 0;
- _status = error;
- emit newMessage(_url.path().toAscii().replace(0,1,"")
- + ": Write timeout", true);
- return;
- }
-
- // Read Caster Response
- // --------------------
- if (!sendRequestOnly) {
- bool proxyResponse = false;
- QStringList response;
- while (true) {
- if (_socket->canReadLine()) {
- QString line = _socket->readLine();
-
- if (line.indexOf("ICY 200 OK") == -1 &&
- line.indexOf("HTTP") != -1 &&
- line.indexOf("200 OK") != -1 ) {
- proxyResponse = true;
- }
-
- if (!proxyResponse && !line.trimmed().isEmpty()) {
- response.push_back(line);
- }
-
- if (line.trimmed().isEmpty()) {
- if (proxyResponse) {
- proxyResponse = false;
- }
- else {
- break;
- }
- }
-
- if (line.indexOf("Unauthorized") != -1) {
- break;
- }
-
- if (!proxyResponse &&
- line.indexOf("200 OK") != -1 &&
- line.indexOf("SOURCETABLE") == -1) {
- response.clear();
- if (_socket->canReadLine()) {
- _socket->readLine();
- }
- break;
- }
- }
- else if (!_socket->waitForReadyRead(_timeOut)) {
- delete _socket;
- _socket = 0;
- _status = error;
- emit newMessage(_url.path().toAscii().replace(0,1,"")
- + ": Response timeout", true);
- return;
- }
- }
- if (response.size() > 0) {
- delete _socket;
- _socket = 0;
- _status = error;
- emit newMessage(_url.path().toAscii().replace(0,1,"")
- + ": Wrong caster response\n"
- + response.join("").toAscii(), true);
- }
- }
-}
-
Index: trunk/BNC/bncnetqueryv1.h
===================================================================
--- trunk/BNC/bncnetqueryv1.h (revision 4277)
+++ (revision )
@@ -1,23 +1,0 @@
-#ifndef BNCNETQUERYV1_H
-#define BNCNETQUERYV1_H
-
-#include "bncnetquery.h"
-
-class bncNetQueryV1 : public bncNetQuery {
- public:
- bncNetQueryV1();
- virtual ~bncNetQueryV1();
-
- virtual void stop();
- virtual void waitForRequestResult(const QUrl& url, QByteArray& outData);
- virtual void startRequest(const QUrl& url, const QByteArray& gga);
- virtual void waitForReadyRead(QByteArray& outData);
-
- private:
- void startRequestPrivate(const QUrl& url, const QByteArray& gga,
- bool sendRequestOnly);
- QEventLoop* _eventLoop;
- QTcpSocket* _socket;
-};
-
-#endif
Index: trunk/BNC/bncnetqueryv2.cpp
===================================================================
--- trunk/BNC/bncnetqueryv2.cpp (revision 4277)
+++ (revision )
@@ -1,229 +1,0 @@
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncNetQueryV2
- *
- * Purpose: Blocking Network Requests (NTRIP Version 2)
- *
- * Author: L. Mervart
- *
- * Created: 27-Dec-2008
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-
-#include "bncnetqueryv2.h"
-#include "bncsettings.h"
-#include "bncversion.h"
-#include "bncsslconfig.h"
-#include "bncsettings.h"
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncNetQueryV2::bncNetQueryV2(bool secure) {
- _secure = secure;
- _manager = new QNetworkAccessManager(this);
- connect(_manager, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&,
- QAuthenticator*)),
- this, SLOT(slotProxyAuthenticationRequired(const QNetworkProxy&,
- QAuthenticator*)));
- _reply = 0;
- _eventLoop = new QEventLoop(this);
- _firstData = true;
- _status = init;
-
- bncSettings settings;
- _ignoreSslErrors =
- (Qt::CheckState(settings.value("ignoreSslErrors").toInt()) == Qt::Checked);
-
- if (_secure && !QSslSocket::supportsSsl()) {
- ((bncApp*)qApp)->slotMessage("No SSL support, install OpenSSL run-time libraries", true);
- stop();
- }
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncNetQueryV2::~bncNetQueryV2() {
- delete _eventLoop;
- delete _reply;
- delete _manager;
-}
-
-// Stop (quit event loop)
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryV2::stop() {
- if (_reply) {
- _reply->abort();
- }
- _eventLoop->quit();
- _status = finished;
-}
-
-// End of Request
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryV2::slotFinished() {
- _eventLoop->quit();
- if (_reply && _reply->error() != QNetworkReply::NoError) {
- _status = error;
- emit newMessage(_url.path().toAscii().replace(0,1,"") +
- ": NetQueryV2: server replied: " +
- _reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray(),
- true);
- }
- else {
- _status = finished;
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryV2::slotProxyAuthenticationRequired(const QNetworkProxy&,
- QAuthenticator*) {
- emit newMessage("slotProxyAuthenticationRequired", true);
-}
-
-// Start request, block till the next read
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryV2::startRequest(const QUrl& url, const QByteArray& gga) {
- startRequestPrivate(url, gga, false);
-}
-
-// Start Request (Private Method)
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryV2::startRequestPrivate(const QUrl& url, const QByteArray& gga,
- bool full) {
-
- _status = running;
-
- // Default scheme and path
- // -----------------------
- _url = url;
- if (_url.scheme().isEmpty()) {
- if (_secure) {
- _url.setScheme("https");
- }
- else {
- _url.setScheme("http");
- }
- }
- if (_url.path().isEmpty()) {
- _url.setPath("/");
- }
-
- // Proxy Settings
- // --------------
- bncSettings settings;
- QString proxyHost = settings.value("proxyHost").toString();
- int proxyPort = settings.value("proxyPort").toInt();
-
- if (!proxyHost.isEmpty()) {
- QNetworkProxy proxy(QNetworkProxy::HttpProxy, proxyHost, proxyPort);
- _manager->setProxy(proxy);
- }
-
- // Network Request
- // ---------------
- QNetworkRequest request;
- bncSslConfig sslConfig;
- request.setSslConfiguration(sslConfig);
- request.setUrl(_url);
- request.setRawHeader("Host" , _url.host().toAscii());
- request.setRawHeader("Ntrip-Version", "Ntrip/2.0");
- request.setRawHeader("User-Agent" , "NTRIP BNC/"BNCVERSION);
- if (!_url.userName().isEmpty()) {
- QString uName = QUrl::fromPercentEncoding(_url.userName().toAscii());
- QString passW = QUrl::fromPercentEncoding(_url.password().toAscii());
- request.setRawHeader("Authorization", "Basic " +
- (uName + ":" + passW).toAscii().toBase64());
- }
- if (!gga.isEmpty()) {
- request.setRawHeader("Ntrip-GGA", gga);
- }
- request.setRawHeader("Connection" , "close");
-
- delete _reply;
- _reply = _manager->get(request);
-
- // Connect Signals
- // ---------------
- connect(_reply, SIGNAL(finished()), this, SLOT(slotFinished()));
- connect(_reply, SIGNAL(finished()), _eventLoop, SLOT(quit()));
- connect(_reply, SIGNAL(sslErrors(QList)),
- this, SLOT(slotSslErrors(QList)));
- if (!full) {
- connect(_reply, SIGNAL(readyRead()), _eventLoop, SLOT(quit()));
- }
-}
-
-// Start Request, wait for its completion
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryV2::waitForRequestResult(const QUrl& url, QByteArray& outData) {
-
- // Send Request
- // ------------
- startRequestPrivate(url, "", true);
-
- // Wait Loop
- // ---------
- _eventLoop->exec();
-
- // Copy Data and Return
- // --------------------
- outData = _reply->readAll();
-}
-
-// Wait for next data
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryV2::waitForReadyRead(QByteArray& outData) {
-
- // Wait Loop
- // ---------
- if (!_reply->bytesAvailable()) {
- _eventLoop->exec();
- }
-
- // Check NTRIPv2 error code
- // ------------------------
- if (_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() != 200) {
- _reply->abort();
- }
-
- // Append Data
- // -----------
- else {
- outData.append(_reply->readAll());
- }
-}
-
-// TSL/SSL
-////////////////////////////////////////////////////////////////////////////
-void bncNetQueryV2::slotSslErrors(QList errors) {
-
- QString msg = "SSL Error\n";
- QSslCertificate cert = _reply->sslConfiguration().peerCertificate();
- if (!cert.isNull()) {
- msg += QString("Server Certificate Issued by:\n"
- "%1\n%2\nCannot be verified\n")
- .arg(cert.issuerInfo(QSslCertificate::OrganizationalUnitName))
- .arg(cert.issuerInfo(QSslCertificate::Organization));
- }
- QListIterator it(errors);
- while (it.hasNext()) {
- const QSslError& err = it.next();
- msg += "\n" + err.errorString();
- }
-
- ((bncApp*)qApp)->slotMessage(msg.toAscii(), true);
-
- if (_ignoreSslErrors) {
- _reply->ignoreSslErrors();
- }
- else {
- stop();
- }
-}
Index: trunk/BNC/bncnetqueryv2.h
===================================================================
--- trunk/BNC/bncnetqueryv2.h (revision 4277)
+++ (revision )
@@ -1,34 +1,0 @@
-#ifndef BNCNETQUERYV2_H
-#define BNCNETQUERYV2_H
-
-#include "bncnetquery.h"
-
-class bncNetQueryV2 : public bncNetQuery {
- Q_OBJECT
-
- public:
- bncNetQueryV2(bool secure);
- virtual ~bncNetQueryV2();
-
- virtual void stop();
- virtual void waitForRequestResult(const QUrl& url, QByteArray& outData);
- virtual void startRequest(const QUrl& url, const QByteArray& gga);
- virtual void waitForReadyRead(QByteArray& outData);
-
- private slots:
- void slotFinished();
- void slotProxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*);
- void slotSslErrors(QList);
-
- private:
- void startRequestPrivate(const QUrl& url, const QByteArray& gga, bool full);
-
- QNetworkAccessManager* _manager;
- QNetworkReply* _reply;
- QEventLoop* _eventLoop;
- bool _firstData;
- bool _secure;
- bool _ignoreSslErrors;
-};
-
-#endif
Index: trunk/BNC/bncoutf.cpp
===================================================================
--- trunk/BNC/bncoutf.cpp (revision 4277)
+++ (revision )
@@ -1,155 +1,0 @@
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Server
- * -------------------------------------------------------------------------
- *
- * Class: bncoutf
- *
- * Purpose: Basis Class for File-Writers
- *
- * Author: L. Mervart
- *
- * Created: 25-Apr-2008
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-#include
-
-#include "bncoutf.h"
-#include "bncsettings.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncoutf::bncoutf(const QString& sklFileName, const QString& intr, int sampl) {
-
- bncSettings settings;
-
- _headerWritten = false;
- _sampl = sampl;
- _intr = intr;
-
- QFileInfo fileInfo(sklFileName);
- _path = fileInfo.absolutePath() + QDir::separator();
- _sklBaseName = fileInfo.baseName();
- _extension = fileInfo.completeSuffix();
-
- expandEnvVar(_path);
- if (!_extension.isEmpty()) {
- _extension = "." + _extension;
- }
-
- _append = Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked;
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncoutf::~bncoutf() {
- closeFile();
-}
-
-// Close the Old RINEX File
-////////////////////////////////////////////////////////////////////////////
-void bncoutf::closeFile() {
- _out.close();
-}
-
-// Epoch String
-////////////////////////////////////////////////////////////////////////////
-QString bncoutf::epochStr(const QDateTime& datTim, const QString& intStr) {
-
- QString epoStr;
-
- int indHlp = intStr.indexOf("min");
-
- if ( indHlp != -1) {
- int step = intStr.left(indHlp-1).toInt();
- char ch = 'A' + datTim.time().hour();
- epoStr = QString("_") + ch;
- if (datTim.time().minute() >= 60-step) {
- epoStr += QString("%1").arg(60-step, 2, 10, QChar('0'));
- }
- else {
- for (int limit = step; limit <= 60-step; limit += step) {
- if (datTim.time().minute() < limit) {
- epoStr += QString("%1").arg(limit-step, 2, 10, QChar('0'));
- break;
- }
- }
- }
- }
- else if (intStr == "1 hour") {
- char ch = 'A' + datTim.time().hour();
- epoStr = QString("_") + ch;
- }
- else {
- epoStr = "";
- }
-
- return epoStr;
-}
-
-// File Name according to RINEX Standards
-////////////////////////////////////////////////////////////////////////////
-QString bncoutf::resolveFileName(int GPSweek, const QDateTime& datTim) {
-
- int dayOfWeek = datTim.date().dayOfWeek();
- if (dayOfWeek == 7) {
- dayOfWeek = 0;
- }
- QString gpswd = QString("%1%2").arg(GPSweek).arg(dayOfWeek);
- QString baseName = _sklBaseName; baseName.replace("${GPSWD}", gpswd);
- QString epoStr = epochStr(datTim, _intr);
-
- return _path + baseName + epoStr + _extension;
-}
-
-// Re-Open Output File
-////////////////////////////////////////////////////////////////////////////
-t_irc bncoutf::reopen(int GPSweek, double GPSweeks) {
-
- if (_sampl != 0 && fmod(GPSweeks, _sampl) != 0.0) {
- return failure;
- }
-
- QDateTime datTim = dateAndTimeFromGPSweek(GPSweek, GPSweeks);
-
- QString newFileName = resolveFileName(GPSweek, datTim);
-
- // Close the file
- // --------------
- if (newFileName != _fName) {
- closeFile();
- _headerWritten = false;
- _fName = newFileName;
- }
-
- // Re-Open File, Write Header
- // --------------------------
- if (!_headerWritten) {
- _out.setf(ios::showpoint | ios::fixed);
- if (_append && QFile::exists(_fName)) {
- _out.open(_fName.toAscii().data(), ios::out | ios::app);
- }
- else {
- _out.open(_fName.toAscii().data());
- writeHeader(datTim);
- }
- _headerWritten = true;
- }
-
- return success;
-}
-
-// Write String
-////////////////////////////////////////////////////////////////////////////
-t_irc bncoutf::write(int GPSweek, double GPSweeks, const QString& str) {
- reopen(GPSweek, GPSweeks);
- _out << str.toAscii().data();
- _out.flush();
- return success;
-}
Index: trunk/BNC/bncoutf.h
===================================================================
--- trunk/BNC/bncoutf.h (revision 4277)
+++ (revision )
@@ -1,36 +1,0 @@
-#ifndef BNCOUTF_H
-#define BNCOUTF_H
-
-#include
-#include
-#include
-
-#include "bncutils.h"
-
-class bncoutf {
- public:
- bncoutf(const QString& sklFileName, const QString& intr, int sampl);
- virtual ~bncoutf();
- t_irc write(int GPSweek, double GPSweeks, const QString& str);
-
- protected:
- virtual t_irc reopen(int GPSweek, double GPSweeks);
- virtual void writeHeader(const QDateTime& /* datTim */) {}
- virtual void closeFile();
- std::ofstream _out;
- int _sampl;
-
- private:
- QString epochStr(const QDateTime& datTim, const QString& intStr);
- QString resolveFileName(int GPSweek, const QDateTime& datTim);
-
- bool _headerWritten;
- QString _path;
- QString _sklBaseName;
- QString _extension;
- QString _intr;
- QString _fName;
- bool _append;
-};
-
-#endif
Index: trunk/BNC/bncpppclient.cpp
===================================================================
--- trunk/BNC/bncpppclient.cpp (revision 4277)
+++ (revision )
@@ -1,532 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncPPPclient
- *
- * Purpose: Precise Point Positioning
- *
- * Author: L. Mervart
- *
- * Created: 21-Nov-2009
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-#include
-#include
-
-#include "bncpppclient.h"
-#include "bncapp.h"
-#include "bncutils.h"
-#include "bncconst.h"
-#include "bncmodel.h"
-#include "pppopt.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncPPPclient::bncPPPclient(QByteArray staID, t_pppOpt* opt, bool connectSlots) :
- bncEphUser(connectSlots) {
-
- if (opt) {
- _opt = opt;
- _optOwner = false;
- }
- else {
- _opt = new t_pppOpt();
- _optOwner = true;
- }
-
- _staID = staID;
-
- _model = new bncModel(this);
-
- if (connectSlots) {
- connect(this, SIGNAL(newMessage(QByteArray,bool)),
- ((bncApp*)qApp), SLOT(slotMessage(const QByteArray,bool)));
-
- connect(((bncApp*)qApp), SIGNAL(newCorrections(QList)),
- this, SLOT(slotNewCorrections(QList)));
- }
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncPPPclient::~bncPPPclient() {
- delete _model;
- while (!_epoData.empty()) {
- delete _epoData.front();
- _epoData.pop();
- }
- QMapIterator ic(_corr);
- while (ic.hasNext()) {
- ic.next();
- delete ic.value();
- }
- QMapIterator ib(_bias);
- while (ib.hasNext()) {
- ib.next();
- delete ib.value();
- }
- if (_optOwner) {
- delete _opt;
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncPPPclient::putNewObs(const t_obs& obs) {
- QMutexLocker locker(&_mutex);
-
- if (obs.satSys == 'R') {
- if (!_opt->useGlonass) return;
- }
- else if (obs.satSys == 'E') {
- if (!_opt->useGalileo) return;
- }
- else if (obs.satSys != 'G') {
- return;
- }
-
- t_satData* satData = new t_satData();
- satData->tt = bncTime(obs.GPSWeek, obs.GPSWeeks);
-
- // Satellite Number
- // ----------------
- satData->prn = QString("%1%2").arg(obs.satSys).arg(obs.satNum,2,10,QChar('0'));
-
- // Check Slips
- // -----------
- slipInfo& sInfo = _slips[satData->prn];
- if ( sInfo.slipCntL1 == obs.slip_cnt_L1 &&
- sInfo.slipCntL2 == obs.slip_cnt_L2 &&
- sInfo.slipCntL5 == obs.slip_cnt_L5 ) {
- satData->slipFlag = false;
- }
- else {
- satData->slipFlag = true;
- }
- sInfo.slipCntL1 = obs.slip_cnt_L1;
- sInfo.slipCntL2 = obs.slip_cnt_L2;
-
- // Handle Code Biases
- // ------------------
- t_bias* bb = 0;
- if (_bias.contains(satData->prn)) {
- bb = _bias.value(satData->prn);
- }
-
- // Add new epoch, process the older ones
- // -------------------------------------
- if (_epoData.size() == 0) {
- _epoData.push(new t_epoData());
- _epoData.back()->tt = satData->tt;
- }
- else if (satData->tt != _epoData.back()->tt) {
- processEpochs();
- _epoData.push(new t_epoData());
- _epoData.back()->tt = satData->tt;
- }
-
- // Set Observations GPS
- // --------------------
- if (obs.satSys == 'G') {
- if ( (obs.P1 || obs.C1) && (obs.P2 || obs.C2) && obs.l1() && obs.l2() ) {
- double f1 = t_CST::freq1;
- double f2 = t_CST::freq2;
- double c1 = f1 * f1 / (f1 * f1 - f2 * f2);
- double c2 = - f2 * f2 / (f1 * f1 - f2 * f2);
- if (obs.P1) {
- satData->P1 = obs.P1 + (bb ? bb->p1 : 0.0);
- }
- else {
- satData->P1 = obs.C1 + (bb ? bb->c1 : 0.0);
- }
- if (obs.P2) {
- satData->P2 = obs.P2 + (bb ? bb->p2 : 0.0);
- }
- else {
- satData->P2 = obs.C2;
- }
- satData->L1 = obs.l1() * t_CST::c / f1;
- satData->L2 = obs.l2() * t_CST::c / f2;
- satData->P3 = c1 * satData->P1 + c2 * satData->P2;
- satData->L3 = c1 * satData->L1 + c2 * satData->L2;
- satData->lambda3 = c1 * t_CST::c / f1 + c2 * t_CST::c / f2;
-
- _epoData.back()->satData[satData->prn] = satData;
- }
- else {
- delete satData;
- }
- }
-
- // Set Observations GLONASS
- // ------------------------
- else if (obs.satSys == 'R') {
- if ( (obs.P1 || obs.C1) && (obs.P2 || obs.C2) && obs.l1() && obs.l2() ) {
- double f1 = t_CST::f1(obs.satSys, obs.slotNum);
- double f2 = t_CST::f1(obs.satSys, obs.slotNum);
- double c1 = f1 * f1 / (f1 * f1 - f2 * f2);
- double c2 = - f2 * f2 / (f1 * f1 - f2 * f2);
- if (obs.P1) {
- satData->P1 = obs.P1 + (bb ? bb->p1 : 0.0);
- }
- else {
- satData->P1 = obs.C1 + (bb ? bb->c1 : 0.0);
- }
- if (obs.P2) {
- satData->P2 = obs.P2 + (bb ? bb->p2 : 0.0);
- }
- else {
- satData->P2 = obs.C2;
- }
- satData->L1 = obs.l1() * t_CST::c / f1;
- satData->L2 = obs.l2() * t_CST::c / f2;
- satData->P3 = c1 * satData->P1 + c2 * satData->P2;
- satData->L3 = c1 * satData->L1 + c2 * satData->L2;
- satData->lambda3 = c1 * t_CST::c / f1 + c2 * t_CST::c / f2;
-
- _epoData.back()->satData[satData->prn] = satData;
- }
- else {
- delete satData;
- }
- }
-
- // Set Observations Galileo
- // ------------------------
- else if (obs.satSys == 'E') {
- if ( obs.C1 && obs.C5 && obs.l1() && obs.L5) {
- double f1 = t_CST::freq1;
- double f5 = t_CST::freq5;
- double c1 = f1 * f1 / (f1 * f1 - f5 * f5);
- double c5 = - f5 * f5 / (f1 * f1 - f5 * f5);
-
- satData->P1 = obs.C1;
- satData->P5 = obs.C5;
- satData->L1 = obs.l1() * t_CST::c / f1;
- satData->L5 = obs.L5 * t_CST::c / f5;
- satData->P3 = c1 * satData->P1 + c5 * satData->P5;
- satData->L3 = c1 * satData->L1 + c5 * satData->L5;
- satData->lambda3 = c1 * t_CST::c / f1 + c5 * t_CST::c / f5;
- _epoData.back()->satData[satData->prn] = satData;
- }
- else {
- delete satData;
- }
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncPPPclient::slotNewCorrections(QList corrList) {
- QMutexLocker locker(&_mutex);
-
- // Check the Mountpoint (source of corrections)
- // --------------------------------------------
- if (!_opt->pppCorrMount.isEmpty()) {
- QMutableListIterator itm(corrList);
- while (itm.hasNext()) {
- QStringList hlp = itm.next().split(" ");
- if (hlp.size() > 0) {
- QString mountpoint = hlp[hlp.size()-1];
- if (mountpoint != _opt->pppCorrMount) {
- itm.remove();
- }
- }
- }
- }
-
- if (corrList.size() == 0) {
- return;
- }
-
- QListIterator it(corrList);
- while (it.hasNext()) {
- QString line = it.next();
-
- QTextStream in(&line);
- int messageType;
- int updateInterval;
- int GPSweek;
- double GPSweeks;
- QString prn;
- in >> messageType >> updateInterval >> GPSweek >> GPSweeks >> prn;
-
- if ( t_corr::relevantMessageType(messageType) ) {
- t_corr* cc = 0;
- if (_corr.contains(prn)) {
- cc = _corr.value(prn);
- }
- else {
- cc = new t_corr();
- _corr[prn] = cc;
- }
-
- cc->readLine(line);
- _corr_tt = cc->tClk;
- }
- else if ( messageType == BTYPE_GPS ) {
-
- t_bias* bb = 0;
- if (_bias.contains(prn)) {
- bb = _bias.value(prn);
- }
- else {
- bb = new t_bias();
- _bias[prn] = bb;
- }
-
- bb->tt.set(GPSweek, GPSweeks);
-
- int numBiases;
- in >> numBiases;
- for (int ii = 0; ii < numBiases; ++ii) {
- int bType;
- double bValue;
- in >> bType >> bValue;
- if (bType == CODETYPEGPS_L1_Z) {
- bb->p1 = bValue;
- }
- else if (bType == CODETYPEGPS_L1_CA) {
- bb->c1 = bValue;
- }
- else if (bType == CODETYPEGPS_L2_Z) {
- bb->p2 = bValue;
- }
- }
- }
- }
-}
-
-// Satellite Position
-////////////////////////////////////////////////////////////////////////////
-t_irc bncPPPclient::getSatPos(const bncTime& tt, const QString& prn,
- ColumnVector& xc, ColumnVector& vv) {
-
- const double MAXAGE = 120.0;
-
- if (_eph.contains(prn)) {
-
- if (_opt->pppMode) {
- if (_corr.contains(prn)) {
- t_corr* cc = _corr.value(prn);
- if (cc->ready() && tt - cc->tClk < MAXAGE) {
- t_eph* eLast = _eph.value(prn)->last;
- t_eph* ePrev = _eph.value(prn)->prev;
- if (eLast && eLast->IOD() == cc->iod) {
- eLast->position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data());
- return applyCorr(tt, cc, xc, vv);
- }
- else if (ePrev && ePrev->IOD() == cc->iod) {
- ePrev->position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data());
- return applyCorr(tt, cc, xc, vv);
- }
- }
- }
- }
-
- else {
- t_eph* ee = _eph.value(prn)->last;
- ee->position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data());
- return success;
- }
- }
-
- return failure;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-t_irc bncPPPclient::applyCorr(const bncTime& tt, const t_corr* cc,
- ColumnVector& xc, ColumnVector& vv) {
-
- double dtRao = tt - cc->tRao;
- ColumnVector raoHlp = cc->rao + cc->dotRao * dtRao
- + 0.5 * cc->dotDotRao * dtRao * dtRao;
-
- if (raoHlp.norm_Frobenius() > 20.0) {
- return failure;
- }
-
- ColumnVector dx(3);
- RSW_to_XYZ(xc.Rows(1,3), vv, raoHlp, dx);
- xc[0] -= dx[0];
- xc[1] -= dx[1];
- xc[2] -= dx[2];
-
- double dtClk = tt - cc->tClk;
-
- xc[3] += cc->dClk + cc->dotDClk * dtClk + cc->dotDotDClk * dtClk * dtClk
- + cc->hrClk;
-
- return success;
-}
-
-// Correct Time of Transmission
-////////////////////////////////////////////////////////////////////////////
-t_irc bncPPPclient::cmpToT(t_satData* satData) {
-
- double prange = satData->P3;
- if (prange == 0.0) {
- return failure;
- }
-
- double clkSat = 0.0;
- for (int ii = 1; ii <= 10; ii++) {
-
- bncTime ToT = satData->tt - prange / t_CST::c - clkSat;
-
- ColumnVector xc(4);
- ColumnVector vv(3);
- if (getSatPos(ToT, satData->prn, xc, vv) != success) {
- return failure;
- }
-
- double clkSatOld = clkSat;
- clkSat = xc(4);
-
- if ( fabs(clkSat-clkSatOld) * t_CST::c < 1.e-4 ) {
- satData->xx = xc.Rows(1,3);
- satData->vv = vv;
- satData->clk = clkSat * t_CST::c;
- return success;
- }
- }
-
- return failure;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncPPPclient::processFrontEpoch() {
-
-#ifdef BNC_DEBUG
- QString msg = "List of Corrections\n";
- QMapIterator itC(_corr);
- while (itC.hasNext()) {
- itC.next();
- QString src = itC.key();
- const t_corr* corr = itC.value();
- msg += QString("%1 %2 %3 %4\n")
- .arg(corr->prn)
- .arg(corr->iod)
- .arg(QString(corr->tClk.datestr().c_str()) + "_" + QString(corr->tClk.timestr().c_str()))
- .arg(QString(corr->tRao.datestr().c_str()) + "_" + QString(corr->tRao.timestr().c_str()));
- }
-
- msg += "List of Ephemeris\n";
- QMapIterator itE(_eph);
- while (itE.hasNext()) {
- itE.next();
- QString prn = itE.key();
- const t_ephPair* ephPair = itE.value();
- if (ephPair->prev) {
- msg += QString("%1 %2 %3 %4 %5\n")
- .arg(prn)
- .arg(ephPair->last->IOD())
- .arg(QString(ephPair->last->TOC().datestr().c_str()) + "_" +
- QString(ephPair->last->TOC().timestr().c_str()))
- .arg(ephPair->prev->IOD())
- .arg(QString(ephPair->prev->TOC().datestr().c_str()) + "_" +
- QString(ephPair->prev->TOC().timestr().c_str()));
- }
- else {
- msg += QString("%1 %2 %3\n")
- .arg(prn)
- .arg(ephPair->last->IOD())
- .arg(QString(ephPair->last->TOC().datestr().c_str()) + "_" +
- QString(ephPair->last->TOC().timestr().c_str()));
- }
- }
-
- emit newMessage(msg.toAscii(), false);
-#endif // BNC_DEBUG
-
- // Data Pre-Processing
- // -------------------
- QMutableMapIterator it(_epoData.front()->satData);
- while (it.hasNext()) {
- it.next();
- QString prn = it.key();
- t_satData* satData = it.value();
-
- if (cmpToT(satData) != success) {
- delete satData;
- it.remove();
- continue;
- }
- }
-
- // Filter Solution
- // ---------------
- if (_model->update(_epoData.front()) == success) {
- emit newPosition(_model->time(), _model->x(), _model->y(), _model->z());
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncPPPclient::processEpochs() {
-
- // Make sure the buffer does not grow beyond any limit
- // ---------------------------------------------------
- const unsigned MAX_EPODATA_SIZE = 120;
- if (_epoData.size() > MAX_EPODATA_SIZE) {
- delete _epoData.front();
- _epoData.pop();
- }
-
- // Loop over all unprocessed epochs
- // --------------------------------
- while (!_epoData.empty()) {
-
- t_epoData* frontEpoData = _epoData.front();
-
- // No corrections yet, skip the epoch
- // ----------------------------------
- if (_opt->corrSync != 0.0 && !_corr_tt.valid()) {
- return;
- }
-
- // Process the front epoch
- // -----------------------
- if (_opt->corrSync == 0 || frontEpoData->tt - _corr_tt < _opt->corrSync) {
- processFrontEpoch();
- delete _epoData.front();
- _epoData.pop();
- }
- else {
- return;
- }
- }
-}
Index: trunk/BNC/bncpppclient.h
===================================================================
--- trunk/BNC/bncpppclient.h (revision 4277)
+++ (revision )
@@ -1,177 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCPPPCLIENT_H
-#define BNCPPPCLIENT_H
-
-#include
-#include "bncephuser.h"
-#include "RTCM/GPSDecoder.h"
-
-class bncModel;
-class t_pppOpt;
-
-class t_satData {
- public:
- t_satData() {
- obsIndex = 0;
- }
- ~t_satData() {}
- bncTime tt;
- QString prn;
- double P1;
- double P2;
- double P5;
- double P3;
- double L1;
- double L2;
- double L5;
- double L3;
- ColumnVector xx;
- ColumnVector vv;
- double clk;
- double eleSat;
- double azSat;
- double rho;
- bool slipFlag;
- double lambda3;
- unsigned obsIndex;
- char system() const {return prn.toAscii()[0];}
-};
-
-class t_epoData {
- public:
- t_epoData() {}
-
- ~t_epoData() {
- clear();
- }
-
- void clear() {
- QMapIterator it(satData);
- while (it.hasNext()) {
- it.next();
- delete it.value();
- }
- satData.clear();
- }
-
- void deepCopy(const t_epoData* from) {
- clear();
- tt = from->tt;
- QMapIterator it(from->satData);
- while (it.hasNext()) {
- it.next();
- satData[it.key()] = new t_satData(*it.value());
- }
- }
-
- unsigned sizeSys(char system) const {
- unsigned ans = 0;
- QMapIterator it(satData);
- while (it.hasNext()) {
- it.next();
- if (it.value()->system() == system) {
- ++ans;
- }
- }
- return ans;
- }
- unsigned sizeAll() const {return satData.size();}
-
- bncTime tt;
- QMap satData;
-};
-
-class t_bias {
- public:
- t_bias() {
- p1 = 0.0;
- p2 = 0.0;
- c1 = 0.0;
- }
- bncTime tt;
- double p1;
- double p2;
- double c1;
-};
-
-class bncPPPclient : public bncEphUser {
- Q_OBJECT
-
- public:
- bncPPPclient(QByteArray staID, t_pppOpt* opt = 0, bool connectSlots = true);
- ~bncPPPclient();
- void putNewObs(const t_obs& pp);
- static t_irc applyCorr(const bncTime& tt, const t_corr* cc, ColumnVector& xc,
- ColumnVector& vv);
- QByteArray staID() const {return _staID;}
- const t_pppOpt* opt() const {return _opt;}
- void emitNewMessage(QByteArray msg, bool showOnScreen) {
- emit newMessage(msg, showOnScreen);
- }
- void emitNewNMEAstr(QByteArray str) {
- emit newNMEAstr(str);
- }
-
- public slots:
- void slotNewCorrections(QList corrList);
-
- signals:
- void newMessage(QByteArray msg, bool showOnScreen);
- void newPosition(bncTime time, double x, double y, double z);
- void newNMEAstr(QByteArray str);
-
- private:
- class slipInfo {
- public:
- slipInfo() {
- slipCntL1 = -1;
- slipCntL2 = -1;
- slipCntL5 = -1;
- }
- ~slipInfo(){}
- int slipCntL1;
- int slipCntL2;
- int slipCntL5;
- };
-
- t_irc getSatPos(const bncTime& tt, const QString& prn,
- ColumnVector& xc, ColumnVector& vv);
- void processEpochs();
- void processFrontEpoch();
- t_irc cmpToT(t_satData* satData);
-
- t_pppOpt* _opt;
- bool _optOwner;
- QByteArray _staID;
- QMap _corr;
- bncTime _corr_tt;
- QMap _bias;
- std::queue _epoData;
- bncModel* _model;
- QMap _slips;
-};
-
-#endif
Index: trunk/BNC/bncrawfile.cpp
===================================================================
--- trunk/BNC/bncrawfile.cpp (revision 4277)
+++ (revision )
@@ -1,155 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncRawFile
- *
- * Purpose: This class stores/reads BNC raw file
- *
- * Author: L. Mervart
- *
- * Created: 23-Aug-2010
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include "bncrawfile.h"
-#include "bncapp.h"
-#include "bncutils.h"
-#include "bncsettings.h"
-
-using namespace std;
-
-#define RAW_FILE_VERSION "1"
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncRawFile::bncRawFile(const QByteArray& fileName, const QByteArray& staID,
- inpOutFlag ioFlg) {
-
- _fileName = fileName; expandEnvVar(_fileName);
- _format = "unset";
- _staID = staID;
- _inpFile = 0;
- _outFile = 0;
- _version = 0;
-
- // Initialize for Input
- // --------------------
- if (ioFlg == input) {
- _inpFile = new QFile(_fileName);
- _inpFile->open(QIODevice::ReadOnly);
- QString line = _inpFile->readLine();
- QStringList lst = line.split(' ');
- _version = lst.value(0).toInt();
- }
-
- // Initialize for Output
- // ---------------------
- else {
- QDate currDate = currentDateAndTimeGPS().date();
- _currentFileName = _fileName + "_" + currDate.toString("yyMMdd");
- _outFile = new QFile(_currentFileName);
- bncSettings settings;
- if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked &&
- QFile::exists(_currentFileName) ) {
- _outFile->open(QIODevice::WriteOnly | QIODevice::Append);
- }
- else {
- _outFile->open(QIODevice::WriteOnly);
- _outFile->write(RAW_FILE_VERSION " Version of BNC raw file");
- }
- }
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncRawFile::~bncRawFile() {
- delete _inpFile;
- delete _outFile;
-}
-
-// Raw Output
-////////////////////////////////////////////////////////////////////////////
-void bncRawFile::writeRawData(const QByteArray& data, const QByteArray& staID,
- const QByteArray& format) {
- if (_outFile) {
- QDate currDate = currentDateAndTimeGPS().date();
- QString hlp = _fileName + "_" + currDate.toString("yyMMdd");
- if (hlp != _currentFileName) {
- _currentFileName = hlp;
- delete _outFile;
- _outFile = new QFile(_currentFileName);
- _outFile->open(QIODevice::WriteOnly);
- _outFile->write(RAW_FILE_VERSION " Version of BNC raw file");
- }
-
- QString chunkHeader = QString("\n%1 %2 %3 %4\n")
- .arg(currentDateAndTimeGPS().toString(Qt::ISODate))
- .arg(QString(staID))
- .arg(QString(format))
- .arg(data.size());
- _outFile->write(chunkHeader.toAscii());
- _outFile->write(data);
- _outFile->flush();
- }
-}
-
-
-// Raw Input
-////////////////////////////////////////////////////////////////////////////
-QByteArray bncRawFile::readChunk(){
-
- QByteArray data;
-
- if (_inpFile) {
- QString line = _inpFile->readLine();
- if (line.indexOf("Version of BNC raw file") != -1) {
- line = _inpFile->readLine();
- }
- if (!line.isEmpty()) {
- QStringList lst = line.split(' ');
-
- bncApp* app = (bncApp*) qApp;
- delete app->_currentDateAndTimeGPS;
- app->_currentDateAndTimeGPS =
- new QDateTime(QDateTime::fromString(lst.value(0), Qt::ISODate));
-
- _staID = lst.value(1).toAscii();
- _format = lst.value(2).toAscii();
- int nBytes = lst.value(3).toInt();
-
- data = _inpFile->read(nBytes);
-
- _inpFile->read(1); // read '\n' character
- }
- }
-
- return data;
-}
-
Index: trunk/BNC/bncrawfile.h
===================================================================
--- trunk/BNC/bncrawfile.h (revision 4277)
+++ (revision )
@@ -1,56 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCRAWFILE_H
-#define BNCRAWFILE_H
-
-#include
-#include
-
-#include "bnccaster.h"
-
-class bncRawFile {
- public:
-
- enum inpOutFlag {input, output};
-
- bncRawFile(const QByteArray& fileName, const QByteArray& staID,
- inpOutFlag ioflg);
-
- ~bncRawFile();
- QByteArray format() const {return _format;}
- QByteArray staID() const {return _staID;}
- QByteArray readChunk();
- void writeRawData(const QByteArray& data, const QByteArray& staID,
- const QByteArray& format);
- private:
- QString _fileName;
- QString _currentFileName;
- QByteArray _format;
- QByteArray _staID;
- QFile* _inpFile;
- QFile* _outFile;
- int _version;
-};
-#endif
Index: trunk/BNC/bncrinex.cpp
===================================================================
--- trunk/BNC/bncrinex.cpp (revision 4277)
+++ (revision )
@@ -1,922 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncRinex
- *
- * Purpose: writes RINEX files
- *
- * Author: L. Mervart
- *
- * Created: 27-Aug-2006
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-#include "bncrinex.h"
-#include "bncapp.h"
-#include "bncutils.h"
-#include "bncconst.h"
-#include "bnctabledlg.h"
-#include "bncgetthread.h"
-#include "bncnetqueryv1.h"
-#include "bncnetqueryv2.h"
-#include "bncsettings.h"
-#include "bncversion.h"
-#include "rtcm3torinex.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncRinex::bncRinex(const QByteArray& statID, const QUrl& mountPoint,
- const QByteArray& latitude, const QByteArray& longitude,
- const QByteArray& nmea, const QByteArray& ntripVersion) {
-
- _statID = statID;
- _mountPoint = mountPoint;
- _latitude = latitude;
- _longitude = longitude;
- _nmea = nmea;
- _ntripVersion = ntripVersion;
- _headerWritten = false;
- _reconnectFlag = false;
- _reloadTable = false;
- _reloadDone = false;
-
- bncSettings settings;
- _rnxScriptName = settings.value("rnxScript").toString();
- expandEnvVar(_rnxScriptName);
-
- _pgmName = QString(BNCPGMNAME).leftJustified(20, ' ', true);
-#ifdef WIN32
- _userName = QString("${USERNAME}");
-#else
- _userName = QString("${USER}");
-#endif
- expandEnvVar(_userName);
- _userName = _userName.leftJustified(20, ' ', true);
-
- if ( Qt::CheckState(settings.value("rnxV3").toInt()) == Qt::Checked) {
- _rinexVers = 3;
- }
- else {
- _rinexVers = 2;
- }
-
- _approxPos[0] = _approxPos[1] = _approxPos[2] = 0.0;
-
- _samplingRate = settings.value("rnxSampl").toInt();
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncRinex::~bncRinex() {
- bncSettings settings;
- if ((_rinexVers == 3) && ( Qt::CheckState(settings.value("rnxAppend").toInt()) != Qt::Checked) ) {
- _out << "> 4 1" << endl;
- _out << "END OF FILE" << endl;
- }
- _out.close();
-}
-
-// Download Skeleton Header File
-////////////////////////////////////////////////////////////////////////////
-t_irc bncRinex::downloadSkeleton() {
-
- t_irc irc = failure;
-
- QStringList table;
- bncTableDlg::getFullTable(_ntripVersion, _mountPoint.host(),
- _mountPoint.port(), table, _reloadTable);
- QString net;
- QStringListIterator it(table);
- while (it.hasNext()) {
- QString line = it.next();
- if (line.indexOf("STR") == 0) {
- QStringList tags = line.split(";");
- if (tags.size() > 7) {
- if (tags.at(1) == _mountPoint.path().mid(1).toAscii()) {
- net = tags.at(7);
- break;
- }
- }
- }
- }
- QString sklDir;
- if (!net.isEmpty()) {
- it.toFront();
- while (it.hasNext()) {
- QString line = it.next();
- if (line.indexOf("NET") == 0) {
- QStringList tags = line.split(";");
- if (tags.size() > 6) {
- if (tags.at(1) == net) {
- sklDir = tags.at(6).trimmed();
- break;
- }
- }
- }
- }
- }
- if (!sklDir.isEmpty() && sklDir != "none") {
- QUrl url(sklDir + "/" + _mountPoint.path().mid(1,4).toLower() + ".skl");
- if (url.port() == -1) {
- url.setPort(80);
- }
-
- bncNetQuery* query;
- if (_ntripVersion == "2s") {
- query = new bncNetQueryV2(true);
- }
- else if (_ntripVersion == "2") {
- query = new bncNetQueryV2(false);
- }
- else {
- query = new bncNetQueryV1;
- }
-
- QByteArray outData;
- query->waitForRequestResult(url, outData);
- if (query->status() == bncNetQuery::finished) {
- _headerLines.clear();
- bool firstLineRead = false;
- QTextStream in(outData);
- QString line = in.readLine();
- while ( !line.isNull() ) {
- if (line.indexOf("MARKER NAME") != -1) {
- irc = success;
- }
- if (line.indexOf("RINEX VERSION") != -1) {
- if (_rinexVers == 3) {
- _headerLines.append(" 3.00 OBSERVATION DATA"
- " M (MIXED)"
- " RINEX VERSION / TYPE");
- }
- else {
- _headerLines.append(" 2.11 OBSERVATION DATA"
- " M (MIXED)"
- " RINEX VERSION / TYPE");
- }
- _headerLines.append("PGM / RUN BY / DATE");
- firstLineRead = true;
- }
- else if (firstLineRead) {
- if (line.indexOf("END OF HEADER") != -1) {
- _headerLines.append("# / TYPES OF OBSERV");
- if (_rinexVers == 2) {
- _headerLines.append(
- QString(" 1 1").leftJustified(60, ' ', true) +
- "WAVELENGTH FACT L1/2");
- }
- _headerLines.append("TIME OF FIRST OBS");
- _headerLines.append( line );
- break;
- }
- else {
- _headerLines.append( line );
- }
- }
- line = in.readLine();
- }
- }
- else {
- delete query;
- return failure;
- }
- delete query;
- }
-
- return irc;
-}
-
-// Read Skeleton Header File
-////////////////////////////////////////////////////////////////////////////
-void bncRinex::readSkeleton() {
-
- // Read the local file
- // -------------------
- QFile skl(_sklName);
- if ( skl.exists() && skl.open(QIODevice::ReadOnly) ) {
- _headerLines.clear();
- QTextStream in(&skl);
- while ( !in.atEnd() ) {
- _headerLines.append( in.readLine() );
- if (_headerLines.last().indexOf("END OF HEADER") != -1) {
- break;
- }
- }
- }
-
- // Read downloaded file
- // --------------------
- else if ( _ntripVersion != "N" && _ntripVersion != "UN" &&
- _ntripVersion != "S" ) {
- QDate currDate = currentDateAndTimeGPS().date();
- if ( !_skeletonDate.isValid() || _skeletonDate != currDate ) {
- if ( downloadSkeleton() == success) {
- _skeletonDate = currDate;
- _reloadDone = false;
- }
- else {
- if(!_reloadDone) {
- _reloadTable = true;
- if ( downloadSkeleton() == success) {
- _skeletonDate = currDate;
- }
- _reloadTable = false;
- _reloadDone = true;
- }
- }
- }
- }
-}
-
-// Next File Epoch (static)
-////////////////////////////////////////////////////////////////////////////
-QString bncRinex::nextEpochStr(const QDateTime& datTim,
- const QString& intStr, QDateTime* nextEpoch) {
-
- QString epoStr;
-
- QTime nextTime;
- QDate nextDate;
-
- int indHlp = intStr.indexOf("min");
-
- if ( indHlp != -1) {
- int step = intStr.left(indHlp-1).toInt();
- char ch = 'A' + datTim.time().hour();
- epoStr = ch;
- if (datTim.time().minute() >= 60-step) {
- epoStr += QString("%1").arg(60-step, 2, 10, QChar('0'));
- if (datTim.time().hour() < 23) {
- nextTime.setHMS(datTim.time().hour() + 1 , 0, 0);
- nextDate = datTim.date();
- }
- else {
- nextTime.setHMS(0, 0, 0);
- nextDate = datTim.date().addDays(1);
- }
- }
- else {
- for (int limit = step; limit <= 60-step; limit += step) {
- if (datTim.time().minute() < limit) {
- epoStr += QString("%1").arg(limit-step, 2, 10, QChar('0'));
- nextTime.setHMS(datTim.time().hour(), limit, 0);
- nextDate = datTim.date();
- break;
- }
- }
- }
- }
- else if (intStr == "1 hour") {
- char ch = 'A' + datTim.time().hour();
- epoStr = ch;
- if (datTim.time().hour() < 23) {
- nextTime.setHMS(datTim.time().hour() + 1 , 0, 0);
- nextDate = datTim.date();
- }
- else {
- nextTime.setHMS(0, 0, 0);
- nextDate = datTim.date().addDays(1);
- }
- }
- else {
- epoStr = "0";
- nextTime.setHMS(0, 0, 0);
- nextDate = datTim.date().addDays(1);
- }
-
- if (nextEpoch) {
- *nextEpoch = QDateTime(nextDate, nextTime);
- }
-
- return epoStr;
-}
-
-// File Name according to RINEX Standards
-////////////////////////////////////////////////////////////////////////////
-void bncRinex::resolveFileName(const QDateTime& datTim) {
-
- bncSettings settings;
- QString path = settings.value("rnxPath").toString();
- expandEnvVar(path);
-
- if ( path.length() > 0 && path[path.length()-1] != QDir::separator() ) {
- path += QDir::separator();
- }
-
- QString hlpStr = nextEpochStr(datTim, settings.value("rnxIntr").toString(),
- &_nextCloseEpoch);
-
- QString ID4 = _statID.left(4);
-
- // Check name conflict
- // -------------------
- QString distStr;
- int num = 0;
- QListIterator it(settings.value("mountPoints").toStringList());
- while (it.hasNext()) {
- QString mp = it.next();
- if (mp.indexOf(ID4) != -1) {
- ++num;
- }
- }
- if (num > 1) {
- distStr = "_" + _statID.mid(4);
- }
-
- QString sklExt = settings.value("rnxSkel").toString();
- if (!sklExt.isEmpty()) {
- _sklName = path + ID4 + distStr + "." + sklExt;
- }
-
- path += ID4 +
- QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0')) +
- hlpStr + distStr + datTim.toString(".yyO");
-
- _fName = path.toAscii();
-}
-
-// Write RINEX Header
-////////////////////////////////////////////////////////////////////////////
-void bncRinex::writeHeader(const QByteArray& format, const QDateTime& datTim,
- const QDateTime& datTimNom) {
-
- bncSettings settings;
-
- // Open the Output File
- // --------------------
- resolveFileName(datTimNom);
-
- // Append to existing file and return
- // ----------------------------------
- if ( QFile::exists(_fName) ) {
- if (_reconnectFlag ||
- Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
- _out.open(_fName.data(), ios::app);
- _out.setf(ios::showpoint | ios::fixed);
- _headerWritten = true;
- _reconnectFlag = false;
- return;
- }
- }
-
- _out.open(_fName.data());
- _out.setf(ios::showpoint | ios::fixed);
-
- // Copy Skeleton Header
- // --------------------
- readSkeleton();
- if (_headerLines.size() > 0) {
- bool typesOfObservationsWritten = false;
- QStringListIterator it(_headerLines);
- while (it.hasNext()) {
- QString line = it.next();
- if (line.indexOf("PGM / RUN BY / DATE") != -1) {
- if (_rinexVers == 3) {
- QString hlp = currentDateAndTimeGPS().toString("yyyyMMdd hhmmss UTC").leftJustified(20, ' ', true);
- _out << _pgmName.toAscii().data() << _userName.toAscii().data()
- << hlp.toAscii().data() << "PGM / RUN BY / DATE" << endl;
- }
- else {
- QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
- _out << _pgmName.toAscii().data() << _userName.toAscii().data()
- << hlp.toAscii().data() << "PGM / RUN BY / DATE" << endl;
- }
- }
- else if ( !typesOfObservationsWritten &&
- (line.indexOf("# / TYPES OF OBSERV") != -1 ||
- line.indexOf("SYS / # / OBS TYPES") != -1) ) {
- typesOfObservationsWritten = true;
- if (_rinexVers == 3) {
- _out << "G 20 C1C L1C D1C S1C C1W L1W D1W S1W C2P L2P D2P S2P C2X SYS / # / OBS TYPES" << endl;
- _out << " L2X D2X S2X C5 L5 D5 S5 SYS / # / OBS TYPES" << endl;
- _out << "R 16 C1C L1C D1C S1C C1P L1P D1P S1P C2P L2P D2P S2P C2C SYS / # / OBS TYPES" << endl;
- _out << " L2C D2C S2C SYS / # / OBS TYPES" << endl;
- _out << "S 8 C1C L1C D1C S1C C1W L1W D1W S1W SYS / # / OBS TYPES" << endl;
- _out << "E 8 C1 L1 D1 S1 C5 L5 D5 S5 SYS / # / OBS TYPES" << endl;
- }
- else {
- _out << " 8 C1 P1 L1 S1 C2 P2 L2 S2"
- " # / TYPES OF OBSERV" << endl;
- }
- }
- else if (line.indexOf("TIME OF FIRST OBS") != -1) {
- _out << datTim.toString(" yyyy MM dd"
- " hh mm ss.zzz0000").toAscii().data();
- _out << " GPS TIME OF FIRST OBS" << endl;
- QString hlp = (format.left(6) + QString(" %1").arg(_mountPoint.host() +
- _mountPoint.path())).leftJustified(60, ' ', true);
- _out << hlp.toAscii().data() << "COMMENT" << endl;
- }
- else if (line.indexOf("MARKER NAME") != -1) {
- if (_rinexVers == 3) {
- _out << line.toAscii().data() << endl;
- _out << setw(71) << "GEODETIC MARKER TYPE" << endl;
- }
- else {
- _out << line.toAscii().data() << endl;
- }
- }
- else {
- _out << line.toAscii().data() << endl;
- }
- }
- }
-
- // Write Dummy Header
- // ------------------
- else {
- double antennaNEU[3]; antennaNEU[0] = antennaNEU[1] = antennaNEU[2] = 0.0;
-
- if (_rinexVers == 3) {
- _out << " 3.00 OBSERVATION DATA M (MIXED) RINEX VERSION / TYPE" << endl;
- QString hlp = currentDateAndTimeGPS().toString("yyyyMMdd hhmmss UTC").leftJustified(20, ' ', true);
- _out << _pgmName.toAscii().data() << _userName.toAscii().data()
- << hlp.toAscii().data() << "PGM / RUN BY / DATE" << endl;
- }
- else {
- _out << " 2.11 OBSERVATION DATA M (MIXED) RINEX VERSION / TYPE" << endl;
- QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
- _out << _pgmName.toAscii().data() << _userName.toAscii().data()
- << hlp.toAscii().data() << "PGM / RUN BY / DATE" << endl;
- }
- _out.setf(ios::left);
- _out << setw(60) << _statID.data() << "MARKER NAME" << endl;
- if (_rinexVers == 3) {
- _out << setw(60) << "unknown" << "MARKER TYPE " << endl;
- }
- _out << setw(60) << "unknown unknown" << "OBSERVER / AGENCY" << endl;
- _out << setw(20) << "unknown"
- << setw(20) << "unknown"
- << setw(20) << "unknown" << "REC # / TYPE / VERS" << endl;
- _out << setw(20) << "unknown"
- << setw(20) << "unknown"
- << setw(20) << " " << "ANT # / TYPE" << endl;
- _out.unsetf(ios::left);
- _out << setw(14) << setprecision(4) << _approxPos[0]
- << setw(14) << setprecision(4) << _approxPos[1]
- << setw(14) << setprecision(4) << _approxPos[2]
- << " " << "APPROX POSITION XYZ" << endl;
- _out << setw(14) << setprecision(4) << antennaNEU[0]
- << setw(14) << setprecision(4) << antennaNEU[1]
- << setw(14) << setprecision(4) << antennaNEU[2]
- << " " << "ANTENNA: DELTA H/E/N" << endl;
- if (_rinexVers == 3) {
- _out << "G 20 C1C L1C D1C S1C C1W L1W D1W S1W C2P L2P D2P S2P C2X SYS / # / OBS TYPES" << endl;
- _out << " L2X D2X S2X C5 L5 D5 S5 SYS / # / OBS TYPES" << endl;
- _out << "R 16 C1C L1C D1C S1C C1P L1P D1P S1P C2P L2P D2P S2P C2C SYS / # / OBS TYPES" << endl;
- _out << " L2C D2C S2C SYS / # / OBS TYPES" << endl;
- _out << "S 8 C1C L1C D1C S1C C1W L1W D1W S1W SYS / # / OBS TYPES" << endl;
- _out << "E 8 C1 L1 D1 S1 C5 L5 D5 S5 SYS / # / OBS TYPES" << endl;
- }
- else {
- _out << " 1 1 WAVELENGTH FACT L1/2" << endl;
- _out << " 8 C1 P1 L1 S1 C2 P2 L2 S2 # / TYPES OF OBSERV" << endl;
- }
- _out << datTim.toString(" yyyy MM dd"
- " hh mm ss.zzz0000").toAscii().data();
- _out << " GPS TIME OF FIRST OBS" << endl;
- QString hlp = (format.left(6) + QString(" %1").arg(_mountPoint.host() +
- _mountPoint.path())).leftJustified(60, ' ', true);
- _out << hlp.toAscii().data() << "COMMENT" << endl;
-
- if (_nmea == "yes") {
- hlp = ("NMEA LAT=" + _latitude + " " + "LONG=" + _longitude).leftJustified(60, ' ',true);
- _out << hlp.toAscii().data() << "COMMENT" << endl; }
-
- _out << " END OF HEADER" << endl;
- }
-
- _headerWritten = true;
-}
-
-// Stores Observation into Internal Array
-////////////////////////////////////////////////////////////////////////////
-void bncRinex::deepCopy(t_obs obs) {
- _obs.push_back(obs);
-}
-
-// Write One Epoch into the RINEX File
-////////////////////////////////////////////////////////////////////////////
-void bncRinex::dumpEpoch(const QByteArray& format, long maxTime) {
-
- // Select observations older than maxTime
- // --------------------------------------
- QList dumpList;
- QMutableListIterator mIt(_obs);
- while (mIt.hasNext()) {
- t_obs obs = mIt.next();
- if (obs.GPSWeek * 7*24*3600 + obs.GPSWeeks < maxTime - 0.05) {
- dumpList.push_back(obs);
- mIt.remove();
- }
- }
-
- // Easy Return
- // -----------
- if (dumpList.isEmpty()) {
- return;
- }
-
- // Time of Epoch
- // -------------
- const t_obs& fObs = dumpList.first();
- QDateTime datTim = dateAndTimeFromGPSweek(fObs.GPSWeek, fObs.GPSWeeks);
- QDateTime datTimNom = dateAndTimeFromGPSweek(fObs.GPSWeek,
- floor(fObs.GPSWeeks+0.5));
-
- // Close the file
- // --------------
- if (_nextCloseEpoch.isValid() && datTimNom >= _nextCloseEpoch) {
- closeFile();
- _headerWritten = false;
- }
-
- // Write RINEX Header
- // ------------------
- if (!_headerWritten) {
- writeHeader(format, datTim, datTimNom);
- }
-
- double sec = double(datTim.time().second()) + fmod(fObs.GPSWeeks,1.0);
-
- // Epoch header line: RINEX Version 3
- // ----------------------------------
- if (_rinexVers == 3) {
- _out << datTim.toString("> yyyy MM dd hh mm ").toAscii().data()
- << setw(10) << setprecision(7) << sec
- << " " << 0 << setw(3) << dumpList.size() << endl;
- }
- // Epoch header line: RINEX Version 2
- // ----------------------------------
- else {
- _out << datTim.toString(" yy MM dd hh mm ").toAscii().data()
- << setw(10) << setprecision(7) << sec
- << " " << 0 << setw(3) << dumpList.size();
-
- QListIterator it(dumpList); int iSat = 0;
- while (it.hasNext()) {
- iSat++;
- const t_obs& obs = it.next();
- _out << obs.satSys << setw(2) << obs.satNum;
- if (iSat == 12 && it.hasNext()) {
- _out << endl << " ";
- iSat = 0;
- }
- }
- _out << endl;
- }
-
- QListIterator it(dumpList);
- while (it.hasNext()) {
- const t_obs& obs = it.next();
-
- // Cycle slips detection
- // ---------------------
- QString prn = QString("%1%2").arg(obs.satSys)
- .arg(obs.satNum, 2, 10, QChar('0'));
-
- char lli1 = ' ';
- char lli2 = ' ';
- char lli5 = ' ';
- if ( obs.slip_cnt_L1 >= 0 ) {
- if ( _slip_cnt_L1.find(prn) != _slip_cnt_L1.end() &&
- _slip_cnt_L1.find(prn).value() != obs.slip_cnt_L1 ) {
- lli1 = '1';
- }
- }
-
- if ( obs.slip_cnt_L2 >= 0 ) {
- if ( _slip_cnt_L2.find(prn) != _slip_cnt_L2.end() &&
- _slip_cnt_L2.find(prn).value() != obs.slip_cnt_L2 ) {
- lli2 = '1';
- }
- }
-
- if ( obs.slip_cnt_L5 >= 0 ) {
- if ( _slip_cnt_L5.find(prn) != _slip_cnt_L5.end() &&
- _slip_cnt_L5.find(prn).value() != obs.slip_cnt_L5 ) {
- lli5 = '1';
- }
- }
-
- _slip_cnt_L1[prn] = obs.slip_cnt_L1;
- _slip_cnt_L2[prn] = obs.slip_cnt_L2;
- _slip_cnt_L5[prn] = obs.slip_cnt_L5;
-
- // RINEX Version 3
- // ---------------
- if (_rinexVers == 3) {
- _out << rinexSatLine(obs, lli1, lli2, lli5);
- _out << endl;
- }
-
- // RINEX Version 2
- // ---------------
- else {
- _out << setw(14) << setprecision(3) << obs.C1 << ' ' << ' '
- << setw(14) << setprecision(3) << obs.P1 << ' ' << ' '
- << setw(14) << setprecision(3) << obs.l1() << lli1 << ' '
- << setw(14) << setprecision(3) << obs.s1() << ' ' << ' '
- << setw(14) << setprecision(3) << obs.C2 << ' ' << ' ' << endl
- << setw(14) << setprecision(3) << obs.P2 << ' ' << ' '
- << setw(14) << setprecision(3) << obs.l2() << lli2 << ' '
- << setw(14) << setprecision(3) << obs.s2() << endl;
- }
- }
-
- _out.flush();
-}
-
-// Close the Old RINEX File
-////////////////////////////////////////////////////////////////////////////
-void bncRinex::closeFile() {
- if (_rinexVers == 3) {
- _out << "> 4 1" << endl;
- _out << "END OF FILE" << endl;
- }
- _out.close();
- if (!_rnxScriptName.isEmpty()) {
- qApp->thread()->wait(100);
-#ifdef WIN32
- QProcess::startDetached(_rnxScriptName, QStringList() << _fName) ;
-#else
- QProcess::startDetached("nohup", QStringList() << _rnxScriptName << _fName) ;
-#endif
-
- }
-}
-
-// One Line in RINEX v3 (static)
-////////////////////////////////////////////////////////////////////////////
-string bncRinex::rinexSatLine(const t_obs& obs, char lli1, char lli2,
- char lli5) {
- ostringstream str;
- str.setf(ios::showpoint | ios::fixed);
-
- if (obs.satSys == 'G') { // GPS
- str << obs.satSys
- << setw(2) << setfill('0') << obs.satNum << setfill(' ')
- << setw(14) << setprecision(3) << obs.C1 << ' ' << ' '
- << setw(14) << setprecision(3) << obs.L1C
- << lli1 << ' ';
- str << setw(14) << setprecision(3) << obs.D1C << ' ' << ' '
- << setw(14) << setprecision(3) << obs.S1C << ' ' << ' '
- << setw(14) << setprecision(3) << obs.P1 << ' ' << ' '
- << setw(14) << setprecision(3) << obs.L1P
- << lli1 << ' ';
- str << setw(14) << setprecision(3) << obs.D1P << ' ' << ' '
- << setw(14) << setprecision(3) << obs.S1P << ' ' << ' '
- << setw(14) << setprecision(3) << obs.P2 << ' ' << ' '
- << setw(14) << setprecision(3) << obs.L2P
- << lli2 << ' ';
- str << setw(14) << setprecision(3) << obs.D2P << ' ' << ' '
- << setw(14) << setprecision(3) << obs.S2P << ' ' << ' '
- << setw(14) << setprecision(3) << obs.C2 << ' ' << ' '
- << setw(14) << setprecision(3) << obs.L2C
- << lli2 << ' ';
- str << setw(14) << setprecision(3) << obs.D2C << ' ' << ' '
- << setw(14) << setprecision(3) << obs.S2C << ' ' << ' '
- << setw(14) << setprecision(3) << obs.C5 << ' ' << ' '
- << setw(14) << setprecision(3) << obs.L5
- << lli5 << ' ';
- str << setw(14) << setprecision(3) << obs.D5 << ' ' << ' '
- << setw(14) << setprecision(3) << obs.S5;
- }
- else if (obs.satSys == 'R') { // Glonass
- str << obs.satSys
- << setw(2) << setfill('0') << obs.satNum << setfill(' ');
- str << setw(14) << setprecision(3) << obs.C1 << ' ' << ' '
- << setw(14) << setprecision(3) << obs.L1C
- << lli1 << ' ';
- str << setw(14) << setprecision(3) << obs.D1C << ' ' << ' '
- << setw(14) << setprecision(3) << obs.S1C << ' ' << ' '
- << setw(14) << setprecision(3) << obs.P1 << ' ' << ' '
- << setw(14) << setprecision(3) << obs.L1P
- << lli1 << ' ';
- str << setw(14) << setprecision(3) << obs.D1P << ' ' << ' '
- << setw(14) << setprecision(3) << obs.S1P << ' ' << ' '
- << setw(14) << setprecision(3) << obs.P2 << ' ' << ' '
- << setw(14) << setprecision(3) << obs.L2P
- << lli2 << ' ';
- str << setw(14) << setprecision(3) << obs.D2P << ' ' << ' '
- << setw(14) << setprecision(3) << obs.S2P << ' ' << ' '
- << setw(14) << setprecision(3) << obs.C2 << ' ' << ' '
- << setw(14) << setprecision(3) << obs.L2C
- << lli2 << ' ';
- str << setw(14) << setprecision(3) << obs.D2C << ' ' << ' '
- << setw(14) << setprecision(3) << obs.S2C;
- }
- else if (obs.satSys == 'S') { // SBAS
- str << obs.satSys
- << setw(2) << setfill('0') << obs.satNum << setfill(' ')
- << setw(14) << setprecision(3) << obs.C1 << ' ' << ' '
- << setw(14) << setprecision(3) << obs.L1C
- << lli1 << ' ';
- str << setw(14) << setprecision(3) << obs.D1C << ' ' << ' '
- << setw(14) << setprecision(3) << obs.S1C << ' ' << ' '
- << setw(14) << setprecision(3) << obs.P1 << ' ' << ' '
- << setw(14) << setprecision(3) << obs.L1P
- << lli1 << ' ';
- str << setw(14) << setprecision(3) << obs.D1P << ' ' << ' '
- << setw(14) << setprecision(3) << obs.S1P;
- }
- else if (obs.satSys == 'E') { // Galileo
- str << obs.satSys
- << setw(2) << setfill('0') << obs.satNum << setfill(' ')
- << setw(14) << setprecision(3) << obs.C1 << ' ' << ' '
- << setw(14) << setprecision(3) << obs.L1C
- << lli1 << ' ';
- str << setw(14) << setprecision(3) << obs.D1C << ' ' << ' '
- << setw(14) << setprecision(3) << obs.S1C << ' ' << ' '
- << setw(14) << setprecision(3) << obs.C5 << ' ' << ' '
- << setw(14) << setprecision(3) << obs.L5
- << lli5 << ' ';
- str << setw(14) << setprecision(3) << obs.D5 << ' ' << ' '
- << setw(14) << setprecision(3) << obs.S5;
- }
- return str.str();
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-string bncRinex::obsToStr(double val, int width, int precision) {
- if (val != 0.0) {
- ostringstream str;
- str.setf(ios::showpoint | ios::fixed);
- str << setw(width) << setprecision(precision) << val;
- return str.str();
- }
- else {
- return "0.0";
- }
-}
-
-// One Line in ASCII (Internal) Format
-////////////////////////////////////////////////////////////////////////////
-string bncRinex::asciiSatLine(const t_obs& obs) {
-
- ostringstream str;
- str.setf(ios::showpoint | ios::fixed);
-
- str << obs.satSys << setw(2) << setfill('0') << obs.satNum << setfill(' ');
-
- if (obs.satSys == 'R') { // Glonass
- str << ' ' << setw(2) << obs.slotNum;
- }
- else {
- str << " ";
- }
-
- if (obs.satSys == 'G') { // GPS
- if (obs.has1C()) {
- str << " 1C "
- << obsToStr(obs.C1) << ' '
- << obsToStr(obs.L1C) << ' '
- << obsToStr(obs.D1C) << ' '
- << obsToStr(obs.S1C, 8, 3) << ' '
- << setw(2) << obs.slip_cnt_L1;
- }
- if (obs.has1P()) {
- str << " 1W "
- << obsToStr(obs.P1) << ' '
- << obsToStr(obs.L1P) << ' '
- << obsToStr(obs.D1P) << ' '
- << obsToStr(obs.S1P, 8, 3) << ' '
- << setw(2) << obs.slip_cnt_L1;
- }
- if (obs.has2P()) {
- str << " 2P "
- << obsToStr(obs.P2) << ' '
- << obsToStr(obs.L2P) << ' '
- << obsToStr(obs.D2P) << ' '
- << obsToStr(obs.S2P, 8, 3) << ' '
- << setw(2) << obs.slip_cnt_L2;
- }
- if (obs.has2C()) {
- str << " 2X "
- << obsToStr(obs.C2) << ' '
- << obsToStr(obs.L2C) << ' '
- << obsToStr(obs.D2C) << ' '
- << obsToStr(obs.S2C, 8, 3) << ' '
- << setw(2) << obs.slip_cnt_L2;
- }
- if (obs.has5C()) {
- str << " 5C "
- << obsToStr(obs.C5) << ' '
- << obsToStr(obs.L5) << ' '
- << obsToStr(obs.D5) << ' '
- << obsToStr(obs.S5, 8, 3) << ' '
- << setw(2) << obs.slip_cnt_L5;
- }
- }
- else if (obs.satSys == 'R') { // Glonass
- if (obs.has1C()) {
- str << " 1C "
- << obsToStr(obs.C1) << ' '
- << obsToStr(obs.L1C) << ' '
- << obsToStr(obs.D1C) << ' '
- << obsToStr(obs.S1C, 8, 3) << ' '
- << setw(2) << obs.slip_cnt_L1;
- }
- if (obs.has1P()) {
- str << " 1P "
- << obsToStr(obs.P1) << ' '
- << obsToStr(obs.L1P) << ' '
- << obsToStr(obs.D1P) << ' '
- << obsToStr(obs.S1P, 8, 3) << ' '
- << setw(2) << obs.slip_cnt_L1;
- }
- if (obs.has2P()) {
- str << " 2P "
- << obsToStr(obs.P2) << ' '
- << obsToStr(obs.L2P) << ' '
- << obsToStr(obs.D2P) << ' '
- << obsToStr(obs.S2P, 8, 3) << ' '
- << setw(2) << obs.slip_cnt_L2;
- }
- if (obs.has2C()) {
- str << " 2C "
- << obsToStr(obs.C2) << ' '
- << obsToStr(obs.L2C) << ' '
- << obsToStr(obs.D2C) << ' '
- << obsToStr(obs.S2C, 8, 3) << ' '
- << setw(2) << obs.slip_cnt_L2;
- }
- }
- else if (obs.satSys == 'S') { // SBAS
- if (obs.has1C()) {
- str << " 1C "
- << obsToStr(obs.C1) << ' '
- << obsToStr(obs.L1C) << ' '
- << obsToStr(obs.D1C) << ' '
- << obsToStr(obs.S1C, 8, 3) << ' '
- << setw(2) << obs.slip_cnt_L1;
- }
- if (obs.has1P()) {
- str << " 1W "
- << obsToStr(obs.P1) << ' '
- << obsToStr(obs.L1P) << ' '
- << obsToStr(obs.D1P) << ' '
- << obsToStr(obs.S1P, 8, 3) << ' '
- << setw(2) << obs.slip_cnt_L1;
- }
- }
- else if (obs.satSys == 'E') { // Galileo
- if (obs.has1C()) {
- str << " 1C "
- << obsToStr(obs.C1) << ' '
- << obsToStr(obs.L1C) << ' '
- << obsToStr(obs.D1C) << ' '
- << obsToStr(obs.S1C, 8, 3) << ' '
- << setw(2) << obs.slip_cnt_L1;
- }
- if (obs.has5C()) {
- str << " 5C "
- << obsToStr(obs.C5) << ' '
- << obsToStr(obs.L5) << ' '
- << obsToStr(obs.D5) << ' '
- << obsToStr(obs.S5, 8, 3) << ' '
- << setw(2) << obs.slip_cnt_L5;
- }
- }
- return str.str();
-}
Index: trunk/BNC/bncrinex.h
===================================================================
--- trunk/BNC/bncrinex.h (revision 4277)
+++ (revision )
@@ -1,99 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCRINEX_H
-#define BNCRINEX_H
-
-#include
-#include
-
-#include "bncconst.h"
-
-class t_obs;
-
-class bncRinex {
- public:
- bncRinex(const QByteArray& statID, const QUrl& mountPoint,
- const QByteArray& latitude, const QByteArray& longitude,
- const QByteArray& nmea, const QByteArray& ntripVersion);
- ~bncRinex();
- void deepCopy(t_obs obs);
- void dumpEpoch(const QByteArray& format, long maxTime);
- void setReconnectFlag(bool flag){_reconnectFlag = flag;}
- static QString nextEpochStr(const QDateTime& datTim,
- const QString& intStr,
- QDateTime* nextEpoch = 0);
-
- int samplingRate() const {return _samplingRate;}
-
- void setApproxPos(double stax, double stay, double staz) {
- _approxPos[0] = stax;
- _approxPos[1] = stay;
- _approxPos[2] = staz;
- }
-
- static std::string rinexSatLine(const t_obs& obs, char lli1, char lli2,
- char lli5);
-
- static std::string asciiSatLine(const t_obs& obs);
- static std::string obsToStr(double val, int width = 14, int precision = 3);
-
- private:
- void resolveFileName(const QDateTime& datTim);
- void readSkeleton();
- void writeHeader(const QByteArray& format, const QDateTime& datTim,
- const QDateTime& datTimNom);
- void closeFile();
- t_irc downloadSkeleton();
-
- QByteArray _statID;
- QByteArray _fName;
- QList _obs;
- std::ofstream _out;
- QStringList _headerLines;
- bool _headerWritten;
- QDateTime _nextCloseEpoch;
- QString _rnxScriptName;
- QUrl _mountPoint;
- QString _pgmName;
- QString _userName;
- QString _sklName;
- QByteArray _latitude;
- QByteArray _longitude;
- QByteArray _nmea;
- QByteArray _ntripVersion;
- bool _reconnectFlag;
- QDate _skeletonDate;
- int _rinexVers;
- bool _reloadTable;
- bool _reloadDone;
- double _approxPos[3];
- int _samplingRate;
-
- QMap _slip_cnt_L1;
- QMap _slip_cnt_L2;
- QMap _slip_cnt_L5;
-};
-
-#endif
Index: trunk/BNC/bncserialport.cpp
===================================================================
--- trunk/BNC/bncserialport.cpp (revision 4277)
+++ (revision )
@@ -1,199 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2009
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncSerialPort
- *
- * Purpose: Select serial port for stream retrieval
- *
- * Author: G. Weber
- *
- * Created: 18-Feb-2009
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-
-#include "bncserialport.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncSerialPort::bncSerialPort(QWidget* parent) : QDialog(parent) {
-
- setMinimumSize(400,150);
- QVBoxLayout* mainLayout = new QVBoxLayout(this);
- QGridLayout* editLayout = new QGridLayout;
-
- setWindowTitle(tr("Add Stream from Serial Port"));
-
- _serialMountpointLineEdit = new QLineEdit();
- _serialPortLineEdit = new QLineEdit();
- _serialFormatLineEdit = new QLineEdit();
- _serialBaudRateComboBox = new QComboBox();
- _serialFlowControlComboBox = new QComboBox();
- _serialDataBitsComboBox = new QComboBox();
- _serialParityComboBox = new QComboBox();
- _serialStopBitsComboBox = new QComboBox();
- _serialLatLineEdit = new QLineEdit();
- _serialLonLineEdit = new QLineEdit();
-
- _serialBaudRateComboBox->addItems(QString("110,300,600,"
- "1200,2400,4800,9600,19200,38400,57600,115200").split(","));
- _serialFlowControlComboBox->addItems(QString("OFF,XONXOFF,HARDWARE").split(","));
- _serialDataBitsComboBox->addItems(QString("5,6,7,8").split(","));
- _serialParityComboBox->addItems(QString("NONE,ODD,EVEN,SPACE").split(","));
- _serialStopBitsComboBox->addItems(QString("1,2").split(","));
-
- _serialBaudRateComboBox->setCurrentIndex(7);
- _serialDataBitsComboBox->setCurrentIndex(3);
-
- int ww = QFontMetrics(font()).width('w');
- _serialMountpointLineEdit->setMaximumWidth(11*ww);
- _serialPortLineEdit->setMaximumWidth(11*ww);
- _serialBaudRateComboBox->setMaximumWidth(9*ww);
- _serialFlowControlComboBox->setMaximumWidth(11*ww);
- _serialDataBitsComboBox->setMaximumWidth(5*ww);
- _serialParityComboBox->setMaximumWidth(9*ww);
- _serialStopBitsComboBox->setMaximumWidth(5*ww);
- _serialLatLineEdit->setMaximumWidth(9*ww);
- _serialLonLineEdit->setMaximumWidth(9*ww);
- _serialFormatLineEdit->setMaximumWidth(9*ww);
-
- // WhatsThis
- // ---------
- _serialMountpointLineEdit->setWhatsThis(tr("BNC allows to retrieve streams via serial port without using the NTRIP transport protocol.
Specify a mountpoint. Recommended is a 4-character station ID.
Example: FFMJ
"));
- _serialPortLineEdit->setWhatsThis(tr("Enter the serial 'Port name' selected for communication with your serial connected device. Valid port names are
Windows: COM1, COM2
Linux: /dev/ttyS0, /dev/ttyS1
FreeBSD: /dev/ttyd0, /dev/ttyd1
Digital Unix: /dev/tty01, /dev/tty02
HP-UX: /dev/tty1p0, /dev/tty2p0
SGI/IRIX: /dev/ttyf1, /dev/ttyf2
SunOS/Solaris: /dev/ttya, /dev/ttyb
Note that you must plug a serial cable in the port defined here before you start BNC.
"));
- _serialFormatLineEdit->setWhatsThis(tr("Specify the stream format.
Available options are 'RTCM_2', 'RTCM_3', 'RTNET', and 'ZERO'.
"));
- _serialBaudRateComboBox->setWhatsThis(tr("Select a 'Baud rate' for the serial input link.
Note that your selection must equal the baud rate configured to the serial connected device. Note further that using a high baud rate is recommended.
"));
- _serialFlowControlComboBox->setWhatsThis(tr("Select a 'Flow control' for the serial input link.
Note that your selection must equal the flow control configured to the serial connected device. Select 'OFF' if you don't know better.
"));
- _serialDataBitsComboBox->setWhatsThis(tr("Select the number of 'Data bits' for the serial input link.
Note that your selection must equal the number of data bits configured to the serial connected device. Note further that often 8 data bits are used.
"));
- _serialParityComboBox->setWhatsThis(tr("Select the 'Parity' for the serial input link.
Note that your selection must equal the parity selection configured to the serial connected device. Note further that parity is often set to 'NONE'.
"));
- _serialStopBitsComboBox->setWhatsThis(tr("Select the number of 'Stop bits' for the serial input link.
Note that your selection must equal the number of stop bits configured to the serial connected device. Note further that often 1 stop bit is used.
"));
- _serialLatLineEdit->setWhatsThis(tr("Enter the approximate latitude of the stream providing receiver in degrees.
Example: 45.32"));
- _serialLonLineEdit->setWhatsThis(tr("Enter the approximate latitude of the stream providing receiver in degrees.
Example: 45.32"));
-
- editLayout->addWidget(new QLabel(tr("Mountpoint")), 0, 0, Qt::AlignRight);
- editLayout->addWidget(_serialMountpointLineEdit, 0, 1);
- editLayout->addWidget(new QLabel(tr("Format")), 0, 2, Qt::AlignRight);
- editLayout->addWidget(_serialFormatLineEdit, 0, 3);
- editLayout->addWidget(new QLabel(tr("Latitude")), 1, 0, Qt::AlignRight);
- editLayout->addWidget(_serialLatLineEdit, 1, 1);
- editLayout->addWidget(new QLabel(tr("Longitude")), 1, 2, Qt::AlignRight);
- editLayout->addWidget(_serialLonLineEdit, 1, 3);
- editLayout->addWidget(new QLabel(tr("Port name")), 2, 0, Qt::AlignRight);
- editLayout->addWidget(_serialPortLineEdit, 2, 1);
- editLayout->addWidget(new QLabel(tr("Baud rate")), 2, 2, Qt::AlignRight);
- editLayout->addWidget(_serialBaudRateComboBox, 2, 3);
- editLayout->addWidget(new QLabel(tr("Data bits")), 3, 0, Qt::AlignRight);
- editLayout->addWidget(_serialDataBitsComboBox, 3, 1);
- editLayout->addWidget(new QLabel(tr("Parity")), 3, 2, Qt::AlignRight);
- editLayout->addWidget(_serialParityComboBox, 3, 3);
- editLayout->addWidget(new QLabel(tr("Stop bits")), 4, 0, Qt::AlignRight);
- editLayout->addWidget(_serialStopBitsComboBox, 4, 1);
- editLayout->addWidget(new QLabel(tr("Flow control")),4, 2, Qt::AlignRight);
- editLayout->addWidget(_serialFlowControlComboBox, 4, 3);
-
- mainLayout->addLayout(editLayout);
-
- _buttonWhatsThis = new QPushButton(tr("Help=Shift+F1"), this);
- connect(_buttonWhatsThis, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
-
- _buttonCancel = new QPushButton(tr("Cancel"), this);
- connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
-
- _buttonOK = new QPushButton(tr("OK"), this);
- connect(_buttonOK, SIGNAL(clicked()), this, SLOT(accept()));
-
- _buttonOK->setDefault(true);
-
- QHBoxLayout* buttonLayout = new QHBoxLayout;
-
- buttonLayout->addWidget(_buttonWhatsThis);
- buttonLayout->addStretch(1);
- buttonLayout->addWidget(_buttonCancel);
- buttonLayout->addWidget(_buttonOK);
-
- mainLayout->addLayout(buttonLayout);
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncSerialPort::~bncSerialPort() {
- delete _buttonCancel;
- delete _buttonOK;
- delete _buttonWhatsThis;
-}
-
-// Accept slot
-////////////////////////////////////////////////////////////////////////////
-void bncSerialPort::accept() {
-
- QStringList* mountPoints = new QStringList;
-
- QString _serialBaudRate = _serialBaudRateComboBox->currentText();
- QString _serialFlowControl = _serialFlowControlComboBox->currentText();
- QString _serialDataBits = _serialDataBitsComboBox->currentText();
- QString _serialParity = _serialParityComboBox->currentText();
- QString _serialStopBits = _serialStopBitsComboBox->currentText();
-
- if ( !_serialMountpointLineEdit->text().isEmpty() &&
- !_serialPortLineEdit->text().isEmpty() &&
- !_serialFormatLineEdit->text().isEmpty() &&
- !_serialLatLineEdit->text().isEmpty() &&
- !_serialLonLineEdit->text().isEmpty() ) {
- mountPoints->push_back("//"
- + _serialPortLineEdit->text().replace("/","-").replace(QRegExp("^[-]"), "") + "-"
- + _serialDataBits + "-"
- + _serialParity + "-"
- + _serialStopBits + "-"
- + _serialFlowControl + "-"
- + _serialBaudRate + "/"
- + _serialMountpointLineEdit->text() + " "
- + _serialFormatLineEdit->text() + " "
- + _serialLatLineEdit->text() + " "
- + _serialLonLineEdit->text() + " "
- + "no S");
- } else {
- QMessageBox::warning(this, tr("Warning"),
- tr("Incomplete settings"),
- QMessageBox::Ok);
- }
-
- emit newMountPoints(mountPoints);
-
- QDialog::accept();
-}
-
-// Whats This Help
-void bncSerialPort::slotWhatsThis() {
-QWhatsThis::enterWhatsThisMode();
-}
-
Index: trunk/BNC/bncserialport.h
===================================================================
--- trunk/BNC/bncserialport.h (revision 4277)
+++ (revision )
@@ -1,65 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2009
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCSERIALPORT_H
-#define BNCSERIALPORT_H
-
-#include
-#include
-#include
-
-class bncSerialPort : public QDialog {
- Q_OBJECT
-
- public:
- bncSerialPort(QWidget* parent);
- ~bncSerialPort();
- QString* _serialPort1;
-
- signals:
- void newMountPoints(QStringList* mountPoints);
-
- private slots:
- virtual void accept();
- void slotWhatsThis();
-
- private:
- QLineEdit* _serialMountpointLineEdit;
- QLineEdit* _serialPortLineEdit;
- QLineEdit* _serialFormatLineEdit;
- QLineEdit* _serialLatLineEdit;
- QLineEdit* _serialLonLineEdit;
- QComboBox* _serialBaudRateComboBox;
- QComboBox* _serialFlowControlComboBox;
- QComboBox* _serialDataBitsComboBox;
- QComboBox* _serialParityComboBox;
- QComboBox* _serialStopBitsComboBox;
-
- QPushButton* _buttonGet;
- QPushButton* _buttonCancel;
- QPushButton* _buttonOK;
- QPushButton* _buttonWhatsThis;
-};
-
-#endif
Index: trunk/BNC/bncsettings.cpp
===================================================================
--- trunk/BNC/bncsettings.cpp (revision 4277)
+++ (revision )
@@ -1,260 +1,0 @@
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncSettings
- *
- * Purpose: Subclasses the QSettings
- *
- * Author: L. Mervart
- *
- * Created: 25-Jan-2009
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-
-#include "bncsettings.h"
-#include "bncapp.h"
-
-QMutex bncSettings::_mutex; // static mutex
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncSettings::bncSettings() {
- QMutexLocker locker(&_mutex);
-
- _bncApp = static_cast(qApp);
-
- // First fill the options
- // ----------------------
- if (_bncApp->_settings.size() == 0) {
- reRead();
- }
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncSettings::~bncSettings() {
-}
-
-// (Re-)read the Options from File or Set the Defaults
-////////////////////////////////////////////////////////////////////////////
-void bncSettings::reRead() {
-
- _bncApp->_settings.clear();
-
- QSettings settings(_bncApp->confFileName(), QSettings::IniFormat);
-
- // Read from File
- // --------------
- if (settings.allKeys().size() > 0) {
- QStringListIterator it(settings.allKeys());
- while (it.hasNext()) {
- QString key = it.next();
- _bncApp->_settings[key] = settings.value(key);
- }
- }
-
- // Set Defaults
- // ------------
- else {
- setValue_p("startTab", "0");
- setValue_p("statusTab", "0");
- setValue_p("casterUrlList", (QStringList()
- << "http://user:pass@www.euref-ip.net:2101"
- << "http://user:pass@www.igs-ip.net:2101"
- << "http://user:pass@products.igs-ip.net:2101"
- << "http://user:pass@mgex.igs-ip.net:2101"));
- setValue_p("mountPoints", "");
- setValue_p("ntripVersion", "1");
- // Network
- setValue_p("proxyHost", "");
- setValue_p("proxyPort", "");
- setValue_p("sslCaCertPath", "");
- setValue_p("ignoreSslErrors", "0");
- // General
- setValue_p("logFile", "");
- setValue_p("rnxAppend", "0");
- setValue_p("onTheFlyInterval", "1 day");
- setValue_p("autoStart", "0");
- setValue_p("rawOutFile", "");
- // RINEX Observations
- setValue_p("rnxPath", "");
- setValue_p("rnxIntr", "1 day");
- setValue_p("rnxSampl", "0");
- setValue_p("rnxSkel", "SKL");
- setValue_p("rnxScript", "");
- setValue_p("rnxV3", "0");
- // RINEX Ephemeris
- setValue_p("ephPath", "");
- setValue_p("ephIntr", "1 day");
- setValue_p("outEphPort", "");
- setValue_p("ephV3", "0");
- // Braodcast Corrections
- setValue_p("corrPath", "");
- setValue_p("corrIntr", "1 day");
- setValue_p("corrPort", "");
- setValue_p("corrTime", "5");
- // Feed Engine
- setValue_p("outPort", "");
- setValue_p("waitTime", "5");
- setValue_p("binSampl", "0");
- setValue_p("outFile", "");
- setValue_p("outUPort", "");
- // Serial Output
- setValue_p("serialMountPoint", "");
- setValue_p("serialPortName", "");
- setValue_p("serialBaudRate", "9600");
- setValue_p("serialFlowControl", "OFF");
- setValue_p("serialDataBits", "8");
- setValue_p("serialParity", "NONE");
- setValue_p("serialStopBits", "1");
- setValue_p("serialAutoNMEA", "Auto");
- setValue_p("serialFileNMEA", "");
- setValue_p("serialHeightNMEA", "");
- // Outages
- setValue_p("obsRate", "");
- setValue_p("adviseFail", "15");
- setValue_p("adviseReco", "5");
- setValue_p("adviseScript", "");
- // Miscellaneous
- setValue_p("miscMount", "");
- setValue_p("perfIntr", "");
- setValue_p("scanRTCM", "0");
- // PPP
- setValue_p("pppSPP", "");
- setValue_p("pppMount", "");
- setValue_p("pppCorrMount", "");
- setValue_p("pppRefCrdX", "");
- setValue_p("pppRefCrdY", "");
- setValue_p("pppRefCrdZ", "");
- setValue_p("pppRefdN", "");
- setValue_p("pppRefdE", "");
- setValue_p("pppRefdU", "");
- setValue_p("nmeaFile", "");
- setValue_p("nmeaPort", "");
- setValue_p("pppPlotCoordinates", "");
- setValue_p("postObsFile", "");
- setValue_p("postNavFile", "");
- setValue_p("postCorrFile", "");
- setValue_p("postOutFile", "");
- setValue_p("pppAntenna", "");
- setValue_p("pppAntex", "");
- setValue_p("pppUsePhase", "");
- setValue_p("pppEstTropo", "");
- setValue_p("pppGLONASS", "");
- setValue_p("pppGalileo", "");
- setValue_p("pppSync", "");
- setValue_p("pppAverage", "");
- setValue_p("pppQuickStart", "");
- setValue_p("pppMaxSolGap", "");
- setValue_p("pppSigmaCode", "10.0");
- setValue_p("pppSigmaPhase", "0.02");
- setValue_p("pppSigCrd0", "100.0");
- setValue_p("pppSigCrdP", "100.0");
- setValue_p("pppSigTrp0", "0.1");
- setValue_p("pppSigTrpP", "3e-6");
- // Reqc
- setValue_p("reqcAction", "");
- setValue_p("reqcObsFile", "");
- setValue_p("reqcNavFile", "");
- setValue_p("reqcOutObsFile", "");
- setValue_p("reqcOutNavFile", "");
- setValue_p("reqcOutLogFile", "");
- setValue_p("reqcRnxVersion", "");
- setValue_p("reqcSampling", "");
- setValue_p("reqcStartDateTime", "");
- setValue_p("reqcEndDateTime", "");
- setValue_p("reqcRunBy", "");
- setValue_p("reqcComment", "");
- setValue_p("reqcOldMarkerName", "");
- setValue_p("reqcNewMarkerName", "");
- setValue_p("reqcOldAntennaName", "");
- setValue_p("reqcNewAntennaName", "");
- setValue_p("reqcOldReceiverName", "");
- setValue_p("reqcNewReceiverName", "");
- // Combination
- setValue_p("combineStreams", "");
- setValue_p("cmbMethod", "");
- setValue_p("cmbMaxres", "");
- setValue_p("cmbSampl", "10");
- // Upload (clk)
- setValue_p("uploadMountpointsOut","");
- setValue_p("uploadIntr", "1 day");
- setValue_p("uploadSamplRtcmEphCorr", "0");
- setValue_p("uploadSamplSp3", "1");
- setValue_p("uploadSamplClkRnx", "10");
- setValue_p("trafo_dx", "");
- setValue_p("trafo_dy", "");
- setValue_p("trafo_dz", "");
- setValue_p("trafo_dxr", "");
- setValue_p("trafo_dyr", "");
- setValue_p("trafo_dzr", "");
- setValue_p("trafo_ox", "");
- setValue_p("trafo_oy", "");
- setValue_p("trafo_oz", "");
- setValue_p("trafo_oxr", "");
- setValue_p("trafo_oyr", "");
- setValue_p("trafo_ozr", "");
- setValue_p("trafo_sc", "");
- setValue_p("trafo_scr", "");
- setValue_p("trafo_t0", "");
- // Upload (eph)
- setValue_p("uploadEphHost", "");
- setValue_p("uploadEphPort", "");
- setValue_p("uploadEphMountpoint", "");
- setValue_p("uploadEphPassword", "");
- setValue_p("uploadEphSample", "5");
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-QVariant bncSettings::value(const QString& key,
- const QVariant& defaultValue) const {
- QMutexLocker locker(&_mutex);
-
- if (_bncApp->_settings.contains(key)) {
- return _bncApp->_settings[key];
- }
- else {
- return defaultValue;
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncSettings::setValue(const QString &key, const QVariant& value) {
- QMutexLocker locker(&_mutex);
- setValue_p(key, value);
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncSettings::setValue_p(const QString &key, const QVariant& value) {
- _bncApp->_settings[key] = value;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncSettings::remove(const QString& key ) {
- QMutexLocker locker(&_mutex);
- _bncApp->_settings.remove(key);
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncSettings::sync() {
- QMutexLocker locker(&_mutex);
- QSettings settings(_bncApp->confFileName(), QSettings::IniFormat);
- settings.clear();
- QMapIterator it(_bncApp->_settings);
- while (it.hasNext()) {
- it.next();
- settings.setValue(it.key(), it.value());
- }
- settings.sync();
-}
Index: trunk/BNC/bncsettings.h
===================================================================
--- trunk/BNC/bncsettings.h (revision 4277)
+++ (revision )
@@ -1,24 +1,0 @@
-#ifndef BNCSETTINGS_H
-#define BNCSETTINGS_H
-
-#include
-
-class bncApp;
-
-class bncSettings {
- public:
- bncSettings();
- ~bncSettings();
- QVariant value(const QString& key,
- const QVariant& defaultValue = QVariant()) const;
- void setValue(const QString &key, const QVariant& value);
- void remove(const QString& key );
- void reRead();
- void sync();
- private:
- void setValue_p(const QString &key, const QVariant& value);
- bncApp* _bncApp;
- static QMutex _mutex;
-};
-
-#endif
Index: trunk/BNC/bncsp3.cpp
===================================================================
--- trunk/BNC/bncsp3.cpp (revision 4277)
+++ (revision )
@@ -1,123 +1,0 @@
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Server
- * -------------------------------------------------------------------------
- *
- * Class: bncSP3
- *
- * Purpose: writes SP3 files
- *
- * Author: L. Mervart
- *
- * Created: 25-Apr-2008
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-#include
-
-#include "bncsp3.h"
-#include "bncutils.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncSP3::bncSP3(const QString& sklFileName, const QString& intr, int sampl)
- : bncoutf(sklFileName, intr, sampl) {
-
- _lastGPSweek = 0;
- _lastGPSweeks = 0.0;
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncSP3::~bncSP3() {
-}
-
-// Write One Epoch
-////////////////////////////////////////////////////////////////////////////
-t_irc bncSP3::write(int GPSweek, double GPSweeks, const QString& prn,
- const ColumnVector& xx) {
-
- if (reopen(GPSweek, GPSweeks) == success) {
-
- if (_lastGPSweek != GPSweek || _lastGPSweeks != GPSweeks) {
- _lastGPSweek = GPSweek;
- _lastGPSweeks = GPSweeks;
-
- QDateTime datTim = dateAndTimeFromGPSweek(GPSweek, GPSweeks);
- double sec = fmod(GPSweeks, 60.0);
-
- _out << datTim.toString("* yyyy MM dd hh mm").toAscii().data()
- << setw(12) << setprecision(8) << sec << endl;
- }
- _out << "P" << prn.toAscii().data()
- << setw(14) << setprecision(6) << xx(1) / 1000.0
- << setw(14) << setprecision(6) << xx(2) / 1000.0
- << setw(14) << setprecision(6) << xx(3) / 1000.0
- << setw(14) << setprecision(6) << xx(4) * 1e6 << endl;
-
- return success;
- }
- else {
- return failure;
- }
-}
-
-// Close File (write last line)
-////////////////////////////////////////////////////////////////////////////
-void bncSP3::closeFile() {
- _out << "EOF" << endl;
- bncoutf::closeFile();
-}
-
-// Write Header
-////////////////////////////////////////////////////////////////////////////
-void bncSP3::writeHeader(const QDateTime& datTim) {
-
- int GPSWeek;
- double GPSWeeks;
- GPSweekFromDateAndTime(datTim, GPSWeek, GPSWeeks);
-
- double sec = fmod(GPSWeeks, 60.0);
-
- int mjd;
- double dayfrac;
- mjdFromDateAndTime(datTim, mjd, dayfrac);
-
- _out << "#aP" << datTim.toString("yyyy MM dd hh mm").toAscii().data()
- << setw(12) << setprecision(8) << sec
- << " 96 ORBIT IGS08 HLM IGS" << endl;
-
- _out << "## "
- << setw(4) << GPSWeek
- << setw(16) << setprecision(8) << GPSWeeks
- << setw(15) << setprecision(8) << double(_sampl)
- << setw(6) << mjd
- << setw(16) << setprecision(13) << dayfrac << endl;
-
- _out << "+ 56 G01G02G03G04G05G06G07G08G09G10G11G12G13G14G15G16G17\n"
- << "+ G18G19G20G21G22G23G24G25G26G27G28G29G30G31G32R01R02\n"
- << "+ R03R04R05R06R07R08R09R10R11R12R13R14R15R16R17R18R19\n"
- << "+ R20R21R22R23R24 0 0 0 0 0 0 0 0 0 0 0 0\n"
- << "+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
- << "++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
- << "++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
- << "++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
- << "++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
- << "++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
- << "%c cc cc ccc ccc cccc cccc cccc cccc ccccc ccccc ccccc ccccc\n"
- << "%c cc cc ccc ccc cccc cccc cccc cccc ccccc ccccc ccccc ccccc\n"
- << "%f 0.0000000 0.000000000 0.00000000000 0.000000000000000\n"
- << "%f 0.0000000 0.000000000 0.00000000000 0.000000000000000\n"
- << "%i 0 0 0 0 0 0 0 0 0\n"
- << "%i 0 0 0 0 0 0 0 0 0\n"
- << "/* \n"
- << "/* \n"
- << "/* \n"
- << "/* \n";
-}
-
Index: trunk/BNC/bncsp3.h
===================================================================
--- trunk/BNC/bncsp3.h (revision 4277)
+++ (revision )
@@ -1,24 +1,0 @@
-#ifndef BNCSP3_H
-#define BNCSP3_H
-
-#include
-#include
-#include
-
-#include "bncoutf.h"
-
-class bncSP3 : public bncoutf {
- public:
- bncSP3(const QString& sklFileName, const QString& intr, int sampl);
- virtual ~bncSP3();
- t_irc write(int GPSweek, double GPSweeks, const QString& prn,
- const ColumnVector& xx);
-
- private:
- virtual void writeHeader(const QDateTime& datTim);
- virtual void closeFile();
- int _lastGPSweek;
- double _lastGPSweeks;
-};
-
-#endif
Index: trunk/BNC/bncsslconfig.cpp
===================================================================
--- trunk/BNC/bncsslconfig.cpp (revision 4277)
+++ (revision )
@@ -1,63 +1,0 @@
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncSslConfig
- *
- * Purpose: Singleton Class that inherits QSslConfiguration class
- *
- * Author: L. Mervart
- *
- * Created: 22-Aug-2011
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-
-#include "bncsslconfig.h"
-#include "bncsettings.h"
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncSslConfig::bncSslConfig() :
- QSslConfiguration(QSslConfiguration::defaultConfiguration())
-{
-
- bncSettings settings;
- QString dirName = settings.value("sslCaCertPath").toString();
- if (dirName.isEmpty()) {
- dirName = defaultPath();
- }
-
- QList caCerts = this->caCertificates();
-
- // Bug in Qt: the wildcard does not work here:
- // -------------------------------------------
- // caCerts += QSslCertificate::fromPath(dirName + QDir::separator() + "*crt",
- // QSsl::Pem, QRegExp::Wildcard);
- QDir dir(dirName);
- QStringList nameFilters; nameFilters << "*.crt";
- QStringList fileNames = dir.entryList(nameFilters, QDir::Files);
- QStringListIterator it(fileNames);
- while (it.hasNext()) {
- QString fileName = it.next();
- caCerts += QSslCertificate::fromPath(dirName+QDir::separator()+fileName);
- }
-
- this->setCaCertificates(caCerts);
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncSslConfig::~bncSslConfig() {
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-QString bncSslConfig::defaultPath() {
- return QDir::homePath() + QDir::separator()
- + ".config" + QDir::separator() + qApp->organizationName();
-}
-
Index: trunk/BNC/bncsslconfig.h
===================================================================
--- trunk/BNC/bncsslconfig.h (revision 4277)
+++ (revision )
@@ -1,16 +1,0 @@
-#ifndef BNCSSLCONFIG_H
-#define BNCSSLCONFIG_H
-
-#include
-
-// Singleton Class
-// ---------------
-class bncSslConfig : public QSslConfiguration {
- public:
- bncSslConfig();
- ~bncSslConfig();
- static QString defaultPath();
- private:
-};
-
-#endif
Index: trunk/BNC/bnctabledlg.cpp
===================================================================
--- trunk/BNC/bnctabledlg.cpp (revision 4277)
+++ (revision )
@@ -1,686 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncTableDlg
- *
- * Purpose: Displays the source table, allows mountpoints selection
- *
- * Author: L. Mervart
- *
- * Created: 24-Dec-2005
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-
-#include "bnctabledlg.h"
-#include "bncgetthread.h"
-#include "bncnetqueryv1.h"
-#include "bncnetqueryv2.h"
-#include "bncsettings.h"
-#include "bncmap.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncTableDlg::bncTableDlg(QWidget* parent) : QDialog(parent) {
-
- setMinimumSize(600,400);
- setWindowTitle(tr("Add Streams from Caster"));
-
- QVBoxLayout* mainLayout = new QVBoxLayout(this);
-
- int ww = QFontMetrics(font()).width('w');
-
- _casterPortLineEdit = new QLineEdit();
- _casterPortLineEdit->setMaximumWidth(9*ww);
-
- _casterUserLineEdit = new QLineEdit();
- _casterUserLineEdit->setMaximumWidth(9*ww);
-
- _casterPasswordLineEdit = new QLineEdit();
- _casterPasswordLineEdit->setMaximumWidth(9*ww);
- _casterPasswordLineEdit->setEchoMode(QLineEdit::PasswordEchoOnEdit);
-
- _casterHostComboBox = new QComboBox();
- _casterHostComboBox->setMaxCount(10);
- _casterHostComboBox->setDuplicatesEnabled(false);
- _casterHostComboBox->setEditable(true);
- _casterHostComboBox->setMinimumWidth(20*ww);
- _casterHostComboBox->setMaximumWidth(20*ww);
- connect(_casterHostComboBox, SIGNAL(currentIndexChanged(const QString&)),
- this, SLOT(slotCasterHostChanged(const QString&)));
- bncSettings settings;
- settings.remove("casterHostList");
- settings.remove("casterHost");
- settings.remove("casterPort");
- settings.remove("casterUser");
- settings.remove("casterPassword");
- QStringList casterUrlList = settings.value("casterUrlList").toStringList();
- for (int ii = 0; ii < casterUrlList.count(); ii++) {
- QUrl url(casterUrlList[ii]);
- _casterHostComboBox->addItem(url.host());
- }
-
- _ntripVersionComboBox = new QComboBox();
- _ntripVersionComboBox->addItems(QString("1,2,2s,R,U").split(","));
- int kk = _ntripVersionComboBox->findText(settings.value("ntripVersion").toString());
- if (kk != -1) {
- _ntripVersionComboBox->setCurrentIndex(kk);
- }
- _ntripVersionComboBox->setMaximumWidth(5*ww);
-
- _buttonCasterTable = new QPushButton(tr("Show"), this);
- connect(_buttonCasterTable, SIGNAL(clicked()), this, SLOT(slotCasterTable()));
- _buttonCasterTable->setMaximumWidth(5*ww);
-
- // WhatsThis
- // ---------
- _casterUserLineEdit->setWhatsThis(tr("Access to some streams on NTRIP broadcasters may be restricted. You'll need to enter a valid 'User ID' and 'Password' for access to these protected streams.
Accounts are usually provided per NTRIP broadcaster through a registration process. Register through http://igs.bkg.bund.de/index_ntrip_reg.htm for access to protected streams on www.euref-ip.net and www.igs-ip.net.
"));
- _casterHostComboBox->setWhatsThis(tr("Enter the NTRIP broadcaster hostname or IP number.
Note that EUREF and IGS operate NTRIP broadcasters at http://www.euref-ip.net/home and http://www.igs-ip.net/home.
"));
- _casterPortLineEdit->setWhatsThis(tr("Enter the NTRIP broadcaster port number."));
- _casterPasswordLineEdit->setWhatsThis(tr("Access to some streams on NTRIP broadcasters may be restricted. You'll need to enter a valid 'Password' for access to these protected streams."));
-
- QGridLayout* editLayout = new QGridLayout;
- editLayout->addWidget(new QLabel(tr("Caster host")), 0, 0);
- editLayout->addWidget(_casterHostComboBox, 0, 1);
- editLayout->addWidget(new QLabel(tr(" Caster port")), 0, 2, Qt::AlignRight);
- editLayout->addWidget(_casterPortLineEdit, 0, 3);
- editLayout->addWidget(new QLabel(tr("Casters table")), 0, 4, Qt::AlignRight);
- editLayout->addWidget(_buttonCasterTable, 0, 5);
- editLayout->addWidget(new QLabel(tr("User")), 1, 0, Qt::AlignRight);
- editLayout->addWidget(_casterUserLineEdit, 1, 1);
- editLayout->addWidget(new QLabel(tr("Password")), 1, 2, Qt::AlignRight);
- editLayout->addWidget(_casterPasswordLineEdit, 1, 3);
- editLayout->addWidget(new QLabel(tr(" NTRIP Version")),1, 4, Qt::AlignRight);
- editLayout->addWidget(_ntripVersionComboBox, 1, 5);
-
- mainLayout->addLayout(editLayout);
-
- _buttonCasterTable->setWhatsThis(tr("Hit 'Show' for a table of known NTRIP broadcaster installations as maintained at www.rtcm-ntrip.org/home.
A window opens which allows to select a broadcaster for stream retrieval.
"));
- _ntripVersionComboBox->setWhatsThis(tr("Select the NTRIP transport protocol version you want to use. Implemented options are:
1: NTRIP version 1, TCP/IP
2: NTRIP version 2, TCP/IP mode
2s: NTRIP version 2 TCP/IP mode via SSL
R: NTRIP Version 2, RTSP/RTP mode
U: NTRIP Version 2, UDP mode
Select option '1' if you are not sure whether the NTRIP broadcaster supports NTRIP version 2.
Note that RTSP/RTP (option 'R') and UDP (option 'U') are not accepted by proxies and sometimes not supported by mobile Internet Service Providers.
"));
-
- _table = new QTableWidget(this);
- _table->setWhatsThis(tr("Use the 'Get Table' button to download the sourcetable from the selected NTRIP broadcaster. Select the desired streams line by line, using +Shift and +Ctrl when necessary. Hit 'OK' to return to the main window.
Pay attention to data field 'format'. Keep in mind that BNC can only decode and convert streams that come in RTCM Version 2.x, or RTCM Version 3.x format. See data field 'format-details' for available message types and their repetition rates in brackets.
The content of data field 'nmea' tells you whether a stream comes from a virtual reference station (VRS).
"));
- connect(_table, SIGNAL(itemSelectionChanged()),
- this, SLOT(slotSelectionChanged()));
- mainLayout->addWidget(_table);
-
- _buttonWhatsThis = new QPushButton(tr("Help=Shift+F1"), this);
- connect(_buttonWhatsThis, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
-
- _buttonGet = new QPushButton(tr("Get table"), this);
- _buttonGet->setDefault(true);
- connect(_buttonGet, SIGNAL(clicked()), this, SLOT(slotGetTable()));
-
- _buttonMap = new QPushButton(tr("Map"), this);
- _buttonMap->setEnabled(false);
- connect(_buttonMap, SIGNAL(clicked()), this, SLOT(slotShowMap()));
-
- _buttonClose = new QPushButton(tr("Close"), this);
- connect(_buttonClose, SIGNAL(clicked()), this, SLOT(close()));
-
- _buttonSelect = new QPushButton(tr("Select"), this);
- connect(_buttonSelect, SIGNAL(clicked()), this, SLOT(select()));
-
- QHBoxLayout* buttonLayout = new QHBoxLayout;
- buttonLayout->addWidget(_buttonWhatsThis);
- buttonLayout->addStretch(1);
- buttonLayout->addWidget(_buttonMap);
- buttonLayout->addWidget(_buttonGet);
- buttonLayout->addWidget(_buttonSelect);
- buttonLayout->addWidget(_buttonClose);
-
- mainLayout->addLayout(buttonLayout);
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncTableDlg::~bncTableDlg() {
- delete _casterHostComboBox;
- delete _casterPortLineEdit;
- delete _casterUserLineEdit;
- delete _casterPasswordLineEdit;
- bncSettings settings;
- settings.setValue("ntripVersion", _ntripVersionComboBox->currentText());
- delete _ntripVersionComboBox;
- delete _buttonGet;
- delete _buttonClose;
- delete _buttonSelect;
- delete _buttonWhatsThis;
- delete _buttonCasterTable;
- delete _table;
-}
-
-// Read full caster table (static)
-////////////////////////////////////////////////////////////////////////////
-t_irc bncTableDlg::getFullTable(const QString& ntripVersion,
- const QString& casterHost,
- int casterPort, QStringList& allLines,
- bool alwaysRead) {
-
- static QMutex mutex;
- static QMap allTables;
-
- QMutexLocker locker(&mutex);
-
- if (!alwaysRead && allTables.find(casterHost) != allTables.end()) {
- allLines = allTables.find(casterHost).value();
- return success;
- }
-
- allLines.clear();
-
- bncNetQuery* query = 0;
- if (ntripVersion == "2") {
- query = new bncNetQueryV2(false);
- }
- else if (ntripVersion == "2s") {
- query = new bncNetQueryV2(true);
- }
- else {
- query = new bncNetQueryV1();
- }
-
- QUrl url;
- url.setHost(casterHost);
- url.setPort(casterPort);
- url.setPath("/");
- if (ntripVersion == "2s") {
- url.setScheme("https");
- }
- else {
- url.setScheme("http");
- }
-
- QByteArray outData;
- query->waitForRequestResult(url, outData);
- if (query->status() == bncNetQuery::finished) {
- QTextStream in(outData);
- QString line = in.readLine();
- while ( !line.isNull() ) {
- allLines.append(line);
- line = in.readLine();
- }
- allTables.insert(casterHost, allLines);
- delete query;
- return success;
- }
- else {
- delete query;
- return failure;
- }
-}
-
-// Read Table from Caster
-////////////////////////////////////////////////////////////////////////////
-void bncTableDlg::slotGetTable() {
-
- _buttonGet->setEnabled(false);
- _buttonMap->setEnabled(true);
- _buttonCasterTable->setEnabled(false);
-
- if ( getFullTable(_ntripVersionComboBox->currentText(),
- _casterHostComboBox->currentText(),
- _casterPortLineEdit->text().toInt(),
- _allLines, true) != success ) {
- QMessageBox::warning(0, "BNC", "Cannot retrieve table of data");
- _buttonGet->setEnabled(true);
- return;
- }
-
- static const QStringList labels = QString("mountpoint,identifier,format,"
- "format-details,carrier,system,network,country,lat,long,"
- "nmea,solution,generator,compress.,auth.,fee,bitrate,"
- "misc").split(",");
-
- QStringList lines;
- QStringListIterator it(_allLines);
- while (it.hasNext()) {
- QString line = it.next();
- if (line.indexOf("STR") == 0) {
- QStringList hlp = line.split(";");
- if (hlp.size() > labels.size()) {
- lines.push_back(line);
- }
- }
- }
-
- if (lines.size() > 0) {
- _table->setSelectionMode(QAbstractItemView::ExtendedSelection);
- _table->setSelectionBehavior(QAbstractItemView::SelectRows);
- _table->setColumnCount(labels.size());
- _table->setRowCount(lines.size());
- for (int nRow = 0; nRow < lines.size(); nRow++) {
- QStringList columns = lines[nRow].split(";");
- for (int ic = 1; ic < columns.size(); ic++) {
- if (ic == 11) {
- if (columns[ic] == "0") {
- columns[ic] = "no";
- } else {
- columns[ic] = "yes";
- }
- }
- QTableWidgetItem* item = new QTableWidgetItem(columns[ic]);
- item->setFlags(item->flags() & ~Qt::ItemIsEditable);
- _table->setItem(nRow, ic-1, item);
- }
- }
- _table->setHorizontalHeaderLabels(labels);
- _table->setSortingEnabled(true);
- int ww = QFontMetrics(this->font()).width('w');
- _table->horizontalHeader()->resizeSection( 0,10*ww);
- _table->horizontalHeader()->resizeSection( 1,10*ww);
- _table->horizontalHeader()->resizeSection( 2, 8*ww);
- _table->horizontalHeader()->resizeSection( 3,22*ww);
- _table->horizontalHeader()->resizeSection( 4, 5*ww);
- _table->horizontalHeader()->resizeSection( 5, 8*ww);
- _table->horizontalHeader()->resizeSection( 6, 8*ww);
- _table->horizontalHeader()->resizeSection( 7, 7*ww);
- _table->horizontalHeader()->resizeSection( 8, 6*ww);
- _table->horizontalHeader()->resizeSection( 9, 6*ww);
- _table->horizontalHeader()->resizeSection(10, 6*ww);
- _table->horizontalHeader()->resizeSection(11, 6*ww);
- _table->horizontalHeader()->resizeSection(12,15*ww);
- _table->horizontalHeader()->resizeSection(13, 8*ww);
- _table->horizontalHeader()->resizeSection(14, 5*ww);
- _table->horizontalHeader()->resizeSection(15, 5*ww);
- _table->horizontalHeader()->resizeSection(16, 7*ww);
- _table->horizontalHeader()->resizeSection(17,15*ww);
- _table->sortItems(0);
- }
-}
-
-// Show world map
-////////////////////////////////////////////////////////////////////////////
-void bncTableDlg::slotShowMap() {
-
- bncMap* winMap = new bncMap(this);
- winMap->setGeometry( x(), int(y()+height()*1.3), 880, 440 );
-
- connect(this, SIGNAL(newPoint(QPointF, QString, QPen, double)),
- winMap, SLOT(slotNewPoint(QPointF, QString, QPen, double)));
-
- connect(this, SIGNAL(fitMap()),
- winMap, SLOT(slotFitMap() ));
-
- connect(this, SIGNAL(fitFont()),
- winMap, SLOT(slotFitFont() ));
-
- _buttonMap->setEnabled(false);
- showSourceTable();
- winMap->exec();
- _buttonMap->setEnabled(true);
-
- disconnect(this, SIGNAL(newPoint(QPointF, QString, QPen, double)),
- winMap, SLOT(slotNewPoint(QPointF, QString, QPen, double)));
-
- disconnect(this, SIGNAL(fitMap()),
- winMap, SLOT(slotFitMap() ));
-
- disconnect(this, SIGNAL(fitFont()),
- winMap, SLOT(slotFitFont() ));
-
- delete winMap;
-}
-
-// Show world map
-////////////////////////////////////////////////////////////////////////////
-void bncTableDlg::showSourceTable() {
-
- for( int i = 0; i < _allLines.size(); i++ ){
-
- if( _allLines.at(i).startsWith("STR") == true ){
-
- QStringList tmp = _allLines.at(i).split(';');
- if( tmp.size() > 0 ){
-
- QPointF point;
- point.setY( tmp.at(9).toDouble() );
- point.setX( tmp.at(10).toDouble() );
-
- QString site = tmp.at(1);
- site.resize(4);
-
- emit newPoint(point, site, QPen(QBrush(QColor(0,0,255,200)), 1.5), 1.5 );
- }
- }
- }
- emit fitMap();
-}
-
-
-// Select slot
-////////////////////////////////////////////////////////////////////////////
-void bncTableDlg::select() {
-
- QString ntripVersion = _ntripVersionComboBox->currentText();
-
- QUrl url;
- if (ntripVersion == "2s") {
- url.setScheme("https");
- }
- else {
- url.setScheme("http");
- }
- url.setHost(_casterHostComboBox->currentText());
- url.setPort(_casterPortLineEdit->text().toInt());
- url.setUserName(QUrl::toPercentEncoding(_casterUserLineEdit->text()));
- url.setPassword(QUrl::toPercentEncoding(_casterPasswordLineEdit->text()));
- addUrl(url);
-
- QStringList* mountPoints = new QStringList;
- if (_table) {
- for (int ir = 0; ir < _table->rowCount(); ir++) {
- QTableWidgetItem* item = _table->item(ir,0);
- QString site = _table->item(ir,0)->text();
- QString format = _table->item(ir,2)->text();
- QString latitude = _table->item(ir,8)->text();
- QString longitude = _table->item(ir,9)->text();
- QString nmea = _table->item(ir,10)->text();
- format.replace(" ", "_");
- if (_table->isItemSelected(item)) {
- url.setPath(item->text());
- mountPoints->push_back(url.toString() + " " + format + " " + latitude
- + " " + longitude + " " + nmea + " " + ntripVersion);
-
- site.resize(4);
- emit newPoint(QPointF(longitude.toDouble(),latitude.toDouble()), site,
- QPen(QBrush(QColor(255,0,0,200)), 3.0), 3.0 );
- }
- }
- }
- emit newMountPoints(mountPoints);
- emit fitFont();
-}
-
-// User changed the selection of mountPoints
-////////////////////////////////////////////////////////////////////////////
-void bncTableDlg::slotSelectionChanged() {
- if (_table->selectedItems().isEmpty()) {
- }
-}
-
-// Whats This Help
-void bncTableDlg::slotWhatsThis() {
-QWhatsThis::enterWhatsThisMode();
-}
-
-// Slot caster table
-////////////////////////////////////////////////////////////////////////////
-void bncTableDlg::slotCasterTable() {
-
- _buttonCasterTable->setEnabled(false);
- _casterHostComboBox->setEnabled(false);
- _casterPortLineEdit->setEnabled(false);
- _casterUserLineEdit->setEnabled(false);
- _casterPasswordLineEdit->setEnabled(false);
- _ntripVersionComboBox->setEnabled(false);
- _buttonWhatsThis->setEnabled(false);
- _buttonGet->setEnabled(false);
- _buttonClose->setEnabled(false);
- _buttonSelect->setEnabled(false);
-
- bncCasterTableDlg* dlg =
- new bncCasterTableDlg(_ntripVersionComboBox->currentText(), this);
- dlg->move(this->pos().x()+50, this->pos().y()+50);
- connect(dlg, SIGNAL(newCaster(QString, QString)),
- this, SLOT(slotNewCaster(QString, QString)));
- dlg->exec();
- delete dlg;
-
- _buttonCasterTable->setEnabled(true);
- _casterHostComboBox->setEnabled(true);
- _casterPortLineEdit->setEnabled(true);
- _casterUserLineEdit->setEnabled(true);
- _casterPasswordLineEdit->setEnabled(true);
- _ntripVersionComboBox->setEnabled(true);
- _buttonWhatsThis->setEnabled(true);
- _buttonGet->setEnabled(true);
- _buttonClose->setEnabled(true);
- _buttonSelect->setEnabled(true);
-
-}
-
-// New caster selected
-////////////////////////////////////////////////////////////////////////////
-void bncTableDlg::slotNewCaster(QString newCasterHost, QString newCasterPort) {
-
- _casterHostComboBox->insertItem(0, newCasterHost);
- _casterHostComboBox->setCurrentIndex(0);
- _casterUserLineEdit->setText("");
- _casterPasswordLineEdit->setText("");
- _casterPortLineEdit->setText(newCasterPort);
-
- QString ntripVersion = _ntripVersionComboBox->currentText();
-
- QUrl url;
- if (ntripVersion == "2s") {
- url.setScheme("https");
- }
- else {
- url.setScheme("http");
- }
- url.setHost(newCasterHost);
- url.setPort(newCasterPort.toInt());
- addUrl(url);
-
- _casterHostComboBox->setCurrentIndex(0);
-}
-
-// New caster selected
-////////////////////////////////////////////////////////////////////////////
-void bncTableDlg::addUrl(const QUrl& url) {
- bncSettings settings;
- QStringList oldUrlList = settings.value("casterUrlList").toStringList();
- QStringList newUrlList;
- newUrlList << url.toString();
- for (int ii = 0; ii < oldUrlList.count(); ii++) {
- QUrl oldUrl(oldUrlList[ii]);
- if (url.host() != oldUrl.host()) {
- newUrlList << oldUrl.toString();
- }
- }
- settings.setValue("casterUrlList", newUrlList);
-}
-
-// New caster selected in combobox
-////////////////////////////////////////////////////////////////////////////
-void bncTableDlg::slotCasterHostChanged(const QString& newHost) {
- bncSettings settings;
- QStringList casterUrlList = settings.value("casterUrlList").toStringList();
- for (int ii = 0; ii < casterUrlList.count(); ii++) {
- QUrl url(casterUrlList[ii]);
- if (url.host() == newHost) {
- _casterUserLineEdit->setText(
- QUrl::fromPercentEncoding(url.userName().toAscii()));
- _casterPasswordLineEdit->setText(
- QUrl::fromPercentEncoding(url.password().toAscii()));
- if (url.port() > 0) {
- _casterPortLineEdit->setText(QString("%1").arg(url.port()));
- }
- else {
- _casterPortLineEdit->setText("");
- }
- }
- }
-}
-
-// Caster table
-////////////////////////////////////////////////////////////////////////////
-bncCasterTableDlg::bncCasterTableDlg(const QString& ntripVersion,
- QWidget* parent) :
- QDialog(parent) {
-
- static const QStringList labels = QString("host,port,identifier,operator,nmea,country,lat,long,link").split(",");
-
- _casterTable = new QTableWidget(this);
-
- QUrl url;
- url.setHost("www.rtcm-ntrip.org");
- url.setPath("/");
- if (ntripVersion == "2s") {
- url.setPort(443);
- url.setScheme("https");
- }
- else {
- url.setPort(2101);
- url.setScheme("http");
- }
-
- bncNetQuery* query = 0;
- if (ntripVersion == "2") {
- query = new bncNetQueryV2(false);
- }
- else if (ntripVersion == "2s") {
- query = new bncNetQueryV2(true);
- }
- else {
- query = new bncNetQueryV1();
- }
-
- QByteArray outData;
- query->waitForRequestResult(url, outData);
-
- QStringList lines;
- if (query->status() == bncNetQuery::finished) {
- QTextStream in(outData);
- QString line = in.readLine();
- while ( !line.isNull() ) {
- line = in.readLine();
- if (line.indexOf("CAS") == 0) {
- QStringList hlp = line.split(";");
- if (hlp.size() > labels.size()) {
- lines.push_back(line);
- }
- }
- }
- }
-
- delete query;
-
- if (lines.size() > 0) {
- _casterTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
- _casterTable->setSelectionBehavior(QAbstractItemView::SelectRows);
-
- QStringList hlp = lines[0].split(";");
- _casterTable->setColumnCount(labels.size());
- _casterTable->setRowCount(lines.size());
-
- for (int nRow = 0; nRow < lines.size(); nRow++) {
- QStringList columns = lines[nRow].split(";");
- for (int ic = 1; ic < columns.size(); ic++) {
- if (ic == 5) {
- if (columns[ic] == "0") {
- columns[ic] = "no";
- } else {
- columns[ic] = "yes";
- }
- }
- QTableWidgetItem* item = new QTableWidgetItem(columns[ic]);
- item->setFlags(item->flags() & ~Qt::ItemIsEditable);
- _casterTable->setItem(nRow, ic-1, item);
- }
- }
- }
- _casterTable->setHorizontalHeaderLabels(labels);
- _casterTable->setSortingEnabled(true);
- _casterTable->sortItems(0);
- int ww = QFontMetrics(this->font()).width('w');
- _casterTable->horizontalHeader()->resizeSection(0,15*ww);
- _casterTable->horizontalHeader()->resizeSection(1, 5*ww);
- _casterTable->horizontalHeader()->resizeSection(2,15*ww);
- _casterTable->horizontalHeader()->resizeSection(3,15*ww);
- _casterTable->horizontalHeader()->resizeSection(4, 5*ww);
- _casterTable->horizontalHeader()->resizeSection(5, 7*ww);
- _casterTable->horizontalHeader()->resizeSection(6, 7*ww);
- _casterTable->horizontalHeader()->resizeSection(7, 7*ww);
- _casterTable->horizontalHeader()->resizeSection(8,15*ww);
-
- _closeButton = new QPushButton("Cancel");
- connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
- _closeButton->setMinimumWidth(8*ww);
- _closeButton->setMaximumWidth(8*ww);
-
- _okButton = new QPushButton(tr("OK"), this);
- connect(_okButton, SIGNAL(clicked()), this, SLOT(slotAcceptCasterTable()));
- _okButton->setMinimumWidth(8*ww);
- _okButton->setMaximumWidth(8*ww);
-
- _whatsThisButton = new QPushButton(tr("Help=Shift+F1"), this);
- connect(_whatsThisButton, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
- _whatsThisButton->setMinimumWidth(12*ww);
- _whatsThisButton->setMaximumWidth(12*ww);
-
- _casterTable->setWhatsThis(tr("Select an NTRIP broadcaster and hit 'OK'.
See http://www.rtcm-ntrip.org/home for further details on known NTRIP broadcaster installations.."));
-
- QGridLayout* dlgLayout = new QGridLayout();
- dlgLayout->addWidget(new QLabel(" List of NTRIP Broadcasters from www.rtcm-ntrip.org"), 0,0,1,3,Qt::AlignLeft);
- dlgLayout->addWidget(_casterTable, 1, 0, 1, 3);
- dlgLayout->addWidget(_whatsThisButton, 2, 0);
- dlgLayout->addWidget(_closeButton, 2, 1, Qt::AlignRight);
- dlgLayout->addWidget(_okButton, 2, 2);
-
- setMinimumSize(600,400);
- setWindowTitle(tr("Select Broadcaster"));
- setLayout(dlgLayout);
- resize(68*ww, 50*ww);
- show();
-}
-
-// Caster table destructor
-////////////////////////////////////////////////////////////////////////////
-bncCasterTableDlg::~bncCasterTableDlg() {
- delete _casterTable;
- delete _okButton;
- delete _closeButton;
- delete _whatsThisButton;
-}
-
-// Caster table what's this
-////////////////////////////////////////////////////////////////////////////
-void bncCasterTableDlg:: slotWhatsThis() {
- QWhatsThis::enterWhatsThisMode();
-}
-
-// Accept caster table
-////////////////////////////////////////////////////////////////////////////
-void bncCasterTableDlg::slotAcceptCasterTable() {
- if (_casterTable) {
- for (int ir = _casterTable->rowCount() - 1; ir >= 0 ; ir--) {
- if (_casterTable->isItemSelected(_casterTable->item(ir,0))) {
- emit newCaster(_casterTable->item(ir,0)->text(),
- _casterTable->item(ir,1)->text());
- }
- }
- }
- QDialog::accept();
-}
Index: trunk/BNC/bnctabledlg.h
===================================================================
--- trunk/BNC/bnctabledlg.h (revision 4277)
+++ (revision )
@@ -1,101 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCTABLEDLG_H
-#define BNCTABLEDLG_H
-
-#include
-#include
-#include
-
-#include "bncconst.h"
-
-class bncCasterTableDlg : public QDialog {
- Q_OBJECT
-
- public:
- bncCasterTableDlg(const QString& ntripVersion, QWidget* parent);
- ~bncCasterTableDlg();
-
- signals:
- void newCaster(QString newCasterHost, QString newCasterPort);
-
- private slots:
- virtual void slotAcceptCasterTable();
- virtual void slotWhatsThis();
-
- private:
- QTableWidget* _casterTable;
- QPushButton* _okButton;
- QPushButton* _closeButton;
- QPushButton* _whatsThisButton;
-};
-
-class bncTableDlg : public QDialog {
- Q_OBJECT
-
- public:
- bncTableDlg(QWidget* parent);
- ~bncTableDlg();
- static t_irc getFullTable(const QString& ntripVersion,
- const QString& casterHost, int casterPort,
- QStringList& allLines, bool alwaysRead = true);
-
- signals:
- void newMountPoints(QStringList* mountPoints);
- void newPoint(QPointF, QString, QPen, double);
- void fitMap();
- void fitFont();
-
- private slots:
- virtual void select();
- void slotGetTable();
- void slotShowMap();
- void slotSelectionChanged();
- void slotWhatsThis();
- void slotCasterTable();
- void slotNewCaster(QString newCasterHost, QString newCasterPort);
- void slotCasterHostChanged(const QString&);
-
- private:
- void addUrl(const QUrl& url);
- void showSourceTable();
- QComboBox* _casterHostComboBox;
- QLineEdit* _casterPortLineEdit;
- QLineEdit* _casterUserLineEdit;
- QLineEdit* _casterPasswordLineEdit;
- QComboBox* _ntripVersionComboBox;
-
- QPushButton* _buttonGet;
- QPushButton* _buttonMap;
- QPushButton* _buttonClose;
- QPushButton* _buttonSelect;
- QPushButton* _buttonWhatsThis;
- QPushButton* _buttonCasterTable;
-
- QTableWidget* _table;
- QStringList _allLines;
-};
-
-#endif
Index: trunk/BNC/bnctableitem.cpp
===================================================================
--- trunk/BNC/bnctableitem.cpp (revision 4277)
+++ (revision )
@@ -1,83 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncTableItem
- *
- * Purpose: Re-Implements QTableWidgetItem
- *
- * Author: L. Mervart
- *
- * Created: 24-Sep-2006
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include "bnctableitem.h"
-#include "bncgetthread.h"
-#include "RTCM/GPSDecoder.h"
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncTableItem::bncTableItem() : QTableWidgetItem() {
- _bytesRead = 0.0;
- setText(QString("%1 byte(s)").arg(0));
- _getThread = 0;
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncTableItem::~bncTableItem() {
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncTableItem::slotNewBytes(const QByteArray, double nbyte) {
-
- QMutexLocker locker(&_mutex);
-
- _bytesRead += nbyte;
-
- if (_bytesRead < 1e3) {
- setText(QString("%1 byte(s)").arg((int)_bytesRead));
- }
- else if (_bytesRead < 1e6) {
- setText(QString("%1 kB").arg(_bytesRead/1.e3, 5));
- }
- else {
- setText(QString("%1 MB").arg(_bytesRead/1.e6, 5));
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncTableItem::setGetThread(bncGetThread* getThread) {
- _getThread = getThread;
- connect(_getThread, SIGNAL(newBytes(QByteArray, double)),
- this, SLOT(slotNewBytes(QByteArray, double)));
-}
Index: trunk/BNC/bnctableitem.h
===================================================================
--- trunk/BNC/bnctableitem.h (revision 4277)
+++ (revision )
@@ -1,54 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCTABLEITEM_H
-#define BNCTABLEITEM_H
-
-#include
-#include
-
-struct Observation;
-struct bncGetThread;
-
-class bncTableItem : public QObject, public QTableWidgetItem {
- Q_OBJECT
-
- public:
- bncTableItem();
- ~bncTableItem();
- void setGetThread(bncGetThread* getThread);
- bncGetThread* getThread() {return _getThread;}
-
- signals:
-
- public slots:
- void slotNewBytes(const QByteArray staID, double nbyte);
-
- private:
- double _bytesRead;
- QMutex _mutex;
- bncGetThread* _getThread;
-};
-
-#endif
Index: trunk/BNC/bnctides.cpp
===================================================================
--- trunk/BNC/bnctides.cpp (revision 4277)
+++ (revision )
@@ -1,224 +1,0 @@
-
-#include
-
-#include "bnctides.h"
-#include "bncutils.h"
-
-using namespace std;
-
-// Auxiliary Functions
-///////////////////////////////////////////////////////////////////////////
-namespace {
-
- static const double RHO_DEG = 180.0 / M_PI;
- static const double RHO_SEC = 3600.0 * RHO_DEG;
- static const double MJD_J2000 = 51544.5;
-
- double Frac (double x) { return x-floor(x); };
- double Modulo (double x, double y) { return y*Frac(x/y); }
-
- Matrix rotX(double Angle) {
- const double C = cos(Angle);
- const double S = sin(Angle);
- Matrix UU(3,3);
- UU[0][0] = 1.0; UU[0][1] = 0.0; UU[0][2] = 0.0;
- UU[1][0] = 0.0; UU[1][1] = +C; UU[1][2] = +S;
- UU[2][0] = 0.0; UU[2][1] = -S; UU[2][2] = +C;
- return UU;
- }
-
- Matrix rotY(double Angle) {
- const double C = cos(Angle);
- const double S = sin(Angle);
- Matrix UU(3,3);
- UU[0][0] = +C; UU[0][1] = 0.0; UU[0][2] = -S;
- UU[1][0] = 0.0; UU[1][1] = 1.0; UU[1][2] = 0.0;
- UU[2][0] = +S; UU[2][1] = 0.0; UU[2][2] = +C;
- return UU;
- }
-
- Matrix rotZ(double Angle) {
- const double C = cos(Angle);
- const double S = sin(Angle);
- Matrix UU(3,3);
- UU[0][0] = +C; UU[0][1] = +S; UU[0][2] = 0.0;
- UU[1][0] = -S; UU[1][1] = +C; UU[1][2] = 0.0;
- UU[2][0] = 0.0; UU[2][1] = 0.0; UU[2][2] = 1.0;
- return UU;
- }
-}
-
-// Greenwich Mean Sidereal Time
-///////////////////////////////////////////////////////////////////////////
-double GMST(double Mjd_UT1) {
-
- const double Secs = 86400.0;
-
- double Mjd_0 = floor(Mjd_UT1);
- double UT1 = Secs*(Mjd_UT1-Mjd_0);
- double T_0 = (Mjd_0 -MJD_J2000)/36525.0;
- double T = (Mjd_UT1-MJD_J2000)/36525.0;
-
- double gmst = 24110.54841 + 8640184.812866*T_0 + 1.002737909350795*UT1
- + (0.093104-6.2e-6*T)*T*T;
-
- return 2.0*M_PI*Frac(gmst/Secs);
-}
-
-// Nutation Matrix
-///////////////////////////////////////////////////////////////////////////
-Matrix NutMatrix(double Mjd_TT) {
-
- const double T = (Mjd_TT-MJD_J2000)/36525.0;
-
- double ls = 2.0*M_PI*Frac(0.993133+ 99.997306*T);
- double D = 2.0*M_PI*Frac(0.827362+1236.853087*T);
- double F = 2.0*M_PI*Frac(0.259089+1342.227826*T);
- double N = 2.0*M_PI*Frac(0.347346- 5.372447*T);
-
- double dpsi = ( -17.200*sin(N) - 1.319*sin(2*(F-D+N)) - 0.227*sin(2*(F+N))
- + 0.206*sin(2*N) + 0.143*sin(ls) ) / RHO_SEC;
- double deps = ( + 9.203*cos(N) + 0.574*cos(2*(F-D+N)) + 0.098*cos(2*(F+N))
- - 0.090*cos(2*N) ) / RHO_SEC;
-
- double eps = 0.4090928-2.2696E-4*T;
-
- return rotX(-eps-deps)*rotZ(-dpsi)*rotX(+eps);
-}
-
-// Precession Matrix
-///////////////////////////////////////////////////////////////////////////
-Matrix PrecMatrix (double Mjd_1, double Mjd_2) {
-
- const double T = (Mjd_1-MJD_J2000)/36525.0;
- const double dT = (Mjd_2-Mjd_1)/36525.0;
-
- double zeta = ( (2306.2181+(1.39656-0.000139*T)*T)+
- ((0.30188-0.000344*T)+0.017998*dT)*dT )*dT/RHO_SEC;
- double z = zeta + ( (0.79280+0.000411*T)+0.000205*dT)*dT*dT/RHO_SEC;
- double theta = ( (2004.3109-(0.85330+0.000217*T)*T)-
- ((0.42665+0.000217*T)+0.041833*dT)*dT )*dT/RHO_SEC;
-
- return rotZ(-z) * rotY(theta) * rotZ(-zeta);
-}
-
-// Sun's position
-///////////////////////////////////////////////////////////////////////////
-ColumnVector Sun(double Mjd_TT) {
-
- const double eps = 23.43929111/RHO_DEG;
- const double T = (Mjd_TT-MJD_J2000)/36525.0;
-
- double M = 2.0*M_PI * Frac ( 0.9931267 + 99.9973583*T);
- double L = 2.0*M_PI * Frac ( 0.7859444 + M/2.0/M_PI +
- (6892.0*sin(M)+72.0*sin(2.0*M)) / 1296.0e3);
- double r = 149.619e9 - 2.499e9*cos(M) - 0.021e9*cos(2*M);
-
- ColumnVector r_Sun(3);
- r_Sun << r*cos(L) << r*sin(L) << 0.0; r_Sun = rotX(-eps) * r_Sun;
-
- return rotZ(GMST(Mjd_TT))
- * NutMatrix(Mjd_TT)
- * PrecMatrix(MJD_J2000, Mjd_TT)
- * r_Sun;
-}
-
-// Moon's position
-///////////////////////////////////////////////////////////////////////////
-ColumnVector Moon(double Mjd_TT) {
-
- const double eps = 23.43929111/RHO_DEG;
- const double T = (Mjd_TT-MJD_J2000)/36525.0;
-
- double L_0 = Frac ( 0.606433 + 1336.851344*T );
- double l = 2.0*M_PI*Frac ( 0.374897 + 1325.552410*T );
- double lp = 2.0*M_PI*Frac ( 0.993133 + 99.997361*T );
- double D = 2.0*M_PI*Frac ( 0.827361 + 1236.853086*T );
- double F = 2.0*M_PI*Frac ( 0.259086 + 1342.227825*T );
-
- double dL = +22640*sin(l) - 4586*sin(l-2*D) + 2370*sin(2*D) + 769*sin(2*l)
- -668*sin(lp) - 412*sin(2*F) - 212*sin(2*l-2*D)- 206*sin(l+lp-2*D)
- +192*sin(l+2*D) - 165*sin(lp-2*D) - 125*sin(D) - 110*sin(l+lp)
- +148*sin(l-lp) - 55*sin(2*F-2*D);
-
- double L = 2.0*M_PI * Frac( L_0 + dL/1296.0e3 );
-
- double S = F + (dL+412*sin(2*F)+541*sin(lp)) / RHO_SEC;
- double h = F-2*D;
- double N = -526*sin(h) + 44*sin(l+h) - 31*sin(-l+h) - 23*sin(lp+h)
- +11*sin(-lp+h) - 25*sin(-2*l+F) + 21*sin(-l+F);
-
- double B = ( 18520.0*sin(S) + N ) / RHO_SEC;
-
- double cosB = cos(B);
-
- double R = 385000e3 - 20905e3*cos(l) - 3699e3*cos(2*D-l) - 2956e3*cos(2*D)
- -570e3*cos(2*l) + 246e3*cos(2*l-2*D) - 205e3*cos(lp-2*D)
- -171e3*cos(l+2*D) - 152e3*cos(l+lp-2*D);
-
- ColumnVector r_Moon(3);
- r_Moon << R*cos(L)*cosB << R*sin(L)*cosB << R*sin(B);
- r_Moon = rotX(-eps) * r_Moon;
-
- return rotZ(GMST(Mjd_TT))
- * NutMatrix(Mjd_TT)
- * PrecMatrix(MJD_J2000, Mjd_TT)
- * r_Moon;
-}
-
-// Tidal Correction
-////////////////////////////////////////////////////////////////////////////
-void tides(const bncTime& time, ColumnVector& xyz) {
-
- static double lastMjd = 0.0;
- static ColumnVector xSun;
- static ColumnVector xMoon;
- static double rSun;
- static double rMoon;
-
- double Mjd = time.mjd() + time.daysec() / 86400.0;
-
- if (Mjd != lastMjd) {
- lastMjd = Mjd;
- xSun = Sun(Mjd);
- rSun = sqrt(DotProduct(xSun,xSun));
- xSun /= rSun;
- xMoon = Moon(Mjd);
- rMoon = sqrt(DotProduct(xMoon,xMoon));
- xMoon /= rMoon;
- }
-
- double rRec = sqrt(DotProduct(xyz, xyz));
- ColumnVector xyzUnit = xyz / rRec;
-
- // Love's Numbers
- // --------------
- const double H2 = 0.6078;
- const double L2 = 0.0847;
-
- // Tidal Displacement
- // ------------------
- double scSun = DotProduct(xyzUnit, xSun);
- double scMoon = DotProduct(xyzUnit, xMoon);
-
- double p2Sun = 3.0 * (H2/2.0-L2) * scSun * scSun - H2/2.0;
- double p2Moon = 3.0 * (H2/2.0-L2) * scMoon * scMoon - H2/2.0;
-
- double x2Sun = 3.0 * L2 * scSun;
- double x2Moon = 3.0 * L2 * scMoon;
-
- const double gmWGS = 398.6005e12;
- const double gms = 1.3271250e20;
- const double gmm = 4.9027890e12;
-
- double facSun = gms / gmWGS *
- (rRec * rRec * rRec * rRec) / (rSun * rSun * rSun);
-
- double facMoon = gmm / gmWGS *
- (rRec * rRec * rRec * rRec) / (rMoon * rMoon * rMoon);
-
- ColumnVector dX = facSun * (x2Sun * xSun + p2Sun * xyzUnit) +
- facMoon * (x2Moon * xMoon + p2Moon * xyzUnit);
-
- xyz += dX;
-}
Index: trunk/BNC/bnctides.h
===================================================================
--- trunk/BNC/bnctides.h (revision 4277)
+++ (revision )
@@ -1,11 +1,0 @@
-#ifndef BNCTIDES_H
-#define BNCTIDES_H
-
-#include
-#include "bnctime.h"
-
-ColumnVector Sun(double Mjd_TT);
-
-void tides(const bncTime& time, ColumnVector& xyz);
-
-#endif
Index: trunk/BNC/bnctime.cpp
===================================================================
--- trunk/BNC/bnctime.cpp (revision 4277)
+++ (revision )
@@ -1,295 +1,0 @@
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "bnctime.h"
-#include "timeutils.h"
-
-using namespace std;
-
-// Constructor
-//////////////////////////////////////////////////////////////////////////////
-bncTime::bncTime(int gpsw, double gpssec) {
- this->set(gpsw, gpssec);
-}
-
-// Constructor (from ISO String yyyy-mm-ddThh:mm:ss)
-//////////////////////////////////////////////////////////////////////////////
-bncTime::bncTime(const std::string& isoString) {
- if (!isoString.empty()) {
- QDateTime dt = QDateTime::fromString(isoString.c_str(), Qt::ISODate);
- this->set(dt.date().year(), dt.date().month(), dt.date().day(),
- dt.time().hour(), dt.time().minute(),
- dt.time().second() + dt.time().msec()/1000.0);
- }
- else {
- this->reset();
- }
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-bncTime& bncTime::set(int gpsw, double gpssec) {
- int deltad;
- int dow = 0;
- while ( gpssec >= 86400 ) {
- gpssec-=86400;
- dow++;
- }
- while ( gpssec < 0 ) {
- gpssec+=86400;
- dow--;
- }
- deltad = gpsw*7 + dow;
- _mjd = 44244 + deltad;
- _sec = gpssec;
- return *this;
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-bncTime& bncTime::setmjd(double daysec, int mjd) {
- _sec = daysec;
- _mjd = mjd;
- while ( _sec >= 86400 ) {
- _sec-=86400;
- _mjd++;
- }
- while ( _sec < 0 ) {
- _sec+=86400;
- _mjd--;
- }
- return *this;
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-unsigned int bncTime::mjd() const {
- return _mjd;
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-double bncTime::daysec() const {
- return _sec;
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-unsigned int bncTime::gpsw() const {
- double gsec;
- long gpsw;
- jdgp(_mjd, gsec, gpsw);
- return (int)gpsw;
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-double bncTime::gpssec() const {
- double gsec;
- long gpsw;
- jdgp(_mjd, gsec, gpsw);
- return gsec + _sec;
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-bool bncTime::operator!=(const bncTime &time1) const {
- if ( ((*this) - time1) != 0.0 ) {
- return true;
- }
- else {
- return false;
- }
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-bool bncTime::operator==(const bncTime &time1) const {
- if ( ((*this) - time1) == 0.0 ) {
- return true;
- }
- else {
- return false;
- }
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-bool bncTime::operator>(const bncTime &time1) const {
- if ( ((*this) - time1) > 0.0 ) {
- return true;
- }
- else {
- return false;
- }
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-bool bncTime::operator>=(const bncTime &time1) const {
- if ( ((*this) - time1) >= 0.0 ) {
- return true;
- }
- else {
- return false;
- }
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-bool bncTime::operator<(const bncTime &time1) const {
- if ( ((*this) - time1) < 0.0 ) {
- return true;
- }
- else {
- return false;
- }
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-bool bncTime::operator<=(const bncTime &time1) const {
- if ( ((*this) - time1) <= 0.0 ) {
- return true;
- }
- else {
- return false;
- }
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-bncTime bncTime::operator+(double sec) const {
- int mjd = this->mjd();
- double daysec = this->daysec();
- daysec+=sec;
- return bncTime().setmjd(daysec, mjd);
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-bncTime bncTime::operator-(double sec) const {
- return (*this) + (-sec);
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-double bncTime::operator-(const bncTime &time1) const {
- int mjdDiff = this->_mjd - time1._mjd;
- if ( mjdDiff != 0 ) {
- return mjdDiff * 86400.0 + this->_sec - time1._sec;
- }
- else {
- return this->_sec - time1._sec;
- }
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-void bncTime::civil_date (unsigned int& year, unsigned int& month,
- unsigned int& day) const {
- double day_d;
- long int yy, mm;
- jmt(_mjd, yy, mm, day_d);
- year = yy;
- month = mm;
- day = static_cast(day_d);
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-void bncTime::civil_time(unsigned int &hour, unsigned int &min,
- double &sec) const {
- hour = static_cast(_sec/3600.0);
- min = static_cast((_sec - hour*3600)/60.0);
- sec = _sec - min*60 - hour*3600;
- if (sec==60.0) {
- min++;
- sec=0;
- }
- if (min==60) {
- hour++;
- min=0;
- }
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-string bncTime::timestr(unsigned numdec, char sep) const {
- ostringstream str;
- unsigned int hour, minute;
- double sec;
- this->civil_time(hour, minute, sec);
- unsigned sw;
- if (numdec == 0) {
- sw = 2;
- }
- else {
- sw = numdec + 3;
- }
- double chk = 0.5;
- for (unsigned int ii=0; ii (60.0-chk)) {
- sec = 0;
- minute++;
- if (minute == 60) {
- minute = 0;
- hour++;
- }
- }
- str.setf(ios::fixed);
- str << setfill('0');
- str << setw(2) << hour;
- if (sep) str << sep;
- str << setw(2) << minute;
- if (sep) str << sep;
- str << setw(sw) << setprecision(numdec) << sec;
- return str.str();
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-string bncTime::datestr(char sep) const {
- unsigned int year, month, day;
- civil_date(year,month,day);
- ostringstream str;
- str.setf(ios::fixed);
- str << setfill('0');
- str << setw(4) << year;
- if (sep) str << sep;
- str << setw(2) << month;
- if (sep) str << sep;
- str << setw(2) << day;
- return str.str();
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-bncTime& bncTime::set(int year, int month, int day,
- int hour, int min, double sec) {
- return set(year, month, day, hour*3600 + min*60 + sec);
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-bncTime& bncTime::set(int year, int month, int day, double daysec) {
- _sec = daysec;
-
- _mjd = (unsigned int)djul(year, month, day);
-
- while ( _sec >= 86400 ) {
- _sec-=86400;
- _mjd++;
- }
- while ( _sec < 0 ) {
- _sec+=86400;
- _mjd--;
- }
-
- return *this;
-}
Index: trunk/BNC/bnctime.h
===================================================================
--- trunk/BNC/bnctime.h (revision 4277)
+++ (revision )
@@ -1,47 +1,0 @@
-
-#ifndef BNCTIME_H
-#define BNCTIME_H
-
-#include
-
-class bncTime {
- public:
- bncTime() {this->reset();}
- bncTime(int gpsw, double gpssec);
- bncTime(const std::string& isoString);
-
- bncTime& set(int gpsw, double gpssec);
- bncTime& set(int year, int month, int day, int hour, int min, double sec);
- bncTime& set(int year, int month, int day, double daysec);
- bncTime& setmjd(double daysec, int mjd);
-
- void reset() {_mjd = 0; _sec = 0;}
- unsigned int mjd() const;
- double daysec() const;
- unsigned int gpsw() const;
- double gpssec() const;
- void civil_date (unsigned int& year, unsigned int& month,
- unsigned int& day) const;
- void civil_time (unsigned int& hour, unsigned int& min,
- double& sec) const;
- bool valid() const {return _mjd != 0 || _sec != 0.0;}
- bool operator==(const bncTime &time1) const;
- bool operator!=(const bncTime &time1) const;
- bool operator<(const bncTime &time1) const;
- bool operator>(const bncTime &time1) const;
- bool operator<=(const bncTime &time1) const;
- bool operator>=(const bncTime &time1) const;
- double operator-(const bncTime &time1) const;
- bncTime operator-(double sec) const;
- bncTime operator+(double sec) const;
-
- std::string timestr(unsigned numdec = 3, char sep = ':') const;
- std::string datestr(char sep = '-') const;
-
- private:
- unsigned int _mjd;
- double _sec;
-};
-
-#endif
-
Index: trunk/BNC/bncudpport.cpp
===================================================================
--- trunk/BNC/bncudpport.cpp (revision 4277)
+++ (revision )
@@ -1,154 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2009
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncUdpPort
- *
- * Purpose: Select host for stream retrieval without NTRIP
- *
- * Author: G. Weber
- *
- * Created: 18-Feb-2009
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-
-#include "bncudpport.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncUdpPort::bncUdpPort(QWidget* parent) : QDialog(parent) {
-
- setMinimumSize(400,150);
- QVBoxLayout* mainLayout = new QVBoxLayout(this);
- QGridLayout* editLayout = new QGridLayout;
-
- setWindowTitle(tr("Add Stream from UDP Port"));
-
- _ipPortLineEdit = new QLineEdit();
- _ipMountLineEdit = new QLineEdit();
- _ipFormatLineEdit = new QLineEdit();
- _ipLatLineEdit = new QLineEdit();
- _ipLonLineEdit = new QLineEdit();
-
- int ww = QFontMetrics(font()).width('w');
- _ipPortLineEdit->setMaximumWidth(9*ww);
- _ipMountLineEdit->setMaximumWidth(9*ww);
- _ipFormatLineEdit->setMaximumWidth(9*ww);
- _ipLatLineEdit->setMaximumWidth(9*ww);
- _ipLonLineEdit->setMaximumWidth(9*ww);
-
- // WhatsThis
- // ---------
- _ipPortLineEdit->setWhatsThis(tr("BNC allows to pick up streams arriving directly at one of the local host's UDP ports without using the NTRIP transport protocol.
Enter the local port number where the UDP stream arrives.
"));
- _ipMountLineEdit->setWhatsThis(tr("Specify a mountpoint.
Recommended is a 4-character station ID.
Example: FFMJ
"));
- _ipFormatLineEdit->setWhatsThis(tr("Specify the stream format.
Available options are 'RTCM_2', 'RTCM_3', 'RTNET', and 'ZERO'.
"));
- _ipLatLineEdit->setWhatsThis(tr("Enter the approximate latitude of the stream providing receiver in degrees.
Example: 45.32
"));
- _ipLonLineEdit->setWhatsThis(tr("Enter the approximate longitude of the stream providing receiver in degrees.
Example: -15.20"));
-
- editLayout->addWidget(new QLabel(tr("UDP Port")), 0, 0, Qt::AlignRight);
- editLayout->addWidget(_ipPortLineEdit, 0, 1);
- editLayout->addWidget(new QLabel(tr("Mountpoint")),1, 0, Qt::AlignRight);
- editLayout->addWidget(_ipMountLineEdit, 1, 1);
- editLayout->addWidget(new QLabel(tr("Format")), 1, 2, Qt::AlignRight);
- editLayout->addWidget(_ipFormatLineEdit, 1, 3);
- editLayout->addWidget(new QLabel(tr("Latitude")), 2, 0, Qt::AlignRight);
- editLayout->addWidget(_ipLatLineEdit, 2, 1);
- editLayout->addWidget(new QLabel(tr("Longitude")), 2, 2, Qt::AlignRight);
- editLayout->addWidget(_ipLonLineEdit, 2, 3);
-
- mainLayout->addLayout(editLayout);
-
- _buttonWhatsThis = new QPushButton(tr("Help=Shift+F1"), this);
- connect(_buttonWhatsThis, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
-
- _buttonCancel = new QPushButton(tr("Cancel"), this);
- connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
-
- _buttonOK = new QPushButton(tr("OK"), this);
- connect(_buttonOK, SIGNAL(clicked()), this, SLOT(accept()));
-
- _buttonOK->setDefault(true);
-
- QHBoxLayout* buttonLayout = new QHBoxLayout;
-
- buttonLayout->addWidget(_buttonWhatsThis);
- buttonLayout->addStretch(1);
- buttonLayout->addWidget(_buttonCancel);
- buttonLayout->addWidget(_buttonOK);
-
- mainLayout->addLayout(buttonLayout);
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncUdpPort::~bncUdpPort() {
- delete _buttonCancel;
- delete _buttonOK;
- delete _buttonWhatsThis;
-}
-
-// Accept slot
-////////////////////////////////////////////////////////////////////////////
-void bncUdpPort::accept() {
-
- QStringList* mountPoints = new QStringList;
-
- if ( !_ipPortLineEdit->text().isEmpty() &&
- !_ipMountLineEdit->text().isEmpty() &&
- !_ipFormatLineEdit->text().isEmpty() &&
- !_ipLatLineEdit->text().isEmpty() &&
- !_ipLonLineEdit->text().isEmpty() ) {
-
- mountPoints->push_back("//127.0.0.1:"
- + _ipPortLineEdit->text() + "/"
- + _ipMountLineEdit->text() + " "
- + _ipFormatLineEdit->text() + " "
- + _ipLatLineEdit->text() + " "
- + _ipLonLineEdit->text() + " "
- + "no UN");
- } else {
- QMessageBox::warning(this, tr("Warning"),
- tr("Incomplete settings"),
- QMessageBox::Ok);
- }
-
- emit newMountPoints(mountPoints);
-
- QDialog::accept();
-}
-
-// Whats This Help
-void bncUdpPort::slotWhatsThis() {
-QWhatsThis::enterWhatsThisMode();
-}
-
Index: trunk/BNC/bncudpport.h
===================================================================
--- trunk/BNC/bncudpport.h (revision 4277)
+++ (revision )
@@ -1,60 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2009
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCUDPPORT_H
-#define BNCUDPPORT_H
-
-#include
-#include
-#include
-
-class bncUdpPort : public QDialog {
- Q_OBJECT
-
- public:
- bncUdpPort(QWidget* parent);
- ~bncUdpPort();
-
- signals:
- void newMountPoints(QStringList* mountPoints);
-
- private slots:
- virtual void accept();
- void slotWhatsThis();
-
- private:
- QLineEdit* _ipHostLineEdit;
- QLineEdit* _ipPortLineEdit;
- QLineEdit* _ipMountLineEdit;
- QLineEdit* _ipFormatLineEdit;
- QLineEdit* _ipLatLineEdit;
- QLineEdit* _ipLonLineEdit;
-
- QPushButton* _buttonGet;
- QPushButton* _buttonCancel;
- QPushButton* _buttonOK;
- QPushButton* _buttonWhatsThis;
-};
-
-#endif
Index: trunk/BNC/bncutils.cpp
===================================================================
--- trunk/BNC/bncutils.cpp (revision 4277)
+++ (revision )
@@ -1,409 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncutils
- *
- * Purpose: Auxiliary Functions
- *
- * Author: L. Mervart
- *
- * Created: 30-Aug-2006
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-#include "bncutils.h"
-#include "bncapp.h"
-
-using namespace std;
-
-//
-////////////////////////////////////////////////////////////////////////////
-void expandEnvVar(QString& str) {
-
- QRegExp rx("(\\$\\{.+\\})");
-
- if (rx.indexIn(str) != -1) {
- QStringListIterator it(rx.capturedTexts());
- if (it.hasNext()) {
- QString rxStr = it.next();
- QString envVar = rxStr.mid(2,rxStr.length()-3);
- str.replace(rxStr, qgetenv(envVar.toAscii()));
- }
- }
-
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-QDateTime dateAndTimeFromGPSweek(int GPSWeek, double GPSWeeks) {
-
- static const QDate zeroEpoch(1980, 1, 6);
-
- QDate date(zeroEpoch);
- QTime time(0,0,0,0);
-
- int weekDays = int(GPSWeeks) / 86400;
- date = date.addDays( GPSWeek * 7 + weekDays );
- time = time.addMSecs( int( (GPSWeeks - 86400 * weekDays) * 1e3 ) );
-
- return QDateTime(date,time);
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void currentGPSWeeks(int& week, double& sec) {
-
- QDateTime currDateTimeGPS;
-
- if ( ((bncApp*) qApp)->_currentDateAndTimeGPS ) {
- currDateTimeGPS = *(((bncApp*) qApp)->_currentDateAndTimeGPS);
- }
- else {
- currDateTimeGPS = QDateTime::currentDateTime().toUTC();
- QDate hlp = currDateTimeGPS.date();
- currDateTimeGPS = currDateTimeGPS.addSecs(gnumleap(hlp.year(),
- hlp.month(), hlp.day()));
- }
-
- QDate currDateGPS = currDateTimeGPS.date();
- QTime currTimeGPS = currDateTimeGPS.time();
-
- week = int( (double(currDateGPS.toJulianDay()) - 2444244.5) / 7 );
-
- sec = (currDateGPS.dayOfWeek() % 7) * 24.0 * 3600.0 +
- currTimeGPS.hour() * 3600.0 +
- currTimeGPS.minute() * 60.0 +
- currTimeGPS.second() +
- currTimeGPS.msec() / 1000.0;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-QDateTime currentDateAndTimeGPS() {
- if ( ((bncApp*) qApp)->_currentDateAndTimeGPS ) {
- return *(((bncApp*) qApp)->_currentDateAndTimeGPS);
- }
- else {
- int GPSWeek;
- double GPSWeeks;
- currentGPSWeeks(GPSWeek, GPSWeeks);
- return dateAndTimeFromGPSweek(GPSWeek, GPSWeeks);
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-QByteArray ggaString(const QByteArray& latitude,
- const QByteArray& longitude,
- const QByteArray& height) {
-
- double lat = strtod(latitude,NULL);
- double lon = strtod(longitude,NULL);
- double hei = strtod(height,NULL);
-
- const char* flagN="N";
- const char* flagE="E";
- if (lon >180.) {lon=(lon-360.)*(-1.); flagE="W";}
- if ((lon < 0.) && (lon >= -180.)) {lon=lon*(-1.); flagE="W";}
- if (lon < -180.) {lon=(lon+360.); flagE="E";}
- if (lat < 0.) {lat=lat*(-1.); flagN="S";}
- QTime ttime(QDateTime::currentDateTime().toUTC().time());
- int lat_deg = (int)lat;
- double lat_min=(lat-lat_deg)*60.;
- int lon_deg = (int)lon;
- double lon_min=(lon-lon_deg)*60.;
- int hh = 0 , mm = 0;
- double ss = 0.0;
- hh=ttime.hour();
- mm=ttime.minute();
- ss=(double)ttime.second()+0.001*ttime.msec();
- QString gga;
- gga += "GPGGA,";
- gga += QString("%1%2%3,").arg((int)hh, 2, 10, QLatin1Char('0')).arg((int)mm, 2, 10, QLatin1Char('0')).arg((int)ss, 2, 10, QLatin1Char('0'));
- gga += QString("%1%2,").arg((int)lat_deg,2, 10, QLatin1Char('0')).arg(lat_min, 7, 'f', 4, QLatin1Char('0'));
- gga += flagN;
- gga += QString(",%1%2,").arg((int)lon_deg,3, 10, QLatin1Char('0')).arg(lon_min, 7, 'f', 4, QLatin1Char('0'));
- gga += flagE + QString(",1,05,1.00");
- gga += QString(",%1,").arg(hei, 2, 'f', 1);
- gga += QString("M,10.000,M,,");
- int xori;
- char XOR = 0;
- char *Buff =gga.toAscii().data();
- int iLen = strlen(Buff);
- for (xori = 0; xori < iLen; xori++) {
- XOR ^= (char)Buff[xori];
- }
- gga = "$" + gga + QString("*%1").arg(XOR, 2, 16, QLatin1Char('0'));
-
- return gga.toAscii();
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void RSW_to_XYZ(const ColumnVector& rr, const ColumnVector& vv,
- const ColumnVector& rsw, ColumnVector& xyz) {
-
- ColumnVector along = vv / vv.norm_Frobenius();
- ColumnVector cross = crossproduct(rr, vv); cross /= cross.norm_Frobenius();
- ColumnVector radial = crossproduct(along, cross);
-
- Matrix RR(3,3);
- RR.Column(1) = radial;
- RR.Column(2) = along;
- RR.Column(3) = cross;
-
- xyz = RR * rsw;
-}
-
-// Transformation xyz --> radial, along track, out-of-plane
-////////////////////////////////////////////////////////////////////////////
-void XYZ_to_RSW(const ColumnVector& rr, const ColumnVector& vv,
- const ColumnVector& xyz, ColumnVector& rsw) {
-
- ColumnVector along = vv / vv.norm_Frobenius();
- ColumnVector cross = crossproduct(rr, vv); cross /= cross.norm_Frobenius();
- ColumnVector radial = crossproduct(along, cross);
-
- rsw.ReSize(3);
- rsw(1) = DotProduct(xyz, radial);
- rsw(2) = DotProduct(xyz, along);
- rsw(3) = DotProduct(xyz, cross);
-}
-
-// Rectangular Coordinates -> Ellipsoidal Coordinates
-////////////////////////////////////////////////////////////////////////////
-t_irc xyz2ell(const double* XYZ, double* Ell) {
-
- const double bell = t_CST::aell*(1.0-1.0/t_CST::fInv) ;
- const double e2 = (t_CST::aell*t_CST::aell-bell*bell)/(t_CST::aell*t_CST::aell) ;
- const double e2c = (t_CST::aell*t_CST::aell-bell*bell)/(bell*bell) ;
-
- double nn, ss, zps, hOld, phiOld, theta, sin3, cos3;
-
- ss = sqrt(XYZ[0]*XYZ[0]+XYZ[1]*XYZ[1]) ;
- zps = XYZ[2]/ss ;
- theta = atan( (XYZ[2]*t_CST::aell) / (ss*bell) );
- sin3 = sin(theta) * sin(theta) * sin(theta);
- cos3 = cos(theta) * cos(theta) * cos(theta);
-
- // Closed formula
- Ell[0] = atan( (XYZ[2] + e2c * bell * sin3) / (ss - e2 * t_CST::aell * cos3) );
- Ell[1] = atan2(XYZ[1],XYZ[0]) ;
- nn = t_CST::aell/sqrt(1.0-e2*sin(Ell[0])*sin(Ell[0])) ;
- Ell[2] = ss / cos(Ell[0]) - nn;
-
- const int MAXITER = 100;
- for (int ii = 1; ii <= MAXITER; ii++) {
- nn = t_CST::aell/sqrt(1.0-e2*sin(Ell[0])*sin(Ell[0])) ;
- hOld = Ell[2] ;
- phiOld = Ell[0] ;
- Ell[2] = ss/cos(Ell[0])-nn ;
- Ell[0] = atan(zps/(1.0-e2*nn/(nn+Ell[2]))) ;
- if ( fabs(phiOld-Ell[0]) <= 1.0e-11 && fabs(hOld-Ell[2]) <= 1.0e-5 ) {
- return success;
- }
- }
-
- return failure;
-}
-
-// Rectangular Coordinates -> North, East, Up Components
-////////////////////////////////////////////////////////////////////////////
-void xyz2neu(const double* Ell, const double* xyz, double* neu) {
-
- double sinPhi = sin(Ell[0]);
- double cosPhi = cos(Ell[0]);
- double sinLam = sin(Ell[1]);
- double cosLam = cos(Ell[1]);
-
- neu[0] = - sinPhi*cosLam * xyz[0]
- - sinPhi*sinLam * xyz[1]
- + cosPhi * xyz[2];
-
- neu[1] = - sinLam * xyz[0]
- + cosLam * xyz[1];
-
- neu[2] = + cosPhi*cosLam * xyz[0]
- + cosPhi*sinLam * xyz[1]
- + sinPhi * xyz[2];
-}
-
-// North, East, Up Components -> Rectangular Coordinates
-////////////////////////////////////////////////////////////////////////////
-void neu2xyz(const double* Ell, const double* neu, double* xyz) {
-
- double sinPhi = sin(Ell[0]);
- double cosPhi = cos(Ell[0]);
- double sinLam = sin(Ell[1]);
- double cosLam = cos(Ell[1]);
-
- xyz[0] = - sinPhi*cosLam * neu[0]
- - sinLam * neu[1]
- + cosPhi*cosLam * neu[2];
-
- xyz[1] = - sinPhi*sinLam * neu[0]
- + cosLam * neu[1]
- + cosPhi*sinLam * neu[2];
-
- xyz[2] = + cosPhi * neu[0]
- + sinPhi * neu[2];
-}
-
-// Fourth order Runge-Kutta numerical integrator for ODEs
-////////////////////////////////////////////////////////////////////////////
-ColumnVector rungeKutta4(
- double xi, // the initial x-value
- const ColumnVector& yi, // vector of the initial y-values
- double dx, // the step size for the integration
- double* acc, // aditional acceleration
- ColumnVector (*der)(double x, const ColumnVector& y, double* acc)
- // A pointer to a function that computes the
- // derivative of a function at a point (x,y)
- ) {
-
- ColumnVector k1 = der(xi , yi , acc) * dx;
- ColumnVector k2 = der(xi+dx/2.0, yi+k1/2.0, acc) * dx;
- ColumnVector k3 = der(xi+dx/2.0, yi+k2/2.0, acc) * dx;
- ColumnVector k4 = der(xi+dx , yi+k3 , acc) * dx;
-
- ColumnVector yf = yi + k1/6.0 + k2/3.0 + k3/3.0 + k4/6.0;
-
- return yf;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-double djul(int jj, int mm, double tt) {
- int ii, kk;
- double djul ;
- if( mm <= 2 ) {
- jj = jj - 1;
- mm = mm + 12;
- }
- ii = jj/100;
- kk = 2 - ii + ii/4;
- djul = (365.25*jj - fmod( 365.25*jj, 1.0 )) - 679006.0;
- djul = djul + floor( 30.6001*(mm + 1) ) + tt + kk;
- return djul;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void jdgp(double tjul, double & second, int & nweek) {
- double deltat;
- deltat = tjul - 44244.0 ;
- // current gps week
- nweek = (int) floor(deltat/7.0);
- // seconds past midnight of last weekend
- second = (deltat - (nweek)*7.0)*86400.0;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void GPSweekFromDateAndTime(const QDateTime& dateTime,
- int& GPSWeek, double& GPSWeeks) {
-
- static const QDateTime zeroEpoch(QDate(1980, 1, 6),QTime(),Qt::UTC);
-
- GPSWeek = zeroEpoch.daysTo(dateTime) / 7;
-
- int weekDay = dateTime.date().dayOfWeek() + 1; // Qt: Monday = 1
- if (weekDay > 7) weekDay = 1;
-
- GPSWeeks = (weekDay - 1) * 86400.0
- - dateTime.time().msecsTo(QTime()) / 1e3;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void GPSweekFromYMDhms(int year, int month, int day, int hour, int min,
- double sec, int& GPSWeek, double& GPSWeeks) {
-
- double mjd = djul(year, month, day);
-
- jdgp(mjd, GPSWeeks, GPSWeek);
- GPSWeeks += hour * 3600.0 + min * 60.0 + sec;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void mjdFromDateAndTime(const QDateTime& dateTime, int& mjd, double& dayfrac) {
-
- static const QDate zeroDate(1858, 11, 17);
-
- mjd = zeroDate.daysTo(dateTime.date());
-
- dayfrac = (dateTime.time().hour() +
- (dateTime.time().minute() +
- (dateTime.time().second() +
- dateTime.time().msec() / 1000.0) / 60.0) / 60.0) / 24.0;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-bool findInVector(const vector& vv, const QString& str) {
- std::vector::const_iterator it;
- for (it = vv.begin(); it != vv.end(); ++it) {
- if ( (*it) == str) {
- return true;
- }
- }
- return false;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-int readInt(const QString& str, int pos, int len, int& value) {
- bool ok;
- value = str.mid(pos, len).toInt(&ok);
- return ok ? 0 : 1;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-int readDbl(const QString& str, int pos, int len, double& value) {
- QString hlp = str.mid(pos, len);
- for (int ii = 0; ii < hlp.length(); ii++) {
- if (hlp[ii]=='D' || hlp[ii]=='d' || hlp[ii] == 'E') {
- hlp[ii]='e';
- }
- }
- bool ok;
- value = hlp.toDouble(&ok);
- return ok ? 0 : 1;
-}
Index: trunk/BNC/bncutils.h
===================================================================
--- trunk/BNC/bncutils.h (revision 4277)
+++ (revision )
@@ -1,78 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCUTILS_H
-#define BNCUTILS_H
-
-#include
-
-#include
-#include
-
-#include
-#include
-
-void expandEnvVar(QString& str);
-
-QDateTime dateAndTimeFromGPSweek(int GPSWeek, double GPSWeeks);
-
-void currentGPSWeeks(int& week, double& sec);
-
-QDateTime currentDateAndTimeGPS();
-
-QByteArray ggaString(const QByteArray& latitude,
- const QByteArray& longitude,
- const QByteArray& height);
-
-void RSW_to_XYZ(const ColumnVector& rr, const ColumnVector& vv,
- const ColumnVector& rsw, ColumnVector& xyz);
-
-void XYZ_to_RSW(const ColumnVector& rr, const ColumnVector& vv,
- const ColumnVector& xyz, ColumnVector& rsw);
-
-t_irc xyz2ell(const double* XYZ, double* Ell);
-
-void xyz2neu(const double* Ell, const double* xyz, double* neu);
-
-void neu2xyz(const double* Ell, const double* neu, double* xyz);
-
-ColumnVector rungeKutta4(double xi, const ColumnVector& yi, double dx,
- double* acc,
- ColumnVector (*der)(double x, const ColumnVector& y, double* acc));
-
-void GPSweekFromDateAndTime(const QDateTime& dateTime,
- int& GPSWeek, double& GPSWeeks);
-
-void GPSweekFromYMDhms(int year, int month, int day, int hour, int min,
- double sec, int& GPSWeek, double& GPSWeeks);
-
-void mjdFromDateAndTime(const QDateTime& dateTime, int& mjd, double& dayfrac);
-
-bool findInVector(const std::vector& vv, const QString& str);
-
-int readInt(const QString& str, int pos, int len, int& value);
-
-int readDbl(const QString& str, int pos, int len, double& value);
-
-#endif
Index: trunk/BNC/bncversion.h
===================================================================
--- trunk/BNC/bncversion.h (revision 4277)
+++ (revision )
@@ -1,8 +1,0 @@
-
-#ifndef BNCVERSION_H
-#define BNCVERSION_H
-
-#define BNCVERSION "2.7"
-#define BNCPGMNAME "BNC 2.7"
-
-#endif
Index: trunk/BNC/bncwindow.cpp
===================================================================
--- trunk/BNC/bncwindow.cpp (revision 4277)
+++ (revision )
@@ -1,2640 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncWindow
- *
- * Purpose: This class implements the main application window.
- *
- * Author: L. Mervart
- *
- * Created: 24-Dec-2005
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-
-#include
-#include "bncwindow.h"
-#include "bncapp.h"
-#include "bncgetthread.h"
-#include "bnctabledlg.h"
-#include "bncipport.h"
-#include "bncudpport.h"
-#include "bncserialport.h"
-#include "bnchlpdlg.h"
-#include "bnchtml.h"
-#include "bnctableitem.h"
-#include "bncsettings.h"
-#include "bncfigure.h"
-#include "bncfigurelate.h"
-#include "bncfigureppp.h"
-#include "bncversion.h"
-#include "bncbytescounter.h"
-#include "bncsslconfig.h"
-#include "upload/bnccustomtrafo.h"
-#include "upload/bncephuploadcaster.h"
-#include "qtfilechooser.h"
-#include "reqcdlg.h"
-#ifdef USE_POSTPROCESSING
-# include "rinex/bncpostprocess.h"
-# include "rinex/reqcedit.h"
-# include "rinex/reqcanalyze.h"
-#endif
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-bncWindow::bncWindow() {
-
- _caster = 0;
- _casterEph = 0;
-
- _bncFigure = new bncFigure(this);
- _bncFigureLate = new bncFigureLate(this);
- _bncFigurePPP = new bncFigurePPP(this);
- _runningRealTime = false;
- _runningPostProcessingPPP = false;
- _runningPostProcessingReqc = false;
-
- _pppSPPComboBox = 0; // necessary for enableStartStop()
- _reqcActionComboBox = 0; // necessary for enableStartStop()
-
- int ww = QFontMetrics(this->font()).width('w');
-
- static const QStringList labels = QString("account, Streams: resource loader / mountpoint, decoder, lat, long, nmea, ntrip, bytes").split(",");
-
- setMinimumSize(85*ww, 65*ww);
-
- setWindowTitle(tr("BKG Ntrip Client (BNC) Version " BNCVERSION));
-
- connect((bncApp*)qApp, SIGNAL(newMessage(QByteArray,bool)),
- this, SLOT(slotWindowMessage(QByteArray,bool)));
-
- // Create Actions
- // --------------
- _actHelp = new QAction(tr("&Help Contents"),this);
- connect(_actHelp, SIGNAL(triggered()), SLOT(slotHelp()));
-
- _actAbout = new QAction(tr("&About BNC"),this);
- connect(_actAbout, SIGNAL(triggered()), SLOT(slotAbout()));
-
- _actFlowchart = new QAction(tr("&Flow Chart"),this);
- connect(_actFlowchart, SIGNAL(triggered()), SLOT(slotFlowchart()));
-
- _actFontSel = new QAction(tr("Select &Font"),this);
- connect(_actFontSel, SIGNAL(triggered()), SLOT(slotFontSel()));
-
- _actSaveOpt = new QAction(tr("&Save && Reread Configuration"),this);
- connect(_actSaveOpt, SIGNAL(triggered()), SLOT(slotSaveOptions()));
-
- _actQuit = new QAction(tr("&Quit"),this);
- connect(_actQuit, SIGNAL(triggered()), SLOT(close()));
-
- _actAddMountPoints = new QAction(tr("Add &Stream"),this);
- connect(_actAddMountPoints, SIGNAL(triggered()), SLOT(slotAddMountPoints()));
-
- _actDeleteMountPoints = new QAction(tr("&Delete Stream"),this);
- connect(_actDeleteMountPoints, SIGNAL(triggered()), SLOT(slotDeleteMountPoints()));
- _actDeleteMountPoints->setEnabled(false);
-
- _actStart = new QAction(tr("Sta&rt"),this);
- connect(_actStart, SIGNAL(triggered()), SLOT(slotStart()));
-
- _actStop = new QAction(tr("Sto&p"),this);
- connect(_actStop, SIGNAL(triggered()), SLOT(slotStop()));
-
- _actwhatsthis= new QAction(tr("Help ?=Shift+F1"),this);
- connect(_actwhatsthis, SIGNAL(triggered()), SLOT(slotWhatsThis()));
-
- CreateMenu();
- AddToolbar();
-
- bncSettings settings;
-
- // Network Options
- // ---------------
- _proxyHostLineEdit = new QLineEdit(settings.value("proxyHost").toString());
- _proxyPortLineEdit = new QLineEdit(settings.value("proxyPort").toString());
-
- connect(_proxyHostLineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- _sslCaCertPathLineEdit = new QLineEdit(settings.value("sslCaCertPath").toString());
- _ignoreSslErrorsCheckBox = new QCheckBox();
- _ignoreSslErrorsCheckBox->setCheckState(Qt::CheckState(
- settings.value("ignoreSslErrors").toInt()));
-
- // General Options
- // ---------------
- _logFileLineEdit = new QLineEdit(settings.value("logFile").toString());
- _rawOutFileLineEdit = new QLineEdit(settings.value("rawOutFile").toString());
- _rnxAppendCheckBox = new QCheckBox();
- _rnxAppendCheckBox->setCheckState(Qt::CheckState(
- settings.value("rnxAppend").toInt()));
- _onTheFlyComboBox = new QComboBox();
- _onTheFlyComboBox->setEditable(false);
- _onTheFlyComboBox->addItems(QString("1 day,1 hour,1 min").split(","));
- int ii = _onTheFlyComboBox->findText(settings.value("onTheFlyInterval").toString());
- if (ii != -1) {
- _onTheFlyComboBox->setCurrentIndex(ii);
- }
- _autoStartCheckBox = new QCheckBox();
- _autoStartCheckBox->setCheckState(Qt::CheckState(
- settings.value("autoStart").toInt()));
-
- // RINEX Observations Options
- // --------------------------
- _rnxPathLineEdit = new QLineEdit(settings.value("rnxPath").toString());
- _rnxIntrComboBox = new QComboBox();
- _rnxIntrComboBox->setEditable(false);
- _rnxIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
- ii = _rnxIntrComboBox->findText(settings.value("rnxIntr").toString());
- if (ii != -1) {
- _rnxIntrComboBox->setCurrentIndex(ii);
- }
- _rnxSamplSpinBox = new QSpinBox();
- _rnxSamplSpinBox->setMinimum(0);
- _rnxSamplSpinBox->setMaximum(60);
- _rnxSamplSpinBox->setSingleStep(5);
- _rnxSamplSpinBox->setValue(settings.value("rnxSampl").toInt());
- _rnxSamplSpinBox->setSuffix(" sec");
- _rnxSkelLineEdit = new QLineEdit(settings.value("rnxSkel").toString());
- _rnxSkelLineEdit->setMaximumWidth(5*ww);
- _rnxScrpLineEdit = new QLineEdit(settings.value("rnxScript").toString());
- _rnxV3CheckBox = new QCheckBox();
- _rnxV3CheckBox->setCheckState(Qt::CheckState(settings.value("rnxV3").toInt()));
-
- connect(_rnxPathLineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- // RINEX Ephemeris Options
- // -----------------------
- _ephPathLineEdit = new QLineEdit(settings.value("ephPath").toString());
- _ephIntrComboBox = new QComboBox();
- _ephIntrComboBox->setEditable(false);
- _ephIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
- int jj = _ephIntrComboBox->findText(settings.value("ephIntr").toString());
- if (jj != -1) {
- _ephIntrComboBox->setCurrentIndex(jj);
- }
- _outEphPortLineEdit = new QLineEdit(settings.value("outEphPort").toString());
- _ephV3CheckBox = new QCheckBox();
- _ephV3CheckBox->setCheckState(Qt::CheckState(settings.value("ephV3").toInt()));
-
- connect(_outEphPortLineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- connect(_ephPathLineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- // Broadcast Corrections Options
- // -----------------------------
- _corrPathLineEdit = new QLineEdit(settings.value("corrPath").toString());
- _corrIntrComboBox = new QComboBox();
- _corrIntrComboBox->setEditable(false);
- _corrIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
- int mm = _corrIntrComboBox->findText(settings.value("corrIntr").toString());
- if (mm != -1) {
- _corrIntrComboBox->setCurrentIndex(mm);
- }
- _corrPortLineEdit = new QLineEdit(settings.value("corrPort").toString());
- _corrTimeSpinBox = new QSpinBox();
- _corrTimeSpinBox->setMinimum(0);
- _corrTimeSpinBox->setMaximum(60);
- _corrTimeSpinBox->setSingleStep(1);
- _corrTimeSpinBox->setSuffix(" sec");
- _corrTimeSpinBox->setValue(settings.value("corrTime").toInt());
-
- connect(_corrPathLineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- connect(_corrPortLineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- // Feed Engine Options
- // -------------------
- _outPortLineEdit = new QLineEdit(settings.value("outPort").toString());
- _waitTimeSpinBox = new QSpinBox();
- _waitTimeSpinBox->setMinimum(1);
- _waitTimeSpinBox->setMaximum(30);
- _waitTimeSpinBox->setSingleStep(1);
- _waitTimeSpinBox->setSuffix(" sec");
- _waitTimeSpinBox->setValue(settings.value("waitTime").toInt());
- _binSamplSpinBox = new QSpinBox();
- _binSamplSpinBox->setMinimum(0);
- _binSamplSpinBox->setMaximum(60);
- _binSamplSpinBox->setSingleStep(5);
- _binSamplSpinBox->setValue(settings.value("binSampl").toInt());
- _binSamplSpinBox->setSuffix(" sec");
- _outFileLineEdit = new QLineEdit(settings.value("outFile").toString());
- _outUPortLineEdit = new QLineEdit(settings.value("outUPort").toString());
-
- connect(_outPortLineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- connect(_outFileLineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- // Serial Output Options
- // ---------------------
- _serialMountPointLineEdit = new QLineEdit(settings.value("serialMountPoint").toString());
- _serialPortNameLineEdit = new QLineEdit(settings.value("serialPortName").toString());
- _serialBaudRateComboBox = new QComboBox();
- _serialBaudRateComboBox->addItems(QString("110,300,600,"
- "1200,2400,4800,9600,19200,38400,57600,115200").split(","));
- int kk = _serialBaudRateComboBox->findText(settings.value("serialBaudRate").toString());
- if (kk != -1) {
- _serialBaudRateComboBox->setCurrentIndex(kk);
- }
- _serialFlowControlComboBox = new QComboBox();
- _serialFlowControlComboBox->addItems(QString("OFF,XONXOFF,HARDWARE").split(","));
- kk = _serialFlowControlComboBox->findText(settings.value("serialFlowControl").toString());
- if (kk != -1) {
- _serialFlowControlComboBox->setCurrentIndex(kk);
- }
- _serialDataBitsComboBox = new QComboBox();
- _serialDataBitsComboBox->addItems(QString("5,6,7,8").split(","));
- kk = _serialDataBitsComboBox->findText(settings.value("serialDataBits").toString());
- if (kk != -1) {
- _serialDataBitsComboBox->setCurrentIndex(kk);
- }
- _serialParityComboBox = new QComboBox();
- _serialParityComboBox->addItems(QString("NONE,ODD,EVEN,SPACE").split(","));
- kk = _serialParityComboBox->findText(settings.value("serialParity").toString());
- if (kk != -1) {
- _serialParityComboBox->setCurrentIndex(kk);
- }
- _serialStopBitsComboBox = new QComboBox();
- _serialStopBitsComboBox->addItems(QString("1,2").split(","));
- kk = _serialStopBitsComboBox->findText(settings.value("serialStopBits").toString());
- if (kk != -1) {
- _serialStopBitsComboBox->setCurrentIndex(kk);
- }
- _serialAutoNMEAComboBox = new QComboBox();
- _serialAutoNMEAComboBox->addItems(QString("Auto,Manual").split(","));
- kk = _serialAutoNMEAComboBox->findText(settings.value("serialAutoNMEA").toString());
- if (kk != -1) {
- _serialAutoNMEAComboBox->setCurrentIndex(kk);
- }
- _serialFileNMEALineEdit = new QLineEdit(settings.value("serialFileNMEA").toString());
- _serialHeightNMEALineEdit = new QLineEdit(settings.value("serialHeightNMEA").toString());
-
- connect(_serialMountPointLineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- connect(_serialAutoNMEAComboBox, SIGNAL(currentIndexChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- // Outages Options
- // ---------------
- _obsRateComboBox = new QComboBox();
- _obsRateComboBox->setEditable(false);
- _obsRateComboBox->addItems(QString(",0.1 Hz,0.2 Hz,0.5 Hz,1 Hz,5 Hz").split(","));
- kk = _obsRateComboBox->findText(settings.value("obsRate").toString());
- if (kk != -1) {
- _obsRateComboBox->setCurrentIndex(kk);
- }
- _adviseFailSpinBox = new QSpinBox();
- _adviseFailSpinBox->setMinimum(0);
- _adviseFailSpinBox->setMaximum(60);
- _adviseFailSpinBox->setSingleStep(1);
- _adviseFailSpinBox->setSuffix(" min");
- _adviseFailSpinBox->setValue(settings.value("adviseFail").toInt());
- _adviseRecoSpinBox = new QSpinBox();
- _adviseRecoSpinBox->setMinimum(0);
- _adviseRecoSpinBox->setMaximum(60);
- _adviseRecoSpinBox->setSingleStep(1);
- _adviseRecoSpinBox->setSuffix(" min");
- _adviseRecoSpinBox->setValue(settings.value("adviseReco").toInt());
- _adviseScriptLineEdit = new QLineEdit(settings.value("adviseScript").toString());
-
- connect(_obsRateComboBox, SIGNAL(currentIndexChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- // Miscellaneous Options
- // ---------------------
- _miscMountLineEdit = new QLineEdit(settings.value("miscMount").toString());
- _perfIntrComboBox = new QComboBox();
- _perfIntrComboBox->setEditable(false);
- _perfIntrComboBox->addItems(QString(",2 sec, 10 sec,1 min,5 min,15 min,1 hour,6 hours,1 day").split(","));
- int ll = _perfIntrComboBox->findText(settings.value("perfIntr").toString());
- if (ll != -1) {
- _perfIntrComboBox->setCurrentIndex(ll);
- }
- _scanRTCMCheckBox = new QCheckBox();
- _scanRTCMCheckBox->setCheckState(Qt::CheckState(
- settings.value("scanRTCM").toInt()));
-
- connect(_miscMountLineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- // PPP Options
- // -----------
- _pppMountLineEdit = new QLineEdit(settings.value("pppMount").toString());
- _pppMountLineEdit->setMaximumWidth(8*ww);
- _pppCorrMountLineEdit = new QLineEdit(settings.value("pppCorrMount").toString());
- _pppMountLineEdit->setMinimumWidth(8*ww);
- _pppCorrMountLineEdit->setMinimumWidth(8*ww);
- _pppCorrMountLineEdit->setMaximumWidth(8*ww);
- _pppNMEALineEdit = new QLineEdit(settings.value("nmeaFile").toString());
- _pppNMEALineEdit->setMinimumWidth(15*ww);
- _pppNMEAPortLineEdit = new QLineEdit(settings.value("nmeaPort").toString());
- _pppNMEAPortLineEdit->setMaximumWidth(8*ww);
- _pppNMEAPortLineEdit->setMinimumWidth(8*ww);
- _pppSigCLineEdit = new QLineEdit(settings.value("pppSigmaCode").toString());
- _pppSigPLineEdit = new QLineEdit(settings.value("pppSigmaPhase").toString());
- _pppSigCrd0 = new QLineEdit(settings.value("pppSigCrd0").toString());
- _pppSigCrdP = new QLineEdit(settings.value("pppSigCrdP").toString());
- _pppSigTrp0 = new QLineEdit(settings.value("pppSigTrp0").toString());
- _pppSigTrpP = new QLineEdit(settings.value("pppSigTrpP").toString());
- _pppAverageLineEdit = new QLineEdit(settings.value("pppAverage").toString());
- _pppQuickStartLineEdit = new QLineEdit(settings.value("pppQuickStart").toString());
- _pppMaxSolGapLineEdit = new QLineEdit(settings.value("pppMaxSolGap").toString());
- _pppRefCrdXLineEdit = new QLineEdit(settings.value("pppRefCrdX").toString());
- _pppRefCrdYLineEdit = new QLineEdit(settings.value("pppRefCrdY").toString());
- _pppRefCrdZLineEdit = new QLineEdit(settings.value("pppRefCrdZ").toString());
- _pppRefdNLineEdit = new QLineEdit(settings.value("pppRefdN").toString());
- _pppRefdELineEdit = new QLineEdit(settings.value("pppRefdE").toString());
- _pppRefdULineEdit = new QLineEdit(settings.value("pppRefdU").toString());
- _pppSync = new QLineEdit(settings.value("pppSync").toString());
- _pppAntexFileChooser = new qtFileChooser;
- _pppAntexFileChooser->setMinimumWidth(12*ww);
- _pppAntennaLineEdit = new QLineEdit(settings.value("pppAntenna").toString());
- _pppAntexFileChooser->setFileName(settings.value("pppAntex").toString());
-
- _pppSPPComboBox = new QComboBox();
- _pppSPPComboBox->setEditable(false);
- _pppSPPComboBox->addItems(QString(",Realtime-PPP,Realtime-SPP,Post-Processing").split(","));
- int ik = _pppSPPComboBox->findText(settings.value("pppSPP").toString());
- if (ik != -1) {
- _pppSPPComboBox->setCurrentIndex(ik);
- }
- _pppUsePhaseCheckBox = new QCheckBox();
- _pppUsePhaseCheckBox->setCheckState(Qt::CheckState(
- settings.value("pppUsePhase").toInt()));
- _pppEstTropoCheckBox = new QCheckBox();
- _pppEstTropoCheckBox->setCheckState(Qt::CheckState(
- settings.value("pppEstTropo").toInt()));
- _pppGLONASSCheckBox = new QCheckBox();
- _pppGLONASSCheckBox->setCheckState(Qt::CheckState(
- settings.value("pppGLONASS").toInt()));
- _pppGalileoCheckBox = new QCheckBox();
- _pppGalileoCheckBox->setCheckState(Qt::CheckState(
- settings.value("pppGalileo").toInt()));
-
- _pppPlotCoordinates = new QCheckBox();
- _pppPlotCoordinates->setCheckState(Qt::CheckState(
- settings.value("pppPlotCoordinates").toInt()));
-
- connect(_pppMountLineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- connect(_pppCorrMountLineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- connect(_pppUsePhaseCheckBox, SIGNAL(stateChanged(int)),
- this, SLOT(slotBncTextChanged()));
-
- connect(_pppRefCrdXLineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
- connect(_pppRefCrdYLineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
- connect(_pppRefCrdZLineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
- connect(_pppRefdNLineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
- connect(_pppRefdELineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
- connect(_pppRefdULineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- connect(_pppEstTropoCheckBox, SIGNAL(stateChanged(int)),
- this, SLOT(slotBncTextChanged()));
-
- connect(_pppSync, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- connect(_pppSPPComboBox, SIGNAL(currentIndexChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- connect(_pppAntexFileChooser, SIGNAL(fileNameChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- connect(_pppQuickStartLineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- // Streams
- // -------
- _mountPointsTable = new QTableWidget(0,8);
-
- _mountPointsTable->horizontalHeader()->resizeSection(1,34*ww);
- _mountPointsTable->horizontalHeader()->resizeSection(2,9*ww);
- _mountPointsTable->horizontalHeader()->resizeSection(3,7*ww);
- _mountPointsTable->horizontalHeader()->resizeSection(4,7*ww);
- _mountPointsTable->horizontalHeader()->resizeSection(5,5*ww);
- _mountPointsTable->horizontalHeader()->resizeSection(6,5*ww);
- _mountPointsTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
- _mountPointsTable->horizontalHeader()->setStretchLastSection(true);
- _mountPointsTable->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
-_mountPointsTable->setHorizontalHeaderLabels(labels);
- _mountPointsTable->setGridStyle(Qt::NoPen);
- _mountPointsTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- _mountPointsTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
- _mountPointsTable->setSelectionBehavior(QAbstractItemView::SelectRows);
- _mountPointsTable->hideColumn(0);
- connect(_mountPointsTable, SIGNAL(itemSelectionChanged()),
- SLOT(slotSelectionChanged()));
- populateMountPointsTable();
-
- _log = new QTextBrowser();
- _log->setReadOnly(true);
-
- // Combine Corrections
- // -------------------
- _cmbTable = new QTableWidget(0,3);
- _cmbTable->setHorizontalHeaderLabels(QString("Mountpoint, AC Name, Weight").split(","));
- _cmbTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
- _cmbTable->setSelectionBehavior(QAbstractItemView::SelectRows);
- _cmbTable->setMaximumWidth(30*ww);
- _cmbTable->horizontalHeader()->resizeSection(0,10*ww);
- _cmbTable->horizontalHeader()->resizeSection(1,8*ww);
- _cmbTable->horizontalHeader()->resizeSection(2,8*ww);
- _cmbTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
- _cmbTable->horizontalHeader()->setStretchLastSection(true);
- _cmbTable->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
-
- _cmbMaxresLineEdit = new QLineEdit(settings.value("cmbMaxres").toString());
-
- _cmbSamplSpinBox = new QSpinBox;
- _cmbSamplSpinBox->setMinimum(10);
- _cmbSamplSpinBox->setMaximum(60);
- _cmbSamplSpinBox->setSingleStep(10);
- _cmbSamplSpinBox->setMaximumWidth(9*ww);
- _cmbSamplSpinBox->setValue(settings.value("cmbSampl").toInt());
- _cmbSamplSpinBox->setSuffix(" sec");
-
- QPushButton* addCmbRowButton = new QPushButton("Add Row");
- QPushButton* delCmbRowButton = new QPushButton("Delete");
-
- connect(_cmbTable, SIGNAL(itemSelectionChanged()),
- SLOT(slotBncTextChanged()));
-
- _cmbMethodComboBox = new QComboBox();
- _cmbMethodComboBox->setEditable(false);
- _cmbMethodComboBox->addItems(QString("Filter,Single-Epoch").split(","));
- int im = _cmbMethodComboBox->findText(settings.value("cmbMethod").toString());
- if (im != -1) {
- _cmbMethodComboBox->setCurrentIndex(im);
- }
-
- int iRow = _cmbTable->rowCount();
- if (iRow > 0) {
- enableWidget(true, _cmbMethodComboBox);
- _cmbMaxresLineEdit->setStyleSheet("background-color: white");
- _cmbMaxresLineEdit->setEnabled(true);
- _cmbSamplSpinBox->setEnabled(true);
- }
- else {
- enableWidget(false, _cmbMethodComboBox);
- _cmbMaxresLineEdit->setStyleSheet("background-color: lightGray");
- _cmbMaxresLineEdit->setEnabled(false);
- _cmbSamplSpinBox->setEnabled(false);
- }
-
- // Upload Results
- // -------------
- _uploadTable = new QTableWidget(0,12);
- _uploadTable->setHorizontalHeaderLabels(QString("Host, Port, Mount, Password, System, CoM, SP3 File, RNX File, PID, SID, IOD, bytes").split(","));
- _uploadTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
- _uploadTable->setSelectionBehavior(QAbstractItemView::SelectRows);
- _uploadTable->horizontalHeader()->resizeSection( 0,13*ww);
- _uploadTable->horizontalHeader()->resizeSection( 1, 5*ww);
- _uploadTable->horizontalHeader()->resizeSection( 2, 6*ww);
- _uploadTable->horizontalHeader()->resizeSection( 3, 8*ww);
- _uploadTable->horizontalHeader()->resizeSection( 4,11*ww);
- _uploadTable->horizontalHeader()->resizeSection( 5, 4*ww);
- _uploadTable->horizontalHeader()->resizeSection( 6,15*ww);
- _uploadTable->horizontalHeader()->resizeSection( 7,15*ww);
- _uploadTable->horizontalHeader()->resizeSection( 8, 4*ww);
- _uploadTable->horizontalHeader()->resizeSection( 9, 4*ww);
- _uploadTable->horizontalHeader()->resizeSection(10, 4*ww);
- _uploadTable->horizontalHeader()->resizeSection(11,12*ww);
- _uploadTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
- _uploadTable->horizontalHeader()->setStretchLastSection(true);
- _uploadTable->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
-
- connect(_uploadTable, SIGNAL(itemSelectionChanged()),
- SLOT(slotBncTextChanged()));
-
- QPushButton* addUploadRowButton = new QPushButton("Add Row");
- QPushButton* delUploadRowButton = new QPushButton("Del Row");
- QPushButton* setUploadTrafoButton = new QPushButton("Custom Trafo");
- _uploadIntrComboBox = new QComboBox;
- _uploadIntrComboBox->setEditable(false);
- _uploadIntrComboBox->addItems(QString("1 day,1 hour, 30 min,15 min,10 min,5 min,2 min,1 min").split(","));
- ii = _uploadIntrComboBox->findText(settings.value("uploadIntr").toString());
- if (ii != -1) {
- _uploadIntrComboBox->setCurrentIndex(ii);
- }
-
- _uploadSamplRtcmEphCorrSpinBox = new QSpinBox;
- _uploadSamplRtcmEphCorrSpinBox->setMinimum(0);
- _uploadSamplRtcmEphCorrSpinBox->setMaximum(60);
- _uploadSamplRtcmEphCorrSpinBox->setSingleStep(5);
- _uploadSamplRtcmEphCorrSpinBox->setMaximumWidth(9*ww);
- _uploadSamplRtcmEphCorrSpinBox->setValue(settings.value("uploadSamplRtcmEphCorr").toInt());
- _uploadSamplRtcmEphCorrSpinBox->setSuffix(" sec");
-
- _uploadSamplSp3SpinBox = new QSpinBox;
- _uploadSamplSp3SpinBox->setMinimum(0);
- _uploadSamplSp3SpinBox->setMaximum(15);
- _uploadSamplSp3SpinBox->setSingleStep(1);
- _uploadSamplSp3SpinBox->setMaximumWidth(9*ww);
- _uploadSamplSp3SpinBox->setValue(settings.value("uploadSamplSp3").toInt());
- _uploadSamplSp3SpinBox->setSuffix(" min");
-
- _uploadSamplClkRnxSpinBox = new QSpinBox;
- _uploadSamplClkRnxSpinBox->setMinimum(0);
- _uploadSamplClkRnxSpinBox->setMaximum(60);
- _uploadSamplClkRnxSpinBox->setSingleStep(5);
- _uploadSamplClkRnxSpinBox->setMaximumWidth(9*ww);
- _uploadSamplClkRnxSpinBox->setValue(settings.value("uploadSamplClkRnx").toInt());
- _uploadSamplClkRnxSpinBox->setSuffix(" sec");
-
- int iRowT = _uploadTable->rowCount();
- if (iRowT > 0) {
- enableWidget(true, _uploadIntrComboBox);
- enableWidget(true, _uploadSamplRtcmEphCorrSpinBox);
- enableWidget(true, _uploadSamplSp3SpinBox);
- enableWidget(true, _uploadSamplClkRnxSpinBox);
- }
- else {
- enableWidget(false, _uploadIntrComboBox);
- enableWidget(false, _uploadSamplRtcmEphCorrSpinBox);
- enableWidget(false, _uploadSamplSp3SpinBox);
- enableWidget(false, _uploadSamplClkRnxSpinBox);
- }
-
- // Upload RTCM3 Ephemeris
- // ----------------------
- _uploadEphHostLineEdit = new QLineEdit(settings.value("uploadEphHost").toString());
- _uploadEphPortLineEdit = new QLineEdit(settings.value("uploadEphPort").toString());
- _uploadEphPasswordLineEdit = new QLineEdit(settings.value("uploadEphPassword").toString());
- _uploadEphPasswordLineEdit->setEchoMode(QLineEdit::PasswordEchoOnEdit);
- _uploadEphMountpointLineEdit = new QLineEdit(settings.value("uploadEphMountpoint").toString());
- _uploadEphSampleSpinBox = new QSpinBox;
- _uploadEphSampleSpinBox->setMinimum(5);
- _uploadEphSampleSpinBox->setMaximum(60);
- _uploadEphSampleSpinBox->setSingleStep(5);
- _uploadEphSampleSpinBox->setMaximumWidth(9*ww);
- _uploadEphSampleSpinBox->setValue(settings.value("uploadEphSample").toInt());
- _uploadEphSampleSpinBox->setSuffix(" sec");
- _uploadEphBytesCounter = new bncBytesCounter;
-
- // Canvas with Editable Fields
- // ---------------------------
- _canvas = new QWidget;
- setCentralWidget(_canvas);
-
- _aogroup = new QTabWidget();
- QWidget* pgroup = new QWidget();
- QWidget* ggroup = new QWidget();
- QWidget* sgroup = new QWidget();
- QWidget* egroup = new QWidget();
- QWidget* agroup = new QWidget();
- QWidget* cgroup = new QWidget();
- QWidget* ogroup = new QWidget();
- QWidget* rgroup = new QWidget();
- QWidget* sergroup = new QWidget();
- QWidget* pppgroup = new QWidget();
- QWidget* ppp2group = new QWidget();
- QWidget* reqcgroup = new QWidget();
- QWidget* cmbgroup = new QWidget();
- QWidget* uploadgroup = new QWidget();
- QWidget* uploadEphgroup = new QWidget();
- _aogroup->addTab(pgroup,tr("Network"));
- _aogroup->addTab(ggroup,tr("General"));
- _aogroup->addTab(ogroup,tr("RINEX Observations"));
- _aogroup->addTab(egroup,tr("RINEX Ephemeris"));
- _aogroup->addTab(reqcgroup,tr("RINEX Editing && QC"));
- _aogroup->addTab(cgroup,tr("Broadcast Corrections"));
- _aogroup->addTab(sgroup,tr("Feed Engine"));
- _aogroup->addTab(sergroup,tr("Serial Output"));
- _aogroup->addTab(agroup,tr("Outages"));
- _aogroup->addTab(rgroup,tr("Miscellaneous"));
- _aogroup->addTab(pppgroup,tr("PPP (1)"));
- _aogroup->addTab(ppp2group,tr("PPP (2)"));
-#ifdef USE_COMBINATION
- _aogroup->addTab(cmbgroup,tr("Combine Corrections"));
-#endif
- _aogroup->addTab(uploadgroup,tr("Upload Corrections"));
- _aogroup->addTab(uploadEphgroup,tr("Upload Ephemeris"));
-
- // Log Tab
- // -------
- _loggroup = new QTabWidget();
- _loggroup->addTab(_log,tr("Log"));
- _loggroup->addTab(_bncFigure,tr("Throughput"));
- _loggroup->addTab(_bncFigureLate,tr("Latency"));
- _loggroup->addTab(_bncFigurePPP,tr("PPP Plot"));
-
- // Netowork (Proxy and SSL) Tab
- // ----------------------------
- QGridLayout* pLayout = new QGridLayout;
- pLayout->setColumnMinimumWidth(0,13*ww);
- _proxyPortLineEdit->setMaximumWidth(9*ww);
-
- pLayout->addWidget(new QLabel("Settings for proxy in protected networks and for SSL authorization, leave boxes blank if none."),0, 0, 1, 50);
- pLayout->addWidget(new QLabel("Proxy host"), 1, 0);
- pLayout->addWidget(_proxyHostLineEdit, 1, 1, 1,10);
- pLayout->addWidget(new QLabel("Proxy port"), 2, 0);
- pLayout->addWidget(_proxyPortLineEdit, 2, 1);
- pLayout->addWidget(new QLabel("Path to SSL Certificates"), 3, 0);
- pLayout->addWidget(_sslCaCertPathLineEdit, 3, 1, 1,10);
- pLayout->addWidget(new QLabel("Default: " + bncSslConfig::defaultPath()), 3,11, 1,20);
- pLayout->addWidget(new QLabel("Ignore SSL Authorization Errors"), 4, 0);
- pLayout->addWidget(_ignoreSslErrorsCheckBox, 4, 1, 1,10);
- pLayout->addWidget(new QLabel(" "), 4, 0);
- pLayout->addWidget(new QLabel(" "), 5, 0);
- pLayout->addWidget(new QLabel(" "), 6, 0);
- pgroup->setLayout(pLayout);
-
- // General Tab
- // -----------
- QGridLayout* gLayout = new QGridLayout;
- gLayout->setColumnMinimumWidth(0,14*ww);
- _onTheFlyComboBox->setMaximumWidth(9*ww);
-
- gLayout->addWidget(new QLabel("General settings for logfile, file handling, configuration on-the-fly, and auto-start."),0, 0, 1, 50);
- gLayout->addWidget(new QLabel("Logfile (full path)"), 1, 0);
- gLayout->addWidget(_logFileLineEdit, 1, 1, 1,30);
- gLayout->addWidget(new QLabel("Append files"), 2, 0);
- gLayout->addWidget(_rnxAppendCheckBox, 2, 1);
- gLayout->addWidget(new QLabel("Reread configuration"), 3, 0);
- gLayout->addWidget(_onTheFlyComboBox, 3, 1);
- gLayout->addWidget(new QLabel("Auto start"), 4, 0);
- gLayout->addWidget(_autoStartCheckBox, 4, 1);
- gLayout->addWidget(new QLabel("Raw output file (full path)"), 5, 0);
- gLayout->addWidget(_rawOutFileLineEdit, 5, 1, 1,30);
- gLayout->addWidget(new QLabel(" "), 6, 0);
- ggroup->setLayout(gLayout);
-
- // RINEX Observations
- // ------------------
- QGridLayout* oLayout = new QGridLayout;
- oLayout->setColumnMinimumWidth(0,14*ww);
- _rnxIntrComboBox->setMaximumWidth(9*ww);
- _rnxSamplSpinBox->setMaximumWidth(9*ww);
-
- oLayout->addWidget(new QLabel("Saving RINEX observation files."),0, 0, 1,50);
- oLayout->addWidget(new QLabel("Directory"), 1, 0);
- oLayout->addWidget(_rnxPathLineEdit, 1, 1, 1,24);
- oLayout->addWidget(new QLabel("Interval"), 2, 0);
- oLayout->addWidget(_rnxIntrComboBox, 2, 1);
- oLayout->addWidget(new QLabel(" Sampling"), 2, 2, Qt::AlignRight);
- oLayout->addWidget(_rnxSamplSpinBox, 2, 3, Qt::AlignLeft);
- oLayout->addWidget(new QLabel("Skeleton extension"), 3, 0);
- oLayout->addWidget(_rnxSkelLineEdit, 3, 1, 1, 1, Qt::AlignLeft);
- oLayout->addWidget(new QLabel("Script (full path)"), 4, 0);
- oLayout->addWidget(_rnxScrpLineEdit, 4, 1, 1,24);
- oLayout->addWidget(new QLabel("Version 3"), 5, 0);
- oLayout->addWidget(_rnxV3CheckBox, 5, 1);
- oLayout->addWidget(new QLabel(" "), 6, 0);
- ogroup->setLayout(oLayout);
-
- // RINEX Ephemeris
- // ---------------
- QGridLayout* eLayout = new QGridLayout;
- eLayout->setColumnMinimumWidth(0,14*ww);
- _ephIntrComboBox->setMaximumWidth(9*ww);
- _outEphPortLineEdit->setMaximumWidth(9*ww);
-
- eLayout->addWidget(new QLabel("Saving RINEX ephemeris files and ephemeris output through IP port."),0,0,1,50);
- eLayout->addWidget(new QLabel("Directory"), 1, 0);
- eLayout->addWidget(_ephPathLineEdit, 1, 1, 1,30);
- eLayout->addWidget(new QLabel("Interval"), 2, 0);
- eLayout->addWidget(_ephIntrComboBox, 2, 1);
- eLayout->addWidget(new QLabel("Port"), 3, 0);
- eLayout->addWidget(_outEphPortLineEdit, 3, 1);
- eLayout->addWidget(new QLabel("Version 3"), 4, 0);
- eLayout->addWidget(_ephV3CheckBox, 4, 1);
- eLayout->addWidget(new QLabel(" "), 5, 0);
- eLayout->addWidget(new QLabel(" "), 6, 0);
- egroup->setLayout(eLayout);
-
-
- // Broadcast Corrections
- // ---------------------
- QGridLayout* cLayout = new QGridLayout;
- cLayout->setColumnMinimumWidth(0,14*ww);
- _corrIntrComboBox->setMaximumWidth(9*ww);
- _corrPortLineEdit->setMaximumWidth(9*ww);
- _corrTimeSpinBox->setMaximumWidth(9*ww);
-
- cLayout->addWidget(new QLabel("Saving Broadcast Ephemeris correction files and correction output through IP port."),0,0,1,50);
- cLayout->addWidget(new QLabel("Directory, ASCII"), 1, 0);
- cLayout->addWidget(_corrPathLineEdit, 1, 1, 1,20);
- cLayout->addWidget(new QLabel("Interval"), 2, 0);
- cLayout->addWidget(_corrIntrComboBox, 2, 1);
- cLayout->addWidget(new QLabel("Port"), 3, 0);
- cLayout->addWidget(_corrPortLineEdit, 3, 1);
- cLayout->addWidget(new QLabel(" Wait for full corr epoch"), 3, 2, Qt::AlignRight);
- cLayout->addWidget(_corrTimeSpinBox, 3, 3, Qt::AlignLeft);
- cLayout->addWidget(new QLabel(" "), 4, 0);
- cLayout->addWidget(new QLabel(" "), 5, 0);
- cLayout->addWidget(new QLabel(" "), 6, 0);
- cgroup->setLayout(cLayout);
-
- // Feed Engine
- // -----------
- QGridLayout* sLayout = new QGridLayout;
- sLayout->setColumnMinimumWidth(0,14*ww);
- _outPortLineEdit->setMaximumWidth(9*ww);
- _waitTimeSpinBox->setMaximumWidth(9*ww);
- _binSamplSpinBox->setMaximumWidth(9*ww);
- _outUPortLineEdit->setMaximumWidth(9*ww);
-
- sLayout->addWidget(new QLabel("Output decoded observations in ASCII format to feed a real-time GNSS network engine."),0,0,1,50);
- sLayout->addWidget(new QLabel("Port"), 1, 0);
- sLayout->addWidget(_outPortLineEdit, 1, 1);
- sLayout->addWidget(new QLabel("Wait for full obs epoch"), 1, 2, Qt::AlignRight);
- sLayout->addWidget(_waitTimeSpinBox, 1, 3, Qt::AlignLeft);
- sLayout->addWidget(new QLabel("Sampling"), 2, 0);
- sLayout->addWidget(_binSamplSpinBox, 2, 1, Qt::AlignLeft);
- sLayout->addWidget(new QLabel("File (full path)"), 3, 0);
- sLayout->addWidget(_outFileLineEdit, 3, 1, 1, 20);
- sLayout->addWidget(new QLabel("Port (unsynchronized)"), 4, 0);
- sLayout->addWidget(_outUPortLineEdit, 4, 1);
- sLayout->addWidget(new QLabel(" "), 5, 0);
- sLayout->addWidget(new QLabel(" "), 6, 0);
- sgroup->setLayout(sLayout);
-
- // Serial Output
- // -------------
- QGridLayout* serLayout = new QGridLayout;
- serLayout->setColumnMinimumWidth(0,14*ww);
- _serialBaudRateComboBox->setMaximumWidth(9*ww);
- _serialFlowControlComboBox->setMaximumWidth(11*ww);
- _serialDataBitsComboBox->setMaximumWidth(5*ww);
- _serialParityComboBox->setMaximumWidth(9*ww);
- _serialStopBitsComboBox->setMaximumWidth(5*ww);
- _serialAutoNMEAComboBox->setMaximumWidth(9*ww);
- _serialHeightNMEALineEdit->setMaximumWidth(8*ww);
-
- serLayout->addWidget(new QLabel("Port settings to feed a serial connected receiver."),0,0,1,30);
- serLayout->addWidget(new QLabel("Mountpoint"), 1, 0, Qt::AlignLeft);
- serLayout->addWidget(_serialMountPointLineEdit, 1, 1, 1, 2);
- serLayout->addWidget(new QLabel("Port name"), 2, 0, Qt::AlignLeft);
- serLayout->addWidget(_serialPortNameLineEdit, 2, 1, 1, 2);
- serLayout->addWidget(new QLabel("Baud rate"), 3, 0, Qt::AlignLeft);
- serLayout->addWidget(_serialBaudRateComboBox, 3, 1);
- serLayout->addWidget(new QLabel("Flow control"), 3, 2, Qt::AlignRight);
- serLayout->addWidget(_serialFlowControlComboBox, 3, 3);
- serLayout->addWidget(new QLabel("Data bits"), 4, 0, Qt::AlignLeft);
- serLayout->addWidget(_serialDataBitsComboBox, 4, 1);
- serLayout->addWidget(new QLabel("Parity"), 4, 2, Qt::AlignRight);
- serLayout->addWidget(_serialParityComboBox, 4, 3);
- serLayout->addWidget(new QLabel(" Stop bits"), 4, 4, Qt::AlignRight);
- serLayout->addWidget(_serialStopBitsComboBox, 4, 5);
- serLayout->addWidget(new QLabel("NMEA"), 5, 0);
- serLayout->addWidget(_serialAutoNMEAComboBox, 5, 1);
- serLayout->addWidget(new QLabel(" File (full path)"), 5, 2, Qt::AlignRight);
- serLayout->addWidget(_serialFileNMEALineEdit, 5, 3, 1,15);
- serLayout->addWidget(new QLabel("Height"), 5,20, Qt::AlignRight);
- serLayout->addWidget(_serialHeightNMEALineEdit, 5,21, 1,11);
- serLayout->addWidget(new QLabel(" "), 6, 0);
-
- sergroup->setLayout(serLayout);
-
- // Outages
- // -------
- QGridLayout* aLayout = new QGridLayout;
- aLayout->setColumnMinimumWidth(0,14*ww);
- _obsRateComboBox->setMaximumWidth(9*ww);
- _adviseFailSpinBox->setMaximumWidth(9*ww);
- _adviseRecoSpinBox->setMaximumWidth(9*ww);
-
- aLayout->addWidget(new QLabel("Failure and recovery reports, advisory notes."),0,0,1,50,Qt::AlignLeft);
- aLayout->addWidget(new QLabel("Observation rate"), 1, 0);
- aLayout->addWidget(_obsRateComboBox, 1, 1);
- aLayout->addWidget(new QLabel("Failure threshold"), 2, 0);
- aLayout->addWidget(_adviseFailSpinBox, 2, 1);
- aLayout->addWidget(new QLabel("Recovery threshold"), 3, 0);
- aLayout->addWidget(_adviseRecoSpinBox, 3, 1);
- aLayout->addWidget(new QLabel("Script (full path)"), 4, 0);
- aLayout->addWidget(_adviseScriptLineEdit, 4, 1, 1,30);
- aLayout->addWidget(new QLabel(" "), 5, 0);
- aLayout->addWidget(new QLabel(" "), 6, 0);
- agroup->setLayout(aLayout);
-
- // Miscellaneous
- // -------------
- QGridLayout* rLayout = new QGridLayout;
- rLayout->setColumnMinimumWidth(0,14*ww);
- _perfIntrComboBox->setMaximumWidth(9*ww);
-
- rLayout->addWidget(new QLabel("Log latencies or scan RTCM streams for numbers of message types and antenna information."),0, 0,1,30);
- rLayout->addWidget(new QLabel("Mountpoint"), 1, 0);
- rLayout->addWidget(_miscMountLineEdit, 1, 1, 1,7);
- rLayout->addWidget(new QLabel("Log latency"), 2, 0);
- rLayout->addWidget(_perfIntrComboBox, 2, 1);
- rLayout->addWidget(new QLabel("Scan RTCM"), 3, 0);
- rLayout->addWidget(_scanRTCMCheckBox, 3, 1);
- rLayout->addWidget(new QLabel(" "), 4, 0);
- rLayout->addWidget(new QLabel(" "), 5, 0);
- rLayout->addWidget(new QLabel(" "), 6, 0);
- rgroup->setLayout(rLayout);
-
- // PPP Client
- // ----------
- QGridLayout* pppLayout = new QGridLayout;
- pppLayout->setColumnMinimumWidth(0,14*ww);
- _pppSigCLineEdit->setMaximumWidth(6*ww);
- _pppSigPLineEdit->setMaximumWidth(6*ww);
- _pppSigCrd0->setMaximumWidth(6*ww);
- _pppSigCrdP->setMaximumWidth(6*ww);
- _pppSigTrp0->setMaximumWidth(6*ww);
- _pppSigTrpP->setMaximumWidth(6*ww);
- _pppAverageLineEdit->setMaximumWidth(6*ww);
- _pppQuickStartLineEdit->setMaximumWidth(6*ww);
- _pppMaxSolGapLineEdit->setMaximumWidth(6*ww);
- _pppRefCrdXLineEdit->setMaximumWidth(10*ww);
- _pppRefCrdYLineEdit->setMaximumWidth(10*ww);
- _pppRefCrdZLineEdit->setMaximumWidth(10*ww);
- _pppRefdNLineEdit->setMaximumWidth(6*ww);
- _pppRefdELineEdit->setMaximumWidth(6*ww);
- _pppRefdULineEdit->setMaximumWidth(6*ww);
- _pppSync->setMaximumWidth(6*ww);
- _pppSPPComboBox->setMinimumWidth(15*ww);
-
- _postObsFileChooser = new qtFileChooser;
- _postObsFileChooser->setFileName(settings.value("postObsFile").toString());
- _postObsFileChooser->setMinimumWidth(15*ww);
- _postNavFileChooser = new qtFileChooser;
- _postNavFileChooser->setFileName(settings.value("postNavFile").toString());
- _postNavFileChooser->setMinimumWidth(15*ww);
- _postCorrFileChooser = new qtFileChooser;
- _postCorrFileChooser->setFileName(settings.value("postCorrFile").toString());
- _postCorrFileChooser->setMinimumWidth(15*ww);
- _postOutLineEdit = new QLineEdit(settings.value("postOutFile").toString());
- _postOutLineEdit->setMinimumWidth(15*ww);
-
- int ir = 0;
- pppLayout->addWidget(new QLabel("Precise Point Positioning, Panel 1."), ir, 0, 1, 2, Qt::AlignLeft);
- ++ir;
- pppLayout->addWidget(new QLabel("Mode & mountpoints"),ir, 0, Qt::AlignLeft);
- pppLayout->addWidget(_pppSPPComboBox, ir, 1, Qt::AlignRight);
- pppLayout->addWidget(_pppMountLineEdit, ir, 3, Qt::AlignRight);
- pppLayout->addWidget(new QLabel("Obs."), ir, 4, Qt::AlignLeft);
- pppLayout->addWidget(_pppCorrMountLineEdit, ir, 5, Qt::AlignRight);
- pppLayout->addWidget(new QLabel("Corr."), ir, 6, Qt::AlignLeft);
- ++ir;
- pppLayout->addWidget(new QLabel("Marker coordinates"), ir, 0, Qt::AlignLeft);
- pppLayout->addWidget(_pppRefCrdXLineEdit, ir, 1, Qt::AlignRight);
- pppLayout->addWidget(new QLabel("X "), ir, 2, Qt::AlignLeft);
- pppLayout->addWidget(_pppRefCrdYLineEdit, ir, 3, Qt::AlignRight);
- pppLayout->addWidget(new QLabel("Y"), ir, 4, Qt::AlignLeft);
- pppLayout->addWidget(_pppRefCrdZLineEdit, ir, 5, Qt::AlignRight);
- pppLayout->addWidget(new QLabel("Z"), ir, 6, Qt::AlignLeft);
- ++ir;
- pppLayout->addWidget(new QLabel("Antenna excentricity"), ir, 0, Qt::AlignLeft);
- pppLayout->addWidget(_pppRefdNLineEdit, ir, 1, Qt::AlignRight);
- pppLayout->addWidget(new QLabel("dN"), ir, 2, Qt::AlignLeft);
- pppLayout->addWidget(_pppRefdELineEdit, ir, 3, Qt::AlignRight);
- pppLayout->addWidget(new QLabel("dE"), ir, 4, Qt::AlignLeft);
- pppLayout->addWidget(_pppRefdULineEdit, ir, 5, Qt::AlignRight);
- pppLayout->addWidget(new QLabel("dU"), ir, 6, Qt::AlignLeft);
- ++ir;
- pppLayout->addWidget(new QLabel("NMEA & plot output"),ir, 0, Qt::AlignLeft);
- pppLayout->addWidget(_pppNMEALineEdit, ir, 1, Qt::AlignRight);
- pppLayout->addWidget(new QLabel("NMEA File"), ir, 2, Qt::AlignLeft);
- pppLayout->addWidget(_pppNMEAPortLineEdit, ir, 3, Qt::AlignRight);
- pppLayout->addWidget(new QLabel("NMEA Port"), ir, 4, Qt::AlignLeft);
- pppLayout->addWidget(_pppPlotCoordinates, ir, 5, Qt::AlignRight);
- pppLayout->addWidget(new QLabel("PPP Plot"), ir, 6, Qt::AlignLeft);
- ++ir;
- pppLayout->addWidget(new QLabel("Post-processing"), ir, 0, Qt::AlignLeft);
- pppLayout->addWidget(_postObsFileChooser, ir, 1, Qt::AlignRight);
- pppLayout->addWidget(new QLabel("Obs "), ir, 2, Qt::AlignLeft);
- pppLayout->addWidget(_postNavFileChooser, ir, 3, Qt::AlignRight);
- pppLayout->addWidget(new QLabel("Nav "), ir, 4, Qt::AlignLeft);
- ++ir;
- pppLayout->addWidget(_postCorrFileChooser, ir, 1, Qt::AlignRight);
- pppLayout->addWidget(new QLabel("Corr"), ir, 2, Qt::AlignLeft);
- pppLayout->addWidget(_postOutLineEdit, ir, 3, Qt::AlignRight);
- pppLayout->addWidget(new QLabel("Log (full path)"), ir, 4, Qt::AlignLeft);
-
- pppgroup->setLayout(pppLayout);
-
- // PPP Client (second panel)
- // -------------------------
- QGridLayout* ppp2Layout = new QGridLayout;
- ppp2Layout->setColumnMinimumWidth(0,14*ww);
- ir = 0;
- ppp2Layout->addWidget(new QLabel("Precise Point Positioning, Panel 2."), ir, 0, 1, 10);
- ++ir;
- ppp2Layout->addWidget(new QLabel("Antennas"), ir, 0);
- ppp2Layout->addWidget(_pppAntexFileChooser, ir, 1,1,3);
- ppp2Layout->addWidget(new QLabel("ANTEX File"), ir, 4);
- ppp2Layout->addWidget(_pppAntennaLineEdit, ir, 5,1,3);
- ppp2Layout->addWidget(new QLabel("Antenna Name"), ir, 8);
- ++ir;
- ppp2Layout->addWidget(new QLabel("Basics"), ir, 0, 1, 5);
- ppp2Layout->addWidget(_pppUsePhaseCheckBox, ir, 1, Qt::AlignRight);
- ppp2Layout->addWidget(new QLabel("Use phase obs"), ir, 2);
- ppp2Layout->addWidget(_pppEstTropoCheckBox, ir, 3, Qt::AlignRight);
- ppp2Layout->addWidget(new QLabel("Estimate tropo"), ir, 4);
- ppp2Layout->addWidget(_pppGLONASSCheckBox, ir, 5, Qt::AlignRight);
- ppp2Layout->addWidget(new QLabel("Use GLONASS"), ir, 6);
- ppp2Layout->addWidget(_pppGalileoCheckBox, ir, 7, Qt::AlignRight);
- ppp2Layout->addWidget(new QLabel("Use Galileo "), ir, 8);
- ++ir;
- ppp2Layout->addWidget(new QLabel("Basics cont'd"), ir, 0);
- ppp2Layout->addWidget(_pppSync, ir, 1);
- ppp2Layout->addWidget(new QLabel("Sync Corr (sec) "), ir, 2);
- ppp2Layout->addWidget(_pppAverageLineEdit, ir, 3, Qt::AlignRight);
- ppp2Layout->addWidget(new QLabel("Averaging (min)") , ir, 4);
- ppp2Layout->addWidget(_pppQuickStartLineEdit, ir, 5, Qt::AlignRight);
- ppp2Layout->addWidget(new QLabel("Quick-Start (sec) "), ir, 6);
- ppp2Layout->addWidget(_pppMaxSolGapLineEdit, ir, 7, Qt::AlignRight);
- ppp2Layout->addWidget(new QLabel("Max Sol. Gap (sec)"), ir, 8);
- ++ir;
- ppp2Layout->addWidget(new QLabel("Sigmas"), ir, 0);
- ppp2Layout->addWidget(_pppSigCLineEdit, ir, 1, Qt::AlignRight);
- ppp2Layout->addWidget(new QLabel("Code"), ir, 2);
- ppp2Layout->addWidget(_pppSigPLineEdit, ir, 3);
- ppp2Layout->addWidget(new QLabel("Phase"), ir, 4);
- ++ir;
- ppp2Layout->addWidget(new QLabel("Sigmas cont'd"), ir, 0);
- ppp2Layout->addWidget(_pppSigCrd0, ir, 1, Qt::AlignRight);
- ppp2Layout->addWidget(new QLabel("XYZ Init "), ir, 2);
- ppp2Layout->addWidget(_pppSigCrdP, ir, 3, Qt::AlignRight);
- ppp2Layout->addWidget(new QLabel("XYZ White Noise "), ir, 4);
- ppp2Layout->addWidget(_pppSigTrp0, ir, 5, Qt::AlignRight);
- ppp2Layout->addWidget(new QLabel("Tropo Init "), ir, 6);
- ppp2Layout->addWidget(_pppSigTrpP, ir, 7);
- ppp2Layout->addWidget(new QLabel("Tropo White Noise"), ir, 8);
- ++ir;
- ppp2Layout->addWidget(new QLabel(""), ir, 0);
-
- ppp2group->setLayout(ppp2Layout);
-
- // Reqc Processing
- // ---------------
- _reqcActionComboBox = new QComboBox();
- _reqcActionComboBox->setEditable(false);
- _reqcActionComboBox->addItems(QString(",Edit/Concatenate,Analyze").split(","));
- ik = _reqcActionComboBox->findText(settings.value("reqcAction").toString());
- if (ik != -1) {
- _reqcActionComboBox->setCurrentIndex(ik);
- }
- connect(_reqcActionComboBox, SIGNAL(currentIndexChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- QGridLayout* reqcLayout = new QGridLayout;
- _reqcActionComboBox->setMinimumWidth(15*ww);
- _reqcActionComboBox->setMaximumWidth(15*ww);
-
- _reqcObsFileChooser = new qtFileChooser(0, qtFileChooser::Files);
- _reqcObsFileChooser->setFileName(settings.value("reqcObsFile").toString());
- _reqcObsFileChooser->setWhatsThis(tr("Specify the full path to an observation file in RINEX v2 or v3 format."));
- _reqcObsFileChooser->setMinimumWidth(15*ww);
- _reqcObsFileChooser->setMaximumWidth(15*ww);
-
- _reqcNavFileChooser = new qtFileChooser(0, qtFileChooser::Files);
- _reqcNavFileChooser->setFileName(settings.value("reqcNavFile").toString());
- _reqcNavFileChooser->setWhatsThis(tr("Specify the full path to a RINEX v2 or v3 navigation file."));
- _reqcNavFileChooser->setMinimumWidth(15*ww);
- _reqcNavFileChooser->setMaximumWidth(15*ww);
-
- _reqcOutObsLineEdit = new QLineEdit(settings.value("reqcOutObsFile").toString());
- _reqcOutObsLineEdit->setWhatsThis(tr("Specify the full path to an output file."));
- _reqcOutObsLineEdit->setMinimumWidth(15*ww);
- _reqcOutObsLineEdit->setMaximumWidth(15*ww);
-
- _reqcOutNavLineEdit = new QLineEdit(settings.value("reqcOutNavFile").toString());
- _reqcOutNavLineEdit->setWhatsThis(tr("Specify the full path to an output file."));
- _reqcOutNavLineEdit->setMinimumWidth(15*ww);
- _reqcOutNavLineEdit->setMaximumWidth(15*ww);
-
- _reqcOutLogLineEdit = new QLineEdit(settings.value("reqcOutLogFile").toString());
- _reqcOutLogLineEdit->setWhatsThis(tr("Specify the full path to an output file."));
- _reqcOutLogLineEdit->setMinimumWidth(15*ww);
- _reqcOutLogLineEdit->setMaximumWidth(15*ww);
-
- ir = 0;
- reqcLayout->addWidget(new QLabel("RINEX file editing, concatenation and quality check."),ir, 0, 1, 20);
- ++ir;
- reqcLayout->addWidget(new QLabel("Action"), ir, 0, Qt::AlignLeft);
- reqcLayout->addWidget(_reqcActionComboBox, ir, 1, Qt::AlignLeft);
- _reqcEditOptionButton = new QPushButton("Set Edit Options");
- reqcLayout->addWidget(_reqcEditOptionButton, ir, 3, Qt::AlignRight);
- ++ir;
- reqcLayout->addWidget(new QLabel("Input files (full path)"), ir, 0, Qt::AlignLeft);
- reqcLayout->addWidget(_reqcObsFileChooser, ir, 1, Qt::AlignRight);
- reqcLayout->addWidget(new QLabel("Obs"), ir, 2, Qt::AlignLeft);
- reqcLayout->addWidget(_reqcNavFileChooser, ir, 3, Qt::AlignRight);
- reqcLayout->addWidget(new QLabel("Nav"), ir, 4, Qt::AlignLeft);
- ++ir;
- reqcLayout->addWidget(new QLabel("Output files (full path)"), ir, 0, Qt::AlignLeft);
- reqcLayout->addWidget(_reqcOutObsLineEdit, ir, 1, Qt::AlignRight);
- reqcLayout->addWidget(new QLabel("Obs"), ir, 2, Qt::AlignLeft);
- reqcLayout->addWidget(_reqcOutNavLineEdit, ir, 3, Qt::AlignRight);
- reqcLayout->addWidget(new QLabel("Nav"), ir, 4, Qt::AlignLeft);
- ++ir;
- reqcLayout->addWidget(_reqcOutLogLineEdit, ir, 1, Qt::AlignRight);
- reqcLayout->addWidget(new QLabel("Log"), ir, 2, Qt::AlignLeft);
- ++ir;
- reqcLayout->addWidget(new QLabel(""), ir, 1);
- reqcLayout->setRowStretch(ir, 999);
-
- reqcLayout->setColumnMinimumWidth(2, 8*ww);
- reqcLayout->setColumnMinimumWidth(4, 8*ww);
-
- reqcgroup->setLayout(reqcLayout);
-
- connect(_reqcEditOptionButton, SIGNAL(clicked()),
- this, SLOT(slotReqcEditOption()));
-
- // Combine Corrections
- // -------------------
- QGridLayout* cmbLayout = new QGridLayout;
-
- populateCmbTable();
- cmbLayout->addWidget(_cmbTable, 0, 0, 6, 3);
- cmbLayout->addWidget(new QLabel(" "), 0, 5);
- cmbLayout->addWidget(new QLabel("Combine Broadcast Correction streams."), 0, 6, 1, 50);
- cmbLayout->addWidget(new QLabel(" "), 1, 5);
- cmbLayout->addWidget(addCmbRowButton, 1, 6);
- cmbLayout->addWidget(delCmbRowButton, 1, 7);
- cmbLayout->addWidget(new QLabel(" "), 2, 5);
- cmbLayout->addWidget(new QLabel("Method"), 2, 6, Qt::AlignRight);
- cmbLayout->addWidget(_cmbMethodComboBox, 2, 7, Qt::AlignRight);
- cmbLayout->addWidget(new QLabel(" "), 3, 5);
- cmbLayout->addWidget(new QLabel("Maximal Residuum"), 3, 6, Qt::AlignRight);
- cmbLayout->addWidget(_cmbMaxresLineEdit, 3, 7, Qt::AlignRight);
- cmbLayout->addWidget(new QLabel(" "), 4, 5);
- cmbLayout->addWidget(new QLabel("Sampling"), 4, 6, Qt::AlignRight);
- cmbLayout->addWidget(_cmbSamplSpinBox, 4, 7, Qt::AlignRight);
- cmbLayout->addWidget(new QLabel(" "), 5, 0);
-
- connect(addCmbRowButton, SIGNAL(clicked()), this, SLOT(slotAddCmbRow()));
- connect(delCmbRowButton, SIGNAL(clicked()), this, SLOT(slotDelCmbRow()));
-
- cmbgroup->setLayout(cmbLayout);
-
- // Upload Layout (Clocks)
- // ----------------------
- QGridLayout* uploadHlpLayout = new QGridLayout();
-
- connect(addUploadRowButton, SIGNAL(clicked()), this, SLOT(slotAddUploadRow()));
- connect(delUploadRowButton, SIGNAL(clicked()), this, SLOT(slotDelUploadRow()));
- connect(setUploadTrafoButton, SIGNAL(clicked()), this, SLOT(slotSetUploadTrafo()));
-
- uploadHlpLayout->addWidget(addUploadRowButton, 0, 0);
- uploadHlpLayout->addWidget(delUploadRowButton, 0, 1);
- uploadHlpLayout->addWidget(new QLabel("Interval"), 0, 2, Qt::AlignRight);
- uploadHlpLayout->addWidget(_uploadIntrComboBox, 0, 3);
- uploadHlpLayout->addWidget(new QLabel(" Sampling: Orb"), 0, 4, Qt::AlignRight);
- uploadHlpLayout->addWidget(_uploadSamplRtcmEphCorrSpinBox, 0, 5);
- uploadHlpLayout->addWidget(new QLabel("SP3"), 0, 6, Qt::AlignRight);
- uploadHlpLayout->addWidget(_uploadSamplSp3SpinBox, 0, 7);
- uploadHlpLayout->addWidget(new QLabel("RNX"), 0, 8, Qt::AlignRight);
- uploadHlpLayout->addWidget(_uploadSamplClkRnxSpinBox, 0, 9);
- uploadHlpLayout->addWidget(setUploadTrafoButton, 0,10);
-
- QBoxLayout* uploadLayout = new QBoxLayout(QBoxLayout::TopToBottom);
- populateUploadTable();
-
- uploadLayout->addWidget(new QLabel("Upload RTCMv3 Broadcast Corrections to caster."));
- uploadLayout->addWidget(_uploadTable);
- uploadLayout->addLayout(uploadHlpLayout);
-
- uploadgroup->setLayout(uploadLayout);
-
- // Upload Layout (Ephemeris)
- // -------------------------
- QGridLayout* uploadLayoutEph = new QGridLayout;
-
- uploadLayoutEph->setColumnMinimumWidth(0, 9*ww);
- _uploadEphPortLineEdit->setMaximumWidth(9*ww);
- _uploadEphPasswordLineEdit->setMaximumWidth(9*ww);
- _uploadEphMountpointLineEdit->setMaximumWidth(12*ww);
-
- uploadLayoutEph->addWidget(new QLabel("Upload concatenated RTCMv3 Broadcast Ephemeris to caster."), 0, 0, 1, 50);
- uploadLayoutEph->addWidget(new QLabel("Host"), 1, 0);
- uploadLayoutEph->addWidget(_uploadEphHostLineEdit, 1, 1, 1, 3);
- uploadLayoutEph->addWidget(new QLabel(" Port"), 1, 4, Qt::AlignRight);
- uploadLayoutEph->addWidget(_uploadEphPortLineEdit, 1, 5, 1, 1);
- uploadLayoutEph->addWidget(new QLabel("Mountpoint "), 2, 0);
- uploadLayoutEph->addWidget(_uploadEphMountpointLineEdit, 2, 1);
- uploadLayoutEph->addWidget(new QLabel(" Password"), 2, 2, Qt::AlignRight);
- uploadLayoutEph->addWidget(_uploadEphPasswordLineEdit, 2, 3);
- uploadLayoutEph->addWidget(new QLabel("Sampling"), 3, 0);
- uploadLayoutEph->addWidget(_uploadEphSampleSpinBox, 3, 1);
- uploadLayoutEph->addWidget(new QLabel("Uploaded"), 4, 0);
- uploadLayoutEph->addWidget(_uploadEphBytesCounter, 4, 1);
- uploadLayoutEph->addWidget(new QLabel(" "), 5, 0);
- uploadLayoutEph->addWidget(new QLabel(" "), 6, 0);
-
- uploadEphgroup->setLayout(uploadLayoutEph);
-
- connect(_uploadEphHostLineEdit, SIGNAL(textChanged(const QString &)),
- this, SLOT(slotBncTextChanged()));
-
- // Main Layout
- // -----------
- QGridLayout* mLayout = new QGridLayout;
- _aogroup->setCurrentIndex(settings.value("startTab").toInt());
- mLayout->addWidget(_aogroup, 0,0);
- mLayout->addWidget(_mountPointsTable, 1,0);
- _loggroup->setCurrentIndex(settings.value("statusTab").toInt());
- mLayout->addWidget(_loggroup, 2,0);
-
- _canvas->setLayout(mLayout);
-
- // WhatsThis
- // ---------
- _proxyHostLineEdit->setWhatsThis(tr("If you are running BNC within a protected Local Area Network (LAN), you might need to use a proxy server to access the Internet. Enter your proxy server IP and port number in case one is operated in front of BNC. If you do not know the IP and port of your proxy server, check the proxy server settings in your Internet browser or ask your network administrator.
Note that IP streaming is sometimes not allowed in a LAN. In this case you need to ask your network administrator for an appropriate modification of the local security policy or for the installation of a TCP relay to the NTRIP broadcasters. If these are not possible, you might need to run BNC outside your LAN on a network that has unobstructed connection to the Internet.
"));
- _proxyPortLineEdit->setWhatsThis(tr("Enter your proxy server port number in case a proxy is operated in front of BNC.
"));
- _sslCaCertPathLineEdit->setWhatsThis(tr("Communication with an NTRIP broadcaster over SSL requires the exchange of client and/or server certificates. Specify the path to a directory where you save certificates on your system. Don't try communication via SSL if you are not sure wheter this is supported by the involved NTRIP broadcaster. Note that SSL communication is usually done over port 443.
"));
- _ignoreSslErrorsCheckBox->setWhatsThis(tr("SSL communication may involve queries coming from the NTRIP broadcaster. Tick 'Ignore SSL authorization erros' if you don't want to be bothered with this.
"));
- _waitTimeSpinBox->setWhatsThis(tr("When feeding a real-time GNSS network engine waiting for synchronized input epoch by epoch, BNC drops whatever is received later than 'Wait for full obs epoch' seconds. A value of 3 to 5 seconds is recommended, depending on the latency of the incoming streams and the delay acceptable to your real-time GNSS network engine or products.
"));
- _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."));
- _outPortLineEdit->setWhatsThis(tr("BNC can produce synchronized observations in a plain ASCII format on your local host through an IP port. Specify a port number here to activate this function."));
- _outUPortLineEdit->setWhatsThis(tr("BNC can produce unsynchronized observations in a plain ASCII format on your local host through an IP port. Specify a port number here to activate this function."));
- _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."));
- _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."));
- _corrTimeSpinBox->setWhatsThis(tr("Concerning output through IP port, BNC drops Broadcast Ephemeris Corrections received later than 'Wait for full corr epoch' seconds. A value of 2 to 5 seconds is recommended, depending on the latency of the incoming correction stream(s) and the delay acceptable to your real-time application.
Specifying a value of '0' means that BNC immediately outputs all incoming Broadcast Epemeris Corrections and does not drop any of them for latency reasons.
"));
- _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."));
- _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."));
- _corrPathLineEdit->setWhatsThis(tr("Specify a directory for saving Broadcast Ephemeris Correction files. If the specified directory does not exist, BNC will not create the files."));
- _rnxScrpLineEdit->setWhatsThis(tr("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).
"));
- _rnxSkelLineEdit->setWhatsThis(tr("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 Observations 'Directory' with a 'Skeleton extension' suffix is interpreted by BNC as a personal RINEX header skeleton file for the corresponding stream.
"));
- _rnxAppendCheckBox->setWhatsThis(tr("When BNC is started, new files are created by default and any existing files with the same name will be overwritten. However, users might want to append already existing files following a restart of BNC, a system crash or when BNC crashed. Tick 'Append files' to continue with existing files and keep what has been recorded so far.
"));
- _autoStartCheckBox->setWhatsThis(tr("Tick 'Auto start' for auto-start of BNC at startup time in window mode with preassigned processing options.
"));
- _rawOutFileLineEdit->setWhatsThis(tr("Save all data coming in through various streams in the received order and format in one file.
"));
-
- _onTheFlyComboBox->setWhatsThis(tr("When operating BNC online in 'no window' mode, some configuration parameters can be changed on-the-fly without interrupting the running process. For that BNC rereads parts of its configuration in pre-defined intervals.
Select '1 min', '1 hour', or '1 day' to force BNC to reread its configuration every full minute, hour, or day and let in between edited configuration options become effective on-the-fly without terminating uninvolved threads.Note that when operating BNC in window mode, on-the-fly changeable configuration options become effective immediately through 'Save & Reread Configuration'.
"));
- _rnxIntrComboBox->setWhatsThis(tr("Select the length of the RINEX Observation file.
"));
- _ephIntrComboBox->setWhatsThis(tr("Select the length of the RINEX Navigation file.
"));
- _corrIntrComboBox->setWhatsThis(tr("Select the length of the Broadcast Ephemeris Correction files.
"));
- _rnxSamplSpinBox->setWhatsThis(tr("Select the RINEX Observation sampling interval in seconds. A value of zero '0' tells BNC to store all received epochs into RINEX.
"));
- _binSamplSpinBox->setWhatsThis(tr("Select the synchronized observation sampling interval in seconds. A value of zero '0' tells BNC to send/store all received epochs.
"));
- _obsRateComboBox->setWhatsThis(tr("BNC can collect all returns (success or failure) coming from a decoder within a certain short time span to then decide whether a stream has an outage or its content is corrupted. The procedure needs a rough estimate of the expected 'Observation rate' of the incoming streams. When a continuous problem is detected, BNC can inform its operator about this event through an advisory note.
"));
- _adviseRecoSpinBox->setWhatsThis(tr("Following a stream outage or a longer series of bad observations, an advisory note is generated when valid observations are received again throughout the 'Recovery threshold' time span. A value of about 5min (default) is recommended.
A value of zero '0' means that for any stream recovery, however short, BNC immediately generates an advisory note.
"));
- _adviseFailSpinBox->setWhatsThis(tr("An advisory note is generated when no (or only corrupted) observations are seen throughout the 'Failure threshold' time span. A value of 15 min (default) is recommended.
A value of zero '0' means that for any stream failure, however short, BNC immediately generates an advisory note.
"));
- _logFileLineEdit->setWhatsThis(tr("Records of BNC's activities are shown in the 'Log' tab on the bottom of this window. They can be saved into a file when a valid path is specified in the 'Logfile (full path)' field.
The logfile name will automatically be extended by a string '_YYMMDD' carrying the current date."));
- _adviseScriptLineEdit->setWhatsThis(tr("
Specify the full path to a script or batch file to handle advisory notes generated in the event of corrupted streams or stream outages. The affected mountpoint and one of the comments 'Begin_Outage', 'End_Outage', 'Begin_Corrupted', or 'End_Corrupted' are passed on to the script as command line parameters.
The script may have the task to send the advisory notes by email to BNC's operator and/or to the affected stream provider. An empty option field (default) or invalid path means that you don't want to use this option.
"));
- _perfIntrComboBox->setWhatsThis(tr("BNC can average latencies per stream over a certain period of GPS time. The resulting mean latencies are recorded in the 'Log' tab at the end of each 'Log latency' interval together with results of a statistical evaluation (approximate number of covered epochs, data gaps).
Select a 'Log latency' interval or select the empty option field if you do not want BNC to log latencies and statistical information.
"));
- _mountPointsTable->setWhatsThis(tr("Streams selected for retrieval are listed in the 'Streams' section. Clicking on 'Add Stream' button will open a window that allows the user to select data streams from an NTRIP broadcaster according to their mountpoints. To remove a stream from the 'Streams' list, highlight it by clicking on it and hit the 'Delete Stream' button. You can also remove multiple streams by highlighting them using +Shift and +Ctrl.
BNC automatically allocates one of its internal decoders to a stream based on the stream's 'format' as given in the sourcetable. BNC allows users to change this selection by editing the decoder string. Double click on the 'decoder' field, enter your preferred decoder and then hit Enter. The accepted decoder strings are 'RTCM_2.x', 'RTCM_3.x' and 'RTNET'.
In case you need to log the raw data as is, BNC allows users to by-pass its decoders and directly save the input in daily log files. To do this specify the decoder string as 'ZERO'.
BNC can also retrieve streams from virtual reference stations (VRS). VRS streams are indicated by a 'yes' in the 'nmea' column. To initiate these streams, the approximate latitude/longitude rover position is sent to the NTRIP broadcaster. The default values can be change according to your requirement. Double click on 'lat' and 'long' fields, enter the values you wish to send and then hit Enter.
"));
- _log->setWhatsThis(tr("Records of BNC's activities are shown in the 'Log' tab. The message log covers the communication status between BNC and the NTRIP broadcaster as well as any problems that occur in the communication link, stream availability, stream delay, stream conversion etc."));
- _bncFigure->setWhatsThis(tr("The bandwidth consumtion per stream is shown in the 'Throughput' tab in bits per second (bps) or kilo bits per second (kbps)."));
- _bncFigureLate->setWhatsThis(tr("The individual latency of observations in each incoming stream is shown in the 'Latency' tab. Streams not carrying observations (i.e. those providing only broadcast ephemeris messages) are not considered here. Note that the calculation of correct latencies requires the clock of the host computer to be properly synchronized."));
- _ephV3CheckBox->setWhatsThis(tr("The default format for output of RINEX Navigation data containing Broadcast Ephemeris is RINEX Version 2.11. Select 'Version 3' if you want to output the ephemeris in RINEX Version 3 format."));
- _rnxV3CheckBox->setWhatsThis(tr("The default format for RINEX Observation files is RINEX Version 2.11. Select 'Version 3' if you want to save the observations in RINEX Version 3 format."));
- _miscMountLineEdit->setWhatsThis(tr("Specify a mountpoint to apply any of the options shown below. Enter 'ALL' if you want to apply these options to all configured streams.
An empty option field (default) means that you don't want BNC to apply any of these options.
"));
- _scanRTCMCheckBox->setWhatsThis(tr("Tick 'Scan RTCM' to log the numbers of incomming message types as well as contained antenna coordinates, antenna heigt, and antenna descriptor.
"));
- _serialMountPointLineEdit->setWhatsThis(tr("Enter a 'Mountpoint' to forward the corresponding stream to a serial connected receiver.
"));
- _serialPortNameLineEdit->setWhatsThis(tr("Enter the serial 'Port name' selected for communication with your serial connected receiver. Valid port names are
Windows: COM1, COM2
Linux: /dev/ttyS0, /dev/ttyS1
FreeBSD: /dev/ttyd0, /dev/ttyd1
Digital Unix: /dev/tty01, /dev/tty02
HP-UX: /dev/tty1p0, /dev/tty2p0
SGI/IRIX: /dev/ttyf1, /dev/ttyf2
SunOS/Solaris: /dev/ttya, /dev/ttyb
Note that you must plug a serial cable in the port defined here before you start BNC.
"));
- _serialBaudRateComboBox->setWhatsThis(tr("Select a 'Baud rate' for the serial output link.
Note that your selection must equal the baud rate configured to the serial connected receiver. Note further that using a high baud rate is recommended.
"));
- _serialParityComboBox->setWhatsThis(tr("Select the 'Parity' for the serial output link.
Note that your selection must equal the parity selection configured to the serial connected receiver. Note further that parity is often set to 'NONE'.
"));
- _serialDataBitsComboBox->setWhatsThis(tr("Select the number of 'Data bits' for the serial output link.
Note that your selection must equal the number of data bits configured to the serial connected receiver. Note further that often 8 data bits are used.
"));
- _serialStopBitsComboBox->setWhatsThis(tr("Select the number of 'Stop bits' for the serial output link.
Note that your selection must equal the number of stop bits configured to the serial connected receiver. Note further that often 1 stop bit is used.
"));
- _serialFlowControlComboBox->setWhatsThis(tr("Select a 'Flow control' for the serial output link.
Note that your selection must equal the flow control configured to the serial connected receiver. Select 'OFF' if you don't know better.
"));
- _serialAutoNMEAComboBox->setWhatsThis(tr("Select 'Auto' to automatically forward NMEA-GGA messages coming from your serial connected receiver to the NTRIP broadcaster and/or save them in a file.
Select 'Manual' only when handling a VRS stream and your serial connected receiver doesn't generate NMEA-GGA messages.
"));
- _serialFileNMEALineEdit->setWhatsThis(tr("Specify the full path to a file where NMEA messages coming from your serial connected receiver are saved.
"));
- _serialHeightNMEALineEdit->setWhatsThis(tr("Specify an approximate 'Height' above mean sea level in meter for your VRS to simulate an inital NMEA-GGA message.
The setting of this option is ignored in case of streams coming from physical reference stations.
"));
- _pppMountLineEdit->setWhatsThis(tr("Specify an observations stream by its mountpoint from the 'Streams' list compiled below if you want BNC to estimate coordinates for the affected receiver position through a PPP solution. Example: 'FFMJ1'
Note that PPP in BNC requires to also pull a stream carrying RTCM Version 3 satellite orbit and clock corrections to Broadcast Ephemeris referring to the satellites' Antenna Phase Centers (APC). Stream CLK11 on NTRIP broadcaster products.igs-ip.net is an example.
Pulling in addition a third stream carrying Broadcast Ephemeris messages in high repetition rate is suggested if such messages are comeing from the receiver in low repetition rate or don't come at all from there.
"));
- _pppCorrMountLineEdit->setWhatsThis(tr("You must specify an orbit/clock Broadcast Ephemeris corrections stream by its mountpoint from the 'Streams' list below. Example: 'CLK10'
Note that BNC can produce an internal PPP solution from combined Broadcast Ephemeris corrections as specified under 'Combine Corrections' if you introduce keyword 'INTERNAL' as the corrections mountpoint.
"));
- _pppSPPComboBox->setWhatsThis(tr("Choose between plain Single Point Positioning (SPP) and Precise Point Positioning (PPP) in 'Realtime' or 'Post-Processing' mode.
When in 'Post-Processing mode:
- Specifying a RINEX Observation, a RINEX Navigation and a Broadcast Correction file leads to a PPP solution.
- Specifying only a RINEX Observation and a RINEX Navigation file and no Broadcast Correction file leads to a SPP solution.
"));
- _reqcActionComboBox->setWhatsThis(tr("BNC allows to edit or concatenate RINEX v2 or v3 files or to perform a quality check.
In this it follows UNAVCO's famous 'teqc' program.
"));
- _reqcEditOptionButton->setWhatsThis(tr("Specify options for editing RINEX v2 or v3 files.
"));
- _pppUsePhaseCheckBox->setWhatsThis(tr("By default BNC applies a PPP solution using an ionosphere free P3 linear combination of code observations.
Tick 'Use phase obs' for an ionosphere free L3 linear combination of phase observations.
"));
- _pppEstTropoCheckBox->setWhatsThis(tr("By default BNC does not introduce troposphere parameters when estimating coordinates.
Tick 'Estimate tropo' to introduce troposphere parameters when estimating coordinates.
"));
- _pppGLONASSCheckBox->setWhatsThis(tr("By default BNC does not use GLONASS observations in PPP mode.
Tick 'Use GLONASS' for adding GLONASS observations to GPS and Galileo (optional) in a PPP solution.
"));
- _pppGalileoCheckBox->setWhatsThis(tr("By default BNC does not use Galileo observations in PPP mode.
Tick 'Use Galileo' for adding Galileo observations to GPS and GLONASS (optional) in a PPP solution.
"));
- _pppPlotCoordinates->setWhatsThis(tr("BNC will plot PPP results in the 'PPP Plot' tab as North (red), East (green) and Up (blue) displacements when this option is selected. Values will be either referred to an XYZ reference coordinate (if specified) or referred to the first estimated coordinate. The sliding PPP time series window will cover the period of the latest 5 minutes.
Note that a PPP time series makes only sense for a stationary operated receiver."));
- _pppNMEALineEdit->setWhatsThis(tr("
Specify the full path to a file where PPP results are saved as NMEA messages.
"));
- _pppNMEAPortLineEdit->setWhatsThis(tr("Specify an IP port number to output PPP results as NMEA messages through an IP port.
"));
- _pppSigCLineEdit->setWhatsThis(tr("Enter a sigma for your code observations in meters.
The higher the sigma you enter, the less the contribution of code observations to a PPP solution based on a combination of code and phase data. 5.0 (default) is likely to be an appropriate choice.
"));
- _pppQuickStartLineEdit->setWhatsThis(tr("Enter the lenght of a startup period in seconds for which you want to fix the PPP solution to a known XYZ coordinate as introduced above and adjust a sigma 'XYZ Ini' according to the coordinate's precision. Fixing the coordinate is done in BNC through setting the 'Sigma XYZ Noise' you define below temporarily to zero.
This so-called Quick-Start option allows the PPP solution to rapidly converge. It requires that the antenna remains unmoved on the know position throughout the startup period.
A value of 120 is likely to be an appropriate choice for 'Quick-Start'. Default is an empty option field, meaning that you don't want BNC to operate in Quick-Start mode.
"));
- _pppMaxSolGapLineEdit->setWhatsThis(tr("Specify a 'Maximum Solution Gap' in seconds. Should the time span between two consecutive solutions exceed this limit, the algorithm returns into Quick-Start mode and fixes the introduced reference coordinate for the specified period. A value of '60' seconds could be an appropriate choice.
This option makes only sense for a stationary operated receiver where solution convergence can be enforced because a good approximation for the rover position is known. Default is an empty option field, meaning that you don't want BNC to return into the Quick-Start mode after failures caused i.e. by longer lasting outages.
"));
- _pppSigPLineEdit->setWhatsThis(tr("Enter a sigma for your phase observations in meters.
The higher the sigma you enter, the less the contribution of phase observations to a PPP solutions based on a combination of code and phase data. 0.02 (default) is likely to be an appropriate choice.
"));
- _pppAverageLineEdit->setWhatsThis(tr("Enter the length of a sliding time window in minutes. BNC will continuously output moving average positions computed from those individual positions obtained most recently throughout this period.
An empty option field (default) means that you don't want BNC to output moving average positions.
"));
- _pppSigCrd0->setWhatsThis(tr("Enter a sigma in meters for the initial XYZ coordinate componentes. A value of 100.0 (default) may be an appropriate choice. However, this value may be significantly smaller (i.e. 0.01) when starting for example from a station with known XZY position in Quick-Start mode."));
- _pppSigCrdP->setWhatsThis(tr("
Enter a sigma in meters for the white noise of estimated XYZ coordinate components. A value of 100.0 (default) may be appropriate considering the potential movement of a rover position.
"));
- _pppSigTrp0->setWhatsThis(tr("Enter a sigma in meters for the a-priory model based tropospheric delay estimation. A value of 0.1 (default) may be an appropriate choice.
"));
- _pppSigTrpP->setWhatsThis(tr("Enter a sigma in meters per second to describe the expected variation of the tropospheric effect.
Supposing 1Hz observation data, a value of 3e-6 (default) would mean that the tropospheric effect may vary for 3600 * 3e-6 = 0.01 meters per hour.
"));
- _pppRefCrdXLineEdit->setWhatsThis(tr("Enter reference coordinate X of the receiver's position.
This option only makes sense in static observation conditions.
"));
- _pppRefCrdYLineEdit->setWhatsThis(tr("Enter reference coordinate Y of the receiver's position.
This option only makes sens in static observation conditions.
"));
- _pppRefCrdZLineEdit->setWhatsThis(tr("Enter reference coordinate Z of the receiver's position.
This option only makes sens in static observation conditions.
"));
- _pppRefdNLineEdit->setWhatsThis(tr("Enter north antenna excentricity.
"));
- _pppRefdELineEdit->setWhatsThis(tr("Enter east antenna excentricity.
"));
- _pppRefdULineEdit->setWhatsThis(tr("Enter up antenna excentricity.
"));
- _bncFigurePPP->setWhatsThis(tr("PPP time series of North (red), East (green) and Up (blue) coordinate components are shown in the 'PPP Plot' tab when the corresponting option is selected above. Values are either referred to an XYZ reference coordinate (if specified) or referred to the first estimated set of coordinate compoments. The sliding PPP time series window covers the period of the latest 5 minutes."));
- _pppSync->setWhatsThis(tr(
- " Zero value (or empty field, default) means that BNC processes each epoch of data "
- "immediately after its arrival using satellite clock corrections available at "
- "that time.
Non-zero value 'Sync Corr' (i.e. 5) means that the epochs of data "
- "are buffered and the processing of each epoch is postponed till the satellite clock "
- "corrections not older than 'Sync Corr' seconds are available.
"));
- _pppAntexFileChooser->setWhatsThis(tr("
IGS provides a file containing absolute phase center corrections for GNSS satellite and receiver antennas in ANTEX format. Entering the full path to such an ANTEX file is required for correcting observations for antenna phase center offsets and variations. It allows you to specify the name of your receiver's antenna (as contained in the ANTEX file) to apply such corrections.
Default is an empty option field meaning that you don't want to correct observations for antenna phase center offsets and variations.
"));
- _pppAntennaLineEdit->setWhatsThis(tr("Specify the receiver's antenna name as defined in your ANTEX file. Observations will be corrected for the antenna phase center's offset which may result in a reduction of a few centimeters at max. Corrections for phase center variations are not yet applied by BNC. The specified name must consist of 20 characters. Add trailing blanks if the antenna name has less then 20 characters.
Default is an empty option field meaning that you don't want to correct observations for antenna phase center offsets.
"));
- _cmbTable->setWhatsThis(tr("BNC allows to process several orbit and clock corrections streams in real-time to produce, encode, upload and save a combination of correctors coming from various providers. Hit the 'Add Row' button, double click on the 'Mountpoint' field to enter a Broadcast Ephemeris corrections mountpoint from the 'Streams' section below and hit Enter. Then double click on the 'AC Name' field to enter your choice of an abbreviation for the Analysis Center (AC) providing the stream. Finally, double click on the 'Weight' field to enter the weight to be applied for this stream in the combination.
- Note that an appropriate 'Wait for full corr epoch' value needs to be specified for the combination under the 'Broadcast Corrections' tab. A value of 15 seconds would make sense there if the update rate of incoming clock corrections is i.e. 10 seconds.
- Note also that you need to tick 'Use GLONASS' which is part ot the 'PPP (2)' panel in case you want to produce an GPS plus GLONASS combination.
Note further that the orbit information in the final combination stream is just copied from one of the incoming streams. The stream used for providing the orbits may vary over time: if the orbit providing stream has an outage then BNC switches to the next remaining stream for getting hold of the orbit information.
The combination process requires Broadcast Ephemeris. Besides the orbit and clock corrections stream(s) BNC should therefore pull a stream carrying Broadcast Ephemeris in the form of RTCM Version 3 messages.
It is possible to specify only one Broadcast Ephemeris corrections stream in the combination table. Instead of combining corrections BNC will then merge them with Broadcast Ephemeris to save results in SP3 and/or Clock RINEX format."));
- _cmbMaxresLineEdit->setWhatsThis(tr("
BNC combines all incoming clocks according to specified weights. Individual clock estimates that differ by more than 'Maximal Residuum' meters from the average of all clocks will be ignored.
It is suggested to specify a value of about 0.2 m for the Kalman filter combination approach and a value of about 3.0 meters for the Single-Epoch combination approach.Default is a value of '999.0'.
"));
- _cmbSamplSpinBox->setWhatsThis(tr("Specify a combination sampling interval. Clock and orbit corrections will be produced following that interval. A value of 10 sec may be an appropriate choice.
"));
- _cmbMethodComboBox->setWhatsThis(tr("Select a clock combination approach. Options are 'Single-Epoch' and Kalman 'Filter'. It is suggested to use the Kalman filter approach for the purpose of Precise Point Positioning.
"));
- _uploadTable->setWhatsThis(tr("BNC can upload clock and orbit corrections to broadcast ephemeris (Broadcast Corrections) in RTCM Version 3 SSR format. You may have a situation where clocks and orbits come from an external Real-time Network Engine (1) or a situation where clock and orbit corrections are combined within BNC (2).
(1) BNC identifies a stream as coming from a Real-time Network Engine if its format is specified as 'RTNET' and hence its decoder string in the 'Streams' canvas is 'RTNET'. It encodes and uploads that stream to the specified NTRIP broadcaster
(2) BNC understands that it is expected to encode and upload combined Broadcast Ephemeris corrections if you specify correction streams in the 'Combine Corrections' stream table.
Hit the 'Add Row' button, double click on the 'Host' field to enter the IP or URL of an NTRIP broadcaster and hit Enter. Then double click on the 'Port', 'Mount' and 'Password' fields to enter the NTRIP broadcaster IP port (default is 80), the mountpoint and the stream upload password. An empty 'Host' option field means that you don't want to upload corrections.
Select a target coordinate reference system (e.g. IGS08) for outgoing clock and orbit corrections.
By default orbit and clock corrections refer to Antenna Phase Center (APC). Tick 'CoM' to refer uploaded corrections to Center of Mass instead of APC.
Specify a path for saving the generated Broadcast Corrections plus Broadcast Ephemeris as SP3 orbit files. If the specified directory does not exist, BNC will not create SP3 orbit files. The following is a path example for a Linux system:
/home/user/BNC${GPSWD}.sp3
Note that '${GPSWD}' produces the GPS Week and Day number in the file name.
- As an SP3 file contents should be referred to the satellites Center of Mass (CoM) while correctors are referred to the satellites Antenna Phase Center (APC), an offset has to be applied which is available from an IGS ANTEX file. You should therefore specify the 'ANTEX File' path under tab 'PPP (2)' if you want to save the stream contents in SP3 format. If you don't specify an 'ANTEX File' path there, the SP3 file contents will be referred to the satellites APCs.
Specify a path for saving the generated Broadcast Correction clocks plus Broadcast Ephemeris clocks as Clock RINEX files. If the specified directory does not exist, BNC will not create Clock RINEX files. The following is a path example for a Linux system:
/home/user/BNC${GPSWD}.clk
Note that '${GPSWD}' produces the GPS Week and Day number in the file name.
Specify finally an SSR Provider ID number, an SSR Solution ID number and an Issue of Data SSR number.
In case the 'Combine Corrections' table contains only one Broadcast Corrections stream, BNC will merge that stream with Broadcast Ephemeris to save results in files specified here through SP3 and/or Clock RINEX file path. In such a case you should define only the SP3 and Clock RINEX file path and no further options in the 'Upload Corrections' table.
"));
- _postObsFileChooser->setWhatsThis(tr("Full path to RINEX v2/v3 Observation file."));
- _postNavFileChooser->setWhatsThis(tr("Full path to RINEX v2/v3 Navigation file."));
- _postCorrFileChooser->setWhatsThis(tr("Full path to Broadcast Corrections file as previously saved with BNC in plain ASCII format."));
- _postOutLineEdit->setWhatsThis(tr("Full path to file with post processing PPP results. "));
- addCmbRowButton->setWhatsThis(tr("Hit 'Add Row' button to add another line to the mountpoints table."));
- delCmbRowButton->setWhatsThis(tr("Hit 'Delete' button to delete the highlighted line from the mountpoints table."));
- addUploadRowButton->setWhatsThis(tr("Hit 'Add Row' button to add another line to the stream upload table."));
- delUploadRowButton->setWhatsThis(tr("Hit 'Del Row' button to delete the highlighted line from the stream upload table."));
- _uploadIntrComboBox->setWhatsThis(tr("Select the length of the SP3 and Clock RINEX files."));
- _uploadSamplRtcmEphCorrSpinBox->setWhatsThis(tr("Select the stream's orbit correction sampling interval in seconds. A value of zero '0' tells BNC to upload all available orbit and clock correction samples together in combined messages."));
- _uploadSamplClkRnxSpinBox->setWhatsThis(tr("Select the Clock RINEX file sampling interval in seconds. A value of zero '0' tells BNC to store all available samples into Clock RINEX files."));
- _uploadSamplSp3SpinBox->setWhatsThis(tr("Select the SP3 orbit file sampling interval in minutes. A value of zero '0' tells BNC to store all available samples into SP3 orbit files."));
- setUploadTrafoButton->setWhatsThis(tr("Hit 'Custom Trafo' to specify your own 14 parameter Helmert Transformation instead of selecting a predefined transformation through 'System' button."));
-
- _uploadEphHostLineEdit->setWhatsThis(tr("BNC can upload a Broadcast Ephemeris stream in RTCM Version 3 format. Specify the host IP of an NTRIP Broadcaster to upload the stream. An empty option field means that you don't want to upload Broadcast Ephemeris."));
- _uploadEphPortLineEdit->setWhatsThis(tr("Specify the IP port of an NTRIP Broadcaster to upload the stream. Default is port 80."));
- _uploadEphMountpointLineEdit->setWhatsThis(tr("Specify the mounpoint for stream upload to an NTRIP Broadcaster."));
- _uploadEphPasswordLineEdit->setWhatsThis(tr("Specify the stream upload password protecting the mounpoint on an NTRIP Broadcaster."));
- _uploadEphSampleSpinBox->setWhatsThis(tr("Select the Broadcast Ephemeris sampling interval in seconds. Defaut is '5' meaning that a complete set of Broadcast Ephemeris is uploaded every 5 seconds."));
- _uploadEphBytesCounter->setWhatsThis(tr("BNC shows the amount of data uploaded through this stream."));
-
- // Enable/Disable all Widgets
- // --------------------------
- slotBncTextChanged();
- enableStartStop();
-
- // Auto start
- // ----------
- if ( Qt::CheckState(settings.value("autoStart").toInt()) == Qt::Checked) {
- slotStart();
- }
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-bncWindow::~bncWindow() {
- delete _caster;
- delete _casterEph;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::populateMountPointsTable() {
-
- for (int iRow = _mountPointsTable->rowCount()-1; iRow >=0; iRow--) {
- _mountPointsTable->removeRow(iRow);
- }
-
- bncSettings settings;
-
- QListIterator it(settings.value("mountPoints").toStringList());
- int iRow = 0;
- while (it.hasNext()) {
- QStringList hlp = it.next().split(" ");
- if (hlp.size() < 5) continue;
- _mountPointsTable->insertRow(iRow);
-
- QUrl url(hlp[0]);
-
- QString fullPath = url.host() + QString(":%1").arg(url.port()) + url.path();
- QString format(hlp[1]); QString latitude(hlp[2]); QString longitude(hlp[3]);
- QString nmea(hlp[4]);
- if (hlp[5] == "S") {
- fullPath = hlp[0].replace(0,2,"");
- }
- QString ntripVersion = "2";
- if (hlp.size() >= 6) {
- ntripVersion = (hlp[5]);
- }
-
- QTableWidgetItem* it;
- it = new QTableWidgetItem(url.userInfo());
- it->setFlags(it->flags() & ~Qt::ItemIsEditable);
- _mountPointsTable->setItem(iRow, 0, it);
-
- it = new QTableWidgetItem(fullPath);
- it->setFlags(it->flags() & ~Qt::ItemIsEditable);
- _mountPointsTable->setItem(iRow, 1, it);
-
- it = new QTableWidgetItem(format);
- _mountPointsTable->setItem(iRow, 2, it);
-
- if (nmea == "yes") {
- it = new QTableWidgetItem(latitude);
- _mountPointsTable->setItem(iRow, 3, it);
- it = new QTableWidgetItem(longitude);
- _mountPointsTable->setItem(iRow, 4, it);
- } else {
- it = new QTableWidgetItem(latitude);
- it->setFlags(it->flags() & ~Qt::ItemIsEditable);
- _mountPointsTable->setItem(iRow, 3, it);
- it = new QTableWidgetItem(longitude);
- it->setFlags(it->flags() & ~Qt::ItemIsEditable);
- _mountPointsTable->setItem(iRow, 4, it);
- }
-
- it = new QTableWidgetItem(nmea);
- it->setFlags(it->flags() & ~Qt::ItemIsEditable);
- _mountPointsTable->setItem(iRow, 5, it);
-
- it = new QTableWidgetItem(ntripVersion);
- //// it->setFlags(it->flags() & ~Qt::ItemIsEditable);
- _mountPointsTable->setItem(iRow, 6, it);
-
- bncTableItem* bncIt = new bncTableItem();
- bncIt->setFlags(bncIt->flags() & ~Qt::ItemIsEditable);
- _mountPointsTable->setItem(iRow, 7, bncIt);
-
- iRow++;
- }
-
- _mountPointsTable->sortItems(1);
-
- enableStartStop();
-}
-
-// Retrieve Table
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotAddMountPoints() {
-
- bncSettings settings;
- QString proxyHost = settings.value("proxyHost").toString();
- int proxyPort = settings.value("proxyPort").toInt();
- if (proxyHost != _proxyHostLineEdit->text() ||
- proxyPort != _proxyPortLineEdit->text().toInt()) {
- int iRet = QMessageBox::question(this, "Question", "Proxy options "
- "changed. Use the new ones?",
- QMessageBox::Yes, QMessageBox::No,
- QMessageBox::NoButton);
- if (iRet == QMessageBox::Yes) {
- settings.setValue("proxyHost", _proxyHostLineEdit->text());
- settings.setValue("proxyPort", _proxyPortLineEdit->text());
- }
- }
-
- settings.setValue("sslCaCertPath", _sslCaCertPathLineEdit->text());
- settings.setValue("ignoreSslErrors", _ignoreSslErrorsCheckBox->checkState());
-
- QMessageBox msgBox;
- msgBox.setIcon(QMessageBox::Question);
- msgBox.setWindowTitle("Add Stream");
- msgBox.setText("Add stream(s) coming from:");
-
- QPushButton* buttonNtrip = msgBox.addButton(tr("Caster"), QMessageBox::ActionRole);
- QPushButton* buttonIP = msgBox.addButton(tr("TCP/IP port"), QMessageBox::ActionRole);
- QPushButton* buttonUDP = msgBox.addButton(tr("UDP port"), QMessageBox::ActionRole);
- QPushButton* buttonSerial = msgBox.addButton(tr("Serial port"), QMessageBox::ActionRole);
- QPushButton* buttonCancel = msgBox.addButton(tr("Cancel"), QMessageBox::ActionRole);
-
- msgBox.exec();
-
- if (msgBox.clickedButton() == buttonNtrip) {
- bncTableDlg* dlg = new bncTableDlg(this);
- dlg->move(this->pos().x()+50, this->pos().y()+50);
- connect(dlg, SIGNAL(newMountPoints(QStringList*)),
- this, SLOT(slotNewMountPoints(QStringList*)));
- dlg->exec();
- delete dlg;
- } else if (msgBox.clickedButton() == buttonIP) {
- bncIpPort* ipp = new bncIpPort(this);
- connect(ipp, SIGNAL(newMountPoints(QStringList*)),
- this, SLOT(slotNewMountPoints(QStringList*)));
- ipp->exec();
- delete ipp;
- } else if (msgBox.clickedButton() == buttonUDP) {
- bncUdpPort* udp = new bncUdpPort(this);
- connect(udp, SIGNAL(newMountPoints(QStringList*)),
- this, SLOT(slotNewMountPoints(QStringList*)));
- udp->exec();
- delete udp;
- } else if (msgBox.clickedButton() == buttonSerial) {
- bncSerialPort* sep = new bncSerialPort(this);
- connect(sep, SIGNAL(newMountPoints(QStringList*)),
- this, SLOT(slotNewMountPoints(QStringList*)));
- sep->exec();
- delete sep;
- } else if (msgBox.clickedButton() == buttonCancel) {
- // Cancel
- }
-
- enableStartStop();
-}
-
-// Delete Selected Mount Points
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotDeleteMountPoints() {
-
- int nRows = _mountPointsTable->rowCount();
- bool flg[nRows];
- for (int iRow = 0; iRow < nRows; iRow++) {
- if (_mountPointsTable->isItemSelected(_mountPointsTable->item(iRow,1))) {
- flg[iRow] = true;
- }
- else {
- flg[iRow] = false;
- }
- }
- for (int iRow = nRows-1; iRow >= 0; iRow--) {
- if (flg[iRow]) {
- _mountPointsTable->removeRow(iRow);
- }
- }
- _actDeleteMountPoints->setEnabled(false);
-
- enableStartStop();
-}
-
-// New Mount Points Selected
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotNewMountPoints(QStringList* mountPoints) {
- int iRow = 0;
- QListIterator it(*mountPoints);
- while (it.hasNext()) {
- QStringList hlp = it.next().split(" ");
- QUrl url(hlp[0]);
- QString fullPath = url.host() + QString(":%1").arg(url.port()) + url.path();
- QString format(hlp[1]); QString latitude(hlp[2]); QString longitude(hlp[3]);
- QString nmea(hlp[4]);
- if (hlp[5] == "S") {
- fullPath = hlp[0].replace(0,2,"");
- }
- QString ntripVersion = "2";
- if (hlp.size() >= 6) {
- ntripVersion = (hlp[5]);
- }
-
- _mountPointsTable->insertRow(iRow);
-
- QTableWidgetItem* it;
- it = new QTableWidgetItem(url.userInfo());
- it->setFlags(it->flags() & ~Qt::ItemIsEditable);
- _mountPointsTable->setItem(iRow, 0, it);
-
- it = new QTableWidgetItem(fullPath);
- it->setFlags(it->flags() & ~Qt::ItemIsEditable);
- _mountPointsTable->setItem(iRow, 1, it);
-
- it = new QTableWidgetItem(format);
- _mountPointsTable->setItem(iRow, 2, it);
-
- if (nmea == "yes") {
- it = new QTableWidgetItem(latitude);
- _mountPointsTable->setItem(iRow, 3, it);
- it = new QTableWidgetItem(longitude);
- _mountPointsTable->setItem(iRow, 4, it);
- } else {
- it = new QTableWidgetItem(latitude);
- it->setFlags(it->flags() & ~Qt::ItemIsEditable);
- _mountPointsTable->setItem(iRow, 3, it);
- it = new QTableWidgetItem(longitude);
- it->setFlags(it->flags() & ~Qt::ItemIsEditable);
- _mountPointsTable->setItem(iRow, 4, it);
- }
-
- it = new QTableWidgetItem(nmea);
- it->setFlags(it->flags() & ~Qt::ItemIsEditable);
- _mountPointsTable->setItem(iRow, 5, it);
-
- it = new QTableWidgetItem(ntripVersion);
- it->setFlags(it->flags() & ~Qt::ItemIsEditable);
- _mountPointsTable->setItem(iRow, 6, it);
-
- bncTableItem* bncIt = new bncTableItem();
- _mountPointsTable->setItem(iRow, 7, bncIt);
-
- iRow++;
- }
- _mountPointsTable->hideColumn(0);
- _mountPointsTable->sortItems(1);
- delete mountPoints;
-
- enableStartStop();
-}
-
-// Save Options (serialize)
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotSaveOptions() {
- saveOptions();
- bncSettings settings;
- settings.sync();
-}
-
-// Save Options (memory only)
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::saveOptions() {
-
- QStringList mountPoints;
- for (int iRow = 0; iRow < _mountPointsTable->rowCount(); iRow++) {
-
- if (_mountPointsTable->item(iRow, 6)->text() != "S") {
- QUrl url( "//" + _mountPointsTable->item(iRow, 0)->text() +
- "@" + _mountPointsTable->item(iRow, 1)->text() );
-
- mountPoints.append(url.toString() + " " +
- _mountPointsTable->item(iRow, 2)->text()
- + " " + _mountPointsTable->item(iRow, 3)->text()
- + " " + _mountPointsTable->item(iRow, 4)->text()
- + " " + _mountPointsTable->item(iRow, 5)->text()
- + " " + _mountPointsTable->item(iRow, 6)->text());
- } else {
- mountPoints.append(
- "//" + _mountPointsTable->item(iRow, 1)->text()
- + " " + _mountPointsTable->item(iRow, 2)->text()
- + " " + _mountPointsTable->item(iRow, 3)->text()
- + " " + _mountPointsTable->item(iRow, 4)->text()
- + " " + _mountPointsTable->item(iRow, 5)->text()
- + " " + _mountPointsTable->item(iRow, 6)->text());
- }
- }
-
- QStringList combineStreams;
- for (int iRow = 0; iRow < _cmbTable->rowCount(); iRow++) {
- QString hlp;
- for (int iCol = 0; iCol < _cmbTable->columnCount(); iCol++) {
- if (_cmbTable->item(iRow, iCol)) {
- hlp += _cmbTable->item(iRow, iCol)->text() + " ";
- }
- }
- if (!hlp.isEmpty()) {
- combineStreams << hlp;
- }
- }
-
- QStringList uploadMountpointsOut;
- for (int iRow = 0; iRow < _uploadTable->rowCount(); iRow++) {
- QString hlp;
- for (int iCol = 0; iCol < _uploadTable->columnCount(); iCol++) {
- if (_uploadTable->cellWidget(iRow, iCol) &&
- (iCol == 3 || iCol == 4 || iCol == 5)) {
- if (iCol == 3) {
- QLineEdit* passwd = (QLineEdit*)(_uploadTable->cellWidget(iRow, iCol));
- hlp += passwd->text() + ",";
- }
- else if (iCol == 4) {
- QComboBox* system = (QComboBox*)(_uploadTable->cellWidget(iRow, iCol));
- hlp += system->currentText() + ",";
- }
- else if (iCol == 5) {
- QCheckBox* com = (QCheckBox*)(_uploadTable->cellWidget(iRow, iCol));
- QString state; state.setNum(com->checkState());
- hlp += state + ",";
- }
- }
- else if (_uploadTable->item(iRow, iCol)) {
- hlp += _uploadTable->item(iRow, iCol)->text() + ",";
- }
- }
- if (!hlp.isEmpty()) {
- uploadMountpointsOut << hlp;
- }
- }
-
- bncSettings settings;
-
- settings.setValue("startTab", _aogroup->currentIndex());
- settings.setValue("statusTab", _loggroup->currentIndex());
- settings.setValue("mountPoints", mountPoints);
-// Network
- settings.setValue("proxyHost", _proxyHostLineEdit->text());
- settings.setValue("proxyPort", _proxyPortLineEdit->text());
- settings.setValue("sslCaCertPath", _sslCaCertPathLineEdit->text());
- settings.setValue("ignoreSslErrors", _ignoreSslErrorsCheckBox->checkState());
-// General
- settings.setValue("logFile", _logFileLineEdit->text());
- settings.setValue("rnxAppend", _rnxAppendCheckBox->checkState());
- settings.setValue("onTheFlyInterval", _onTheFlyComboBox->currentText());
- settings.setValue("autoStart", _autoStartCheckBox->checkState());
- settings.setValue("rawOutFile", _rawOutFileLineEdit->text());
-// RINEX Observations
- settings.setValue("rnxPath", _rnxPathLineEdit->text());
- settings.setValue("rnxIntr", _rnxIntrComboBox->currentText());
- settings.setValue("rnxSampl", _rnxSamplSpinBox->value());
- settings.setValue("rnxSkel", _rnxSkelLineEdit->text());
- settings.setValue("rnxScript", _rnxScrpLineEdit->text());
- settings.setValue("rnxV3", _rnxV3CheckBox->checkState());
-// RINEX Ephemeris
- settings.setValue("ephPath", _ephPathLineEdit->text());
- settings.setValue("ephIntr", _ephIntrComboBox->currentText());
- settings.setValue("outEphPort", _outEphPortLineEdit->text());
- settings.setValue("ephV3", _ephV3CheckBox->checkState());
-// Broadcast Corrections
- settings.setValue("corrPath", _corrPathLineEdit->text());
- settings.setValue("corrIntr", _corrIntrComboBox->currentText());
- settings.setValue("corrPort", _corrPortLineEdit->text());
- settings.setValue("corrTime", _corrTimeSpinBox->value());
-// Feed Engine
- settings.setValue("outPort", _outPortLineEdit->text());
- settings.setValue("waitTime", _waitTimeSpinBox->value());
- settings.setValue("binSampl", _binSamplSpinBox->value());
- settings.setValue("outFile", _outFileLineEdit->text());
- settings.setValue("outUPort", _outUPortLineEdit->text());
-// Serial Output
- settings.setValue("serialMountPoint",_serialMountPointLineEdit->text());
- settings.setValue("serialPortName", _serialPortNameLineEdit->text());
- settings.setValue("serialBaudRate", _serialBaudRateComboBox->currentText());
- settings.setValue("serialFlowControl",_serialFlowControlComboBox->currentText());
- settings.setValue("serialDataBits", _serialDataBitsComboBox->currentText());
- settings.setValue("serialParity", _serialParityComboBox->currentText());
- settings.setValue("serialStopBits", _serialStopBitsComboBox->currentText());
- settings.setValue("serialAutoNMEA", _serialAutoNMEAComboBox->currentText());
- settings.setValue("serialFileNMEA",_serialFileNMEALineEdit->text());
- settings.setValue("serialHeightNMEA",_serialHeightNMEALineEdit->text());
-// Outages
- settings.setValue("obsRate", _obsRateComboBox->currentText());
- settings.setValue("adviseFail", _adviseFailSpinBox->value());
- settings.setValue("adviseReco", _adviseRecoSpinBox->value());
- settings.setValue("adviseScript",_adviseScriptLineEdit->text());
-// Miscellaneous
- settings.setValue("miscMount", _miscMountLineEdit->text());
- settings.setValue("perfIntr", _perfIntrComboBox->currentText());
- settings.setValue("scanRTCM", _scanRTCMCheckBox->checkState());
-// PPPP
- settings.setValue("pppSPP", _pppSPPComboBox->currentText());
- settings.setValue("pppMount", _pppMountLineEdit->text());
- settings.setValue("pppCorrMount",_pppCorrMountLineEdit->text());
- settings.setValue("pppRefCrdX", _pppRefCrdXLineEdit->text());
- settings.setValue("pppRefCrdY", _pppRefCrdYLineEdit->text());
- settings.setValue("pppRefCrdZ", _pppRefCrdZLineEdit->text());
- settings.setValue("pppRefdN", _pppRefdNLineEdit->text());
- settings.setValue("pppRefdE", _pppRefdELineEdit->text());
- settings.setValue("pppRefdU", _pppRefdULineEdit->text());
- settings.setValue("nmeaFile", _pppNMEALineEdit->text());
- settings.setValue("nmeaPort", _pppNMEAPortLineEdit->text());
- settings.setValue("pppPlotCoordinates", _pppPlotCoordinates->checkState());
- settings.setValue("postObsFile", _postObsFileChooser->fileName());
- settings.setValue("postNavFile", _postNavFileChooser->fileName());
- settings.setValue("postCorrFile", _postCorrFileChooser->fileName());
- settings.setValue("postOutFile", _postOutLineEdit->text());
- settings.setValue("pppAntenna", _pppAntennaLineEdit->text());
- settings.setValue("pppAntex", _pppAntexFileChooser->fileName());
- settings.setValue("pppUsePhase", _pppUsePhaseCheckBox->checkState());
- settings.setValue("pppEstTropo", _pppEstTropoCheckBox->checkState());
- settings.setValue("pppGLONASS", _pppGLONASSCheckBox->checkState());
- settings.setValue("pppGalileo", _pppGalileoCheckBox->checkState());
- settings.setValue("pppSync", _pppSync->text());
- settings.setValue("pppAverage", _pppAverageLineEdit->text());
- settings.setValue("pppQuickStart", _pppQuickStartLineEdit->text());
- settings.setValue("pppMaxSolGap", _pppMaxSolGapLineEdit->text());
- settings.setValue("pppSigmaCode",_pppSigCLineEdit->text());
- settings.setValue("pppSigmaPhase",_pppSigPLineEdit->text());
- settings.setValue("pppSigCrd0",_pppSigCrd0->text());
- settings.setValue("pppSigCrdP",_pppSigCrdP->text());
- settings.setValue("pppSigTrp0",_pppSigTrp0->text());
- settings.setValue("pppSigTrpP",_pppSigTrpP->text());
-// Reqc
- settings.setValue("reqcAction", _reqcActionComboBox->currentText());
- settings.setValue("reqcObsFile", _reqcObsFileChooser->fileName());
- settings.setValue("reqcNavFile", _reqcNavFileChooser->fileName());
- settings.setValue("reqcOutObsFile", _reqcOutObsLineEdit->text());
- settings.setValue("reqcOutNavFile", _reqcOutNavLineEdit->text());
- settings.setValue("reqcOutLogFile", _reqcOutLogLineEdit->text());
-// Combine Corrections
- if (!combineStreams.isEmpty()) {
- settings.setValue("combineStreams", combineStreams);
- }
- else {
- settings.setValue("combineStreams", "");
- }
- settings.setValue("cmbMethod", _cmbMethodComboBox->currentText());
- settings.setValue("cmbMaxres", _cmbMaxresLineEdit->text());
- settings.setValue("cmbSampl", _cmbSamplSpinBox->value());
-// Upload Corrections
- if (!uploadMountpointsOut.isEmpty()) {
- settings.setValue("uploadMountpointsOut", uploadMountpointsOut);
- }
- else {
- settings.setValue("uploadMountpointsOut", "");
- }
- settings.setValue("uploadIntr", _uploadIntrComboBox->currentText());
- settings.setValue("uploadSamplRtcmEphCorr", _uploadSamplRtcmEphCorrSpinBox->value());
- settings.setValue("uploadSamplSp3", _uploadSamplSp3SpinBox->value());
- settings.setValue("uploadSamplClkRnx", _uploadSamplClkRnxSpinBox->value());
-// Upload Ephemeris
- settings.setValue("uploadEphHost", _uploadEphHostLineEdit->text());
- settings.setValue("uploadEphPort", _uploadEphPortLineEdit->text());
- settings.setValue("uploadEphMountpoint",_uploadEphMountpointLineEdit->text());
- settings.setValue("uploadEphPassword", _uploadEphPasswordLineEdit->text());
- settings.setValue("uploadEphSample", _uploadEphSampleSpinBox->value());
- if (_caster) {
- _caster->readMountPoints();
- }
-}
-
-// All get slots terminated
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotGetThreadsFinished() {
- ((bncApp*)qApp)->slotMessage("All Get Threads Terminated", true);
- delete _caster; _caster = 0;
- delete _casterEph; _casterEph = 0;
- _runningRealTime = false;
-}
-
-// Start It!
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotStart() {
- saveOptions();
- if ( _pppSPPComboBox->currentText() == "Post-Processing" ) {
- startPostProcessingPPP();
- }
- else if ( !_reqcActionComboBox->currentText().isEmpty() ) {
- startPostProcessingReqc();
- }
- else {
- startRealTime();
- }
-}
-
-// Start Real-Time (Retrieve Data etc.)
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::startRealTime() {
-
- _runningRealTime = true;
-
- _bncFigurePPP->reset();
-
- _actDeleteMountPoints->setEnabled(false);
-
- enableStartStop();
-
- _caster = new bncCaster(_outFileLineEdit->text(),
- _outPortLineEdit->text().toInt());
-
- ((bncApp*)qApp)->setPort(_outEphPortLineEdit->text().toInt());
- ((bncApp*)qApp)->setPortCorr(_corrPortLineEdit->text().toInt());
- ((bncApp*)qApp)->initCombination();
-
- connect(_caster, SIGNAL(getThreadsFinished()),
- this, SLOT(slotGetThreadsFinished()));
-
- connect (_caster, SIGNAL(mountPointsRead(QList)),
- this, SLOT(slotMountPointsRead(QList)));
-
- ((bncApp*)qApp)->slotMessage("========== Start BNC v" BNCVERSION " =========", true);
-
- bncSettings settings;
-
- QDir rnxdir(settings.value("rnxPath").toString());
- if (!rnxdir.exists()) ((bncApp*)qApp)->slotMessage("Cannot find RINEX Observations directory", true);
-
- QString rnx_file = settings.value("rnxScript").toString();
- if ( !rnx_file.isEmpty() ) {
- QFile rnxfile(settings.value("rnxScript").toString());
- if (!rnxfile.exists()) ((bncApp*)qApp)->slotMessage("Cannot find RINEX Observations script", true);
- }
-
- QDir ephdir(settings.value("ephPath").toString());
- if (!ephdir.exists()) ((bncApp*)qApp)->slotMessage("Cannot find RINEX Ephemeris directory", true);
-
- QDir corrdir(settings.value("corrPath").toString());
- if (!corrdir.exists()) ((bncApp*)qApp)->slotMessage("Cannot find Broadcast Corrections directory", true);
-
- QString advise_file = settings.value("adviseScript").toString();
- if ( !advise_file.isEmpty() ) {
- QFile advisefile(settings.value("adviseScript").toString());
- if (!advisefile.exists()) ((bncApp*)qApp)->slotMessage("Cannot find Outages script", true);
- }
-
- QString ant_file = settings.value("pppAntex").toString();
- if ( !ant_file.isEmpty() ) {
- QFile anxfile(settings.value("pppAntex").toString());
- if (!anxfile.exists()) ((bncApp*)qApp)->slotMessage("Cannot find IGS ANTEX file", true);
- }
-
- _caster->readMountPoints();
-
- _casterEph = new bncEphUploadCaster();
- connect(_casterEph, SIGNAL(newBytes(QByteArray,double)),
- _uploadEphBytesCounter, SLOT(slotNewBytes(QByteArray,double)));
-}
-
-// Retrieve Data
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotStop() {
- int iRet = QMessageBox::question(this, "Stop", "Stop retrieving data?",
- QMessageBox::Yes, QMessageBox::No,
- QMessageBox::NoButton);
- if (iRet == QMessageBox::Yes) {
- ((bncApp*)qApp)->stopCombination();
- delete _caster; _caster = 0;
- delete _casterEph; _casterEph = 0;
- _runningRealTime = false;
- enableStartStop();
- }
-}
-
-// Close Application gracefully
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::closeEvent(QCloseEvent* event) {
-
- int iRet = QMessageBox::question(this, "Close", "Save Options?",
- QMessageBox::Yes, QMessageBox::No,
- QMessageBox::Cancel);
-
- if (iRet == QMessageBox::Cancel) {
- event->ignore();
- return;
- }
- else if (iRet == QMessageBox::Yes) {
- slotSaveOptions();
- }
-
- QMainWindow::closeEvent(event);
-}
-
-// User changed the selection of mountPoints
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotSelectionChanged() {
- if (_mountPointsTable->selectedItems().isEmpty()) {
- _actDeleteMountPoints->setEnabled(false);
- }
- else {
- _actDeleteMountPoints->setEnabled(true);
- }
-}
-
-// Display Program Messages
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotWindowMessage(const QByteArray msg, bool showOnScreen) {
-
-#ifdef DEBUG_RTCM2_2021
- const int maxBufferSize = 1000;
-#else
- const int maxBufferSize = 10000;
-#endif
-
- if (! showOnScreen ) {
- return;
- }
-
- QString txt = _log->toPlainText() + "\n" +
- QDateTime::currentDateTime().toUTC().toString("yy-MM-dd hh:mm:ss ") + msg;
- _log->clear();
- _log->append(txt.right(maxBufferSize));
-}
-
-// About Message
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotAbout() {
- new bncAboutDlg(0);
-}
-
-//Flowchart
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotFlowchart() {
- new bncFlowchartDlg(0);
-}
-
-// Help Window
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotHelp() {
- QUrl url;
- url.setPath(":bnchelp.html");
- new bncHlpDlg(0, url);
-}
-
-// Select Fonts
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotFontSel() {
- bool ok;
- QFont newFont = QFontDialog::getFont(&ok, this->font(), this);
- if (ok) {
- bncSettings settings;
- settings.setValue("font", newFont.toString());
- QApplication::setFont(newFont);
- int ww = QFontMetrics(newFont).width('w');
- setMinimumSize(60*ww, 80*ww);
- resize(60*ww, 80*ww);
- }
-}
-
-// Whats This Help
-void bncWindow::slotWhatsThis() {
- QWhatsThis::enterWhatsThisMode();
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotMountPointsRead(QList threads) {
- _bncFigure->updateMountPoints();
- _bncFigureLate->updateMountPoints();
-
- populateMountPointsTable();
- bncSettings settings;
- _binSamplSpinBox->setValue(settings.value("binSampl").toInt());
- _waitTimeSpinBox->setValue(settings.value("waitTime").toInt());
- QListIterator iTh(threads);
- while (iTh.hasNext()) {
- bncGetThread* thread = iTh.next();
- for (int iRow = 0; iRow < _mountPointsTable->rowCount(); iRow++) {
- QUrl url( "//" + _mountPointsTable->item(iRow, 0)->text() +
- "@" + _mountPointsTable->item(iRow, 1)->text() );
- if (url == thread->mountPoint() &&
- _mountPointsTable->item(iRow, 3)->text() == thread->latitude() &&
- _mountPointsTable->item(iRow, 4)->text() == thread->longitude() ) {
- ((bncTableItem*) _mountPointsTable->item(iRow, 7))->setGetThread(thread);
- disconnect(thread, SIGNAL(newBytes(QByteArray, double)),
- _bncFigure, SLOT(slotNewData(QByteArray, double)));
- connect(thread, SIGNAL(newBytes(QByteArray, double)),
- _bncFigure, SLOT(slotNewData(QByteArray, double)));
- disconnect(thread, SIGNAL(newLatency(QByteArray, double)),
- _bncFigureLate, SLOT(slotNewLatency(QByteArray, double)));
- connect(thread, SIGNAL(newLatency(QByteArray, double)),
- _bncFigureLate, SLOT(slotNewLatency(QByteArray, double)));
- if ( Qt::CheckState(settings.value("pppPlotCoordinates").toInt()) == Qt::Checked) {
- disconnect(thread,
- SIGNAL(newPosition(bncTime, double, double, double)),
- _bncFigurePPP,
- SLOT(slotNewPosition(bncTime, double, double, double)));
- connect(thread, SIGNAL(newPosition(bncTime, double, double, double)),
- _bncFigurePPP,
- SLOT(slotNewPosition(bncTime, double, double, double)));
- }
- break;
- }
- }
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::CreateMenu() {
- // Create Menus
- // ------------
- _menuFile = menuBar()->addMenu(tr("&File"));
- _menuFile->addAction(_actFontSel);
- _menuFile->addSeparator();
- _menuFile->addAction(_actSaveOpt);
- _menuFile->addSeparator();
- _menuFile->addAction(_actQuit);
-
- _menuHlp = menuBar()->addMenu(tr("&Help"));
- _menuHlp->addAction(_actHelp);
- _menuHlp->addAction(_actFlowchart);
- _menuHlp->addAction(_actAbout);
-}
-
-// Toolbar
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::AddToolbar() {
- QToolBar* toolBar = new QToolBar;
- addToolBar(Qt::BottomToolBarArea, toolBar);
- toolBar->setMovable(false);
- toolBar->addAction(_actAddMountPoints);
- toolBar->addAction(_actDeleteMountPoints);
- toolBar->addAction(_actStart);
- toolBar->addAction(_actStop);
- toolBar->addWidget(new QLabel(" "));
- toolBar->addAction(_actwhatsthis);
-}
-
-// About
-////////////////////////////////////////////////////////////////////////////
-bncAboutDlg::bncAboutDlg(QWidget* parent) :
- QDialog(parent) {
-
- QTextBrowser* tb = new QTextBrowser;
- QUrl url; url.setPath(":bncabout.html");
- tb->setSource(url);
- tb->setReadOnly(true);
-
- int ww = QFontMetrics(font()).width('w');
- QPushButton* _closeButton = new QPushButton("Close");
- _closeButton->setMaximumWidth(10*ww);
- connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
-
- QGridLayout* dlgLayout = new QGridLayout();
- QLabel* img = new QLabel();
- img->setPixmap(QPixmap(":ntrip-logo.png"));
- dlgLayout->addWidget(img, 0,0);
- dlgLayout->addWidget(new QLabel("BKG Ntrip Client (BNC) Version "BNCVERSION), 0,1);
- dlgLayout->addWidget(tb,1,0,1,2);
- dlgLayout->addWidget(_closeButton,2,1,Qt::AlignRight);
-
- setLayout(dlgLayout);
- resize(60*ww, 60*ww);
- setWindowTitle("About BNC");
- show();
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-bncAboutDlg::~bncAboutDlg() {
-};
-
-// Flowchart
-////////////////////////////////////////////////////////////////////////////
-bncFlowchartDlg::bncFlowchartDlg(QWidget* parent) :
- QDialog(parent) {
-
- int ww = QFontMetrics(font()).width('w');
- QPushButton* _closeButton = new QPushButton("Close");
- _closeButton->setMaximumWidth(10*ww);
- connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
-
- QGridLayout* dlgLayout = new QGridLayout();
- QLabel* img = new QLabel();
- img->setPixmap(QPixmap(":bncflowchart.png"));
- dlgLayout->addWidget(img, 0,0);
- dlgLayout->addWidget(_closeButton,1,0,Qt::AlignLeft);
-
- setLayout(dlgLayout);
- setWindowTitle("Flow Chart");
- show();
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-bncFlowchartDlg::~bncFlowchartDlg() {
-};
-
-// Enable/Disable Widget (and change its color)
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::enableWidget(bool enable, QWidget* widget) {
- const static QPalette paletteWhite(QColor(255, 255, 255));
- const static QPalette paletteGray(QColor(230, 230, 230));
-
- widget->setEnabled(enable);
- if (enable) {
- widget->setPalette(paletteWhite);
- }
- else {
- widget->setPalette(paletteGray);
- }
-}
-
-// Bnc Text
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotBncTextChanged(){
-
- bool enable = true;
-
- // Proxy
- //------
- if (sender() == 0 || sender() == _proxyHostLineEdit) {
- enable = !_proxyHostLineEdit->text().isEmpty();
- enableWidget(enable, _proxyPortLineEdit);
- }
-
- // RINEX Observations
- // ------------------
- if (sender() == 0 || sender() == _rnxPathLineEdit) {
- enable = !_rnxPathLineEdit->text().isEmpty();
- enableWidget(enable, _rnxSamplSpinBox);
- enableWidget(enable, _rnxSkelLineEdit);
- enableWidget(enable, _rnxScrpLineEdit);
- enableWidget(enable, _rnxV3CheckBox);
- enableWidget(enable, _rnxIntrComboBox);
- }
-
- // RINEX Ephemeris
- // ---------------
- if (sender() == 0 || sender() == _ephPathLineEdit || sender() == _outEphPortLineEdit) {
- enable = !_ephPathLineEdit->text().isEmpty() || !_outEphPortLineEdit->text().isEmpty();
- enableWidget(enable, _ephIntrComboBox);
- enableWidget(enable, _ephV3CheckBox);
- }
-
- // Broadcast Corrections
- // ---------------------
- if (sender() == 0 || sender() == _corrPathLineEdit || sender() == _corrPortLineEdit) {
- enable = !_corrPathLineEdit->text().isEmpty() || !_corrPortLineEdit->text().isEmpty();
- enableWidget(enable, _corrIntrComboBox);
- }
-
- // Feed Engine
- // -----------
- if (sender() == 0 || sender() == _outPortLineEdit || sender() == _outFileLineEdit) {
- enable = !_outPortLineEdit->text().isEmpty() || !_outFileLineEdit->text().isEmpty();
- enableWidget(enable, _waitTimeSpinBox);
- enableWidget(enable, _binSamplSpinBox);
- }
-
- // Serial Output
- // -------------
- if (sender() == 0 || sender() == _serialMountPointLineEdit ||
- sender() == _serialAutoNMEAComboBox) {
- enable = !_serialMountPointLineEdit->text().isEmpty();
- enableWidget(enable, _serialPortNameLineEdit);
- enableWidget(enable, _serialBaudRateComboBox);
- enableWidget(enable, _serialParityComboBox);
- enableWidget(enable, _serialDataBitsComboBox);
- enableWidget(enable, _serialStopBitsComboBox);
- enableWidget(enable, _serialFlowControlComboBox);
- enableWidget(enable, _serialAutoNMEAComboBox);
-
- bool enable2 = enable && _serialAutoNMEAComboBox->currentText() != "Auto";
- enableWidget(enable2, _serialFileNMEALineEdit);
- }
-
- // Outages
- // -------
- if (sender() == 0 || sender() == _obsRateComboBox) {
- enable = !_obsRateComboBox->currentText().isEmpty();
- enableWidget(enable, _adviseFailSpinBox);
- enableWidget(enable, _adviseRecoSpinBox);
- enableWidget(enable, _adviseScriptLineEdit);
- }
-
- // Miscellaneous
- // -------------
- if (sender() == 0 || sender() == _miscMountLineEdit) {
- enable = !_miscMountLineEdit->text().isEmpty();
- enableWidget(enable, _perfIntrComboBox);
- enableWidget(enable, _scanRTCMCheckBox);
- }
-
- // Enable/disable Broadcast Ephemerides
- // ------------------------------------
- if (sender() == 0 || sender() == _uploadEphHostLineEdit) {
- if (!_uploadEphHostLineEdit->text().isEmpty()) {
- _uploadEphPortLineEdit->setStyleSheet("background-color: white");
- _uploadEphMountpointLineEdit->setStyleSheet("background-color: white");
- _uploadEphPasswordLineEdit->setStyleSheet("background-color: white");
- _uploadEphSampleSpinBox->setStyleSheet("background-color: white");
- _uploadEphPortLineEdit->setEnabled(true);
- _uploadEphMountpointLineEdit->setEnabled(true);
- _uploadEphPasswordLineEdit->setEnabled(true);
- _uploadEphSampleSpinBox->setEnabled(true);
- }
- else {
- _uploadEphPortLineEdit->setStyleSheet("background-color: lightGray");
- _uploadEphMountpointLineEdit->setStyleSheet("background-color: lightGray");
- _uploadEphPasswordLineEdit->setStyleSheet("background-color: lightGray");
- _uploadEphSampleSpinBox->setStyleSheet("background-color: lightGray");
- _uploadEphPortLineEdit->setEnabled(false);
- _uploadEphMountpointLineEdit->setEnabled(false);
- _uploadEphPasswordLineEdit->setEnabled(false);
- _uploadEphSampleSpinBox->setEnabled(false);
- }
- }
-
- // Combine Corrections
- // -------------------
- if (sender() == 0 || sender() == _cmbTable) {
- int iRow = _cmbTable->rowCount();
- if (iRow > 0) {
- enableWidget(true, _cmbMethodComboBox);
- _cmbMaxresLineEdit->setStyleSheet("background-color: white");
- _cmbMaxresLineEdit->setEnabled(true);
- _cmbSamplSpinBox->setEnabled(true);
- }
- else {
- enableWidget(false, _cmbMethodComboBox);
- _cmbMaxresLineEdit->setStyleSheet("background-color: lightGray");
- _cmbMaxresLineEdit->setEnabled(false);
- _cmbSamplSpinBox->setEnabled(false);
- }
- }
-
- // Upload(clk)
- // -----------
- int iRow = _uploadTable->rowCount();
- if (iRow > 0) {
- enableWidget(true, _uploadIntrComboBox);
- enableWidget(true, _uploadSamplRtcmEphCorrSpinBox);
- enableWidget(true, _uploadSamplClkRnxSpinBox);
- enableWidget(true, _uploadSamplSp3SpinBox);
- }
- else {
- enableWidget(false, _uploadIntrComboBox);
- enableWidget(false, _uploadSamplRtcmEphCorrSpinBox);
- enableWidget(false, _uploadSamplClkRnxSpinBox);
- enableWidget(false, _uploadSamplSp3SpinBox);
- }
-
- // PPP Client
- // ----------
- if (sender() == 0
- || sender() == _pppMountLineEdit
- || sender() == _pppCorrMountLineEdit
- || sender() == _pppRefCrdXLineEdit
- || sender() == _pppRefCrdYLineEdit
- || sender() == _pppRefCrdZLineEdit
- || sender() == _pppRefdNLineEdit
- || sender() == _pppRefdELineEdit
- || sender() == _pppRefdULineEdit
- || sender() == _pppSync
- || sender() == _pppSPPComboBox
- || sender() == _pppQuickStartLineEdit
- || sender() == _pppEstTropoCheckBox
- || sender() == _pppUsePhaseCheckBox
- || sender() == _pppAntexFileChooser ) {
-
- enable = !_pppSPPComboBox->currentText().isEmpty();
- if (enable) {
- enable = (!_pppMountLineEdit->text().isEmpty() && !_pppCorrMountLineEdit->text().isEmpty()) ||
- (!_pppMountLineEdit->text().isEmpty() && _pppSPPComboBox->currentText() == "Realtime-SPP") ||
- (_pppSPPComboBox->currentText() == "Post-Processing");
- }
-
- enableWidget(enable, _pppNMEALineEdit);
- enableWidget(enable, _pppNMEAPortLineEdit);
- enableWidget(enable, _pppRefCrdXLineEdit);
- enableWidget(enable, _pppRefCrdYLineEdit);
- enableWidget(enable, _pppRefCrdZLineEdit);
- enableWidget(enable, _pppRefdNLineEdit);
- enableWidget(enable, _pppRefdELineEdit);
- enableWidget(enable, _pppRefdULineEdit);
- enableWidget(enable, _pppUsePhaseCheckBox);
- enableWidget(enable, _pppPlotCoordinates);
- enableWidget(enable, _pppEstTropoCheckBox);
-// enableWidget(enable, _pppGLONASSCheckBox);
- enableWidget(enable, _pppGalileoCheckBox);
-// enableWidget(enable, _pppAntexFileChooser);
- enableWidget(enable, _pppSigCLineEdit);
- enableWidget(enable, _pppSigCrd0);
- enableWidget(enable, _pppSigCrdP);
-
- bool enable2 = enable && !_pppRefCrdXLineEdit->text().isEmpty() &&
- !_pppRefCrdYLineEdit->text().isEmpty() &&
- !_pppRefCrdZLineEdit->text().isEmpty();
-
- enableWidget(enable2, _pppAverageLineEdit);
- enableWidget(enable2, _pppQuickStartLineEdit);
-
- bool enable3 = enable2 && !_pppQuickStartLineEdit->text().isEmpty();
- enableWidget(enable3, _pppMaxSolGapLineEdit);
-
- bool enable4 = enable && !_pppAntexFileChooser->fileName().isEmpty();
- enableWidget(enable4, _pppAntennaLineEdit);
-
- bool enable5 = enable && _pppEstTropoCheckBox->isChecked();
- enableWidget(enable5, _pppSigTrp0);
- enableWidget(enable5, _pppSigTrpP);
-
- bool enable6 = enable && _pppUsePhaseCheckBox->isChecked();
- enableWidget(enable6, _pppSigPLineEdit);
-
- bool enable7 = enable && _pppSPPComboBox->currentText() == "Realtime-PPP";
- enableWidget(enable7, _pppSync);
-
- bool enable8 = _pppSPPComboBox->currentText() == "Realtime-PPP";
- enableWidget(enable8, _pppCorrMountLineEdit);
-
- bool enable9 = _pppSPPComboBox->currentText() == "Post-Processing";
- enableWidget(enable9, _postObsFileChooser);
- enableWidget(enable9, _postNavFileChooser);
- enableWidget(enable9, _postCorrFileChooser);
- enableWidget(enable9, _postOutLineEdit);
-
- bool enable10 = !_pppSPPComboBox->currentText().isEmpty() && !enable9;
- enableWidget(enable10, _pppMountLineEdit);
- }
-
- if (sender() == 0 || sender() == _reqcActionComboBox) {
- enable = !_reqcActionComboBox->currentText().isEmpty();
- bool enable10 = _reqcActionComboBox->currentText() == "Edit/Concatenate";
- enableWidget(enable && enable10, _reqcEditOptionButton);
- enableWidget(enable, _reqcObsFileChooser);
- enableWidget(enable, _reqcNavFileChooser);
- enableWidget(enable && enable10, _reqcOutObsLineEdit);
- enableWidget(enable && enable10, _reqcOutNavLineEdit);
- enableWidget(enable && !enable10, _reqcOutLogLineEdit);
- }
-
- enableStartStop();
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotAddCmbRow() {
- int iRow = _cmbTable->rowCount();
- _cmbTable->insertRow(iRow);
- for (int iCol = 0; iCol < _cmbTable->columnCount(); iCol++) {
- _cmbTable->setItem(iRow, iCol, new QTableWidgetItem(""));
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotDelCmbRow() {
- int nRows = _cmbTable->rowCount();
- bool flg[nRows];
- for (int iRow = 0; iRow < nRows; iRow++) {
- if (_cmbTable->isItemSelected(_cmbTable->item(iRow,1))) {
- flg[iRow] = true;
- }
- else {
- flg[iRow] = false;
- }
- }
- for (int iRow = nRows-1; iRow >= 0; iRow--) {
- if (flg[iRow]) {
- _cmbTable->removeRow(iRow);
- }
- }
- nRows = _cmbTable->rowCount();
- if (nRows < 1) {
- enableWidget(false, _cmbMethodComboBox);
- _cmbMaxresLineEdit->setStyleSheet("background-color: lightGray");
- _cmbMaxresLineEdit->setEnabled(false);
- _cmbSamplSpinBox->setEnabled(false);
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::populateCmbTable() {
-
- for (int iRow = _cmbTable->rowCount()-1; iRow >=0; iRow--) {
- _cmbTable->removeRow(iRow);
- }
-
- bncSettings settings;
-
- int iRow = -1;
- QListIterator it(settings.value("combineStreams").toStringList());
- while (it.hasNext()) {
- QStringList hlp = it.next().split(" ");
- if (hlp.size() > 2) {
- ++iRow;
- _cmbTable->insertRow(iRow);
- }
- for (int iCol = 0; iCol < hlp.size(); iCol++) {
- _cmbTable->setItem(iRow, iCol, new QTableWidgetItem(hlp[iCol]));
- }
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotAddUploadRow() {
- int iRow = _uploadTable->rowCount();
- _uploadTable->insertRow(iRow);
- for (int iCol = 0; iCol < _uploadTable->columnCount(); iCol++) {
- if (iCol == 3) {
- QLineEdit* passwd = new QLineEdit();
- passwd->setFrame(false);
- passwd->setEchoMode(QLineEdit::PasswordEchoOnEdit);
- _uploadTable->setCellWidget(iRow, iCol, passwd);
- }
- else if (iCol == 4) {
- QComboBox* system = new QComboBox();
- system->setEditable(false);
- system->addItems(QString(",IGS08,ETRF2000,NAD83,GDA94,SIRGAS95,SIRGAS2000,Custom").split(","));
- system->setFrame(false);
- _uploadTable->setCellWidget(iRow, iCol, system);
- }
- else if (iCol == 5) {
- QCheckBox* com = new QCheckBox();
- _uploadTable->setCellWidget(iRow, iCol, com);
- }
- else if (iCol == 11) {
- bncTableItem* bncIt = new bncTableItem();
- bncIt->setFlags(bncIt->flags() & ~Qt::ItemIsEditable);
- _uploadTable->setItem(iRow, iCol, bncIt);
- ((bncApp*)qApp)->_uploadTableItems[iRow] = bncIt;
- }
- else {
- _uploadTable->setItem(iRow, iCol, new QTableWidgetItem(""));
- }
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotDelUploadRow() {
- ((bncApp*)qApp)->_uploadTableItems.clear();
- int nRows = _uploadTable->rowCount();
- bool flg[nRows];
- for (int iRow = 0; iRow < nRows; iRow++) {
- if (_uploadTable->isItemSelected(_uploadTable->item(iRow,1))) {
- flg[iRow] = true;
- }
- else {
- flg[iRow] = false;
- }
- }
- for (int iRow = nRows-1; iRow >= 0; iRow--) {
- if (flg[iRow]) {
- _uploadTable->removeRow(iRow);
- }
- }
- for (int iRow = 0; iRow < _uploadTable->rowCount(); iRow++) {
- ((bncApp*)qApp)->_uploadTableItems[iRow] =
- (bncTableItem*) _uploadTable->item(iRow, 11);
- }
- nRows = _uploadTable->rowCount();
- if (nRows < 1) {
- enableWidget(false, _uploadIntrComboBox);
- enableWidget(false, _uploadSamplRtcmEphCorrSpinBox);
- enableWidget(false, _uploadSamplSp3SpinBox);
- enableWidget(false, _uploadSamplClkRnxSpinBox);
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::populateUploadTable() {
- for (int iRow = _uploadTable->rowCount()-1; iRow >=0; iRow--) {
- _uploadTable->removeRow(iRow);
- }
-
- bncSettings settings;
-
- int iRow = -1;
- QListIterator it(settings.value("uploadMountpointsOut").toStringList());
- while (it.hasNext()) {
- QStringList hlp = it.next().split(",");
- if (hlp.size() > 6) {
- ++iRow;
- _uploadTable->insertRow(iRow);
- }
- for (int iCol = 0; iCol < hlp.size(); iCol++) {
- if (iCol == 3) {
- QLineEdit* passwd = new QLineEdit();
- passwd->setFrame(false);
- passwd->setEchoMode(QLineEdit::PasswordEchoOnEdit);
- passwd->setText(hlp[iCol]);
- _uploadTable->setCellWidget(iRow, iCol, passwd);
- }
- else if (iCol == 4) {
- QComboBox* system = new QComboBox();
- system->setEditable(false);
- system->addItems(QString(",IGS08,ETRF2000,NAD83,GDA94,SIRGAS95,SIRGAS2000,Custom").split(","));
- system->setFrame(false);
- system->setCurrentIndex(system->findText(hlp[iCol]));
- _uploadTable->setCellWidget(iRow, iCol, system);
- }
- else if (iCol == 5) {
- QCheckBox* com = new QCheckBox();
- if (hlp[iCol].toInt() == Qt::Checked) {
- com->setCheckState(Qt::Checked);
- }
- _uploadTable->setCellWidget(iRow, iCol, com);
- }
- else if (iCol == 11) {
- bncTableItem* bncIt = new bncTableItem();
- bncIt->setFlags(bncIt->flags() & ~Qt::ItemIsEditable);
- _uploadTable->setItem(iRow, iCol, bncIt);
- ((bncApp*)qApp)->_uploadTableItems[iRow] = bncIt;
- }
- else {
- _uploadTable->setItem(iRow, iCol, new QTableWidgetItem(hlp[iCol]));
- }
- }
- }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotSetUploadTrafo() {
- bncCustomTrafo* dlg = new bncCustomTrafo(this);
- dlg->exec();
- delete dlg;
-}
-
-// Start Post-Processing PPP
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::startPostProcessingPPP() {
-#ifdef USE_POSTPROCESSING
- _runningPostProcessingPPP = true;
- _actStart->setText("0 Epochs");
- enableStartStop();
-
- t_postProcessing* postProcessing = new t_postProcessing(this);
- connect(postProcessing, SIGNAL(finished()), this, SLOT(slotFinishedPostProcessingPPP()));
- connect(postProcessing, SIGNAL(progress(int)), this, SLOT(slotPostProgress(int)));
-
- postProcessing->start();
-#else
- QMessageBox::information(this, "Information",
- "Post-Processing Not Permitted");
-#endif
-}
-
-// Post-Processing PPP Finished
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotFinishedPostProcessingPPP() {
- _runningPostProcessingPPP = false;
- QMessageBox::information(this, "Information",
- "Post-Processing Thread Finished");
- _actStart->setText("Start");
- enableStartStop();
-}
-
-// Progress Bar Change
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotPostProgress(int nEpo) {
- if (_actStart) {
- _actStart->setText(QString("%1 Epochs").arg(nEpo));
- }
-}
-
-// Start Post-Processing Reqc
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::startPostProcessingReqc() {
-#ifdef USE_POSTPROCESSING
- _runningPostProcessingReqc = true;
- enableStartStop();
- if (_reqcActionComboBox->currentText() == "Analyze") {
- t_reqcAnalyze* reqcAnalyze = new t_reqcAnalyze(this);
- connect(reqcAnalyze, SIGNAL(finished()),
- this, SLOT(slotFinishedPostProcessingReqc()));
- reqcAnalyze->start();
- }
- else {
- t_reqcEdit* reqcEdit = new t_reqcEdit(this);
- connect(reqcEdit, SIGNAL(finished()),
- this, SLOT(slotFinishedPostProcessingReqc()));
- reqcEdit->start();
- }
-#else
- QMessageBox::information(this, "Information",
- "Post-Processing Not Permitted");
-#endif
-}
-
-// Post-Processing Reqc Finished
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotFinishedPostProcessingReqc() {
- _runningPostProcessingReqc = false;
- QMessageBox::information(this, "Information",
- "RINEX Processing Thread Finished");
- enableStartStop();
-}
-
-// Edit teqc-like editing options
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::slotReqcEditOption() {
- reqcDlg* dlg = new reqcDlg(this);
- dlg->move(this->pos().x()+50, this->pos().y()+50);
- dlg->exec();
- delete dlg;
-}
-
-// Enable/Disable Start and Stop Buttons
-////////////////////////////////////////////////////////////////////////////
-void bncWindow::enableStartStop() {
-
- if ( _pppSPPComboBox && _pppSPPComboBox->currentText() == "Post-Processing" ) {
- if (_runningPostProcessingPPP) {
- _actStart->setEnabled(false);
- }
- else {
- _actStart->setEnabled(true);
- }
- _actStop->setEnabled(false);
- }
- else if ( _reqcActionComboBox && !_reqcActionComboBox->currentText().isEmpty() ) {
- if (_runningPostProcessingReqc) {
- _actStart->setEnabled(false);
- }
- else {
- _actStart->setEnabled(true);
- }
- _actStop->setEnabled(false);
- }
- else {
- if (_runningRealTime) {
- _actStart->setEnabled(false);
- _actStop->setEnabled(true);
- }
- else {
- _actStop->setEnabled(false);
- if (_mountPointsTable->rowCount() == 0) {
- _actStart->setEnabled(false);
- }
- else {
- _actStart->setEnabled(true);
- }
- }
- }
-}
Index: trunk/BNC/bncwindow.h
===================================================================
--- trunk/BNC/bncwindow.h (revision 4277)
+++ (revision )
@@ -1,255 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCWINDOW_H
-#define BNCWINDOW_H
-
-#include
-#include
-
-#include "bncgetthread.h"
-#include "bnccaster.h"
-
-class bncAboutDlg : public QDialog {
- Q_OBJECT
- public:
- bncAboutDlg(QWidget* parent);
- ~bncAboutDlg();
-};
-
-class bncFlowchartDlg : public QDialog {
- Q_OBJECT
-
- public:
- bncFlowchartDlg(QWidget* parent);
- ~bncFlowchartDlg();
-};
-
-class bncFigure;
-class bncFigureLate;
-class bncFigurePPP;
-class bncBytesCounter;
-class bncEphUploadCaster;
-class qtFileChooser;
-
-class bncWindow : public QMainWindow {
- Q_OBJECT
-
- public:
- bncWindow();
- ~bncWindow();
- void CreateMenu();
- void AddToolbar();
-
- public slots:
- void slotMountPointsRead(QList);
- void slotBncTextChanged();
- void slotPostProgress(int);
-
- private slots:
- void slotWindowMessage(const QByteArray msg, bool showOnScreen);
- void slotHelp();
- void slotAbout();
- void slotFlowchart();
- void slotFontSel();
- void slotSaveOptions();
- void slotAddMountPoints();
- void slotStart();
- void slotFinishedPostProcessingPPP();
- void slotFinishedPostProcessingReqc();
- void slotStop();
- void slotNewMountPoints(QStringList* mountPoints);
- void slotDeleteMountPoints();
- void slotGetThreadsFinished();
- void slotSelectionChanged();
- void slotWhatsThis();
- void slotAddCmbRow();
- void slotDelCmbRow();
- void slotAddUploadRow();
- void slotDelUploadRow();
- void slotSetUploadTrafo();
- void slotReqcEditOption();
-
- protected:
- virtual void closeEvent(QCloseEvent *);
-
- private:
- void saveOptions();
- void populateMountPointsTable();
- void populateCmbTable();
- void populateUploadTable();
- void enableWidget(bool enable, QWidget* widget);
- void startRealTime();
- void startPostProcessingPPP();
- void startPostProcessingReqc();
- void enableStartStop();
-
- QMenu* _menuHlp;
- QMenu* _menuFile;
-
- QAction* _actHelp;
- QAction* _actAbout;
- QAction* _actFlowchart;
- QAction* _actFontSel;
- QAction* _actSaveOpt;
- QAction* _actQuit;
- QAction* _actStart;
- QAction* _actStop;
- QAction* _actAddMountPoints;
- QAction* _actDeleteMountPoints;
- QAction* _actwhatsthis;
- QAction* _actwhatsthismenu;
-
- QLineEdit* _proxyHostLineEdit;
- QLineEdit* _proxyPortLineEdit;
- QLineEdit* _sslCaCertPathLineEdit;
- QCheckBox* _ignoreSslErrorsCheckBox;
- QLineEdit* _outFileLineEdit;
- QLineEdit* _outPortLineEdit;
- QLineEdit* _outUPortLineEdit;
- QLineEdit* _outEphPortLineEdit;
- QLineEdit* _corrPortLineEdit;
- QLineEdit* _rnxPathLineEdit;
- QLineEdit* _ephPathLineEdit;
- QLineEdit* _corrPathLineEdit;
- QLineEdit* _miscMountLineEdit;
- QLineEdit* _pppMountLineEdit;
- QLineEdit* _pppCorrMountLineEdit;
- QLineEdit* _pppNMEALineEdit;
- QLineEdit* _pppNMEAPortLineEdit;
- QLineEdit* _pppSigCLineEdit;
- QLineEdit* _pppSigPLineEdit;
- QLineEdit* _pppSigCrd0;
- QLineEdit* _pppSigCrdP;
- QLineEdit* _pppSigTrp0;
- QLineEdit* _pppSigTrpP;
- QLineEdit* _pppSync;
- QLineEdit* _pppAverageLineEdit;
- QLineEdit* _pppQuickStartLineEdit;
- QLineEdit* _pppMaxSolGapLineEdit;
- QLineEdit* _pppRefCrdXLineEdit;
- QLineEdit* _pppRefCrdYLineEdit;
- QLineEdit* _pppRefCrdZLineEdit;
- QLineEdit* _pppRefdNLineEdit;
- QLineEdit* _pppRefdELineEdit;
- QLineEdit* _pppRefdULineEdit;
- QCheckBox* _pppPlotCoordinates;
- QCheckBox* _pppUsePhaseCheckBox;
- QCheckBox* _pppEstTropoCheckBox;
- QCheckBox* _pppGLONASSCheckBox;
- QCheckBox* _pppGalileoCheckBox;
- QLineEdit* _pppAntennaLineEdit;
- qtFileChooser* _pppAntexFileChooser;
-
- qtFileChooser* _postObsFileChooser;
- qtFileChooser* _postNavFileChooser;
- qtFileChooser* _postCorrFileChooser;
- QLineEdit* _postOutLineEdit;
-
- QComboBox* _reqcActionComboBox;
- QPushButton* _reqcEditOptionButton;
- qtFileChooser* _reqcObsFileChooser;
- qtFileChooser* _reqcNavFileChooser;
- QLineEdit* _reqcOutObsLineEdit;
- QLineEdit* _reqcOutNavLineEdit;
- QLineEdit* _reqcOutLogLineEdit;
-
- QCheckBox* _rnxV3CheckBox;
- QCheckBox* _ephV3CheckBox;
- QLineEdit* _rnxSkelLineEdit;
- QLineEdit* _rnxScrpLineEdit;
- QLineEdit* _logFileLineEdit;
- QLineEdit* _rawOutFileLineEdit;
- QComboBox* _pppSPPComboBox;
- QComboBox* _rnxIntrComboBox;
- QComboBox* _ephIntrComboBox;
- QComboBox* _corrIntrComboBox;
- QSpinBox* _rnxSamplSpinBox;
- QSpinBox* _binSamplSpinBox;
- QCheckBox* _rnxAppendCheckBox;
- QCheckBox* _autoStartCheckBox;
- QCheckBox* _scanRTCMCheckBox;
- QSpinBox* _waitTimeSpinBox;
- QSpinBox* _corrTimeSpinBox;
- QComboBox* _obsRateComboBox;
- QSpinBox* _adviseFailSpinBox;
- QSpinBox* _adviseRecoSpinBox;
- QLineEdit* _adviseScriptLineEdit;
- QComboBox* _perfIntrComboBox;
- QTableWidget* _mountPointsTable;
-
- QLineEdit* _serialPortNameLineEdit;
- QLineEdit* _serialMountPointLineEdit;
- QComboBox* _serialBaudRateComboBox;
- QComboBox* _serialParityComboBox;
- QComboBox* _serialDataBitsComboBox;
- QComboBox* _serialStopBitsComboBox;
- QComboBox* _serialFlowControlComboBox;
- QLineEdit* _serialHeightNMEALineEdit;
- QLineEdit* _serialFileNMEALineEdit;
- QComboBox* _serialAutoNMEAComboBox;
-
- QLineEdit* _LatLineEdit;
- QLineEdit* _LonLineEdit;
-
- QComboBox* _onTheFlyComboBox;
-
- QTextEdit* _log;
-
- QWidget* _canvas;
- QTabWidget* _aogroup;
-
- QTabWidget* _loggroup;
- bncFigure* _bncFigure;
- bncFigureLate* _bncFigureLate;
- bncFigurePPP* _bncFigurePPP;
-
- QTableWidget* _cmbTable;
- QLineEdit* _cmbMaxresLineEdit;
- QComboBox* _cmbMethodComboBox;
- QSpinBox* _cmbSamplSpinBox;
-
- QTableWidget* _uploadTable;
- QComboBox* _uploadIntrComboBox;
- QSpinBox* _uploadSamplRtcmEphCorrSpinBox;
- QSpinBox* _uploadSamplSp3SpinBox;
- QSpinBox* _uploadSamplClkRnxSpinBox;
-
- QLineEdit* _uploadEphHostLineEdit;
- QLineEdit* _uploadEphPortLineEdit;
- QLineEdit* _uploadEphPasswordLineEdit;
- QLineEdit* _uploadEphMountpointLineEdit;
- QSpinBox* _uploadEphSampleSpinBox;
- bncBytesCounter* _uploadEphBytesCounter;
-
- bncCaster* _caster;
-
- bncEphUploadCaster* _casterEph;
-
- bool _realTimeRunning;
- bool _runningRealTime;
- bool _runningPostProcessingPPP;
- bool _runningPostProcessingReqc;
-};
-#endif
Index: trunk/BNC/bnczerodecoder.cpp
===================================================================
--- trunk/BNC/bnczerodecoder.cpp (revision 4277)
+++ (revision )
@@ -1,99 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: bncZeroDecoder
- *
- * Purpose: Implementation of zero decoder to by-pass decoding algorithm
- *
- * Author: L. Mervart
- *
- * Created: 24-Apr-2007
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-#include "bnczerodecoder.h"
-#include "bncutils.h"
-#include "bncsettings.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////
-bncZeroDecoder::bncZeroDecoder(const QString& fileName) {
-
- bncSettings settings;
- QString path = settings.value("rnxPath").toString();
- expandEnvVar(path);
-
- if ( path.length() > 0 && path[path.length()-1] != QDir::separator() ) {
- path += QDir::separator();
- }
-
- _fileName = path + fileName;
-
- _out = 0;
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////
-bncZeroDecoder::~bncZeroDecoder() {
- delete _out;
-}
-
-// Reopen Output File
-////////////////////////////////////////////////////////////////////////
-void bncZeroDecoder::reopen() {
- QDate currDate = currentDateAndTimeGPS().date();
- if (!_out || _fileDate != currDate) {
- delete _out;
- QByteArray fileName =
- (_fileName + "_" + currDate.toString("yyMMdd")).toAscii();
- bncSettings settings;
- if (Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
- _out = new ofstream(fileName.data(), ios::out | ios::app);
- }
- else {
- _out = new ofstream(fileName.data());
- }
- _fileDate = currDate;
- }
-}
-
-// Decode Method
-////////////////////////////////////////////////////////////////////////
-t_irc bncZeroDecoder::Decode(char* buffer, int bufLen, vector& errmsg) {
- errmsg.clear();
- reopen();
- _out->write(buffer, bufLen);
- _out->flush();
- return success;
-}
-
Index: trunk/BNC/bnczerodecoder.h
===================================================================
--- trunk/BNC/bnczerodecoder.h (revision 4277)
+++ (revision )
@@ -1,44 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef INC_BNCZERODECODER_H
-#define INC_BNCZERODECODER_H
-
-#include
-#include
-#include "RTCM/GPSDecoder.h"
-
-class bncZeroDecoder: public GPSDecoder {
- public:
- bncZeroDecoder(const QString& fileName);
- ~bncZeroDecoder();
- virtual t_irc Decode(char* buffer, int bufLen, std::vector& errmsg);
- private:
- void reopen();
- QString _fileName;
- std::ofstream* _out;
- QDate _fileDate;
-};
-
-#endif // include blocker
Index: trunk/BNC/latencychecker.cpp
===================================================================
--- trunk/BNC/latencychecker.cpp (revision 4277)
+++ (revision )
@@ -1,492 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: latencyChecker
- *
- * Purpose: Check incoming GNSS data for latencies, gaps etc.
- *
- * Author: G. Weber
- *
- * Created: 02-Feb-2009
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-
-#ifdef WIN32
-#include
-#else
-#include
-#endif
-
-#include "latencychecker.h"
-#include "bncapp.h"
-#include "bncutils.h"
-#include "bncsettings.h"
-
-using namespace std;
-
-// Constructor
-//////////////////////////////////////////////////////////////////////////////
-latencyChecker::latencyChecker(QByteArray staID) {
-
- _staID = staID;
-
- bncApp* app = (bncApp*) qApp;
- connect(this, SIGNAL(newMessage(QByteArray,bool)),
- app, SLOT(slotMessage(const QByteArray,bool)));
-
- bncSettings settings;
-
- // Notice threshold
- // ----------------
- QString obsRate = settings.value("obsRate").toString();
- _inspSegm = 0;
- if ( obsRate.isEmpty() ) {
- _inspSegm = 0;
- }
- else if ( obsRate.indexOf("5 Hz") != -1 ) {
- _inspSegm = 20;
- }
- else if ( obsRate.indexOf("1 Hz") != -1 ) {
- _inspSegm = 10;
- }
- else if ( obsRate.indexOf("0.5 Hz") != -1 ) {
- _inspSegm = 20;
- }
- else if ( obsRate.indexOf("0.2 Hz") != -1 ) {
- _inspSegm = 40;
- }
- else if ( obsRate.indexOf("0.1 Hz") != -1 ) {
- _inspSegm = 50;
- }
- _adviseFail = settings.value("adviseFail").toInt();
- _adviseReco = settings.value("adviseReco").toInt();
- _adviseScript = settings.value("adviseScript").toString();
- expandEnvVar(_adviseScript);
-
- // Latency interval/average
- // ------------------------
- _perfIntr = 1;
- QString perfIntr = settings.value("perfIntr").toString();
- if ( perfIntr.isEmpty() ) {
- _perfIntr = 1;
- }
- else if ( perfIntr.indexOf("2 sec") != -1 ) {
- _perfIntr = 2;
- }
- else if ( perfIntr.indexOf("10 sec") != -1 ) {
- _perfIntr = 10;
- }
- else if ( perfIntr.indexOf("1 min") != -1 ) {
- _perfIntr = 60;
- }
- else if ( perfIntr.left(5).indexOf("5 min") != -1 ) {
- _perfIntr = 300;
- }
- else if ( perfIntr.indexOf("15 min") != -1 ) {
- _perfIntr = 900;
- }
- else if ( perfIntr.indexOf("1 hour") != -1 ) {
- _perfIntr = 3600;
- }
- else if ( perfIntr.indexOf("6 hours") != -1 ) {
- _perfIntr = 21600;
- }
- else if ( perfIntr.indexOf("1 day") != -1 ) {
- _perfIntr = 86400;
- }
-
- // RTCM message types
- // ------------------
- _checkMountPoint = settings.value("miscMount").toString();
-
- // Initialize private members
- // --------------------------
- _maxDt = 1000.0;
- _wrongEpoch = false;
- _checkSeg = false;
- _numSucc = 0;
- _secSucc = 0;
- _secFail = 0;
- _initPause = 0;
- _currPause = 0;
- _begCorrupt = false;
- _endCorrupt = false;
- _followSec = false;
- _oldSecGPS = 0;
- _newSecGPS = 0;
- _numGaps = 0;
- _diffSecGPS = 0;
- _numLat = 0;
- _sumLat = 0.0;
- _sumLatQ = 0.0;
- _meanDiff = 0.0;
- _minLat = _maxDt;
- _maxLat = -_maxDt;
- _curLat = 0.0;
-
- _checkTime = QDateTime::currentDateTime();
- _decodeSucc = QDateTime::currentDateTime();
-
- _decodeStop = QDateTime::currentDateTime();
-
-}
-
-// Destructor
-//////////////////////////////////////////////////////////////////////////////
-latencyChecker::~latencyChecker() {
-}
-
-// Perform 'Begin outage' check
-//////////////////////////////////////////////////////////////////////////////
-void latencyChecker::checkReconnect() {
-
- // Begin outage threshold
- // ----------------------
- if ( _decodeStop.isValid() ) {
- if ( _decodeStop.secsTo(QDateTime::currentDateTime()) > _adviseFail * 60 ) {
- _decodeStop.setDate(QDate());
- _decodeStop.setTime(QTime());
- _begDateOut = _checkTime.toUTC().date().toString("yy-MM-dd");
- _begTimeOut = _checkTime.toUTC().time().toString("hh:mm:ss");
- emit(newMessage((_staID
- + ": Failure threshold exceeded, outage since "
- + _begDateOut + " " + _begTimeOut).toAscii(), true));
- callScript(("Begin_Outage "
- + _begDateOut + " " + _begTimeOut).toAscii());
- }
- _decodeStart = QDateTime::currentDateTime();
- }
-
-}
-
-// Perform Corrupt and 'End outage' check
-//////////////////////////////////////////////////////////////////////////////
-void latencyChecker::checkOutage(bool decoded) {
-
- if (_inspSegm == 0) { return;}
-
- if (decoded) { _numSucc += 1; }
-
- if (!_checkPause.isValid() || _checkPause.secsTo(QDateTime::currentDateTime()) >= _currPause ) {
- if (!_checkSeg) {
- if ( _checkTime.secsTo(QDateTime::currentDateTime()) > _inspSegm ) {
- _checkSeg = true;
- }
- }
-
- // Check - once per inspect segment
- // --------------------------------
- if (_checkSeg) {
-
- _checkTime = QDateTime::currentDateTime();
-
- if (_numSucc > 0) {
- _secSucc += _inspSegm;
- _decodeSucc = QDateTime::currentDateTime();
- if (_secSucc > _adviseReco * 60) {
- _secSucc = _adviseReco * 60 + 1;
- }
- _numSucc = 0;
- _currPause = _initPause;
- _checkPause.setDate(QDate());
- _checkPause.setTime(QTime());
- }
- else {
- _secFail += _inspSegm;
- _secSucc = 0;
- if (_secFail > _adviseFail * 60) {
- _secFail = _adviseFail * 60 + 1;
- }
- if (!_checkPause.isValid()) {
- _checkPause = QDateTime::currentDateTime();
- }
- else {
- _checkPause.setDate(QDate());
- _checkPause.setTime(QTime());
- _secFail = _secFail + _currPause - _inspSegm;
- _currPause = _currPause * 2;
- if (_currPause > 960) {
- _currPause = 960;
- }
- }
- }
-
- // End corrupt threshold
- // ---------------------
- if ( _begCorrupt && !_endCorrupt && _secSucc > _adviseReco * 60 ) {
- _endDateCor = QDateTime::currentDateTime()
- .addSecs(- _adviseReco * 60)
- .toUTC().date().toString("yy-MM-dd");
- _endTimeCor = QDateTime::currentDateTime()
- .addSecs(- _adviseReco * 60)
- .toUTC().time().toString("hh:mm:ss");
- emit(newMessage((_staID
- + ": Recovery threshold exceeded, corruption ended "
- + _endDateCor + " " + _endTimeCor).toAscii(), true));
- callScript(("End_Corrupted "
- + _endDateCor + " " + _endTimeCor + " Begin was "
- + _begDateCor + " " + _begTimeCor).toAscii());
- _endCorrupt = true;
- _begCorrupt = false;
- _secFail = 0;
- }
- else {
-
- // Begin corrupt threshold
- // -----------------------
- if ( !_begCorrupt && _secFail > _adviseFail * 60 ) {
- _begDateCor = _decodeSucc.toUTC().date().toString("yy-MM-dd");
- _begTimeCor = _decodeSucc.toUTC().time().toString("hh:mm:ss");
- emit(newMessage((_staID
- + ": Failure threshold exceeded, corrupted since "
- + _begDateCor + " " + _begTimeCor).toAscii(), true));
- callScript(("Begin_Corrupted "
- + _begDateCor + " " + _begTimeCor).toAscii());
- _begCorrupt = true;
- _endCorrupt = false;
- _secSucc = 0;
- _numSucc = 0;
- }
- }
- _checkSeg = false;
- }
- }
-
- // End outage threshold
- // --------------------
- if ( _decodeStart.isValid() ) {
- if ( _decodeStart.secsTo(QDateTime::currentDateTime()) > _adviseReco * 60 ) {
- _decodeStart.setDate(QDate());
- _decodeStart.setTime(QTime());
- _endDateOut = QDateTime::currentDateTime()
- .addSecs(- _adviseReco * 60)
- .toUTC().date().toString("yy-MM-dd");
- _endTimeOut = QDateTime::currentDateTime()
- .addSecs(- _adviseReco * 60)
- .toUTC().time().toString("hh:mm:ss");
- emit(newMessage((_staID
- + ": Recovery threshold exceeded, outage ended "
- + _endDateOut + " " + _endTimeOut).toAscii(), true));
- callScript(("End_Outage "
- + _endDateOut + " " + _endTimeOut + " Begin was "
- + _begDateOut + " " + _begTimeOut).toAscii());
- _decodeStop = QDateTime::currentDateTime();
- }
- }
-}
-
-// Perform latency checks (observations)
-//////////////////////////////////////////////////////////////////////////////
-void latencyChecker::checkObsLatency(const QList& obsList) {
-
- if (_perfIntr > 0 ) {
-
- QListIterator it(obsList);
- while (it.hasNext()) {
- const t_obs& obs = it.next();
-
- _newSecGPS = static_cast(obs.GPSWeeks);
- if (_newSecGPS != _oldSecGPS) {
- if (_newSecGPS % _perfIntr < _oldSecGPS % _perfIntr) {
- if (_numLat > 0) {
- if (_meanDiff > 0.0) {
- if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) {
- emit( newMessage(QString("%1: Mean latency %2 sec, min %3, max %4, rms %5, %6 epochs, %7 gaps")
- .arg(_staID.data())
- .arg(int(_sumLat/_numLat*100)/100.)
- .arg(int(_minLat*100)/100.)
- .arg(int(_maxLat*100)/100.)
- .arg(int((sqrt((_sumLatQ - _sumLat * _sumLat / _numLat)/_numLat))*100)/100.)
- .arg(_numLat)
- .arg(_numGaps)
- .toAscii(), true) );
- }
- } else {
- if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) {
- emit( newMessage(QString("%1: Mean latency %2 sec, min %3, max %4, rms %5, %6 epochs")
- .arg(_staID.data())
- .arg(int(_sumLat/_numLat*100)/100.)
- .arg(int(_minLat*100)/100.)
- .arg(int(_maxLat*100)/100.)
- .arg(int((sqrt((_sumLatQ - _sumLat * _sumLat / _numLat)/_numLat))*100)/100.)
- .arg(_numLat)
- .toAscii(), true) );
- }
- }
- }
- _meanDiff = _diffSecGPS / _numLat;
- _diffSecGPS = 0;
- _numGaps = 0;
- _sumLat = 0.0;
- _sumLatQ = 0.0;
- _numLat = 0;
- _minLat = _maxDt;
- _maxLat = -_maxDt;
- }
- if (_followSec) {
- _diffSecGPS += _newSecGPS - _oldSecGPS;
- if (_meanDiff>0.) {
- if (_newSecGPS - _oldSecGPS > 1.5 * _meanDiff) {
- _numGaps += 1;
- }
- }
- }
-
- // Compute the observations latency
- // --------------------------------
- int week;
- double sec;
- currentGPSWeeks(week, sec);
- const double secPerWeek = 7.0 * 24.0 * 3600.0;
- if (week < obs.GPSWeek) {
- week += 1;
- sec -= secPerWeek;
- }
- if (week > obs.GPSWeek) {
- week -= 1;
- sec += secPerWeek;
- }
- _curLat = sec - obs.GPSWeeks;
- _sumLat += _curLat;
- _sumLatQ += _curLat * _curLat;
- if (_curLat < _minLat) {
- _minLat = _curLat;
- }
- if (_curLat >= _maxLat) {
- _maxLat = _curLat;
- }
- _numLat += 1;
- _oldSecGPS = _newSecGPS;
- _followSec = true;
- }
- }
- }
-}
-
-// Perform latency checks (corrections)
-//////////////////////////////////////////////////////////////////////////////
-void latencyChecker::checkCorrLatency(int corrGPSEpochTime) {
-
- if (corrGPSEpochTime < 0) {
- return;
- }
-
- if (_perfIntr > 0) {
-
- _newSecGPS = corrGPSEpochTime;
-
- int week;
- double sec;
- currentGPSWeeks(week, sec);
- double dt = fabs(sec - _newSecGPS);
- const double secPerWeek = 7.0 * 24.0 * 3600.0;
- if (dt > 0.5 * secPerWeek) {
- if (sec > _newSecGPS) {
- sec -= secPerWeek;
- } else {
- sec += secPerWeek;
- }
- }
- if (_newSecGPS != _oldSecGPS) {
- if (int(_newSecGPS) % _perfIntr < int(_oldSecGPS) % _perfIntr) {
- if (_numLat>0) {
- QString late;
- if (_meanDiff>0.) {
- late = QString(": Mean latency %1 sec, min %2, max %3, rms %4, %5 epochs, %6 gaps")
- .arg(int(_sumLat/_numLat*100)/100.)
- .arg(int(_minLat*100)/100.)
- .arg(int(_maxLat*100)/100.)
- .arg(int((sqrt((_sumLatQ - _sumLat * _sumLat / _numLat)/_numLat))*100)/100.)
- .arg(_numLat)
- .arg(_numGaps);
- if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) {
- emit(newMessage(QString(_staID + late ).toAscii(), true) );
- }
- }
- else {
- late = QString(": Mean latency %1 sec, min %2, max %3, rms %4, %5 epochs")
- .arg(int(_sumLat/_numLat*100)/100.)
- .arg(int(_minLat*100)/100.)
- .arg(int(_maxLat*100)/100.)
- .arg(int((sqrt((_sumLatQ - _sumLat * _sumLat / _numLat)/_numLat))*100)/100.)
- .arg(_numLat);
- if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) {
- emit(newMessage(QString(_staID + late ).toAscii(), true) );
- }
- }
- }
- _meanDiff = int(_diffSecGPS)/_numLat;
- _diffSecGPS = 0;
- _numGaps = 0;
- _sumLat = 0.0;
- _sumLatQ = 0.0;
- _numLat = 0;
- _minLat = 1000.;
- _maxLat = -1000.;
- }
- if (_followSec) {
- _diffSecGPS += _newSecGPS - _oldSecGPS;
- if (_meanDiff>0.) {
- if (_newSecGPS - _oldSecGPS > 1.5 * _meanDiff) {
- _numGaps += 1;
- }
- }
- }
- _curLat = sec - _newSecGPS;
- _sumLat += _curLat;
- _sumLatQ += _curLat * _curLat;
- if (_curLat < _minLat) {
- _minLat = _curLat;
- }
- if (_curLat >= _maxLat) {
- _maxLat = _curLat;
- }
- _numLat += 1;
- _oldSecGPS = _newSecGPS;
- _followSec = true;
- }
- }
-}
-
-// Call advisory notice script
-////////////////////////////////////////////////////////////////////////////
-void latencyChecker::callScript(const char* comment) {
- if (!_adviseScript.isEmpty()) {
-#ifdef WIN32
- Sleep(1);
- QProcess::startDetached(_adviseScript, QStringList() << _staID << comment) ;
-#else
- sleep(1);
- QProcess::startDetached("nohup", QStringList() << _adviseScript << _staID << comment) ;
-#endif
- }
-}
Index: trunk/BNC/latencychecker.h
===================================================================
--- trunk/BNC/latencychecker.h (revision 4277)
+++ (revision )
@@ -1,94 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef LATENCYCHECKER_H
-#define LATENCYCHECKER_H
-
-#include
-
-#include "RTCM/GPSDecoder.h"
-
-class latencyChecker : public QObject {
-Q_OBJECT
-
- public:
- latencyChecker(QByteArray staID);
- ~latencyChecker();
- void checkReconnect();
- void checkOutage(bool decoded);
- void checkObsLatency(const QList& obsList);
- void checkCorrLatency(int corrGPSEpochTime);
- double currentLatency() const {return _curLat;}
-
- signals:
- void newMessage(QByteArray msg, bool showOnScreen);
-
- private:
- void callScript(const char* comment);
- int _inspSegm;
- int _adviseFail;
- int _adviseReco;
- int _perfIntr;
- int _numSucc;
- int _secSucc;
- int _secFail;
- int _initPause;
- int _currPause;
- int _oldSecGPS;
- int _newSecGPS;
- int _numGaps;
- int _diffSecGPS;
- int _numLat;
- bool _wrongEpoch;
- bool _checkSeg;
- bool _begCorrupt;
- bool _endCorrupt;
- bool _followSec;
- double _maxDt;
- double _sumLat;
- double _sumLatQ;
- double _meanDiff;
- double _minLat;
- double _maxLat;
- double _curLat;
- QByteArray _staID;
- QString _adviseScript;
- QString _checkMountPoint;
- QString _begDateCor;
- QString _begTimeCor;
- QString _begDateOut;
- QString _begTimeOut;
- QString _endDateCor;
- QString _endTimeCor;
- QString _endDateOut;
- QString _endTimeOut;
- QDateTime _checkTime;
- QDateTime _decodeSucc;
- QDateTime _decodeFailure;
- QDateTime _decodeStart;
- QDateTime _decodeStop;
- QDateTime _checkPause;
-};
-
-#endif
Index: trunk/BNC/pppopt.cpp
===================================================================
--- trunk/BNC/pppopt.cpp (revision 4277)
+++ (revision )
@@ -1,143 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: t_pppOpt
- *
- * Purpose: Options for Precise Point Positioning
- *
- * Author: L. Mervart
- *
- * Created: 22-Jan-2012
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-#include "pppopt.h"
-#include "bncsettings.h"
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-t_pppOpt::t_pppOpt() {
- bncSettings settings;
-
- sigP3 = settingsToDouble("pppSigmaCode", 5.0);
- sigL3 = settingsToDouble("pppSigmaPhase", 0.02);
- sigCrd0 = settingsToDouble("pppSigCrd0", 100.0);
- sigCrdP = settingsToDouble("pppSigCrdP", 100.0);
- sigTrp0 = settingsToDouble("pppSigTrp0", 0.1);
- sigTrpP = settingsToDouble("pppSigTrpP", 1e-6);
- refCrd[0] = settingsToDouble("pppRefCrdX");
- refCrd[1] = settingsToDouble("pppRefCrdY");
- refCrd[2] = settingsToDouble("pppRefCrdZ");
- antEccNEU[0] = settingsToDouble("pppRefdN");
- antEccNEU[1] = settingsToDouble("pppRefdE");
- antEccNEU[2] = settingsToDouble("pppRefdU");
- maxSolGap = settingsToDouble("pppMaxSolGap");
- quickStart = settingsToDouble("pppQuickStart");
- corrSync = settingsToDouble("pppSync");
- pppAverage = settingsToDouble("pppAverage") * 60.0;
- if (pppAverage < 0.0) {
- pppAverage = 0.0;
- }
- else if (pppAverage > 86400.0) {
- pppAverage = 86400.0;
- }
-
- pppCorrMount = settings.value("pppCorrMount").toString();
- nmeaFile = settings.value("nmeaFile").toString();
- antexFile = settings.value("pppAntex").toString();
- antennaName = settings.value("pppAntenna").toString();
- obsFileName = settings.value("postObsFile").toString();
- navFileName = settings.value("postNavFile").toString();
- corrFileName = settings.value("postCorrFile").toString();
-
- if (settings.value("pppSPP").toString() == "Post-Processing") {
- corrSync = 0.0;
- pppCorrMount = "";
- if (corrFileName.isEmpty()) {
- pppMode = false;
- }
- else {
- pppMode = true;
- }
- }
- else if (settings.value("pppSPP").toString() == "Realtime-PPP") {
- pppMode = true;
- }
- else {
- pppMode = false;
- }
-
- rnxAppend = settingsChecked("rnxAppend");
- usePhase = settingsChecked("pppUsePhase");
- estTropo = settingsChecked("pppEstTropo");
- useGlonass = settingsChecked("pppGLONASS");
- useGalileo = settingsChecked("pppGalileo");
-
- if (!refCrdSet()) quickStart = 0.0;
- if (!pppMode) corrSync = 0.0;
-
- sigGalileoOffset0 = 1000.0;
- sigGalileoOffsetP = 0.0;
- sigClk0 = 1000.0;
- sigAmb0 = 1000.0;
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-t_pppOpt::~t_pppOpt() {
-}
-
-// Settings Value with Default
-////////////////////////////////////////////////////////////////////////////
-double t_pppOpt::settingsToDouble(const QByteArray& keyName,
- double defaultValue) const {
- bncSettings settings;
- if (settings.value(keyName).toString().isEmpty()) {
- return defaultValue;
- }
- else {
- return settings.value(keyName).toDouble();
- }
-}
-
-// Settings Checked
-////////////////////////////////////////////////////////////////////////////
-bool t_pppOpt::settingsChecked(const QByteArray& keyName) const {
- bncSettings settings;
- if (Qt::CheckState(settings.value(keyName).toInt()) == Qt::Checked) {
- return true;
- }
- else {
- return false;
- }
-}
Index: trunk/BNC/pppopt.h
===================================================================
--- trunk/BNC/pppopt.h (revision 4277)
+++ (revision )
@@ -1,74 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef PPPOPT_H
-#define PPPOPT_H
-
-#include
-
-class t_pppOpt {
- public:
- t_pppOpt();
- ~t_pppOpt();
- bool refCrdSet() const {
- return refCrd[0] != 0.0 || refCrd[1] != 0 || refCrd[2] != 0.0;
- }
- bool antEccSet() const {
- return antEccNEU[0] != 0.0 || antEccNEU[1] != 0.0 || antEccNEU[2] != 0.0;
- }
- double sigL3;
- double sigP3;
- double sigCrd0;
- double sigCrdP;
- double sigTrp0;
- double sigTrpP;
- double refCrd[3];
- double antEccNEU[3];
- double maxSolGap;
- double quickStart;
- double corrSync;
- double pppAverage;
- QString pppCorrMount;
- QString nmeaFile;
- QString antexFile;
- QString antennaName;
- QString obsFileName;
- QString navFileName;
- QString corrFileName;
- bool pppMode;
- bool rnxAppend;
- bool usePhase;
- bool estTropo;
- bool useGlonass;
- bool useGalileo;
- double sigGalileoOffset0;
- double sigGalileoOffsetP;
- double sigAmb0;
- double sigClk0;
- private:
- double settingsToDouble(const QByteArray& keyName, double defaultValue = 0.0) const;
- bool settingsChecked(const QByteArray& keyName) const;
-};
-
-#endif
Index: trunk/BNC/qtfilechooser.cpp
===================================================================
--- trunk/BNC/qtfilechooser.cpp (revision 4277)
+++ (revision )
@@ -1,77 +1,0 @@
-/* -------------------------------------------------------------------------
- * Generally useful widget
- * -------------------------------------------------------------------------
- *
- * Class: qtFileChooser
- *
- * Purpose: Widget for selecting a file or directory
- *
- * Author: L. Mervart
- *
- * Created: 10-May-2011
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include "qtfilechooser.h"
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////////
-qtFileChooser::qtFileChooser(QWidget* parent, qtFileChooser::Mode mode) :
- QWidget(parent), _mode(mode) {
-
- QHBoxLayout* layout = new QHBoxLayout( this );
- layout->setMargin(0);
-
- _lineEdit = new QLineEdit(this);
- layout->addWidget(_lineEdit);
-
- connect(_lineEdit, SIGNAL(textChanged(const QString &)),
- this, SIGNAL(fileNameChanged(const QString &)));
-
- _button = new QPushButton("...", this);
- _button->setFixedWidth(_button->fontMetrics().width(" ... "));
- layout->addWidget(_button);
-
- connect(_button, SIGNAL(clicked()), this, SLOT(chooseFile()));
- setFocusProxy(_lineEdit);
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////////
-qtFileChooser::~qtFileChooser() {
-}
-
-//
-////////////////////////////////////////////////////////////////////////////////
-void qtFileChooser::setFileName(const QString& fileName) {
- _lineEdit->setText(fileName);
-}
-
-//
-////////////////////////////////////////////////////////////////////////////////
-QString qtFileChooser::fileName() const {
- return _lineEdit->text();
-}
-
-//
-////////////////////////////////////////////////////////////////////////////////
-void qtFileChooser::chooseFile() {
- QString fileName;
- if (mode() == File) {
- fileName = QFileDialog::getOpenFileName(this);
- }
- else if (mode() == Files) {
- QStringList fileNames = QFileDialog::getOpenFileNames(this);
- fileName = fileNames.join(",");
- }
- else {
- fileName = QFileDialog::getExistingDirectory(this);
- }
-
- if (!fileName.isEmpty()) {
- _lineEdit->setText(fileName);
- emit fileNameChanged(fileName);
- }
-}
Index: trunk/BNC/qtfilechooser.h
===================================================================
--- trunk/BNC/qtfilechooser.h (revision 4277)
+++ (revision )
@@ -1,39 +1,0 @@
-
-#ifndef QTFILECHOOSER
-#define QTFILECHOOSER
-
-#include
-
-class qtFileChooser : public QWidget {
- Q_OBJECT
-
- Q_ENUMS( Mode )
- Q_PROPERTY( Mode mode READ mode WRITE setMode )
- Q_PROPERTY( QString fileName READ fileName WRITE setFileName )
-
- public:
- enum Mode {File, Files, Directory};
-
- qtFileChooser(QWidget* parent = 0, qtFileChooser::Mode mode = File);
- ~qtFileChooser();
-
- QString fileName() const;
- Mode mode() const {return _mode;}
-
- public slots:
- void setFileName(const QString& fileName);
- void setMode(Mode mode) {_mode = mode;}
-
- signals:
- void fileNameChanged(const QString&);
-
- private slots:
- void chooseFile();
-
- private:
- QLineEdit* _lineEdit;
- QPushButton* _button;
- Mode _mode;
-
-};
-#endif
Index: trunk/BNC/reqcdlg.cpp
===================================================================
--- trunk/BNC/reqcdlg.cpp (revision 4277)
+++ (revision )
@@ -1,242 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class: reqcDlg
- *
- * Purpose: Displays the teqc-like editing options
- *
- * Author: L. Mervart
- *
- * Created: 28-Mar-2012
- *
- * Changes:
- *
- * -----------------------------------------------------------------------*/
-
-#include
-
-#include "reqcdlg.h"
-#include "bncsettings.h"
-
-using namespace std;
-
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-reqcDlg::reqcDlg(QWidget* parent) : QDialog(parent) {
-
- setWindowTitle(tr("RINEX Editing Options"));
-
- int ww = QFontMetrics(font()).width('w');
-
- const QString timeFmtString = "yyyy-MM-dd hh:mm:ss";
-
- _reqcRnxVersion = new QComboBox(this);
- _reqcSampling = new QSpinBox(this);
- _reqcStartDateTime = new QDateTimeEdit(this);
- _reqcStartDateTime->setDisplayFormat(timeFmtString);
- _reqcEndDateTime = new QDateTimeEdit(this);
- _reqcEndDateTime->setDisplayFormat(timeFmtString);
- _reqcRunBy = new QLineEdit(this);
- _reqcComment = new QLineEdit(this);
- _reqcOldMarkerName = new QLineEdit(this);
- _reqcNewMarkerName = new QLineEdit(this);
- _reqcOldAntennaName = new QLineEdit(this);
- _reqcNewAntennaName = new QLineEdit(this);
- _reqcOldReceiverName = new QLineEdit(this);
- _reqcNewReceiverName = new QLineEdit(this);
-
- _reqcRnxVersion->setEditable(false);
- _reqcRnxVersion->addItems(QString("2,3").split(","));
- _reqcRnxVersion->setMaximumWidth(7*ww);
-
- _reqcSampling->setMinimum(0);
- _reqcSampling->setMaximum(60);
- _reqcSampling->setSingleStep(5);
- _reqcSampling->setSuffix(" sec");
- _reqcSampling->setMaximumWidth(7*ww);
-
- // Read Options
- // ------------
- bncSettings settings;
-
- int kk = _reqcRnxVersion->findText(settings.value("reqcRnxVersion").toString());
- if (kk != -1) {
- _reqcRnxVersion->setCurrentIndex(kk);
- }
- _reqcSampling->setValue(settings.value("reqcSampling").toInt());
- if (settings.value("reqcStartDateTime").toString().isEmpty()) {
- _reqcStartDateTime->setDateTime(QDateTime::fromString("1967-11-02T00:00:00", Qt::ISODate));
- }
- else {
- _reqcStartDateTime->setDateTime(settings.value("reqcStartDateTime").toDateTime());
- }
- if (settings.value("reqcEndDateTime").toString().isEmpty()) {
- _reqcEndDateTime->setDateTime(QDateTime::fromString("2099-01-01T00:00:00", Qt::ISODate));
- }
- else {
- _reqcEndDateTime->setDateTime(settings.value("reqcEndDateTime").toDateTime());
- }
- _reqcRunBy->setText(settings.value("reqcRunBy").toString());
- _reqcComment->setText(settings.value("reqcComment").toString());
- _reqcOldMarkerName->setText(settings.value("reqcOldMarkerName").toString());
- _reqcNewMarkerName->setText(settings.value("reqcNewMarkerName").toString());
- _reqcOldAntennaName->setText(settings.value("reqcOldAntennaName").toString());
- _reqcNewAntennaName->setText(settings.value("reqcNewAntennaName").toString());
- _reqcOldReceiverName->setText(settings.value("reqcOldReceiverName").toString());
- _reqcNewReceiverName->setText(settings.value("reqcNewReceiverName").toString());
-
- // Dialog Layout
- // -------------
- QGridLayout* grid = new QGridLayout;
-
- int ir = 0;
- grid->addWidget(new QLabel("RNX Version"), ir, 1);
- grid->addWidget(_reqcRnxVersion, ir, 2);
- grid->addWidget(new QLabel(" Sampling"), ir, 3);
- grid->addWidget(_reqcSampling, ir, 4);
- ++ir;
- grid->addWidget(new QLabel("Start"), ir, 1);
- grid->addWidget(_reqcStartDateTime, ir, 2);
- grid->addWidget(new QLabel(" End"), ir, 3);
- grid->addWidget(_reqcEndDateTime, ir, 4);
- ++ir;
- grid->addWidget(new QLabel("Run By"), ir, 0);
- grid->addWidget(_reqcRunBy, ir, 1);
- ++ir;
- grid->addWidget(new QLabel("Comment(s)"), ir, 0);
- grid->addWidget(_reqcComment, ir, 1, 1, 4);
- ++ir;
- grid->addWidget(new QLabel("Old"), ir, 1, 1, 2, Qt::AlignCenter);
- grid->addWidget(new QLabel("New"), ir, 3, 1, 2, Qt::AlignCenter);
- ++ir;
- grid->addWidget(new QLabel("Marker Name"), ir, 0);
- grid->addWidget(_reqcOldMarkerName, ir, 1, 1, 2);
- grid->addWidget(_reqcNewMarkerName, ir, 3, 1, 2);
- ++ir;
- grid->addWidget(new QLabel("Antenna Name"), ir, 0);
- grid->addWidget(_reqcOldAntennaName, ir, 1, 1, 2);
- grid->addWidget(_reqcNewAntennaName, ir, 3, 1, 2);
- ++ir;
- grid->addWidget(new QLabel("Receiver Name"), ir, 0);
- grid->addWidget(_reqcOldReceiverName, ir, 1, 1, 2);
- grid->addWidget(_reqcNewReceiverName, ir, 3, 1, 2);
-
- _buttonWhatsThis = new QPushButton(tr("Help=Shift+F1"), this);
- connect(_buttonWhatsThis, SIGNAL(clicked()), this, SLOT(slotWhatsThis()));
-
- _buttonOK = new QPushButton(tr("OK / Save"), this);
- connect(_buttonOK, SIGNAL(clicked()), this, SLOT(slotOK()));
-
- _buttonCancel = new QPushButton(tr("Cancel"), this);
- connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(close()));
-
- QHBoxLayout* buttonLayout = new QHBoxLayout;
- buttonLayout->addWidget(_buttonWhatsThis);
- buttonLayout->addStretch(1);
- buttonLayout->addWidget(_buttonOK);
- buttonLayout->addWidget(_buttonCancel);
-
- QVBoxLayout* mainLayout = new QVBoxLayout(this);
- mainLayout->addLayout(grid);
- mainLayout->addLayout(buttonLayout);
-
- _reqcRnxVersion->setWhatsThis(tr("Select version number of emerging new RINEX file.
When converting RINEX Version 2 to RINEX Version 3, the tracking mode or channel information in the (last character out of the three characters) observation code is left blank if unknown. When converting RINEX Version 3 to RINEX Version 2
- C1P in RINEX Version 3 is mapped to P1 in RINEX Version 2
- C2P in RINEX Version 3 is mapped to P2 in RINEX Version 2
- If several observations in RINEX Version 3 come with the same observation type, same band/frequency but different tracking modes, BNC uses only the one provided first for creating RINEX Version 2 while ignoring others.
"));
- _reqcSampling->setWhatsThis(tr("Select sampling rate of emerging new RINEX observation file.
"));
- _reqcStartDateTime->setWhatsThis(tr("Specify begin of emerging new RINEX observation file.
"));
- _reqcEndDateTime->setWhatsThis(tr("Specify end of emerging new RINEX observation file.
"));
- _reqcOldMarkerName->setWhatsThis(tr("Enter old marker name in RINEX observation file.
"));
- _reqcNewMarkerName->setWhatsThis(tr("Enter new marker name in RINEX observation file.
"));
- _reqcOldAntennaName->setWhatsThis(tr("Enter old antenna name in RINEX observation file.
"));
- _reqcNewAntennaName->setWhatsThis(tr("Enter new antenna name in RINEX observation file.
"));
- _reqcOldReceiverName->setWhatsThis(tr("Enter old receiver name in RINEX observation file.
"));
- _reqcNewReceiverName->setWhatsThis(tr("Enter new receiver name in RINEX observation file.
"));
- _reqcComment->setWhatsThis(tr("Specifying a comment line text to be added to the emerging new RINEX file header is an option. Any introduction of newline specification '\\n' in this enforces the beginning of a further comment line. The comment line(s) will be added to the header after the 'PGM / RUN BY / DATE' record.
Default is an empty option field meaning that no additional comment line is added to the RINEX header.
"));
- _reqcRunBy->setWhatsThis(tr("Specify a 'RUN BY' string to be included in the emerging new RINEX file header.
Default is an empty option field meanig the operator's user ID is used as 'RUN BY' string.
"));
-
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-reqcDlg::~reqcDlg() {
- delete _buttonOK;
- delete _buttonCancel;
- delete _buttonWhatsThis;
-}
-
-// Accept the Options
-////////////////////////////////////////////////////////////////////////////
-void reqcDlg::slotOK() {
- saveOptions();
- done(0);
-}
-
-// Whats This Help
-////////////////////////////////////////////////////////////////////////////
-void reqcDlg::slotWhatsThis() {
- QWhatsThis::enterWhatsThisMode();
-}
-
-// Close Dialog gracefully
-////////////////////////////////////////////////////////////////////////////
-void reqcDlg::closeEvent(QCloseEvent* event) {
-
- int iRet = QMessageBox::question(this, "Close", "Save Options?",
- QMessageBox::Yes, QMessageBox::No,
- QMessageBox::Cancel);
-
- if (iRet == QMessageBox::Cancel) {
- event->ignore();
- return;
- }
- else if (iRet == QMessageBox::Yes) {
- saveOptions();
- }
-
- QDialog::closeEvent(event);
-}
-
-// Save Selected Options
-////////////////////////////////////////////////////////////////////////////
-void reqcDlg::saveOptions() {
-
- bncSettings settings;
-
- settings.setValue("reqcRnxVersion" , _reqcRnxVersion->currentText());
- settings.setValue("reqcSampling" , _reqcSampling->value());
- settings.setValue("reqcStartDateTime" , _reqcStartDateTime->dateTime().toString(Qt::ISODate));
- settings.setValue("reqcEndDateTime" , _reqcEndDateTime->dateTime().toString(Qt::ISODate));
- settings.setValue("reqcRunBy" , _reqcRunBy->text());
- settings.setValue("reqcComment" , _reqcComment->text());
- settings.setValue("reqcOldMarkerName" , _reqcOldMarkerName->text());
- settings.setValue("reqcNewMarkerName" , _reqcNewMarkerName->text());
- settings.setValue("reqcOldAntennaName" , _reqcOldAntennaName->text());
- settings.setValue("reqcNewAntennaName" , _reqcNewAntennaName->text());
- settings.setValue("reqcOldReceiverName", _reqcOldReceiverName->text());
- settings.setValue("reqcNewReceiverName", _reqcNewReceiverName->text());
-}
Index: trunk/BNC/reqcdlg.h
===================================================================
--- trunk/BNC/reqcdlg.h (revision 4277)
+++ (revision )
@@ -1,70 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef REQCDLG_H
-#define REQCDLG_H
-
-#include
-#include
-
-#include "bncconst.h"
-
-class reqcDlg : public QDialog {
-
- Q_OBJECT
-
- public:
- reqcDlg(QWidget* parent);
- ~reqcDlg();
-
- signals:
-
- private slots:
- void slotOK();
- void slotWhatsThis();
-
- protected:
- virtual void closeEvent(QCloseEvent *);
-
- private:
- void saveOptions();
-
- QComboBox* _reqcRnxVersion;
- QSpinBox* _reqcSampling;
- QDateTimeEdit* _reqcStartDateTime;
- QDateTimeEdit* _reqcEndDateTime;
- QLineEdit* _reqcRunBy;
- QLineEdit* _reqcComment;
- QLineEdit* _reqcOldMarkerName;
- QLineEdit* _reqcNewMarkerName;
- QLineEdit* _reqcOldAntennaName;
- QLineEdit* _reqcNewAntennaName;
- QLineEdit* _reqcOldReceiverName;
- QLineEdit* _reqcNewReceiverName;
- QPushButton* _buttonOK;
- QPushButton* _buttonCancel;
- QPushButton* _buttonWhatsThis;
-};
-
-#endif
Index: trunk/BNC/src/bancroft.cpp
===================================================================
--- trunk/BNC/src/bancroft.cpp (revision 4278)
+++ trunk/BNC/src/bancroft.cpp (revision 4278)
@@ -0,0 +1,79 @@
+
+#include
+
+#include "bancroft.h"
+#include "bncconst.h"
+
+void bancroft(const Matrix& BBpass, ColumnVector& pos) {
+
+ if (pos.Nrows() != 4) {
+ pos.ReSize(4);
+ }
+ pos = 0.0;
+
+ for (int iter = 1; iter <= 2; iter++) {
+ Matrix BB = BBpass;
+ int mm = BB.Nrows();
+ for (int ii = 1; ii <= mm; ii++) {
+ double xx = BB(ii,1);
+ double yy = BB(ii,2);
+ double traveltime = 0.072;
+ if (iter > 1) {
+ double zz = BB(ii,3);
+ double rho = sqrt( (xx-pos(1)) * (xx-pos(1)) +
+ (yy-pos(2)) * (yy-pos(2)) +
+ (zz-pos(3)) * (zz-pos(3)) );
+ traveltime = rho / t_CST::c;
+ }
+ double angle = traveltime * t_CST::omega;
+ double cosa = cos(angle);
+ double sina = sin(angle);
+ BB(ii,1) = cosa * xx + sina * yy;
+ BB(ii,2) = -sina * xx + cosa * yy;
+ }
+
+ Matrix BBB;
+ if (mm > 4) {
+ SymmetricMatrix hlp; hlp << BB.t() * BB;
+ BBB = hlp.i() * BB.t();
+ }
+ else {
+ BBB = BB.i();
+ }
+ ColumnVector ee(mm); ee = 1.0;
+ ColumnVector alpha(mm); alpha = 0.0;
+ for (int ii = 1; ii <= mm; ii++) {
+ alpha(ii) = lorentz(BB.Row(ii).t(),BB.Row(ii).t())/2.0;
+ }
+ ColumnVector BBBe = BBB * ee;
+ ColumnVector BBBalpha = BBB * alpha;
+ double aa = lorentz(BBBe, BBBe);
+ double bb = lorentz(BBBe, BBBalpha)-1;
+ double cc = lorentz(BBBalpha, BBBalpha);
+ double root = sqrt(bb*bb-aa*cc);
+
+ Matrix hlpPos(4,2);
+ hlpPos.Column(1) = (-bb-root)/aa * BBBe + BBBalpha;
+ hlpPos.Column(2) = (-bb+root)/aa * BBBe + BBBalpha;
+
+ ColumnVector omc(2);
+ for (int pp = 1; pp <= 2; pp++) {
+ hlpPos(4,pp) = -hlpPos(4,pp);
+ omc(pp) = BB(1,4) -
+ sqrt( (BB(1,1)-hlpPos(1,pp)) * (BB(1,1)-hlpPos(1,pp)) +
+ (BB(1,2)-hlpPos(2,pp)) * (BB(1,2)-hlpPos(2,pp)) +
+ (BB(1,3)-hlpPos(3,pp)) * (BB(1,3)-hlpPos(3,pp)) ) -
+ hlpPos(4,pp);
+ }
+ if ( fabs(omc(1)) > fabs(omc(2)) ) {
+ pos = hlpPos.Column(2);
+ }
+ else {
+ pos = hlpPos.Column(1);
+ }
+ }
+}
+
+double lorentz(const ColumnVector& aa, const ColumnVector& bb) {
+ return aa(1)*bb(1) + aa(2)*bb(2) + aa(3)*bb(3) - aa(4)*bb(4);
+}
Index: trunk/BNC/src/bancroft.h
===================================================================
--- trunk/BNC/src/bancroft.h (revision 4278)
+++ trunk/BNC/src/bancroft.h (revision 4278)
@@ -0,0 +1,12 @@
+
+#ifndef BANCROFT_H
+#define BANCROFT_H
+
+#include
+
+void bancroft(const Matrix& BBpass, ColumnVector& pos);
+
+inline double lorentz(const ColumnVector& aa, const ColumnVector& bb);
+
+#endif
+
Index: trunk/BNC/src/bnc.pro
===================================================================
--- trunk/BNC/src/bnc.pro (revision 4278)
+++ trunk/BNC/src/bnc.pro (revision 4278)
@@ -0,0 +1,123 @@
+
+# Switch to debug configuration
+# -----------------------------
+CONFIG -= debug
+CONFIG += release
+
+DEFINES += NO_RTCM3_MAIN
+###DEFINES += DEBUG_RTCM2_2021
+unix:DEFINES += _TTY_POSIX_
+win32:DEFINES += _TTY_WIN_
+
+RESOURCES += bnc.qrc
+
+unix:QMAKE_CFLAGS_RELEASE -= -O2
+unix:QMAKE_CXXFLAGS_RELEASE -= -O2
+
+# Get rid of mingwm10.dll and libgcc_s_dw2-1.dll
+# ----------------------------------------------
+win32 {
+ QMAKE_LFLAGS += -static-libgcc
+ QMAKE_LFLAGS -= -mthreads
+ QMAKE_CXXFLAGS_EXCEPTIONS_ON -= -mthreads
+ QMAKE_LFLAGS_EXCEPTIONS_ON -= -mthreads
+}
+
+debug:OBJECTS_DIR=.obj/debug
+debug:MOC_DIR=.moc/debug
+release:OBJECTS_DIR=.obj/release
+release:MOC_DIR=.moc/release
+
+# Include Path
+# ------------
+INCLUDEPATH = . ./newmat ./RTCM3 ./RTCM3/clock_and_orbit ./RTCM3/rtcm3torinex
+
+HEADERS = bnchelp.html bncgetthread.h bncwindow.h bnctabledlg.h \
+ bnccaster.h bncrinex.h bncapp.h bncutils.h bnchlpdlg.h \
+ bncconst.h bnchtml.h bnctableitem.h bnczerodecoder.h \
+ bncnetquery.h bncnetqueryv1.h bncnetqueryv2.h \
+ bncnetqueryrtp.h bncsettings.h latencychecker.h \
+ bncipport.h bncnetqueryv0.h bncnetqueryudp.h \
+ bncnetqueryudp0.h bncudpport.h bnctime.h pppopt.h \
+ bncserialport.h bncnetquerys.h bncfigure.h \
+ bncfigurelate.h bncpppclient.h bncversion.h \
+ bancroft.h bncmodel.h bncfigureppp.h bncrawfile.h \
+ bnctides.h bncmap.h bncmapview.h bncantex.h \
+ bncephuser.h bncoutf.h bncclockrinex.h bncsp3.h \
+ bncbytescounter.h bncsslconfig.h reqcdlg.h \
+ upload/bncrtnetdecoder.h upload/bncuploadcaster.h \
+ upload/bncrtnetuploadcaster.h upload/bnccustomtrafo.h \
+ upload/bncephuploadcaster.h bnccomb.h qtfilechooser.h \
+ RTCM/GPSDecoder.h RTCM/RTCM2.h RTCM/RTCM2Decoder.h \
+ RTCM/RTCM2_2021.h RTCM/rtcm_utils.h \
+ RTCM3/RTCM3Decoder.h RTCM3/rtcm3torinex/rtcm3torinex.h \
+ RTCM3/RTCM3coDecoder.h \
+ RTCM3/clock_and_orbit/clock_orbit_rtcm.h \
+ RTCM3/ephemeris.h RTCM3/timeutils.h \
+ GPSS/gpssDecoder.h GPSS/hassDecoder.h
+
+HEADERS += serial/qextserialbase.h serial/qextserialport.h
+unix:HEADERS += serial/posix_qextserialport.h
+win32:HEADERS += serial/win_qextserialport.h
+
+HEADERS += newmat/controlw.h newmat/include.h newmat/myexcept.h \
+ newmat/newmatap.h newmat/newmat.h newmat/newmatio.h \
+ newmat/newmatrc.h newmat/newmatrm.h newmat/precisio.h
+
+SOURCES = bncmain.cpp bncgetthread.cpp bncwindow.cpp bnctabledlg.cpp \
+ bnccaster.cpp bncrinex.cpp bncapp.cpp bncutils.cpp \
+ bncconst.cpp bnchtml.cpp bnchlpdlg.cpp bnctableitem.cpp \
+ bnczerodecoder.cpp bncnetqueryv1.cpp bncnetqueryv2.cpp \
+ bncnetqueryrtp.cpp bncsettings.cpp latencychecker.cpp \
+ bncipport.cpp bncnetqueryv0.cpp bncnetqueryudp.cpp \
+ bncnetqueryudp0.cpp bncudpport.cpp pppopt.cpp \
+ bncserialport.cpp bncnetquerys.cpp bncfigure.cpp \
+ bncfigurelate.cpp bncpppclient.cpp bnctime.cpp \
+ bancroft.cpp bncmodel.cpp bncfigureppp.cpp bncrawfile.cpp \
+ bnctides.cpp bncmap.cpp bncmapview.cpp bncantex.cpp \
+ bncephuser.cpp bncoutf.cpp bncclockrinex.cpp bncsp3.cpp \
+ bncbytescounter.cpp bncsslconfig.cpp reqcdlg.cpp \
+ upload/bncrtnetdecoder.cpp upload/bncuploadcaster.cpp \
+ upload/bncrtnetuploadcaster.cpp upload/bnccustomtrafo.cpp \
+ upload/bncephuploadcaster.cpp qtfilechooser.cpp \
+ RTCM/GPSDecoder.cpp RTCM/RTCM2.cpp RTCM/RTCM2Decoder.cpp \
+ RTCM/RTCM2_2021.cpp RTCM/rtcm_utils.cpp \
+ RTCM3/RTCM3Decoder.cpp RTCM3/rtcm3torinex/rtcm3torinex.c \
+ RTCM3/RTCM3coDecoder.cpp \
+ RTCM3/clock_and_orbit/clock_orbit_rtcm.c \
+ RTCM3/ephemeris.cpp RTCM3/timeutils.cpp \
+ GPSS/gpssDecoder.cpp GPSS/hassDecoder.cpp
+
+SOURCES += serial/qextserialbase.cpp serial/qextserialport.cpp
+unix:SOURCES += serial/posix_qextserialport.cpp
+win32:SOURCES += serial/win_qextserialport.cpp
+
+SOURCES += newmat/bandmat.cpp newmat/cholesky.cpp newmat/evalue.cpp \
+ newmat/fft.cpp newmat/hholder.cpp newmat/jacobi.cpp \
+ newmat/myexcept.cpp newmat/newfft.cpp newmat/newmat1.cpp \
+ newmat/newmat2.cpp newmat/newmat3.cpp newmat/newmat4.cpp \
+ newmat/newmat5.cpp newmat/newmat6.cpp newmat/newmat7.cpp \
+ newmat/newmat8.cpp newmat/newmat9.cpp newmat/newmatex.cpp \
+ newmat/newmatrm.cpp newmat/nm_misc.cpp newmat/sort.cpp \
+ newmat/submat.cpp newmat/svd.cpp
+
+RC_FILE = bnc.rc
+
+QT += network
+
+exists(combination/bnccomb.h) {
+ DEFINES += USE_COMBINATION
+ HEADERS += combination/bnccomb.h
+ SOURCES += combination/bnccomb.cpp
+}
+
+exists(rinex/bncpostprocess.h) {
+ DEFINES += USE_POSTPROCESSING
+ HEADERS += rinex/bncpostprocess.h rinex/rnxobsfile.h \
+ rinex/rnxnavfile.h rinex/corrfile.h \
+ rinex/reqcedit.h rinex/reqcanalyze.h
+ SOURCES += rinex/bncpostprocess.cpp rinex/rnxobsfile.cpp \
+ rinex/rnxnavfile.cpp rinex/corrfile.cpp \
+ rinex/reqcedit.cpp rinex/reqcanalyze.cpp
+}
+
Index: trunk/BNC/src/bncantex.cpp
===================================================================
--- trunk/BNC/src/bncantex.cpp (revision 4278)
+++ trunk/BNC/src/bncantex.cpp (revision 4278)
@@ -0,0 +1,275 @@
+// Part of BNC, a utility for retrieving decoding and
+// converting GNSS data streams from NTRIP broadcasters.
+//
+// Copyright (C) 2007
+// German Federal Agency for Cartography and Geodesy (BKG)
+// http://www.bkg.bund.de
+// Czech Technical University Prague, Department of Geodesy
+// http://www.fsv.cvut.cz
+//
+// Email: euref-ip@bkg.bund.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation, version 2.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+/* -------------------------------------------------------------------------
+ * BKG NTRIP Client
+ * -------------------------------------------------------------------------
+ *
+ * Class: bncAntex
+ *
+ * Purpose: Antenna Phase Centers and Variations from ANTEX File
+ *
+ * Author: L. Mervart
+ *
+ * Created: 26-Jan-2011
+ *
+ * Changes:
+ *
+ * -----------------------------------------------------------------------*/
+
+#include
+#include
+
+#include "bncantex.h"
+#include "bnctides.h"
+
+using namespace std;
+
+// Constructor
+////////////////////////////////////////////////////////////////////////////
+bncAntex::bncAntex() {
+}
+
+// Destructor
+////////////////////////////////////////////////////////////////////////////
+bncAntex::~bncAntex() {
+ QMapIterator it(_maps);
+ while (it.hasNext()) {
+ it.next();
+ delete it.value();
+ }
+}
+
+// Print
+////////////////////////////////////////////////////////////////////////////
+void bncAntex::print() const {
+ QMapIterator it(_maps);
+ while (it.hasNext()) {
+ it.next();
+ t_antMap* map = it.value();
+ cout << map->antName.toAscii().data() << endl;
+ cout << " " << map->zen1 << " " << map->zen2 << " " << map->dZen << endl;
+ if (map->frqMapL1) {
+ cout << " " << map->frqMapL1->neu[0] << " "
+ << map->frqMapL1->neu[1] << " "
+ << map->frqMapL1->neu[2] << endl;
+ cout << " " << map->frqMapL1->pattern.t();
+ }
+ if (map->frqMapL2) {
+ cout << " " << map->frqMapL2->neu[0] << " "
+ << map->frqMapL2->neu[1] << " "
+ << map->frqMapL2->neu[2] << endl;
+ cout << " " << map->frqMapL2->pattern.t();
+ }
+ cout << endl;
+ }
+}
+
+// Read ANTEX File
+////////////////////////////////////////////////////////////////////////////
+t_irc bncAntex::readFile(const QString& fileName) {
+
+ QFile inFile(fileName);
+ inFile.open(QIODevice::ReadOnly | QIODevice::Text);
+
+ QTextStream in(&inFile);
+
+ t_antMap* newAntMap = 0;
+ t_frqMap* newFrqMap = 0;
+
+ while ( !in.atEnd() ) {
+ QString line = in.readLine();
+
+ // Start of Antenna
+ // ----------------
+ if (line.indexOf("START OF ANTENNA") == 60) {
+ if (newAntMap) {
+ delete newAntMap;
+ return failure;
+ }
+ else {
+ delete newAntMap;
+ newAntMap = new t_antMap();
+ }
+ }
+
+ // End of Antenna
+ // --------------
+ else if (line.indexOf("END OF ANTENNA") == 60) {
+ if (newAntMap) {
+ if (_maps.contains(newAntMap->antName)) {
+ delete _maps[newAntMap->antName];
+ }
+ _maps[newAntMap->antName] = newAntMap;
+ newAntMap = 0;
+ }
+ else {
+ delete newAntMap;
+ return failure;
+ }
+ }
+
+ // Antenna Reading in Progress
+ // ---------------------------
+ else if (newAntMap) {
+ if (line.indexOf("TYPE / SERIAL NO") == 60) {
+ if (line.indexOf("BLOCK I") == 0 ||
+ line.indexOf("GLONASS") == 0) {
+ newAntMap->antName = line.mid(20,3);
+ }
+ else {
+ newAntMap->antName = line.mid(0,20);
+ }
+ }
+ else if (line.indexOf("ZEN1 / ZEN2 / DZEN") == 60) {
+ QTextStream inLine(&line, QIODevice::ReadOnly);
+ inLine >> newAntMap->zen1 >> newAntMap->zen2 >> newAntMap->dZen;
+ }
+
+ // Start of Frequency
+ // ------------------
+ else if (line.indexOf("START OF FREQUENCY") == 60) {
+ if (newFrqMap) {
+ delete newFrqMap;
+ delete newAntMap;
+ return failure;
+ }
+ else {
+ newFrqMap = new t_frqMap();
+ }
+ }
+
+ // End of Frequency
+ // ----------------
+ else if (line.indexOf("END OF FREQUENCY") == 60) {
+ if (newFrqMap) {
+ if (line.indexOf("G01") == 3 || line.indexOf("R01") == 3) {
+ delete newAntMap->frqMapL1;
+ newAntMap->frqMapL1 = newFrqMap;
+ }
+ else if (line.indexOf("G02") == 3 || line.indexOf("R02") == 3) {
+ delete newAntMap->frqMapL2;
+ newAntMap->frqMapL2 = newFrqMap;
+ }
+ else {
+ delete newFrqMap;
+ }
+ newFrqMap = 0;
+ }
+ else {
+ delete newAntMap;
+ return failure;
+ }
+ }
+
+ // Frequency Reading in Progress
+ // -----------------------------
+ else if (newFrqMap) {
+ if (line.indexOf("NORTH / EAST / UP") == 60) {
+ QTextStream inLine(&line, QIODevice::ReadOnly);
+ inLine >> newFrqMap->neu[0] >> newFrqMap->neu[1] >> newFrqMap->neu[2];
+ newFrqMap->neu[0] *= 1e-3;
+ newFrqMap->neu[1] *= 1e-3;
+ newFrqMap->neu[2] *= 1e-3;
+ }
+ else if (line.indexOf("NOAZI") == 3) {
+ QTextStream inLine(&line, QIODevice::ReadOnly);
+ int nPat = int((newAntMap->zen2-newAntMap->zen1)/newAntMap->dZen) + 1;
+ newFrqMap->pattern.ReSize(nPat);
+ QString dummy;
+ inLine >> dummy;
+ for (int ii = 0; ii < nPat; ii++) {
+ inLine >> newFrqMap->pattern[ii];
+ }
+ newFrqMap->pattern *= 1e-3;
+ }
+ }
+ }
+ }
+
+ delete newFrqMap;
+ delete newAntMap;
+
+ return success;
+}
+
+// Satellite Antenna Offset
+////////////////////////////////////////////////////////////////////////////
+t_irc bncAntex::satCoMcorrection(const QString& prn, double Mjd,
+ const ColumnVector& xSat, ColumnVector& dx) {
+
+ QMap::const_iterator it = _maps.find(prn);
+ if (it != _maps.end()) {
+ t_antMap* map = it.value();
+ double* neu = map->frqMapL1->neu;
+
+ // Unit Vectors sz, sy, sx
+ // -----------------------
+ ColumnVector sz = -xSat;
+ sz /= sqrt(DotProduct(sz,sz));
+
+ ColumnVector xSun = Sun(Mjd);
+ xSun /= sqrt(DotProduct(xSun,xSun));
+
+ ColumnVector sy = crossproduct(sz, xSun);
+ sy /= sqrt(DotProduct(sy,sy));
+
+ ColumnVector sx = crossproduct(sy, sz);
+
+ dx[0] = sx[0] * neu[0] + sy[0] * neu[1] + sz[0] * neu[2];
+ dx[1] = sx[1] * neu[0] + sy[1] * neu[1] + sz[1] * neu[2];
+ dx[2] = sx[2] * neu[0] + sy[2] * neu[1] + sz[2] * neu[2];
+
+ return success;
+ }
+ else {
+ return failure;
+ }
+}
+
+// Phase Center Offset (Receiver Antenna and GPS only)
+////////////////////////////////////////////////////////////////////////////
+double bncAntex::pco(const QString& antName, double eleSat, bool& found) {
+
+ static const double f1 = t_CST::freq1;
+ static const double f2 = t_CST::freq2;
+ static const double c1 = f1 * f1 / (f1 * f1 - f2 * f2);
+ static const double c2 = - f2 * f2 / (f1 * f1 - f2 * f2);
+
+ QMap::const_iterator it = _maps.find(antName);
+ if (it != _maps.end()) {
+ found = true;
+ t_antMap* map = it.value();
+ if (map->frqMapL1 && map->frqMapL2) {
+ double corr1 = -map->frqMapL1->neu[2] * sin(eleSat);
+ double corr2 = -map->frqMapL2->neu[2] * sin(eleSat);
+ return c1 * corr1 + c2 * corr2;
+ }
+ }
+ else {
+ found = false;
+ }
+
+ return 0.0;
+}
Index: trunk/BNC/src/bncantex.h
===================================================================
--- trunk/BNC/src/bncantex.h (revision 4278)
+++ trunk/BNC/src/bncantex.h (revision 4278)
@@ -0,0 +1,74 @@
+// Part of BNC, a utility for retrieving decoding and
+// converting GNSS data streams from NTRIP broadcasters.
+//
+// Copyright (C) 2007
+// German Federal Agency for Cartography and Geodesy (BKG)
+// http://www.bkg.bund.de
+// Czech Technical University Prague, Department of Geodesy
+// http://www.fsv.cvut.cz
+//
+// Email: euref-ip@bkg.bund.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation, version 2.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef BNCANTEX_H
+#define BNCANTEX_H
+
+#include
+#include
+#include "bncconst.h"
+#include "bnctime.h"
+
+class bncAntex {
+ public:
+ bncAntex();
+ ~bncAntex();
+ t_irc readFile(const QString& fileName);
+ void print() const;
+ double pco(const QString& antName, double eleSat, bool& found);
+ t_irc satCoMcorrection(const QString& prn, double Mjd,
+ const ColumnVector& xSat, ColumnVector& dx);
+
+ private:
+
+ class t_frqMap {
+ public:
+ double neu[3];
+ ColumnVector pattern;
+ };
+
+ class t_antMap {
+ public:
+ t_antMap() {
+ frqMapL1 = 0;
+ frqMapL2 = 0;
+ }
+ ~t_antMap() {
+ delete frqMapL1;
+ delete frqMapL2;
+ }
+ QString antName;
+ double zen1;
+ double zen2;
+ double dZen;
+ t_frqMap* frqMapL1;
+ t_frqMap* frqMapL2;
+ bncTime validFrom;
+ bncTime validTo;
+ };
+
+ QMap _maps;
+};
+
+#endif
Index: trunk/BNC/src/bncapp.cpp
===================================================================
--- trunk/BNC/src/bncapp.cpp (revision 4278)
+++ trunk/BNC/src/bncapp.cpp (revision 4278)
@@ -0,0 +1,820 @@
+// Part of BNC, a utility for retrieving decoding and
+// converting GNSS data streams from NTRIP broadcasters.
+//
+// Copyright (C) 2007
+// German Federal Agency for Cartography and Geodesy (BKG)
+// http://www.bkg.bund.de
+// Czech Technical University Prague, Department of Geodesy
+// http://www.fsv.cvut.cz
+//
+// Email: euref-ip@bkg.bund.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation, version 2.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+/* -------------------------------------------------------------------------
+ * BKG NTRIP Client
+ * -------------------------------------------------------------------------
+ *
+ * Class: bncApp
+ *
+ * Purpose: This class implements the main application
+ *
+ * Author: L. Mervart
+ *
+ * Created: 29-Aug-2006
+ *
+ * Changes:
+ *
+ * -----------------------------------------------------------------------*/
+
+#include
+#include
+#include
+
+#include "bncapp.h"
+#include "bncutils.h"
+#include "bncrinex.h"
+#include "bncsettings.h"
+#include "bncversion.h"
+#include "RTCM3/ephemeris.h"
+
+#ifdef USE_COMBINATION
+#include "combination/bnccomb.h"
+#endif
+
+using namespace std;
+
+// Constructor
+////////////////////////////////////////////////////////////////////////////
+bncApp::bncApp(int& argc, char* argv[], bool GUIenabled) :
+ QApplication(argc, argv, GUIenabled) {
+
+ _logFileFlag = 0;
+ _logFile = 0;
+ _logStream = 0;
+ _caster = 0;
+ _rawFile = 0;
+#ifdef USE_COMBINATION
+ _bncComb = 0;
+#endif
+
+ // Lists of Ephemeris
+ // ------------------
+ for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
+ _gpsEph[ii-PRN_GPS_START] = 0;
+ }
+ for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
+ _glonassEph[ii-PRN_GLONASS_START] = 0;
+ }
+ for (int ii = PRN_GALILEO_START; ii <= PRN_GALILEO_END; ii++) {
+ _galileoEph[ii-PRN_GALILEO_START] = 0;
+ }
+
+ // Eph file(s)
+ // -----------
+ _rinexVers = 0;
+ _ephFileGPS = 0;
+ _ephStreamGPS = 0;
+ _ephFileGlonass = 0;
+ _ephStreamGlonass = 0;
+ _ephFileGalileo = 0;
+ _ephStreamGalileo = 0;
+
+ _port = 0;
+ _server = 0;
+ _sockets = 0;
+
+ _portCorr = 0;
+ _serverCorr = 0;
+ _socketsCorr = 0;
+
+ _pgmName = QString(BNCPGMNAME).leftJustified(20, ' ', true);
+#ifdef WIN32
+ _userName = QString("${USERNAME}");
+#else
+ _userName = QString("${USER}");
+#endif
+ expandEnvVar(_userName);
+ _userName = _userName.leftJustified(20, ' ', true);
+
+ _lastDumpCoSec = 0;
+
+ _corrs = new QMultiMap;
+
+ _currentDateAndTimeGPS = 0;
+
+ for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
+ _GLOFreq[ii] = 0;
+ }
+
+ _bncPPPclient = 0;
+}
+
+// Destructor
+////////////////////////////////////////////////////////////////////////////
+bncApp::~bncApp() {
+ delete _logStream;
+ delete _logFile;
+ delete _ephStreamGPS;
+ delete _ephFileGPS;
+ delete _server;
+ delete _sockets;
+ delete _serverCorr;
+ delete _socketsCorr;
+ if (_rinexVers == 2) {
+ delete _ephStreamGlonass;
+ delete _ephFileGlonass;
+ }
+ for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
+ delete _gpsEph[ii-PRN_GPS_START];
+ }
+ for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
+ delete _glonassEph[ii-PRN_GLONASS_START];
+ }
+ for (int ii = PRN_GALILEO_START; ii <= PRN_GALILEO_END; ii++) {
+ delete _galileoEph[ii-PRN_GALILEO_START];
+ }
+
+ delete _corrs;
+
+ delete _currentDateAndTimeGPS;
+
+ delete _rawFile;
+
+#ifdef USE_COMBINATION
+ delete _bncComb;
+#endif
+}
+
+// Write a Program Message
+////////////////////////////////////////////////////////////////////////////
+void bncApp::slotMessage(QByteArray msg, bool showOnScreen) {
+
+ QMutexLocker locker(&_mutexMessage);
+
+ messagePrivate(msg);
+ emit newMessage(msg, showOnScreen);
+}
+
+// Write a Program Message (private, no lock)
+////////////////////////////////////////////////////////////////////////////
+void bncApp::messagePrivate(const QByteArray& msg) {
+
+ // First time resolve the log file name
+ // ------------------------------------
+ QDate currDate = currentDateAndTimeGPS().date();
+ if (_logFileFlag == 0 || _fileDate != currDate) {
+ delete _logStream; _logStream = 0;
+ delete _logFile; _logFile = 0;
+ _logFileFlag = 1;
+ bncSettings settings;
+ QString logFileName = settings.value("logFile").toString();
+ if ( !logFileName.isEmpty() ) {
+ expandEnvVar(logFileName);
+ _logFile = new QFile(logFileName + "_" +
+ currDate.toString("yyMMdd").toAscii().data());
+ _fileDate = currDate;
+ if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
+ _logFile->open(QIODevice::WriteOnly | QIODevice::Append);
+ }
+ else {
+ _logFile->open(QIODevice::WriteOnly);
+ }
+ _logStream = new QTextStream();
+ _logStream->setDevice(_logFile);
+ }
+ }
+
+ if (_logStream) {
+ QByteArray msgLocal = msg;
+ if (msg.indexOf('\n') == 0) {
+ *_logStream << endl;
+ msgLocal = msg.mid(1);
+ }
+ *_logStream << currentDateAndTimeGPS().toString("yy-MM-dd hh:mm:ss ").toAscii().data();
+ *_logStream << msgLocal.data() << endl;
+ _logStream->flush();
+ _logFile->flush();
+ }
+}
+
+// New GPS Ephemeris
+////////////////////////////////////////////////////////////////////////////
+void bncApp::slotNewGPSEph(gpsephemeris* gpseph) {
+
+ QMutexLocker locker(&_mutex);
+
+ gpsephemeris copy_gpseph = *gpseph;
+ emit newEphGPS(copy_gpseph);
+
+ printEphHeader();
+
+ gpsephemeris** ee = &_gpsEph[gpseph->satellite-1];
+
+ if ( *ee != 0 &&
+ gpseph->GPSweek == (*ee)->GPSweek && gpseph->TOC == (*ee)->TOC ) {
+ checkEphemeris(*ee, gpseph);
+ }
+
+ if ( *ee == 0 ||
+ gpseph->GPSweek > (*ee)->GPSweek ||
+ (gpseph->GPSweek == (*ee)->GPSweek && gpseph->TOC > (*ee)->TOC) ) {
+ delete *ee;
+ *ee = gpseph;
+ printGPSEph(gpseph, true);
+ }
+ else {
+ printGPSEph(gpseph, false);
+ delete gpseph;
+ }
+}
+
+// New Glonass Ephemeris
+////////////////////////////////////////////////////////////////////////////
+void bncApp::slotNewGlonassEph(glonassephemeris* glonasseph) {
+
+ QMutexLocker locker(&_mutex);
+
+ glonassephemeris copy_glonasseph = *glonasseph;
+ emit newEphGlonass(copy_glonasseph);
+
+ printEphHeader();
+
+ glonassephemeris** ee = &_glonassEph[glonasseph->almanac_number-1];
+
+ int wwOld, towOld, wwNew, towNew;
+ if (*ee != 0) {
+ wwOld = (*ee)->GPSWeek;
+ towOld = (*ee)->GPSTOW;
+ updatetime(&wwOld, &towOld, (*ee)->tb*1000, 0); // Moscow -> GPS
+
+ wwNew = glonasseph->GPSWeek;
+ towNew = glonasseph->GPSTOW;
+ updatetime(&wwNew, &towNew, glonasseph->tb*1000, 0); // Moscow -> GPS
+ }
+
+ if ( *ee == 0 ||
+ wwNew > wwOld ||
+ (wwNew == wwOld && towNew > towOld) ) {
+ delete *ee;
+ *ee = glonasseph;
+ printGlonassEph(glonasseph, true);
+ }
+ else {
+ printGlonassEph(glonasseph, false);
+ delete glonasseph;
+ }
+}
+
+// New Galileo Ephemeris
+////////////////////////////////////////////////////////////////////////////
+void bncApp::slotNewGalileoEph(galileoephemeris* galileoeph) {
+
+ QMutexLocker locker(&_mutex);
+
+ galileoephemeris copy_galileoeph = *galileoeph;
+ emit newEphGalileo(copy_galileoeph);
+
+ printEphHeader();
+
+ int galIndex = galileoeph->satellite;
+ /* GIOVE */
+ if(galIndex == 51) galIndex = 1;
+ else if(galIndex == 52) galIndex = 16;
+ if (galIndex < 0 || galIndex > PRN_GALILEO_END - PRN_GALILEO_START) {
+ emit( newMessage("Wrong Galileo Satellite Number", true) );
+ exit(1);
+ }
+
+ galileoephemeris** ee = &_galileoEph[galIndex];
+
+ if ( *ee == 0 ||
+ galileoeph->Week > (*ee)->Week ||
+ (galileoeph->Week == (*ee)->Week && galileoeph->TOC > (*ee)->TOC) ) {
+ delete *ee;
+ *ee = galileoeph;
+ printGalileoEph(galileoeph, true);
+ }
+ else {
+ printGalileoEph(galileoeph, false);
+ delete galileoeph;
+ }
+}
+
+// Print Header of the output File(s)
+////////////////////////////////////////////////////////////////////////////
+void bncApp::printEphHeader() {
+
+ bncSettings settings;
+
+ // Initialization
+ // --------------
+ if (_rinexVers == 0) {
+
+ if ( Qt::CheckState(settings.value("ephV3").toInt()) == Qt::Checked) {
+ _rinexVers = 3;
+ }
+ else {
+ _rinexVers = 2;
+ }
+
+ _ephPath = settings.value("ephPath").toString();
+
+ if ( !_ephPath.isEmpty() ) {
+ if ( _ephPath[_ephPath.length()-1] != QDir::separator() ) {
+ _ephPath += QDir::separator();
+ }
+ expandEnvVar(_ephPath);
+ }
+ }
+
+ // (Re-)Open output File(s)
+ // ------------------------
+ if (!_ephPath.isEmpty()) {
+
+ QDateTime datTim = currentDateAndTimeGPS();
+
+ QString ephFileNameGPS = _ephPath + "BRDC" +
+ QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0'));
+
+ QString hlpStr = bncRinex::nextEpochStr(datTim,
+ settings.value("ephIntr").toString());
+
+ if (_rinexVers == 3) {
+ ephFileNameGPS += hlpStr + datTim.toString(".yyP");
+ }
+ else {
+ ephFileNameGPS += hlpStr + datTim.toString(".yyN");
+ }
+
+ if (_ephFileNameGPS == ephFileNameGPS) {
+ return;
+ }
+ else {
+ _ephFileNameGPS = ephFileNameGPS;
+ }
+
+ for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
+ delete _gpsEph[ii-PRN_GPS_START];
+ _gpsEph[ii-PRN_GPS_START] = 0;
+ }
+ for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
+ delete _glonassEph[ii-PRN_GLONASS_START];
+ _glonassEph[ii-PRN_GLONASS_START] = 0;
+ }
+ for (int ii = PRN_GALILEO_START; ii <= PRN_GALILEO_END; ii++) {
+ delete _galileoEph[ii-PRN_GALILEO_START];
+ _galileoEph[ii-PRN_GALILEO_START] = 0;
+ }
+
+ delete _ephStreamGPS;
+ delete _ephFileGPS;
+
+ QFlags appendFlagGPS;
+ QFlags appendFlagGlonass;
+ QFlags appendFlagGalileo;
+
+ if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked &&
+ QFile::exists(ephFileNameGPS) ) {
+ appendFlagGPS = QIODevice::Append;
+ }
+
+ _ephFileGPS = new QFile(ephFileNameGPS);
+ _ephFileGPS->open(QIODevice::WriteOnly | appendFlagGPS);
+ _ephStreamGPS = new QTextStream();
+ _ephStreamGPS->setDevice(_ephFileGPS);
+
+ if (_rinexVers == 3) {
+ _ephFileGlonass = _ephFileGPS;
+ _ephStreamGlonass = _ephStreamGPS;
+ _ephFileGalileo = _ephFileGPS;
+ _ephStreamGalileo = _ephStreamGPS;
+ }
+ else if (_rinexVers == 2) {
+ QString ephFileNameGlonass = _ephPath + "BRDC" +
+ QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0')) +
+ hlpStr + datTim.toString(".yyG");
+
+ delete _ephStreamGlonass;
+ delete _ephFileGlonass;
+
+ if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked &&
+ QFile::exists(ephFileNameGlonass) ) {
+ appendFlagGlonass = QIODevice::Append;
+ }
+
+ _ephFileGlonass = new QFile(ephFileNameGlonass);
+ _ephFileGlonass->open(QIODevice::WriteOnly | appendFlagGlonass);
+ _ephStreamGlonass = new QTextStream();
+ _ephStreamGlonass->setDevice(_ephFileGlonass);
+ }
+
+ // Header - RINEX Version 3
+ // ------------------------
+ if (_rinexVers == 3) {
+ if ( ! (appendFlagGPS & QIODevice::Append)) {
+ QString line;
+ line.sprintf(
+ "%9.2f%11sN: GNSS NAV DATA M: Mixed%12sRINEX VERSION / TYPE\n",
+ 3.0, "", "");
+ *_ephStreamGPS << line;
+
+ QString hlp = currentDateAndTimeGPS().toString("yyyyMMdd hhmmss UTC").leftJustified(20, ' ', true);
+ *_ephStreamGPS << _pgmName.toAscii().data()
+ << _userName.toAscii().data()
+ << hlp.toAscii().data()
+ << "PGM / RUN BY / DATE" << endl;
+
+ line.sprintf("%60sEND OF HEADER\n", "");
+ *_ephStreamGPS << line;
+
+ _ephStreamGPS->flush();
+ }
+ }
+
+ // Headers - RINEX Version 2
+ // -------------------------
+ else if (_rinexVers == 2) {
+ if (! (appendFlagGPS & QIODevice::Append)) {
+ QString line;
+ line.sprintf(
+ "%9.2f%11sN: GPS NAV DATA%25sRINEX VERSION / TYPE\n", 2.10, "", "");
+ *_ephStreamGPS << line;
+
+ QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
+ *_ephStreamGPS << _pgmName.toAscii().data()
+ << _userName.toAscii().data()
+ << hlp.toAscii().data()
+ << "PGM / RUN BY / DATE" << endl;
+
+ line.sprintf("%60sEND OF HEADER\n", "");
+ *_ephStreamGPS << line;
+
+ _ephStreamGPS->flush();
+ }
+ if (! (appendFlagGlonass & QIODevice::Append)) {
+ QString line;
+ line.sprintf(
+ "%9.2f%11sG: GLONASS NAV DATA%21sRINEX VERSION / TYPE\n",2.10,"","");
+ *_ephStreamGlonass << line;
+
+ QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
+ *_ephStreamGlonass << _pgmName.toAscii().data()
+ << _userName.toAscii().data()
+ << hlp.toAscii().data()
+ << "PGM / RUN BY / DATE" << endl;
+
+ line.sprintf("%60sEND OF HEADER\n", "");
+ *_ephStreamGlonass << line;
+
+ _ephStreamGlonass->flush();
+ }
+ }
+ }
+}
+
+// Print One GPS Ephemeris
+////////////////////////////////////////////////////////////////////////////
+void bncApp::printGPSEph(gpsephemeris* ep, bool printFile) {
+
+ t_ephGPS eph;
+ eph.set(ep);
+
+ QString strV2 = eph.toString(2.11);
+ QString strV3 = eph.toString(3.01);
+
+ printOutput(printFile, _ephStreamGPS, strV2, strV3);
+}
+
+// Print One Glonass Ephemeris
+////////////////////////////////////////////////////////////////////////////
+void bncApp::printGlonassEph(glonassephemeris* ep, bool printFile) {
+
+ t_ephGlo eph;
+ eph.set(ep);
+
+ QString strV2 = eph.toString(2.11);
+ QString strV3 = eph.toString(3.01);
+
+ printOutput(printFile, _ephStreamGlonass, strV2, strV3);
+}
+
+// Print One Galileo Ephemeris
+////////////////////////////////////////////////////////////////////////////
+void bncApp::printGalileoEph(galileoephemeris* ep, bool printFile) {
+
+ t_ephGal eph;
+ eph.set(ep);
+
+ QString strV2 = eph.toString(2.11);
+ QString strV3 = eph.toString(3.01);
+
+ printOutput(printFile, _ephStreamGalileo, strV2, strV3);
+}
+
+// Output
+////////////////////////////////////////////////////////////////////////////
+void bncApp::printOutput(bool printFile, QTextStream* stream,
+ const QString& strV2, const QString& strV3) {
+
+ // Output into file
+ // ----------------
+ if (printFile && stream) {
+ if (_rinexVers == 2) {
+ *stream << strV2.toAscii();
+ }
+ else {
+ *stream << strV3.toAscii();
+ }
+ stream->flush();
+ }
+
+ // Output into the socket
+ // ----------------------
+ if (_sockets) {
+ QMutableListIterator is(*_sockets);
+ while (is.hasNext()) {
+ QTcpSocket* sock = is.next();
+ if (sock->state() == QAbstractSocket::ConnectedState) {
+ if (sock->write(strV3.toAscii()) == -1) {
+ delete sock;
+ is.remove();
+ }
+ }
+ else if (sock->state() != QAbstractSocket::ConnectingState) {
+ delete sock;
+ is.remove();
+ }
+ }
+ }
+}
+
+// Set Port Number
+////////////////////////////////////////////////////////////////////////////
+void bncApp::setPort(int port) {
+ _port = port;
+ if (_port != 0) {
+ delete _server;
+ _server = new QTcpServer;
+ if ( !_server->listen(QHostAddress::Any, _port) ) {
+ slotMessage("bncApp: Cannot listen on ephemeris port", true);
+ }
+ connect(_server, SIGNAL(newConnection()), this, SLOT(slotNewConnection()));
+ delete _sockets;
+ _sockets = new QList;
+ }
+}
+
+// Set Port Number
+////////////////////////////////////////////////////////////////////////////
+void bncApp::setPortCorr(int port) {
+ _portCorr = port;
+ if (_portCorr != 0) {
+ delete _serverCorr;
+ _serverCorr = new QTcpServer;
+ if ( !_serverCorr->listen(QHostAddress::Any, _portCorr) ) {
+ slotMessage("bncApp: Cannot listen on correction port", true);
+ }
+ connect(_serverCorr, SIGNAL(newConnection()), this, SLOT(slotNewConnectionCorr()));
+ delete _socketsCorr;
+ _socketsCorr = new QList;
+ }
+}
+
+// New Connection
+////////////////////////////////////////////////////////////////////////////
+void bncApp::slotNewConnection() {
+ _sockets->push_back( _server->nextPendingConnection() );
+}
+
+// New Connection
+////////////////////////////////////////////////////////////////////////////
+void bncApp::slotNewConnectionCorr() {
+ _socketsCorr->push_back( _serverCorr->nextPendingConnection() );
+}
+
+//
+////////////////////////////////////////////////////////////////////////////
+void bncApp::slotQuit() {
+ cout << "bncApp::slotQuit" << endl;
+ delete _caster;
+ quit();
+}
+
+//
+////////////////////////////////////////////////////////////////////////////
+void bncApp::slotNewCorrLine(QString line, QString staID, long coTime) {
+
+ QMutexLocker locker(&_mutex);
+
+ // Combination of Corrections
+ // --------------------------
+#ifdef USE_COMBINATION
+ if (_bncComb) {
+ _bncComb->processCorrLine(staID, line);
+ }
+#endif
+
+ bncSettings settings;
+ _waitCoTime = settings.value("corrTime").toInt();
+ if (_waitCoTime < 0) {
+ _waitCoTime = 0;
+ }
+
+ // First time, set the _lastDumpSec immediately
+ // --------------------------------------------
+ if (_lastDumpCoSec == 0) {
+ _lastDumpCoSec = coTime - 1;
+ }
+
+ // An old correction - throw it away
+ // ---------------------------------
+ if (_waitCoTime > 0 && coTime <= _lastDumpCoSec) {
+ if (!_bncComb) {
+ QString line = staID + ": Correction for one sat neglected because overaged by " +
+ QString().sprintf(" %ld sec",
+ _lastDumpCoSec - coTime + _waitCoTime);
+ messagePrivate(line.toAscii());
+ emit( newMessage(line.toAscii(), true) );
+ }
+ return;
+ }
+
+ _corrs->insert(coTime, QString(line + " " + staID));
+
+ // Dump Corrections
+ // ----------------
+ if (_waitCoTime == 0) {
+ dumpCorrs();
+ }
+ else if (coTime - _waitCoTime > _lastDumpCoSec) {
+ dumpCorrs(_lastDumpCoSec + 1, coTime - _waitCoTime);
+ _lastDumpCoSec = coTime - _waitCoTime;
+ }
+}
+
+// Dump Complete Correction Epochs
+////////////////////////////////////////////////////////////////////////////
+void bncApp::dumpCorrs(long minTime, long maxTime) {
+ for (long sec = minTime; sec <= maxTime; sec++) {
+ QList allCorrs = _corrs->values(sec);
+ dumpCorrs(allCorrs);
+ _corrs->remove(sec);
+ }
+}
+
+// Dump all corrections
+////////////////////////////////////////////////////////////////////////////
+void bncApp::dumpCorrs() {
+ QList allCorrs;
+ QMutableMapIterator it(*_corrs);
+ while (it.hasNext()) {
+ allCorrs << it.next().value();
+ it.remove();
+ }
+ dumpCorrs(allCorrs);
+}
+
+// Dump List of Corrections
+////////////////////////////////////////////////////////////////////////////
+void bncApp::dumpCorrs(const QList& allCorrs) {
+ emit newCorrections(allCorrs);
+ if (_socketsCorr) {
+ QListIterator it(allCorrs);
+ while (it.hasNext()) {
+ QString corrLine = it.next() + "\n";
+
+ QMutableListIterator is(*_socketsCorr);
+ while (is.hasNext()) {
+ QTcpSocket* sock = is.next();
+ if (sock->state() == QAbstractSocket::ConnectedState) {
+ if (sock->write(corrLine.toAscii()) == -1) {
+ delete sock;
+ is.remove();
+ }
+ }
+ else if (sock->state() != QAbstractSocket::ConnectingState) {
+ delete sock;
+ is.remove();
+ }
+ }
+ }
+ }
+}
+
+//
+////////////////////////////////////////////////////////////////////////////
+void bncApp::setConfFileName(const QString& confFileName) {
+ if (confFileName.isEmpty()) {
+ _confFileName = QDir::homePath() + QDir::separator()
+ + ".config" + QDir::separator()
+ + organizationName() + QDir::separator()
+ + applicationName() + ".bnc";
+ }
+ else {
+ _confFileName = confFileName;
+ }
+}
+
+// Raw Output
+////////////////////////////////////////////////////////////////////////////
+void bncApp::writeRawData(const QByteArray& data, const QByteArray& staID,
+ const QByteArray& format) {
+
+ QMutexLocker locker(&_mutex);
+
+ if (!_rawFile) {
+ bncSettings settings;
+ QByteArray fileName = settings.value("rawOutFile").toByteArray();
+ if (!fileName.isEmpty()) {
+ _rawFile = new bncRawFile(fileName, staID, bncRawFile::output);
+ }
+ }
+
+ if (_rawFile) {
+ _rawFile->writeRawData(data, staID, format);
+ }
+}
+
+// Get Glonass Slot Numbers from Global Array
+////////////////////////////////////////////////////////////////////////////
+void bncApp::getGlonassSlotNums(int GLOFreq[]) {
+
+ QMutexLocker locker(&_mutex);
+
+ for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
+ if (_GLOFreq[ii] != 0) {
+ GLOFreq[ii] = _GLOFreq[ii];
+ }
+ }
+}
+
+// Store Glonass Slot Numbers to Global Array
+////////////////////////////////////////////////////////////////////////////
+void bncApp::storeGlonassSlotNums(const int GLOFreq[]) {
+
+ QMutexLocker locker(&_mutex);
+
+ for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
+ if (GLOFreq[ii] != 0) {
+ _GLOFreq[ii] = GLOFreq[ii];
+ }
+ }
+}
+
+//
+////////////////////////////////////////////////////////////////////////////
+void bncApp::initCombination() {
+#ifdef USE_COMBINATION
+ _bncComb = new bncComb();
+ if (_bncComb->nStreams() < 1) {
+ delete _bncComb;
+ _bncComb = 0;
+ }
+#endif
+}
+
+//
+////////////////////////////////////////////////////////////////////////////
+void bncApp::stopCombination() {
+#ifdef USE_COMBINATION
+ delete _bncComb;
+ _bncComb = 0;
+#endif
+}
+
+// Handling Events (virtual)
+////////////////////////////////////////////////////////////////////////////
+bool bncApp::event(QEvent* ev) {
+
+ if (ev->type() == QEvent::FileOpen) { // currently happens on Mac only
+ QString fileName = static_cast(ev)->file();
+ setConfFileName(fileName);
+ return true;
+ }
+
+ return QApplication::event(ev);
+}
+
+// Check Ephemeris Consistency
+////////////////////////////////////////////////////////////////////////////
+void bncApp::checkEphemeris(gpsephemeris* oldEph, gpsephemeris* newEph) {
+ if (oldEph->clock_bias != newEph->clock_bias ||
+ oldEph->clock_drift != newEph->clock_drift ||
+ oldEph->clock_driftrate != newEph->clock_driftrate) {
+ QString msg = currentDateAndTimeGPS().toString(Qt::ISODate) +
+ QString(" %1 EPH DIFFERS\n").arg(oldEph->satellite);
+ messagePrivate(msg.toAscii());
+ }
+}
Index: trunk/BNC/src/bncapp.h
===================================================================
--- trunk/BNC/src/bncapp.h (revision 4278)
+++ trunk/BNC/src/bncapp.h (revision 4278)
@@ -0,0 +1,140 @@
+// Part of BNC, a utility for retrieving decoding and
+// converting GNSS data streams from NTRIP broadcasters.
+//
+// Copyright (C) 2007
+// German Federal Agency for Cartography and Geodesy (BKG)
+// http://www.bkg.bund.de
+// Czech Technical University Prague, Department of Geodesy
+// http://www.fsv.cvut.cz
+//
+// Email: euref-ip@bkg.bund.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation, version 2.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef BNCAPP_H
+#define BNCAPP_H
+
+#include
+
+#include "bnccaster.h"
+#include "bncrawfile.h"
+#include "RTCM3/RTCM3Decoder.h"
+
+class bncComb;
+class bncPPPclient;
+class bncTableItem;
+
+class bncApp : public QApplication {
+ Q_OBJECT
+
+ friend class bncSettings;
+ QSettings::SettingsMap _settings;
+
+ public:
+ enum e_mode {interactive, nonInteractive, batchPostProcessing};
+ bncApp(int& argc, char* argv[], bool GUIenabled);
+ virtual ~bncApp();
+ e_mode mode() const {return _mode;}
+ void setMode(e_mode mode) {_mode = mode;}
+ void setPort(int port);
+ void setPortCorr(int port);
+ void setCaster(bncCaster* caster) {_caster = caster;}
+ QDateTime* _currentDateAndTimeGPS;
+ void setConfFileName(const QString& confFileName);
+ QString confFileName() const {return _confFileName;}
+ void writeRawData(const QByteArray& data, const QByteArray& staID,
+ const QByteArray& format);
+ void storeGlonassSlotNums(const int GLOFreq[]);
+ void getGlonassSlotNums(int GLOFreq[]);
+ void initCombination();
+ void stopCombination();
+ const QString& pgmName() {return _pgmName;}
+ const QString& userName() {return _userName;}
+ protected:
+ virtual bool event(QEvent* ev);
+
+ public slots:
+ void slotMessage(QByteArray msg, bool showOnScreen);
+ void slotNewGPSEph(gpsephemeris* gpseph);
+ void slotNewGlonassEph(glonassephemeris* glonasseph);
+ void slotNewGalileoEph(galileoephemeris* galileoeph);
+ void slotNewCorrLine(QString line, QString staID, long coTime);
+ void slotQuit();
+
+ signals:
+ void newMessage(QByteArray msg, bool showOnScreen);
+ void newEphGPS(gpsephemeris gpseph);
+ void newEphGlonass(glonassephemeris glonasseph);
+ void newEphGalileo(galileoephemeris galileoeph);
+ void newCorrections(QList);
+
+ private slots:
+ void slotNewConnection();
+ void slotNewConnectionCorr();
+ private:
+ void printEphHeader();
+ void printGPSEph(gpsephemeris* ep, bool printFile);
+ void printGlonassEph(glonassephemeris* ep, bool printFile);
+ void printGalileoEph(galileoephemeris* ep, bool printFile);
+ void printOutput(bool printFile, QTextStream* stream,
+ const QString& strV2, const QString& strV3);
+ void dumpCorrs(long minTime, long maxTime);
+ void dumpCorrs();
+ void dumpCorrs(const QList& allCorrs);
+ void messagePrivate(const QByteArray& msg);
+ void checkEphemeris(gpsephemeris* oldEph, gpsephemeris* newEph);
+
+ QFile* _logFile;
+ QTextStream* _logStream;
+ int _logFileFlag;
+ QMutex _mutex;
+ QMutex _mutexMessage;
+ QString _ephPath;
+ QString _ephFileNameGPS;
+ int _rinexVers;
+ QFile* _ephFileGPS;
+ QTextStream* _ephStreamGPS;
+ QFile* _ephFileGlonass;
+ QTextStream* _ephStreamGlonass;
+ QFile* _ephFileGalileo;
+ QTextStream* _ephStreamGalileo;
+ gpsephemeris* _gpsEph[PRN_GPS_END - PRN_GPS_START + 1];
+ glonassephemeris* _glonassEph[PRN_GLONASS_END - PRN_GLONASS_START + 1];
+ galileoephemeris* _galileoEph[PRN_GALILEO_END - PRN_GALILEO_START + 1];
+ QString _userName;
+ QString _pgmName;
+ int _port;
+ QTcpServer* _server;
+ QList* _sockets;
+ int _portCorr;
+ QTcpServer* _serverCorr;
+ QList* _socketsCorr;
+ int _portNMEA;
+ QTcpServer* _serverNMEA;
+ QList* _socketsNMEA;
+ bncCaster* _caster;
+ long _lastDumpCoSec;
+ long _waitCoTime;
+ QMultiMap* _corrs;
+ QString _confFileName;
+ QDate _fileDate;
+ bncRawFile* _rawFile;
+ int _GLOFreq[PRN_GLONASS_NUM];
+ bncComb* _bncComb;
+ e_mode _mode;
+ public:
+ bncPPPclient* _bncPPPclient;
+ QMap _uploadTableItems;
+};
+#endif
Index: trunk/BNC/src/bncbytescounter.cpp
===================================================================
--- trunk/BNC/src/bncbytescounter.cpp (revision 4278)
+++ trunk/BNC/src/bncbytescounter.cpp (revision 4278)
@@ -0,0 +1,72 @@
+// Part of BNC, a utility for retrieving decoding and
+// converting GNSS data streams from NTRIP broadcasters.
+//
+// Copyright (C) 2007
+// German Federal Agency for Cartography and Geodesy (BKG)
+// http://www.bkg.bund.de
+// Czech Technical University Prague, Department of Geodesy
+// http://www.fsv.cvut.cz
+//
+// Email: euref-ip@bkg.bund.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation, version 2.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+/* -------------------------------------------------------------------------
+ * BKG NTRIP Client
+ * -------------------------------------------------------------------------
+ *
+ * Class: bncBytesCounter
+ *
+ * Purpose: Re-Implements QLabel
+ *
+ * Author: L. Mervart
+ *
+ * Created: 03-Apr-2011
+ *
+ * Changes:
+ *
+ * -----------------------------------------------------------------------*/
+
+#include "bncbytescounter.h"
+
+// Constructor
+////////////////////////////////////////////////////////////////////////////
+bncBytesCounter::bncBytesCounter() : QLabel() {
+ _bytesRead = 0.0;
+ setText(QString("%1 byte(s)").arg(0));
+}
+
+// Destructor
+////////////////////////////////////////////////////////////////////////////
+bncBytesCounter::~bncBytesCounter() {
+}
+
+//
+////////////////////////////////////////////////////////////////////////////
+void bncBytesCounter::slotNewBytes(const QByteArray, double nbyte) {
+
+ QMutexLocker locker(&_mutex);
+
+ _bytesRead += nbyte;
+
+ if (_bytesRead < 1e3) {
+ setText(QString("%1 byte(s)").arg((int)_bytesRead));
+ }
+ else if (_bytesRead < 1e6) {
+ setText(QString("%1 kB").arg(_bytesRead/1.e3, 5));
+ }
+ else {
+ setText(QString("%1 MB").arg(_bytesRead/1.e6, 5));
+ }
+}
Index: trunk/BNC/src/bncbytescounter.h
===================================================================
--- trunk/BNC/src/bncbytescounter.h (revision 4278)
+++ trunk/BNC/src/bncbytescounter.h (revision 4278)
@@ -0,0 +1,45 @@
+// Part of BNC, a utility for retrieving decoding and
+// converting GNSS data streams from NTRIP broadcasters.
+//
+// Copyright (C) 2007
+// German Federal Agency for Cartography and Geodesy (BKG)
+// http://www.bkg.bund.de
+// Czech Technical University Prague, Department of Geodesy
+// http://www.fsv.cvut.cz
+//
+// Email: euref-ip@bkg.bund.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation, version 2.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef BNCBYTESCOUNTER_H
+#define BNCBYTESCOUNTER_H
+
+#include
+
+class bncBytesCounter : public QLabel {
+ Q_OBJECT
+
+ public:
+ bncBytesCounter();
+ ~bncBytesCounter();
+
+ public slots:
+ void slotNewBytes(const QByteArray staID, double nbyte);
+
+ private:
+ double _bytesRead;
+ QMutex _mutex;
+};
+
+#endif
Index: trunk/BNC/src/bnccaster.cpp
===================================================================
--- trunk/BNC/src/bnccaster.cpp (revision 4278)
+++ trunk/BNC/src/bnccaster.cpp (revision 4278)
@@ -0,0 +1,524 @@
+// Part of BNC, a utility for retrieving decoding and
+// converting GNSS data streams from NTRIP broadcasters.
+//
+// Copyright (C) 2007
+// German Federal Agency for Cartography and Geodesy (BKG)
+// http://www.bkg.bund.de
+// Czech Technical University Prague, Department of Geodesy
+// http://www.fsv.cvut.cz
+//
+// Email: euref-ip@bkg.bund.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation, version 2.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+/* -------------------------------------------------------------------------
+ * BKG NTRIP Client
+ * -------------------------------------------------------------------------
+ *
+ * Class: bncCaster
+ *
+ * Purpose: buffers and disseminates the data
+ *
+ * Author: L. Mervart
+ *
+ * Created: 24-Dec-2005
+ *
+ * Changes:
+ *
+ * -----------------------------------------------------------------------*/
+
+#include
+#include
+#include
+#include
+#include
+
+#include "bnccaster.h"
+#include "bncrinex.h"
+#include "bncapp.h"
+#include "bncgetthread.h"
+#include "bncutils.h"
+#include "bncsettings.h"
+#include "RTCM/GPSDecoder.h"
+
+using namespace std;
+
+// Constructor
+////////////////////////////////////////////////////////////////////////////
+bncCaster::bncCaster(const QString& outFileName, int port) {
+
+ bncSettings settings;
+
+ connect(this, SIGNAL(newMessage(QByteArray,bool)),
+ (bncApp*) qApp, SLOT(slotMessage(const QByteArray,bool)));
+
+ if ( !outFileName.isEmpty() ) {
+ QString lName = outFileName;
+ expandEnvVar(lName);
+ _outFile = new QFile(lName);
+ if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
+ _outFile->open(QIODevice::WriteOnly | QIODevice::Append);
+ }
+ else {
+ _outFile->open(QIODevice::WriteOnly);
+ }
+ _out = new QTextStream(_outFile);
+ _out->setRealNumberNotation(QTextStream::FixedNotation);
+ }
+ else {
+ _outFile = 0;
+ _out = 0;
+ }
+
+ _port = port;
+
+ if (_port != 0) {
+ _server = new QTcpServer;
+ if ( !_server->listen(QHostAddress::Any, _port) ) {
+ emit newMessage("bncCaster: Cannot listen on sync port", true);
+ }
+ connect(_server, SIGNAL(newConnection()), this, SLOT(slotNewConnection()));
+ _sockets = new QList;
+ }
+ else {
+ _server = 0;
+ _sockets = 0;
+ }
+
+ int uPort = settings.value("outUPort").toInt();
+ if (uPort != 0) {
+ _uServer = new QTcpServer;
+ if ( !_uServer->listen(QHostAddress::Any, uPort) ) {
+ emit newMessage("bncCaster: Cannot listen on usync port", true);
+ }
+ connect(_uServer, SIGNAL(newConnection()), this, SLOT(slotNewUConnection()));
+ _uSockets = new QList;
+ }
+ else {
+ _uServer = 0;
+ _uSockets = 0;
+ }
+
+ int nmeaPort = settings.value("nmeaPort").toInt();
+ if (nmeaPort != 0) {
+ _nmeaServer = new QTcpServer;
+ if ( !_nmeaServer->listen(QHostAddress::Any, nmeaPort) ) {
+ emit newMessage("bncCaster: Cannot listen on port", true);
+ }
+ connect(_nmeaServer, SIGNAL(newConnection()), this, SLOT(slotNewNMEAConnection()));
+ _nmeaSockets = new QList;
+ }
+ else {
+ _nmeaServer = 0;
+ _nmeaSockets = 0;
+ }
+
+ _epochs = new QMultiMap;
+
+ _samplingRate = settings.value("binSampl").toInt();
+ _waitTime = settings.value("waitTime").toInt();
+ _lastDumpSec = 0;
+ _confInterval = -1;
+}
+
+// Destructor
+////////////////////////////////////////////////////////////////////////////
+bncCaster::~bncCaster() {
+
+ QMutexLocker locker(&_mutex);
+
+ QListIterator it(_threads);
+ while(it.hasNext()){
+ bncGetThread* thread = it.next();
+ thread->terminate();
+ }
+ delete _out;
+ delete _outFile;
+ delete _server;
+ delete _sockets;
+ delete _uServer;
+ delete _uSockets;
+ delete _nmeaServer;
+ delete _nmeaSockets;
+ delete _epochs;
+}
+
+// New Observations
+////////////////////////////////////////////////////////////////////////////
+void bncCaster::newObs(const QByteArray staID, bool firstObs, t_obs obs) {
+
+ QMutexLocker locker(&_mutex);
+
+ long iSec = long(floor(obs.GPSWeeks+0.5));
+ long newTime = obs.GPSWeek * 7*24*3600 + iSec;
+
+ // Rename the Station
+ // ------------------
+ strncpy(obs.StatID, staID.constData(),sizeof(obs.StatID));
+ obs.StatID[sizeof(obs.StatID)-1] = '\0';
+
+ // Output into the socket
+ // ----------------------
+ if (_uSockets) {
+
+ ostringstream oStr;
+ oStr.setf(ios::showpoint | ios::fixed);
+ oStr << obs.StatID << " "
+ << obs.GPSWeek << " "
+ << setprecision(7) << obs.GPSWeeks << " "
+ << bncRinex::asciiSatLine(obs) << endl;
+
+ string hlpStr = oStr.str();
+
+ QMutableListIterator is(*_uSockets);
+ while (is.hasNext()) {
+ QTcpSocket* sock = is.next();
+ if (sock->state() == QAbstractSocket::ConnectedState) {
+ int numBytes = hlpStr.length();
+ if (myWrite(sock, hlpStr.c_str(), numBytes) != numBytes) {
+ delete sock;
+ is.remove();
+ }
+ }
+ else if (sock->state() != QAbstractSocket::ConnectingState) {
+ delete sock;
+ is.remove();
+ }
+ }
+ }
+
+ // First time, set the _lastDumpSec immediately
+ // --------------------------------------------
+ if (_lastDumpSec == 0) {
+ _lastDumpSec = newTime - 1;
+ }
+
+ // An old observation - throw it away
+ // ----------------------------------
+ if (newTime <= _lastDumpSec) {
+ if (firstObs) {
+ bncSettings settings;
+ if ( !settings.value("outFile").toString().isEmpty() ||
+ !settings.value("outPort").toString().isEmpty() ) {
+
+ QTime enomtime = QTime(0,0,0).addSecs(iSec);
+
+ emit( newMessage(QString("%1: Old epoch %2 (%3) thrown away")
+ .arg(staID.data()).arg(iSec)
+ .arg(enomtime.toString("HH:mm:ss"))
+ .toAscii(), true) );
+ }
+ }
+ return;
+ }
+
+ // Save the observation
+ // --------------------
+ _epochs->insert(newTime, obs);
+
+ // Dump Epochs
+ // -----------
+ if (newTime - _waitTime > _lastDumpSec) {
+ dumpEpochs(_lastDumpSec + 1, newTime - _waitTime);
+ _lastDumpSec = newTime - _waitTime;
+ }
+}
+
+// New Connection
+////////////////////////////////////////////////////////////////////////////
+void bncCaster::slotNewConnection() {
+ _sockets->push_back( _server->nextPendingConnection() );
+ emit( newMessage(QString("New client connection on sync port: # %1")
+ .arg(_sockets->size()).toAscii(), true) );
+}
+
+void bncCaster::slotNewUConnection() {
+ _uSockets->push_back( _uServer->nextPendingConnection() );
+ emit( newMessage(QString("New client connection on usync port: # %1")
+ .arg(_uSockets->size()).toAscii(), true) );
+}
+
+void bncCaster::slotNewNMEAConnection() {
+ _nmeaSockets->push_back( _nmeaServer->nextPendingConnection() );
+ emit( newMessage(QString("New PPP client on port: # %1")
+ .arg(_nmeaSockets->size()).toAscii(), true) );
+}
+
+// Add New Thread
+////////////////////////////////////////////////////////////////////////////
+void bncCaster::addGetThread(bncGetThread* getThread, bool noNewThread) {
+
+ qRegisterMetaType("t_obs");
+ qRegisterMetaType("gpsephemeris");
+ qRegisterMetaType("glonassephemeris");
+ qRegisterMetaType("galileoephemeris");
+
+ connect(getThread, SIGNAL(newObs(QByteArray, bool, t_obs)),
+ this, SLOT(newObs(QByteArray, bool, t_obs)));
+
+ connect(getThread, SIGNAL(getThreadFinished(QByteArray)),
+ this, SLOT(slotGetThreadFinished(QByteArray)));
+
+ connect(getThread, SIGNAL(newNMEAstr(QByteArray)),
+ this, SLOT(slotNewNMEAstr(QByteArray)));
+
+ _staIDs.push_back(getThread->staID());
+ _threads.push_back(getThread);
+
+ if (noNewThread) {
+ getThread->run();
+ }
+ else {
+ getThread->start();
+ }
+}
+
+// Get Thread destroyed
+////////////////////////////////////////////////////////////////////////////
+void bncCaster::slotGetThreadFinished(QByteArray staID) {
+ QMutexLocker locker(&_mutex);
+
+ QListIterator it(_threads);
+ while (it.hasNext()) {
+ bncGetThread* thread = it.next();
+ if (thread->staID() == staID) {
+ _threads.removeOne(thread);
+ }
+ }
+
+ _staIDs.removeAll(staID);
+ emit( newMessage(
+ QString("Decoding %1 stream(s)").arg(_staIDs.size()).toAscii(), true) );
+ if (_staIDs.size() == 0) {
+ emit(newMessage("bncCaster: Last get thread terminated", true));
+ emit getThreadsFinished();
+ }
+}
+
+// Dump Complete Epochs
+////////////////////////////////////////////////////////////////////////////
+void bncCaster::dumpEpochs(long minTime, long maxTime) {
+
+ for (long sec = minTime; sec <= maxTime; sec++) {
+
+ QList allObs = _epochs->values(sec);
+
+ QListIterator it(allObs);
+ while (it.hasNext()) {
+ const t_obs& obs = it.next();
+
+ if (_samplingRate == 0 || sec % _samplingRate == 0) {
+
+ if (_out || _sockets) {
+ ostringstream oStr;
+ oStr.setf(ios::showpoint | ios::fixed);
+ oStr << obs.StatID << " "
+ << obs.GPSWeek << " "
+ << setprecision(7) << obs.GPSWeeks << " "
+ << bncRinex::asciiSatLine(obs) << endl;
+ if (!it.hasNext()) {
+ oStr << endl;
+ }
+ string hlpStr = oStr.str();
+
+ // Output into the File
+ // --------------------
+ if (_out) {
+ *_out << hlpStr.c_str();
+ _out->flush();
+ }
+
+ // Output into the socket
+ // ----------------------
+ if (_sockets) {
+ QMutableListIterator is(*_sockets);
+ while (is.hasNext()) {
+ QTcpSocket* sock = is.next();
+ if (sock->state() == QAbstractSocket::ConnectedState) {
+ int numBytes = hlpStr.length();
+ if (myWrite(sock, hlpStr.c_str(), numBytes) != numBytes) {
+ delete sock;
+ is.remove();
+ }
+ }
+ else if (sock->state() != QAbstractSocket::ConnectingState) {
+ delete sock;
+ is.remove();
+ }
+ }
+ }
+ }
+ }
+
+ _epochs->remove(sec);
+ }
+ }
+}
+
+// Reread configuration (private slot)
+////////////////////////////////////////////////////////////////////////////
+void bncCaster::slotReadMountPoints() {
+
+ bncSettings settings;
+ settings.reRead();
+
+ readMountPoints();
+}
+
+// Read Mountpoints
+////////////////////////////////////////////////////////////////////////////
+void bncCaster::readMountPoints() {
+
+ bncSettings settings;
+
+ // Reread several options
+ // ----------------------
+ _samplingRate = settings.value("binSampl").toInt();
+ _waitTime = settings.value("waitTime").toInt();
+ if (_waitTime < 1) {
+ _waitTime = 1;
+ }
+
+ // Add new mountpoints
+ // -------------------
+ int iMount = -1;
+ QListIterator