- Timestamp:
- Nov 24, 2007, 8:58:16 PM (17 years ago)
- Location:
- trunk/BNC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncapp.cpp
r584 r589 91 91 _ephStreamGlonass = 0; 92 92 93 _server = 0; 94 _sockets = 0; 95 93 96 _pgmName = _bncVersion.leftJustified(20, ' ', true); 94 97 #ifdef WIN32 … … 108 111 delete _ephStreamGPS; 109 112 delete _ephFileGPS; 113 delete _server; 114 delete _sockets; 110 115 if (_rinexVers == 2) { 111 116 delete _ephStreamGlonass; … … 241 246 } 242 247 expandEnvVar(_ephPath); 248 } 249 250 // Socket Output 251 // ------------- 252 _port = settings.value("outEphPort").toInt(); 253 if (_port != 0) { 254 _server = new QTcpServer; 255 _server->listen(QHostAddress::Any, _port); 256 connect(_server, SIGNAL(newConnection()), this, SLOT(slotNewConnection())); 257 _sockets = new QList<QTcpSocket*>; 243 258 } 244 259 } … … 456 471 converttime(&cti, ep->GPSweek, ep->TOC); 457 472 458 if (_rinexVers == 3) { 459 line.sprintf("G%02d %04d %02d %02d %02d %02d %02d%19.12e%19.12e%19.12e", 460 ep->satellite, cti.year, cti.month, cti.day, cti.hour, 461 cti.minute, cti.second, ep->clock_bias, ep->clock_drift, 462 ep->clock_driftrate); 463 } 464 else if (_rinexVers == 2) { 473 QByteArray stream; 474 475 line.sprintf("G%02d %04d %02d %02d %02d %02d %02d%19.12e%19.12e%19.12e", 476 ep->satellite, cti.year, cti.month, cti.day, cti.hour, 477 cti.minute, cti.second, ep->clock_bias, ep->clock_drift, 478 ep->clock_driftrate); 479 stream += line; 480 if (_rinexVers == 2) { 465 481 line.sprintf("%02d %02d %02d %02d %02d %02d%5.1f%19.12e%19.12e%19.12e", 466 482 ep->satellite, cti.year%100, cti.month, cti.day, cti.hour, … … 472 488 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", (double)ep->IODE, 473 489 ep->Crs, ep->Delta_n, ep->M0); 490 stream += line; 474 491 *_ephStreamGPS << line << endl; 475 492 476 493 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->Cuc, 477 494 ep->e, ep->Cus, ep->sqrt_A); 495 stream += line; 478 496 *_ephStreamGPS << line << endl; 479 497 480 498 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", 481 499 (double) ep->TOE, ep->Cic, ep->OMEGA0, ep->Cis); 500 stream += line; 482 501 *_ephStreamGPS << line << endl; 483 502 484 503 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->i0, 485 504 ep->Crc, ep->omega, ep->OMEGADOT); 505 stream += line; 486 506 *_ephStreamGPS << line << endl; 487 507 … … 494 514 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", ep->IDOT, dd, 495 515 (double) ep->GPSweek, ii & GPSEPHF_L2PCODEDATA ? 1.0 : 0.0); 516 stream += line; 496 517 *_ephStreamGPS << line << endl; 497 518 … … 502 523 line.sprintf(" %19.12e%19.12e%19.12e%19.12e", dd, 503 524 ((double) ep->SVhealth), ep->TGD, ((double) ep->IODC)); 525 stream += line; 504 526 *_ephStreamGPS << line << endl; 505 527 506 528 line.sprintf(" %19.12e%19.12e", ((double)ep->TOW), 0.0); 529 stream += line; 507 530 *_ephStreamGPS << line << endl; 508 531 509 532 _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 } 543 } 544 } 510 545 } 511 546 } … … 560 595 } 561 596 } 597 598 // New Connection 599 //////////////////////////////////////////////////////////////////////////// 600 void bncApp::slotNewConnection() { 601 _sockets->push_back( _server->nextPendingConnection() ); 602 } 603 -
trunk/BNC/bncapp.h
r559 r589 43 43 void slotNewGPSEph(gpsephemeris* gpseph); 44 44 void slotNewGlonassEph(glonassephemeris* glonasseph); 45 private slots: 46 void slotNewConnection(); 45 47 private: 46 48 void printEphHeader(); … … 64 66 QString _userName; 65 67 QString _pgmName; 68 int _port; 69 QTcpServer* _server; 70 QList<QTcpSocket*>* _sockets; 66 71 }; 67 72 #endif
Note:
See TracChangeset
for help on using the changeset viewer.