Legend:
- Unmodified
- Added
- Removed
-
trunk/BNS/bns.cpp
r2429 r2461 46 46 bnsSettings settings; 47 47 48 _GPSweek = 0; 49 _GPSweeks = 0; 50 48 51 // Set Proxy (application-wide) 49 52 // ---------------------------- … … 314 317 if (_clkSocket && _clkSocket->state() == QAbstractSocket::ConnectedState) { 315 318 if ( _clkSocket->canReadLine()) { 316 read Epoch();319 readRecords(); 317 320 } 318 321 else { … … 330 333 void t_bns::readEpoch() { 331 334 335 QTextStream in(_clkLine); 336 337 QString hlp; 338 in >> hlp >> _year >> _month >> _day >> _hour >> _min >> _sec; 339 340 GPSweekFromYMDhms(_year, _month, _day, _hour, _min, _sec, _GPSweek, _GPSweeks); 341 342 if (_echoStream) { 343 *_echoStream << _clkLine; 344 _echoStream->flush(); 345 } 346 emit(newClkBytes(_clkLine.length())); 347 } 348 349 350 // 351 //////////////////////////////////////////////////////////////////////////// 352 void t_bns::readRecords() { 353 332 354 bnsSettings settings; 333 355 334 356 // Read the first line (if not already read) 335 357 // ----------------------------------------- 336 if (_clkLine.indexOf('*') == -1) { 358 if ( _GPSweek == 0 and _clkLine.indexOf('*') == -1 ) { 359 337 360 _clkLine = _clkSocket->readLine(); 338 if (_echoStream) { 339 *_echoStream << _clkLine; 340 _echoStream->flush(); 341 } 342 emit(newClkBytes(_clkLine.length())); 343 } 344 345 if (_clkLine.indexOf('*') == -1) { 346 return; 347 } 348 349 QTextStream in(_clkLine); 350 351 QString hlp; 352 int year, month, day, hour, min; 353 double sec; 354 in >> hlp >> year >> month >> day >> hour >> min >> sec; 355 356 int GPSweek; 357 double GPSweeks; 358 359 GPSweekFromYMDhms(year, month, day, hour, min, sec, GPSweek, GPSweeks); 360 361 QStringList prns; 361 // cout << "trying epoch:" << _clkLine.data() << endl; 362 363 if (_clkLine.indexOf('*') == -1) { 364 return; 365 }else{ 366 readEpoch(); 367 } 368 } 362 369 363 370 // Loop over all satellites … … 368 375 break; 369 376 } 377 378 QByteArray tmp = _clkSocket->peek(80); 379 380 // found epoch, but not first record, break 381 if( tmp.indexOf('*') >= 0 and lines.size() > 0 ) { 382 // cout << "find epoch, not first, thus break" << endl; 383 break; 384 } 385 370 386 _clkLine = _clkSocket->readLine(); 387 388 // found epoch, but still first record, continue 389 if (_clkLine[0] == '*') { 390 // cout << "epoch:" << _clkLine.data(); 391 readEpoch(); 392 } 393 394 if (_clkLine[0] == 'P') { 395 // cout << "data:" << _clkLine.data(); 396 _clkLine.remove(0,1); 397 lines.push_back(_clkLine); 398 } 399 371 400 if (_echoStream) { 372 401 *_echoStream << _clkLine; 373 402 _echoStream->flush(); 374 403 } 375 if (_clkLine[0] == '*') { 376 return; 377 } 378 if (_clkLine[0] == 'P') { 379 _clkLine.remove(0,1); 380 lines.push_back(_clkLine); 381 } 382 } 383 404 405 } 406 407 // some data records to be processed ? 384 408 if (lines.size() > 0) { 385 409 … … 393 417 struct ClockOrbit co; 394 418 memset(&co, 0, sizeof(co)); 395 co.GPSEpochTime = (int) GPSweeks;396 co.GLONASSEpochTime = (int)fmod( GPSweeks, 86400.0)397 + 3 * 3600 - gnumleap( year, month,day);419 co.GPSEpochTime = (int)_GPSweeks; 420 co.GLONASSEpochTime = (int)fmod(_GPSweeks, 86400.0) 421 + 3 * 3600 - gnumleap(_year, _month, _day); 398 422 co.ClockDataSupplied = 1; 399 423 co.OrbitDataSupplied = 1; … … 402 426 struct Bias bias; 403 427 memset(&bias, 0, sizeof(bias)); 404 bias.GPSEpochTime = (int) GPSweeks;405 bias.GLONASSEpochTime = (int)fmod( GPSweeks, 86400.0)406 + 3 * 3600 - gnumleap( year, month,day);428 bias.GPSEpochTime = (int)_GPSweeks; 429 bias.GLONASSEpochTime = (int)fmod(_GPSweeks, 86400.0) 430 + 3 * 3600 - gnumleap(_year, _month, _day); 407 431 408 432 for (int ii = 0; ii < lines.size(); ii++) { … … 452 476 } 453 477 } 454 455 478 if (ep != 0) { 456 479 struct ClockOrbit::SatData* sd = 0; … … 467 490 processSatellite(oldEph, ic, _caster.at(ic)->crdTrafo(), 468 491 _caster.at(ic)->CoM(), ep, 469 GPSweek,GPSweeks, prn, xx, sd, outLine);492 _GPSweek, _GPSweeks, prn, xx, sd, outLine); 470 493 _caster.at(ic)->printAscii(outLine); 471 494 } -
trunk/BNS/bns.h
r2349 r2461 69 69 void openCaster(); 70 70 void readEpoch(); 71 void readRecords(); 71 72 void processSatellite(int oldEph, int iCaster, const QString trafo, bool CoM, 72 73 t_eph* ep, int GPSweek, double GPSweeks, … … 89 90 bnsSP3* _sp3; 90 91 QByteArray _clkLine; 92 93 int _GPSweek; 94 double _GPSweeks; 95 int _year; 96 int _month; 97 int _day; 98 int _hour; 99 int _min; 100 double _sec; 101 91 102 double _dx; 92 103 double _dy; -
trunk/BNS/bnsoutf.cpp
r1668 r2461 110 110 111 111 if (nextEpoch) { 112 *nextEpoch = QDateTime(nextDate, nextTime);112 *nextEpoch = QDateTime(nextDate, nextTime, Qt::UTC); 113 113 } 114 114
Note:
See TracChangeset
for help on using the changeset viewer.