- Timestamp:
- Feb 11, 2012, 4:33:33 PM (13 years ago)
- Location:
- trunk/BNC
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/RTCM3/ephemeris.cpp
r3661 r3664 793 793 ////////////////////////////////////////////////////////////////////////////// 794 794 t_ephGPS::t_ephGPS(float rnxVersion, const QStringList& lines) { 795 795 796 if (lines.size() != 8) { 796 797 _ok = false; 797 798 return; 798 799 } 799 QRegExp rex; 800 if (rnxVersion < 3.0) { 801 rex.setPattern("(.{2}).(.{2}).(.{2}).(.{2}).(.{2}).(.{2})(.{5})(.{19})(.{19})(.{19})\\s*"); 802 if (rex.exactMatch(lines[0])) { 803 QStringList hlp = rex.capturedTexts(); 804 _prn = QString("G%1").arg(hlp[1], 2, QChar('0')); 805 int year = hlp[2].toInt(); 806 int month = hlp[3].toInt(); 807 int day = hlp[4].toInt(); 808 int hour = hlp[5].toInt(); 809 int min = hlp[6].toInt(); 810 double sec = hlp[7].toDouble(); 811 cout << _prn.toAscii().data() << " " << year << " " << month << " " 812 << day << " " << hour << " " << min << " " << sec << "<<<" << endl; 800 801 unsigned off = (rnxVersion < 2.12) ? 0 : 1; 802 803 // Read eight lines 804 // ---------------- 805 for (unsigned iLine = 0; iLine < 8; iLine++) { 806 QString line = lines[iLine]; 807 808 if ( iLine == 0 ) { 809 int year, month, day, hour, min; 810 double sec = 0.0; 811 if (rnxVersion < 3.0) { 812 if ( readInt(line, 3 + off, 2, year ) || 813 readInt(line, 6 + off, 2, month ) || 814 readInt(line, 9 + off, 2, day ) || 815 readInt(line, 12 + off, 2, hour ) || 816 readInt(line, 15 + off, 2, min ) || 817 readDbl(line, 17 + off, 5, sec ) || 818 readDbl(line, 22 + off, 19, _clock_bias ) || 819 readDbl(line, 41 + off, 19, _clock_drift ) || 820 readDbl(line, 60 + off, 19, _clock_driftrate) ) { 821 return; 822 } 823 if (year < 80) { 824 year += 2000; 825 } 826 else { 827 year += 1900; 828 } 829 } 830 else { 831 int iSec; 832 if ( readInt(line, 4, 4, year ) || 833 readInt(line, 9, 2, month ) || 834 readInt(line, 12, 2, day ) || 835 readInt(line, 15, 2, hour ) || 836 readInt(line, 18, 2, min ) || 837 readInt(line, 21, 2, iSec ) || 838 readDbl(line, 23, 19, _clock_bias ) || 839 readDbl(line, 42, 19, _clock_drift ) || 840 readDbl(line, 61, 19, _clock_driftrate) ) { 841 return; 842 } 843 sec = iSec; 844 } 845 bncTime hlpTime; 846 hlpTime.set(year, month, day, hour, min, sec); 847 _GPSweek = hlpTime.gpsw(); 848 _GPSweeks = hlpTime.gpssec(); 849 _TOC = _GPSweeks; 850 } 851 852 else if ( iLine == 1 ) { 853 if ( readDbl(line, off + 3, 19, _IODE ) || 854 readDbl(line, off + 22, 19, _Crs ) || 855 readDbl(line, off + 41, 19, _Delta_n) || 856 readDbl(line, off + 60, 19, _M0 ) ) { 857 return; 858 } 859 } 860 861 else if ( iLine == 2 ) { 862 if ( readDbl(line, off + 3, 19, _Cuc ) || 863 readDbl(line, off + 22, 19, _e ) || 864 readDbl(line, off + 41, 19, _Cus ) || 865 readDbl(line, off + 60, 19, _sqrt_A) ) { 866 return; 867 } 868 } 869 870 else if ( iLine == 3 ) { 871 if ( readDbl(line, off + 3, 19, _TOE ) || 872 readDbl(line, off + 22, 19, _Cic ) || 873 readDbl(line, off + 41, 19, _OMEGA0) || 874 readDbl(line, off + 60, 19, _Cis ) ) { 875 return; 876 } 877 } 878 879 else if ( iLine == 4 ) { 880 if ( readDbl(line, off + 3, 19, _i0 ) || 881 readDbl(line, off + 22, 19, _Crc ) || 882 readDbl(line, off + 41, 19, _omega ) || 883 readDbl(line, off + 60, 19, _OMEGADOT) ) { 884 return; 885 } 886 } 887 888 else if ( iLine == 5 ) { 889 double dummy, TOEw; 890 if ( readDbl(line, off + 3, 19, _IDOT) || 891 readDbl(line, off + 22, 19, dummy) || 892 readDbl(line, off + 41, 19, TOEw ) || 893 readDbl(line, off + 60, 19, dummy) ) { 894 return; 895 } 896 } 897 898 else if ( iLine == 6 ) { 899 double dummy; 900 if ( readDbl(line, off + 3, 19, dummy ) || 901 readDbl(line, off + 22, 19, _health) || 902 readDbl(line, off + 41, 19, _TGD ) || 903 readDbl(line, off + 60, 19, _IODC ) ) { 904 return; 905 } 906 } 907 908 else if ( iLine == 7 ) { 909 double TOT; 910 if ( readDbl(line, off + 3, 19, TOT) ) { 911 return; 912 } 813 913 } 814 914 } -
trunk/BNC/bncutils.cpp
r3408 r3664 387 387 } 388 388 389 // 390 //////////////////////////////////////////////////////////////////////////// 391 int readInt(const QString& str, int pos, int len, int& value) { 392 bool ok; 393 value = str.mid(pos, len).toInt(&ok); 394 return ok ? 0 : 1; 395 } 396 397 // 398 //////////////////////////////////////////////////////////////////////////// 399 int readDbl(const QString& str, int pos, int len, double& value) { 400 QString hlp = str.mid(pos, len); 401 for (int ii = 0; ii < hlp.length(); ii++) { 402 if (hlp[ii]=='D' || hlp[ii]=='d' || hlp[ii] == 'E') { 403 hlp[ii]='e'; 404 } 405 } 406 bool ok; 407 value = hlp.toDouble(&ok); 408 return ok ? 0 : 1; 409 } -
trunk/BNC/bncutils.h
r3408 r3664 72 72 bool findInVector(const std::vector<QString>& vv, const QString& str); 73 73 74 int readInt(const QString& str, int pos, int len, int& value); 75 76 int readDbl(const QString& str, int pos, int len, double& value); 77 74 78 #endif
Note:
See TracChangeset
for help on using the changeset viewer.