gnss-js 1.65.0 → 1.66.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.
@@ -6,7 +6,7 @@ import {
6
6
  computeSatPosition,
7
7
  ecefToAzEl,
8
8
  selectEphemeris
9
- } from "./chunk-MHGNKSSH.js";
9
+ } from "./chunk-JYWYQ7DW.js";
10
10
  import {
11
11
  ecefToGeodetic,
12
12
  getAer,
@@ -5,7 +5,7 @@ import {
5
5
  bdsSubframeParityOk,
6
6
  galInavPageCrcOk,
7
7
  testGloString
8
- } from "./chunk-FA2UTLEQ.js";
8
+ } from "./chunk-3KSDL3CO.js";
9
9
  import {
10
10
  decodeSbasGeoNav,
11
11
  sbasCrcOk
@@ -0,0 +1,269 @@
1
+ // src/rtcm2/index.ts
2
+ var RTCM2_PREAMBLE = 102;
3
+ var HAMMING = [
4
+ 3139384448,
5
+ 1569692224,
6
+ 2932329728,
7
+ 1466164864,
8
+ 1806824256,
9
+ 2340063680
10
+ ];
11
+ function getbitu(buff, pos, len) {
12
+ let v = 0;
13
+ for (let i = pos; i < pos + len; i++)
14
+ v = v * 2 + (buff[i >> 3] >> 7 - (i & 7) & 1);
15
+ return v >>> 0;
16
+ }
17
+ function getbits(buff, pos, len) {
18
+ const v = getbitu(buff, pos, len);
19
+ return v & 1 << len - 1 ? v - 2 ** len : v;
20
+ }
21
+ function decodeWord(w) {
22
+ let word = w >>> 0;
23
+ if (word & 1073741824) word = (word ^ 1073741760) >>> 0;
24
+ let parity = 0;
25
+ for (let i = 0; i < 6; i++) {
26
+ parity <<= 1;
27
+ let x = (word & HAMMING[i]) >>> 6;
28
+ while (x) {
29
+ parity ^= x & 1;
30
+ x >>>= 1;
31
+ }
32
+ }
33
+ if (parity >>> 0 !== (word & 63)) return null;
34
+ return [word >>> 22 & 255, word >>> 14 & 255, word >>> 6 & 255];
35
+ }
36
+ var Rtcm2Decoder = class {
37
+ word = 0;
38
+ nbyte = 0;
39
+ nbit = 0;
40
+ len = 0;
41
+ buff = new Uint8Array(256);
42
+ /** Reset the framer (e.g. after a stream reconnect). */
43
+ reset() {
44
+ this.word = 0;
45
+ this.nbyte = 0;
46
+ this.nbit = 0;
47
+ this.len = 0;
48
+ }
49
+ decode(bytes) {
50
+ const frames = [];
51
+ for (const raw of bytes) {
52
+ if ((raw & 192) !== 64) continue;
53
+ let data = raw;
54
+ for (let i = 0; i < 6; i++, data >>= 1) {
55
+ this.word = (this.word << 1 | data & 1) >>> 0;
56
+ if (this.nbyte === 0) {
57
+ let preamb = this.word >>> 22 & 255;
58
+ if (this.word & 1073741824) preamb ^= 255;
59
+ if (preamb !== RTCM2_PREAMBLE) continue;
60
+ const d2 = decodeWord(this.word);
61
+ if (!d2) continue;
62
+ this.buff[0] = d2[0];
63
+ this.buff[1] = d2[1];
64
+ this.buff[2] = d2[2];
65
+ this.nbyte = 3;
66
+ this.nbit = 0;
67
+ continue;
68
+ }
69
+ if (++this.nbit < 30) continue;
70
+ this.nbit = 0;
71
+ const d = decodeWord(this.word);
72
+ if (!d) {
73
+ this.nbyte = 0;
74
+ this.word &= 3;
75
+ continue;
76
+ }
77
+ this.buff[this.nbyte] = d[0];
78
+ this.buff[this.nbyte + 1] = d[1];
79
+ this.buff[this.nbyte + 2] = d[2];
80
+ this.nbyte += 3;
81
+ if (this.nbyte === 6) this.len = (this.buff[5] >> 3) * 3 + 6;
82
+ if (this.nbyte < this.len) continue;
83
+ frames.push(this.readHeader(this.buff.slice(0, this.len)));
84
+ this.nbyte = 0;
85
+ this.word &= 3;
86
+ }
87
+ }
88
+ return frames;
89
+ }
90
+ readHeader(payload) {
91
+ return {
92
+ messageType: getbitu(payload, 8, 6),
93
+ stationId: getbitu(payload, 14, 10),
94
+ zcountSec: getbitu(payload, 24, 13) * 0.6,
95
+ sequenceNo: getbitu(payload, 37, 3),
96
+ lengthWords: payload[5] >> 3,
97
+ health: getbitu(payload, 45, 3),
98
+ payload
99
+ };
100
+ }
101
+ };
102
+ function rtcm2Station(frame) {
103
+ const p = frame.payload;
104
+ const nbit = frame.lengthWords * 24;
105
+ if (frame.messageType === 3) {
106
+ if (nbit < 96) return null;
107
+ return {
108
+ position: [
109
+ getbits(p, 48, 32) * 0.01,
110
+ getbits(p, 80, 32) * 0.01,
111
+ getbits(p, 112, 32) * 0.01
112
+ ]
113
+ };
114
+ }
115
+ if (frame.messageType === 22) {
116
+ if (nbit < 24) return null;
117
+ const l1 = [
118
+ getbits(p, 48, 8) / 25600,
119
+ getbits(p, 56, 8) / 25600,
120
+ getbits(p, 64, 8) / 25600
121
+ ];
122
+ let height;
123
+ if (nbit >= 48) {
124
+ const noh = getbits(p, 48 + 24 + 5, 1);
125
+ height = noh ? 0 : getbitu(p, 48 + 24 + 6, 18) / 25600;
126
+ }
127
+ return { l1Offset: l1, height };
128
+ }
129
+ return null;
130
+ }
131
+ function rtcm2Observation(frame) {
132
+ const t = frame.messageType;
133
+ if (t !== 18 && t !== 19) return null;
134
+ const p = frame.payload;
135
+ const nbit = frame.lengthWords * 24 + 48;
136
+ let i = 48;
137
+ if (i + 24 > nbit) return null;
138
+ const fRaw = getbitu(p, i, 2);
139
+ i += 4;
140
+ const microSec = getbitu(p, i, 20);
141
+ i += 20;
142
+ if (fRaw & 1) return null;
143
+ const freq = fRaw >> 1;
144
+ let sync = false;
145
+ const records = [];
146
+ while (i + 48 <= nbit) {
147
+ sync = getbitu(p, i, 1) === 1;
148
+ i += 1;
149
+ const code = getbitu(p, i, 1);
150
+ i += 1;
151
+ const sys = getbitu(p, i, 1);
152
+ i += 1;
153
+ let prn = getbitu(p, i, 5);
154
+ i += 5;
155
+ let loss;
156
+ if (t === 18) {
157
+ i += 3;
158
+ loss = getbitu(p, i, 5);
159
+ i += 5;
160
+ } else {
161
+ i += 8;
162
+ }
163
+ const val = t === 18 ? getbits(p, i, 32) : getbitu(p, i, 32);
164
+ i += 32;
165
+ if (prn === 0) prn = 32;
166
+ const system = sys ? "R" : "G";
167
+ const rec = {
168
+ prn: `${system}${String(prn).padStart(2, "0")}`,
169
+ system,
170
+ freq,
171
+ code: code ? "P" : "C/A",
172
+ lossOfLock: loss
173
+ };
174
+ if (t === 18)
175
+ rec.phaseCycles = -val / 256;
176
+ else rec.pseudorangeM = val * 0.02;
177
+ records.push(rec);
178
+ }
179
+ return { freq, sync, microSec, records };
180
+ }
181
+ function rtcm2Dgps(frame) {
182
+ const t = frame.messageType;
183
+ if (t !== 1 && t !== 9 && t !== 31) return null;
184
+ const system = t === 31 ? "R" : "G";
185
+ const p = frame.payload;
186
+ const nbit = frame.lengthWords * 24 + 48;
187
+ let i = 48;
188
+ const corrections = [];
189
+ while (i + 40 <= nbit) {
190
+ const fact = getbitu(p, i, 1);
191
+ i += 1;
192
+ const udre = getbitu(p, i, 2);
193
+ i += 2;
194
+ let prn = getbitu(p, i, 5);
195
+ i += 5;
196
+ const prc = getbits(p, i, 16);
197
+ i += 16;
198
+ const rrc = getbits(p, i, 8);
199
+ i += 8;
200
+ const iod = getbits(p, i, 8);
201
+ i += 8;
202
+ if (prn === 0) prn = 32;
203
+ corrections.push({
204
+ prn: `${system}${String(prn).padStart(2, "0")}`,
205
+ prc: prc * (fact ? 0.32 : 0.02),
206
+ rrc: rrc * (fact ? 0.032 : 2e-3),
207
+ iod,
208
+ udre
209
+ });
210
+ }
211
+ return { system, corrections };
212
+ }
213
+ function rtcm2Time(frame) {
214
+ if (frame.messageType !== 14) return null;
215
+ const p = frame.payload;
216
+ if (frame.lengthWords * 24 < 24) return null;
217
+ return {
218
+ zcountSec: getbitu(p, 24, 13) * 0.6,
219
+ week: getbitu(p, 48, 10),
220
+ hour: getbitu(p, 58, 8),
221
+ leapSeconds: getbitu(p, 66, 6)
222
+ };
223
+ }
224
+ function rtcm2Text(frame) {
225
+ if (frame.messageType !== 16) return null;
226
+ const p = frame.payload;
227
+ const nbit = frame.lengthWords * 24 + 48;
228
+ let s = "";
229
+ for (let i = 48; i + 8 <= nbit; i += 8) {
230
+ const c = getbitu(p, i, 8);
231
+ if (c === 0) break;
232
+ s += String.fromCharCode(c);
233
+ }
234
+ return s;
235
+ }
236
+ var RTCM2_MESSAGE_NAMES = {
237
+ 1: "GPS differential corrections",
238
+ 3: "Reference station parameters (ARP)",
239
+ 9: "GPS partial correction set",
240
+ 14: "GPS time of week",
241
+ 16: "GPS special message (text)",
242
+ 17: "GPS ephemerides",
243
+ 18: "RTK uncorrected carrier phase",
244
+ 19: "RTK uncorrected pseudorange",
245
+ 22: "Extended reference station parameters",
246
+ 23: "Antenna type definition",
247
+ 24: "Antenna reference point (ARP)",
248
+ 31: "GLONASS differential corrections",
249
+ 32: "GLONASS reference station parameters",
250
+ 34: "GLONASS partial correction set",
251
+ 36: "GLONASS special message"
252
+ };
253
+ function looksLikeRtcm2(bytes) {
254
+ const n = Math.min(bytes.length, 4096);
255
+ if (n < 12) return false;
256
+ for (let i = 0; i < n; i++) if ((bytes[i] & 192) !== 64) return false;
257
+ return new Rtcm2Decoder().decode(bytes.subarray(0, n)).length >= 2;
258
+ }
259
+
260
+ export {
261
+ Rtcm2Decoder,
262
+ rtcm2Station,
263
+ rtcm2Observation,
264
+ rtcm2Dgps,
265
+ rtcm2Time,
266
+ rtcm2Text,
267
+ RTCM2_MESSAGE_NAMES,
268
+ looksLikeRtcm2
269
+ };
@@ -7,11 +7,14 @@ import {
7
7
  galFnavPageCrcOk,
8
8
  galInavPageCrcOk,
9
9
  testGloString
10
- } from "./chunk-FA2UTLEQ.js";
10
+ } from "./chunk-3KSDL3CO.js";
11
11
  import {
12
12
  decodeSbasGeoNav,
13
13
  sbasCrcOk
14
14
  } from "./chunk-WQX354KD.js";
15
+ import {
16
+ getGpsLeap
17
+ } from "./chunk-HVXYFUCB.js";
15
18
  import {
16
19
  geodeticToEcef
17
20
  } from "./chunk-37QNKGTC.js";
@@ -26,9 +29,6 @@ import {
26
29
  getBitU,
27
30
  setBitU
28
31
  } from "./chunk-V2D5KUKH.js";
29
- import {
30
- getGpsLeap
31
- } from "./chunk-HVXYFUCB.js";
32
32
 
33
33
  // src/sbf/frame.ts
34
34
  var CRC_TABLE = (() => {
package/dist/constants.js CHANGED
@@ -1,10 +1,4 @@
1
1
  import "./chunk-5S5MONFK.js";
2
- import {
3
- WGS84_ECCENTRICITY_SQUARED,
4
- WGS84_FLATTENING,
5
- WGS84_SEMI_MAJOR_AXIS,
6
- WGS84_SEMI_MINOR_AXIS
7
- } from "./chunk-6FAL6P4G.js";
8
2
  import {
9
3
  DAYS_MJD2000_MJD,
10
4
  DAYS_MJD_JULIAN,
@@ -30,6 +24,12 @@ import {
30
24
  START_TAI_TIME,
31
25
  START_UNIX_TIME
32
26
  } from "./chunk-LEEU5OIO.js";
27
+ import {
28
+ WGS84_ECCENTRICITY_SQUARED,
29
+ WGS84_FLATTENING,
30
+ WGS84_SEMI_MAJOR_AXIS,
31
+ WGS84_SEMI_MINOR_AXIS
32
+ } from "./chunk-6FAL6P4G.js";
33
33
  import {
34
34
  ARC_GAP_FACTOR,
35
35
  BAND_LABELS,
package/dist/index.cjs CHANGED
@@ -81,7 +81,9 @@ __export(src_exports, {
81
81
  OMEGA_E: () => OMEGA_E,
82
82
  REFERENCE_FRAMES: () => REFERENCE_FRAMES,
83
83
  RINEX_CODES: () => RINEX_CODES,
84
+ RTCM2_MESSAGE_NAMES: () => RTCM2_MESSAGE_NAMES,
84
85
  RTCM3_MESSAGE_NAMES: () => RTCM3_MESSAGE_NAMES,
86
+ Rtcm2Decoder: () => Rtcm2Decoder,
85
87
  Rtcm3Decoder: () => Rtcm3Decoder,
86
88
  RtkFloatEngine: () => RtkFloatEngine,
87
89
  SBAS_L5_MT_NAMES: () => SBAS_L5_MT_NAMES,
@@ -247,6 +249,7 @@ __export(src_exports, {
247
249
  klobucharDelay: () => klobucharDelay,
248
250
  lambdaReduction: () => lambdaReduction,
249
251
  lambdaSearch: () => lambdaSearch,
252
+ looksLikeRtcm2: () => looksLikeRtcm2,
250
253
  maskRadForAzimuth: () => maskRadForAzimuth,
251
254
  moonEcef: () => moonEcef,
252
255
  msmEpochToDate: () => msmEpochToDate,
@@ -306,6 +309,11 @@ __export(src_exports, {
306
309
  resetGloFreqCache: () => resetGloFreqCache,
307
310
  resolvePppAmbiguities: () => resolvePppAmbiguities,
308
311
  rhumbLine: () => rhumbLine,
312
+ rtcm2Dgps: () => rtcm2Dgps,
313
+ rtcm2Observation: () => rtcm2Observation,
314
+ rtcm2Station: () => rtcm2Station,
315
+ rtcm2Text: () => rtcm2Text,
316
+ rtcm2Time: () => rtcm2Time,
309
317
  rtcm3Constellation: () => rtcm3Constellation,
310
318
  satClockCorrection: () => satClockCorrection,
311
319
  sbasIonoDeg: () => sbasIonoDeg,
@@ -4476,6 +4484,265 @@ function writeRinex4ObsBlob(header, epochs, obsTypes) {
4476
4484
  });
4477
4485
  }
4478
4486
 
4487
+ // src/rtcm2/index.ts
4488
+ var RTCM2_PREAMBLE = 102;
4489
+ var HAMMING = [
4490
+ 3139384448,
4491
+ 1569692224,
4492
+ 2932329728,
4493
+ 1466164864,
4494
+ 1806824256,
4495
+ 2340063680
4496
+ ];
4497
+ function getbitu(buff, pos, len) {
4498
+ let v = 0;
4499
+ for (let i = pos; i < pos + len; i++)
4500
+ v = v * 2 + (buff[i >> 3] >> 7 - (i & 7) & 1);
4501
+ return v >>> 0;
4502
+ }
4503
+ function getbits(buff, pos, len) {
4504
+ const v = getbitu(buff, pos, len);
4505
+ return v & 1 << len - 1 ? v - 2 ** len : v;
4506
+ }
4507
+ function decodeWord(w) {
4508
+ let word = w >>> 0;
4509
+ if (word & 1073741824) word = (word ^ 1073741760) >>> 0;
4510
+ let parity = 0;
4511
+ for (let i = 0; i < 6; i++) {
4512
+ parity <<= 1;
4513
+ let x = (word & HAMMING[i]) >>> 6;
4514
+ while (x) {
4515
+ parity ^= x & 1;
4516
+ x >>>= 1;
4517
+ }
4518
+ }
4519
+ if (parity >>> 0 !== (word & 63)) return null;
4520
+ return [word >>> 22 & 255, word >>> 14 & 255, word >>> 6 & 255];
4521
+ }
4522
+ var Rtcm2Decoder = class {
4523
+ word = 0;
4524
+ nbyte = 0;
4525
+ nbit = 0;
4526
+ len = 0;
4527
+ buff = new Uint8Array(256);
4528
+ /** Reset the framer (e.g. after a stream reconnect). */
4529
+ reset() {
4530
+ this.word = 0;
4531
+ this.nbyte = 0;
4532
+ this.nbit = 0;
4533
+ this.len = 0;
4534
+ }
4535
+ decode(bytes) {
4536
+ const frames = [];
4537
+ for (const raw of bytes) {
4538
+ if ((raw & 192) !== 64) continue;
4539
+ let data = raw;
4540
+ for (let i = 0; i < 6; i++, data >>= 1) {
4541
+ this.word = (this.word << 1 | data & 1) >>> 0;
4542
+ if (this.nbyte === 0) {
4543
+ let preamb = this.word >>> 22 & 255;
4544
+ if (this.word & 1073741824) preamb ^= 255;
4545
+ if (preamb !== RTCM2_PREAMBLE) continue;
4546
+ const d2 = decodeWord(this.word);
4547
+ if (!d2) continue;
4548
+ this.buff[0] = d2[0];
4549
+ this.buff[1] = d2[1];
4550
+ this.buff[2] = d2[2];
4551
+ this.nbyte = 3;
4552
+ this.nbit = 0;
4553
+ continue;
4554
+ }
4555
+ if (++this.nbit < 30) continue;
4556
+ this.nbit = 0;
4557
+ const d = decodeWord(this.word);
4558
+ if (!d) {
4559
+ this.nbyte = 0;
4560
+ this.word &= 3;
4561
+ continue;
4562
+ }
4563
+ this.buff[this.nbyte] = d[0];
4564
+ this.buff[this.nbyte + 1] = d[1];
4565
+ this.buff[this.nbyte + 2] = d[2];
4566
+ this.nbyte += 3;
4567
+ if (this.nbyte === 6) this.len = (this.buff[5] >> 3) * 3 + 6;
4568
+ if (this.nbyte < this.len) continue;
4569
+ frames.push(this.readHeader(this.buff.slice(0, this.len)));
4570
+ this.nbyte = 0;
4571
+ this.word &= 3;
4572
+ }
4573
+ }
4574
+ return frames;
4575
+ }
4576
+ readHeader(payload) {
4577
+ return {
4578
+ messageType: getbitu(payload, 8, 6),
4579
+ stationId: getbitu(payload, 14, 10),
4580
+ zcountSec: getbitu(payload, 24, 13) * 0.6,
4581
+ sequenceNo: getbitu(payload, 37, 3),
4582
+ lengthWords: payload[5] >> 3,
4583
+ health: getbitu(payload, 45, 3),
4584
+ payload
4585
+ };
4586
+ }
4587
+ };
4588
+ function rtcm2Station(frame) {
4589
+ const p = frame.payload;
4590
+ const nbit = frame.lengthWords * 24;
4591
+ if (frame.messageType === 3) {
4592
+ if (nbit < 96) return null;
4593
+ return {
4594
+ position: [
4595
+ getbits(p, 48, 32) * 0.01,
4596
+ getbits(p, 80, 32) * 0.01,
4597
+ getbits(p, 112, 32) * 0.01
4598
+ ]
4599
+ };
4600
+ }
4601
+ if (frame.messageType === 22) {
4602
+ if (nbit < 24) return null;
4603
+ const l1 = [
4604
+ getbits(p, 48, 8) / 25600,
4605
+ getbits(p, 56, 8) / 25600,
4606
+ getbits(p, 64, 8) / 25600
4607
+ ];
4608
+ let height;
4609
+ if (nbit >= 48) {
4610
+ const noh = getbits(p, 48 + 24 + 5, 1);
4611
+ height = noh ? 0 : getbitu(p, 48 + 24 + 6, 18) / 25600;
4612
+ }
4613
+ return { l1Offset: l1, height };
4614
+ }
4615
+ return null;
4616
+ }
4617
+ function rtcm2Observation(frame) {
4618
+ const t = frame.messageType;
4619
+ if (t !== 18 && t !== 19) return null;
4620
+ const p = frame.payload;
4621
+ const nbit = frame.lengthWords * 24 + 48;
4622
+ let i = 48;
4623
+ if (i + 24 > nbit) return null;
4624
+ const fRaw = getbitu(p, i, 2);
4625
+ i += 4;
4626
+ const microSec = getbitu(p, i, 20);
4627
+ i += 20;
4628
+ if (fRaw & 1) return null;
4629
+ const freq = fRaw >> 1;
4630
+ let sync = false;
4631
+ const records = [];
4632
+ while (i + 48 <= nbit) {
4633
+ sync = getbitu(p, i, 1) === 1;
4634
+ i += 1;
4635
+ const code = getbitu(p, i, 1);
4636
+ i += 1;
4637
+ const sys = getbitu(p, i, 1);
4638
+ i += 1;
4639
+ let prn = getbitu(p, i, 5);
4640
+ i += 5;
4641
+ let loss;
4642
+ if (t === 18) {
4643
+ i += 3;
4644
+ loss = getbitu(p, i, 5);
4645
+ i += 5;
4646
+ } else {
4647
+ i += 8;
4648
+ }
4649
+ const val = t === 18 ? getbits(p, i, 32) : getbitu(p, i, 32);
4650
+ i += 32;
4651
+ if (prn === 0) prn = 32;
4652
+ const system = sys ? "R" : "G";
4653
+ const rec = {
4654
+ prn: `${system}${String(prn).padStart(2, "0")}`,
4655
+ system,
4656
+ freq,
4657
+ code: code ? "P" : "C/A",
4658
+ lossOfLock: loss
4659
+ };
4660
+ if (t === 18)
4661
+ rec.phaseCycles = -val / 256;
4662
+ else rec.pseudorangeM = val * 0.02;
4663
+ records.push(rec);
4664
+ }
4665
+ return { freq, sync, microSec, records };
4666
+ }
4667
+ function rtcm2Dgps(frame) {
4668
+ const t = frame.messageType;
4669
+ if (t !== 1 && t !== 9 && t !== 31) return null;
4670
+ const system = t === 31 ? "R" : "G";
4671
+ const p = frame.payload;
4672
+ const nbit = frame.lengthWords * 24 + 48;
4673
+ let i = 48;
4674
+ const corrections = [];
4675
+ while (i + 40 <= nbit) {
4676
+ const fact = getbitu(p, i, 1);
4677
+ i += 1;
4678
+ const udre = getbitu(p, i, 2);
4679
+ i += 2;
4680
+ let prn = getbitu(p, i, 5);
4681
+ i += 5;
4682
+ const prc = getbits(p, i, 16);
4683
+ i += 16;
4684
+ const rrc = getbits(p, i, 8);
4685
+ i += 8;
4686
+ const iod = getbits(p, i, 8);
4687
+ i += 8;
4688
+ if (prn === 0) prn = 32;
4689
+ corrections.push({
4690
+ prn: `${system}${String(prn).padStart(2, "0")}`,
4691
+ prc: prc * (fact ? 0.32 : 0.02),
4692
+ rrc: rrc * (fact ? 0.032 : 2e-3),
4693
+ iod,
4694
+ udre
4695
+ });
4696
+ }
4697
+ return { system, corrections };
4698
+ }
4699
+ function rtcm2Time(frame) {
4700
+ if (frame.messageType !== 14) return null;
4701
+ const p = frame.payload;
4702
+ if (frame.lengthWords * 24 < 24) return null;
4703
+ return {
4704
+ zcountSec: getbitu(p, 24, 13) * 0.6,
4705
+ week: getbitu(p, 48, 10),
4706
+ hour: getbitu(p, 58, 8),
4707
+ leapSeconds: getbitu(p, 66, 6)
4708
+ };
4709
+ }
4710
+ function rtcm2Text(frame) {
4711
+ if (frame.messageType !== 16) return null;
4712
+ const p = frame.payload;
4713
+ const nbit = frame.lengthWords * 24 + 48;
4714
+ let s = "";
4715
+ for (let i = 48; i + 8 <= nbit; i += 8) {
4716
+ const c = getbitu(p, i, 8);
4717
+ if (c === 0) break;
4718
+ s += String.fromCharCode(c);
4719
+ }
4720
+ return s;
4721
+ }
4722
+ var RTCM2_MESSAGE_NAMES = {
4723
+ 1: "GPS differential corrections",
4724
+ 3: "Reference station parameters (ARP)",
4725
+ 9: "GPS partial correction set",
4726
+ 14: "GPS time of week",
4727
+ 16: "GPS special message (text)",
4728
+ 17: "GPS ephemerides",
4729
+ 18: "RTK uncorrected carrier phase",
4730
+ 19: "RTK uncorrected pseudorange",
4731
+ 22: "Extended reference station parameters",
4732
+ 23: "Antenna type definition",
4733
+ 24: "Antenna reference point (ARP)",
4734
+ 31: "GLONASS differential corrections",
4735
+ 32: "GLONASS reference station parameters",
4736
+ 34: "GLONASS partial correction set",
4737
+ 36: "GLONASS special message"
4738
+ };
4739
+ function looksLikeRtcm2(bytes) {
4740
+ const n = Math.min(bytes.length, 4096);
4741
+ if (n < 12) return false;
4742
+ for (let i = 0; i < n; i++) if ((bytes[i] & 192) !== 64) return false;
4743
+ return new Rtcm2Decoder().decode(bytes.subarray(0, n)).length >= 2;
4744
+ }
4745
+
4479
4746
  // src/rtcm3/decoder.ts
4480
4747
  var debugHandler = null;
4481
4748
  function setRtcm3DebugHandler(fn) {
@@ -18578,7 +18845,9 @@ function computePsdDb(centerMHz, halfSpanChips, numPoints, psdFn, f0 = 1023e3, f
18578
18845
  OMEGA_E,
18579
18846
  REFERENCE_FRAMES,
18580
18847
  RINEX_CODES,
18848
+ RTCM2_MESSAGE_NAMES,
18581
18849
  RTCM3_MESSAGE_NAMES,
18850
+ Rtcm2Decoder,
18582
18851
  Rtcm3Decoder,
18583
18852
  RtkFloatEngine,
18584
18853
  SBAS_L5_MT_NAMES,
@@ -18744,6 +19013,7 @@ function computePsdDb(centerMHz, halfSpanChips, numPoints, psdFn, f0 = 1023e3, f
18744
19013
  klobucharDelay,
18745
19014
  lambdaReduction,
18746
19015
  lambdaSearch,
19016
+ looksLikeRtcm2,
18747
19017
  maskRadForAzimuth,
18748
19018
  moonEcef,
18749
19019
  msmEpochToDate,
@@ -18803,6 +19073,11 @@ function computePsdDb(centerMHz, halfSpanChips, numPoints, psdFn, f0 = 1023e3, f
18803
19073
  resetGloFreqCache,
18804
19074
  resolvePppAmbiguities,
18805
19075
  rhumbLine,
19076
+ rtcm2Dgps,
19077
+ rtcm2Observation,
19078
+ rtcm2Station,
19079
+ rtcm2Text,
19080
+ rtcm2Time,
18806
19081
  rtcm3Constellation,
18807
19082
  satClockCorrection,
18808
19083
  sbasIonoDeg,
package/dist/index.d.cts CHANGED
@@ -9,6 +9,7 @@ export { BiasRecord, BiasSinex, CompactEpoch, CrxField, DiffState, EMPTY_WARNING
9
9
  export { E as EpochSummary, P as ParseOptions, R as RinexHeader, a as RinexResult, b as RinexStats, S as SYSTEM_ORDER, c as SatObsCallback, p as parseRinexStream, s as systemCmp, d as systemName } from './parser-JPjjFgeP.cjs';
10
10
  export { C as CnavEphemeris, E as Ephemeris, G as GlonassEphemeris, K as KeplerEphemeris, N as NavHeader, a as NavResult, R as RinexCnavEphemeris, p as parseNavFile } from './nav-DImXUdbp.cjs';
11
11
  export { C as ClkFile, I as IonexGrid, S as Sp3File, a as Sp3Sample, c as clkBias, p as parseClk, b as parseIonex, d as parseSp3, s as sp3Position } from './clk-DGVBGRzA.cjs';
12
+ export { RTCM2_MESSAGE_NAMES, Rtcm2Correction, Rtcm2Decoder, Rtcm2Frame, Rtcm2ObsRecord, Rtcm2Station, looksLikeRtcm2, rtcm2Dgps, rtcm2Observation, rtcm2Station, rtcm2Text, rtcm2Time } from './rtcm2.cjs';
12
13
  export { B as BitReader, E as EphemerisInfo, R as Rtcm3DebugHandler, a as Rtcm3Decoder, b as Rtcm3Frame, d as decodeEphemeris, r as readString, c as reportDecodeError, s as setRtcm3DebugHandler } from './ephemeris-Ohl6NAfw.cjs';
13
14
  export { IgsSsrIonoLayer, IgsSsrMessage, MessageTypeStats, MsmEpoch, MsmSatObs, MsmSignal, RTCM3_MESSAGE_NAMES, SatCn0, SignalCn0, SsrCodeBias, SsrKind, SsrMessage, SsrPhaseBias, SsrSatCorrection, StationMeta, StreamStats, SystemParams, SystemParamsMessage, createStationMeta, createStreamStats, decodeIgsSsr, decodeLegacyObs, decodeMsmFull, decodeSsr, decodeSystemParams, isSsrMessage, msmEpochToDate, resetGloFreqCache, rtcm3Constellation, setGloFreqNumber, updateStationMeta, updateStreamStats } from './rtcm3.cjs';
14
15
  export { UbxCnavResult, UbxFrame, UbxIonoUtcResult, UbxMeasurement, UbxNavOptions, UbxNavResult, UbxParseResult, UbxPvtResult, UbxRawNavOptions, UbxRawNavResult, UbxRawxEpoch, parseUbxCnav, parseUbxIonoUtc, parseUbxNav, parseUbxPvt, parseUbxRawNav, parseUbxRawx, ubxFrames } from './ubx.cjs';
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export { BiasRecord, BiasSinex, CompactEpoch, CrxField, DiffState, EMPTY_WARNING
9
9
  export { E as EpochSummary, P as ParseOptions, R as RinexHeader, a as RinexResult, b as RinexStats, S as SYSTEM_ORDER, c as SatObsCallback, p as parseRinexStream, s as systemCmp, d as systemName } from './parser-JPjjFgeP.js';
10
10
  export { C as CnavEphemeris, E as Ephemeris, G as GlonassEphemeris, K as KeplerEphemeris, N as NavHeader, a as NavResult, R as RinexCnavEphemeris, p as parseNavFile } from './nav-DImXUdbp.js';
11
11
  export { C as ClkFile, I as IonexGrid, S as Sp3File, a as Sp3Sample, c as clkBias, p as parseClk, b as parseIonex, d as parseSp3, s as sp3Position } from './clk-DGVBGRzA.js';
12
+ export { RTCM2_MESSAGE_NAMES, Rtcm2Correction, Rtcm2Decoder, Rtcm2Frame, Rtcm2ObsRecord, Rtcm2Station, looksLikeRtcm2, rtcm2Dgps, rtcm2Observation, rtcm2Station, rtcm2Text, rtcm2Time } from './rtcm2.js';
12
13
  export { B as BitReader, E as EphemerisInfo, R as Rtcm3DebugHandler, a as Rtcm3Decoder, b as Rtcm3Frame, d as decodeEphemeris, r as readString, c as reportDecodeError, s as setRtcm3DebugHandler } from './ephemeris-Ohl6NAfw.js';
13
14
  export { IgsSsrIonoLayer, IgsSsrMessage, MessageTypeStats, MsmEpoch, MsmSatObs, MsmSignal, RTCM3_MESSAGE_NAMES, SatCn0, SignalCn0, SsrCodeBias, SsrKind, SsrMessage, SsrPhaseBias, SsrSatCorrection, StationMeta, StreamStats, SystemParams, SystemParamsMessage, createStationMeta, createStreamStats, decodeIgsSsr, decodeLegacyObs, decodeMsmFull, decodeSsr, decodeSystemParams, isSsrMessage, msmEpochToDate, resetGloFreqCache, rtcm3Constellation, setGloFreqNumber, updateStationMeta, updateStreamStats } from './rtcm3.js';
14
15
  export { UbxCnavResult, UbxFrame, UbxIonoUtcResult, UbxMeasurement, UbxNavOptions, UbxNavResult, UbxParseResult, UbxPvtResult, UbxRawNavOptions, UbxRawNavResult, UbxRawxEpoch, parseUbxCnav, parseUbxIonoUtc, parseUbxNav, parseUbxPvt, parseUbxRawNav, parseUbxRawx, ubxFrames } from './ubx.js';