Changeset 5990 in ntrip for trunk/BNC/src/PPP
- Timestamp:
- Aug 18, 2014, 8:37:21 AM (11 years ago)
- Location:
- trunk/BNC/src/PPP
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/PPP/pppRun.cpp
r5989 r5990 297 297 298 298 if (!output._error) { 299 QString rmcStr = nmea RMC(output);300 QString ggaStr = nmea GGA(output);299 QString rmcStr = nmeaString('R', output); 300 QString ggaStr = nmeaString('G', output); 301 301 if (_nmeaFile) { 302 302 _nmeaFile->write(output._epoTime.gpsw(), output._epoTime.gpssec(), rmcStr); … … 518 518 // 519 519 //////////////////////////////////////////////////////////////////////////// 520 QString t_pppRun::nmea RMC(const t_output& output) const{520 QString t_pppRun::nmeaString(char strType, const t_output& output) { 521 521 522 522 double ell[3]; … … 536 536 } 537 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()); 538 ostringstream out; 539 out.setf(ios::fixed); 540 541 if (strType == 'R') { 542 string datestr = output._epoTime.datestr(0); // yyyymmdd 543 out << "GPRMC," 544 << output._epoTime.timestr(0,0) << ",A," 545 << setw(2) << setfill('0') << int(phiDeg) 546 << setw(6) << setprecision(3) << setfill('0') 547 << fmod(60*phiDeg,60) << ',' << phiCh << ',' 548 << setw(3) << setfill('0') << int(lamDeg) 549 << setw(6) << setprecision(3) << setfill('0') 550 << fmod(60*lamDeg,60) << ',' << lamCh << ",,," 551 << datestr[6] << datestr[7] << datestr[4] << datestr[5] 552 << datestr[2] << datestr[3] << ",,"; 553 } 554 else if (strType == 'G') { 555 out << "GPGGA," 556 << output._epoTime.timestr(0,0) << ',' 557 << setw(2) << setfill('0') << int(phiDeg) 558 << setw(10) << setprecision(7) << setfill('0') 559 << fmod(60*phiDeg,60) << ',' << phiCh << ',' 560 << setw(3) << setfill('0') << int(lamDeg) 561 << setw(10) << setprecision(7) << setfill('0') 562 << fmod(60*lamDeg,60) << ',' << lamCh 563 << ",1," << setw(2) << setfill('0') << output._numSat << ',' 564 << setw(3) << setprecision(1) << output._pDop << ',' 565 << setprecision(3) << ell[2] << ",M,0.0,M,,"; 566 } 567 else { 568 return ""; 569 } 570 571 QString nmStr(out.str().c_str()); 554 572 unsigned char XOR = 0; 555 573 for (int ii = 0; ii < nmStr.length(); ii++) { … … 560 578 } 561 579 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) << ',' << lamCh592 << ",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
r5989 r5990 24 24 25 25 void processFiles(); 26 27 static QString nmeaString(char strType, const t_output& output); 26 28 27 29 signals: … … 54 56 }; 55 57 56 QString nmeaRMC(const t_output& output) const;57 QString nmeaGGA(const t_output& output) const;58 59 58 QMutex _mutex; 60 59 const t_pppOptions* _opt;
Note:
See TracChangeset
for help on using the changeset viewer.