gnss-js 1.64.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.
- package/dist/{chunk-TWAC2BZF.js → chunk-2CMAFEHI.js} +1 -1
- package/dist/{chunk-MRC6LIPM.js → chunk-GH7MYXON.js} +1 -1
- package/dist/{chunk-5SQLUGWE.js → chunk-REULRNJ5.js} +42 -1
- package/dist/chunk-S624C5AC.js +269 -0
- package/dist/{chunk-UHLUAU6H.js → chunk-WW3DKCDN.js} +4 -4
- package/dist/constants.js +6 -6
- package/dist/index.cjs +318 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +119 -99
- package/dist/novatel.js +3 -3
- package/dist/orbit.js +3 -3
- package/dist/positioning.js +4 -4
- package/dist/rtcm2.cjs +300 -0
- package/dist/rtcm2.d.cts +116 -0
- package/dist/rtcm2.d.ts +116 -0
- package/dist/rtcm2.js +20 -0
- package/dist/rtcm3.cjs +43 -1
- package/dist/rtcm3.d.cts +29 -1
- package/dist/rtcm3.d.ts +29 -1
- package/dist/rtcm3.js +3 -1
- package/dist/sbf.js +4 -4
- package/dist/ubx.js +4 -4
- package/package.json +6 -1
- package/dist/{chunk-FA2UTLEQ.js → chunk-3KSDL3CO.js} +3 -3
- package/dist/{chunk-MHGNKSSH.js → chunk-JYWYQ7DW.js} +3 -3
- package/dist/{chunk-KUTNIP3O.js → chunk-SEYH4BEN.js} +3 -3
package/dist/index.js
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CompletenessAccumulator,
|
|
3
|
+
CycleSlipAccumulator,
|
|
4
|
+
IonoAccumulator,
|
|
5
|
+
MultipathAccumulator,
|
|
6
|
+
analyzeQuality,
|
|
7
|
+
applyIonoDcb,
|
|
8
|
+
computeIonoRate,
|
|
9
|
+
detrendIonoArcs,
|
|
10
|
+
parseSinexBiasDcb
|
|
11
|
+
} from "./chunk-KUSUN7DP.js";
|
|
1
12
|
import {
|
|
2
13
|
frequencyLabel,
|
|
3
14
|
parseAntex
|
|
@@ -43,6 +54,29 @@ import {
|
|
|
43
54
|
phiBOCs,
|
|
44
55
|
phiBPSK
|
|
45
56
|
} from "./chunk-2K3FCJBX.js";
|
|
57
|
+
import {
|
|
58
|
+
BitReader,
|
|
59
|
+
RTCM3_MESSAGE_NAMES,
|
|
60
|
+
Rtcm3Decoder,
|
|
61
|
+
createStationMeta,
|
|
62
|
+
createStreamStats,
|
|
63
|
+
decodeEphemeris,
|
|
64
|
+
decodeIgsSsr,
|
|
65
|
+
decodeLegacyObs,
|
|
66
|
+
decodeMsmFull,
|
|
67
|
+
decodeSsr,
|
|
68
|
+
decodeSystemParams,
|
|
69
|
+
isSsrMessage,
|
|
70
|
+
msmEpochToDate,
|
|
71
|
+
readString,
|
|
72
|
+
reportDecodeError,
|
|
73
|
+
resetGloFreqCache,
|
|
74
|
+
rtcm3Constellation,
|
|
75
|
+
setGloFreqNumber,
|
|
76
|
+
setRtcm3DebugHandler,
|
|
77
|
+
updateStationMeta,
|
|
78
|
+
updateStreamStats
|
|
79
|
+
} from "./chunk-REULRNJ5.js";
|
|
46
80
|
import {
|
|
47
81
|
parseUbxCnav,
|
|
48
82
|
parseUbxIonoUtc,
|
|
@@ -51,7 +85,7 @@ import {
|
|
|
51
85
|
parseUbxRawNav,
|
|
52
86
|
parseUbxRawx,
|
|
53
87
|
ubxFrames
|
|
54
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-GH7MYXON.js";
|
|
55
89
|
import {
|
|
56
90
|
SBAS_L5_MT_NAMES,
|
|
57
91
|
SBAS_L5_PREAMBLE_UW,
|
|
@@ -78,8 +112,8 @@ import {
|
|
|
78
112
|
sbasL5MessageName,
|
|
79
113
|
sbasL5MessageType,
|
|
80
114
|
scanSbfFrames
|
|
81
|
-
} from "./chunk-
|
|
82
|
-
import "./chunk-
|
|
115
|
+
} from "./chunk-WW3DKCDN.js";
|
|
116
|
+
import "./chunk-3KSDL3CO.js";
|
|
83
117
|
import {
|
|
84
118
|
OEM4_HLEN,
|
|
85
119
|
crc32,
|
|
@@ -87,7 +121,7 @@ import {
|
|
|
87
121
|
parseNovatelNav,
|
|
88
122
|
parseNovatelPvt,
|
|
89
123
|
parseNovatelRange
|
|
90
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-SEYH4BEN.js";
|
|
91
125
|
import {
|
|
92
126
|
parseTrimble,
|
|
93
127
|
parseTrimbleNav,
|
|
@@ -107,17 +141,6 @@ import {
|
|
|
107
141
|
fetchSourcetable,
|
|
108
142
|
parseSourcetable
|
|
109
143
|
} from "./chunk-BJHTBYNG.js";
|
|
110
|
-
import {
|
|
111
|
-
CompletenessAccumulator,
|
|
112
|
-
CycleSlipAccumulator,
|
|
113
|
-
IonoAccumulator,
|
|
114
|
-
MultipathAccumulator,
|
|
115
|
-
analyzeQuality,
|
|
116
|
-
applyIonoDcb,
|
|
117
|
-
computeIonoRate,
|
|
118
|
-
detrendIonoArcs,
|
|
119
|
-
parseSinexBiasDcb
|
|
120
|
-
} from "./chunk-KUSUN7DP.js";
|
|
121
144
|
import {
|
|
122
145
|
Scale,
|
|
123
146
|
getDateFromDayOfWeek,
|
|
@@ -178,7 +201,7 @@ import {
|
|
|
178
201
|
sunEcef,
|
|
179
202
|
toRtkEpoch,
|
|
180
203
|
wlWavelength
|
|
181
|
-
} from "./chunk-
|
|
204
|
+
} from "./chunk-2CMAFEHI.js";
|
|
182
205
|
import "./chunk-WQX354KD.js";
|
|
183
206
|
import {
|
|
184
207
|
almanacEpochMs,
|
|
@@ -200,7 +223,42 @@ import {
|
|
|
200
223
|
navTimesFromEph,
|
|
201
224
|
rangeRate,
|
|
202
225
|
selectEphemeris
|
|
203
|
-
} from "./chunk-
|
|
226
|
+
} from "./chunk-JYWYQ7DW.js";
|
|
227
|
+
import {
|
|
228
|
+
getBdsTime,
|
|
229
|
+
getDateFromBdsTime,
|
|
230
|
+
getDateFromGalTime,
|
|
231
|
+
getDateFromGloN,
|
|
232
|
+
getDateFromGpsData,
|
|
233
|
+
getDateFromGpsTime,
|
|
234
|
+
getDateFromTai,
|
|
235
|
+
getDateFromTt,
|
|
236
|
+
getDateFromUnixTime,
|
|
237
|
+
getDateFromUtc,
|
|
238
|
+
getGalTime,
|
|
239
|
+
getGloN4,
|
|
240
|
+
getGloNA,
|
|
241
|
+
getGpsLeap,
|
|
242
|
+
getGpsTime,
|
|
243
|
+
getHoursFromTimeDifference,
|
|
244
|
+
getLeap,
|
|
245
|
+
getMinutesFromTimeDifference,
|
|
246
|
+
getNtpTime,
|
|
247
|
+
getSecondsFromTimeDifference,
|
|
248
|
+
getTaiDate,
|
|
249
|
+
getTimeDifference,
|
|
250
|
+
getTimeDifferenceFromDays,
|
|
251
|
+
getTimeDifferenceFromHours,
|
|
252
|
+
getTimeDifferenceFromMinutes,
|
|
253
|
+
getTimeDifferenceFromObject,
|
|
254
|
+
getTimeDifferenceFromSeconds,
|
|
255
|
+
getTimeOfWeek,
|
|
256
|
+
getTotalDaysFromTimeDifference,
|
|
257
|
+
getTtDate,
|
|
258
|
+
getUnixTime,
|
|
259
|
+
getUtcDate,
|
|
260
|
+
getWeekNumber
|
|
261
|
+
} from "./chunk-HVXYFUCB.js";
|
|
204
262
|
import {
|
|
205
263
|
deg2dms,
|
|
206
264
|
deg2rad,
|
|
@@ -222,6 +280,31 @@ import {
|
|
|
222
280
|
getEnuDifference
|
|
223
281
|
} from "./chunk-37QNKGTC.js";
|
|
224
282
|
import "./chunk-5S5MONFK.js";
|
|
283
|
+
import {
|
|
284
|
+
DAYS_MJD2000_MJD,
|
|
285
|
+
DAYS_MJD_JULIAN,
|
|
286
|
+
MILLISECONDS_GPS_TAI,
|
|
287
|
+
MILLISECONDS_IN_DAY,
|
|
288
|
+
MILLISECONDS_IN_HOUR,
|
|
289
|
+
MILLISECONDS_IN_MINUTE,
|
|
290
|
+
MILLISECONDS_IN_SECOND,
|
|
291
|
+
MILLISECONDS_IN_WEEK,
|
|
292
|
+
MILLISECONDS_TT_TAI,
|
|
293
|
+
RINEX_CODES,
|
|
294
|
+
SECONDS_IN_DAY,
|
|
295
|
+
SECONDS_IN_HOUR,
|
|
296
|
+
SECONDS_IN_MINUTE,
|
|
297
|
+
SECONDS_IN_WEEK,
|
|
298
|
+
START_BDS_TIME,
|
|
299
|
+
START_GAL_TIME,
|
|
300
|
+
START_GLO_LEAP,
|
|
301
|
+
START_GPS_TIME,
|
|
302
|
+
START_JULIAN_TAI,
|
|
303
|
+
START_MJD_UNIX_SECONDS,
|
|
304
|
+
START_NTP_TIME,
|
|
305
|
+
START_TAI_TIME,
|
|
306
|
+
START_UNIX_TIME
|
|
307
|
+
} from "./chunk-LEEU5OIO.js";
|
|
225
308
|
import {
|
|
226
309
|
WGS84_ECCENTRICITY_SQUARED,
|
|
227
310
|
WGS84_FLATTENING,
|
|
@@ -268,88 +351,6 @@ import {
|
|
|
268
351
|
} from "./chunk-GPEP67TG.js";
|
|
269
352
|
import "./chunk-YUW33VXK.js";
|
|
270
353
|
import "./chunk-V2D5KUKH.js";
|
|
271
|
-
import {
|
|
272
|
-
BitReader,
|
|
273
|
-
RTCM3_MESSAGE_NAMES,
|
|
274
|
-
Rtcm3Decoder,
|
|
275
|
-
createStationMeta,
|
|
276
|
-
createStreamStats,
|
|
277
|
-
decodeEphemeris,
|
|
278
|
-
decodeIgsSsr,
|
|
279
|
-
decodeLegacyObs,
|
|
280
|
-
decodeMsmFull,
|
|
281
|
-
decodeSsr,
|
|
282
|
-
isSsrMessage,
|
|
283
|
-
msmEpochToDate,
|
|
284
|
-
readString,
|
|
285
|
-
reportDecodeError,
|
|
286
|
-
resetGloFreqCache,
|
|
287
|
-
rtcm3Constellation,
|
|
288
|
-
setGloFreqNumber,
|
|
289
|
-
setRtcm3DebugHandler,
|
|
290
|
-
updateStationMeta,
|
|
291
|
-
updateStreamStats
|
|
292
|
-
} from "./chunk-5SQLUGWE.js";
|
|
293
|
-
import {
|
|
294
|
-
getBdsTime,
|
|
295
|
-
getDateFromBdsTime,
|
|
296
|
-
getDateFromGalTime,
|
|
297
|
-
getDateFromGloN,
|
|
298
|
-
getDateFromGpsData,
|
|
299
|
-
getDateFromGpsTime,
|
|
300
|
-
getDateFromTai,
|
|
301
|
-
getDateFromTt,
|
|
302
|
-
getDateFromUnixTime,
|
|
303
|
-
getDateFromUtc,
|
|
304
|
-
getGalTime,
|
|
305
|
-
getGloN4,
|
|
306
|
-
getGloNA,
|
|
307
|
-
getGpsLeap,
|
|
308
|
-
getGpsTime,
|
|
309
|
-
getHoursFromTimeDifference,
|
|
310
|
-
getLeap,
|
|
311
|
-
getMinutesFromTimeDifference,
|
|
312
|
-
getNtpTime,
|
|
313
|
-
getSecondsFromTimeDifference,
|
|
314
|
-
getTaiDate,
|
|
315
|
-
getTimeDifference,
|
|
316
|
-
getTimeDifferenceFromDays,
|
|
317
|
-
getTimeDifferenceFromHours,
|
|
318
|
-
getTimeDifferenceFromMinutes,
|
|
319
|
-
getTimeDifferenceFromObject,
|
|
320
|
-
getTimeDifferenceFromSeconds,
|
|
321
|
-
getTimeOfWeek,
|
|
322
|
-
getTotalDaysFromTimeDifference,
|
|
323
|
-
getTtDate,
|
|
324
|
-
getUnixTime,
|
|
325
|
-
getUtcDate,
|
|
326
|
-
getWeekNumber
|
|
327
|
-
} from "./chunk-HVXYFUCB.js";
|
|
328
|
-
import {
|
|
329
|
-
DAYS_MJD2000_MJD,
|
|
330
|
-
DAYS_MJD_JULIAN,
|
|
331
|
-
MILLISECONDS_GPS_TAI,
|
|
332
|
-
MILLISECONDS_IN_DAY,
|
|
333
|
-
MILLISECONDS_IN_HOUR,
|
|
334
|
-
MILLISECONDS_IN_MINUTE,
|
|
335
|
-
MILLISECONDS_IN_SECOND,
|
|
336
|
-
MILLISECONDS_IN_WEEK,
|
|
337
|
-
MILLISECONDS_TT_TAI,
|
|
338
|
-
RINEX_CODES,
|
|
339
|
-
SECONDS_IN_DAY,
|
|
340
|
-
SECONDS_IN_HOUR,
|
|
341
|
-
SECONDS_IN_MINUTE,
|
|
342
|
-
SECONDS_IN_WEEK,
|
|
343
|
-
START_BDS_TIME,
|
|
344
|
-
START_GAL_TIME,
|
|
345
|
-
START_GLO_LEAP,
|
|
346
|
-
START_GPS_TIME,
|
|
347
|
-
START_JULIAN_TAI,
|
|
348
|
-
START_MJD_UNIX_SECONDS,
|
|
349
|
-
START_NTP_TIME,
|
|
350
|
-
START_TAI_TIME,
|
|
351
|
-
START_UNIX_TIME
|
|
352
|
-
} from "./chunk-LEEU5OIO.js";
|
|
353
354
|
import {
|
|
354
355
|
ARC_GAP_FACTOR,
|
|
355
356
|
BAND_LABELS,
|
|
@@ -373,6 +374,16 @@ import {
|
|
|
373
374
|
getFreq,
|
|
374
375
|
gloFreq
|
|
375
376
|
} from "./chunk-FIEWO4J4.js";
|
|
377
|
+
import {
|
|
378
|
+
RTCM2_MESSAGE_NAMES,
|
|
379
|
+
Rtcm2Decoder,
|
|
380
|
+
looksLikeRtcm2,
|
|
381
|
+
rtcm2Dgps,
|
|
382
|
+
rtcm2Observation,
|
|
383
|
+
rtcm2Station,
|
|
384
|
+
rtcm2Text,
|
|
385
|
+
rtcm2Time
|
|
386
|
+
} from "./chunk-S624C5AC.js";
|
|
376
387
|
export {
|
|
377
388
|
ARC_GAP_FACTOR,
|
|
378
389
|
BAND_LABELS,
|
|
@@ -435,7 +446,9 @@ export {
|
|
|
435
446
|
OMEGA_E,
|
|
436
447
|
REFERENCE_FRAMES,
|
|
437
448
|
RINEX_CODES,
|
|
449
|
+
RTCM2_MESSAGE_NAMES,
|
|
438
450
|
RTCM3_MESSAGE_NAMES,
|
|
451
|
+
Rtcm2Decoder,
|
|
439
452
|
Rtcm3Decoder,
|
|
440
453
|
RtkFloatEngine,
|
|
441
454
|
SBAS_L5_MT_NAMES,
|
|
@@ -503,6 +516,7 @@ export {
|
|
|
503
516
|
decodeMsmFull,
|
|
504
517
|
decodeSbfNavigation,
|
|
505
518
|
decodeSsr,
|
|
519
|
+
decodeSystemParams,
|
|
506
520
|
deg2dms,
|
|
507
521
|
deg2rad,
|
|
508
522
|
detrendIonoArcs,
|
|
@@ -600,6 +614,7 @@ export {
|
|
|
600
614
|
klobucharDelay,
|
|
601
615
|
lambdaReduction,
|
|
602
616
|
lambdaSearch,
|
|
617
|
+
looksLikeRtcm2,
|
|
603
618
|
maskRadForAzimuth,
|
|
604
619
|
moonEcef,
|
|
605
620
|
msmEpochToDate,
|
|
@@ -659,6 +674,11 @@ export {
|
|
|
659
674
|
resetGloFreqCache,
|
|
660
675
|
resolvePppAmbiguities,
|
|
661
676
|
rhumbLine,
|
|
677
|
+
rtcm2Dgps,
|
|
678
|
+
rtcm2Observation,
|
|
679
|
+
rtcm2Station,
|
|
680
|
+
rtcm2Text,
|
|
681
|
+
rtcm2Time,
|
|
662
682
|
rtcm3Constellation,
|
|
663
683
|
satClockCorrection,
|
|
664
684
|
sbasIonoDeg,
|
package/dist/novatel.js
CHANGED
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
parseNovatelNav,
|
|
6
6
|
parseNovatelPvt,
|
|
7
7
|
parseNovatelRange
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-SEYH4BEN.js";
|
|
9
9
|
import "./chunk-WQX354KD.js";
|
|
10
|
-
import "./chunk-YUW33VXK.js";
|
|
11
|
-
import "./chunk-V2D5KUKH.js";
|
|
12
10
|
import "./chunk-HVXYFUCB.js";
|
|
13
11
|
import "./chunk-LEEU5OIO.js";
|
|
12
|
+
import "./chunk-YUW33VXK.js";
|
|
13
|
+
import "./chunk-V2D5KUKH.js";
|
|
14
14
|
export {
|
|
15
15
|
OEM4_HLEN,
|
|
16
16
|
crc32,
|
package/dist/orbit.js
CHANGED
|
@@ -18,14 +18,14 @@ import {
|
|
|
18
18
|
navTimesFromEph,
|
|
19
19
|
rangeRate,
|
|
20
20
|
selectEphemeris
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-JYWYQ7DW.js";
|
|
22
|
+
import "./chunk-HVXYFUCB.js";
|
|
22
23
|
import {
|
|
23
24
|
ecefToGeodetic,
|
|
24
25
|
geodeticToEcef
|
|
25
26
|
} from "./chunk-37QNKGTC.js";
|
|
26
|
-
import "./chunk-6FAL6P4G.js";
|
|
27
|
-
import "./chunk-HVXYFUCB.js";
|
|
28
27
|
import "./chunk-LEEU5OIO.js";
|
|
28
|
+
import "./chunk-6FAL6P4G.js";
|
|
29
29
|
import "./chunk-FIEWO4J4.js";
|
|
30
30
|
export {
|
|
31
31
|
almanacEpochMs,
|
package/dist/positioning.js
CHANGED
|
@@ -32,17 +32,17 @@ import {
|
|
|
32
32
|
sunEcef,
|
|
33
33
|
toRtkEpoch,
|
|
34
34
|
wlWavelength
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-2CMAFEHI.js";
|
|
36
36
|
import "./chunk-WQX354KD.js";
|
|
37
|
-
import "./chunk-
|
|
37
|
+
import "./chunk-JYWYQ7DW.js";
|
|
38
|
+
import "./chunk-HVXYFUCB.js";
|
|
38
39
|
import "./chunk-MIIM4LDY.js";
|
|
39
40
|
import "./chunk-37QNKGTC.js";
|
|
41
|
+
import "./chunk-LEEU5OIO.js";
|
|
40
42
|
import "./chunk-6FAL6P4G.js";
|
|
41
43
|
import "./chunk-GPEP67TG.js";
|
|
42
44
|
import "./chunk-YUW33VXK.js";
|
|
43
45
|
import "./chunk-V2D5KUKH.js";
|
|
44
|
-
import "./chunk-HVXYFUCB.js";
|
|
45
|
-
import "./chunk-LEEU5OIO.js";
|
|
46
46
|
import "./chunk-FIEWO4J4.js";
|
|
47
47
|
export {
|
|
48
48
|
IONO_L1_M_PER_TECU,
|
package/dist/rtcm2.cjs
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/rtcm2/index.ts
|
|
21
|
+
var rtcm2_exports = {};
|
|
22
|
+
__export(rtcm2_exports, {
|
|
23
|
+
RTCM2_MESSAGE_NAMES: () => RTCM2_MESSAGE_NAMES,
|
|
24
|
+
Rtcm2Decoder: () => Rtcm2Decoder,
|
|
25
|
+
looksLikeRtcm2: () => looksLikeRtcm2,
|
|
26
|
+
rtcm2Dgps: () => rtcm2Dgps,
|
|
27
|
+
rtcm2Observation: () => rtcm2Observation,
|
|
28
|
+
rtcm2Station: () => rtcm2Station,
|
|
29
|
+
rtcm2Text: () => rtcm2Text,
|
|
30
|
+
rtcm2Time: () => rtcm2Time
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(rtcm2_exports);
|
|
33
|
+
var RTCM2_PREAMBLE = 102;
|
|
34
|
+
var HAMMING = [
|
|
35
|
+
3139384448,
|
|
36
|
+
1569692224,
|
|
37
|
+
2932329728,
|
|
38
|
+
1466164864,
|
|
39
|
+
1806824256,
|
|
40
|
+
2340063680
|
|
41
|
+
];
|
|
42
|
+
function getbitu(buff, pos, len) {
|
|
43
|
+
let v = 0;
|
|
44
|
+
for (let i = pos; i < pos + len; i++)
|
|
45
|
+
v = v * 2 + (buff[i >> 3] >> 7 - (i & 7) & 1);
|
|
46
|
+
return v >>> 0;
|
|
47
|
+
}
|
|
48
|
+
function getbits(buff, pos, len) {
|
|
49
|
+
const v = getbitu(buff, pos, len);
|
|
50
|
+
return v & 1 << len - 1 ? v - 2 ** len : v;
|
|
51
|
+
}
|
|
52
|
+
function decodeWord(w) {
|
|
53
|
+
let word = w >>> 0;
|
|
54
|
+
if (word & 1073741824) word = (word ^ 1073741760) >>> 0;
|
|
55
|
+
let parity = 0;
|
|
56
|
+
for (let i = 0; i < 6; i++) {
|
|
57
|
+
parity <<= 1;
|
|
58
|
+
let x = (word & HAMMING[i]) >>> 6;
|
|
59
|
+
while (x) {
|
|
60
|
+
parity ^= x & 1;
|
|
61
|
+
x >>>= 1;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (parity >>> 0 !== (word & 63)) return null;
|
|
65
|
+
return [word >>> 22 & 255, word >>> 14 & 255, word >>> 6 & 255];
|
|
66
|
+
}
|
|
67
|
+
var Rtcm2Decoder = class {
|
|
68
|
+
word = 0;
|
|
69
|
+
nbyte = 0;
|
|
70
|
+
nbit = 0;
|
|
71
|
+
len = 0;
|
|
72
|
+
buff = new Uint8Array(256);
|
|
73
|
+
/** Reset the framer (e.g. after a stream reconnect). */
|
|
74
|
+
reset() {
|
|
75
|
+
this.word = 0;
|
|
76
|
+
this.nbyte = 0;
|
|
77
|
+
this.nbit = 0;
|
|
78
|
+
this.len = 0;
|
|
79
|
+
}
|
|
80
|
+
decode(bytes) {
|
|
81
|
+
const frames = [];
|
|
82
|
+
for (const raw of bytes) {
|
|
83
|
+
if ((raw & 192) !== 64) continue;
|
|
84
|
+
let data = raw;
|
|
85
|
+
for (let i = 0; i < 6; i++, data >>= 1) {
|
|
86
|
+
this.word = (this.word << 1 | data & 1) >>> 0;
|
|
87
|
+
if (this.nbyte === 0) {
|
|
88
|
+
let preamb = this.word >>> 22 & 255;
|
|
89
|
+
if (this.word & 1073741824) preamb ^= 255;
|
|
90
|
+
if (preamb !== RTCM2_PREAMBLE) continue;
|
|
91
|
+
const d2 = decodeWord(this.word);
|
|
92
|
+
if (!d2) continue;
|
|
93
|
+
this.buff[0] = d2[0];
|
|
94
|
+
this.buff[1] = d2[1];
|
|
95
|
+
this.buff[2] = d2[2];
|
|
96
|
+
this.nbyte = 3;
|
|
97
|
+
this.nbit = 0;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (++this.nbit < 30) continue;
|
|
101
|
+
this.nbit = 0;
|
|
102
|
+
const d = decodeWord(this.word);
|
|
103
|
+
if (!d) {
|
|
104
|
+
this.nbyte = 0;
|
|
105
|
+
this.word &= 3;
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
this.buff[this.nbyte] = d[0];
|
|
109
|
+
this.buff[this.nbyte + 1] = d[1];
|
|
110
|
+
this.buff[this.nbyte + 2] = d[2];
|
|
111
|
+
this.nbyte += 3;
|
|
112
|
+
if (this.nbyte === 6) this.len = (this.buff[5] >> 3) * 3 + 6;
|
|
113
|
+
if (this.nbyte < this.len) continue;
|
|
114
|
+
frames.push(this.readHeader(this.buff.slice(0, this.len)));
|
|
115
|
+
this.nbyte = 0;
|
|
116
|
+
this.word &= 3;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return frames;
|
|
120
|
+
}
|
|
121
|
+
readHeader(payload) {
|
|
122
|
+
return {
|
|
123
|
+
messageType: getbitu(payload, 8, 6),
|
|
124
|
+
stationId: getbitu(payload, 14, 10),
|
|
125
|
+
zcountSec: getbitu(payload, 24, 13) * 0.6,
|
|
126
|
+
sequenceNo: getbitu(payload, 37, 3),
|
|
127
|
+
lengthWords: payload[5] >> 3,
|
|
128
|
+
health: getbitu(payload, 45, 3),
|
|
129
|
+
payload
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
function rtcm2Station(frame) {
|
|
134
|
+
const p = frame.payload;
|
|
135
|
+
const nbit = frame.lengthWords * 24;
|
|
136
|
+
if (frame.messageType === 3) {
|
|
137
|
+
if (nbit < 96) return null;
|
|
138
|
+
return {
|
|
139
|
+
position: [
|
|
140
|
+
getbits(p, 48, 32) * 0.01,
|
|
141
|
+
getbits(p, 80, 32) * 0.01,
|
|
142
|
+
getbits(p, 112, 32) * 0.01
|
|
143
|
+
]
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
if (frame.messageType === 22) {
|
|
147
|
+
if (nbit < 24) return null;
|
|
148
|
+
const l1 = [
|
|
149
|
+
getbits(p, 48, 8) / 25600,
|
|
150
|
+
getbits(p, 56, 8) / 25600,
|
|
151
|
+
getbits(p, 64, 8) / 25600
|
|
152
|
+
];
|
|
153
|
+
let height;
|
|
154
|
+
if (nbit >= 48) {
|
|
155
|
+
const noh = getbits(p, 48 + 24 + 5, 1);
|
|
156
|
+
height = noh ? 0 : getbitu(p, 48 + 24 + 6, 18) / 25600;
|
|
157
|
+
}
|
|
158
|
+
return { l1Offset: l1, height };
|
|
159
|
+
}
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
function rtcm2Observation(frame) {
|
|
163
|
+
const t = frame.messageType;
|
|
164
|
+
if (t !== 18 && t !== 19) return null;
|
|
165
|
+
const p = frame.payload;
|
|
166
|
+
const nbit = frame.lengthWords * 24 + 48;
|
|
167
|
+
let i = 48;
|
|
168
|
+
if (i + 24 > nbit) return null;
|
|
169
|
+
const fRaw = getbitu(p, i, 2);
|
|
170
|
+
i += 4;
|
|
171
|
+
const microSec = getbitu(p, i, 20);
|
|
172
|
+
i += 20;
|
|
173
|
+
if (fRaw & 1) return null;
|
|
174
|
+
const freq = fRaw >> 1;
|
|
175
|
+
let sync = false;
|
|
176
|
+
const records = [];
|
|
177
|
+
while (i + 48 <= nbit) {
|
|
178
|
+
sync = getbitu(p, i, 1) === 1;
|
|
179
|
+
i += 1;
|
|
180
|
+
const code = getbitu(p, i, 1);
|
|
181
|
+
i += 1;
|
|
182
|
+
const sys = getbitu(p, i, 1);
|
|
183
|
+
i += 1;
|
|
184
|
+
let prn = getbitu(p, i, 5);
|
|
185
|
+
i += 5;
|
|
186
|
+
let loss;
|
|
187
|
+
if (t === 18) {
|
|
188
|
+
i += 3;
|
|
189
|
+
loss = getbitu(p, i, 5);
|
|
190
|
+
i += 5;
|
|
191
|
+
} else {
|
|
192
|
+
i += 8;
|
|
193
|
+
}
|
|
194
|
+
const val = t === 18 ? getbits(p, i, 32) : getbitu(p, i, 32);
|
|
195
|
+
i += 32;
|
|
196
|
+
if (prn === 0) prn = 32;
|
|
197
|
+
const system = sys ? "R" : "G";
|
|
198
|
+
const rec = {
|
|
199
|
+
prn: `${system}${String(prn).padStart(2, "0")}`,
|
|
200
|
+
system,
|
|
201
|
+
freq,
|
|
202
|
+
code: code ? "P" : "C/A",
|
|
203
|
+
lossOfLock: loss
|
|
204
|
+
};
|
|
205
|
+
if (t === 18)
|
|
206
|
+
rec.phaseCycles = -val / 256;
|
|
207
|
+
else rec.pseudorangeM = val * 0.02;
|
|
208
|
+
records.push(rec);
|
|
209
|
+
}
|
|
210
|
+
return { freq, sync, microSec, records };
|
|
211
|
+
}
|
|
212
|
+
function rtcm2Dgps(frame) {
|
|
213
|
+
const t = frame.messageType;
|
|
214
|
+
if (t !== 1 && t !== 9 && t !== 31) return null;
|
|
215
|
+
const system = t === 31 ? "R" : "G";
|
|
216
|
+
const p = frame.payload;
|
|
217
|
+
const nbit = frame.lengthWords * 24 + 48;
|
|
218
|
+
let i = 48;
|
|
219
|
+
const corrections = [];
|
|
220
|
+
while (i + 40 <= nbit) {
|
|
221
|
+
const fact = getbitu(p, i, 1);
|
|
222
|
+
i += 1;
|
|
223
|
+
const udre = getbitu(p, i, 2);
|
|
224
|
+
i += 2;
|
|
225
|
+
let prn = getbitu(p, i, 5);
|
|
226
|
+
i += 5;
|
|
227
|
+
const prc = getbits(p, i, 16);
|
|
228
|
+
i += 16;
|
|
229
|
+
const rrc = getbits(p, i, 8);
|
|
230
|
+
i += 8;
|
|
231
|
+
const iod = getbits(p, i, 8);
|
|
232
|
+
i += 8;
|
|
233
|
+
if (prn === 0) prn = 32;
|
|
234
|
+
corrections.push({
|
|
235
|
+
prn: `${system}${String(prn).padStart(2, "0")}`,
|
|
236
|
+
prc: prc * (fact ? 0.32 : 0.02),
|
|
237
|
+
rrc: rrc * (fact ? 0.032 : 2e-3),
|
|
238
|
+
iod,
|
|
239
|
+
udre
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
return { system, corrections };
|
|
243
|
+
}
|
|
244
|
+
function rtcm2Time(frame) {
|
|
245
|
+
if (frame.messageType !== 14) return null;
|
|
246
|
+
const p = frame.payload;
|
|
247
|
+
if (frame.lengthWords * 24 < 24) return null;
|
|
248
|
+
return {
|
|
249
|
+
zcountSec: getbitu(p, 24, 13) * 0.6,
|
|
250
|
+
week: getbitu(p, 48, 10),
|
|
251
|
+
hour: getbitu(p, 58, 8),
|
|
252
|
+
leapSeconds: getbitu(p, 66, 6)
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
function rtcm2Text(frame) {
|
|
256
|
+
if (frame.messageType !== 16) return null;
|
|
257
|
+
const p = frame.payload;
|
|
258
|
+
const nbit = frame.lengthWords * 24 + 48;
|
|
259
|
+
let s = "";
|
|
260
|
+
for (let i = 48; i + 8 <= nbit; i += 8) {
|
|
261
|
+
const c = getbitu(p, i, 8);
|
|
262
|
+
if (c === 0) break;
|
|
263
|
+
s += String.fromCharCode(c);
|
|
264
|
+
}
|
|
265
|
+
return s;
|
|
266
|
+
}
|
|
267
|
+
var RTCM2_MESSAGE_NAMES = {
|
|
268
|
+
1: "GPS differential corrections",
|
|
269
|
+
3: "Reference station parameters (ARP)",
|
|
270
|
+
9: "GPS partial correction set",
|
|
271
|
+
14: "GPS time of week",
|
|
272
|
+
16: "GPS special message (text)",
|
|
273
|
+
17: "GPS ephemerides",
|
|
274
|
+
18: "RTK uncorrected carrier phase",
|
|
275
|
+
19: "RTK uncorrected pseudorange",
|
|
276
|
+
22: "Extended reference station parameters",
|
|
277
|
+
23: "Antenna type definition",
|
|
278
|
+
24: "Antenna reference point (ARP)",
|
|
279
|
+
31: "GLONASS differential corrections",
|
|
280
|
+
32: "GLONASS reference station parameters",
|
|
281
|
+
34: "GLONASS partial correction set",
|
|
282
|
+
36: "GLONASS special message"
|
|
283
|
+
};
|
|
284
|
+
function looksLikeRtcm2(bytes) {
|
|
285
|
+
const n = Math.min(bytes.length, 4096);
|
|
286
|
+
if (n < 12) return false;
|
|
287
|
+
for (let i = 0; i < n; i++) if ((bytes[i] & 192) !== 64) return false;
|
|
288
|
+
return new Rtcm2Decoder().decode(bytes.subarray(0, n)).length >= 2;
|
|
289
|
+
}
|
|
290
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
291
|
+
0 && (module.exports = {
|
|
292
|
+
RTCM2_MESSAGE_NAMES,
|
|
293
|
+
Rtcm2Decoder,
|
|
294
|
+
looksLikeRtcm2,
|
|
295
|
+
rtcm2Dgps,
|
|
296
|
+
rtcm2Observation,
|
|
297
|
+
rtcm2Station,
|
|
298
|
+
rtcm2Text,
|
|
299
|
+
rtcm2Time
|
|
300
|
+
});
|