gnss-js 1.66.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/rtcm3.cjs CHANGED
@@ -29,10 +29,11 @@ __export(rtcm3_exports, {
29
29
  decodeIgsSsr: () => decodeIgsSsr,
30
30
  decodeLegacyObs: () => decodeLegacyObs,
31
31
  decodeMsmFull: () => decodeMsmFull,
32
+ decodeObs: () => decodeObs,
32
33
  decodeSsr: () => decodeSsr,
33
34
  decodeSystemParams: () => decodeSystemParams,
34
35
  isSsrMessage: () => isSsrMessage,
35
- msmEpochToDate: () => msmEpochToDate,
36
+ obsEpochToDate: () => obsEpochToDate,
36
37
  readString: () => readString,
37
38
  reportDecodeError: () => reportDecodeError,
38
39
  resetGloFreqCache: () => resetGloFreqCache,
@@ -88,9 +89,6 @@ var BitReader = class {
88
89
  skip(n) {
89
90
  this.bitPos += n;
90
91
  }
91
- get bitsLeft() {
92
- return this.data.length * 8 - this.bitPos;
93
- }
94
92
  };
95
93
  function crc24q(data, length) {
96
94
  let crc = 0;
@@ -592,7 +590,7 @@ function decodeEphemeris(frame) {
592
590
  }
593
591
  }
594
592
 
595
- // src/rtcm3/igs-ssr.ts
593
+ // src/rtcm3/ssr-common.ts
596
594
  var UPDATE_INTERVAL_S = [
597
595
  1,
598
596
  2,
@@ -611,6 +609,28 @@ var UPDATE_INTERVAL_S = [
611
609
  7200,
612
610
  10800
613
611
  ];
612
+ function ssrUraMm(v) {
613
+ if (v === 0) return null;
614
+ const cls = v >> 3 & 7;
615
+ const val = v & 7;
616
+ return 3 ** cls * (1 + val / 4) - 1;
617
+ }
618
+ function readSsrOrbit(r, sat) {
619
+ sat.iode = r.readU(8);
620
+ sat.deltaRadial = r.readS(22) * 1e-4;
621
+ sat.deltaAlongTrack = r.readS(20) * 4e-4;
622
+ sat.deltaCrossTrack = r.readS(20) * 4e-4;
623
+ sat.dotRadial = r.readS(21) * 1e-6;
624
+ sat.dotAlongTrack = r.readS(19) * 4e-6;
625
+ sat.dotCrossTrack = r.readS(19) * 4e-6;
626
+ }
627
+ function readSsrClock(r, sat) {
628
+ sat.c0 = r.readS(22) * 1e-4;
629
+ sat.c1 = r.readS(21) * 1e-6;
630
+ sat.c2 = r.readS(27) * 2e-8;
631
+ }
632
+
633
+ // src/rtcm3/igs-ssr.ts
614
634
  var SYSTEM_BY_BASE = {
615
635
  20: "G",
616
636
  40: "R",
@@ -634,12 +654,6 @@ function prnFor(system, id) {
634
654
  if (system === "S") return `S${two(19 + id)}`;
635
655
  return `${system}${two(id)}`;
636
656
  }
637
- function ssrUraMm(v) {
638
- if (v === 0) return null;
639
- const cls = v >> 3 & 7;
640
- const val = v & 7;
641
- return 3 ** cls * (1 + val / 4) - 1;
642
- }
643
657
  function decodeIgsSsr(frame) {
644
658
  if (frame.messageType !== 4076) return null;
645
659
  const r = new BitReader(frame.payload);
@@ -666,26 +680,12 @@ function decodeIgsSsr(frame) {
666
680
  mwConsistency = r.readU(1) === 1;
667
681
  }
668
682
  const nsat = r.readU(6);
669
- const readOrbit = (s) => {
670
- s.iode = r.readU(8);
671
- s.deltaRadial = r.readS(22) * 1e-4;
672
- s.deltaAlongTrack = r.readS(20) * 4e-4;
673
- s.deltaCrossTrack = r.readS(20) * 4e-4;
674
- s.dotRadial = r.readS(21) * 1e-6;
675
- s.dotAlongTrack = r.readS(19) * 4e-6;
676
- s.dotCrossTrack = r.readS(19) * 4e-6;
677
- };
678
- const readClock = (s) => {
679
- s.c0 = r.readS(22) * 1e-4;
680
- s.c1 = r.readS(21) * 1e-6;
681
- s.c2 = r.readS(27) * 2e-8;
682
- };
683
683
  const satellites = [];
684
684
  for (let i = 0; i < nsat; i++) {
685
685
  const id = r.readU(6);
686
686
  const sat = { prn: prnFor(system, id) };
687
- if (kind === "orbit" || kind === "combined") readOrbit(sat);
688
- if (kind === "clock" || kind === "combined") readClock(sat);
687
+ if (kind === "orbit" || kind === "combined") readSsrOrbit(r, sat);
688
+ if (kind === "clock" || kind === "combined") readSsrClock(r, sat);
689
689
  else if (kind === "ura")
690
690
  sat.uraMm = ssrUraMm(r.readU(6));
691
691
  else if (kind === "highRateClock")
@@ -778,145 +778,6 @@ function decodeIono(r, version, im) {
778
778
  };
779
779
  }
780
780
 
781
- // src/constants/gnss.ts
782
- var C_LIGHT = 299792458;
783
- var FREQ = {
784
- G: { "1": 157542e4, "2": 12276e5, "5": 117645e4 },
785
- // R bands 4/6 are the CDMA L1OC/L2OC center frequencies
786
- R: { "3": 1202025e3, "4": 1600995e3, "6": 124806e4 },
787
- E: {
788
- "1": 157542e4,
789
- "5": 117645e4,
790
- "6": 127875e4,
791
- "7": 120714e4,
792
- "8": 1191795e3
793
- },
794
- C: {
795
- "1": 157542e4,
796
- "2": 1561098e3,
797
- "5": 117645e4,
798
- "6": 126852e4,
799
- "7": 120714e4
800
- },
801
- J: { "1": 157542e4, "2": 12276e5, "5": 117645e4, "6": 127875e4 },
802
- I: { "5": 117645e4, "9": 2492028e3 },
803
- S: { "1": 157542e4, "5": 117645e4 }
804
- };
805
- var GLO_F1_BASE = 1602e6;
806
- var GLO_F1_STEP = 562500;
807
- var GLO_F2_BASE = 1246e6;
808
- var GLO_F2_STEP = 437500;
809
-
810
- // src/rtcm3/legacy-obs.ts
811
- var PRUNIT_GPS = 299792.458;
812
- var PRUNIT_GLO = 599584.916;
813
- var LAM_GPS_L1 = C_LIGHT / 157542e4;
814
- var LAM_GPS_L2 = C_LIGHT / 12276e5;
815
- var PPR_INVALID = -(2 ** 19);
816
- var PR21_INVALID = -(2 ** 13);
817
- function legacyLockSec(i) {
818
- if (i < 24) return i;
819
- if (i < 48) return 2 * i - 24;
820
- if (i < 72) return 4 * i - 120;
821
- if (i < 96) return 8 * i - 408;
822
- if (i < 120) return 16 * i - 1176;
823
- if (i < 127) return 32 * i - 3096;
824
- return 937;
825
- }
826
- var two2 = (n) => n.toString().padStart(2, "0");
827
- function decodeLegacyObs(frame) {
828
- const type = frame.messageType;
829
- const gps = type >= 1001 && type <= 1004;
830
- const glo = type >= 1009 && type <= 1012;
831
- if (!gps && !glo) return null;
832
- const ext = type === 1002 || type === 1004 || type === 1010 || type === 1012;
833
- const dual = type === 1003 || type === 1004 || type === 1011 || type === 1012;
834
- const system = gps ? "G" : "R";
835
- const r = new BitReader(frame.payload);
836
- r.readU(12);
837
- r.readU(12);
838
- let epochMs;
839
- let nsat;
840
- if (gps) {
841
- epochMs = r.readU(30);
842
- r.readU(1);
843
- nsat = r.readU(5);
844
- r.readU(1);
845
- r.readU(3);
846
- } else {
847
- const tk = r.readU(27);
848
- r.readU(1);
849
- nsat = r.readU(5);
850
- r.readU(1);
851
- r.readU(3);
852
- const gloDow = new Date(Date.now() + 3 * 36e5).getUTCDay();
853
- epochMs = (gloDow << 27 | tk) >>> 0;
854
- }
855
- const observations = [];
856
- for (let s = 0; s < nsat; s++) {
857
- const satId = r.readU(6);
858
- const code1 = r.readU(1);
859
- const freqCh = glo ? r.readU(5) : 0;
860
- const pr1raw = r.readU(gps ? 24 : 25);
861
- const ppr1 = r.readS(20);
862
- const lock1 = r.readU(7);
863
- let amb = 0;
864
- let cnr1 = 0;
865
- if (ext) {
866
- amb = r.readU(gps ? 8 : 7);
867
- cnr1 = r.readU(8);
868
- }
869
- let code2 = 0;
870
- let pr21 = 0;
871
- let ppr2 = 0;
872
- let lock2 = 0;
873
- let cnr2 = 0;
874
- if (dual) {
875
- code2 = r.readU(2);
876
- pr21 = r.readS(14);
877
- ppr2 = r.readS(20);
878
- lock2 = r.readU(7);
879
- if (ext) cnr2 = r.readU(8);
880
- }
881
- if (gps && (satId < 1 || satId > 32)) continue;
882
- if (glo && (satId < 1 || satId > 24)) continue;
883
- const prunit = gps ? PRUNIT_GPS : PRUNIT_GLO;
884
- const pr1 = pr1raw * 0.02 + amb * prunit;
885
- const k = freqCh - 7;
886
- const lamL1 = gps ? LAM_GPS_L1 : C_LIGHT / (GLO_F1_BASE + k * GLO_F1_STEP);
887
- const lamL2 = gps ? LAM_GPS_L2 : C_LIGHT / (GLO_F2_BASE + k * GLO_F2_STEP);
888
- const signals = [];
889
- {
890
- const sig = {
891
- rinexCode: gps ? code1 ? "1W" : "1C" : code1 ? "1P" : "1C",
892
- pseudorange: pr1,
893
- wavelength: lamL1,
894
- lockTime: legacyLockSec(lock1)
895
- };
896
- if (ppr1 !== PPR_INVALID) sig.phase = (pr1 + ppr1 * 5e-4) / lamL1;
897
- if (ext && cnr1 > 0) sig.cn0 = cnr1 * 0.25;
898
- signals.push(sig);
899
- }
900
- if (dual) {
901
- const sig = {
902
- rinexCode: gps ? code2 === 0 ? "2X" : "2W" : code2 === 0 ? "2C" : "2P",
903
- wavelength: lamL2,
904
- lockTime: legacyLockSec(lock2)
905
- };
906
- if (pr21 !== PR21_INVALID) sig.pseudorange = pr1 + pr21 * 0.02;
907
- if (ppr2 !== PPR_INVALID) sig.phase = (pr1 + ppr2 * 5e-4) / lamL2;
908
- if (ext && cnr2 > 0) sig.cn0 = cnr2 * 0.25;
909
- signals.push(sig);
910
- }
911
- observations.push({
912
- prn: `${system}${two2(satId)}`,
913
- system,
914
- signals
915
- });
916
- }
917
- return { messageType: type, epochMs, system, observations };
918
- }
919
-
920
781
  // src/constants/time.ts
921
782
  var MILLISECONDS_IN_WEEK = 6048e5;
922
783
  var MILLISECONDS_IN_SECOND = 1e3;
@@ -1007,6 +868,35 @@ function getGpsLeap(date) {
1007
868
  return leap_seconds - 19;
1008
869
  }
1009
870
 
871
+ // src/constants/gnss.ts
872
+ var C_LIGHT = 299792458;
873
+ var FREQ = {
874
+ G: { "1": 157542e4, "2": 12276e5, "5": 117645e4 },
875
+ // R bands 4/6 are the CDMA L1OC/L2OC center frequencies
876
+ R: { "3": 1202025e3, "4": 1600995e3, "6": 124806e4 },
877
+ E: {
878
+ "1": 157542e4,
879
+ "5": 117645e4,
880
+ "6": 127875e4,
881
+ "7": 120714e4,
882
+ "8": 1191795e3
883
+ },
884
+ C: {
885
+ "1": 157542e4,
886
+ "2": 1561098e3,
887
+ "5": 117645e4,
888
+ "6": 126852e4,
889
+ "7": 120714e4
890
+ },
891
+ J: { "1": 157542e4, "2": 12276e5, "5": 117645e4, "6": 127875e4 },
892
+ I: { "5": 117645e4, "9": 2492028e3 },
893
+ S: { "1": 157542e4, "5": 117645e4 }
894
+ };
895
+ var GLO_F1_BASE = 1602e6;
896
+ var GLO_F1_STEP = 562500;
897
+ var GLO_F2_BASE = 1246e6;
898
+ var GLO_F2_STEP = 437500;
899
+
1010
900
  // src/rtcm3/msm.ts
1011
901
  var GPS_L1 = FREQ.G["1"];
1012
902
  var GPS_L2 = FREQ.G["2"];
@@ -1505,7 +1395,7 @@ function decodeMsmFull(frame) {
1505
1395
  }
1506
1396
  var GPS_EPOCH = START_GPS_TIME.getTime();
1507
1397
  var MS_PER_WEEK = MILLISECONDS_IN_WEEK;
1508
- function msmEpochToDate(sys, epochMs, refTime = /* @__PURE__ */ new Date()) {
1398
+ function obsEpochToDate(sys, epochMs, refTime = /* @__PURE__ */ new Date()) {
1509
1399
  const refMs = refTime.getTime();
1510
1400
  if (sys === "R") {
1511
1401
  const dayOfWeek = epochMs >>> 27 & 7;
@@ -1541,25 +1431,120 @@ function resetGloFreqCache() {
1541
1431
  gloFreqNum.fill(-128);
1542
1432
  }
1543
1433
 
1434
+ // src/rtcm3/legacy-obs.ts
1435
+ var PRUNIT_GPS = 299792.458;
1436
+ var PRUNIT_GLO = 599584.916;
1437
+ var LAM_GPS_L1 = C_LIGHT / 157542e4;
1438
+ var LAM_GPS_L2 = C_LIGHT / 12276e5;
1439
+ var PPR_INVALID = -(2 ** 19);
1440
+ var PR21_INVALID = -(2 ** 13);
1441
+ function legacyLockSec(i) {
1442
+ if (i < 24) return i;
1443
+ if (i < 48) return 2 * i - 24;
1444
+ if (i < 72) return 4 * i - 120;
1445
+ if (i < 96) return 8 * i - 408;
1446
+ if (i < 120) return 16 * i - 1176;
1447
+ if (i < 127) return 32 * i - 3096;
1448
+ return 937;
1449
+ }
1450
+ var two2 = (n) => n.toString().padStart(2, "0");
1451
+ function decodeLegacyObs(frame) {
1452
+ const type = frame.messageType;
1453
+ const gps = type >= 1001 && type <= 1004;
1454
+ const glo = type >= 1009 && type <= 1012;
1455
+ if (!gps && !glo) return null;
1456
+ const ext = type === 1002 || type === 1004 || type === 1010 || type === 1012;
1457
+ const dual = type === 1003 || type === 1004 || type === 1011 || type === 1012;
1458
+ const system = gps ? "G" : "R";
1459
+ const r = new BitReader(frame.payload);
1460
+ r.readU(12);
1461
+ r.readU(12);
1462
+ let epochMs;
1463
+ let nsat;
1464
+ if (gps) {
1465
+ epochMs = r.readU(30);
1466
+ r.readU(1);
1467
+ nsat = r.readU(5);
1468
+ r.readU(1);
1469
+ r.readU(3);
1470
+ } else {
1471
+ const tk = r.readU(27);
1472
+ r.readU(1);
1473
+ nsat = r.readU(5);
1474
+ r.readU(1);
1475
+ r.readU(3);
1476
+ const gloDow = new Date(Date.now() + 3 * 36e5).getUTCDay();
1477
+ epochMs = (gloDow << 27 | tk) >>> 0;
1478
+ }
1479
+ const observations = [];
1480
+ for (let s = 0; s < nsat; s++) {
1481
+ const satId = r.readU(6);
1482
+ const code1 = r.readU(1);
1483
+ const freqCh = glo ? r.readU(5) : 0;
1484
+ const pr1raw = r.readU(gps ? 24 : 25);
1485
+ const ppr1 = r.readS(20);
1486
+ const lock1 = r.readU(7);
1487
+ let amb = 0;
1488
+ let cnr1 = 0;
1489
+ if (ext) {
1490
+ amb = r.readU(gps ? 8 : 7);
1491
+ cnr1 = r.readU(8);
1492
+ }
1493
+ let code2 = 0;
1494
+ let pr21 = 0;
1495
+ let ppr2 = 0;
1496
+ let lock2 = 0;
1497
+ let cnr2 = 0;
1498
+ if (dual) {
1499
+ code2 = r.readU(2);
1500
+ pr21 = r.readS(14);
1501
+ ppr2 = r.readS(20);
1502
+ lock2 = r.readU(7);
1503
+ if (ext) cnr2 = r.readU(8);
1504
+ }
1505
+ if (gps && (satId < 1 || satId > 32)) continue;
1506
+ if (glo && (satId < 1 || satId > 24)) continue;
1507
+ const prunit = gps ? PRUNIT_GPS : PRUNIT_GLO;
1508
+ const pr1 = pr1raw * 0.02 + amb * prunit;
1509
+ const k = freqCh - 7;
1510
+ const lamL1 = gps ? LAM_GPS_L1 : C_LIGHT / (GLO_F1_BASE + k * GLO_F1_STEP);
1511
+ const lamL2 = gps ? LAM_GPS_L2 : C_LIGHT / (GLO_F2_BASE + k * GLO_F2_STEP);
1512
+ const signals = [];
1513
+ {
1514
+ const sig = {
1515
+ rinexCode: gps ? code1 ? "1W" : "1C" : code1 ? "1P" : "1C",
1516
+ pseudorange: pr1,
1517
+ wavelength: lamL1,
1518
+ lockTime: legacyLockSec(lock1)
1519
+ };
1520
+ if (ppr1 !== PPR_INVALID) sig.phase = (pr1 + ppr1 * 5e-4) / lamL1;
1521
+ if (ext && cnr1 > 0) sig.cn0 = cnr1 * 0.25;
1522
+ signals.push(sig);
1523
+ }
1524
+ if (dual) {
1525
+ const sig = {
1526
+ rinexCode: gps ? code2 === 0 ? "2X" : "2W" : code2 === 0 ? "2C" : "2P",
1527
+ wavelength: lamL2,
1528
+ lockTime: legacyLockSec(lock2)
1529
+ };
1530
+ if (pr21 !== PR21_INVALID) sig.pseudorange = pr1 + pr21 * 0.02;
1531
+ if (ppr2 !== PPR_INVALID) sig.phase = (pr1 + ppr2 * 5e-4) / lamL2;
1532
+ if (ext && cnr2 > 0) sig.cn0 = cnr2 * 0.25;
1533
+ signals.push(sig);
1534
+ }
1535
+ observations.push({
1536
+ prn: `${system}${two2(satId)}`,
1537
+ system,
1538
+ signals
1539
+ });
1540
+ }
1541
+ return { messageType: type, epochMs, system, observations };
1542
+ }
1543
+ function decodeObs(frame) {
1544
+ return decodeMsmFull(frame) ?? decodeLegacyObs(frame);
1545
+ }
1546
+
1544
1547
  // src/rtcm3/ssr.ts
1545
- var UPDATE_INTERVAL_S2 = [
1546
- 1,
1547
- 2,
1548
- 5,
1549
- 10,
1550
- 15,
1551
- 30,
1552
- 60,
1553
- 120,
1554
- 240,
1555
- 300,
1556
- 600,
1557
- 900,
1558
- 1800,
1559
- 3600,
1560
- 7200,
1561
- 10800
1562
- ];
1563
1548
  var GPS_SIGNAL = {
1564
1549
  0: "L1 C/A",
1565
1550
  1: "L1 P",
@@ -1594,12 +1579,6 @@ var SSR_KIND = {
1594
1579
  1067: { system: "R", kind: "ura" },
1595
1580
  1068: { system: "R", kind: "highRateClock" }
1596
1581
  };
1597
- function ssrUraMm2(v) {
1598
- if (v === 0) return null;
1599
- const cls = v >> 3 & 7;
1600
- const val = v & 7;
1601
- return 3 ** cls * (1 + val / 4) - 1;
1602
- }
1603
1582
  var two3 = (n) => n.toString().padStart(2, "0");
1604
1583
  function decodeSsr(frame) {
1605
1584
  const spec = SSR_KIND[frame.messageType];
@@ -1609,7 +1588,7 @@ function decodeSsr(frame) {
1609
1588
  const r = new BitReader(frame.payload);
1610
1589
  r.readU(12);
1611
1590
  const epochS = r.readU(gps ? 20 : 17);
1612
- const updateIntervalS = UPDATE_INTERVAL_S2[r.readU(4)];
1591
+ const updateIntervalS = UPDATE_INTERVAL_S[r.readU(4)];
1613
1592
  const multipleMessage = r.readU(1) === 1;
1614
1593
  const hasDatum = kind === "orbit" || kind === "combined";
1615
1594
  const referenceDatum = hasDatum ? r.readU(1) : void 0;
@@ -1619,30 +1598,14 @@ function decodeSsr(frame) {
1619
1598
  const nsat = r.readU(6);
1620
1599
  const sigName = gps ? GPS_SIGNAL : GLO_SIGNAL;
1621
1600
  const satellites = [];
1622
- const readOrbit = (sat) => {
1623
- sat.deltaRadial = r.readS(22) * 1e-4;
1624
- sat.deltaAlongTrack = r.readS(20) * 4e-4;
1625
- sat.deltaCrossTrack = r.readS(20) * 4e-4;
1626
- sat.dotRadial = r.readS(21) * 1e-6;
1627
- sat.dotAlongTrack = r.readS(19) * 4e-6;
1628
- sat.dotCrossTrack = r.readS(19) * 4e-6;
1629
- };
1630
- const readClock = (sat) => {
1631
- sat.c0 = r.readS(22) * 1e-4;
1632
- sat.c1 = r.readS(21) * 1e-6;
1633
- sat.c2 = r.readS(27) * 2e-8;
1634
- };
1635
1601
  for (let i = 0; i < nsat; i++) {
1636
1602
  const satId = gps ? r.readU(6) : r.readU(5);
1637
1603
  const sat = { prn: `${system}${two3(satId)}` };
1638
- if (kind === "orbit" || kind === "combined") {
1639
- sat.iode = r.readU(8);
1640
- readOrbit(sat);
1641
- }
1642
- if (kind === "combined") readClock(sat);
1643
- else if (kind === "clock") readClock(sat);
1604
+ if (kind === "orbit" || kind === "combined") readSsrOrbit(r, sat);
1605
+ if (kind === "combined") readSsrClock(r, sat);
1606
+ else if (kind === "clock") readSsrClock(r, sat);
1644
1607
  else if (kind === "ura")
1645
- sat.uraMm = ssrUraMm2(r.readU(6));
1608
+ sat.uraMm = ssrUraMm(r.readU(6));
1646
1609
  else if (kind === "highRateClock")
1647
1610
  sat.highRateClock = r.readS(22) * 1e-4;
1648
1611
  else if (kind === "codeBias") {
@@ -2010,9 +1973,9 @@ function updateStreamStats(stats, frames, rawBytes) {
2010
1973
  entry.count++;
2011
1974
  entry.lastSeen = now;
2012
1975
  entry.totalBytes += frame.length + 6;
2013
- const msmEpoch = decodeMsmFull(frame);
2014
- if (msmEpoch) {
2015
- for (const obs of msmEpoch.observations) {
1976
+ const obsEpoch = decodeObs(frame);
1977
+ if (obsEpoch) {
1978
+ for (const obs of obsEpoch.observations) {
2016
1979
  const signals = [];
2017
1980
  let bestCn0 = 0;
2018
1981
  for (const sig of obs.signals) {
@@ -2021,7 +1984,7 @@ function updateStreamStats(stats, frames, rawBytes) {
2021
1984
  if (sig.cn0 > bestCn0) bestCn0 = sig.cn0;
2022
1985
  }
2023
1986
  }
2024
- if (signals.length > 0) {
1987
+ if (obs.signals.length > 0) {
2025
1988
  stats.satellites.set(obs.prn, {
2026
1989
  prn: obs.prn,
2027
1990
  system: obs.system,
@@ -2072,10 +2035,11 @@ function updateStreamStats(stats, frames, rawBytes) {
2072
2035
  decodeIgsSsr,
2073
2036
  decodeLegacyObs,
2074
2037
  decodeMsmFull,
2038
+ decodeObs,
2075
2039
  decodeSsr,
2076
2040
  decodeSystemParams,
2077
2041
  isSsrMessage,
2078
- msmEpochToDate,
2042
+ obsEpochToDate,
2079
2043
  readString,
2080
2044
  reportDecodeError,
2081
2045
  resetGloFreqCache,
package/dist/rtcm3.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { b as Rtcm3Frame, E as EphemerisInfo } from './ephemeris-Ohl6NAfw.cjs';
2
- export { B as BitReader, R as Rtcm3DebugHandler, a as Rtcm3Decoder, d as decodeEphemeris, r as readString, c as reportDecodeError, s as setRtcm3DebugHandler } from './ephemeris-Ohl6NAfw.cjs';
1
+ import { b as Rtcm3Frame, E as EphemerisInfo } from './ephemeris-BAnBLLB9.cjs';
2
+ export { B as BitReader, R as Rtcm3DebugHandler, a as Rtcm3Decoder, d as decodeEphemeris, r as readString, c as reportDecodeError, s as setRtcm3DebugHandler } from './ephemeris-BAnBLLB9.cjs';
3
3
 
4
4
  /** One code bias for a specific signal (DF380/DF381 + DF383). */
5
5
  interface SsrCodeBias {
@@ -127,7 +127,7 @@ declare function decodeIgsSsr(frame: Rtcm3Frame): IgsSsrMessage | null;
127
127
  */
128
128
 
129
129
  /** Single signal observation for one satellite */
130
- interface MsmSignal {
130
+ interface ObsSignal {
131
131
  /** RINEX 2-char obs code, e.g. "1C", "5X" */
132
132
  rinexCode: string;
133
133
  /** Pseudorange in meters (undefined if invalid) */
@@ -146,16 +146,20 @@ interface MsmSignal {
146
146
  wavelength: number;
147
147
  }
148
148
  /** All observations for one satellite in one epoch */
149
- interface MsmSatObs {
149
+ interface ObsSatObs {
150
150
  /** PRN string, e.g. "G01", "R15", "E04" */
151
151
  prn: string;
152
152
  /** System letter: G, R, E, C, J, I, S */
153
153
  system: string;
154
154
  /** Signal observations */
155
- signals: MsmSignal[];
155
+ signals: ObsSignal[];
156
156
  }
157
- /** One decoded MSM epoch */
158
- interface MsmEpoch {
157
+ /**
158
+ * One decoded observation epoch. Originally the MSM4–7 output shape, now the
159
+ * neutral shape every RTCM3 obs source fills: MSM (`decodeMsmFull`), legacy
160
+ * 1001–1012 (`decodeLegacyObs`), via the `decodeObs` dispatcher.
161
+ */
162
+ interface ObsEpoch {
159
163
  /** Message type (1074, 1077, etc.) */
160
164
  messageType: number;
161
165
  /** Epoch time as GPS milliseconds of week (or GLONASS day-of-week ms, BDS SOW) */
@@ -163,15 +167,15 @@ interface MsmEpoch {
163
167
  /** System letter */
164
168
  system: string;
165
169
  /** Observations per satellite */
166
- observations: MsmSatObs[];
170
+ observations: ObsSatObs[];
167
171
  }
168
172
  /**
169
173
  * Decode a single RTCM3 MSM4-7 frame into full observations.
170
174
  * Returns null for non-MSM or MSM1-3 frames.
171
175
  */
172
- declare function decodeMsmFull(frame: Rtcm3Frame): MsmEpoch | null;
176
+ declare function decodeMsmFull(frame: Rtcm3Frame): ObsEpoch | null;
173
177
  /**
174
- * Convert MSM epoch timestamp to a Date.
178
+ * Convert an observation epoch timestamp to a Date.
175
179
  * For GPS/Galileo/BDS/QZSS: epochMs is ms of GPS week.
176
180
  * For GLONASS: epochMs is day-of-week × 86400000 + ms of day (UTC+3).
177
181
  *
@@ -185,7 +189,7 @@ declare function decodeMsmFull(frame: Rtcm3Frame): MsmEpoch | null;
185
189
  * 18 s (the current leap-second count) off — a ±14 km per-satellite
186
190
  * range error that scattered live SPP solutions by kilometres.
187
191
  */
188
- declare function msmEpochToDate(sys: string, epochMs: number, refTime?: Date): Date;
192
+ declare function obsEpochToDate(sys: string, epochMs: number, refTime?: Date): Date;
189
193
  /**
190
194
  * Set a GLONASS FDMA frequency number (k = -7..+13) for a slot (1-24),
191
195
  * e.g. from a decoded 1020 ephemeris. MSM4/6 carry no DF419, so without
@@ -199,9 +203,18 @@ declare function resetGloFreqCache(): void;
199
203
 
200
204
  /**
201
205
  * Decode a legacy RTCM3 observation frame (1001–1004 GPS, 1009–1012 GLONASS)
202
- * into an {@link MsmEpoch}, or null for any other message type.
206
+ * into an {@link ObsEpoch}, or null for any other message type.
207
+ */
208
+ declare function decodeLegacyObs(frame: Rtcm3Frame): ObsEpoch | null;
209
+ /**
210
+ * Decode any RTCM3 observation frame into an {@link ObsEpoch}: MSM4–7 first
211
+ * ({@link decodeMsmFull}), then the legacy fixed-layout obs (1001–1004 GPS,
212
+ * 1009–1012 GLONASS) via {@link decodeLegacyObs}. Returns null for any
213
+ * non-observation message. This is the single obs entry point every consumer
214
+ * (stream stats, live SPP/QC/RTK, station monitor) should call, so a new obs
215
+ * source is added here once rather than at every call site.
203
216
  */
204
- declare function decodeLegacyObs(frame: Rtcm3Frame): MsmEpoch | null;
217
+ declare function decodeObs(frame: Rtcm3Frame): ObsEpoch | null;
205
218
 
206
219
  /** One announced message in the station's schedule (DF055/DF056/DF057). */
207
220
  interface SystemParamsMessage {
@@ -287,7 +300,7 @@ interface StreamStats {
287
300
  messageTypes: Map<number, MessageTypeStats>;
288
301
  bytesPerSecond: number;
289
302
  framesPerSecond: number;
290
- /** Per-satellite C/N0 from MSM messages. Key = PRN (e.g. "G01"). */
303
+ /** Per-satellite C/N0 from observation messages. Key = PRN (e.g. "G01"). */
291
304
  satellites: Map<string, SatCn0>;
292
305
  /** Per-satellite ephemeris data. Key = PRN (e.g. "G01"). */
293
306
  ephemerides: Map<string, EphemerisInfo>;
@@ -303,4 +316,4 @@ declare function rtcm3Constellation(msgType: number): string | null;
303
316
  declare function createStreamStats(): StreamStats;
304
317
  declare function updateStreamStats(stats: StreamStats, frames: Rtcm3Frame[], rawBytes: number): void;
305
318
 
306
- export { EphemerisInfo, type IgsSsrIonoLayer, type IgsSsrMessage, type MessageTypeStats, type MsmEpoch, type MsmSatObs, type MsmSignal, RTCM3_MESSAGE_NAMES, Rtcm3Frame, type SatCn0, type SignalCn0, type SsrCodeBias, type SsrKind, type SsrMessage, type SsrPhaseBias, type SsrSatCorrection, type StationMeta, type StreamStats, type SystemParams, type SystemParamsMessage, createStationMeta, createStreamStats, decodeIgsSsr, decodeLegacyObs, decodeMsmFull, decodeSsr, decodeSystemParams, isSsrMessage, msmEpochToDate, resetGloFreqCache, rtcm3Constellation, setGloFreqNumber, updateStationMeta, updateStreamStats };
319
+ export { EphemerisInfo, type IgsSsrIonoLayer, type IgsSsrMessage, type MessageTypeStats, type ObsEpoch, type ObsSatObs, type ObsSignal, RTCM3_MESSAGE_NAMES, Rtcm3Frame, type SatCn0, type SignalCn0, type SsrCodeBias, type SsrKind, type SsrMessage, type SsrPhaseBias, type SsrSatCorrection, type StationMeta, type StreamStats, type SystemParams, type SystemParamsMessage, createStationMeta, createStreamStats, decodeIgsSsr, decodeLegacyObs, decodeMsmFull, decodeObs, decodeSsr, decodeSystemParams, isSsrMessage, obsEpochToDate, resetGloFreqCache, rtcm3Constellation, setGloFreqNumber, updateStationMeta, updateStreamStats };