gnss-js 1.0.0 → 1.1.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.
Files changed (39) hide show
  1. package/README.md +26 -0
  2. package/dist/analysis.cjs +143 -36
  3. package/dist/analysis.js +3 -3
  4. package/dist/{chunk-HKN3PUGN.js → chunk-5SPJH4MG.js} +35 -26
  5. package/dist/{chunk-WR7LCB52.js → chunk-BJHTBYNG.js} +15 -4
  6. package/dist/{chunk-Y3R57B5P.js → chunk-G3N4S3DM.js} +37 -8
  7. package/dist/{chunk-PRSZIWKM.js → chunk-JDO3LEPC.js} +100 -132
  8. package/dist/{chunk-K7WZQFBV.js → chunk-MIIM4LDY.js} +4 -1
  9. package/dist/{chunk-CB6EOOLA.js → chunk-OZCYOM5D.js} +70 -21
  10. package/dist/{chunk-SDRRAJT5.js → chunk-PGHDJFQK.js} +31 -14
  11. package/dist/{chunk-IS4UUDBV.js → chunk-W4YMQKWH.js} +54 -9
  12. package/dist/{chunk-354IRDOG.js → chunk-W5WKEV7U.js} +39 -9
  13. package/dist/constants.cjs +39 -9
  14. package/dist/constants.js +26 -26
  15. package/dist/coordinates.cjs +4 -1
  16. package/dist/coordinates.js +1 -1
  17. package/dist/{ephemeris-BUWzfmBy.d.cts → ephemeris-Ohl6NAfw.d.cts} +12 -2
  18. package/dist/{ephemeris-BUWzfmBy.d.ts → ephemeris-Ohl6NAfw.d.ts} +12 -2
  19. package/dist/index.cjs +366 -220
  20. package/dist/index.d.cts +2 -2
  21. package/dist/index.d.ts +2 -2
  22. package/dist/index.js +40 -34
  23. package/dist/ntrip.cjs +15 -4
  24. package/dist/ntrip.js +1 -1
  25. package/dist/orbit.cjs +31 -14
  26. package/dist/orbit.d.cts +1 -1
  27. package/dist/orbit.d.ts +1 -1
  28. package/dist/orbit.js +2 -1
  29. package/dist/rinex.cjs +123 -29
  30. package/dist/rinex.js +3 -3
  31. package/dist/rtcm3.cjs +123 -131
  32. package/dist/rtcm3.d.cts +9 -3
  33. package/dist/rtcm3.d.ts +9 -3
  34. package/dist/rtcm3.js +9 -2
  35. package/dist/signals.cjs +55 -26
  36. package/dist/signals.d.cts +26 -26
  37. package/dist/signals.d.ts +26 -26
  38. package/dist/signals.js +2 -1
  39. package/package.json +1 -2
@@ -1,6 +1,10 @@
1
1
  import {
2
2
  ecefToGeodetic
3
3
  } from "./chunk-37QNKGTC.js";
4
+ import {
5
+ START_BDS_TIME,
6
+ START_GPS_TIME
7
+ } from "./chunk-LEEU5OIO.js";
4
8
 
5
9
  // src/orbit/index.ts
6
10
  var GM_GPS = 3986005e8;
@@ -8,6 +12,8 @@ var GM_GAL = 3986004418e5;
8
12
  var GM_BDS = 3986004418e5;
9
13
  var GM_GLO = 39860044e7;
10
14
  var OMEGA_E = 72921151467e-15;
15
+ var BDS_GEO_MAX_INCLINATION_RAD = 0.1;
16
+ var BDS_GEO_MIN_SEMIMAJOR_AXIS_M = 4e7;
11
17
  var AE_GLO = 6378136;
12
18
  var J2_GLO = 108263e-8;
13
19
  var TWO_PI = 2 * Math.PI;
@@ -33,10 +39,7 @@ function keplerPosition(eph, t) {
33
39
  }
34
40
  const sinE = Math.sin(Ek);
35
41
  const cosE = Math.cos(Ek);
36
- const vk = Math.atan2(
37
- Math.sqrt(1 - eph.e * eph.e) * sinE,
38
- cosE - eph.e
39
- );
42
+ const vk = Math.atan2(Math.sqrt(1 - eph.e * eph.e) * sinE, cosE - eph.e);
40
43
  const phik = vk + eph.omega;
41
44
  const sin2phi = Math.sin(2 * phik);
42
45
  const cos2phi = Math.cos(2 * phik);
@@ -48,7 +51,7 @@ function keplerPosition(eph, t) {
48
51
  const ik = eph.i0 + dik + eph.idot * tk;
49
52
  const xp = rk * Math.cos(uk);
50
53
  const yp = rk * Math.sin(uk);
51
- const isBdsGeo = eph.system === "C" && Math.abs(eph.i0) < 0.1 && a > 4e7;
54
+ const isBdsGeo = eph.system === "C" && Math.abs(eph.i0) < BDS_GEO_MAX_INCLINATION_RAD && a > BDS_GEO_MIN_SEMIMAJOR_AXIS_M;
52
55
  if (isBdsGeo) {
53
56
  const omegak2 = eph.omega0 + eph.omegaDot * tk - OMEGA_E * eph.toe;
54
57
  const cosO2 = Math.cos(omegak2);
@@ -199,7 +202,10 @@ function invert4x4(m) {
199
202
  let det = a[0] * inv[0] + a[1] * inv[4] + a[2] * inv[8] + a[3] * inv[12];
200
203
  if (Math.abs(det) < 1e-20) return null;
201
204
  det = 1 / det;
202
- const result = Array.from({ length: 4 }, () => new Array(4).fill(0));
205
+ const result = Array.from(
206
+ { length: 4 },
207
+ () => new Array(4).fill(0)
208
+ );
203
209
  for (let i = 0; i < 4; i++) {
204
210
  for (let j = 0; j < 4; j++) {
205
211
  result[i][j] = inv[i * 4 + j] * det;
@@ -226,9 +232,10 @@ function computeSatPosition(eph, timeMs) {
226
232
  if (eph.system === "R" || eph.system === "S") {
227
233
  return glonassPosition(eph, timeMs / 1e3);
228
234
  }
229
- const GPS_EPOCH = Date.UTC(1980, 0, 6);
235
+ const GPS_EPOCH = START_GPS_TIME.getTime();
230
236
  const gpsSeconds = (timeMs - GPS_EPOCH) / 1e3;
231
- const tow = gpsSeconds % (7 * 86400);
237
+ let tow = gpsSeconds % (7 * 86400);
238
+ if (eph.system === "C") tow = (tow - 14 + 604800) % 604800;
232
239
  return keplerPosition(eph, tow);
233
240
  }
234
241
  function navTimesFromEph(ephs) {
@@ -310,16 +317,22 @@ function selectBest(ephs, timeMs) {
310
317
  }
311
318
  return best;
312
319
  }
313
- var GPS_EPOCH_MS = Date.UTC(1980, 0, 6);
314
- var BDS_EPOCH_MS = Date.UTC(2006, 0, 1);
320
+ var GPS_EPOCH_MS = START_GPS_TIME.getTime();
321
+ var BDS_EPOCH_MS = START_BDS_TIME.getTime();
315
322
  var GAL_EPOCH_MS = GPS_EPOCH_MS;
316
323
  function ephInfoToEphemeris(info) {
317
324
  const sys = info.prn.charAt(0);
318
325
  if (sys === "R") {
319
- if (info.x === void 0 || info.y === void 0 || info.z === void 0) return null;
320
- if (info.vx === void 0 || info.vy === void 0 || info.vz === void 0) return null;
326
+ if (info.x === void 0 || info.y === void 0 || info.z === void 0)
327
+ return null;
328
+ if (info.vx === void 0 || info.vy === void 0 || info.vz === void 0)
329
+ return null;
321
330
  const now = new Date(info.lastReceived);
322
- const utcMidnight = Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate());
331
+ const utcMidnight = Date.UTC(
332
+ now.getUTCFullYear(),
333
+ now.getUTCMonth(),
334
+ now.getUTCDate()
335
+ );
323
336
  const tbSec = (info.tb ?? 0) * 900;
324
337
  const moscowOffset = 3 * 3600;
325
338
  const tocMs = utcMidnight + (tbSec - moscowOffset) * 1e3;
@@ -344,7 +357,11 @@ function ephInfoToEphemeris(info) {
344
357
  freqNum: info.freqChannel ?? 0
345
358
  };
346
359
  }
347
- if (info.sqrtA === void 0 || info.eccentricity === void 0 || info.inclination === void 0 || info.omega0 === void 0 || info.argPerigee === void 0 || info.meanAnomaly === void 0 || info.toe === void 0 || info.week === void 0) return null;
360
+ if (info.sqrtA === void 0 || info.eccentricity === void 0 || info.inclination === void 0 || info.omega0 === void 0 || info.argPerigee === void 0 || info.meanAnomaly === void 0 || info.toe === void 0 || info.week === void 0)
361
+ return null;
362
+ if (info.eccentricity < 0 || info.eccentricity >= 1 || info.sqrtA < 3e3 || info.sqrtA > 9e3 || info.toe < 0 || info.toe > 604800) {
363
+ return null;
364
+ }
348
365
  let epochMs;
349
366
  const tocSec = info.toc ?? info.toe;
350
367
  if (sys === "C") {
@@ -39,10 +39,18 @@ var WarningAccumulator = class {
39
39
  );
40
40
  }
41
41
  if (!header.antType) {
42
- this.add("MISSING_ANT_TYPE", "info", "Missing antenna type (ANT # / TYPE)");
42
+ this.add(
43
+ "MISSING_ANT_TYPE",
44
+ "info",
45
+ "Missing antenna type (ANT # / TYPE)"
46
+ );
43
47
  }
44
48
  if (!header.receiverType) {
45
- this.add("MISSING_REC_TYPE", "info", "Missing receiver type (REC # / TYPE / VERS)");
49
+ this.add(
50
+ "MISSING_REC_TYPE",
51
+ "info",
52
+ "Missing receiver type (REC # / TYPE / VERS)"
53
+ );
46
54
  }
47
55
  if (!header.markerName) {
48
56
  this.add("MISSING_MARKER", "info", "Missing marker name (MARKER NAME)");
@@ -51,7 +59,11 @@ var WarningAccumulator = class {
51
59
  this.add("MISSING_INTERVAL", "info", "No observation interval in header");
52
60
  }
53
61
  if (Object.keys(header.obsTypes).length === 0) {
54
- this.add("NO_OBS_TYPES", "error", "No observation types defined in header");
62
+ this.add(
63
+ "NO_OBS_TYPES",
64
+ "error",
65
+ "No observation types defined in header"
66
+ );
55
67
  }
56
68
  }
57
69
  setInterval(intervalMs) {
@@ -118,7 +130,12 @@ var WarningAccumulator = class {
118
130
  };
119
131
  const range = ranges[sys];
120
132
  if (!range) {
121
- this.add("UNKNOWN_SYSTEM", "info", "Unknown satellite system letter", prn);
133
+ this.add(
134
+ "UNKNOWN_SYSTEM",
135
+ "info",
136
+ "Unknown satellite system letter",
137
+ prn
138
+ );
122
139
  } else if (num < range[0] || num > range[1]) {
123
140
  this.add(
124
141
  "PRN_OUT_OF_RANGE",
@@ -208,7 +225,15 @@ var R4_MSG_LINES = {
208
225
  EOP: 3,
209
226
  ION: 3
210
227
  };
211
- var SUPPORTED_EPH_MSGS = /* @__PURE__ */ new Set(["LNAV", "INAV", "FNAV", "D1", "D2", "SBAS", "FDMA"]);
228
+ var SUPPORTED_EPH_MSGS = /* @__PURE__ */ new Set([
229
+ "LNAV",
230
+ "INAV",
231
+ "FNAV",
232
+ "D1",
233
+ "D2",
234
+ "SBAS",
235
+ "FDMA"
236
+ ]);
212
237
  function parseFloat19(s) {
213
238
  return parseFloat(s.trim().replace(/[dD]/g, "E"));
214
239
  }
@@ -415,9 +440,25 @@ function parseNavFile(text) {
415
440
  }
416
441
  if (dataLines2.length === numDataLines2) {
417
442
  if (sys2 === "R" || sys2 === "S") {
418
- ephemerides.push(buildStateVectorEphemeris(sys2, prn2, parsed.date, parsed.values, dataLines2));
443
+ ephemerides.push(
444
+ buildStateVectorEphemeris(
445
+ sys2,
446
+ prn2,
447
+ parsed.date,
448
+ parsed.values,
449
+ dataLines2
450
+ )
451
+ );
419
452
  } else if (sys2 === "G" || sys2 === "E" || sys2 === "C" || sys2 === "J" || sys2 === "I") {
420
- ephemerides.push(buildKeplerEphemeris(sys2, prn2, parsed.date, parsed.values, dataLines2));
453
+ ephemerides.push(
454
+ buildKeplerEphemeris(
455
+ sys2,
456
+ prn2,
457
+ parsed.date,
458
+ parsed.values,
459
+ dataLines2
460
+ )
461
+ );
421
462
  }
422
463
  }
423
464
  i++;
@@ -453,9 +494,13 @@ function parseNavFile(text) {
453
494
  }
454
495
  if (dataLines.length === numDataLines) {
455
496
  if (sys === "R" || sys === "S") {
456
- ephemerides.push(buildStateVectorEphemeris(sys, prn, date, epochVals, dataLines));
497
+ ephemerides.push(
498
+ buildStateVectorEphemeris(sys, prn, date, epochVals, dataLines)
499
+ );
457
500
  } else if (sys === "G" || sys === "E" || sys === "C" || sys === "J" || sys === "I") {
458
- ephemerides.push(buildKeplerEphemeris(sys, prn, date, epochVals, dataLines));
501
+ ephemerides.push(
502
+ buildKeplerEphemeris(sys, prn, date, epochVals, dataLines)
503
+ );
459
504
  }
460
505
  }
461
506
  i++;
@@ -20,9 +20,22 @@ var SYS_SHORT = {
20
20
  var C_LIGHT = 299792458;
21
21
  var FREQ = {
22
22
  G: { "1": 157542e4, "2": 12276e5, "5": 117645e4 },
23
- R: { "3": 1202025e3 },
24
- E: { "1": 157542e4, "5": 117645e4, "6": 127875e4, "7": 120714e4, "8": 1191795e3 },
25
- C: { "1": 157542e4, "2": 1561098e3, "5": 117645e4, "6": 126852e4, "7": 120714e4 },
23
+ // R bands 4/6 are the CDMA L1OC/L2OC center frequencies
24
+ R: { "3": 1202025e3, "4": 1600995e3, "6": 124806e4 },
25
+ E: {
26
+ "1": 157542e4,
27
+ "5": 117645e4,
28
+ "6": 127875e4,
29
+ "7": 120714e4,
30
+ "8": 1191795e3
31
+ },
32
+ C: {
33
+ "1": 157542e4,
34
+ "2": 1561098e3,
35
+ "5": 117645e4,
36
+ "6": 126852e4,
37
+ "7": 120714e4
38
+ },
26
39
  J: { "1": 157542e4, "2": 12276e5, "5": 117645e4, "6": 127875e4 },
27
40
  I: { "5": 117645e4, "9": 2492028e3 },
28
41
  S: { "1": 157542e4, "5": 117645e4 }
@@ -37,11 +50,28 @@ var BAND_LABELS = {
37
50
  S: { "1": "L1", "5": "L5" }
38
51
  };
39
52
  var DUAL_FREQ_PAIRS = {
40
- G: [["1", "2"], ["1", "5"]],
41
- R: [["1", "2"], ["1", "3"]],
42
- E: [["1", "5"], ["1", "7"], ["1", "6"]],
43
- C: [["2", "7"], ["2", "6"], ["1", "5"]],
44
- J: [["1", "2"], ["1", "5"]],
53
+ G: [
54
+ ["1", "2"],
55
+ ["1", "5"]
56
+ ],
57
+ R: [
58
+ ["1", "2"],
59
+ ["1", "3"]
60
+ ],
61
+ E: [
62
+ ["1", "5"],
63
+ ["1", "7"],
64
+ ["1", "6"]
65
+ ],
66
+ C: [
67
+ ["2", "7"],
68
+ ["2", "6"],
69
+ ["1", "5"]
70
+ ],
71
+ J: [
72
+ ["1", "2"],
73
+ ["1", "5"]
74
+ ],
45
75
  I: [["5", "9"]],
46
76
  S: [["1", "5"]]
47
77
  };
@@ -85,11 +115,11 @@ function buildGloChannelMap(slots) {
85
115
  return map;
86
116
  }
87
117
  function gloFreq(gloChannels, prn, band) {
118
+ if (band === "3" || band === "4" || band === "6") return FREQ.R[band];
88
119
  const k = gloChannels[prn];
89
120
  if (k === void 0) return void 0;
90
121
  if (band === "1") return GLO_F1_BASE + k * GLO_F1_STEP;
91
122
  if (band === "2") return GLO_F2_BASE + k * GLO_F2_STEP;
92
- if (band === "3") return GLO_F3;
93
123
  return void 0;
94
124
  }
95
125
  function getFreq(gloChannels, prn, band) {
@@ -148,9 +148,22 @@ var SYS_SHORT = {
148
148
  var C_LIGHT = 299792458;
149
149
  var FREQ = {
150
150
  G: { "1": 157542e4, "2": 12276e5, "5": 117645e4 },
151
- R: { "3": 1202025e3 },
152
- E: { "1": 157542e4, "5": 117645e4, "6": 127875e4, "7": 120714e4, "8": 1191795e3 },
153
- C: { "1": 157542e4, "2": 1561098e3, "5": 117645e4, "6": 126852e4, "7": 120714e4 },
151
+ // R bands 4/6 are the CDMA L1OC/L2OC center frequencies
152
+ R: { "3": 1202025e3, "4": 1600995e3, "6": 124806e4 },
153
+ E: {
154
+ "1": 157542e4,
155
+ "5": 117645e4,
156
+ "6": 127875e4,
157
+ "7": 120714e4,
158
+ "8": 1191795e3
159
+ },
160
+ C: {
161
+ "1": 157542e4,
162
+ "2": 1561098e3,
163
+ "5": 117645e4,
164
+ "6": 126852e4,
165
+ "7": 120714e4
166
+ },
154
167
  J: { "1": 157542e4, "2": 12276e5, "5": 117645e4, "6": 127875e4 },
155
168
  I: { "5": 117645e4, "9": 2492028e3 },
156
169
  S: { "1": 157542e4, "5": 117645e4 }
@@ -165,11 +178,28 @@ var BAND_LABELS = {
165
178
  S: { "1": "L1", "5": "L5" }
166
179
  };
167
180
  var DUAL_FREQ_PAIRS = {
168
- G: [["1", "2"], ["1", "5"]],
169
- R: [["1", "2"], ["1", "3"]],
170
- E: [["1", "5"], ["1", "7"], ["1", "6"]],
171
- C: [["2", "7"], ["2", "6"], ["1", "5"]],
172
- J: [["1", "2"], ["1", "5"]],
181
+ G: [
182
+ ["1", "2"],
183
+ ["1", "5"]
184
+ ],
185
+ R: [
186
+ ["1", "2"],
187
+ ["1", "3"]
188
+ ],
189
+ E: [
190
+ ["1", "5"],
191
+ ["1", "7"],
192
+ ["1", "6"]
193
+ ],
194
+ C: [
195
+ ["2", "7"],
196
+ ["2", "6"],
197
+ ["1", "5"]
198
+ ],
199
+ J: [
200
+ ["1", "2"],
201
+ ["1", "5"]
202
+ ],
173
203
  I: [["5", "9"]],
174
204
  S: [["1", "5"]]
175
205
  };
@@ -213,11 +243,11 @@ function buildGloChannelMap(slots) {
213
243
  return map;
214
244
  }
215
245
  function gloFreq(gloChannels, prn, band) {
246
+ if (band === "3" || band === "4" || band === "6") return FREQ.R[band];
216
247
  const k = gloChannels[prn];
217
248
  if (k === void 0) return void 0;
218
249
  if (band === "1") return GLO_F1_BASE + k * GLO_F1_STEP;
219
250
  if (band === "2") return GLO_F2_BASE + k * GLO_F2_STEP;
220
- if (band === "3") return GLO_F3;
221
251
  return void 0;
222
252
  }
223
253
  function getFreq(gloChannels, prn, band) {
package/dist/constants.js CHANGED
@@ -1,29 +1,4 @@
1
1
  import "./chunk-5S5MONFK.js";
2
- import {
3
- DAYS_MJD2000_MJD,
4
- DAYS_MJD_JULIAN,
5
- MILLISECONDS_GPS_TAI,
6
- MILLISECONDS_IN_DAY,
7
- MILLISECONDS_IN_HOUR,
8
- MILLISECONDS_IN_MINUTE,
9
- MILLISECONDS_IN_SECOND,
10
- MILLISECONDS_IN_WEEK,
11
- MILLISECONDS_TT_TAI,
12
- RINEX_CODES,
13
- SECONDS_IN_DAY,
14
- SECONDS_IN_HOUR,
15
- SECONDS_IN_MINUTE,
16
- SECONDS_IN_WEEK,
17
- START_BDS_TIME,
18
- START_GAL_TIME,
19
- START_GLO_LEAP,
20
- START_GPS_TIME,
21
- START_JULIAN_TAI,
22
- START_MJD_UNIX_SECONDS,
23
- START_NTP_TIME,
24
- START_TAI_TIME,
25
- START_UNIX_TIME
26
- } from "./chunk-LEEU5OIO.js";
27
2
  import {
28
3
  ARC_GAP_FACTOR,
29
4
  BAND_LABELS,
@@ -45,13 +20,38 @@ import {
45
20
  formatUTCTime,
46
21
  getFreq,
47
22
  gloFreq
48
- } from "./chunk-354IRDOG.js";
23
+ } from "./chunk-W5WKEV7U.js";
49
24
  import {
50
25
  WGS84_ECCENTRICITY_SQUARED,
51
26
  WGS84_FLATTENING,
52
27
  WGS84_SEMI_MAJOR_AXIS,
53
28
  WGS84_SEMI_MINOR_AXIS
54
29
  } from "./chunk-6FAL6P4G.js";
30
+ import {
31
+ DAYS_MJD2000_MJD,
32
+ DAYS_MJD_JULIAN,
33
+ MILLISECONDS_GPS_TAI,
34
+ MILLISECONDS_IN_DAY,
35
+ MILLISECONDS_IN_HOUR,
36
+ MILLISECONDS_IN_MINUTE,
37
+ MILLISECONDS_IN_SECOND,
38
+ MILLISECONDS_IN_WEEK,
39
+ MILLISECONDS_TT_TAI,
40
+ RINEX_CODES,
41
+ SECONDS_IN_DAY,
42
+ SECONDS_IN_HOUR,
43
+ SECONDS_IN_MINUTE,
44
+ SECONDS_IN_WEEK,
45
+ START_BDS_TIME,
46
+ START_GAL_TIME,
47
+ START_GLO_LEAP,
48
+ START_GPS_TIME,
49
+ START_JULIAN_TAI,
50
+ START_MJD_UNIX_SECONDS,
51
+ START_NTP_TIME,
52
+ START_TAI_TIME,
53
+ START_UNIX_TIME
54
+ } from "./chunk-LEEU5OIO.js";
55
55
  export {
56
56
  ARC_GAP_FACTOR,
57
57
  BAND_LABELS,
@@ -156,7 +156,10 @@ function vincenty(lat1, lon1, lat2, lon2) {
156
156
  const cosLat2 = Math.cos(lat2), sinLat2 = Math.sin(lat2);
157
157
  const dLon = lon2 - lon1;
158
158
  sigma = Math.acos(
159
- Math.min(1, Math.max(-1, sinLat1 * sinLat2 + cosLat1 * cosLat2 * Math.cos(dLon)))
159
+ Math.min(
160
+ 1,
161
+ Math.max(-1, sinLat1 * sinLat2 + cosLat1 * cosLat2 * Math.cos(dLon))
162
+ )
160
163
  );
161
164
  const distance2 = WGS84_SEMI_MAJOR_AXIS * sigma;
162
165
  const ib = Math.atan2(
@@ -10,7 +10,7 @@ import {
10
10
  rad2deg,
11
11
  rhumbLine,
12
12
  vincenty
13
- } from "./chunk-K7WZQFBV.js";
13
+ } from "./chunk-MIIM4LDY.js";
14
14
  import {
15
15
  clampUnit,
16
16
  ecefToGeodetic,
@@ -7,12 +7,22 @@ interface Rtcm3Frame {
7
7
  length: number;
8
8
  payload: Uint8Array;
9
9
  }
10
+ /** Called when a message decoder swallows an exception. */
11
+ type Rtcm3DebugHandler = (context: string, error: unknown) => void;
12
+ /**
13
+ * Install a handler to observe decode errors that are otherwise
14
+ * silently mapped to null results (corrupt frames, truncated payloads).
15
+ * Pass null to remove.
16
+ */
17
+ declare function setRtcm3DebugHandler(fn: Rtcm3DebugHandler | null): void;
18
+ /** @internal Report a swallowed decode error to the debug handler. */
19
+ declare function reportDecodeError(context: string, error: unknown): void;
10
20
  /** Simple bit reader for parsing RTCM3 payloads at bit level. */
11
21
  declare class BitReader {
12
22
  private data;
13
23
  private bitPos;
14
24
  constructor(data: Uint8Array);
15
- /** Read `n` bits as unsigned integer (max 32). */
25
+ /** Read `n` bits as unsigned integer (max 53). */
16
26
  readU(n: number): number;
17
27
  /** Read `n` bits as signed (two's complement) integer. */
18
28
  readS(n: number): number;
@@ -111,4 +121,4 @@ declare function readString(r: BitReader, nChars: number): string;
111
121
  /** Decode any supported ephemeris message. Returns null for non-ephemeris or decode errors. */
112
122
  declare function decodeEphemeris(frame: Rtcm3Frame): EphemerisInfo | null;
113
123
 
114
- export { BitReader as B, type EphemerisInfo as E, Rtcm3Decoder as R, type Rtcm3Frame as a, decodeEphemeris as d, readString as r };
124
+ export { BitReader as B, type EphemerisInfo as E, type Rtcm3DebugHandler as R, Rtcm3Decoder as a, type Rtcm3Frame as b, reportDecodeError as c, decodeEphemeris as d, readString as r, setRtcm3DebugHandler as s };
@@ -7,12 +7,22 @@ interface Rtcm3Frame {
7
7
  length: number;
8
8
  payload: Uint8Array;
9
9
  }
10
+ /** Called when a message decoder swallows an exception. */
11
+ type Rtcm3DebugHandler = (context: string, error: unknown) => void;
12
+ /**
13
+ * Install a handler to observe decode errors that are otherwise
14
+ * silently mapped to null results (corrupt frames, truncated payloads).
15
+ * Pass null to remove.
16
+ */
17
+ declare function setRtcm3DebugHandler(fn: Rtcm3DebugHandler | null): void;
18
+ /** @internal Report a swallowed decode error to the debug handler. */
19
+ declare function reportDecodeError(context: string, error: unknown): void;
10
20
  /** Simple bit reader for parsing RTCM3 payloads at bit level. */
11
21
  declare class BitReader {
12
22
  private data;
13
23
  private bitPos;
14
24
  constructor(data: Uint8Array);
15
- /** Read `n` bits as unsigned integer (max 32). */
25
+ /** Read `n` bits as unsigned integer (max 53). */
16
26
  readU(n: number): number;
17
27
  /** Read `n` bits as signed (two's complement) integer. */
18
28
  readS(n: number): number;
@@ -111,4 +121,4 @@ declare function readString(r: BitReader, nChars: number): string;
111
121
  /** Decode any supported ephemeris message. Returns null for non-ephemeris or decode errors. */
112
122
  declare function decodeEphemeris(frame: Rtcm3Frame): EphemerisInfo | null;
113
123
 
114
- export { BitReader as B, type EphemerisInfo as E, Rtcm3Decoder as R, type Rtcm3Frame as a, decodeEphemeris as d, readString as r };
124
+ export { BitReader as B, type EphemerisInfo as E, type Rtcm3DebugHandler as R, Rtcm3Decoder as a, type Rtcm3Frame as b, reportDecodeError as c, decodeEphemeris as d, readString as r, setRtcm3DebugHandler as s };