gnss-js 0.1.2 → 1.0.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 (87) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +171 -5
  3. package/dist/analysis.cjs +1381 -0
  4. package/dist/analysis.d.cts +211 -0
  5. package/dist/analysis.d.ts +211 -0
  6. package/dist/analysis.js +14 -0
  7. package/dist/antex.cjs +239 -0
  8. package/dist/antex.d.cts +77 -0
  9. package/dist/antex.d.ts +77 -0
  10. package/dist/antex.js +8 -0
  11. package/dist/chunk-354IRDOG.js +239 -0
  12. package/dist/chunk-37QNKGTC.js +65 -0
  13. package/dist/chunk-5CMSYIYM.js +214 -0
  14. package/dist/chunk-5S5MONFK.js +0 -0
  15. package/dist/chunk-6FAL6P4G.js +12 -0
  16. package/dist/chunk-7NOFXKET.js +433 -0
  17. package/dist/chunk-CB6EOOLA.js +753 -0
  18. package/dist/chunk-HKN3PUGN.js +800 -0
  19. package/dist/chunk-IS4UUDBV.js +577 -0
  20. package/dist/chunk-K7WZQFBV.js +236 -0
  21. package/dist/chunk-LEEU5OIO.js +75 -0
  22. package/dist/chunk-PRSZIWKM.js +1482 -0
  23. package/dist/chunk-SDRRAJT5.js +433 -0
  24. package/dist/chunk-WR7LCB52.js +143 -0
  25. package/dist/chunk-Y3R57B5P.js +473 -0
  26. package/dist/chunk-YDMYO3YK.js +220 -0
  27. package/dist/constants.cjs +394 -0
  28. package/dist/constants.d.cts +14 -0
  29. package/dist/constants.d.ts +14 -0
  30. package/dist/constants.js +103 -0
  31. package/dist/coordinates.cjs +334 -0
  32. package/dist/coordinates.d.cts +81 -0
  33. package/dist/coordinates.d.ts +81 -0
  34. package/dist/coordinates.js +39 -0
  35. package/dist/ecef-CF0uAysr.d.cts +40 -0
  36. package/dist/ecef-CF0uAysr.d.ts +40 -0
  37. package/dist/ephemeris-BUWzfmBy.d.cts +114 -0
  38. package/dist/ephemeris-BUWzfmBy.d.ts +114 -0
  39. package/dist/gnss-BT6ulR17.d.cts +56 -0
  40. package/dist/gnss-C-tgoYNa.d.ts +56 -0
  41. package/dist/index.cjs +5774 -78
  42. package/dist/index.d.cts +17 -96
  43. package/dist/index.d.ts +17 -96
  44. package/dist/index.js +352 -415
  45. package/dist/nav-BAI1a9vK.d.cts +108 -0
  46. package/dist/nav-BAI1a9vK.d.ts +108 -0
  47. package/dist/nmea.cjs +247 -0
  48. package/dist/nmea.d.cts +37 -0
  49. package/dist/nmea.d.ts +37 -0
  50. package/dist/nmea.js +12 -0
  51. package/dist/ntrip.cjs +169 -0
  52. package/dist/ntrip.d.cts +98 -0
  53. package/dist/ntrip.d.ts +98 -0
  54. package/dist/ntrip.js +10 -0
  55. package/dist/orbit.cjs +504 -0
  56. package/dist/orbit.d.cts +117 -0
  57. package/dist/orbit.d.ts +117 -0
  58. package/dist/orbit.js +29 -0
  59. package/dist/parser-JPjjFgeP.d.cts +73 -0
  60. package/dist/parser-JPjjFgeP.d.ts +73 -0
  61. package/dist/rinex.cjs +1375 -0
  62. package/dist/rinex.d.cts +116 -0
  63. package/dist/rinex.d.ts +116 -0
  64. package/dist/rinex.js +37 -0
  65. package/dist/rtcm3.cjs +1519 -0
  66. package/dist/rtcm3.d.cts +143 -0
  67. package/dist/rtcm3.d.ts +143 -0
  68. package/dist/rtcm3.js +31 -0
  69. package/dist/signals.cjs +858 -0
  70. package/dist/signals.d.cts +93 -0
  71. package/dist/signals.d.ts +93 -0
  72. package/dist/signals.js +70 -0
  73. package/dist/time-DnI1VpE8.d.cts +33 -0
  74. package/dist/time-DnI1VpE8.d.ts +33 -0
  75. package/dist/time.cjs +585 -0
  76. package/dist/time.d.cts +307 -0
  77. package/dist/time.d.ts +307 -0
  78. package/dist/time.js +154 -0
  79. package/package.json +112 -14
  80. package/.prettierrc +0 -5
  81. package/jest.config.ts +0 -9
  82. package/test/functions.test.ts +0 -63
  83. package/test/gnss-scales.test.ts +0 -95
  84. package/test/julian.test.ts +0 -145
  85. package/test/rinex.test.ts +0 -11
  86. package/test/test.ts +0 -10
  87. package/test/utc.test.ts +0 -25
@@ -0,0 +1,143 @@
1
+ import { a as Rtcm3Frame, E as EphemerisInfo } from './ephemeris-BUWzfmBy.cjs';
2
+ export { B as BitReader, R as Rtcm3Decoder, d as decodeEphemeris, r as readString } from './ephemeris-BUWzfmBy.cjs';
3
+
4
+ /**
5
+ * Full RTCM3 MSM4-7 decoder — extracts pseudorange, carrier phase,
6
+ * Doppler, and C/N0 for every satellite × signal cell.
7
+ *
8
+ * Reference: BNC 2.13.4 RTCM3Decoder.cpp (BKG) and RTCM 10403.3 §3.5.
9
+ *
10
+ * Only MSM types 4-7 are decoded (full data). Types 1-3 carry partial
11
+ * data and are skipped.
12
+ */
13
+
14
+ /** Single signal observation for one satellite */
15
+ interface MsmSignal {
16
+ /** RINEX 2-char obs code, e.g. "1C", "5X" */
17
+ rinexCode: string;
18
+ /** Pseudorange in meters (undefined if invalid) */
19
+ pseudorange?: number;
20
+ /** Carrier phase in cycles (undefined if invalid) */
21
+ phase?: number;
22
+ /** Doppler in Hz (undefined if invalid) */
23
+ doppler?: number;
24
+ /** Signal-to-noise ratio in dB-Hz */
25
+ cn0?: number;
26
+ /** Lock time in seconds */
27
+ lockTime?: number;
28
+ /** Half-cycle ambiguity indicator */
29
+ halfCycle?: boolean;
30
+ /** Wavelength used (meters) — needed for RINEX phase */
31
+ wavelength: number;
32
+ }
33
+ /** All observations for one satellite in one epoch */
34
+ interface MsmSatObs {
35
+ /** PRN string, e.g. "G01", "R15", "E04" */
36
+ prn: string;
37
+ /** System letter: G, R, E, C, J, I, S */
38
+ system: string;
39
+ /** Signal observations */
40
+ signals: MsmSignal[];
41
+ }
42
+ /** One decoded MSM epoch */
43
+ interface MsmEpoch {
44
+ /** Message type (1074, 1077, etc.) */
45
+ messageType: number;
46
+ /** Epoch time as GPS milliseconds of week (or GLONASS day-of-week ms, BDS SOW) */
47
+ epochMs: number;
48
+ /** System letter */
49
+ system: string;
50
+ /** Observations per satellite */
51
+ observations: MsmSatObs[];
52
+ }
53
+ /**
54
+ * Decode a single RTCM3 MSM4-7 frame into full observations.
55
+ * Returns null for non-MSM or MSM1-3 frames.
56
+ */
57
+ declare function decodeMsmFull(frame: Rtcm3Frame): MsmEpoch | null;
58
+ /**
59
+ * Convert MSM epoch timestamp to a Date.
60
+ * For GPS/Galileo/BDS/QZSS: epochMs is ms of GPS week.
61
+ * For GLONASS: epochMs is day-of-week × 86400000 + ms of day (UTC+3).
62
+ *
63
+ * Requires an approximate reference time to resolve the current week.
64
+ */
65
+ declare function msmEpochToDate(sys: string, epochMs: number, refTime?: Date): Date;
66
+ /**
67
+ * Reset the GLONASS frequency number cache (e.g., when switching mountpoints).
68
+ */
69
+ declare function resetGloFreqCache(): void;
70
+
71
+ /**
72
+ * RTCM3 station metadata decoders (messages 1005/1006, 1007/1008, 1029, 1033).
73
+ */
74
+
75
+ interface StationMeta {
76
+ stationId: number | null;
77
+ itrf: number | null;
78
+ position: [number, number, number] | null;
79
+ antennaHeight: number | null;
80
+ antennaType: string | null;
81
+ antennaSerial: string | null;
82
+ antennaSetupId: number | null;
83
+ receiverType: string | null;
84
+ receiverFirmware: string | null;
85
+ receiverSerial: string | null;
86
+ description: string | null;
87
+ }
88
+ declare function createStationMeta(): StationMeta;
89
+ /** Update station metadata from an RTCM3 frame. Returns true if the frame was a metadata message. */
90
+ declare function updateStationMeta(meta: StationMeta, frame: Rtcm3Frame): boolean;
91
+
92
+ /**
93
+ * RTCM3 stream statistics — tracks message types, satellite C/N0,
94
+ * ephemerides, and station metadata from a live NTRIP stream.
95
+ */
96
+
97
+ /** Per-signal C/N0 for one satellite */
98
+ interface SignalCn0 {
99
+ /** RINEX 2-char obs code, e.g. "1C", "5X" */
100
+ code: string;
101
+ /** C/N0 in dB-Hz */
102
+ cn0: number;
103
+ }
104
+ interface SatCn0 {
105
+ prn: string;
106
+ system: string;
107
+ cn0: number;
108
+ lastSeen: number;
109
+ /** Per-signal C/N0 values */
110
+ signals: SignalCn0[];
111
+ }
112
+ interface MessageTypeStats {
113
+ messageType: number;
114
+ name: string;
115
+ count: number;
116
+ lastSeen: number;
117
+ constellation: string | null;
118
+ totalBytes: number;
119
+ }
120
+ interface StreamStats {
121
+ totalBytes: number;
122
+ totalFrames: number;
123
+ startTime: number;
124
+ messageTypes: Map<number, MessageTypeStats>;
125
+ bytesPerSecond: number;
126
+ framesPerSecond: number;
127
+ /** Per-satellite C/N0 from MSM messages. Key = PRN (e.g. "G01"). */
128
+ satellites: Map<string, SatCn0>;
129
+ /** Per-satellite ephemeris data. Key = PRN (e.g. "G01"). */
130
+ ephemerides: Map<string, EphemerisInfo>;
131
+ /** Observed RINEX codes per system (e.g. G → ["C1C","L1C","S1C"]). */
132
+ obsTypes: Record<string, Set<string>>;
133
+ /** Station metadata from RTCM3 descriptor messages. */
134
+ stationMeta: StationMeta;
135
+ }
136
+ /** Known RTCM3 message type names. */
137
+ declare const RTCM3_MESSAGE_NAMES: Record<number, string>;
138
+ /** RTCM3 message type to constellation mapping. */
139
+ declare function rtcm3Constellation(msgType: number): string | null;
140
+ declare function createStreamStats(): StreamStats;
141
+ declare function updateStreamStats(stats: StreamStats, frames: Rtcm3Frame[], rawBytes: number): void;
142
+
143
+ export { EphemerisInfo, type MessageTypeStats, type MsmEpoch, type MsmSatObs, type MsmSignal, RTCM3_MESSAGE_NAMES, Rtcm3Frame, type SatCn0, type SignalCn0, type StationMeta, type StreamStats, createStationMeta, createStreamStats, decodeMsmFull, msmEpochToDate, resetGloFreqCache, rtcm3Constellation, updateStationMeta, updateStreamStats };
@@ -0,0 +1,143 @@
1
+ import { a as Rtcm3Frame, E as EphemerisInfo } from './ephemeris-BUWzfmBy.js';
2
+ export { B as BitReader, R as Rtcm3Decoder, d as decodeEphemeris, r as readString } from './ephemeris-BUWzfmBy.js';
3
+
4
+ /**
5
+ * Full RTCM3 MSM4-7 decoder — extracts pseudorange, carrier phase,
6
+ * Doppler, and C/N0 for every satellite × signal cell.
7
+ *
8
+ * Reference: BNC 2.13.4 RTCM3Decoder.cpp (BKG) and RTCM 10403.3 §3.5.
9
+ *
10
+ * Only MSM types 4-7 are decoded (full data). Types 1-3 carry partial
11
+ * data and are skipped.
12
+ */
13
+
14
+ /** Single signal observation for one satellite */
15
+ interface MsmSignal {
16
+ /** RINEX 2-char obs code, e.g. "1C", "5X" */
17
+ rinexCode: string;
18
+ /** Pseudorange in meters (undefined if invalid) */
19
+ pseudorange?: number;
20
+ /** Carrier phase in cycles (undefined if invalid) */
21
+ phase?: number;
22
+ /** Doppler in Hz (undefined if invalid) */
23
+ doppler?: number;
24
+ /** Signal-to-noise ratio in dB-Hz */
25
+ cn0?: number;
26
+ /** Lock time in seconds */
27
+ lockTime?: number;
28
+ /** Half-cycle ambiguity indicator */
29
+ halfCycle?: boolean;
30
+ /** Wavelength used (meters) — needed for RINEX phase */
31
+ wavelength: number;
32
+ }
33
+ /** All observations for one satellite in one epoch */
34
+ interface MsmSatObs {
35
+ /** PRN string, e.g. "G01", "R15", "E04" */
36
+ prn: string;
37
+ /** System letter: G, R, E, C, J, I, S */
38
+ system: string;
39
+ /** Signal observations */
40
+ signals: MsmSignal[];
41
+ }
42
+ /** One decoded MSM epoch */
43
+ interface MsmEpoch {
44
+ /** Message type (1074, 1077, etc.) */
45
+ messageType: number;
46
+ /** Epoch time as GPS milliseconds of week (or GLONASS day-of-week ms, BDS SOW) */
47
+ epochMs: number;
48
+ /** System letter */
49
+ system: string;
50
+ /** Observations per satellite */
51
+ observations: MsmSatObs[];
52
+ }
53
+ /**
54
+ * Decode a single RTCM3 MSM4-7 frame into full observations.
55
+ * Returns null for non-MSM or MSM1-3 frames.
56
+ */
57
+ declare function decodeMsmFull(frame: Rtcm3Frame): MsmEpoch | null;
58
+ /**
59
+ * Convert MSM epoch timestamp to a Date.
60
+ * For GPS/Galileo/BDS/QZSS: epochMs is ms of GPS week.
61
+ * For GLONASS: epochMs is day-of-week × 86400000 + ms of day (UTC+3).
62
+ *
63
+ * Requires an approximate reference time to resolve the current week.
64
+ */
65
+ declare function msmEpochToDate(sys: string, epochMs: number, refTime?: Date): Date;
66
+ /**
67
+ * Reset the GLONASS frequency number cache (e.g., when switching mountpoints).
68
+ */
69
+ declare function resetGloFreqCache(): void;
70
+
71
+ /**
72
+ * RTCM3 station metadata decoders (messages 1005/1006, 1007/1008, 1029, 1033).
73
+ */
74
+
75
+ interface StationMeta {
76
+ stationId: number | null;
77
+ itrf: number | null;
78
+ position: [number, number, number] | null;
79
+ antennaHeight: number | null;
80
+ antennaType: string | null;
81
+ antennaSerial: string | null;
82
+ antennaSetupId: number | null;
83
+ receiverType: string | null;
84
+ receiverFirmware: string | null;
85
+ receiverSerial: string | null;
86
+ description: string | null;
87
+ }
88
+ declare function createStationMeta(): StationMeta;
89
+ /** Update station metadata from an RTCM3 frame. Returns true if the frame was a metadata message. */
90
+ declare function updateStationMeta(meta: StationMeta, frame: Rtcm3Frame): boolean;
91
+
92
+ /**
93
+ * RTCM3 stream statistics — tracks message types, satellite C/N0,
94
+ * ephemerides, and station metadata from a live NTRIP stream.
95
+ */
96
+
97
+ /** Per-signal C/N0 for one satellite */
98
+ interface SignalCn0 {
99
+ /** RINEX 2-char obs code, e.g. "1C", "5X" */
100
+ code: string;
101
+ /** C/N0 in dB-Hz */
102
+ cn0: number;
103
+ }
104
+ interface SatCn0 {
105
+ prn: string;
106
+ system: string;
107
+ cn0: number;
108
+ lastSeen: number;
109
+ /** Per-signal C/N0 values */
110
+ signals: SignalCn0[];
111
+ }
112
+ interface MessageTypeStats {
113
+ messageType: number;
114
+ name: string;
115
+ count: number;
116
+ lastSeen: number;
117
+ constellation: string | null;
118
+ totalBytes: number;
119
+ }
120
+ interface StreamStats {
121
+ totalBytes: number;
122
+ totalFrames: number;
123
+ startTime: number;
124
+ messageTypes: Map<number, MessageTypeStats>;
125
+ bytesPerSecond: number;
126
+ framesPerSecond: number;
127
+ /** Per-satellite C/N0 from MSM messages. Key = PRN (e.g. "G01"). */
128
+ satellites: Map<string, SatCn0>;
129
+ /** Per-satellite ephemeris data. Key = PRN (e.g. "G01"). */
130
+ ephemerides: Map<string, EphemerisInfo>;
131
+ /** Observed RINEX codes per system (e.g. G → ["C1C","L1C","S1C"]). */
132
+ obsTypes: Record<string, Set<string>>;
133
+ /** Station metadata from RTCM3 descriptor messages. */
134
+ stationMeta: StationMeta;
135
+ }
136
+ /** Known RTCM3 message type names. */
137
+ declare const RTCM3_MESSAGE_NAMES: Record<number, string>;
138
+ /** RTCM3 message type to constellation mapping. */
139
+ declare function rtcm3Constellation(msgType: number): string | null;
140
+ declare function createStreamStats(): StreamStats;
141
+ declare function updateStreamStats(stats: StreamStats, frames: Rtcm3Frame[], rawBytes: number): void;
142
+
143
+ export { EphemerisInfo, type MessageTypeStats, type MsmEpoch, type MsmSatObs, type MsmSignal, RTCM3_MESSAGE_NAMES, Rtcm3Frame, type SatCn0, type SignalCn0, type StationMeta, type StreamStats, createStationMeta, createStreamStats, decodeMsmFull, msmEpochToDate, resetGloFreqCache, rtcm3Constellation, updateStationMeta, updateStreamStats };
package/dist/rtcm3.js ADDED
@@ -0,0 +1,31 @@
1
+ import {
2
+ BitReader,
3
+ RTCM3_MESSAGE_NAMES,
4
+ Rtcm3Decoder,
5
+ createStationMeta,
6
+ createStreamStats,
7
+ decodeEphemeris,
8
+ decodeMsmFull,
9
+ msmEpochToDate,
10
+ readString,
11
+ resetGloFreqCache,
12
+ rtcm3Constellation,
13
+ updateStationMeta,
14
+ updateStreamStats
15
+ } from "./chunk-PRSZIWKM.js";
16
+ import "./chunk-354IRDOG.js";
17
+ export {
18
+ BitReader,
19
+ RTCM3_MESSAGE_NAMES,
20
+ Rtcm3Decoder,
21
+ createStationMeta,
22
+ createStreamStats,
23
+ decodeEphemeris,
24
+ decodeMsmFull,
25
+ msmEpochToDate,
26
+ readString,
27
+ resetGloFreqCache,
28
+ rtcm3Constellation,
29
+ updateStationMeta,
30
+ updateStreamStats
31
+ };