Changeset 10534 in ntrip
- Timestamp:
- Sep 17, 2024, 4:56:38 PM (2 months ago)
- Location:
- trunk/BNC/src/RTCM3
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/RTCM3/RTCM3Decoder.cpp
r10236 r10534 53 53 #include "bncutils.h" 54 54 #include "bncsettings.h" 55 #include "bnctime.h" 56 #include "crs.h" 55 57 56 58 using namespace std; … … 481 483 sys = 'J'; 482 484 } 483 else if (type >= 1101 && type <= 1 007) {485 else if (type >= 1101 && type <= 1107) { 484 486 sys = 'S'; 485 487 } … … 1730 1732 GETBITSSIGN(z, 38) 1731 1733 _antList.back().zz = z * 1e-4; 1732 if (type == 1006) 1733 { 1734 if (type == 1006) { 1734 1735 double h; 1735 1736 GETBITS(h, 16) … … 1741 1742 return true; 1742 1743 } 1744 1745 // 1746 //////////////////////////////////////////////////////////////////////////// 1747 bool RTCM3Decoder::DecodeServiceCRS(unsigned char* data, int size) { 1748 t_serviceCrs serviceCrs; 1749 int servicecrsnum = -1; 1750 1751 uint64_t numbits = 0, bitfield = 0; 1752 1753 data += 3; // header 1754 size -= 6; // header + crc 1755 1756 SKIPBITS(12) // Message Number 1757 1758 GETBITS(servicecrsnum, 5) 1759 if (servicecrsnum > -1 && servicecrsnum <= 31) { 1760 for(int i = 0; i < servicecrsnum; i++) { 1761 GETBITS(serviceCrs._name[i], 8); 1762 } 1763 serviceCrs._name[servicecrsnum] = 0; 1764 } 1765 if (_serviceCrs.empty() || 1766 (strncmp(_serviceCrs.back()._name, serviceCrs._name, servicecrsnum) != 0)) { 1767 _serviceCrs.push_back(serviceCrs); 1768 GETFLOAT(_serviceCrs.back()._CE, 16, 1/100.0) 1769 _serviceCrs.back().setCoordinateEpochFromCE(); 1770 _serviceCrs.back().print(); 1771 } 1772 return true; 1773 1774 } 1775 1776 // 1777 //////////////////////////////////////////////////////////////////////////// 1778 bool RTCM3Decoder::DecodeRTCMCRS(unsigned char* data, int size) { 1779 1780 t_rtcmCrs rtcmCrs; 1781 int rtcmcrsnum = -1; 1782 1783 uint64_t numbits = 0, bitfield = 0; 1784 1785 data += 3; // header 1786 size -= 6; // header + crc 1787 1788 SKIPBITS(12) // Message Number 1789 GETBITS(rtcmcrsnum, 5) 1790 if (rtcmcrsnum > -1 && rtcmcrsnum <= 31) { 1791 for(int i = 0; i < rtcmcrsnum; i++) { 1792 GETBITS(rtcmCrs._name[i], 8); 1793 } 1794 rtcmCrs._name[rtcmcrsnum] = 0; 1795 } 1796 if (_rtcmCrs.empty() || 1797 (strncmp(_rtcmCrs.back()._name, rtcmCrs._name, rtcmcrsnum) != 0)) { 1798 _rtcmCrs.push_back(rtcmCrs); 1799 1800 GETBITS(_rtcmCrs.back()._anchor, 1) 1801 GETBITS(_rtcmCrs.back()._plateNumber, 5) 1802 1803 int dblinksnum = 0; 1804 GETBITS(dblinksnum, 3) 1805 for (int i = 0; i < dblinksnum; i++) { 1806 int dblinknum = -1; 1807 char dblinkname[31]; 1808 GETBITS(dblinknum, 5) 1809 if (dblinknum > -1 && dblinknum <= 31) { 1810 for(int i = 0; i < dblinknum; i++) { 1811 GETBITS(dblinkname[i], 8); 1812 } 1813 dblinkname[dblinknum] = 0; 1814 _rtcmCrs.back()._databaseLinks.append(QString("%1").arg(dblinkname)); 1815 } 1816 } 1817 _rtcmCrs.back().print(); 1818 } 1819 1820 return true; 1821 } 1822 1823 1824 //////////////////////////////////////////////////////////////////////////// 1825 bool RTCM3Decoder::DecodeHelmertTrafoParameters(unsigned char* data, int size) { 1826 1827 t_helmertPar helmertPar; 1828 int sourcenum = -1; 1829 int targetnum = -1; 1830 1831 uint64_t numbits = 0, bitfield = 0; 1832 data += 3; // header 1833 size -= 6; // header + crc 1834 1835 SKIPBITS(12) // Message Number 1836 GETBITS(sourcenum, 5) 1837 if (sourcenum > -1 && sourcenum <= 31) { 1838 for(int i = 0; i < sourcenum; i++) { 1839 GETBITS(helmertPar._sourceName[i], 8); 1840 } 1841 helmertPar._sourceName[sourcenum] = 0; 1842 } 1843 GETBITS(targetnum, 5) 1844 if (targetnum > -1 && targetnum <= 31) { 1845 for(int i = 0; i < targetnum; i++) { 1846 GETBITS(helmertPar._targetName[i], 8); 1847 } 1848 helmertPar._targetName[targetnum] = 0; 1849 } 1850 GETBITS(helmertPar._sysIdentNum, 8) 1851 GETBITS(helmertPar._utilTrafoMessageIndicator, 10) 1852 int mjd; 1853 GETBITS(mjd, 16) 1854 helmertPar._t0 = mjd + 44244; 1855 1856 // delete old parameter entries if available 1857 if (!_helmertPar.empty()) { 1858 QList<t_helmertPar>::iterator it = _helmertPar.begin(); 1859 while (it != _helmertPar.end()) { 1860 (helmertPar == *it) ? it = _helmertPar.erase(it) : ++it; 1861 } 1862 } 1863 _helmertPar.push_back(helmertPar); 1864 1865 GETFLOATSIGN(_helmertPar.back()._dx, 23, 0.001) 1866 GETFLOATSIGN(_helmertPar.back()._dy, 23, 0.001) 1867 GETFLOATSIGN(_helmertPar.back()._dz, 23, 0.001) 1868 GETFLOATSIGN(_helmertPar.back()._ox, 32, 0.00002) 1869 GETFLOATSIGN(_helmertPar.back()._oy, 32, 0.00002) 1870 GETFLOATSIGN(_helmertPar.back()._oz, 32, 0.00002) 1871 GETFLOATSIGN(_helmertPar.back()._sc, 25, 0.00001) 1872 GETFLOATSIGN(_helmertPar.back()._dxr, 17, 0.00002) 1873 GETFLOATSIGN(_helmertPar.back()._dyr, 17, 0.00002) 1874 GETFLOATSIGN(_helmertPar.back()._dzr, 17, 0.00002) 1875 GETFLOATSIGN(_helmertPar.back()._oxr, 17, 0.0000004) 1876 GETFLOATSIGN(_helmertPar.back()._oyr, 17, 0.0000004) 1877 GETFLOATSIGN(_helmertPar.back()._ozr, 17, 0.0000004) 1878 GETFLOATSIGN(_helmertPar.back()._scr, 14, 0.0000002) 1879 1880 _helmertPar.back().print(); 1881 1882 return true; 1883 } 1884 1743 1885 1744 1886 // … … 1853 1995 DecodeAntennaPosition(_Message, _BlockSize); 1854 1996 break; 1997 case 1300: 1998 DecodeServiceCRS(_Message, _BlockSize); 1999 break; 2000 case 1301: 2001 DecodeHelmertTrafoParameters(_Message, _BlockSize); 2002 break; 2003 case 1302: 2004 case 35: 2005 DecodeRTCMCRS(_Message, _BlockSize); 2006 break; 1855 2007 } 1856 2008 } 1857 2009 } 1858 2010 } 2011 /* 2012 for (int ii = 0; ii < _helmertParList.size(); ii++) { 2013 _helmertParList[ii].print(); 2014 }*/ 1859 2015 return decoded ? success : failure; 1860 2016 } 1861 ;1862 2017 1863 2018 // -
trunk/BNC/src/RTCM3/RTCM3Decoder.h
r9287 r10534 32 32 #include "GPSDecoder.h" 33 33 #include "RTCM3coDecoder.h" 34 #include "crs.h" 34 35 #include "bncrawfile.h" 35 36 #include "ephemeris.h" … … 167 168 */ 168 169 bool DecodeAntennaPosition(unsigned char* buffer, int bufLen); 169 170 /** 171 * Extract service CRS from 1300 RTCM3 messages 172 * @param buffer the buffer containing CRS name and epoch RTCM block 173 * @param bufLen the length of the buffer (the message length including header+crc) 174 * @return <code>true</code> when data block was decodable 175 */ 176 bool DecodeServiceCRS(unsigned char* buffer, int bufLen); 177 /** 178 * Extract Helmert transformation parameters from 1301 RTCM3 messages 179 * @param buffer the buffer containing Helmert transformation parameters RTCM block 180 * @param bufLen the length of the buffer (the message length including header+crc) 181 * @return <code>true</code> when data block was decodable 182 */ 183 bool DecodeHelmertTrafoParameters(unsigned char* buffer, int bufLen); 184 /** 185 * Extract RTCM CRS data from 1302 RTCM3 messages 186 * @param buffer the buffer containing a database link RTCM block 187 * @param bufLen the length of the buffer (the message length including header+crc) 188 * @return <code>true</code> when data block was decodable 189 */ 190 bool DecodeRTCMCRS(unsigned char* buffer, int bufLen); 170 191 /** Current station description, dynamic in case of raw input file handling */ 171 192 QString _staID; … … 197 218 */ 198 219 QList<t_satObs> _CurrentObsList; 220 199 221 }; 200 222 -
trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp
r10527 r10534 98 98 99 99 _ssrCorr = 0; 100 100 101 } 101 102 … … 178 179 struct SsrCorr::PhaseBias phaseBiasSav; 179 180 struct SsrCorr::VTEC vTECSav; 180 memcpy(&clkOrbSav, &_clkOrb, sizeof(clkOrbSav)); // save state181 memcpy(&codeBiasSav, &_codeBias, sizeof(codeBiasSav));182 memcpy(&phaseBiasSav, &_phaseBias, sizeof(phaseBiasSav));183 memcpy(&vTECSav, &_vTEC, sizeof(vTECSav));181 memcpy(&clkOrbSav, &_clkOrb, sizeof(clkOrbSav)); // save state 182 memcpy(&codeBiasSav, &_codeBias, sizeof(codeBiasSav)); 183 memcpy(&phaseBiasSav, &_phaseBias, sizeof(phaseBiasSav)); 184 memcpy(&vTECSav, &_vTEC, sizeof(vTECSav)); 184 185 185 186 int bytesused = 0; … … 205 206 206 207 if (irc == GCOBR_OK || irc == GCOBR_MESSAGEFOLLOWS ) { 207 208 208 setEpochTime(); // sets _lastTime 209 209 … … 554 554 newProviderID[1] = _clkOrb.SSRSolutionID; 555 555 newProviderID[2] = _clkOrb.SSRIOD; 556 QString newProviderIDStr = QString(" [SSR Provider ID: %1 SSR Solution ID: %2 SSR IOD: %3]: ") 557 .arg(newProviderID[0]).arg(newProviderID[1]).arg(newProviderID[2]); 556 558 557 559 bool alreadySet = false; … … 569 571 570 572 if (alreadySet && different) { 571 emit newMessage("RTCM3coDecoder: Provider Changed : "+ _staID.toLatin1(), true);573 emit newMessage("RTCM3coDecoder: Provider Changed " + newProviderIDStr.toLatin1() + _staID.toLatin1(), true); 572 574 emit providerIDChanged(_staID); 573 575 } … … 657 659 } 658 660 else if (epoSecGlo != -1) { 661 QDate date = dateAndTimeFromGPSweek(currentTime.gpsw(), currentTime.gpssec()).date(); 662 if (_type == IGSssr) { 663 if (epoSecGPS != -1 && epoSecGPS != epoSecGlo) {// should be not done in case of an IGS-SSR encoding error => line has to be deleted 664 epoSecGlo = epoSecGlo + gnumleap(date.year(), date.month(), date.day()); 665 } 666 } 659 667 if (_type == RTCMssr) { 660 QDate date = dateAndTimeFromGPSweek(currentTime.gpsw(), currentTime.gpssec()).date();661 668 epoSecGlo = epoSecGlo - 3 * 3600 + gnumleap(date.year(), date.month(), date.day()); 662 669 } … … 673 680 } 674 681 else if (epoSecBds != -1) { 682 if (_type == IGSssr) { 683 if (epoSecGPS != -1 && epoSecGPS != epoSecBds) {// should be not done in case of an IGS-SSR encoding error => line has to be deleted 684 epoSecBds += 14.0; 685 if (epoSecBds > 604800.0) { 686 epoSecBds -= 7.0*24.0*60.0*60.0; 687 } 688 } 689 }// line has to be deleted 675 690 if (_type == RTCMssr) { 676 691 epoSecBds += 14.0; -
trunk/BNC/src/RTCM3/bits.h
r9032 r10534 110 110 } 111 111 112 #define STARTDATA \ 113 size_t ressize=0; \ 114 char *blockstart=0; \ 115 int numbits=0; \ 116 uint64_t bitbuffer=0; 117 118 119 #define STOREBITS \ 120 while(numbits >= 8) { \ 121 if(!size) return 0; \ 122 *(buffer++) = bitbuffer>>(numbits-8); \ 123 numbits -= 8; \ 124 ++ressize; \ 125 --size; \ 126 } 127 128 #define ADDBITS(a, b) { \ 129 bitbuffer = (bitbuffer<<(a))|((b)&((1<<a)-1)); \ 130 numbits += (a); \ 131 STOREBITS \ 132 } 133 134 135 #define INITBLOCK \ 136 numbits = 0; \ 137 blockstart = buffer; \ 138 ADDBITS(8, 0xD3) \ 139 ADDBITS(6, 0) \ 140 ADDBITS(10, 0) 141 142 #define ENDBLOCK \ 143 if(numbits) { ADDBITS((8-numbits), 0) } { \ 144 int len = buffer-blockstart-3; \ 145 blockstart[1] |= len>>8; \ 146 blockstart[2] = len; \ 147 if(len > 1023) \ 148 return 0; \ 149 len = CRC24(len+3, (const unsigned char *) blockstart); \ 150 ADDBITS(24, len) \ 151 } 152 153 #define SCALEADDBITS(a, b, c) ADDBITS(a, (int64_t)(c > 0 ? b*c+0.5 : b*c-0.5)) 154 155 // RTCM3 GPS EPH encoding 156 ////////////////////////////////////////////////////////// 157 #define GPSTOINT(type, value) static_cast<type>(round(value)) 158 159 #define GPSADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \ 160 |(GPSTOINT(long long,b)&((1ULL<<a)-1)); \ 161 numbits += (a); \ 162 while(numbits >= 8) { \ 163 buffer[size++] = bitbuffer>>(numbits-8);numbits -= 8;}} 164 165 #define GPSADDBITSFLOAT(a,b,c) {long long i = GPSTOINT(long long,(b)/(c)); \ 166 GPSADDBITS(a,i)}; 167 168 // RTCM3 GLONASS EPH encoding 169 ////////////////////////////////////////////////////////// 170 #define GLONASSTOINT(type, value) static_cast<type>(round(value)) 171 172 #define GLONASSADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \ 173 |(GLONASSTOINT(long long,b)&((1ULL<<(a))-1)); \ 174 numbits += (a); \ 175 while(numbits >= 8) { \ 176 buffer[size++] = bitbuffer>>(numbits-8);numbits -= 8;}} 177 178 #define GLONASSADDBITSFLOATM(a,b,c) {int s; long long i; \ 179 if(b < 0.0) \ 180 { \ 181 s = 1; \ 182 i = GLONASSTOINT(long long,(-b)/(c)); \ 183 if(!i) s = 0; \ 184 } \ 185 else \ 186 { \ 187 s = 0; \ 188 i = GLONASSTOINT(long long,(b)/(c)); \ 189 } \ 190 GLONASSADDBITS(1,s) \ 191 GLONASSADDBITS(a-1,i)} 192 193 // RTCM3 Galileo EPH encoding 194 ////////////////////////////////////////////////////////// 195 #define GALILEOTOINT(type, value) static_cast<type>(round(value)) 196 197 #define GALILEOADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \ 198 |(GALILEOTOINT(long long,b)&((1LL<<a)-1)); \ 199 numbits += (a); \ 200 while(numbits >= 8) { \ 201 buffer[size++] = bitbuffer>>(numbits-8);numbits -= 8;}} 202 203 #define GALILEOADDBITSFLOAT(a,b,c) {long long i = GALILEOTOINT(long long,(b)/(c)); \ 204 GALILEOADDBITS(a,i)}; 205 206 // RTCM3 BDS EPH encoding 207 ////////////////////////////////////////////////////////// 208 #define BDSTOINT(type, value) static_cast<type>(round(value)) 209 210 #define BDSADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \ 211 |(BDSTOINT(long long,b)&((1ULL<<a)-1)); \ 212 numbits += (a); \ 213 while(numbits >= 8) { \ 214 buffer[size++] = bitbuffer>>(numbits-8);numbits -= 8;}} 215 216 #define BDSADDBITSFLOAT(a,b,c) {long long i = BDSTOINT(long long,(b)/(c)); \ 217 BDSADDBITS(a,i)}; 218 219 // RTCM3 SBAS EPH encoding 220 ////////////////////////////////////////////////////////// 221 #define SBASTOINT(type, value) static_cast<type>(round(value)) 222 #define SBASADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \ 223 |(SBASTOINT(long long,b)&((1ULL<<a)-1)); \ 224 numbits += (a); \ 225 while(numbits >= 8) { \ 226 buffer[size++] = bitbuffer>>(numbits-8);numbits -= 8;}} 227 #define SBASADDBITSFLOAT(a,b,c) {long long i = SBASTOINT(long long,(b)/(c)); \ 228 SBASADDBITS(a,i)}; 229 112 230 #endif /* BITS_H */ -
trunk/BNC/src/RTCM3/ephEncoder.h
r6799 r10534 4 4 #include "ephemeris.h" 5 5 #include "bncutils.h" 6 #include "bits.h" 6 7 7 8 class t_ephEncoder {
Note:
See TracChangeset
for help on using the changeset viewer.