- Timestamp:
- Apr 27, 2011, 9:59:47 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/RTCM3/ephemeris.cpp
r3269 r3279 720 720 // build up RTCM3 for Galileo 721 721 //////////////////////////////////////////////////////////////////////////// 722 #define GALILEOTOINT(type, value) static_cast<type>(NearestInt(value, 0)) 723 724 #define GALILEOADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \ 725 |(GALILEOTOINT(long long,b)&((1LL<<a)-1)); \ 726 numbits += (a); \ 727 while(numbits >= 8) { \ 728 buffer[size++] = bitbuffer>>(numbits-8);numbits -= 8;}} 729 #define GALILEOADDBITSFLOAT(a,b,c) {long long i = GALILEOTOINT(long long,(b)/(c)); \ 730 GALILEOADDBITS(a,i)}; 731 722 732 int t_ephGal::RTCM3(unsigned char *buffer) { 723 724 return 0; 725 } 733 int size = 0; 734 int numbits = 0; 735 long long bitbuffer = 0; 736 unsigned char *startbuffer = buffer; 737 buffer= buffer+3; 738 739 GALILEOADDBITS(12, /*inav ? 1046 :*/ 1045) 740 GALILEOADDBITS(6, _prn.right((_prn.length()-1)).toInt()) 741 GALILEOADDBITS(12, _GPSweek) 742 GALILEOADDBITS(10, _IODnav) 743 GALILEOADDBITS(8, _SISA) 744 GALILEOADDBITSFLOAT(14, _IDOT, PI/static_cast<double>(1<<30) 745 /static_cast<double>(1<<13)) 746 GALILEOADDBITS(14, _TOC/60) 747 GALILEOADDBITSFLOAT(6, _clock_driftrate, 1.0/static_cast<double>(1<<30) 748 /static_cast<double>(1<<29)) 749 GALILEOADDBITSFLOAT(21, _clock_drift, 1.0/static_cast<double>(1<<30) 750 /static_cast<double>(1<<16)) 751 GALILEOADDBITSFLOAT(31, _clock_bias, 1.0/static_cast<double>(1<<30) 752 /static_cast<double>(1<<4)) 753 GALILEOADDBITSFLOAT(16, _Crs, 1.0/static_cast<double>(1<<5)) 754 GALILEOADDBITSFLOAT(16, _Delta_n, PI/static_cast<double>(1<<30) 755 /static_cast<double>(1<<13)) 756 GALILEOADDBITSFLOAT(32, _M0, PI/static_cast<double>(1<<30)/static_cast<double>(1<<1)) 757 GALILEOADDBITSFLOAT(16, _Cuc, 1.0/static_cast<double>(1<<29)) 758 GALILEOADDBITSFLOAT(32, _e, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<3)) 759 GALILEOADDBITSFLOAT(16, _Cus, 1.0/static_cast<double>(1<<29)) 760 GALILEOADDBITSFLOAT(32, _sqrt_A, 1.0/static_cast<double>(1<<19)) 761 GALILEOADDBITS(14, _TOE/60) 762 GALILEOADDBITSFLOAT(16, _Cic, 1.0/static_cast<double>(1<<29)) 763 GALILEOADDBITSFLOAT(32, _OMEGA0, PI/static_cast<double>(1<<30) 764 /static_cast<double>(1<<1)) 765 GALILEOADDBITSFLOAT(16, _Cis, 1.0/static_cast<double>(1<<29)) 766 GALILEOADDBITSFLOAT(32, _i0, PI/static_cast<double>(1<<30)/static_cast<double>(1<<1)) 767 GALILEOADDBITSFLOAT(16, _Crc, 1.0/static_cast<double>(1<<5)) 768 GALILEOADDBITSFLOAT(32, _omega, PI/static_cast<double>(1<<30) 769 /static_cast<double>(1<<1)) 770 GALILEOADDBITSFLOAT(24, _OMEGADOT, PI/static_cast<double>(1<<30) 771 /static_cast<double>(1<<13)) 772 GALILEOADDBITSFLOAT(10, _BGD_1_5A, 1.0/static_cast<double>(1<<30) 773 /static_cast<double>(1<<2)) 774 /*if(inav) 775 { 776 GALILEOADDBITSFLOAT(10, _BGD_1_5B, 1.0/static_cast<double>(1<<30) 777 /static_cast<double>(1<<2)) 778 GALILEOADDBITS(2, _E5bHS) 779 GALILEOADDBITS(1, flags & MNFGALEPHF_E5BDINVALID) 780 } 781 else*/ 782 { 783 GALILEOADDBITS(2, _E5aHS) 784 GALILEOADDBITS(1, /*flags & MNFGALEPHF_E5ADINVALID*/0) 785 } 786 _TOE = 0.9999E9; 787 GALILEOADDBITS(20, _TOE) 788 789 GALILEOADDBITS(/*inav ? 1 :*/ 3, 0) /* fill up */ 790 791 startbuffer[0]=0xD3; 792 startbuffer[1]=(size >> 8); 793 startbuffer[2]=size; 794 unsigned long i = CRC24(size+3, startbuffer); 795 buffer[size++] = i >> 16; 796 buffer[size++] = i >> 8; 797 buffer[size++] = i; 798 size += 3; 799 return size; 800 }
Note:
See TracChangeset
for help on using the changeset viewer.