@packet-net/pdn-aprs 0.0.1

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 (120) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/LICENSE +661 -0
  3. package/README.md +192 -0
  4. package/THIRD-PARTY-NOTICES.md +5 -0
  5. package/dist/builder.d.ts +232 -0
  6. package/dist/builder.d.ts.map +1 -0
  7. package/dist/builder.js +508 -0
  8. package/dist/builder.js.map +1 -0
  9. package/dist/bytes.d.ts +19 -0
  10. package/dist/bytes.d.ts.map +1 -0
  11. package/dist/bytes.js +120 -0
  12. package/dist/bytes.js.map +1 -0
  13. package/dist/codes.d.ts +13 -0
  14. package/dist/codes.d.ts.map +1 -0
  15. package/dist/codes.js +112 -0
  16. package/dist/codes.js.map +1 -0
  17. package/dist/decode/context.d.ts +33 -0
  18. package/dist/decode/context.d.ts.map +1 -0
  19. package/dist/decode/context.js +65 -0
  20. package/dist/decode/context.js.map +1 -0
  21. package/dist/decode/index.d.ts +10 -0
  22. package/dist/decode/index.d.ts.map +1 -0
  23. package/dist/decode/index.js +121 -0
  24. package/dist/decode/index.js.map +1 -0
  25. package/dist/decode/message.d.ts +5 -0
  26. package/dist/decode/message.d.ts.map +1 -0
  27. package/dist/decode/message.js +190 -0
  28. package/dist/decode/message.js.map +1 -0
  29. package/dist/decode/other.d.ts +25 -0
  30. package/dist/decode/other.d.ts.map +1 -0
  31. package/dist/decode/other.js +326 -0
  32. package/dist/decode/other.js.map +1 -0
  33. package/dist/decode/positioned.d.ts +132 -0
  34. package/dist/decode/positioned.d.ts.map +1 -0
  35. package/dist/decode/positioned.js +1063 -0
  36. package/dist/decode/positioned.js.map +1 -0
  37. package/dist/decode/reports.d.ts +13 -0
  38. package/dist/decode/reports.d.ts.map +1 -0
  39. package/dist/decode/reports.js +375 -0
  40. package/dist/decode/reports.js.map +1 -0
  41. package/dist/decoder.d.ts +23 -0
  42. package/dist/decoder.d.ts.map +1 -0
  43. package/dist/decoder.js +75 -0
  44. package/dist/decoder.js.map +1 -0
  45. package/dist/deviceid-data.d.ts +33 -0
  46. package/dist/deviceid-data.d.ts.map +1 -0
  47. package/dist/deviceid-data.js +2941 -0
  48. package/dist/deviceid-data.js.map +1 -0
  49. package/dist/deviceid.d.ts +12 -0
  50. package/dist/deviceid.d.ts.map +1 -0
  51. package/dist/deviceid.js +86 -0
  52. package/dist/deviceid.js.map +1 -0
  53. package/dist/diagnostics.d.ts +48 -0
  54. package/dist/diagnostics.d.ts.map +1 -0
  55. package/dist/diagnostics.js +65 -0
  56. package/dist/diagnostics.js.map +1 -0
  57. package/dist/encode/common.d.ts +19 -0
  58. package/dist/encode/common.d.ts.map +1 -0
  59. package/dist/encode/common.js +84 -0
  60. package/dist/encode/common.js.map +1 -0
  61. package/dist/encode/index.d.ts +35 -0
  62. package/dist/encode/index.d.ts.map +1 -0
  63. package/dist/encode/index.js +248 -0
  64. package/dist/encode/index.js.map +1 -0
  65. package/dist/encode/other.d.ts +21 -0
  66. package/dist/encode/other.d.ts.map +1 -0
  67. package/dist/encode/other.js +253 -0
  68. package/dist/encode/other.js.map +1 -0
  69. package/dist/encode/position.d.ts +31 -0
  70. package/dist/encode/position.d.ts.map +1 -0
  71. package/dist/encode/position.js +729 -0
  72. package/dist/encode/position.js.map +1 -0
  73. package/dist/header.d.ts +42 -0
  74. package/dist/header.d.ts.map +1 -0
  75. package/dist/header.js +206 -0
  76. package/dist/header.js.map +1 -0
  77. package/dist/index.d.ts +13 -0
  78. package/dist/index.d.ts.map +1 -0
  79. package/dist/index.js +14 -0
  80. package/dist/index.js.map +1 -0
  81. package/dist/neutral.d.ts +22 -0
  82. package/dist/neutral.d.ts.map +1 -0
  83. package/dist/neutral.js +593 -0
  84. package/dist/neutral.js.map +1 -0
  85. package/dist/symbols-data.d.ts +832 -0
  86. package/dist/symbols-data.d.ts.map +1 -0
  87. package/dist/symbols-data.js +173 -0
  88. package/dist/symbols-data.js.map +1 -0
  89. package/dist/symbols.d.ts +35 -0
  90. package/dist/symbols.d.ts.map +1 -0
  91. package/dist/symbols.js +71 -0
  92. package/dist/symbols.js.map +1 -0
  93. package/dist/types.d.ts +458 -0
  94. package/dist/types.d.ts.map +1 -0
  95. package/dist/types.js +4 -0
  96. package/dist/types.js.map +1 -0
  97. package/package.json +68 -0
  98. package/src/builder.ts +617 -0
  99. package/src/bytes.ts +118 -0
  100. package/src/codes.ts +218 -0
  101. package/src/decode/context.ts +63 -0
  102. package/src/decode/index.ts +135 -0
  103. package/src/decode/message.ts +194 -0
  104. package/src/decode/other.ts +307 -0
  105. package/src/decode/positioned.ts +1161 -0
  106. package/src/decode/reports.ts +378 -0
  107. package/src/decoder.ts +76 -0
  108. package/src/deviceid-data.ts +2954 -0
  109. package/src/deviceid.ts +83 -0
  110. package/src/diagnostics.ts +86 -0
  111. package/src/encode/common.ts +87 -0
  112. package/src/encode/index.ts +280 -0
  113. package/src/encode/other.ts +247 -0
  114. package/src/encode/position.ts +656 -0
  115. package/src/header.ts +221 -0
  116. package/src/index.ts +57 -0
  117. package/src/neutral.ts +595 -0
  118. package/src/symbols-data.ts +181 -0
  119. package/src/symbols.ts +85 -0
  120. package/src/types.ts +571 -0
package/src/types.ts ADDED
@@ -0,0 +1,571 @@
1
+ // The APRS data model: one interface per data type, joined in the discriminated union `AprsData`.
2
+ // Quantities keep the units APRS sends them in, with the unit in the name; nothing is converted.
3
+
4
+ import type { Diagnostic } from './diagnostics.js';
5
+
6
+ /** A display symbol: the table (`/`, `\`, or an overlay character) and the code. */
7
+ export interface AprsSymbol {
8
+ /** `/` for the primary table, `\` for the alternate one, or an overlay `0`-`9` or `A`-`Z`. */
9
+ readonly table: string;
10
+ /** The symbol code, a printable ASCII character. */
11
+ readonly code: string;
12
+ }
13
+
14
+ /**
15
+ * A timestamp, as sent. `dhm-zulu` is `092345z`, `dhm-local` is `092345/`, `hms` is `234517h`,
16
+ * `mdhm` (positionless weather) is `10090556`.
17
+ */
18
+ export type AprsTimestamp =
19
+ | { readonly kind: 'dhm-zulu'; readonly day: number; readonly hour: number; readonly minute: number }
20
+ | { readonly kind: 'dhm-local'; readonly day: number; readonly hour: number; readonly minute: number }
21
+ | { readonly kind: 'hms'; readonly hour: number; readonly minute: number; readonly second: number }
22
+ | { readonly kind: 'mdhm'; readonly month: number; readonly day: number; readonly hour: number; readonly minute: number };
23
+
24
+ /** GPS fix state in a compressed position's type byte. */
25
+ export type CompressionFix = 'old' | 'current';
26
+ /** NMEA source in a compressed position's type byte. */
27
+ export type CompressionSource = 'other' | 'gll' | 'gga' | 'rmc';
28
+ /** Compression origin in a compressed position's type byte. */
29
+ export type CompressionOrigin =
30
+ | 'compressed'
31
+ | 'tnc-beacon-text'
32
+ | 'software'
33
+ | 'reserved3'
34
+ | 'kpc3'
35
+ | 'pico'
36
+ | 'other-tracker'
37
+ | 'digipeater-conversion';
38
+
39
+ /** A compressed position's type byte (APRS12c ch. 9). */
40
+ export interface CompressionType {
41
+ readonly fix: CompressionFix;
42
+ readonly source: CompressionSource;
43
+ readonly origin: CompressionOrigin;
44
+ }
45
+
46
+ /** Power, effective antenna height, gain and directivity codes, as sent (APRS12c ch. 7). */
47
+ export interface Phg {
48
+ /** Power code 0-9: power in watts is the code squared. */
49
+ readonly power: number;
50
+ /** Height code, `0` and on through the ASCII table: height in feet is 10 x 2^code. */
51
+ readonly height: number;
52
+ /** Gain code 0-9, in dBi. */
53
+ readonly gain: number;
54
+ /** Directivity code 0-9: 0 is omni, 1-8 are 45-360 degrees. */
55
+ readonly directivity: number;
56
+ /** PHGR: beacons per hour (1-9, then A-Z for 10 and on). */
57
+ readonly beaconsPerHour?: number;
58
+ }
59
+
60
+ /** Omni-DF signal strength, effective antenna height, gain and directivity codes (APRS12c ch. 7). */
61
+ export interface Dfs {
62
+ readonly strength: number;
63
+ readonly height: number;
64
+ readonly gain: number;
65
+ readonly directivity: number;
66
+ }
67
+
68
+ /** DF bearing and number/range/quality (APRS12c ch. 7). */
69
+ export interface DfBearing {
70
+ readonly bearingDegrees: number;
71
+ readonly number: number;
72
+ readonly range: number;
73
+ readonly quality: number;
74
+ }
75
+
76
+ /** An area object's shape (APRS12c ch. 11), codes 0-9. */
77
+ export type AreaShape =
78
+ | 'open-circle'
79
+ | 'line-down-right'
80
+ | 'open-ellipse'
81
+ | 'open-triangle'
82
+ | 'open-box'
83
+ | 'filled-circle'
84
+ | 'line-down-left'
85
+ | 'filled-ellipse'
86
+ | 'filled-triangle'
87
+ | 'filled-box';
88
+
89
+ /** An area object's colour: codes /0-/7 high intensity, then /8, /9, 10-15 low. */
90
+ export type AreaColor =
91
+ | 'black'
92
+ | 'blue'
93
+ | 'green'
94
+ | 'cyan'
95
+ | 'red'
96
+ | 'violet'
97
+ | 'yellow'
98
+ | 'gray'
99
+ | 'black-low'
100
+ | 'blue-low'
101
+ | 'green-low'
102
+ | 'cyan-low'
103
+ | 'red-low'
104
+ | 'violet-low'
105
+ | 'yellow-low'
106
+ | 'gray-low';
107
+
108
+ /** An area object (the `\l` symbol), offsets as sent (APRS12c ch. 11). */
109
+ export interface AreaObject {
110
+ readonly shape: AreaShape;
111
+ readonly color: AreaColor;
112
+ /** yy: the square root of 1500 x the latitude offset in degrees. */
113
+ readonly latOffset: number;
114
+ /** xx: the square root of 1500 x the longitude offset in degrees. */
115
+ readonly lonOffset: number;
116
+ /** A line's corridor width either side, in miles, from `{...}` in the comment. */
117
+ readonly corridorWidthMiles?: number;
118
+ }
119
+
120
+ /** Storm type (APRS12c ch. 12). */
121
+ export type StormType = 'tropical-storm' | 'hurricane' | 'tropical-depression';
122
+
123
+ /** Storm data (APRS12c ch. 12). */
124
+ export interface Storm {
125
+ readonly type: StormType;
126
+ readonly sustainedWindKnots?: number;
127
+ readonly gustKnots?: number;
128
+ readonly centralPressureMbar?: number;
129
+ readonly hurricaneRadiusNm?: number;
130
+ readonly tropicalStormRadiusNm?: number;
131
+ readonly wholeGaleRadiusNm?: number;
132
+ }
133
+
134
+ /** How precise a `!DAO!` is. */
135
+ export type DaoPrecision = 'none' | 'thousandths' | 'base91';
136
+
137
+ /** The `!DAO!` datum and precision (APRS12c ch. 5). */
138
+ export interface Dao {
139
+ /** The datum letter, upper case (`W` is WGS84). */
140
+ readonly datum: string;
141
+ readonly precision: DaoPrecision;
142
+ }
143
+
144
+ /** Base-91 comment telemetry (APRS12c ch. 13). */
145
+ export interface CommentTelemetry {
146
+ readonly sequence: number;
147
+ /** One to five analog values, 0-8280. */
148
+ readonly analog: readonly number[];
149
+ /** The eight digital bits as a number, B1 the least significant bit. */
150
+ readonly digital?: number;
151
+ }
152
+
153
+ /** A voice frequency's tone type (APRS12c ch. 18). */
154
+ export type ToneType = 'off' | 'tone' | 'ctcss' | 'dcs' | 'tone-burst';
155
+
156
+ /** An APRS 1.2 voice frequency (APRS12c ch. 18). */
157
+ export interface VoiceFrequency {
158
+ readonly mhz: number;
159
+ readonly tone?: ToneType;
160
+ /** Tone in Hz without the tenths, or the DCS code. Absent for `off` and `tone-burst`. */
161
+ readonly toneValue?: number;
162
+ /** Transmit offset in kHz. */
163
+ readonly offsetKhz?: number;
164
+ /** Nominal range, in miles unless `rangeKm`. */
165
+ readonly range?: number;
166
+ readonly rangeKm?: boolean;
167
+ /** Narrow modulation (a lower-case tone letter). */
168
+ readonly narrow?: boolean;
169
+ /** Sent as `FFF.FF MHz`, to the nearest 10 kHz. */
170
+ readonly tenKhzResolution?: boolean;
171
+ }
172
+
173
+ /** An extra weather field: a letter the spec does not define, and its value as sent. */
174
+ export interface ExtraWeatherField {
175
+ readonly letter: string;
176
+ readonly value: string;
177
+ }
178
+
179
+ /** Weather data (APRS12c ch. 12), in the units sent. */
180
+ export interface Weather {
181
+ readonly windDirectionDegrees?: number;
182
+ readonly windSpeedMph?: number;
183
+ readonly windGustMph?: number;
184
+ readonly temperatureF?: number;
185
+ readonly rain1hIn?: number;
186
+ readonly rain24hIn?: number;
187
+ readonly rainMidnightIn?: number;
188
+ /** The raw rain counter (`#`). */
189
+ readonly rainRaw?: number;
190
+ readonly humidityPercent?: number;
191
+ readonly pressureMbar?: number;
192
+ readonly luminosityWM2?: number;
193
+ readonly snow24hIn?: number;
194
+ /** The APRS software type letter. */
195
+ readonly software?: string;
196
+ /** The weather station unit type, 2-4 characters. */
197
+ readonly unit?: string;
198
+ readonly extra?: readonly ExtraWeatherField[];
199
+ }
200
+
201
+ /** The fields positions, Mic-E reports, objects and items share. */
202
+ export interface PositionedFields {
203
+ /** Degrees, north positive, with any `!DAO!` applied; the centre of an ambiguous position. */
204
+ readonly latitude: number;
205
+ /** Degrees, east positive. */
206
+ readonly longitude: number;
207
+ /** How many digits were blanked, 1-4. */
208
+ readonly ambiguity?: number;
209
+ readonly symbol: AprsSymbol;
210
+ readonly compressed?: boolean;
211
+ readonly compression?: CompressionType;
212
+ readonly courseDegrees?: number;
213
+ readonly speedKnots?: number;
214
+ readonly altitudeFeet?: number;
215
+ readonly phg?: Phg;
216
+ readonly rangeMiles?: number;
217
+ readonly dfs?: Dfs;
218
+ readonly area?: AreaObject;
219
+ readonly dfBearing?: DfBearing;
220
+ readonly storm?: Storm;
221
+ readonly dao?: Dao;
222
+ readonly telemetry?: CommentTelemetry;
223
+ readonly frequency?: VoiceFrequency;
224
+ readonly weather?: Weather;
225
+ /** A signpost's 1-3 characters (the `\m` symbol). */
226
+ readonly signpost?: string;
227
+ /** The free text left once every structured element is lifted out. */
228
+ readonly comment?: string;
229
+ }
230
+
231
+ /** A position report (`!`, `=`, `/`, `@`). */
232
+ export interface PositionReport extends PositionedFields {
233
+ readonly type: 'position';
234
+ readonly timestamp?: AprsTimestamp;
235
+ /** The sender is messaging capable (`=` or `@`). */
236
+ readonly messaging?: boolean;
237
+ }
238
+
239
+ /** A Mic-E message type (APRS12c ch. 10). */
240
+ export type MicEMessage =
241
+ | 'off-duty'
242
+ | 'en-route'
243
+ | 'in-service'
244
+ | 'returning'
245
+ | 'committed'
246
+ | 'special'
247
+ | 'priority'
248
+ | 'custom0'
249
+ | 'custom1'
250
+ | 'custom2'
251
+ | 'custom3'
252
+ | 'custom4'
253
+ | 'custom5'
254
+ | 'custom6'
255
+ | 'emergency'
256
+ | 'unknown';
257
+
258
+ /** A Mic-E report: position in the destination address and the information field. */
259
+ export interface MicEReport extends PositionedFields {
260
+ readonly type: 'mic-e';
261
+ readonly micEMessage: MicEMessage;
262
+ /** `'` rather than `` ` ``: old GPS data. */
263
+ readonly oldData?: boolean;
264
+ /** The device type code before the status text: `` ` ``, `'`, `>`, `]` or a space. */
265
+ readonly typeCode?: string;
266
+ /** The device suffix at the end of the status text, when the device database knows it. */
267
+ readonly deviceSuffix?: string;
268
+ readonly locator?: string;
269
+ /** Obsolete Mic-E telemetry values. */
270
+ readonly legacyTelemetry?: readonly number[];
271
+ /** The destination address SSID: the generic digipeater path code. */
272
+ readonly destinationSsid?: number;
273
+ }
274
+
275
+ /** An object report (`;`). */
276
+ export interface ObjectReport extends PositionedFields {
277
+ readonly type: 'object';
278
+ readonly name: string;
279
+ readonly killed?: boolean;
280
+ readonly timestamp?: AprsTimestamp;
281
+ }
282
+
283
+ /** An item report (`)`). */
284
+ export interface ItemReport extends PositionedFields {
285
+ readonly type: 'item';
286
+ readonly name: string;
287
+ readonly killed?: boolean;
288
+ }
289
+
290
+ /** A message (`:`). */
291
+ export interface Message {
292
+ readonly type: 'message';
293
+ readonly addressee: string;
294
+ readonly text: string;
295
+ readonly messageId?: string;
296
+ /** A reply-ack; the empty string says the sender is reply-ack capable with nothing to ack. */
297
+ readonly replyAck?: string;
298
+ }
299
+
300
+ /** A message acknowledgement. */
301
+ export interface Ack {
302
+ readonly type: 'ack';
303
+ readonly addressee: string;
304
+ readonly ackedId: string;
305
+ readonly replyAck?: string;
306
+ }
307
+
308
+ /** A message rejection. */
309
+ export interface Reject {
310
+ readonly type: 'reject';
311
+ readonly addressee: string;
312
+ readonly rejectedId: string;
313
+ readonly replyAck?: string;
314
+ }
315
+
316
+ /** A bulletin or announcement (addressee `BLN...`). */
317
+ export interface Bulletin {
318
+ readonly type: 'bulletin';
319
+ readonly addressee: string;
320
+ readonly text: string;
321
+ readonly messageId?: string;
322
+ }
323
+
324
+ /** A National Weather Service bulletin (addressee `NWS-...` and similar). */
325
+ export interface NwsBulletin {
326
+ readonly type: 'nws-bulletin';
327
+ readonly addressee: string;
328
+ readonly text: string;
329
+ readonly messageId?: string;
330
+ }
331
+
332
+ /** Telemetry channel names (`PARM.`). */
333
+ export interface TelemetryNames {
334
+ readonly type: 'telemetry-names';
335
+ readonly addressee: string;
336
+ readonly names: readonly string[];
337
+ readonly messageId?: string;
338
+ }
339
+
340
+ /** Telemetry units and labels (`UNIT.`). */
341
+ export interface TelemetryUnits {
342
+ readonly type: 'telemetry-units';
343
+ readonly addressee: string;
344
+ readonly units: readonly string[];
345
+ readonly messageId?: string;
346
+ }
347
+
348
+ /** Telemetry equation coefficients (`EQNS.`). */
349
+ export interface TelemetryCoefficients {
350
+ readonly type: 'telemetry-coefficients';
351
+ readonly addressee: string;
352
+ readonly coefficients: readonly number[];
353
+ /** The coefficients as sent (`.53`), so they can be written back the same. */
354
+ readonly coefficientsText?: readonly string[];
355
+ readonly messageId?: string;
356
+ }
357
+
358
+ /** Telemetry bit sense and project title (`BITS.`). */
359
+ export interface TelemetryBits {
360
+ readonly type: 'telemetry-bits';
361
+ readonly addressee: string;
362
+ /** Eight `0`/`1` characters, B1 first. */
363
+ readonly bits: string;
364
+ readonly project?: string;
365
+ readonly messageId?: string;
366
+ }
367
+
368
+ /** A directed query (`?APRSx` in a message). */
369
+ export interface DirectedQuery {
370
+ readonly type: 'directed-query';
371
+ readonly addressee: string;
372
+ readonly queryType: string;
373
+ readonly target?: string;
374
+ }
375
+
376
+ /** A status report (`>`). */
377
+ export interface StatusReport {
378
+ readonly type: 'status';
379
+ readonly timestamp?: AprsTimestamp;
380
+ readonly locator?: string;
381
+ readonly symbol?: AprsSymbol;
382
+ /** Meteor scatter beam heading and power codes (`^B7`). */
383
+ readonly beam?: { readonly headingCode: string; readonly powerCode: string };
384
+ readonly text?: string;
385
+ }
386
+
387
+ /** A telemetry report (`T#`). */
388
+ export interface TelemetryReport {
389
+ readonly type: 'telemetry';
390
+ /** The sequence as sent. */
391
+ readonly sequence: string;
392
+ /** Analog values; `null` for an empty one. */
393
+ readonly analog: readonly (number | null)[];
394
+ /** The analog values as sent (`073`, `190.0`), so they can be written back the same. */
395
+ readonly analogText?: readonly (string | null)[];
396
+ /** Eight `0`/`1` characters, B1 first. */
397
+ readonly bits?: string;
398
+ readonly comment?: string;
399
+ }
400
+
401
+ /** A positionless weather report (`_`). */
402
+ export interface WeatherReport {
403
+ readonly type: 'weather';
404
+ readonly timestamp?: AprsTimestamp;
405
+ readonly weather: Weather;
406
+ readonly comment?: string;
407
+ }
408
+
409
+ /** Raw weather station data format. */
410
+ export type RawWeatherFormat = 'peet-bros-hash' | 'peet-bros-star' | 'ultimeter-packet' | 'ultimeter-logging';
411
+
412
+ /** Raw weather station data (`#`, `*`, `$ULTW`, `!!`), kept as text. */
413
+ export interface RawWeather {
414
+ readonly type: 'raw-weather';
415
+ readonly format: RawWeatherFormat;
416
+ readonly data?: string;
417
+ }
418
+
419
+ /** A raw NMEA sentence (`$`). */
420
+ export interface NmeaSentence {
421
+ readonly type: 'nmea';
422
+ /** The sentence without the `$`. */
423
+ readonly sentence: string;
424
+ readonly hasChecksum?: boolean;
425
+ readonly latitude?: number;
426
+ readonly longitude?: number;
427
+ readonly fix?: 'valid' | 'invalid';
428
+ readonly courseDegrees?: number;
429
+ readonly speedKnots?: number;
430
+ readonly altitudeM?: number;
431
+ /** `HH:MM:SS`, with any fraction of a second. */
432
+ readonly time?: string;
433
+ readonly waypoint?: string;
434
+ }
435
+
436
+ /** A Maidenhead locator beacon (`[`), obsolete. */
437
+ export interface MaidenheadBeacon {
438
+ readonly type: 'maidenhead-beacon';
439
+ readonly locator: string;
440
+ readonly comment?: string;
441
+ }
442
+
443
+ /** A general query (`?`). */
444
+ export interface Query {
445
+ readonly type: 'query';
446
+ readonly queryType: string;
447
+ readonly footprint?: { readonly latitude: number; readonly longitude: number; readonly radiusMiles: number };
448
+ }
449
+
450
+ /** A station capability: a token, or a token and its value. */
451
+ export type Capability = readonly [token: string] | readonly [token: string, value: string];
452
+
453
+ /** Station capabilities (`<`). */
454
+ export interface Capabilities {
455
+ readonly type: 'capabilities';
456
+ readonly capabilities: readonly Capability[];
457
+ }
458
+
459
+ /** Third-party traffic (`}`): a packet from another network. */
460
+ export interface ThirdParty {
461
+ readonly type: 'third-party';
462
+ readonly packet: AprsPacket;
463
+ }
464
+
465
+ /** User-defined data (`{`). */
466
+ export interface UserDefined {
467
+ readonly type: 'user-defined';
468
+ readonly userId: string;
469
+ readonly packetType: string;
470
+ /** The data, one character per byte (U+0000-U+00FF). */
471
+ readonly data?: string;
472
+ }
473
+
474
+ /** Invalid or test data (`,`). */
475
+ export interface TestData {
476
+ readonly type: 'test';
477
+ readonly data?: string;
478
+ }
479
+
480
+ /** An Agrelo DFJr / MicroFinder report (`%`). */
481
+ export interface AgreloDf {
482
+ readonly type: 'agrelo-df';
483
+ readonly bearingDegrees: number;
484
+ readonly quality: number;
485
+ }
486
+
487
+ /** Why a packet's data was not decoded. */
488
+ export type UnrecognizedReason = 'empty' | 'not-aprs' | 'reserved-data-type' | 'malformed';
489
+
490
+ /** Data that was not decoded; the diagnostics say why. */
491
+ export interface Unrecognized {
492
+ readonly type: 'unrecognized';
493
+ readonly reason: UnrecognizedReason;
494
+ }
495
+
496
+ /** Every kind of APRS data. */
497
+ export type AprsData =
498
+ | PositionReport
499
+ | MicEReport
500
+ | ObjectReport
501
+ | ItemReport
502
+ | Message
503
+ | Ack
504
+ | Reject
505
+ | Bulletin
506
+ | NwsBulletin
507
+ | TelemetryNames
508
+ | TelemetryUnits
509
+ | TelemetryCoefficients
510
+ | TelemetryBits
511
+ | DirectedQuery
512
+ | StatusReport
513
+ | TelemetryReport
514
+ | WeatherReport
515
+ | RawWeather
516
+ | NmeaSentence
517
+ | MaidenheadBeacon
518
+ | Query
519
+ | Capabilities
520
+ | ThirdParty
521
+ | UserDefined
522
+ | TestData
523
+ | AgreloDf
524
+ | Unrecognized;
525
+
526
+ /** The `type` of each kind of data. */
527
+ export type AprsDataType = AprsData['type'];
528
+
529
+ /** Data that has a position. */
530
+ export type PositionedData = PositionReport | MicEReport | ObjectReport | ItemReport;
531
+
532
+ /** A digipeater path entry. */
533
+ export interface PathEntry {
534
+ /** The address, e.g. `WIDE2-1` or `qAR`. */
535
+ readonly address: string;
536
+ /** Marked used (`*`), or implied used by a later used entry. */
537
+ readonly used: boolean;
538
+ }
539
+
540
+ /** An APRS-IS q-construct and the station it names (the IGate). */
541
+ export interface QConstruct {
542
+ /** e.g. `qAR`. */
543
+ readonly construct: string;
544
+ readonly station?: string;
545
+ }
546
+
547
+ /** A device from the APRS device identification database. */
548
+ export interface DeviceInfo {
549
+ readonly vendor?: string;
550
+ readonly model?: string;
551
+ readonly class?: string;
552
+ readonly os?: string;
553
+ /** e.g. `messaging`, `item-in-msg`. */
554
+ readonly features?: readonly string[];
555
+ }
556
+
557
+ /** A decoded APRS packet. */
558
+ export interface AprsPacket {
559
+ readonly source: string;
560
+ readonly destination: string;
561
+ readonly path: readonly PathEntry[];
562
+ /** The information field as received (for AX.25, as in the frame). */
563
+ readonly information: Uint8Array;
564
+ readonly data: AprsData;
565
+ /** Everything the decoder noticed, header first. */
566
+ readonly diagnostics: readonly Diagnostic[];
567
+ /** The APRS-IS q-construct in the path, if any. */
568
+ readonly qConstruct?: QConstruct;
569
+ /** The sending device, from the device identification database. */
570
+ readonly device?: DeviceInfo;
571
+ }