[280] | 1 | // Part of BNC, a utility for retrieving decoding and
|
---|
[464] | 2 | // converting GNSS data streams from NTRIP broadcasters.
|
---|
[280] | 3 | //
|
---|
[464] | 4 | // Copyright (C) 2007
|
---|
[280] | 5 | // German Federal Agency for Cartography and Geodesy (BKG)
|
---|
| 6 | // http://www.bkg.bund.de
|
---|
[464] | 7 | // Czech Technical University Prague, Department of Geodesy
|
---|
[280] | 8 | // http://www.fsv.cvut.cz
|
---|
| 9 | //
|
---|
| 10 | // Email: euref-ip@bkg.bund.de
|
---|
| 11 | //
|
---|
| 12 | // This program is free software; you can redistribute it and/or
|
---|
| 13 | // modify it under the terms of the GNU General Public License
|
---|
| 14 | // as published by the Free Software Foundation, version 2.
|
---|
| 15 | //
|
---|
| 16 | // This program is distributed in the hope that it will be useful,
|
---|
| 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 19 | // GNU General Public License for more details.
|
---|
| 20 | //
|
---|
| 21 | // You should have received a copy of the GNU General Public License
|
---|
| 22 | // along with this program; if not, write to the Free Software
|
---|
| 23 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
---|
[82] | 24 |
|
---|
| 25 | /* -------------------------------------------------------------------------
|
---|
[93] | 26 | * BKG NTRIP Client
|
---|
[82] | 27 | * -------------------------------------------------------------------------
|
---|
| 28 | *
|
---|
| 29 | * Class: bncApp
|
---|
| 30 | *
|
---|
| 31 | * Purpose: This class implements the main application
|
---|
| 32 | *
|
---|
| 33 | * Author: L. Mervart
|
---|
| 34 | *
|
---|
| 35 | * Created: 29-Aug-2006
|
---|
| 36 | *
|
---|
| 37 | * Changes:
|
---|
| 38 | *
|
---|
| 39 | * -----------------------------------------------------------------------*/
|
---|
| 40 |
|
---|
| 41 | #include <iostream>
|
---|
[149] | 42 | #include <QSettings>
|
---|
[150] | 43 | #include <QMessageBox>
|
---|
[519] | 44 | #include <cmath>
|
---|
[82] | 45 |
|
---|
| 46 | #include "bncapp.h"
|
---|
[151] | 47 | #include "bncutils.h"
|
---|
[82] | 48 |
|
---|
| 49 | using namespace std;
|
---|
| 50 |
|
---|
[523] | 51 | struct converttimeinfo {
|
---|
| 52 | int second; /* seconds of GPS time [0..59] */
|
---|
| 53 | int minute; /* minutes of GPS time [0..59] */
|
---|
| 54 | int hour; /* hour of GPS time [0..24] */
|
---|
| 55 | int day; /* day of GPS time [1..28..30(31)*/
|
---|
| 56 | int month; /* month of GPS time [1..12]*/
|
---|
| 57 | int year; /* year of GPS time [1980..] */
|
---|
| 58 | };
|
---|
| 59 |
|
---|
| 60 | extern "C" {
|
---|
| 61 | void converttime(struct converttimeinfo *c, int week, int tow);
|
---|
| 62 | void updatetime(int *week, int *tow, int tk, int fixnumleap);
|
---|
[529] | 63 | int HandleRunBy(char *buffer, int buffersize, const char **u, int rinex3);
|
---|
[523] | 64 | }
|
---|
| 65 |
|
---|
| 66 |
|
---|
[82] | 67 | // Constructor
|
---|
| 68 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 69 | bncApp::bncApp(int argc, char* argv[], bool GUIenabled) :
|
---|
| 70 | QApplication(argc, argv, GUIenabled) {
|
---|
[109] | 71 |
|
---|
[533] | 72 | _bncVersion = "BNC 1.4";
|
---|
| 73 |
|
---|
[150] | 74 | _logFileFlag = 0;
|
---|
| 75 | _logFile = 0;
|
---|
| 76 | _logStream = 0;
|
---|
[152] | 77 |
|
---|
[516] | 78 | // Lists of Ephemeris
|
---|
| 79 | // ------------------
|
---|
| 80 | for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
|
---|
| 81 | _gpsEph[ii-PRN_GPS_START] = 0;
|
---|
| 82 | }
|
---|
| 83 | for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
|
---|
| 84 | _glonassEph[ii-PRN_GLONASS_START] = 0;
|
---|
| 85 | }
|
---|
| 86 |
|
---|
[533] | 87 | // Eph file(s)
|
---|
| 88 | // -----------
|
---|
[534] | 89 | _rinexVers = 0;
|
---|
[533] | 90 | _ephFileGPS = 0;
|
---|
| 91 | _ephStreamGPS = 0;
|
---|
| 92 | _ephFileGlonass = 0;
|
---|
| 93 | _ephStreamGlonass = 0;
|
---|
[82] | 94 | }
|
---|
| 95 |
|
---|
| 96 | // Destructor
|
---|
| 97 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 98 | bncApp::~bncApp() {
|
---|
[109] | 99 | delete _logStream;
|
---|
| 100 | delete _logFile;
|
---|
[533] | 101 | delete _ephStreamGPS;
|
---|
| 102 | delete _ephFileGPS;
|
---|
[534] | 103 | if (_rinexVers == 2) {
|
---|
[533] | 104 | delete _ephStreamGlonass;
|
---|
| 105 | delete _ephFileGlonass;
|
---|
| 106 | }
|
---|
[516] | 107 | for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
|
---|
| 108 | delete _gpsEph[ii-PRN_GPS_START];
|
---|
| 109 | }
|
---|
| 110 | for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
|
---|
| 111 | delete _glonassEph[ii-PRN_GLONASS_START];
|
---|
| 112 | }
|
---|
[82] | 113 | }
|
---|
| 114 |
|
---|
| 115 | // Write a Program Message
|
---|
| 116 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 117 | void bncApp::slotMessage(const QByteArray msg) {
|
---|
[150] | 118 |
|
---|
[243] | 119 | QMutexLocker locker(&_mutex);
|
---|
| 120 |
|
---|
[150] | 121 | // First time resolve the log file name
|
---|
| 122 | // ------------------------------------
|
---|
| 123 | if (_logFileFlag == 0) {
|
---|
| 124 | _logFileFlag = 1;
|
---|
| 125 | QSettings settings;
|
---|
| 126 | QString logFileName = settings.value("logFile").toString();
|
---|
| 127 | if ( !logFileName.isEmpty() ) {
|
---|
[151] | 128 | expandEnvVar(logFileName);
|
---|
[150] | 129 | _logFile = new QFile(logFileName);
|
---|
[275] | 130 | if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
|
---|
| 131 | _logFile->open(QIODevice::WriteOnly | QIODevice::Append);
|
---|
| 132 | }
|
---|
| 133 | else {
|
---|
| 134 | _logFile->open(QIODevice::WriteOnly);
|
---|
| 135 | }
|
---|
[150] | 136 | _logStream = new QTextStream();
|
---|
| 137 | _logStream->setDevice(_logFile);
|
---|
| 138 | }
|
---|
| 139 | }
|
---|
| 140 |
|
---|
[109] | 141 | if (_logStream) {
|
---|
[335] | 142 | *_logStream << QDate::currentDate().toString("yy-MM-dd ").toAscii().data();
|
---|
[199] | 143 | *_logStream << QTime::currentTime().toString("hh:mm:ss ").toAscii().data();
|
---|
[109] | 144 | *_logStream << msg.data() << endl;
|
---|
| 145 | _logStream->flush();
|
---|
[82] | 146 | }
|
---|
| 147 | }
|
---|
[511] | 148 |
|
---|
[535] | 149 | // New GPS Ephemeris
|
---|
[511] | 150 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 151 | void bncApp::slotNewGPSEph(gpsephemeris* gpseph) {
|
---|
[516] | 152 |
|
---|
| 153 | QMutexLocker locker(&_mutex);
|
---|
| 154 |
|
---|
[534] | 155 | printEphHeader();
|
---|
| 156 |
|
---|
[533] | 157 | if (!_ephStreamGPS) {
|
---|
[517] | 158 | delete gpseph;
|
---|
| 159 | return;
|
---|
| 160 | }
|
---|
| 161 |
|
---|
[532] | 162 | gpsephemeris** ee = &_gpsEph[gpseph->satellite-1];
|
---|
[538] | 163 | if ( *ee == 0 ||
|
---|
| 164 | gpseph->GPSweek > (*ee)->GPSweek ||
|
---|
| 165 | gpseph->TOW > (*ee)->TOW ) {
|
---|
[516] | 166 | delete *ee;
|
---|
| 167 | *ee = gpseph;
|
---|
| 168 | printGPSEph(gpseph);
|
---|
| 169 | }
|
---|
| 170 | else {
|
---|
| 171 | delete gpseph;
|
---|
| 172 | }
|
---|
[511] | 173 | }
|
---|
| 174 |
|
---|
[535] | 175 | // New Glonass Ephemeris
|
---|
[511] | 176 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 177 | void bncApp::slotNewGlonassEph(glonassephemeris* glonasseph) {
|
---|
[516] | 178 |
|
---|
| 179 | QMutexLocker locker(&_mutex);
|
---|
| 180 |
|
---|
[534] | 181 | printEphHeader();
|
---|
| 182 |
|
---|
[533] | 183 | if (!_ephStreamGlonass) {
|
---|
[517] | 184 | delete glonasseph;
|
---|
| 185 | return;
|
---|
| 186 | }
|
---|
| 187 |
|
---|
[532] | 188 | glonassephemeris** ee = &_glonassEph[glonasseph->almanac_number-1];
|
---|
[531] | 189 |
|
---|
[538] | 190 | if ( *ee == 0 ||
|
---|
| 191 | glonasseph->GPSWeek > (*ee)->GPSWeek ||
|
---|
| 192 | glonasseph->GPSTOW > (*ee)->GPSTOW ) {
|
---|
[531] | 193 | delete *ee;
|
---|
| 194 | *ee = glonasseph;
|
---|
| 195 | printGlonassEph(glonasseph);
|
---|
| 196 | }
|
---|
| 197 | else {
|
---|
| 198 | delete glonasseph;
|
---|
| 199 | }
|
---|
[511] | 200 | }
|
---|
| 201 |
|
---|
[535] | 202 | // Print Header of the output File(s)
|
---|
[516] | 203 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 204 | void bncApp::printEphHeader() {
|
---|
[528] | 205 |
|
---|
[535] | 206 | QSettings settings;
|
---|
| 207 |
|
---|
[534] | 208 | // Initialization
|
---|
| 209 | // --------------
|
---|
| 210 | if (_rinexVers == 0) {
|
---|
[528] | 211 |
|
---|
[533] | 212 | if ( Qt::CheckState(settings.value("ephV3").toInt()) == Qt::Checked) {
|
---|
[534] | 213 | _rinexVers = 3;
|
---|
[533] | 214 | }
|
---|
| 215 | else {
|
---|
[534] | 216 | _rinexVers = 2;
|
---|
[533] | 217 | }
|
---|
[529] | 218 |
|
---|
[533] | 219 | _ephPath = settings.value("ephPath").toString();
|
---|
| 220 |
|
---|
| 221 | if ( !_ephPath.isEmpty() ) {
|
---|
| 222 | if ( _ephPath[_ephPath.length()-1] != QDir::separator() ) {
|
---|
| 223 | _ephPath += QDir::separator();
|
---|
| 224 | }
|
---|
| 225 | expandEnvVar(_ephPath);
|
---|
| 226 | }
|
---|
[517] | 227 | }
|
---|
[533] | 228 |
|
---|
[534] | 229 | // (Re-)Open output File(s)
|
---|
| 230 | // ------------------------
|
---|
[533] | 231 | if (!_ephPath.isEmpty()) {
|
---|
| 232 |
|
---|
| 233 | QDate date = QDate::currentDate();
|
---|
| 234 |
|
---|
[535] | 235 | QString hlp = (_rinexVers == 3) ? "MIX_" : "GPS_";
|
---|
| 236 | QString ephFileNameGPS = _ephPath + hlp +
|
---|
[533] | 237 | QString("%1").arg(date.dayOfYear(), 3, 10, QChar('0')) +
|
---|
| 238 | date.toString("0.yyN");
|
---|
| 239 |
|
---|
| 240 | if (_ephFileNameGPS == ephFileNameGPS) {
|
---|
| 241 | return;
|
---|
| 242 | }
|
---|
| 243 | else {
|
---|
| 244 | _ephFileNameGPS = ephFileNameGPS;
|
---|
| 245 | }
|
---|
| 246 |
|
---|
| 247 | delete _ephStreamGPS;
|
---|
| 248 | delete _ephFileGPS;
|
---|
| 249 |
|
---|
[535] | 250 | QFlags<QIODevice::OpenModeFlag> appendFlagGPS;
|
---|
[536] | 251 | QFlags<QIODevice::OpenModeFlag> appendFlagGlonass;
|
---|
| 252 |
|
---|
[535] | 253 | if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked &&
|
---|
| 254 | QFile::exists(ephFileNameGPS) ) {
|
---|
| 255 | appendFlagGPS = QIODevice::Append;
|
---|
| 256 | }
|
---|
| 257 |
|
---|
[533] | 258 | _ephFileGPS = new QFile(ephFileNameGPS);
|
---|
[535] | 259 | _ephFileGPS->open(QIODevice::WriteOnly | appendFlagGPS);
|
---|
[533] | 260 | _ephStreamGPS = new QTextStream();
|
---|
| 261 | _ephStreamGPS->setDevice(_ephFileGPS);
|
---|
| 262 |
|
---|
[534] | 263 | if (_rinexVers == 3) {
|
---|
[533] | 264 | _ephFileGlonass = _ephFileGPS;
|
---|
| 265 | _ephStreamGlonass = _ephStreamGPS;
|
---|
| 266 | }
|
---|
[534] | 267 | else if (_rinexVers == 2) {
|
---|
[533] | 268 | QString ephFileNameGlonass = _ephPath + "GLO_" +
|
---|
| 269 | QString("%1").arg(date.dayOfYear(), 3, 10, QChar('0')) +
|
---|
| 270 | date.toString("0.yyN");
|
---|
| 271 |
|
---|
| 272 | delete _ephStreamGlonass;
|
---|
| 273 | delete _ephFileGlonass;
|
---|
| 274 |
|
---|
[535] | 275 | if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked &&
|
---|
| 276 | QFile::exists(ephFileNameGlonass) ) {
|
---|
| 277 | appendFlagGlonass = QIODevice::Append;
|
---|
| 278 | }
|
---|
| 279 |
|
---|
[533] | 280 | _ephFileGlonass = new QFile(ephFileNameGlonass);
|
---|
[535] | 281 | _ephFileGlonass->open(QIODevice::WriteOnly | appendFlagGlonass);
|
---|
[533] | 282 | _ephStreamGlonass = new QTextStream();
|
---|
| 283 | _ephStreamGlonass->setDevice(_ephFileGlonass);
|
---|
| 284 | }
|
---|
| 285 |
|
---|
[534] | 286 | // Header - RINEX Version 3
|
---|
| 287 | // ------------------------
|
---|
| 288 | if (_rinexVers == 3) {
|
---|
[537] | 289 | if ( ! (appendFlagGPS & QIODevice::Append)) {
|
---|
| 290 | QString line;
|
---|
| 291 | line.sprintf(
|
---|
| 292 | "%9.2f%11sN: GNSS NAV DATA M: Mixed%12sRINEX VERSION / TYPE\n",
|
---|
| 293 | 3.0, "", "");
|
---|
| 294 | *_ephStreamGPS << line;
|
---|
| 295 |
|
---|
| 296 | char buffer[100];
|
---|
| 297 | HandleRunBy(buffer, sizeof(buffer), 0, 1);
|
---|
| 298 | line.sprintf("%s\n%60sEND OF HEADER\n", buffer, "");
|
---|
| 299 | *_ephStreamGPS << line;
|
---|
| 300 |
|
---|
| 301 | _ephStreamGPS->flush();
|
---|
[535] | 302 | }
|
---|
[533] | 303 | }
|
---|
| 304 |
|
---|
[536] | 305 | // Headers - RINEX Version 2
|
---|
| 306 | // -------------------------
|
---|
[534] | 307 | else if (_rinexVers == 2) {
|
---|
[536] | 308 | if (! (appendFlagGPS & QIODevice::Append)) {
|
---|
| 309 | QString line;
|
---|
| 310 | line.sprintf(
|
---|
| 311 | "%9.2f%11sN: GPS NAV DATA%25sRINEX VERSION / TYPE\n", 2.1, "", "");
|
---|
| 312 | *_ephStreamGPS << line;
|
---|
| 313 |
|
---|
| 314 | char buffer[100];
|
---|
| 315 | HandleRunBy(buffer, sizeof(buffer), 0, 0);
|
---|
| 316 | line.sprintf("%s\n%60sEND OF HEADER\n", buffer, "");
|
---|
| 317 | *_ephStreamGPS << line;
|
---|
[537] | 318 |
|
---|
| 319 | _ephStreamGPS->flush();
|
---|
[536] | 320 | }
|
---|
| 321 | if (! (appendFlagGlonass & QIODevice::Append)) {
|
---|
| 322 | QString line;
|
---|
| 323 | line.sprintf(
|
---|
| 324 | "%9.2f%11sG: GLONASS NAV DATA%21sRINEX VERSION / TYPE\n",2.1,"","");
|
---|
| 325 | *_ephStreamGlonass << line;
|
---|
| 326 |
|
---|
| 327 | char buffer[100];
|
---|
| 328 | HandleRunBy(buffer, sizeof(buffer), 0, 0);
|
---|
| 329 | line.sprintf("%s\n%60sEND OF HEADER\n", buffer, "");
|
---|
| 330 | *_ephStreamGlonass << line;
|
---|
[537] | 331 |
|
---|
| 332 | _ephStreamGlonass->flush();
|
---|
[536] | 333 | }
|
---|
[533] | 334 | }
|
---|
| 335 | }
|
---|
[516] | 336 | }
|
---|
| 337 |
|
---|
[535] | 338 | // Print One GPS Ephemeris
|
---|
[516] | 339 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 340 | void bncApp::printGPSEph(gpsephemeris* ep) {
|
---|
[519] | 341 |
|
---|
[533] | 342 | if (_ephStreamGPS) {
|
---|
| 343 |
|
---|
[519] | 344 | QString line;
|
---|
| 345 |
|
---|
[524] | 346 | struct converttimeinfo cti;
|
---|
| 347 | converttime(&cti, ep->GPSweek, ep->TOC);
|
---|
| 348 |
|
---|
[534] | 349 | if (_rinexVers == 3) {
|
---|
[526] | 350 | line.sprintf("G%02d %04d %02d %02d %02d %02d %02d%19.12e%19.12e%19.12e",
|
---|
[524] | 351 | ep->satellite, cti.year, cti.month, cti.day, cti.hour,
|
---|
| 352 | cti.minute, cti.second, ep->clock_bias, ep->clock_drift,
|
---|
| 353 | ep->clock_driftrate);
|
---|
[519] | 354 | }
|
---|
[534] | 355 | else if (_rinexVers == 2) {
|
---|
[526] | 356 | line.sprintf("%02d %02d %02d %02d %02d %02d%05.1f%19.12e%19.12e%19.12e",
|
---|
[524] | 357 | ep->satellite, cti.year%100, cti.month, cti.day, cti.hour,
|
---|
| 358 | cti.minute, (double) cti.second, ep->clock_bias,
|
---|
[519] | 359 | ep->clock_drift, ep->clock_driftrate);
|
---|
| 360 | }
|
---|
[533] | 361 | *_ephStreamGPS << line << endl;
|
---|
[520] | 362 |
|
---|
[521] | 363 | line.sprintf(" %19.12e%19.12e%19.12e%19.12e", (double)ep->IODE,
|
---|
[520] | 364 | ep->Crs, ep->Delta_n, ep->M0);
|
---|
[533] | 365 | *_ephStreamGPS << line << endl;
|
---|
[520] | 366 |
|
---|
[521] | 367 | line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->Cuc,
|
---|
[520] | 368 | ep->e, ep->Cus, ep->sqrt_A);
|
---|
[533] | 369 | *_ephStreamGPS << line << endl;
|
---|
[520] | 370 |
|
---|
[521] | 371 | line.sprintf(" %19.12e%19.12e%19.12e%19.12e",
|
---|
[520] | 372 | (double) ep->TOE, ep->Cic, ep->OMEGA0, ep->Cis);
|
---|
[533] | 373 | *_ephStreamGPS << line << endl;
|
---|
[520] | 374 |
|
---|
[521] | 375 | line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->i0,
|
---|
[520] | 376 | ep->Crc, ep->omega, ep->OMEGADOT);
|
---|
[533] | 377 | *_ephStreamGPS << line << endl;
|
---|
[520] | 378 |
|
---|
[519] | 379 | double dd = 0;
|
---|
| 380 | unsigned long ii = ep->flags;
|
---|
| 381 | if(ii & GPSEPHF_L2CACODE)
|
---|
| 382 | dd += 2.0;
|
---|
| 383 | if(ii & GPSEPHF_L2PCODE)
|
---|
| 384 | dd += 1.0;
|
---|
[521] | 385 | line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->IDOT, dd,
|
---|
[520] | 386 | (double) ep->GPSweek, ii & GPSEPHF_L2PCODEDATA ? 1.0 : 0.0);
|
---|
[533] | 387 | *_ephStreamGPS << line << endl;
|
---|
[520] | 388 |
|
---|
[519] | 389 | if(ep->URAindex <= 6) /* URA index */
|
---|
| 390 | dd = ceil(10.0*pow(2.0, 1.0+((double)ep->URAindex)/2.0))/10.0;
|
---|
| 391 | else
|
---|
| 392 | dd = ceil(10.0*pow(2.0, ((double)ep->URAindex)/2.0))/10.0;
|
---|
[521] | 393 | line.sprintf(" %19.12e%19.12e%19.12e%19.12e", dd,
|
---|
[520] | 394 | ((double) ep->SVhealth), ep->TGD, ((double) ep->IODC));
|
---|
[533] | 395 | *_ephStreamGPS << line << endl;
|
---|
[519] | 396 |
|
---|
[521] | 397 | line.sprintf(" %19.12e%19.12e", ((double)ep->TOW), 0.0);
|
---|
[533] | 398 | *_ephStreamGPS << line << endl;
|
---|
[519] | 399 |
|
---|
[533] | 400 | _ephStreamGPS->flush();
|
---|
[517] | 401 | }
|
---|
[516] | 402 | }
|
---|
| 403 |
|
---|
[535] | 404 | // Print One Glonass Ephemeris
|
---|
[516] | 405 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 406 | void bncApp::printGlonassEph(glonassephemeris* ep) {
|
---|
[523] | 407 |
|
---|
[533] | 408 | if (_ephStreamGlonass) {
|
---|
[527] | 409 | int ww = ep->GPSWeek;
|
---|
| 410 | int tow = ep->GPSTOW;
|
---|
[525] | 411 | struct converttimeinfo cti;
|
---|
[523] | 412 |
|
---|
[527] | 413 | updatetime(&ww, &tow, ep->tb*1000, 1);
|
---|
| 414 | converttime(&cti, ww, tow);
|
---|
[523] | 415 |
|
---|
[527] | 416 | int ii = ep->tk-3*60*60;
|
---|
| 417 | if (ii < 0) {
|
---|
| 418 | ii += 86400;
|
---|
| 419 | }
|
---|
[525] | 420 |
|
---|
| 421 | QString line;
|
---|
| 422 |
|
---|
[534] | 423 | if (_rinexVers == 3) {
|
---|
[525] | 424 | line.sprintf("R%02d %04d %02d %02d %02d %02d %02d%19.12e%19.12e%19.12e",
|
---|
| 425 | ep->almanac_number, cti.year, cti.month, cti.day, cti.hour,
|
---|
[527] | 426 | cti.minute, cti.second, -ep->tau, ep->gamma, (double) ii);
|
---|
[525] | 427 | }
|
---|
[534] | 428 | else if (_rinexVers == 2) {
|
---|
[525] | 429 | line.sprintf("%02d %02d %02d %02d %02d %02d%5.1f%19.12e%19.12e%19.12e",
|
---|
| 430 | ep->almanac_number, cti.year%100, cti.month, cti.day,
|
---|
| 431 | cti.hour, cti.minute, (double) cti.second, -ep->tau,
|
---|
[527] | 432 | ep->gamma, (double) ii);
|
---|
[525] | 433 | }
|
---|
[533] | 434 | *_ephStreamGlonass << line << endl;
|
---|
[525] | 435 |
|
---|
| 436 | line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->x_pos,
|
---|
| 437 | ep->x_velocity, ep->x_acceleration,
|
---|
| 438 | (ep->flags & GLOEPHF_UNHEALTHY) ? 1.0 : 0.0);
|
---|
[533] | 439 | *_ephStreamGlonass << line << endl;
|
---|
[525] | 440 |
|
---|
| 441 | line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->y_pos,
|
---|
| 442 | ep->y_velocity, ep->y_acceleration,
|
---|
| 443 | (double) ep->frequency_number);
|
---|
[533] | 444 | *_ephStreamGlonass << line << endl;
|
---|
[525] | 445 |
|
---|
| 446 | line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->z_pos,
|
---|
| 447 | ep->z_velocity, ep->z_acceleration, (double) ep->E);
|
---|
[533] | 448 | *_ephStreamGlonass << line << endl;
|
---|
[525] | 449 |
|
---|
[533] | 450 | _ephStreamGlonass->flush();
|
---|
[517] | 451 | }
|
---|
[516] | 452 | }
|
---|