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.
@@ -0,0 +1,116 @@
1
+ /**
2
+ * RTCM 2.x decoder (RTCM 10402.3). A wholly different wire format from RTCM3:
3
+ * a stream of 30-bit GPS-style words (24 data + 6 parity bits), each carried in
4
+ * the low 6 bits of successive bytes ("6-of-8" — every byte has its top two
5
+ * bits set to 01, so 0x40–0x7F). Words are parity-checked and their D30* bit
6
+ * inverts the following data, exactly like the GPS LNAV navigation message.
7
+ *
8
+ * Framing/parity are a faithful port of RTKLIB `input_rtcm2` + `decode_word`.
9
+ * {@link Rtcm2Decoder.decode} strips the encoding, parity-checks, syncs on the
10
+ * 0x66 preamble and returns the message frames (header + the packed 24-bit-word
11
+ * body); the per-type body decoders (`rtcm2Station`, `rtcm2Observation`,
12
+ * `rtcm2Dgps`, `rtcm2Time`, `rtcm2Text`) read that body.
13
+ *
14
+ * Nearly extinct in favour of RTCM3, but still broadcast by some legacy CORS.
15
+ */
16
+ /** One decoded RTCM 2.x message frame (header + packed 24-bit-word body). */
17
+ interface Rtcm2Frame {
18
+ messageType: number;
19
+ stationId: number;
20
+ /** Modified Z-count, seconds within the hour (0–3599.4). */
21
+ zcountSec: number;
22
+ sequenceNo: number;
23
+ /** Station health (3-bit). */
24
+ health: number;
25
+ /** Number of 24-bit data words after the 2-word header. */
26
+ lengthWords: number;
27
+ /** The parity-stripped message: header + data words, 24 bits per word packed
28
+ * MSB-first into bytes (message type at bit 8, body from bit 48). */
29
+ payload: Uint8Array;
30
+ }
31
+ /**
32
+ * Streaming RTCM 2.x framer. Feed bytes; get back complete, parity-valid
33
+ * message frames. Retains partial-word state across calls.
34
+ */
35
+ declare class Rtcm2Decoder {
36
+ private word;
37
+ private nbyte;
38
+ private nbit;
39
+ private len;
40
+ private buff;
41
+ /** Reset the framer (e.g. after a stream reconnect). */
42
+ reset(): void;
43
+ decode(bytes: Uint8Array): Rtcm2Frame[];
44
+ private readHeader;
45
+ }
46
+ /** Reference-station coordinates from Type 3 (ARP) or Type 22 (extension). */
47
+ interface Rtcm2Station {
48
+ /** ECEF position (m) — Type 3. */
49
+ position?: [number, number, number];
50
+ /** L1 phase-centre → ARP offset (m) — Type 22. */
51
+ l1Offset?: [number, number, number];
52
+ /** Antenna height above the monument (m) — Type 22. */
53
+ height?: number;
54
+ }
55
+ /** Decode Type 3 (reference station ARP) or Type 22 (extended parameters). */
56
+ declare function rtcm2Station(frame: Rtcm2Frame): Rtcm2Station | null;
57
+ /** One raw observation record from a Type 18/19 message. */
58
+ interface Rtcm2ObsRecord {
59
+ prn: string;
60
+ system: 'G' | 'R';
61
+ /** Frequency: 0 = L1, 1 = L2. */
62
+ freq: number;
63
+ code: 'C/A' | 'P';
64
+ /** Carrier phase (cycles) — Type 18. */
65
+ phaseCycles?: number;
66
+ /** Pseudorange (m) — Type 19. */
67
+ pseudorangeM?: number;
68
+ /** Loss-of-lock indicator (Type 18). */
69
+ lossOfLock?: number;
70
+ }
71
+ /** Decode a Type 18 (carrier phase) or Type 19 (pseudorange) message into its
72
+ * per-satellite records. Returns the frequency, the multiple-message sync flag
73
+ * and the records; the caller pairs 18+19 across an epoch to form observations.
74
+ * Returns null for other types or an L2-frequency variant we don't map. */
75
+ declare function rtcm2Observation(frame: Rtcm2Frame): {
76
+ freq: number;
77
+ sync: boolean;
78
+ microSec: number;
79
+ records: Rtcm2ObsRecord[];
80
+ } | null;
81
+ /** One differential correction from a Type 1/9 (GPS) or Type 31 (GLONASS). */
82
+ interface Rtcm2Correction {
83
+ prn: string;
84
+ /** Pseudorange correction (m). */
85
+ prc: number;
86
+ /** Range-rate correction (m/s). */
87
+ rrc: number;
88
+ /** Issue of data. */
89
+ iod: number;
90
+ /** UDRE scale index (0–3). */
91
+ udre: number;
92
+ }
93
+ /** Decode differential corrections — Type 1/9 (GPS) or Type 31 (GLONASS). */
94
+ declare function rtcm2Dgps(frame: Rtcm2Frame): {
95
+ system: 'G' | 'R';
96
+ corrections: Rtcm2Correction[];
97
+ } | null;
98
+ /** Decode Type 14 — GPS time of week (week/hour + leap seconds). */
99
+ declare function rtcm2Time(frame: Rtcm2Frame): {
100
+ week: number;
101
+ hour: number;
102
+ zcountSec: number;
103
+ leapSeconds: number;
104
+ } | null;
105
+ /** Decode Type 16 — GPS special (ASCII text) message. */
106
+ declare function rtcm2Text(frame: Rtcm2Frame): string | null;
107
+ /** RTCM 2.x message-type names for the census/inspector. */
108
+ declare const RTCM2_MESSAGE_NAMES: Record<number, string>;
109
+ /**
110
+ * Heuristic: does this buffer look like an RTCM 2.x stream? Every byte must be
111
+ * 6-of-8 (top two bits 01), and the framer must extract at least two
112
+ * parity-valid frames from the head.
113
+ */
114
+ declare function looksLikeRtcm2(bytes: Uint8Array): boolean;
115
+
116
+ export { RTCM2_MESSAGE_NAMES, type Rtcm2Correction, Rtcm2Decoder, type Rtcm2Frame, type Rtcm2ObsRecord, type Rtcm2Station, looksLikeRtcm2, rtcm2Dgps, rtcm2Observation, rtcm2Station, rtcm2Text, rtcm2Time };
@@ -0,0 +1,116 @@
1
+ /**
2
+ * RTCM 2.x decoder (RTCM 10402.3). A wholly different wire format from RTCM3:
3
+ * a stream of 30-bit GPS-style words (24 data + 6 parity bits), each carried in
4
+ * the low 6 bits of successive bytes ("6-of-8" — every byte has its top two
5
+ * bits set to 01, so 0x40–0x7F). Words are parity-checked and their D30* bit
6
+ * inverts the following data, exactly like the GPS LNAV navigation message.
7
+ *
8
+ * Framing/parity are a faithful port of RTKLIB `input_rtcm2` + `decode_word`.
9
+ * {@link Rtcm2Decoder.decode} strips the encoding, parity-checks, syncs on the
10
+ * 0x66 preamble and returns the message frames (header + the packed 24-bit-word
11
+ * body); the per-type body decoders (`rtcm2Station`, `rtcm2Observation`,
12
+ * `rtcm2Dgps`, `rtcm2Time`, `rtcm2Text`) read that body.
13
+ *
14
+ * Nearly extinct in favour of RTCM3, but still broadcast by some legacy CORS.
15
+ */
16
+ /** One decoded RTCM 2.x message frame (header + packed 24-bit-word body). */
17
+ interface Rtcm2Frame {
18
+ messageType: number;
19
+ stationId: number;
20
+ /** Modified Z-count, seconds within the hour (0–3599.4). */
21
+ zcountSec: number;
22
+ sequenceNo: number;
23
+ /** Station health (3-bit). */
24
+ health: number;
25
+ /** Number of 24-bit data words after the 2-word header. */
26
+ lengthWords: number;
27
+ /** The parity-stripped message: header + data words, 24 bits per word packed
28
+ * MSB-first into bytes (message type at bit 8, body from bit 48). */
29
+ payload: Uint8Array;
30
+ }
31
+ /**
32
+ * Streaming RTCM 2.x framer. Feed bytes; get back complete, parity-valid
33
+ * message frames. Retains partial-word state across calls.
34
+ */
35
+ declare class Rtcm2Decoder {
36
+ private word;
37
+ private nbyte;
38
+ private nbit;
39
+ private len;
40
+ private buff;
41
+ /** Reset the framer (e.g. after a stream reconnect). */
42
+ reset(): void;
43
+ decode(bytes: Uint8Array): Rtcm2Frame[];
44
+ private readHeader;
45
+ }
46
+ /** Reference-station coordinates from Type 3 (ARP) or Type 22 (extension). */
47
+ interface Rtcm2Station {
48
+ /** ECEF position (m) — Type 3. */
49
+ position?: [number, number, number];
50
+ /** L1 phase-centre → ARP offset (m) — Type 22. */
51
+ l1Offset?: [number, number, number];
52
+ /** Antenna height above the monument (m) — Type 22. */
53
+ height?: number;
54
+ }
55
+ /** Decode Type 3 (reference station ARP) or Type 22 (extended parameters). */
56
+ declare function rtcm2Station(frame: Rtcm2Frame): Rtcm2Station | null;
57
+ /** One raw observation record from a Type 18/19 message. */
58
+ interface Rtcm2ObsRecord {
59
+ prn: string;
60
+ system: 'G' | 'R';
61
+ /** Frequency: 0 = L1, 1 = L2. */
62
+ freq: number;
63
+ code: 'C/A' | 'P';
64
+ /** Carrier phase (cycles) — Type 18. */
65
+ phaseCycles?: number;
66
+ /** Pseudorange (m) — Type 19. */
67
+ pseudorangeM?: number;
68
+ /** Loss-of-lock indicator (Type 18). */
69
+ lossOfLock?: number;
70
+ }
71
+ /** Decode a Type 18 (carrier phase) or Type 19 (pseudorange) message into its
72
+ * per-satellite records. Returns the frequency, the multiple-message sync flag
73
+ * and the records; the caller pairs 18+19 across an epoch to form observations.
74
+ * Returns null for other types or an L2-frequency variant we don't map. */
75
+ declare function rtcm2Observation(frame: Rtcm2Frame): {
76
+ freq: number;
77
+ sync: boolean;
78
+ microSec: number;
79
+ records: Rtcm2ObsRecord[];
80
+ } | null;
81
+ /** One differential correction from a Type 1/9 (GPS) or Type 31 (GLONASS). */
82
+ interface Rtcm2Correction {
83
+ prn: string;
84
+ /** Pseudorange correction (m). */
85
+ prc: number;
86
+ /** Range-rate correction (m/s). */
87
+ rrc: number;
88
+ /** Issue of data. */
89
+ iod: number;
90
+ /** UDRE scale index (0–3). */
91
+ udre: number;
92
+ }
93
+ /** Decode differential corrections — Type 1/9 (GPS) or Type 31 (GLONASS). */
94
+ declare function rtcm2Dgps(frame: Rtcm2Frame): {
95
+ system: 'G' | 'R';
96
+ corrections: Rtcm2Correction[];
97
+ } | null;
98
+ /** Decode Type 14 — GPS time of week (week/hour + leap seconds). */
99
+ declare function rtcm2Time(frame: Rtcm2Frame): {
100
+ week: number;
101
+ hour: number;
102
+ zcountSec: number;
103
+ leapSeconds: number;
104
+ } | null;
105
+ /** Decode Type 16 — GPS special (ASCII text) message. */
106
+ declare function rtcm2Text(frame: Rtcm2Frame): string | null;
107
+ /** RTCM 2.x message-type names for the census/inspector. */
108
+ declare const RTCM2_MESSAGE_NAMES: Record<number, string>;
109
+ /**
110
+ * Heuristic: does this buffer look like an RTCM 2.x stream? Every byte must be
111
+ * 6-of-8 (top two bits 01), and the framer must extract at least two
112
+ * parity-valid frames from the head.
113
+ */
114
+ declare function looksLikeRtcm2(bytes: Uint8Array): boolean;
115
+
116
+ export { RTCM2_MESSAGE_NAMES, type Rtcm2Correction, Rtcm2Decoder, type Rtcm2Frame, type Rtcm2ObsRecord, type Rtcm2Station, looksLikeRtcm2, rtcm2Dgps, rtcm2Observation, rtcm2Station, rtcm2Text, rtcm2Time };
package/dist/rtcm2.js ADDED
@@ -0,0 +1,20 @@
1
+ import {
2
+ RTCM2_MESSAGE_NAMES,
3
+ Rtcm2Decoder,
4
+ looksLikeRtcm2,
5
+ rtcm2Dgps,
6
+ rtcm2Observation,
7
+ rtcm2Station,
8
+ rtcm2Text,
9
+ rtcm2Time
10
+ } from "./chunk-S624C5AC.js";
11
+ export {
12
+ RTCM2_MESSAGE_NAMES,
13
+ Rtcm2Decoder,
14
+ looksLikeRtcm2,
15
+ rtcm2Dgps,
16
+ rtcm2Observation,
17
+ rtcm2Station,
18
+ rtcm2Text,
19
+ rtcm2Time
20
+ };
package/dist/sbf.js CHANGED
@@ -24,15 +24,15 @@ import {
24
24
  sbasL5MessageName,
25
25
  sbasL5MessageType,
26
26
  scanSbfFrames
27
- } from "./chunk-UHLUAU6H.js";
28
- import "./chunk-FA2UTLEQ.js";
27
+ } from "./chunk-WW3DKCDN.js";
28
+ import "./chunk-3KSDL3CO.js";
29
29
  import "./chunk-WQX354KD.js";
30
+ import "./chunk-HVXYFUCB.js";
30
31
  import "./chunk-37QNKGTC.js";
32
+ import "./chunk-LEEU5OIO.js";
31
33
  import "./chunk-6FAL6P4G.js";
32
34
  import "./chunk-YUW33VXK.js";
33
35
  import "./chunk-V2D5KUKH.js";
34
- import "./chunk-HVXYFUCB.js";
35
- import "./chunk-LEEU5OIO.js";
36
36
  export {
37
37
  SBAS_L5_MT_NAMES,
38
38
  SBAS_L5_PREAMBLE_UW,
package/dist/ubx.js CHANGED
@@ -6,13 +6,13 @@ import {
6
6
  parseUbxRawNav,
7
7
  parseUbxRawx,
8
8
  ubxFrames
9
- } from "./chunk-MRC6LIPM.js";
10
- import "./chunk-FA2UTLEQ.js";
9
+ } from "./chunk-GH7MYXON.js";
10
+ import "./chunk-3KSDL3CO.js";
11
11
  import "./chunk-WQX354KD.js";
12
- import "./chunk-YUW33VXK.js";
13
- import "./chunk-V2D5KUKH.js";
14
12
  import "./chunk-HVXYFUCB.js";
15
13
  import "./chunk-LEEU5OIO.js";
14
+ import "./chunk-YUW33VXK.js";
15
+ import "./chunk-V2D5KUKH.js";
16
16
  export {
17
17
  parseUbxCnav,
18
18
  parseUbxIonoUtc,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gnss-js",
3
- "version": "1.65.0",
3
+ "version": "1.66.0",
4
4
  "description": "Comprehensive GNSS library for JavaScript — time scales, coordinates, RINEX parsing, RTCM3 decoding, orbit computation, and signal analysis",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -55,6 +55,11 @@
55
55
  "import": "./dist/binex.js",
56
56
  "require": "./dist/binex.cjs"
57
57
  },
58
+ "./rtcm2": {
59
+ "types": "./dist/rtcm2.d.ts",
60
+ "import": "./dist/rtcm2.js",
61
+ "require": "./dist/rtcm2.cjs"
62
+ },
58
63
  "./rtcm3": {
59
64
  "types": "./dist/rtcm3.d.ts",
60
65
  "import": "./dist/rtcm3.js",
@@ -1,3 +1,6 @@
1
+ import {
2
+ getUtcDate
3
+ } from "./chunk-HVXYFUCB.js";
1
4
  import {
2
5
  crc24q
3
6
  } from "./chunk-YUW33VXK.js";
@@ -6,9 +9,6 @@ import {
6
9
  getBitS,
7
10
  getBitU
8
11
  } from "./chunk-V2D5KUKH.js";
9
- import {
10
- getUtcDate
11
- } from "./chunk-HVXYFUCB.js";
12
12
 
13
13
  // src/navbits/bds.ts
14
14
  var BDT_EPOCH_MS = Date.UTC(2006, 0, 1);
@@ -1,9 +1,9 @@
1
- import {
2
- ecefToGeodetic
3
- } from "./chunk-37QNKGTC.js";
4
1
  import {
5
2
  getGpsLeap
6
3
  } from "./chunk-HVXYFUCB.js";
4
+ import {
5
+ ecefToGeodetic
6
+ } from "./chunk-37QNKGTC.js";
7
7
  import {
8
8
  START_BDS_TIME,
9
9
  START_GPS_TIME
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  decodeSbasGeoNav
3
3
  } from "./chunk-WQX354KD.js";
4
+ import {
5
+ getUtcDate
6
+ } from "./chunk-HVXYFUCB.js";
4
7
  import {
5
8
  CnavAssembler,
6
9
  cnavCrcOk
@@ -8,9 +11,6 @@ import {
8
11
  import {
9
12
  decodeGpsLnavFrame
10
13
  } from "./chunk-V2D5KUKH.js";
11
- import {
12
- getUtcDate
13
- } from "./chunk-HVXYFUCB.js";
14
14
 
15
15
  // src/novatel/frame.ts
16
16
  var OEM4_HLEN = 28;