Changeset 5989 in ntrip for trunk/BNC/src
- Timestamp:
- Aug 18, 2014, 8:31:00 AM (10 years ago)
- Location:
- trunk/BNC/src/PPP
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/PPP/pppRun.cpp
r5988 r5989 296 296 } 297 297 298 if (!output._error) { 299 QString rmcStr = nmeaRMC(output); 300 QString ggaStr = nmeaGGA(output); 301 if (_nmeaFile) { 302 _nmeaFile->write(output._epoTime.gpsw(), output._epoTime.gpssec(), rmcStr); 303 _nmeaFile->write(output._epoTime.gpsw(), output._epoTime.gpssec(), ggaStr); 304 } 305 emit newNMEAstr(staID, rmcStr.toAscii()); 306 emit newNMEAstr(staID, ggaStr.toAscii()); 307 } 308 298 309 emit newMessage(QByteArray(log.str().c_str()), true); 299 310 } … … 504 515 _stopFlag = true; 505 516 } 517 518 // 519 //////////////////////////////////////////////////////////////////////////// 520 QString t_pppRun::nmeaRMC(const t_output& output) const { 521 522 double ell[3]; 523 xyz2ell(output._xyzRover, ell); 524 double phiDeg = ell[0] * 180 / M_PI; 525 double lamDeg = ell[1] * 180 / M_PI; 526 527 char phiCh = 'N'; 528 if (phiDeg < 0) { 529 phiDeg = -phiDeg; 530 phiCh = 'S'; 531 } 532 char lamCh = 'E'; 533 if (lamDeg < 0) { 534 lamDeg = -lamDeg; 535 lamCh = 'W'; 536 } 537 538 string datestr = output._epoTime.datestr(0); // yyyymmdd 539 540 ostringstream strRMC; 541 strRMC.setf(ios::fixed); 542 strRMC << "GPRMC," 543 << output._epoTime.timestr(0,0) << ",A," 544 << setw(2) << setfill('0') << int(phiDeg) 545 << setw(6) << setprecision(3) << setfill('0') 546 << fmod(60*phiDeg,60) << ',' << phiCh << ',' 547 << setw(3) << setfill('0') << int(lamDeg) 548 << setw(6) << setprecision(3) << setfill('0') 549 << fmod(60*lamDeg,60) << ',' << lamCh << ",,," 550 << datestr[6] << datestr[7] << datestr[4] << datestr[5] 551 << datestr[2] << datestr[3] << ",,"; 552 553 QString nmStr(strRMC.str().c_str()); 554 unsigned char XOR = 0; 555 for (int ii = 0; ii < nmStr.length(); ii++) { 556 XOR ^= (unsigned char) nmStr[ii].toAscii(); 557 } 558 559 return '$' + nmStr + QString("*%1\n").arg(int(XOR), 0, 16).toUpper(); 560 } 561 562 // 563 //////////////////////////////////////////////////////////////////////////// 564 QString t_pppRun::nmeaGGA(const t_output& output) const { 565 566 double ell[3]; 567 xyz2ell(output._xyzRover, ell); 568 double phiDeg = ell[0] * 180 / M_PI; 569 double lamDeg = ell[1] * 180 / M_PI; 570 571 char phiCh = 'N'; 572 if (phiDeg < 0) { 573 phiDeg = -phiDeg; 574 phiCh = 'S'; 575 } 576 char lamCh = 'E'; 577 if (lamDeg < 0) { 578 lamDeg = -lamDeg; 579 lamCh = 'W'; 580 } 581 582 ostringstream strGGA; 583 strGGA.setf(ios::fixed); 584 strGGA << "GPGGA," 585 << output._epoTime.timestr(0,0) << ',' 586 << setw(2) << setfill('0') << int(phiDeg) 587 << setw(10) << setprecision(7) << setfill('0') 588 << fmod(60*phiDeg,60) << ',' << phiCh << ',' 589 << setw(3) << setfill('0') << int(lamDeg) 590 << setw(10) << setprecision(7) << setfill('0') 591 << fmod(60*lamDeg,60) << ',' << lamCh 592 << ",1," << setw(2) << setfill('0') << output._numSat << ',' 593 << setw(3) << setprecision(1) << output._pDop << ',' 594 << setprecision(3) << ell[2] << ",M,0.0,M,,"; 595 596 QString nmStr(strGGA.str().c_str()); 597 unsigned char XOR = 0; 598 for (int ii = 0; ii < nmStr.length(); ii++) { 599 XOR ^= (unsigned char) nmStr[ii].toAscii(); 600 } 601 602 return '$' + nmStr + QString("*%1\n").arg(int(XOR), 0, 16).toUpper(); 603 } -
trunk/BNC/src/PPP/pppRun.h
r5988 r5989 54 54 }; 55 55 56 QString nmeaRMC(const t_output& output) const; 57 QString nmeaGGA(const t_output& output) const; 58 56 59 QMutex _mutex; 57 60 const t_pppOptions* _opt; … … 61 64 double _lastClkCorrValue[t_prn::MAXPRN+1]; 62 65 bncTime _lastClkCorrTime; 63 64 t_rnxObsFile* _rnxObsFile; 65 t_rnxNavFile* _rnxNavFile; 66 t_corrFile* _corrFile; 67 int _speed; 68 bool _stopFlag; 69 bncoutf* _logFile; 70 bncoutf* _nmeaFile; 66 t_rnxObsFile* _rnxObsFile; 67 t_rnxNavFile* _rnxNavFile; 68 t_corrFile* _corrFile; 69 int _speed; 70 bool _stopFlag; 71 bncoutf* _logFile; 72 bncoutf* _nmeaFile; 71 73 }; 72 74
Note:
See TracChangeset
for help on using the changeset viewer.