gnss-js 1.20.0 → 1.22.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/ubx.d.cts CHANGED
@@ -147,6 +147,116 @@ interface UbxCnavResult {
147
147
  */
148
148
  declare function parseUbxCnav(data: Uint8Array): UbxCnavResult;
149
149
 
150
+ /**
151
+ * u-blox UBX raw navigation-message decoding for the non-GPS
152
+ * constellations: Galileo I/NAV (E1B/E5b), BeiDou D1/D2 (B1I/B2I) and
153
+ * GLONASS L1/L2 C/A strings from RXM-SFRBX (class 0x02, id 0x13).
154
+ * GPS/QZSS LNAV stays in `parseUbxNav` (./nav.ts) and GPS CNAV in
155
+ * `parseUbxCnav` (./cnav.ts).
156
+ *
157
+ * The per-constellation word repack is a port of RTKLIB demo5
158
+ * (rtklibexplorer fork, src/rcv/ublox.c: decode_rxmsfrbx routing into
159
+ * decode_inav / decode_cnav / decode_gnav, Copyright (c) 2007-2020
160
+ * T. Takasu, BSD-2-Clause); the bit-field decoding and data-set
161
+ * assembly live in src/navbits (gal.ts / bds.ts / glo.ts), shared with
162
+ * the Septentrio SBF path (src/sbf/rawnav-gal.ts / rawnav-bds.ts).
163
+ *
164
+ * How u-blox packs each message into the little-endian 32-bit `dwrd`
165
+ * words (interface description §RXM-SFRBX; verified on a ZED-F9P
166
+ * capture against convbin):
167
+ *
168
+ * - Galileo I/NAV (gnssId 2, sigId 1 = E1B, 5 = E5b): one nominal page
169
+ * pair per message, bits MSB-first — the 114-bit even part
170
+ * left-justified in dwrd 0-3 (pad bits 114-127 ignored) and the
171
+ * 120-bit odd part left-justified in dwrd 4-7. E1B messages carry a
172
+ * 9th reserved word, E5b messages 8 words; both repack identically
173
+ * (RTKLIB decode_inav reads 8 dwrds for either). The two carriers
174
+ * broadcast the same words and feed ONE assembler per satellite,
175
+ * like RTKLIB's shared subframe buffer and the SBF module's single
176
+ * I/NAV assembler. u-blox does not track E5a, so F/NAV (sigId 3) is
177
+ * out of scope; E6 (sigId 8) is skipped like RTKLIB.
178
+ * - BeiDou D1/D2 (gnssId 3, B1I sigId 0/1, B2I sigId 2/3): ten dwrds,
179
+ * each carrying one 30-bit word in its 30 LSBs, already
180
+ * de-interleaved with the BCH parity bits in place — exactly the
181
+ * 300-bit layout `bdsSubframeParityOk` / `BdsAssembler` expect
182
+ * (RTKLIB decode_cnav packs `U4(p)` low 30 bits straight into its
183
+ * subframe buffer). B1I and B2I carry the same message and share
184
+ * the assembler.
185
+ * - GLONASS (gnssId 6, sigId 0 = L1OF, 2 = L2OF): four dwrds holding
186
+ * the 85-bit navigation string MSB-first from the idle bit (RTKLIB
187
+ * repacks each little-endian dwrd big-endian: `buff[k]=p[3-j]`);
188
+ * bits 85-95 are padding and dwrd 3 carries the receiver-counted
189
+ * superframe/frame numbers. The frequency slot is the payload
190
+ * `freqId` minus 7. L1 and L2 strings are identical and share one
191
+ * assembler per slot.
192
+ *
193
+ * Parity handling: the receiver marks nothing in SFRBX, so every
194
+ * integrity check is re-run here — CRC-24Q per I/NAV page pair,
195
+ * BCH(15,11,1) per BDS word, Hamming (KX) per GLONASS string —
196
+ * and `badParity` counts exactly the messages rejected for a failed
197
+ * check. (RTKLIB checks only the GLONASS Hamming code and the I/NAV
198
+ * CRC on this path; the BDS BCH check is this library's addition, as
199
+ * in the SBF module.)
200
+ *
201
+ * GLONASS time reference: tk/tb count into a UTC day, so each string
202
+ * needs a receiver time stamp (RTKLIB `raw->time`, set by the last
203
+ * RXM-RAWX). This parser mirrors that: the running reference is the
204
+ * most recent RXM-RAWX epoch (GPS week + rcvTow) in the stream, never
205
+ * the system clock; GLONASS strings seen before the first time
206
+ * reference are skipped. `refWeek` substitutes for the RAWX week
207
+ * field only when the receiver reports it as 0 (time not yet known).
208
+ *
209
+ * Documented deviations from RTKLIB's u-blox path:
210
+ * - GLONASS string buffers reset on a > 30 s gap between strings
211
+ * (`GloStringAssembler`), not on the u-blox frame-number change
212
+ * RTKLIB uses (dwrd-3 bytes it stores as "frame-id") — the
213
+ * convention the SBF port settled, where no frame counter exists.
214
+ * - The RINEX GLONASS message-frame-time comes from the broadcast tk
215
+ * of the frame that completed the record, not the receiver time of
216
+ * day (RTKLIB's geph->tof) — see the oracle notes in
217
+ * test/bdsglo-raw.test.ts; the two differ by the ~8 s string-4
218
+ * offset within the frame.
219
+ */
220
+
221
+ interface UbxRawNavOptions {
222
+ /**
223
+ * Full GPS week substituted for the RXM-RAWX week field when the
224
+ * receiver reports it as 0 (time not yet resolved). The GLONASS
225
+ * day reference always comes from RAWX epochs in the stream —
226
+ * a stream without any usable RXM-RAWX time stamp yields no
227
+ * GLONASS ephemerides (Galileo and BeiDou messages carry their own
228
+ * week and are decoded regardless); the system clock is never used.
229
+ */
230
+ refWeek?: number;
231
+ }
232
+ interface UbxRawNavResult {
233
+ /**
234
+ * Broadcast ephemerides in stream order, unchanged rebroadcasts
235
+ * suppressed: Galileo I/NAV (`system: 'E'`, RINEX I/NAV clock set),
236
+ * BeiDou D1/D2 (`system: 'C'`, BDT epochs/weeks) and GLONASS
237
+ * (`system: 'R'`, UTC epochs, km state vectors).
238
+ */
239
+ ephemerides: Ephemeris[];
240
+ /** RXM-SFRBX messages routed to each constellation's decoder:
241
+ * `gal` = E1B + E5b I/NAV pages, `bds` = B1I + B2I subframes,
242
+ * `glo` = L1 + L2 C/A strings. */
243
+ counts: {
244
+ gal: number;
245
+ bds: number;
246
+ glo: number;
247
+ };
248
+ /** Messages dropped for a failed integrity check: I/NAV page
249
+ * CRC-24Q, BDS BCH(15,11,1) word parity, GLONASS Hamming (KX). */
250
+ badParity: number;
251
+ }
252
+ /**
253
+ * Decode every Galileo/BeiDou/GLONASS broadcast ephemeris in a UBX
254
+ * byte stream (RXM-SFRBX), the way `parseUbxNav` does for GPS/QZSS.
255
+ * See the module header for the per-constellation repack, parity and
256
+ * time-reference conventions.
257
+ */
258
+ declare function parseUbxRawNav(data: Uint8Array, opts?: UbxRawNavOptions): UbxRawNavResult;
259
+
150
260
  /**
151
261
  * u-blox UBX raw-measurement decoding (RXM-RAWX) — the path from a
152
262
  * receiver log to RINEX-grade observables.
@@ -203,4 +313,4 @@ interface UbxParseResult {
203
313
  */
204
314
  declare function parseUbxRawx(data: Uint8Array): UbxParseResult;
205
315
 
206
- export { type UbxCnavResult, type UbxFrame, type UbxIonoUtcResult, type UbxMeasurement, type UbxNavOptions, type UbxNavResult, type UbxParseResult, type UbxRawxEpoch, parseUbxCnav, parseUbxIonoUtc, parseUbxNav, parseUbxRawx, ubxFrames };
316
+ export { type UbxCnavResult, type UbxFrame, type UbxIonoUtcResult, type UbxMeasurement, type UbxNavOptions, type UbxNavResult, type UbxParseResult, type UbxRawNavOptions, type UbxRawNavResult, type UbxRawxEpoch, parseUbxCnav, parseUbxIonoUtc, parseUbxNav, parseUbxRawNav, parseUbxRawx, ubxFrames };
package/dist/ubx.d.ts CHANGED
@@ -147,6 +147,116 @@ interface UbxCnavResult {
147
147
  */
148
148
  declare function parseUbxCnav(data: Uint8Array): UbxCnavResult;
149
149
 
150
+ /**
151
+ * u-blox UBX raw navigation-message decoding for the non-GPS
152
+ * constellations: Galileo I/NAV (E1B/E5b), BeiDou D1/D2 (B1I/B2I) and
153
+ * GLONASS L1/L2 C/A strings from RXM-SFRBX (class 0x02, id 0x13).
154
+ * GPS/QZSS LNAV stays in `parseUbxNav` (./nav.ts) and GPS CNAV in
155
+ * `parseUbxCnav` (./cnav.ts).
156
+ *
157
+ * The per-constellation word repack is a port of RTKLIB demo5
158
+ * (rtklibexplorer fork, src/rcv/ublox.c: decode_rxmsfrbx routing into
159
+ * decode_inav / decode_cnav / decode_gnav, Copyright (c) 2007-2020
160
+ * T. Takasu, BSD-2-Clause); the bit-field decoding and data-set
161
+ * assembly live in src/navbits (gal.ts / bds.ts / glo.ts), shared with
162
+ * the Septentrio SBF path (src/sbf/rawnav-gal.ts / rawnav-bds.ts).
163
+ *
164
+ * How u-blox packs each message into the little-endian 32-bit `dwrd`
165
+ * words (interface description §RXM-SFRBX; verified on a ZED-F9P
166
+ * capture against convbin):
167
+ *
168
+ * - Galileo I/NAV (gnssId 2, sigId 1 = E1B, 5 = E5b): one nominal page
169
+ * pair per message, bits MSB-first — the 114-bit even part
170
+ * left-justified in dwrd 0-3 (pad bits 114-127 ignored) and the
171
+ * 120-bit odd part left-justified in dwrd 4-7. E1B messages carry a
172
+ * 9th reserved word, E5b messages 8 words; both repack identically
173
+ * (RTKLIB decode_inav reads 8 dwrds for either). The two carriers
174
+ * broadcast the same words and feed ONE assembler per satellite,
175
+ * like RTKLIB's shared subframe buffer and the SBF module's single
176
+ * I/NAV assembler. u-blox does not track E5a, so F/NAV (sigId 3) is
177
+ * out of scope; E6 (sigId 8) is skipped like RTKLIB.
178
+ * - BeiDou D1/D2 (gnssId 3, B1I sigId 0/1, B2I sigId 2/3): ten dwrds,
179
+ * each carrying one 30-bit word in its 30 LSBs, already
180
+ * de-interleaved with the BCH parity bits in place — exactly the
181
+ * 300-bit layout `bdsSubframeParityOk` / `BdsAssembler` expect
182
+ * (RTKLIB decode_cnav packs `U4(p)` low 30 bits straight into its
183
+ * subframe buffer). B1I and B2I carry the same message and share
184
+ * the assembler.
185
+ * - GLONASS (gnssId 6, sigId 0 = L1OF, 2 = L2OF): four dwrds holding
186
+ * the 85-bit navigation string MSB-first from the idle bit (RTKLIB
187
+ * repacks each little-endian dwrd big-endian: `buff[k]=p[3-j]`);
188
+ * bits 85-95 are padding and dwrd 3 carries the receiver-counted
189
+ * superframe/frame numbers. The frequency slot is the payload
190
+ * `freqId` minus 7. L1 and L2 strings are identical and share one
191
+ * assembler per slot.
192
+ *
193
+ * Parity handling: the receiver marks nothing in SFRBX, so every
194
+ * integrity check is re-run here — CRC-24Q per I/NAV page pair,
195
+ * BCH(15,11,1) per BDS word, Hamming (KX) per GLONASS string —
196
+ * and `badParity` counts exactly the messages rejected for a failed
197
+ * check. (RTKLIB checks only the GLONASS Hamming code and the I/NAV
198
+ * CRC on this path; the BDS BCH check is this library's addition, as
199
+ * in the SBF module.)
200
+ *
201
+ * GLONASS time reference: tk/tb count into a UTC day, so each string
202
+ * needs a receiver time stamp (RTKLIB `raw->time`, set by the last
203
+ * RXM-RAWX). This parser mirrors that: the running reference is the
204
+ * most recent RXM-RAWX epoch (GPS week + rcvTow) in the stream, never
205
+ * the system clock; GLONASS strings seen before the first time
206
+ * reference are skipped. `refWeek` substitutes for the RAWX week
207
+ * field only when the receiver reports it as 0 (time not yet known).
208
+ *
209
+ * Documented deviations from RTKLIB's u-blox path:
210
+ * - GLONASS string buffers reset on a > 30 s gap between strings
211
+ * (`GloStringAssembler`), not on the u-blox frame-number change
212
+ * RTKLIB uses (dwrd-3 bytes it stores as "frame-id") — the
213
+ * convention the SBF port settled, where no frame counter exists.
214
+ * - The RINEX GLONASS message-frame-time comes from the broadcast tk
215
+ * of the frame that completed the record, not the receiver time of
216
+ * day (RTKLIB's geph->tof) — see the oracle notes in
217
+ * test/bdsglo-raw.test.ts; the two differ by the ~8 s string-4
218
+ * offset within the frame.
219
+ */
220
+
221
+ interface UbxRawNavOptions {
222
+ /**
223
+ * Full GPS week substituted for the RXM-RAWX week field when the
224
+ * receiver reports it as 0 (time not yet resolved). The GLONASS
225
+ * day reference always comes from RAWX epochs in the stream —
226
+ * a stream without any usable RXM-RAWX time stamp yields no
227
+ * GLONASS ephemerides (Galileo and BeiDou messages carry their own
228
+ * week and are decoded regardless); the system clock is never used.
229
+ */
230
+ refWeek?: number;
231
+ }
232
+ interface UbxRawNavResult {
233
+ /**
234
+ * Broadcast ephemerides in stream order, unchanged rebroadcasts
235
+ * suppressed: Galileo I/NAV (`system: 'E'`, RINEX I/NAV clock set),
236
+ * BeiDou D1/D2 (`system: 'C'`, BDT epochs/weeks) and GLONASS
237
+ * (`system: 'R'`, UTC epochs, km state vectors).
238
+ */
239
+ ephemerides: Ephemeris[];
240
+ /** RXM-SFRBX messages routed to each constellation's decoder:
241
+ * `gal` = E1B + E5b I/NAV pages, `bds` = B1I + B2I subframes,
242
+ * `glo` = L1 + L2 C/A strings. */
243
+ counts: {
244
+ gal: number;
245
+ bds: number;
246
+ glo: number;
247
+ };
248
+ /** Messages dropped for a failed integrity check: I/NAV page
249
+ * CRC-24Q, BDS BCH(15,11,1) word parity, GLONASS Hamming (KX). */
250
+ badParity: number;
251
+ }
252
+ /**
253
+ * Decode every Galileo/BeiDou/GLONASS broadcast ephemeris in a UBX
254
+ * byte stream (RXM-SFRBX), the way `parseUbxNav` does for GPS/QZSS.
255
+ * See the module header for the per-constellation repack, parity and
256
+ * time-reference conventions.
257
+ */
258
+ declare function parseUbxRawNav(data: Uint8Array, opts?: UbxRawNavOptions): UbxRawNavResult;
259
+
150
260
  /**
151
261
  * u-blox UBX raw-measurement decoding (RXM-RAWX) — the path from a
152
262
  * receiver log to RINEX-grade observables.
@@ -203,4 +313,4 @@ interface UbxParseResult {
203
313
  */
204
314
  declare function parseUbxRawx(data: Uint8Array): UbxParseResult;
205
315
 
206
- export { type UbxCnavResult, type UbxFrame, type UbxIonoUtcResult, type UbxMeasurement, type UbxNavOptions, type UbxNavResult, type UbxParseResult, type UbxRawxEpoch, parseUbxCnav, parseUbxIonoUtc, parseUbxNav, parseUbxRawx, ubxFrames };
316
+ export { type UbxCnavResult, type UbxFrame, type UbxIonoUtcResult, type UbxMeasurement, type UbxNavOptions, type UbxNavResult, type UbxParseResult, type UbxRawNavOptions, type UbxRawNavResult, type UbxRawxEpoch, parseUbxCnav, parseUbxIonoUtc, parseUbxNav, parseUbxRawNav, parseUbxRawx, ubxFrames };
package/dist/ubx.js CHANGED
@@ -2,14 +2,19 @@ import {
2
2
  parseUbxCnav,
3
3
  parseUbxIonoUtc,
4
4
  parseUbxNav,
5
+ parseUbxRawNav,
5
6
  parseUbxRawx,
6
7
  ubxFrames
7
- } from "./chunk-DLXTTHRK.js";
8
+ } from "./chunk-MCAVU3XL.js";
9
+ import "./chunk-VTX3VCL4.js";
8
10
  import "./chunk-WZDFZ76K.js";
11
+ import "./chunk-HVXYFUCB.js";
12
+ import "./chunk-LEEU5OIO.js";
9
13
  export {
10
14
  parseUbxCnav,
11
15
  parseUbxIonoUtc,
12
16
  parseUbxNav,
17
+ parseUbxRawNav,
13
18
  parseUbxRawx,
14
19
  ubxFrames
15
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gnss-js",
3
- "version": "1.20.0",
3
+ "version": "1.22.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,