- Timestamp:
- Nov 24, 2007, 9:08:02 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncapp.cpp
r589 r590 464 464 void bncApp::printGPSEph(gpsephemeris* ep) { 465 465 466 if (_ephStreamGPS) { 467 468 QString line; 469 470 struct converttimeinfo cti; 471 converttime(&cti, ep->GPSweek, ep->TOC); 472 473 QByteArray stream; 474 475 line.sprintf("G%02d %04d %02d %02d %02d %02d %02d%19.12e%19.12e%19.12e", 466 QString line; 467 QByteArray allLines; 468 469 struct converttimeinfo cti; 470 converttime(&cti, ep->GPSweek, ep->TOC); 471 if (_rinexVers == 3) { 472 line.sprintf("G%02d %04d %02d %02d %02d %02d %02d%19.12e%19.12e%19.12e\n", 476 473 ep->satellite, cti.year, cti.month, cti.day, cti.hour, 477 474 cti.minute, cti.second, ep->clock_bias, ep->clock_drift, 478 475 ep->clock_driftrate); 479 stream += line; 480 if (_rinexVers == 2) { 481 line.sprintf("%02d %02d %02d %02d %02d %02d%5.1f%19.12e%19.12e%19.12e", 482 ep->satellite, cti.year%100, cti.month, cti.day, cti.hour, 483 cti.minute, (double) cti.second, ep->clock_bias, 484 ep->clock_drift, ep->clock_driftrate); 485 } 486 *_ephStreamGPS << line << endl; 487 488 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", (double)ep->IODE, 489 ep->Crs, ep->Delta_n, ep->M0); 490 stream += line; 491 *_ephStreamGPS << line << endl; 492 493 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->Cuc, 494 ep->e, ep->Cus, ep->sqrt_A); 495 stream += line; 496 *_ephStreamGPS << line << endl; 497 498 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", 499 (double) ep->TOE, ep->Cic, ep->OMEGA0, ep->Cis); 500 stream += line; 501 *_ephStreamGPS << line << endl; 502 503 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->i0, 504 ep->Crc, ep->omega, ep->OMEGADOT); 505 stream += line; 506 *_ephStreamGPS << line << endl; 507 508 double dd = 0; 509 unsigned long ii = ep->flags; 510 if(ii & GPSEPHF_L2CACODE) 511 dd += 2.0; 512 if(ii & GPSEPHF_L2PCODE) 513 dd += 1.0; 514 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->IDOT, dd, 515 (double) ep->GPSweek, ii & GPSEPHF_L2PCODEDATA ? 1.0 : 0.0); 516 stream += line; 517 *_ephStreamGPS << line << endl; 518 519 if(ep->URAindex <= 6) /* URA index */ 520 dd = ceil(10.0*pow(2.0, 1.0+((double)ep->URAindex)/2.0))/10.0; 521 else 522 dd = ceil(10.0*pow(2.0, ((double)ep->URAindex)/2.0))/10.0; 523 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", dd, 524 ((double) ep->SVhealth), ep->TGD, ((double) ep->IODC)); 525 stream += line; 526 *_ephStreamGPS << line << endl; 527 528 line.sprintf(" %19.12e%19.12e", ((double)ep->TOW), 0.0); 529 stream += line; 530 *_ephStreamGPS << line << endl; 531 476 } 477 else if (_rinexVers == 2) { 478 line.sprintf("%02d %02d %02d %02d %02d %02d%5.1f%19.12e%19.12e%19.12e\n", 479 ep->satellite, cti.year%100, cti.month, cti.day, cti.hour, 480 cti.minute, (double) cti.second, ep->clock_bias, 481 ep->clock_drift, ep->clock_driftrate); 482 } 483 allLines += line; 484 485 line.sprintf(" %19.12e%19.12e%19.12e%19.12e\n", (double)ep->IODE, 486 ep->Crs, ep->Delta_n, ep->M0); 487 allLines += line; 488 489 line.sprintf(" %19.12e%19.12e%19.12e%19.12e\n", ep->Cuc, 490 ep->e, ep->Cus, ep->sqrt_A); 491 allLines += line; 492 493 line.sprintf(" %19.12e%19.12e%19.12e%19.12e\n", 494 (double) ep->TOE, ep->Cic, ep->OMEGA0, ep->Cis); 495 allLines += line; 496 497 line.sprintf(" %19.12e%19.12e%19.12e%19.12e\n", ep->i0, 498 ep->Crc, ep->omega, ep->OMEGADOT); 499 allLines += line; 500 501 double dd = 0; 502 unsigned long ii = ep->flags; 503 if(ii & GPSEPHF_L2CACODE) 504 dd += 2.0; 505 if(ii & GPSEPHF_L2PCODE) 506 dd += 1.0; 507 line.sprintf(" %19.12e%19.12e%19.12e%19.12e\n", ep->IDOT, dd, 508 (double) ep->GPSweek, ii & GPSEPHF_L2PCODEDATA ? 1.0 : 0.0); 509 allLines += line; 510 511 if(ep->URAindex <= 6) /* URA index */ 512 dd = ceil(10.0*pow(2.0, 1.0+((double)ep->URAindex)/2.0))/10.0; 513 else 514 dd = ceil(10.0*pow(2.0, ((double)ep->URAindex)/2.0))/10.0; 515 line.sprintf(" %19.12e%19.12e%19.12e%19.12e\n", dd, 516 ((double) ep->SVhealth), ep->TGD, ((double) ep->IODC)); 517 allLines += line; 518 519 line.sprintf(" %19.12e%19.12e\n", ((double)ep->TOW), 0.0); 520 allLines += line; 521 522 // Output into file 523 // ---------------- 524 if (_ephStreamGPS) { 525 *_ephStreamGPS << allLines << endl; 532 526 _ephStreamGPS->flush(); 533 534 // Output into the socket 535 // ----------------------536 if (_sockets) {537 QListIterator<QTcpSocket*> is(*_sockets);538 while (is.hasNext()) {539 QTcpSocket* sock = is.next();540 if (sock->state() == QAbstractSocket::ConnectedState) {541 sock->write(stream);542 }527 } 528 529 // Output into the socket 530 // ---------------------- 531 if (_sockets) { 532 QListIterator<QTcpSocket*> is(*_sockets); 533 while (is.hasNext()) { 534 QTcpSocket* sock = is.next(); 535 if (sock->state() == QAbstractSocket::ConnectedState) { 536 sock->write(allLines); 543 537 } 544 538 } … … 550 544 void bncApp::printGlonassEph(glonassephemeris* ep) { 551 545 546 QString line; 547 QByteArray allLines; 548 549 int ww = ep->GPSWeek; 550 int tow = ep->GPSTOW; 551 struct converttimeinfo cti; 552 553 updatetime(&ww, &tow, ep->tb*1000, 1); 554 converttime(&cti, ww, tow); 555 556 int ii = ep->tk-3*60*60; 557 if (ii < 0) { 558 ii += 86400; 559 } 560 561 if (_rinexVers == 3) { 562 line.sprintf("R%02d %04d %02d %02d %02d %02d %02d%19.12e%19.12e%19.12e\n", 563 ep->almanac_number, cti.year, cti.month, cti.day, cti.hour, 564 cti.minute, cti.second, -ep->tau, ep->gamma, (double) ii); 565 } 566 else if (_rinexVers == 2) { 567 line.sprintf("%02d %02d %02d %02d %02d %02d%5.1f%19.12e%19.12e%19.12e\n", 568 ep->almanac_number, cti.year%100, cti.month, cti.day, 569 cti.hour, cti.minute, (double) cti.second, -ep->tau, 570 ep->gamma, (double) ii); 571 } 572 allLines += line; 573 574 line.sprintf(" %19.12e%19.12e%19.12e%19.12e\n", ep->x_pos, 575 ep->x_velocity, ep->x_acceleration, 576 (ep->flags & GLOEPHF_UNHEALTHY) ? 1.0 : 0.0); 577 allLines += line; 578 579 line.sprintf(" %19.12e%19.12e%19.12e%19.12e\n", ep->y_pos, 580 ep->y_velocity, ep->y_acceleration, 581 (double) ep->frequency_number); 582 allLines += line; 583 584 line.sprintf(" %19.12e%19.12e%19.12e%19.12e\n", ep->z_pos, 585 ep->z_velocity, ep->z_acceleration, (double) ep->E); 586 allLines += line; 587 588 // Output into file 589 // ---------------- 552 590 if (_ephStreamGlonass) { 553 int ww = ep->GPSWeek; 554 int tow = ep->GPSTOW; 555 struct converttimeinfo cti; 556 557 updatetime(&ww, &tow, ep->tb*1000, 1); 558 converttime(&cti, ww, tow); 559 560 int ii = ep->tk-3*60*60; 561 if (ii < 0) { 562 ii += 86400; 563 } 564 565 QString line; 566 567 if (_rinexVers == 3) { 568 line.sprintf("R%02d %04d %02d %02d %02d %02d %02d%19.12e%19.12e%19.12e", 569 ep->almanac_number, cti.year, cti.month, cti.day, cti.hour, 570 cti.minute, cti.second, -ep->tau, ep->gamma, (double) ii); 571 } 572 else if (_rinexVers == 2) { 573 line.sprintf("%02d %02d %02d %02d %02d %02d%5.1f%19.12e%19.12e%19.12e", 574 ep->almanac_number, cti.year%100, cti.month, cti.day, 575 cti.hour, cti.minute, (double) cti.second, -ep->tau, 576 ep->gamma, (double) ii); 577 } 578 *_ephStreamGlonass << line << endl; 579 580 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->x_pos, 581 ep->x_velocity, ep->x_acceleration, 582 (ep->flags & GLOEPHF_UNHEALTHY) ? 1.0 : 0.0); 583 *_ephStreamGlonass << line << endl; 584 585 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->y_pos, 586 ep->y_velocity, ep->y_acceleration, 587 (double) ep->frequency_number); 588 *_ephStreamGlonass << line << endl; 589 590 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->z_pos, 591 ep->z_velocity, ep->z_acceleration, (double) ep->E); 592 *_ephStreamGlonass << line << endl; 593 591 *_ephStreamGlonass << allLines << endl; 594 592 _ephStreamGlonass->flush(); 593 } 594 595 // Output into the socket 596 // ---------------------- 597 if (_sockets) { 598 QListIterator<QTcpSocket*> is(*_sockets); 599 while (is.hasNext()) { 600 QTcpSocket* sock = is.next(); 601 if (sock->state() == QAbstractSocket::ConnectedState) { 602 sock->write(allLines); 603 } 604 } 595 605 } 596 606 }
Note:
See TracChangeset
for help on using the changeset viewer.