Changeset 10544 in ntrip for trunk/BNC/src/RTCM3/RTCM3Decoder.cpp
- Timestamp:
- Sep 24, 2024, 12:02:48 PM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/RTCM3/RTCM3Decoder.cpp
r10539 r10544 1042 1042 1043 1043 GETBITS(i, 6) 1044 if (i < 1 || i > 63 ) { 1045 #ifdef BNC_DEBUG_BCEP 1046 emit(newMessage(QString("%1: Block %2 (G) PRN# is out of range: %3!") 1047 .arg(_staID) 1048 .arg(1019,4) 1049 .arg(i).toLatin1(), true)); 1050 #endif 1051 return false; 1052 } 1044 1053 eph._prn.set('G', i); 1045 1054 GETBITS(week, 10) 1055 if (week < 0 || week > 1023) { 1056 #ifdef BNC_DEBUG_BCEP 1057 emit(newMessage(QString("%1: Block %2 (%3) WEEK # is out of range: %4!") 1058 .arg(_staID) 1059 .arg(1019,4) 1060 .arg(eph._prn.toString().c_str()) 1061 .arg(week).toLatin1(), true)); 1062 #endif 1063 return false; 1064 } 1046 1065 GETBITS(i, 4) 1047 1066 eph._ura = accuracyFromIndex(i, eph.type()); … … 1051 1070 GETBITS(i, 16) 1052 1071 i <<= 4; 1072 if (i < 0 || i > 604784) { 1073 #ifdef BNC_DEBUG_BCEP 1074 emit(newMessage(QString("%1: Block %2 (%3) TOC is out of range: %4!") 1075 .arg(_staID) 1076 .arg(1019,4) 1077 .arg(eph._prn.toString().c_str()) 1078 .arg(i).toLatin1(), true)); 1079 #endif 1080 return false; 1081 } 1053 1082 eph._TOC.set(i * 1000); 1054 1083 GETFLOATSIGN(eph._clock_driftrate, 8, 1.0 / (double )(1 << 30) / (double )(1 << 25)) … … 1073 1102 GETBITS(i, 16) 1074 1103 i <<= 4; 1104 if (i < 0 || i > 604784) { 1105 #ifdef BNC_DEBUG_BCEP 1106 emit(newMessage(QString("%1: Block %2 (%3) TOE is out of range: %4!") 1107 .arg(_staID) 1108 .arg(1019,4) 1109 .arg(eph._prn.toString().c_str()) 1110 .arg(i).toLatin1(), true)); 1111 #endif 1112 return false; 1113 } 1075 1114 eph._TOEsec = i; 1076 1115 bncTime t; … … 1123 1162 1124 1163 GETBITS(sv, 6) 1164 if (sv < 1 || sv > 63) { 1165 #ifdef BNC_DEBUG_BCEP 1166 emit(newMessage(QString("%1: Block %2 (R): SLOT# is unknown (0) or out of range: %3!") 1167 .arg(_staID) 1168 .arg(1020,4) 1169 .arg(sv).toLatin1(), true)); 1170 #endif 1171 return false; 1172 } 1125 1173 eph._prn.set('R', sv); 1126 1174 1127 1175 GETBITS(i, 5) 1176 if (i < 0 || i > 20) { 1177 #ifdef BNC_DEBUG_BCEP 1178 emit(newMessage(QString("%1: Block %2 (%3): FRQ CHN# is out of range: %4") 1179 .arg(_staID) 1180 .arg(1020,4) 1181 .arg(eph._prn.toString().c_str()) 1182 .arg(i).toLatin1(), true)); 1183 #endif 1184 return false; 1185 } 1128 1186 eph._frequency_number = i - 7; 1129 1187 GETBITS(eph._almanac_health, 1) /* almanac healthy */ 1130 1188 GETBITS(eph._almanac_health_availablility_indicator, 1) /* almanac health ok */ 1131 /*1132 if (eph._almanac_health_availablility_indicator == 0.0) {1133 #ifdef BNC_DEBUG_BCEP1134 emit(newMessage(QString("%1: Block %2 (%3): ALM = %4: missing data!")1135 .arg(_staID).arg(1020,4).arg(eph._prn.toString().c_str())1136 .arg(eph._almanac_health_availablility_indicator).toLatin1(), true));1137 #endif1138 return false;1139 }1140 */1141 1189 GETBITS(eph._P1, 2) /* P1 */ 1142 1190 GETBITS(i, 5) 1191 if (i < 0 || i > 23) { 1192 #ifdef BNC_DEBUG_BCEP 1193 emit(newMessage(QString("%1: Block %2 (%3): T_k (bits 11-7) is out of range: %4") 1194 .arg(_staID) 1195 .arg(1020,4) 1196 .arg(eph._prn.toString().c_str()) 1197 .arg(i).toLatin1(), true)); 1198 #endif 1199 return false; 1200 } 1143 1201 tk = i * 60 * 60; 1144 1202 GETBITS(i, 6) 1203 if (i < 0 || i > 59) { 1204 #ifdef BNC_DEBUG_BCEP 1205 emit(newMessage(QString("%1: Block %2 (%3): T_k (bits 6-1) is out of range: %4") 1206 .arg(_staID) 1207 .arg(1020,4) 1208 .arg(eph._prn.toString().c_str()) 1209 .arg(i).toLatin1(), true)); 1210 #endif 1211 return false; 1212 } 1145 1213 tk += i * 60; 1146 1214 GETBITS(i, 1) 1215 if (i < 0 || i > 1) { 1216 #ifdef BNC_DEBUG_BCEP 1217 emit(newMessage(QString("%1: Block %2 (%3): T_k (bit 0) is out of range: %4") 1218 .arg(_staID) 1219 .arg(1020,4) 1220 .arg(eph._prn.toString().c_str()) 1221 .arg(i).toLatin1(), true)); 1222 #endif 1223 return false; 1224 } 1147 1225 tk += i * 30; 1148 1226 eph._tki = tk - 3*60*60; … … 1153 1231 GETBITS(eph._P2, 1) /* P2 */ 1154 1232 GETBITS(i, 7) 1155 eph._TOC.setTk(i * 15 * 60 * 1000); /* tb */ 1233 i *= 15; 1234 if (i < 15 || i > 1425) { 1235 #ifdef BNC_DEBUG_BCEP 1236 emit(newMessage(QString("%1: Block %2 (%3): T_b is out of range: %4") 1237 .arg(_staID) 1238 .arg(1020,4) 1239 .arg(eph._prn.toString().c_str()) 1240 .arg(i).toLatin1(), true)); 1241 #endif 1242 return false; 1243 } 1244 eph._TOC.setTk(i * 60 * 1000); /* tb */ 1156 1245 1157 1246 GETFLOATSIGNM(eph._x_velocity, 24, 1.0 / (double )(1 << 20)) … … 1252 1341 1253 1342 GETBITS(i, 4) 1343 if (i < 1 || i > 10 ) { 1344 #ifdef BNC_DEBUG_BCEP 1345 emit(newMessage(QString("%1: Block %2 (J) SAT ID is out of range: %3!") 1346 .arg(_staID) 1347 .arg(1044,4) 1348 .arg(i).toLatin1(), true)); 1349 #endif 1350 return false; 1351 } 1254 1352 eph._prn.set('J', i); 1255 1353 1256 1354 GETBITS(i, 16) 1257 1355 i <<= 4; 1356 if (i < 0 || i > 604784) { 1357 #ifdef BNC_DEBUG_BCEP 1358 emit(newMessage(QString("%1: Block %2 (%3) TOC is out of range: %4!") 1359 .arg(_staID) 1360 .arg(1044,4) 1361 .arg(eph._prn.toString().c_str()) 1362 .arg(i).toLatin1(), true)); 1363 #endif 1364 return false; 1365 } 1258 1366 eph._TOC.set(i * 1000); 1259 1367 … … 1279 1387 GETBITS(i, 16) 1280 1388 i <<= 4; 1389 if (i < 0 || i > 604784) { 1390 #ifdef BNC_DEBUG_BCEP 1391 emit(newMessage(QString("%1: Block %2 (%3) TOE is out of range: %4!") 1392 .arg(_staID) 1393 .arg(1044,4) 1394 .arg(eph._prn.toString().c_str()) 1395 .arg(i).toLatin1(), true)); 1396 #endif 1397 return false; 1398 } 1281 1399 eph._TOEsec = i; 1282 1400 bncTime t; … … 1293 1411 GETBITS(eph._L2Codes, 2) 1294 1412 GETBITS(week, 10) 1413 if (week < 0 || week > 1023) { 1414 #ifdef BNC_DEBUG_BCEP 1415 emit(newMessage(QString("%1: Block %2 (%3) WEEK # is out of range: %4!") 1416 .arg(_staID) 1417 .arg(1044,4) 1418 .arg(eph._prn.toString().c_str()) 1419 .arg(week).toLatin1(), true)); 1420 #endif 1421 return false; 1422 } 1295 1423 int numOfRollOvers = int(floor(t.gpsw()/1024.0)); 1296 1424 week += (numOfRollOvers * 1024); … … 1336 1464 1337 1465 GETBITS(i, 6) 1466 if (i < 1 || i > 63 ) { 1467 #ifdef BNC_DEBUG_BCEP 1468 emit(newMessage(QString("%1: Block %2 (I) PRN# is out of range: %3!") 1469 .arg(_staID) 1470 .arg(1041,4) 1471 .arg(i).toLatin1(), true)); 1472 #endif 1473 return false; 1474 } 1338 1475 eph._prn.set('I', i); 1339 1476 GETBITS(week, 10) 1477 if (week < 0 || week > 1023) { 1478 #ifdef BNC_DEBUG_BCEP 1479 emit(newMessage(QString("%1: Block %2 (%3) WEEK # is out of range: %4!") 1480 .arg(_staID) 1481 .arg(1041,4) 1482 .arg(eph._prn.toString().c_str()) 1483 .arg(week).toLatin1(), true)); 1484 #endif 1485 return false; 1486 } 1340 1487 GETFLOATSIGN(eph._clock_bias, 22, 1.0 / (double )(1 << 30) / (double )(1 << 1)) 1341 1488 GETFLOATSIGN(eph._clock_drift, 16, 1.0 / (double )(1 << 30) / (double )(1 << 13)) … … 1345 1492 GETBITS(i, 16) 1346 1493 i <<= 4; 1494 if (i < 0 || i > 1048560) { 1495 #ifdef BNC_DEBUG_BCEP 1496 emit(newMessage(QString("%1: Block %2 (%3) TOC is out of range: %4!") 1497 .arg(_staID) 1498 .arg(1041,4) 1499 .arg(eph._prn.toString().c_str()) 1500 .arg(i).toLatin1(), true)); 1501 #endif 1502 return false; 1503 } 1347 1504 eph._TOC.set(i * 1000); 1348 1505 GETFLOATSIGN(eph._TGD, 8, 1.0 / (double )(1 << 30) / (double )(1 << 1)) … … 1377 1534 GETBITS(i, 16) 1378 1535 i <<= 4; 1536 if (i < 0 || i > 1048560) { 1537 #ifdef BNC_DEBUG_BCEP 1538 emit(newMessage(QString("%1: Block %2 (%3) TOE is out of range: %4!") 1539 .arg(_staID) 1540 .arg(1041,4) 1541 .arg(eph._prn.toString().c_str()) 1542 .arg(i).toLatin1(), true)); 1543 #endif 1544 return false; 1545 } 1379 1546 eph._TOEsec = i; 1380 1547 bncTime t; … … 1428 1595 1429 1596 GETBITS(i, 6) 1430 eph._prn.set('S', 20 + i); 1597 if (i < 40 || i > 58 ) { 1598 #ifdef BNC_DEBUG_BCEP 1599 emit(newMessage(QString("%1: Block %2 (S) PRN# is out of range: %3!") 1600 .arg(_staID) 1601 .arg(1043,4) 1602 .arg(i).toLatin1(), true)); 1603 #endif 1604 return false; 1605 } 1606 eph._prn.set('S', 80 + i); 1431 1607 GETBITS(eph._IODN, 8) 1432 1608 GETBITS(i, 13) 1433 1609 i <<= 4; 1610 if (i < 0 || i > 86384) { 1611 #ifdef BNC_DEBUG_BCEP 1612 emit(newMessage(QString("%1: Block %2 (%3) TOC is out of range: %4!") 1613 .arg(_staID) 1614 .arg(1043,4) 1615 .arg(eph._prn.toString().c_str()) 1616 .arg(i).toLatin1(), true)); 1617 #endif 1618 return false; 1619 } 1434 1620 eph._TOC.setTOD(i * 1000); 1435 1621 GETBITS(i, 4) … … 1471 1657 bool decoded = false; 1472 1658 uint64_t numbits = 0, bitfield = 0; 1473 int i ;1659 int i, week, mnum; 1474 1660 1475 1661 data += 3; /* header */ … … 1479 1665 if ((i == 1046 && size == 61) || (i == 1045 && size == 60)) { 1480 1666 t_ephGal eph; 1481 1482 1667 eph._receptDateTime = currentDateAndTimeGPS(); 1483 1668 eph._receptStaID = _staID; … … 1485 1670 eph._inav = (i == 1046); 1486 1671 eph._fnav = (i == 1045); 1672 mnum = i; 1487 1673 GETBITS(i, 6) 1674 if (i < 1 || i > 36 ) { // max. constellation within I/NAV / F/NAV frames is 36 1675 #ifdef BNC_DEBUG_BCEP 1676 emit(newMessage(QString("%1: Block %2 (E) PRN# is out of range: %3!") 1677 .arg(_staID) 1678 .arg(mnum,4) 1679 .arg(i).toLatin1(), true)); 1680 #endif 1681 return false; 1682 } 1488 1683 eph._prn.set('E', i, eph._inav ? 1 : 0); 1489 1684 1490 GETBITS(eph._TOEweek, 12) //FIXME: roll-over after week 4095!! 1685 GETBITS(week, 12) //FIXME: roll-over after week 4095!! 1686 if (week < 0 || week > 4095) { 1687 #ifdef BNC_DEBUG_BCEP 1688 emit(newMessage(QString("%1: Block %2 (%3) WEEK # is out of range: %4!") 1689 .arg(_staID) 1690 .arg(mnum,4) 1691 .arg(eph._prn.toString().c_str()) 1692 .arg(week).toLatin1(), true)); 1693 #endif 1694 return false; 1695 } 1696 eph._TOEweek = week; 1491 1697 GETBITS(eph._IODnav, 10) 1492 1698 GETBITS(i, 8) … … 1494 1700 GETFLOATSIGN(eph._IDOT, 14, R2R_PI/(double)(1<<30)/(double)(1<<13)) 1495 1701 GETBITSFACTOR(i, 14, 60) 1496 eph._TOC.set(1024 + eph._TOEweek, i); 1702 if (i < 0 || i > 604740) { 1703 #ifdef BNC_DEBUG_BCEP 1704 emit(newMessage(QString("%1: Block %2 (%3) TOC is out of range: %4!") 1705 .arg(_staID) 1706 .arg(mnum,4) 1707 .arg(eph._prn.toString().c_str()) 1708 .arg(i).toLatin1(), true)); 1709 #endif 1710 return false; 1711 } 1712 eph._TOC.set(1024 + eph._TOEweek, i);// Period #2 = + 1 x 1024 (has to be determined) 1497 1713 GETFLOATSIGN(eph._clock_driftrate, 6, 1.0 / (double )(1 << 30) / (double )(1 << 29)) 1498 1714 GETFLOATSIGN(eph._clock_drift, 21, 1.0 / (double )(1 << 30) / (double )(1 << 16)) … … 1506 1722 GETFLOAT(eph._sqrt_A, 32, 1.0 / (double )(1 << 19)) 1507 1723 GETBITSFACTOR(eph._TOEsec, 14, 60) 1724 if (i < 0 || i > 604740) { 1725 #ifdef BNC_DEBUG_BCEP 1726 emit(newMessage(QString("%1: Block %2 (%3) TOE is out of range: %4!") 1727 .arg(_staID) 1728 .arg(mnum,4) 1729 .arg(eph._prn.toString().c_str()) 1730 .arg(i).toLatin1(), true)); 1731 #endif 1732 return false; 1733 } 1508 1734 /* FIXME: overwrite value, copied from old code */ 1509 1735 eph._TOEsec = eph._TOC.gpssec(); … … 1582 1808 if (size == 70) { 1583 1809 t_ephBDS eph; 1584 int i ;1810 int i, week; 1585 1811 uint64_t numbits = 0, bitfield = 0; 1586 1812 … … 1593 1819 1594 1820 GETBITS(i, 6) 1821 if (i < 1 || i > 63 ) { 1822 #ifdef BNC_DEBUG_BCEP 1823 emit(newMessage(QString("%1: Block %2 (C) PRN# is out of range: %3!") 1824 .arg(_staID) 1825 .arg(1042,4) 1826 .arg(i).toLatin1(), true)); 1827 #endif 1828 return false; 1829 } 1595 1830 eph._prn.set('C', i); 1596 1831 1597 GETBITS(eph._BDTweek, 13) 1832 GETBITS(week, 13) 1833 if (week < 0 || week > 8191) { 1834 #ifdef BNC_DEBUG_BCEP 1835 emit(newMessage(QString("%1: Block %2 (%3) WEEK # is out of range: %4!") 1836 .arg(_staID) 1837 .arg(1042,4) 1838 .arg(eph._prn.toString().c_str()) 1839 .arg(week).toLatin1(), true)); 1840 #endif 1841 return false; 1842 } 1843 eph._BDTweek = week; 1598 1844 GETBITS(i, 4) 1599 1845 eph._URA = accuracyFromIndex(i, eph.type()); … … 1602 1848 GETBITS(i, 17) 1603 1849 i <<= 3; 1850 if (i < 0 || i > 604792) { 1851 #ifdef BNC_DEBUG_BCEP 1852 emit(newMessage(QString("%1: Block %2 (%3) TOC is out of range: %4!") 1853 .arg(_staID) 1854 .arg(1042,4) 1855 .arg(eph._prn.toString().c_str()) 1856 .arg(i).toLatin1(), true)); 1857 #endif 1858 return false; 1859 } 1604 1860 eph._TOC.setBDS(eph._BDTweek, i); 1605 1861 GETFLOATSIGN(eph._clock_driftrate, 11, 1.0 / (double )(1 << 30) / (double )(1 << 30) / (double )(1 << 6)) … … 1624 1880 GETBITS(i, 17) 1625 1881 i <<= 3; 1882 if (i < 0 || i > 604792) { 1883 #ifdef BNC_DEBUG_BCEP 1884 emit(newMessage(QString("%1: Block %2 (%3) TOE is out of range: %4!") 1885 .arg(_staID) 1886 .arg(1042,4) 1887 .arg(eph._prn.toString().c_str()) 1888 .arg(i).toLatin1(), true)); 1889 #endif 1890 return false; 1891 } 1626 1892 eph._TOEsec = i; 1627 1893 eph._TOE.setBDS(eph._BDTweek, i); … … 2082 2348 _coDecoders.begin().value()->corrGPSEpochTime() : -1; 2083 2349 } 2350 2351 2352 2353
Note:
See TracChangeset
for help on using the changeset viewer.