@airframes/acars-decoder 1.8.6 → 1.8.8
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/README.md +8 -6
- package/dist/index.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +1201 -440
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1201 -440
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -2
package/dist/index.js
CHANGED
|
@@ -36,87 +36,89 @@ __export(index_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(index_exports);
|
|
37
37
|
|
|
38
38
|
// lib/IcaoDecoder.ts
|
|
39
|
-
var IcaoDecoder = class {
|
|
39
|
+
var IcaoDecoder = class _IcaoDecoder {
|
|
40
40
|
name;
|
|
41
41
|
icao;
|
|
42
|
+
// Military ICAO address ranges (as [start, end] tuples, inclusive)
|
|
43
|
+
static MILITARY_RANGES = [
|
|
44
|
+
[65648, 65679],
|
|
45
|
+
// Egypt
|
|
46
|
+
[671744, 675839],
|
|
47
|
+
// Algeria
|
|
48
|
+
[3407616, 3407871],
|
|
49
|
+
// Italy
|
|
50
|
+
[3473408, 3670015],
|
|
51
|
+
// Spain
|
|
52
|
+
[3842048, 3866623],
|
|
53
|
+
// France 1
|
|
54
|
+
[3895296, 3932159],
|
|
55
|
+
// France 2
|
|
56
|
+
[4104192, 4112383],
|
|
57
|
+
// Germany 1
|
|
58
|
+
[4145152, 4177919],
|
|
59
|
+
// Germany 2
|
|
60
|
+
[4194304, 4194367],
|
|
61
|
+
// UK 1
|
|
62
|
+
[4440064, 4444159],
|
|
63
|
+
// UK 2
|
|
64
|
+
[4472832, 4485119],
|
|
65
|
+
// Austria
|
|
66
|
+
[4517888, 4521983],
|
|
67
|
+
// Belgium
|
|
68
|
+
[4550656, 4554751],
|
|
69
|
+
// Bulgaria
|
|
70
|
+
[4584448, 4584703],
|
|
71
|
+
// Denmark
|
|
72
|
+
[4620288, 4621311],
|
|
73
|
+
// Greece
|
|
74
|
+
[4668416, 4668431],
|
|
75
|
+
// Hungary
|
|
76
|
+
[4686080, 4686335],
|
|
77
|
+
// Norway
|
|
78
|
+
[4718592, 4722687],
|
|
79
|
+
// Netherlands
|
|
80
|
+
[4773888, 4774015],
|
|
81
|
+
// Poland
|
|
82
|
+
[4815872, 4816127],
|
|
83
|
+
// Portugal
|
|
84
|
+
[4817952, 4817967],
|
|
85
|
+
// Czech
|
|
86
|
+
[4943872, 4947967],
|
|
87
|
+
// Switzerland
|
|
88
|
+
[4948480, 4948735],
|
|
89
|
+
// Turkey
|
|
90
|
+
[7389296, 7389311],
|
|
91
|
+
// Oman
|
|
92
|
+
[7406168, 7406223],
|
|
93
|
+
// Saudi 1
|
|
94
|
+
[7406464, 7406495],
|
|
95
|
+
// Saudi 2
|
|
96
|
+
[7571968, 7572223],
|
|
97
|
+
// Israel
|
|
98
|
+
[8189952, 8190719],
|
|
99
|
+
// Australia
|
|
100
|
+
[8389120, 8389375],
|
|
101
|
+
// India
|
|
102
|
+
[11401160, 11534335],
|
|
103
|
+
// USA
|
|
104
|
+
[12713984, 12845055],
|
|
105
|
+
// Canada
|
|
106
|
+
[14942208, 14950399]
|
|
107
|
+
// Brazil
|
|
108
|
+
];
|
|
42
109
|
constructor(icao) {
|
|
43
110
|
this.name = "icao-decoder-typescript";
|
|
44
111
|
this.icao = icao;
|
|
45
112
|
}
|
|
46
113
|
isMilitary() {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var DateTimeUtils = class {
|
|
54
|
-
// Expects a four digit UTC time string (HHMM)
|
|
55
|
-
static UTCToString(UTCString) {
|
|
56
|
-
let utcDate = /* @__PURE__ */ new Date();
|
|
57
|
-
utcDate.setUTCHours(+UTCString.substr(0, 2), +UTCString.substr(2, 2), 0);
|
|
58
|
-
return utcDate.toTimeString();
|
|
59
|
-
}
|
|
60
|
-
// Expects a six digit date string and a four digit UTC time string
|
|
61
|
-
// (DDMMYY) (HHMM)
|
|
62
|
-
static UTCDateTimeToString(dateString, timeString) {
|
|
63
|
-
let utcDate = /* @__PURE__ */ new Date();
|
|
64
|
-
utcDate.setUTCDate(+dateString.substr(0, 2));
|
|
65
|
-
utcDate.setUTCMonth(+dateString.substr(2, 2));
|
|
66
|
-
if (dateString.length === 6) {
|
|
67
|
-
utcDate.setUTCFullYear(2e3 + +dateString.substr(4, 2));
|
|
68
|
-
}
|
|
69
|
-
if (timeString.length === 6) {
|
|
70
|
-
utcDate.setUTCHours(+timeString.substr(0, 2), +timeString.substr(2, 2), +timeString.substr(4, 2));
|
|
71
|
-
} else {
|
|
72
|
-
utcDate.setUTCHours(+timeString.substr(0, 2), +timeString.substr(2, 2), 0);
|
|
73
|
-
}
|
|
74
|
-
return utcDate.toUTCString();
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
*
|
|
78
|
-
* @param time HHMMSS or HHMM
|
|
79
|
-
* @returns seconds since midnight
|
|
80
|
-
*/
|
|
81
|
-
static convertHHMMSSToTod(time) {
|
|
82
|
-
if (time.length === 4) {
|
|
83
|
-
time += "00";
|
|
84
|
-
}
|
|
85
|
-
const h = Number(time.substring(0, 2));
|
|
86
|
-
const m = Number(time.substring(2, 4));
|
|
87
|
-
const s = Number(time.substring(4, 6));
|
|
88
|
-
const tod = h * 3600 + m * 60 + s;
|
|
89
|
-
return tod;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
*
|
|
93
|
-
* @param time HHMMSS
|
|
94
|
-
* @param date MMDDYY or MMDDYYYY
|
|
95
|
-
* @returns seconds since epoch
|
|
96
|
-
*/
|
|
97
|
-
static convertDateTimeToEpoch(time, date) {
|
|
98
|
-
if (date.length === 6) {
|
|
99
|
-
date = date.substring(0, 4) + `20${date.substring(4, 6)}`;
|
|
100
|
-
}
|
|
101
|
-
const timestamp = `${date.substring(4, 8)}-${date.substring(0, 2)}-${date.substring(2, 4)}T${time.substring(0, 2)}:${time.substring(2, 4)}:${time.substring(4, 6)}.000Z`;
|
|
102
|
-
const millis = Date.parse(timestamp);
|
|
103
|
-
return millis / 1e3;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Converts a timestamp to a string
|
|
107
|
-
*
|
|
108
|
-
* ISO-8601 format for 'epoch'
|
|
109
|
-
* HH:MM:SS for 'tod'
|
|
110
|
-
* @param time
|
|
111
|
-
* @param format
|
|
112
|
-
* @returns
|
|
113
|
-
*/
|
|
114
|
-
static timestampToString(time, format) {
|
|
115
|
-
const date = new Date(time * 1e3);
|
|
116
|
-
if (format == "tod") {
|
|
117
|
-
return date.toISOString().slice(11, 19);
|
|
114
|
+
const i = this.icao;
|
|
115
|
+
const n = parseInt(i, 16);
|
|
116
|
+
for (const [start, end] of _IcaoDecoder.MILITARY_RANGES) {
|
|
117
|
+
if (start <= n && n <= end) {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
118
120
|
}
|
|
119
|
-
return
|
|
121
|
+
return false;
|
|
120
122
|
}
|
|
121
123
|
};
|
|
122
124
|
|
|
@@ -146,7 +148,9 @@ var DecoderPlugin = class {
|
|
|
146
148
|
this.options = options;
|
|
147
149
|
}
|
|
148
150
|
id() {
|
|
149
|
-
console.log(
|
|
151
|
+
console.log(
|
|
152
|
+
"DecoderPlugin subclass has not overriden id() to provide a unique ID for this plugin!"
|
|
153
|
+
);
|
|
150
154
|
return "abstract_decoder_plugin";
|
|
151
155
|
}
|
|
152
156
|
meetsStateRequirements() {
|
|
@@ -173,7 +177,7 @@ var CoordinateUtils = class _CoordinateUtils {
|
|
|
173
177
|
/**
|
|
174
178
|
* Decode a string of coordinates into an object with latitude and longitude in millidegrees
|
|
175
179
|
* @param stringCoords - The string of coordinates to decode
|
|
176
|
-
*
|
|
180
|
+
*
|
|
177
181
|
* @returns An object with latitude and longitude properties
|
|
178
182
|
*/
|
|
179
183
|
static decodeStringCoordinates(stringCoords) {
|
|
@@ -193,11 +197,11 @@ var CoordinateUtils = class _CoordinateUtils {
|
|
|
193
197
|
return void 0;
|
|
194
198
|
}
|
|
195
199
|
/**
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
200
|
+
* Decode a string of coordinates into an object with latitude and longitude in degrees and decimal minutes
|
|
201
|
+
* @param stringCoords - The string of coordinates to decode
|
|
202
|
+
*
|
|
203
|
+
* @returns An object with latitude and longitude properties
|
|
204
|
+
*/
|
|
201
205
|
static decodeStringCoordinatesDecimalMinutes(stringCoords) {
|
|
202
206
|
const firstChar = stringCoords.substring(0, 1);
|
|
203
207
|
let middleChar = stringCoords.substring(6, 7);
|
|
@@ -236,6 +240,85 @@ var CoordinateUtils = class _CoordinateUtils {
|
|
|
236
240
|
}
|
|
237
241
|
};
|
|
238
242
|
|
|
243
|
+
// lib/DateTimeUtils.ts
|
|
244
|
+
var DateTimeUtils = class {
|
|
245
|
+
// Expects a four digit UTC time string (HHMM)
|
|
246
|
+
static UTCToString(UTCString) {
|
|
247
|
+
let utcDate = /* @__PURE__ */ new Date();
|
|
248
|
+
utcDate.setUTCHours(+UTCString.substr(0, 2), +UTCString.substr(2, 2), 0);
|
|
249
|
+
return utcDate.toTimeString();
|
|
250
|
+
}
|
|
251
|
+
// Expects a six digit date string and a four digit UTC time string
|
|
252
|
+
// (DDMMYY) (HHMM)
|
|
253
|
+
static UTCDateTimeToString(dateString, timeString) {
|
|
254
|
+
let utcDate = /* @__PURE__ */ new Date();
|
|
255
|
+
utcDate.setUTCDate(+dateString.substr(0, 2));
|
|
256
|
+
utcDate.setUTCMonth(+dateString.substr(2, 2));
|
|
257
|
+
if (dateString.length === 6) {
|
|
258
|
+
utcDate.setUTCFullYear(2e3 + +dateString.substr(4, 2));
|
|
259
|
+
}
|
|
260
|
+
if (timeString.length === 6) {
|
|
261
|
+
utcDate.setUTCHours(
|
|
262
|
+
+timeString.substr(0, 2),
|
|
263
|
+
+timeString.substr(2, 2),
|
|
264
|
+
+timeString.substr(4, 2)
|
|
265
|
+
);
|
|
266
|
+
} else {
|
|
267
|
+
utcDate.setUTCHours(
|
|
268
|
+
+timeString.substr(0, 2),
|
|
269
|
+
+timeString.substr(2, 2),
|
|
270
|
+
0
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
return utcDate.toUTCString();
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
*
|
|
277
|
+
* @param time HHMMSS or HHMM
|
|
278
|
+
* @returns seconds since midnight
|
|
279
|
+
*/
|
|
280
|
+
static convertHHMMSSToTod(time) {
|
|
281
|
+
if (time.length === 4) {
|
|
282
|
+
time += "00";
|
|
283
|
+
}
|
|
284
|
+
const h = Number(time.substring(0, 2));
|
|
285
|
+
const m = Number(time.substring(2, 4));
|
|
286
|
+
const s = Number(time.substring(4, 6));
|
|
287
|
+
const tod = h * 3600 + m * 60 + s;
|
|
288
|
+
return tod;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
*
|
|
292
|
+
* @param time HHMMSS
|
|
293
|
+
* @param date MMDDYY or MMDDYYYY
|
|
294
|
+
* @returns seconds since epoch
|
|
295
|
+
*/
|
|
296
|
+
static convertDateTimeToEpoch(time, date) {
|
|
297
|
+
if (date.length === 6) {
|
|
298
|
+
date = date.substring(0, 4) + `20${date.substring(4, 6)}`;
|
|
299
|
+
}
|
|
300
|
+
const timestamp = `${date.substring(4, 8)}-${date.substring(0, 2)}-${date.substring(2, 4)}T${time.substring(0, 2)}:${time.substring(2, 4)}:${time.substring(4, 6)}.000Z`;
|
|
301
|
+
const millis = Date.parse(timestamp);
|
|
302
|
+
return millis / 1e3;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Converts a timestamp to a string
|
|
306
|
+
*
|
|
307
|
+
* ISO-8601 format for 'epoch'
|
|
308
|
+
* HH:MM:SS for 'tod'
|
|
309
|
+
* @param time
|
|
310
|
+
* @param format
|
|
311
|
+
* @returns
|
|
312
|
+
*/
|
|
313
|
+
static timestampToString(time, format) {
|
|
314
|
+
const date = new Date(time * 1e3);
|
|
315
|
+
if (format == "tod") {
|
|
316
|
+
return date.toISOString().slice(11, 19);
|
|
317
|
+
}
|
|
318
|
+
return date.toISOString().slice(0, -5) + "Z";
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
|
|
239
322
|
// lib/utils/route_utils.ts
|
|
240
323
|
var RouteUtils = class _RouteUtils {
|
|
241
324
|
static formatFlightState(state) {
|
|
@@ -290,20 +373,36 @@ var RouteUtils = class _RouteUtils {
|
|
|
290
373
|
static getWaypoint(leg) {
|
|
291
374
|
const regex = leg.match(/^([A-Z]+)(\d{3})-(\d{4})$/);
|
|
292
375
|
if (regex?.length == 4) {
|
|
293
|
-
return {
|
|
376
|
+
return {
|
|
377
|
+
name: regex[1],
|
|
378
|
+
offset: {
|
|
379
|
+
bearing: parseInt(regex[2]),
|
|
380
|
+
distance: parseInt(regex[3]) / 10
|
|
381
|
+
}
|
|
382
|
+
};
|
|
294
383
|
}
|
|
295
384
|
const waypoint = leg.split(",");
|
|
296
385
|
if (waypoint.length == 2) {
|
|
297
|
-
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
386
|
+
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
387
|
+
waypoint[1]
|
|
388
|
+
);
|
|
298
389
|
if (position) {
|
|
299
|
-
return {
|
|
390
|
+
return {
|
|
391
|
+
name: waypoint[0],
|
|
392
|
+
latitude: position.latitude,
|
|
393
|
+
longitude: position.longitude
|
|
394
|
+
};
|
|
300
395
|
}
|
|
301
396
|
}
|
|
302
397
|
if (leg.length == 13 || leg.length == 14) {
|
|
303
398
|
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(leg);
|
|
304
399
|
const name = waypoint.length == 2 ? waypoint[0] : "";
|
|
305
400
|
if (position) {
|
|
306
|
-
return {
|
|
401
|
+
return {
|
|
402
|
+
name,
|
|
403
|
+
latitude: position.latitude,
|
|
404
|
+
longitude: position.longitude
|
|
405
|
+
};
|
|
307
406
|
}
|
|
308
407
|
}
|
|
309
408
|
return { name: leg };
|
|
@@ -528,8 +627,11 @@ var ResultFormatter = class {
|
|
|
528
627
|
value: decodeResult.raw.fuel_remaining.toString()
|
|
529
628
|
});
|
|
530
629
|
}
|
|
630
|
+
static checksumAlgorithm(decodeResult, value) {
|
|
631
|
+
decodeResult.raw.checksum_algorithm = value;
|
|
632
|
+
}
|
|
531
633
|
static checksum(decodeResult, value) {
|
|
532
|
-
decodeResult.raw.checksum =
|
|
634
|
+
decodeResult.raw.checksum = value;
|
|
533
635
|
decodeResult.formatted.items.push({
|
|
534
636
|
type: "message_checksum",
|
|
535
637
|
code: "CHECKSUM",
|
|
@@ -568,7 +670,9 @@ var ResultFormatter = class {
|
|
|
568
670
|
if (value.length === 0) {
|
|
569
671
|
return;
|
|
570
672
|
}
|
|
571
|
-
decodeResult.raw.outside_air_temperature = Number(
|
|
673
|
+
decodeResult.raw.outside_air_temperature = Number(
|
|
674
|
+
value.replace("M", "-").replace("P", "+")
|
|
675
|
+
);
|
|
572
676
|
decodeResult.formatted.items.push({
|
|
573
677
|
type: "outside_air_temperature",
|
|
574
678
|
code: "OATEMP",
|
|
@@ -785,17 +889,112 @@ var ResultFormatter = class {
|
|
|
785
889
|
value: `${decodeResult.raw.sublabel}`
|
|
786
890
|
});
|
|
787
891
|
}
|
|
892
|
+
static requestedAltitudes(decodeResult, values) {
|
|
893
|
+
decodeResult.raw.requested_alts = values;
|
|
894
|
+
decodeResult.formatted.items.push({
|
|
895
|
+
type: "requested_altitudes",
|
|
896
|
+
code: "REQ_ALTS",
|
|
897
|
+
label: "Requested Altitudes",
|
|
898
|
+
value: `${decodeResult.raw.requested_alts.join(", ")}`
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
static desiredAltitude(decodeResult, value) {
|
|
902
|
+
decodeResult.raw.desired_alt = value;
|
|
903
|
+
decodeResult.formatted.items.push({
|
|
904
|
+
type: "desired_altitude",
|
|
905
|
+
code: "DES_ALT",
|
|
906
|
+
label: "Desired Altitude",
|
|
907
|
+
value: `${decodeResult.raw.desired_alt}`
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
static startPoint(decodeResult, value) {
|
|
911
|
+
decodeResult.raw.start_point = value;
|
|
912
|
+
decodeResult.formatted.items.push({
|
|
913
|
+
type: "start_point",
|
|
914
|
+
code: "START",
|
|
915
|
+
label: "Start Point",
|
|
916
|
+
value: `${decodeResult.raw.start_point}`
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
static routeNumber(decodeResult, value) {
|
|
920
|
+
decodeResult.raw.route_number = value;
|
|
921
|
+
decodeResult.formatted.items.push({
|
|
922
|
+
type: "route_number",
|
|
923
|
+
code: "RTE_NUM",
|
|
924
|
+
label: "Route Number",
|
|
925
|
+
value: `${decodeResult.raw.route_number}`
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
static flightPlan(decodeResult, value) {
|
|
929
|
+
decodeResult.raw.flight_plan = value;
|
|
930
|
+
decodeResult.formatted.items.push({
|
|
931
|
+
type: "flight_plan",
|
|
932
|
+
code: "FPN",
|
|
933
|
+
label: "Flight Plan",
|
|
934
|
+
value: `${decodeResult.raw.flight_plan}`
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
static groundAddress(decodeResult, value) {
|
|
938
|
+
decodeResult.raw.ground_address = value;
|
|
939
|
+
decodeResult.formatted.items.push({
|
|
940
|
+
type: "ground_address",
|
|
941
|
+
code: "GND_ADDR",
|
|
942
|
+
label: "Ground Address",
|
|
943
|
+
value: `${decodeResult.raw.ground_address}`
|
|
944
|
+
});
|
|
945
|
+
}
|
|
788
946
|
static unknown(decodeResult, value, sep = ",") {
|
|
789
|
-
if (!decodeResult.remaining.text)
|
|
790
|
-
|
|
791
|
-
else
|
|
792
|
-
decodeResult.remaining.text += sep + value;
|
|
947
|
+
if (!decodeResult.remaining.text) decodeResult.remaining.text = value;
|
|
948
|
+
else decodeResult.remaining.text += sep + value;
|
|
793
949
|
}
|
|
794
950
|
static unknownArr(decodeResult, value, sep = ",") {
|
|
795
951
|
this.unknown(decodeResult, value.join(sep), sep);
|
|
796
952
|
}
|
|
797
953
|
};
|
|
798
954
|
|
|
955
|
+
// lib/plugins/CBand.ts
|
|
956
|
+
var CBand = class extends DecoderPlugin {
|
|
957
|
+
name = "c-band";
|
|
958
|
+
qualifiers() {
|
|
959
|
+
return {
|
|
960
|
+
labels: ["*"]
|
|
961
|
+
};
|
|
962
|
+
}
|
|
963
|
+
decode(message, options = {}) {
|
|
964
|
+
let decodeResult = this.defaultResult();
|
|
965
|
+
decodeResult.decoder.name = this.name;
|
|
966
|
+
decodeResult.message = message;
|
|
967
|
+
let cband = message.text.match(
|
|
968
|
+
/^(?<msgno>[A-Z]\d{2}[A-Z])(?<airline>[A-Z0-9]{2})(?<number>[0-9]{4})/
|
|
969
|
+
);
|
|
970
|
+
if (cband?.groups) {
|
|
971
|
+
const messageText = message.text.substring(10);
|
|
972
|
+
const decoded = this.decoder.decode(
|
|
973
|
+
{
|
|
974
|
+
label: message.label,
|
|
975
|
+
sublabel: message.sublabel,
|
|
976
|
+
text: messageText
|
|
977
|
+
},
|
|
978
|
+
options
|
|
979
|
+
);
|
|
980
|
+
if (decoded.decoded) {
|
|
981
|
+
ResultFormatter.flightNumber(
|
|
982
|
+
decodeResult,
|
|
983
|
+
cband.groups.airline + Number(cband.groups.number)
|
|
984
|
+
);
|
|
985
|
+
decodeResult.decoded = true;
|
|
986
|
+
decodeResult.decoder.decodeLevel = decoded.decoder.decodeLevel;
|
|
987
|
+
decodeResult.decoder.name = this.name + "-" + decoded.decoder.name;
|
|
988
|
+
decodeResult.raw = { ...decodeResult.raw, ...decoded.raw };
|
|
989
|
+
decodeResult.formatted.description = decoded.formatted.description;
|
|
990
|
+
decodeResult.formatted.items.push(...decoded.formatted.items);
|
|
991
|
+
decodeResult.remaining = decoded.remaining;
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
return decodeResult;
|
|
995
|
+
}
|
|
996
|
+
};
|
|
997
|
+
|
|
799
998
|
// lib/plugins/Label_5Z_Slash.ts
|
|
800
999
|
var Label_5Z_Slash = class extends DecoderPlugin {
|
|
801
1000
|
name = "label-5z-slash";
|
|
@@ -866,12 +1065,23 @@ var Label_5Z_Slash = class extends DecoderPlugin {
|
|
|
866
1065
|
ResultFormatter.departureAirport(decodeResult, info[1]);
|
|
867
1066
|
ResultFormatter.arrivalAirport(decodeResult, info[2]);
|
|
868
1067
|
decodeResult.raw.day = Number(info[3]);
|
|
869
|
-
ResultFormatter.time_of_day(
|
|
1068
|
+
ResultFormatter.time_of_day(
|
|
1069
|
+
decodeResult,
|
|
1070
|
+
DateTimeUtils.convertHHMMSSToTod(info[4])
|
|
1071
|
+
);
|
|
870
1072
|
ResultFormatter.arrivalRunway(decodeResult, info[5].slice(1));
|
|
871
1073
|
ResultFormatter.unknownArr(decodeResult, data.slice(3), "/");
|
|
872
1074
|
} else if (type === "B3") {
|
|
873
|
-
ResultFormatter.departureAirport(
|
|
874
|
-
|
|
1075
|
+
ResultFormatter.departureAirport(
|
|
1076
|
+
decodeResult,
|
|
1077
|
+
header[1].substring(0, 3),
|
|
1078
|
+
"IATA"
|
|
1079
|
+
);
|
|
1080
|
+
ResultFormatter.arrivalAirport(
|
|
1081
|
+
decodeResult,
|
|
1082
|
+
header[1].substring(3),
|
|
1083
|
+
"IATA"
|
|
1084
|
+
);
|
|
875
1085
|
decodeResult.raw.day = Number(header[2]);
|
|
876
1086
|
ResultFormatter.arrivalRunway(decodeResult, header[3].slice(1));
|
|
877
1087
|
if (header.length > 4) {
|
|
@@ -882,19 +1092,36 @@ var Label_5Z_Slash = class extends DecoderPlugin {
|
|
|
882
1092
|
ResultFormatter.departureAirport(decodeResult, info[1]);
|
|
883
1093
|
ResultFormatter.arrivalAirport(decodeResult, info[2]);
|
|
884
1094
|
decodeResult.raw.day = Number(info[3]);
|
|
885
|
-
ResultFormatter.time_of_day(
|
|
1095
|
+
ResultFormatter.time_of_day(
|
|
1096
|
+
decodeResult,
|
|
1097
|
+
DateTimeUtils.convertHHMMSSToTod(info[4])
|
|
1098
|
+
);
|
|
886
1099
|
ResultFormatter.unknownArr(decodeResult, info.slice(5), " ");
|
|
887
1100
|
} else if (type === "C3") {
|
|
888
|
-
ResultFormatter.departureAirport(
|
|
889
|
-
|
|
1101
|
+
ResultFormatter.departureAirport(
|
|
1102
|
+
decodeResult,
|
|
1103
|
+
header[1].substring(0, 3),
|
|
1104
|
+
"IATA"
|
|
1105
|
+
);
|
|
1106
|
+
ResultFormatter.arrivalAirport(
|
|
1107
|
+
decodeResult,
|
|
1108
|
+
header[1].substring(3),
|
|
1109
|
+
"IATA"
|
|
1110
|
+
);
|
|
890
1111
|
} else if (type === "ET") {
|
|
891
1112
|
const airports = data[2].split(" ");
|
|
892
1113
|
ResultFormatter.departureAirport(decodeResult, airports[1]);
|
|
893
1114
|
ResultFormatter.arrivalAirport(decodeResult, airports[2]);
|
|
894
1115
|
decodeResult.raw.day = Number(airports[3]);
|
|
895
|
-
ResultFormatter.time_of_day(
|
|
1116
|
+
ResultFormatter.time_of_day(
|
|
1117
|
+
decodeResult,
|
|
1118
|
+
DateTimeUtils.convertHHMMSSToTod(airports[4])
|
|
1119
|
+
);
|
|
896
1120
|
const estimates = data[3].split(" ");
|
|
897
|
-
ResultFormatter.eta(
|
|
1121
|
+
ResultFormatter.eta(
|
|
1122
|
+
decodeResult,
|
|
1123
|
+
DateTimeUtils.convertHHMMSSToTod(estimates[1])
|
|
1124
|
+
);
|
|
898
1125
|
ResultFormatter.unknown(decodeResult, estimates[2]);
|
|
899
1126
|
} else {
|
|
900
1127
|
if (options.debug) {
|
|
@@ -917,7 +1144,6 @@ var Label_5Z_Slash = class extends DecoderPlugin {
|
|
|
917
1144
|
|
|
918
1145
|
// lib/plugins/Label_10_LDR.ts
|
|
919
1146
|
var Label_10_LDR = class extends DecoderPlugin {
|
|
920
|
-
// eslint-disable-line camelcase
|
|
921
1147
|
name = "label-10-ldr";
|
|
922
1148
|
qualifiers() {
|
|
923
1149
|
return {
|
|
@@ -956,7 +1182,10 @@ var Label_10_LDR = class extends DecoderPlugin {
|
|
|
956
1182
|
if (altRwy != "") {
|
|
957
1183
|
ResultFormatter.alternateRunway(decodeResult, altRwy);
|
|
958
1184
|
}
|
|
959
|
-
ResultFormatter.unknownArr(decodeResult, [
|
|
1185
|
+
ResultFormatter.unknownArr(decodeResult, [
|
|
1186
|
+
...parts.slice(0, 5),
|
|
1187
|
+
...parts.slice(15)
|
|
1188
|
+
]);
|
|
960
1189
|
decodeResult.decoded = true;
|
|
961
1190
|
decodeResult.decoder.decodeLevel = "partial";
|
|
962
1191
|
return decodeResult;
|
|
@@ -965,7 +1194,6 @@ var Label_10_LDR = class extends DecoderPlugin {
|
|
|
965
1194
|
|
|
966
1195
|
// lib/plugins/Label_10_POS.ts
|
|
967
1196
|
var Label_10_POS = class extends DecoderPlugin {
|
|
968
|
-
// eslint-disable-line camelcase
|
|
969
1197
|
name = "label-10-pos";
|
|
970
1198
|
qualifiers() {
|
|
971
1199
|
return {
|
|
@@ -996,7 +1224,11 @@ var Label_10_POS = class extends DecoderPlugin {
|
|
|
996
1224
|
};
|
|
997
1225
|
ResultFormatter.position(decodeResult, position);
|
|
998
1226
|
ResultFormatter.altitude(decodeResult, Number(parts[7]));
|
|
999
|
-
ResultFormatter.unknownArr(decodeResult, [
|
|
1227
|
+
ResultFormatter.unknownArr(decodeResult, [
|
|
1228
|
+
parts[0],
|
|
1229
|
+
...parts.slice(3, 7),
|
|
1230
|
+
...parts.slice(8)
|
|
1231
|
+
]);
|
|
1000
1232
|
decodeResult.decoded = true;
|
|
1001
1233
|
decodeResult.decoder.decodeLevel = "partial";
|
|
1002
1234
|
return decodeResult;
|
|
@@ -1005,7 +1237,6 @@ var Label_10_POS = class extends DecoderPlugin {
|
|
|
1005
1237
|
|
|
1006
1238
|
// lib/plugins/Label_10_Slash.ts
|
|
1007
1239
|
var Label_10_Slash = class extends DecoderPlugin {
|
|
1008
|
-
// eslint-disable-line camelcase
|
|
1009
1240
|
name = "label-10-slash";
|
|
1010
1241
|
qualifiers() {
|
|
1011
1242
|
return {
|
|
@@ -1038,23 +1269,34 @@ var Label_10_Slash = class extends DecoderPlugin {
|
|
|
1038
1269
|
ResultFormatter.heading(decodeResult, Number(parts[5]));
|
|
1039
1270
|
ResultFormatter.altitude(decodeResult, 100 * Number(parts[6]));
|
|
1040
1271
|
ResultFormatter.arrivalAirport(decodeResult, parts[7]);
|
|
1041
|
-
ResultFormatter.eta(
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1272
|
+
ResultFormatter.eta(
|
|
1273
|
+
decodeResult,
|
|
1274
|
+
DateTimeUtils.convertHHMMSSToTod(parts[8])
|
|
1275
|
+
);
|
|
1276
|
+
const waypoints = [
|
|
1277
|
+
{
|
|
1278
|
+
name: parts[11]
|
|
1279
|
+
},
|
|
1280
|
+
{
|
|
1281
|
+
name: parts[12],
|
|
1282
|
+
time: DateTimeUtils.convertHHMMSSToTod(parts[13]),
|
|
1283
|
+
timeFormat: "tod"
|
|
1284
|
+
},
|
|
1285
|
+
{
|
|
1286
|
+
name: parts[14],
|
|
1287
|
+
time: DateTimeUtils.convertHHMMSSToTod(parts[15]),
|
|
1288
|
+
timeFormat: "tod"
|
|
1289
|
+
}
|
|
1290
|
+
];
|
|
1053
1291
|
ResultFormatter.route(decodeResult, { waypoints });
|
|
1054
1292
|
if (parts[16]) {
|
|
1055
1293
|
ResultFormatter.departureAirport(decodeResult, parts[16]);
|
|
1056
1294
|
}
|
|
1057
|
-
ResultFormatter.unknownArr(
|
|
1295
|
+
ResultFormatter.unknownArr(
|
|
1296
|
+
decodeResult,
|
|
1297
|
+
[parts[3], parts[4], ...parts.slice(9, 11), ...parts.slice(17)],
|
|
1298
|
+
"/"
|
|
1299
|
+
);
|
|
1058
1300
|
decodeResult.decoded = true;
|
|
1059
1301
|
decodeResult.decoder.decodeLevel = "partial";
|
|
1060
1302
|
return decodeResult;
|
|
@@ -1079,7 +1321,7 @@ var Label_12_N_Space = class extends DecoderPlugin {
|
|
|
1079
1321
|
let results = message.text.match(variant1Regex);
|
|
1080
1322
|
if (results?.groups) {
|
|
1081
1323
|
if (options.debug) {
|
|
1082
|
-
console.log(
|
|
1324
|
+
console.log("Label 12 N : results");
|
|
1083
1325
|
console.log(results);
|
|
1084
1326
|
}
|
|
1085
1327
|
ResultFormatter.position(decodeResult, {
|
|
@@ -1088,7 +1330,11 @@ var Label_12_N_Space = class extends DecoderPlugin {
|
|
|
1088
1330
|
});
|
|
1089
1331
|
const altitude = results.groups.alt == "GRD" || results.groups.alt == "***" ? 0 : Number(results.groups.alt);
|
|
1090
1332
|
ResultFormatter.altitude(decodeResult, altitude);
|
|
1091
|
-
ResultFormatter.unknownArr(decodeResult, [
|
|
1333
|
+
ResultFormatter.unknownArr(decodeResult, [
|
|
1334
|
+
results.groups.unkwn1,
|
|
1335
|
+
results.groups.unkwn2,
|
|
1336
|
+
results.groups.unkwn3
|
|
1337
|
+
]);
|
|
1092
1338
|
decodeResult.decoded = true;
|
|
1093
1339
|
decodeResult.decoder.decodeLevel = "partial";
|
|
1094
1340
|
return decodeResult;
|
|
@@ -1130,15 +1376,32 @@ var Label_12_POS = class extends DecoderPlugin {
|
|
|
1130
1376
|
const lat = data[0].substring(0, 8);
|
|
1131
1377
|
const lon = data[0].substring(8);
|
|
1132
1378
|
ResultFormatter.position(decodeResult, {
|
|
1133
|
-
latitude: CoordinateUtils.getDirection(lat[0]) * CoordinateUtils.dmsToDecimalDegrees(
|
|
1134
|
-
|
|
1379
|
+
latitude: CoordinateUtils.getDirection(lat[0]) * CoordinateUtils.dmsToDecimalDegrees(
|
|
1380
|
+
Number(lat.substring(1, 4)),
|
|
1381
|
+
Number(lat.substring(4, 6)),
|
|
1382
|
+
Number(lat.substring(6, 8))
|
|
1383
|
+
),
|
|
1384
|
+
longitude: CoordinateUtils.getDirection(lon[0]) * CoordinateUtils.dmsToDecimalDegrees(
|
|
1385
|
+
Number(lon.substring(1, 4)),
|
|
1386
|
+
Number(lon.substring(4, 6)),
|
|
1387
|
+
Number(lon.substring(6, 8))
|
|
1388
|
+
)
|
|
1135
1389
|
});
|
|
1136
1390
|
ResultFormatter.unknown(decodeResult, data[1]);
|
|
1137
|
-
ResultFormatter.time_of_day(
|
|
1391
|
+
ResultFormatter.time_of_day(
|
|
1392
|
+
decodeResult,
|
|
1393
|
+
DateTimeUtils.convertHHMMSSToTod(data[2])
|
|
1394
|
+
);
|
|
1138
1395
|
ResultFormatter.altitude(decodeResult, 10 * Number(data[3]));
|
|
1139
1396
|
ResultFormatter.unknownArr(decodeResult, data.slice(4, 7));
|
|
1140
|
-
ResultFormatter.currentFuel(
|
|
1141
|
-
|
|
1397
|
+
ResultFormatter.currentFuel(
|
|
1398
|
+
decodeResult,
|
|
1399
|
+
Number(data[7].substring(3).trim())
|
|
1400
|
+
);
|
|
1401
|
+
ResultFormatter.eta(
|
|
1402
|
+
decodeResult,
|
|
1403
|
+
DateTimeUtils.convertHHMMSSToTod(data[8].substring(3).trim())
|
|
1404
|
+
);
|
|
1142
1405
|
ResultFormatter.departureAirport(decodeResult, data[9]);
|
|
1143
1406
|
ResultFormatter.arrivalAirport(decodeResult, data[10]);
|
|
1144
1407
|
ResultFormatter.unknown(decodeResult, data[11]);
|
|
@@ -1150,7 +1413,6 @@ var Label_12_POS = class extends DecoderPlugin {
|
|
|
1150
1413
|
|
|
1151
1414
|
// lib/plugins/Label_13Through18_Slash.ts
|
|
1152
1415
|
var Label_13Through18_Slash = class extends DecoderPlugin {
|
|
1153
|
-
// eslint-disable-line camelcase
|
|
1154
1416
|
name = "label-13-18-slash";
|
|
1155
1417
|
qualifiers() {
|
|
1156
1418
|
return {
|
|
@@ -1197,11 +1459,22 @@ var Label_13Through18_Slash = class extends DecoderPlugin {
|
|
|
1197
1459
|
const location = lines[i].substring(5).split(",");
|
|
1198
1460
|
let position;
|
|
1199
1461
|
if (location[0].startsWith("+") || location[0].startsWith("-")) {
|
|
1200
|
-
position = {
|
|
1462
|
+
position = {
|
|
1463
|
+
latitude: Number(location[0]),
|
|
1464
|
+
longitude: Number(location[1])
|
|
1465
|
+
};
|
|
1201
1466
|
} else {
|
|
1202
1467
|
position = {
|
|
1203
|
-
latitude: CoordinateUtils.getDirection(location[0][0]) * CoordinateUtils.dmsToDecimalDegrees(
|
|
1204
|
-
|
|
1468
|
+
latitude: CoordinateUtils.getDirection(location[0][0]) * CoordinateUtils.dmsToDecimalDegrees(
|
|
1469
|
+
Number(location[0].substring(1, 3)),
|
|
1470
|
+
Number(location[0].substring(3, 5)),
|
|
1471
|
+
Number(location[0].substring(5, 7))
|
|
1472
|
+
),
|
|
1473
|
+
longitude: CoordinateUtils.getDirection(location[1][0]) * CoordinateUtils.dmsToDecimalDegrees(
|
|
1474
|
+
Number(location[1].substring(1, 4)),
|
|
1475
|
+
Number(location[1].substring(4, 6)),
|
|
1476
|
+
Number(location[1].substring(6, 8))
|
|
1477
|
+
)
|
|
1205
1478
|
};
|
|
1206
1479
|
}
|
|
1207
1480
|
ResultFormatter.position(decodeResult, position);
|
|
@@ -1252,22 +1525,38 @@ var Label_15 = class extends DecoderPlugin {
|
|
|
1252
1525
|
decodeResult.message = message;
|
|
1253
1526
|
if (message.text.startsWith("(2") && message.text.endsWith("(Z")) {
|
|
1254
1527
|
const between = message.text.substring(2, message.text.length - 2);
|
|
1255
|
-
ResultFormatter.position(
|
|
1528
|
+
ResultFormatter.position(
|
|
1529
|
+
decodeResult,
|
|
1530
|
+
CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
1531
|
+
between.substring(0, 13)
|
|
1532
|
+
)
|
|
1533
|
+
);
|
|
1256
1534
|
if (between.length === 25) {
|
|
1257
1535
|
ResultFormatter.unknown(decodeResult, between.substring(13, 19));
|
|
1258
1536
|
const alt = between.substring(19, 22);
|
|
1259
1537
|
if (alt != "---") {
|
|
1260
1538
|
ResultFormatter.altitude(decodeResult, 100 * Number(alt));
|
|
1261
1539
|
}
|
|
1262
|
-
ResultFormatter.temperature(
|
|
1540
|
+
ResultFormatter.temperature(
|
|
1541
|
+
decodeResult,
|
|
1542
|
+
between.substring(22).replaceAll(" ", "0")
|
|
1543
|
+
);
|
|
1263
1544
|
} else if (between.substring(13, 16) === "OFF") {
|
|
1264
1545
|
const ddmmyy = between.substring(16, 22);
|
|
1265
1546
|
const hhmm = between.substring(22, 26);
|
|
1266
1547
|
if (ddmmyy != "------") {
|
|
1267
1548
|
const mmddyy = ddmmyy.substring(2, 4) + ddmmyy.substring(0, 2) + ddmmyy.substring(4);
|
|
1268
|
-
ResultFormatter.off(
|
|
1549
|
+
ResultFormatter.off(
|
|
1550
|
+
decodeResult,
|
|
1551
|
+
DateTimeUtils.convertDateTimeToEpoch(hhmm + "00", mmddyy),
|
|
1552
|
+
"epoch"
|
|
1553
|
+
);
|
|
1269
1554
|
} else {
|
|
1270
|
-
ResultFormatter.off(
|
|
1555
|
+
ResultFormatter.off(
|
|
1556
|
+
decodeResult,
|
|
1557
|
+
DateTimeUtils.convertHHMMSSToTod(hhmm),
|
|
1558
|
+
"tod"
|
|
1559
|
+
);
|
|
1271
1560
|
}
|
|
1272
1561
|
ResultFormatter.unknown(decodeResult, between.substring(26));
|
|
1273
1562
|
} else {
|
|
@@ -1312,7 +1601,10 @@ var Label_15_FST = class extends DecoderPlugin {
|
|
|
1312
1601
|
const lat = Number(stringCoords.substring(1, 7)) / 1e4 * (firstChar === "S" ? -1 : 1);
|
|
1313
1602
|
const lon = Number(stringCoords.substring(8, 15)) / 1e4 * (middleChar === "W" ? -1 : 1);
|
|
1314
1603
|
ResultFormatter.position(decodeResult, { latitude: lat, longitude: lon });
|
|
1315
|
-
ResultFormatter.altitude(
|
|
1604
|
+
ResultFormatter.altitude(
|
|
1605
|
+
decodeResult,
|
|
1606
|
+
Number(stringCoords.substring(15)) * 100
|
|
1607
|
+
);
|
|
1316
1608
|
} else {
|
|
1317
1609
|
decodeResult.decoded = false;
|
|
1318
1610
|
decodeResult.decoder.decodeLevel = "none";
|
|
@@ -1408,7 +1700,7 @@ var Label_16_N_Space = class extends DecoderPlugin {
|
|
|
1408
1700
|
let results = message.text.match(variant1Regex);
|
|
1409
1701
|
if (results?.groups) {
|
|
1410
1702
|
if (options.debug) {
|
|
1411
|
-
console.log(
|
|
1703
|
+
console.log("Label 16 N : results");
|
|
1412
1704
|
console.log(results);
|
|
1413
1705
|
}
|
|
1414
1706
|
let pos = {
|
|
@@ -1418,7 +1710,10 @@ var Label_16_N_Space = class extends DecoderPlugin {
|
|
|
1418
1710
|
const altitude = results.groups.alt == "GRD" || results.groups.alt == "***" ? 0 : Number(results.groups.alt);
|
|
1419
1711
|
ResultFormatter.position(decodeResult, pos);
|
|
1420
1712
|
ResultFormatter.altitude(decodeResult, altitude);
|
|
1421
|
-
ResultFormatter.unknownArr(decodeResult, [
|
|
1713
|
+
ResultFormatter.unknownArr(decodeResult, [
|
|
1714
|
+
results.groups.unkwn1,
|
|
1715
|
+
results.groups.unkwn2
|
|
1716
|
+
]);
|
|
1422
1717
|
decodeResult.decoded = true;
|
|
1423
1718
|
decodeResult.decoder.decodeLevel = "partial";
|
|
1424
1719
|
return decodeResult;
|
|
@@ -1426,7 +1721,7 @@ var Label_16_N_Space = class extends DecoderPlugin {
|
|
|
1426
1721
|
results = message.text.match(variant2Regex);
|
|
1427
1722
|
if (results?.groups) {
|
|
1428
1723
|
if (options.debug) {
|
|
1429
|
-
console.log(
|
|
1724
|
+
console.log("Label 16 N : results");
|
|
1430
1725
|
console.log(results);
|
|
1431
1726
|
}
|
|
1432
1727
|
let pos = {
|
|
@@ -1472,17 +1767,22 @@ var Label_16_POSA1 = class extends DecoderPlugin {
|
|
|
1472
1767
|
decodeResult.decoder.decodeLevel = "none";
|
|
1473
1768
|
return decodeResult;
|
|
1474
1769
|
}
|
|
1475
|
-
ResultFormatter.position(
|
|
1770
|
+
ResultFormatter.position(
|
|
1771
|
+
decodeResult,
|
|
1772
|
+
CoordinateUtils.decodeStringCoordinates(fields[0].substring(5))
|
|
1773
|
+
);
|
|
1476
1774
|
const waypoint = fields[1].trim();
|
|
1477
1775
|
const time = DateTimeUtils.convertHHMMSSToTod(fields[2]);
|
|
1478
1776
|
ResultFormatter.altitude(decodeResult, Number(fields[3]) * 100);
|
|
1479
1777
|
const nextWaypoint = fields[4].trim();
|
|
1480
1778
|
const nextTime = DateTimeUtils.convertHHMMSSToTod(fields[5]);
|
|
1481
1779
|
ResultFormatter.unknownArr(decodeResult, fields.slice(6), ",");
|
|
1482
|
-
ResultFormatter.route(decodeResult, {
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1780
|
+
ResultFormatter.route(decodeResult, {
|
|
1781
|
+
waypoints: [
|
|
1782
|
+
{ name: waypoint, time, timeFormat: "tod" },
|
|
1783
|
+
{ name: nextWaypoint, time: nextTime, timeFormat: "tod" }
|
|
1784
|
+
]
|
|
1785
|
+
});
|
|
1486
1786
|
decodeResult.decoded = true;
|
|
1487
1787
|
decodeResult.decoder.decodeLevel = "partial";
|
|
1488
1788
|
return decodeResult;
|
|
@@ -1517,7 +1817,10 @@ var Label_16_TOD = class extends DecoderPlugin {
|
|
|
1517
1817
|
if (fields[1] !== "") {
|
|
1518
1818
|
ResultFormatter.altitude(decodeResult, Number(fields[1]));
|
|
1519
1819
|
}
|
|
1520
|
-
ResultFormatter.eta(
|
|
1820
|
+
ResultFormatter.eta(
|
|
1821
|
+
decodeResult,
|
|
1822
|
+
DateTimeUtils.convertHHMMSSToTod(fields[2])
|
|
1823
|
+
);
|
|
1521
1824
|
ResultFormatter.unknown(decodeResult, fields[3]);
|
|
1522
1825
|
const temp = fields[4].split("/");
|
|
1523
1826
|
const posFields = temp[0].split(" ");
|
|
@@ -1538,9 +1841,9 @@ var Label_16_TOD = class extends DecoderPlugin {
|
|
|
1538
1841
|
var FlightPlanUtils = class _FlightPlanUtils {
|
|
1539
1842
|
/**
|
|
1540
1843
|
* Processes flight plan data
|
|
1541
|
-
*
|
|
1844
|
+
*
|
|
1542
1845
|
* Expected format is [header, key1, val1, ... keyN, valN]
|
|
1543
|
-
*
|
|
1846
|
+
*
|
|
1544
1847
|
* @param decodeResult - results
|
|
1545
1848
|
* @param data - original message split by ':'
|
|
1546
1849
|
* @returns whether all fields were processed or not
|
|
@@ -1572,6 +1875,9 @@ var FlightPlanUtils = class _FlightPlanUtils {
|
|
|
1572
1875
|
case "F":
|
|
1573
1876
|
addRoute(decodeResult, value);
|
|
1574
1877
|
break;
|
|
1878
|
+
case "FP":
|
|
1879
|
+
ResultFormatter.flightPlan(decodeResult, value.trim());
|
|
1880
|
+
break;
|
|
1575
1881
|
case "R":
|
|
1576
1882
|
addRunway(decodeResult, value);
|
|
1577
1883
|
break;
|
|
@@ -1626,6 +1932,14 @@ var FlightPlanUtils = class _FlightPlanUtils {
|
|
|
1626
1932
|
label: "Route Status",
|
|
1627
1933
|
value: "Route Mapped"
|
|
1628
1934
|
});
|
|
1935
|
+
} else if (header.startsWith("RS")) {
|
|
1936
|
+
decodeResult.raw.route_status = "RS";
|
|
1937
|
+
decodeResult.formatted.items.push({
|
|
1938
|
+
type: "status",
|
|
1939
|
+
code: "ROUTE_STATUS",
|
|
1940
|
+
label: "Route Status",
|
|
1941
|
+
value: "Route Saved"
|
|
1942
|
+
});
|
|
1629
1943
|
} else {
|
|
1630
1944
|
decodeResult.remaining.text += header;
|
|
1631
1945
|
allKnownFields = false;
|
|
@@ -1645,7 +1959,7 @@ var FlightPlanUtils = class _FlightPlanUtils {
|
|
|
1645
1959
|
decodeResult.raw.procedures.push({ type, route });
|
|
1646
1960
|
const procedureName = type.substring(0, 1).toUpperCase() + type.slice(1);
|
|
1647
1961
|
decodeResult.formatted.items.push({
|
|
1648
|
-
type:
|
|
1962
|
+
type: "procedure",
|
|
1649
1963
|
code: "proc",
|
|
1650
1964
|
label: `${procedureName} Procedure`,
|
|
1651
1965
|
value: RouteUtils.routeToString(route)
|
|
@@ -1666,7 +1980,9 @@ function addRunway(decodeResult, value) {
|
|
|
1666
1980
|
}
|
|
1667
1981
|
function addRoute(decodeResult, value) {
|
|
1668
1982
|
const route = value.split(".");
|
|
1669
|
-
ResultFormatter.route(decodeResult, {
|
|
1983
|
+
ResultFormatter.route(decodeResult, {
|
|
1984
|
+
waypoints: route.map((leg) => RouteUtils.getWaypoint(leg))
|
|
1985
|
+
});
|
|
1670
1986
|
}
|
|
1671
1987
|
function addCompanyRoute(decodeResult, value) {
|
|
1672
1988
|
const segments = value.split(".");
|
|
@@ -1699,9 +2015,14 @@ function addCompanyRoute(decodeResult, value) {
|
|
|
1699
2015
|
// lib/utils/h1_helper.ts
|
|
1700
2016
|
var H1Helper = class _H1Helper {
|
|
1701
2017
|
static decodeH1Message(decodeResult, message) {
|
|
1702
|
-
const checksum = message.slice(-4);
|
|
2018
|
+
const checksum = parseInt(message.slice(-4), 16);
|
|
1703
2019
|
const data = message.slice(0, message.length - 4);
|
|
1704
|
-
|
|
2020
|
+
let checksumAlgorithmUsed = "";
|
|
2021
|
+
if (crc16IbmSdlcRev(data) === checksum) {
|
|
2022
|
+
checksumAlgorithmUsed = "IBM-SDLC reversed";
|
|
2023
|
+
} else if (crc16Genibus(data) === checksum) {
|
|
2024
|
+
checksumAlgorithmUsed = "GENIBUS";
|
|
2025
|
+
} else {
|
|
1705
2026
|
decodeResult.decoded = false;
|
|
1706
2027
|
decodeResult.decoder.decodeLevel = "none";
|
|
1707
2028
|
return false;
|
|
@@ -1720,15 +2041,27 @@ var H1Helper = class _H1Helper {
|
|
|
1720
2041
|
case "AF":
|
|
1721
2042
|
processAirField(decodeResult, data2.split(","));
|
|
1722
2043
|
break;
|
|
2044
|
+
case "AK":
|
|
2045
|
+
ResultFormatter.unknown(decodeResult, fields[i], "/");
|
|
2046
|
+
break;
|
|
1723
2047
|
case "CG":
|
|
1724
2048
|
processCenterOfGravity(decodeResult, data2.split(","));
|
|
1725
2049
|
break;
|
|
1726
2050
|
case "DC":
|
|
1727
2051
|
processDateCode(decodeResult, data2.split(","));
|
|
1728
2052
|
break;
|
|
2053
|
+
case "DI":
|
|
2054
|
+
ResultFormatter.unknown(decodeResult, fields[i], "/");
|
|
2055
|
+
break;
|
|
1729
2056
|
case "DT":
|
|
1730
2057
|
processDT(decodeResult, data2.split(","));
|
|
1731
2058
|
break;
|
|
2059
|
+
case "DQ":
|
|
2060
|
+
ResultFormatter.desiredAltitude(
|
|
2061
|
+
decodeResult,
|
|
2062
|
+
parseInt(data2, 10) * 100
|
|
2063
|
+
);
|
|
2064
|
+
break;
|
|
1732
2065
|
case "ET":
|
|
1733
2066
|
processETA(data2, decodeResult, fields, i);
|
|
1734
2067
|
break;
|
|
@@ -1741,6 +2074,9 @@ var H1Helper = class _H1Helper {
|
|
|
1741
2074
|
case "FX":
|
|
1742
2075
|
ResultFormatter.freetext(decodeResult, data2);
|
|
1743
2076
|
break;
|
|
2077
|
+
case "GA":
|
|
2078
|
+
ResultFormatter.groundAddress(decodeResult, data2);
|
|
2079
|
+
break;
|
|
1744
2080
|
case "ID":
|
|
1745
2081
|
processIdentification(decodeResult, data2.split(","));
|
|
1746
2082
|
break;
|
|
@@ -1757,11 +2093,21 @@ var H1Helper = class _H1Helper {
|
|
|
1757
2093
|
case "RI":
|
|
1758
2094
|
case "RM":
|
|
1759
2095
|
case "RP":
|
|
2096
|
+
case "RS":
|
|
1760
2097
|
FlightPlanUtils.processFlightPlan(decodeResult, fields[i].split(":"));
|
|
1761
2098
|
break;
|
|
2099
|
+
case "RN":
|
|
2100
|
+
ResultFormatter.routeNumber(decodeResult, data2);
|
|
2101
|
+
break;
|
|
2102
|
+
case "RW":
|
|
2103
|
+
processRunway(decodeResult, data2.split(":"));
|
|
2104
|
+
break;
|
|
1762
2105
|
case "SN":
|
|
1763
2106
|
decodeResult.raw.serial_number = data2;
|
|
1764
2107
|
break;
|
|
2108
|
+
case "SP":
|
|
2109
|
+
ResultFormatter.startPoint(decodeResult, data2);
|
|
2110
|
+
break;
|
|
1765
2111
|
case "TD":
|
|
1766
2112
|
processTimeOfDeparture(decodeResult, data2.split(","));
|
|
1767
2113
|
break;
|
|
@@ -1774,23 +2120,23 @@ var H1Helper = class _H1Helper {
|
|
|
1774
2120
|
case "WD":
|
|
1775
2121
|
processWindData(decodeResult, data2);
|
|
1776
2122
|
break;
|
|
2123
|
+
case "WQ":
|
|
2124
|
+
processWeatherQuery(decodeResult, data2.split(":"));
|
|
2125
|
+
break;
|
|
1777
2126
|
default:
|
|
1778
2127
|
ResultFormatter.unknown(decodeResult, fields[i], "/");
|
|
1779
2128
|
}
|
|
1780
2129
|
}
|
|
2130
|
+
ResultFormatter.checksumAlgorithm(decodeResult, checksumAlgorithmUsed);
|
|
1781
2131
|
ResultFormatter.checksum(decodeResult, checksum);
|
|
1782
2132
|
return true;
|
|
1783
2133
|
}
|
|
1784
2134
|
static processPS(decodeResult, data) {
|
|
1785
|
-
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
2135
|
+
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
2136
|
+
data[0]
|
|
2137
|
+
);
|
|
1786
2138
|
if (position) {
|
|
1787
|
-
|
|
1788
|
-
decodeResult.formatted.items.push({
|
|
1789
|
-
type: "aircraft_position",
|
|
1790
|
-
code: "POS",
|
|
1791
|
-
label: "Aircraft Position",
|
|
1792
|
-
value: CoordinateUtils.coordinateString(position)
|
|
1793
|
-
});
|
|
2139
|
+
ResultFormatter.position(decodeResult, position);
|
|
1794
2140
|
}
|
|
1795
2141
|
if (data.length === 9) {
|
|
1796
2142
|
processRoute(decodeResult, data[3], data[1], data[5], data[4], void 0);
|
|
@@ -1807,7 +2153,9 @@ var H1Helper = class _H1Helper {
|
|
|
1807
2153
|
}
|
|
1808
2154
|
}
|
|
1809
2155
|
static processPosition(decodeResult, data) {
|
|
1810
|
-
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
2156
|
+
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
2157
|
+
data[0]
|
|
2158
|
+
);
|
|
1811
2159
|
if (position) {
|
|
1812
2160
|
ResultFormatter.position(decodeResult, position);
|
|
1813
2161
|
}
|
|
@@ -1823,7 +2171,15 @@ var H1Helper = class _H1Helper {
|
|
|
1823
2171
|
}
|
|
1824
2172
|
}
|
|
1825
2173
|
static processTimeStamp(decodeResult, data) {
|
|
1826
|
-
|
|
2174
|
+
if (data.length > 2) {
|
|
2175
|
+
const positionData = data.slice(1);
|
|
2176
|
+
positionData[0] = positionData[0].substring(6);
|
|
2177
|
+
this.processPosition(decodeResult, positionData);
|
|
2178
|
+
}
|
|
2179
|
+
let time = DateTimeUtils.convertDateTimeToEpoch(
|
|
2180
|
+
data[0],
|
|
2181
|
+
data[1].substring(0, 6)
|
|
2182
|
+
);
|
|
1827
2183
|
if (Number.isNaN(time)) {
|
|
1828
2184
|
const date = data[1].substring(2, 4) + data[1].substring(0, 2) + data[1].substring(4, 6);
|
|
1829
2185
|
time = DateTimeUtils.convertDateTimeToEpoch(data[0], date);
|
|
@@ -1834,10 +2190,16 @@ var H1Helper = class _H1Helper {
|
|
|
1834
2190
|
function processETA(data, decodeResult, fields, i) {
|
|
1835
2191
|
if (data.length === 5) {
|
|
1836
2192
|
ResultFormatter.day(decodeResult, Number(data.substring(0, 1)));
|
|
1837
|
-
ResultFormatter.eta(
|
|
2193
|
+
ResultFormatter.eta(
|
|
2194
|
+
decodeResult,
|
|
2195
|
+
DateTimeUtils.convertHHMMSSToTod(data.substring(1))
|
|
2196
|
+
);
|
|
1838
2197
|
} else if (data.length === 6) {
|
|
1839
2198
|
ResultFormatter.day(decodeResult, Number(data.substring(0, 2)));
|
|
1840
|
-
ResultFormatter.eta(
|
|
2199
|
+
ResultFormatter.eta(
|
|
2200
|
+
decodeResult,
|
|
2201
|
+
DateTimeUtils.convertHHMMSSToTod(data.substring(2))
|
|
2202
|
+
);
|
|
1841
2203
|
} else {
|
|
1842
2204
|
ResultFormatter.unknown(decodeResult, fields[i], "/");
|
|
1843
2205
|
}
|
|
@@ -1880,26 +2242,42 @@ function processIdentification(decodeResult, data) {
|
|
|
1880
2242
|
}
|
|
1881
2243
|
}
|
|
1882
2244
|
function processDT(decodeResult, data) {
|
|
1883
|
-
if (
|
|
1884
|
-
ResultFormatter.
|
|
1885
|
-
|
|
1886
|
-
|
|
2245
|
+
if (data.length === 9) {
|
|
2246
|
+
ResultFormatter.unknown(decodeResult, data[0]);
|
|
2247
|
+
if (!decodeResult.raw.arrival_icao) {
|
|
2248
|
+
ResultFormatter.arrivalAirport(decodeResult, data[1]);
|
|
2249
|
+
}
|
|
2250
|
+
ResultFormatter.arrivalRunway(decodeResult, data[2]);
|
|
2251
|
+
ResultFormatter.currentFuel(decodeResult, parseInt(data[3], 10));
|
|
2252
|
+
ResultFormatter.eta(
|
|
2253
|
+
decodeResult,
|
|
2254
|
+
DateTimeUtils.convertHHMMSSToTod(data[4])
|
|
2255
|
+
);
|
|
2256
|
+
ResultFormatter.unknown(decodeResult, data[5]);
|
|
2257
|
+
ResultFormatter.position(
|
|
2258
|
+
decodeResult,
|
|
2259
|
+
CoordinateUtils.decodeStringCoordinates(data[6])
|
|
2260
|
+
);
|
|
2261
|
+
ResultFormatter.unknown(decodeResult, data[7]);
|
|
2262
|
+
ResultFormatter.unknown(decodeResult, data[8]);
|
|
2263
|
+
return;
|
|
1887
2264
|
}
|
|
1888
|
-
if (data.length
|
|
2265
|
+
if (data.length === 4 || data.length === 5) {
|
|
2266
|
+
if (!decodeResult.raw.arrival_icao) {
|
|
2267
|
+
ResultFormatter.arrivalAirport(decodeResult, data[0]);
|
|
2268
|
+
}
|
|
1889
2269
|
ResultFormatter.arrivalRunway(decodeResult, data[1]);
|
|
2270
|
+
ResultFormatter.currentFuel(decodeResult, parseInt(data[2], 10));
|
|
2271
|
+
ResultFormatter.eta(
|
|
2272
|
+
decodeResult,
|
|
2273
|
+
DateTimeUtils.convertHHMMSSToTod(data[3])
|
|
2274
|
+
);
|
|
2275
|
+
if (data.length > 4) {
|
|
2276
|
+
ResultFormatter.remainingFuel(decodeResult, Number(data[4]));
|
|
2277
|
+
}
|
|
2278
|
+
return;
|
|
1890
2279
|
}
|
|
1891
|
-
|
|
1892
|
-
ResultFormatter.currentFuel(decodeResult, Number(data[2]));
|
|
1893
|
-
}
|
|
1894
|
-
if (data.length > 3) {
|
|
1895
|
-
ResultFormatter.eta(decodeResult, DateTimeUtils.convertHHMMSSToTod(data[3]));
|
|
1896
|
-
}
|
|
1897
|
-
if (data.length > 4) {
|
|
1898
|
-
ResultFormatter.remainingFuel(decodeResult, Number(data[4]));
|
|
1899
|
-
}
|
|
1900
|
-
if (data.length > 5) {
|
|
1901
|
-
ResultFormatter.unknownArr(decodeResult, data);
|
|
1902
|
-
}
|
|
2280
|
+
ResultFormatter.unknownArr(decodeResult, data, ",");
|
|
1903
2281
|
}
|
|
1904
2282
|
function processLandingReport(decodeResult, data) {
|
|
1905
2283
|
if (data.length === 19) {
|
|
@@ -1932,18 +2310,30 @@ function processCenterOfGravity(decodeResult, data) {
|
|
|
1932
2310
|
ResultFormatter.unknown(decodeResult, data.join(","));
|
|
1933
2311
|
}
|
|
1934
2312
|
}
|
|
1935
|
-
function parseMessageType(decodeResult,
|
|
2313
|
+
function parseMessageType(decodeResult, messagePart) {
|
|
2314
|
+
const messageParts = messagePart.split(",");
|
|
2315
|
+
const messageType = messageParts[0];
|
|
1936
2316
|
if (messageType.startsWith("POS")) {
|
|
1937
|
-
H1Helper.processPosition(decodeResult,
|
|
2317
|
+
H1Helper.processPosition(decodeResult, messagePart.substring(3).split(","));
|
|
1938
2318
|
return processMessageType(decodeResult, "POS");
|
|
1939
|
-
} else if (messageType.length ===
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
2319
|
+
} else if (messageType.length === 6) {
|
|
2320
|
+
const part1 = processMessageType(decodeResult, messageType.substring(0, 3));
|
|
2321
|
+
const description = decodeResult.formatted.description;
|
|
2322
|
+
const part2 = processMessageType(decodeResult, messageType.substring(3, 6));
|
|
2323
|
+
decodeResult.formatted.description = description + " for " + decodeResult.formatted.description;
|
|
2324
|
+
if (messageParts.length > 1) {
|
|
2325
|
+
ResultFormatter.unknown(
|
|
2326
|
+
decodeResult,
|
|
2327
|
+
messageParts.slice(1).join(","),
|
|
2328
|
+
"/"
|
|
2329
|
+
);
|
|
1944
2330
|
}
|
|
2331
|
+
return part1 && part2;
|
|
1945
2332
|
}
|
|
1946
|
-
|
|
2333
|
+
if (messageParts.length > 1) {
|
|
2334
|
+
ResultFormatter.unknown(decodeResult, messageParts.slice(1).join(","), "/");
|
|
2335
|
+
}
|
|
2336
|
+
return processMessageType(decodeResult, messageType);
|
|
1947
2337
|
}
|
|
1948
2338
|
function processMessageType(decodeResult, type) {
|
|
1949
2339
|
if (type === "FPN") {
|
|
@@ -1951,7 +2341,9 @@ function processMessageType(decodeResult, type) {
|
|
|
1951
2341
|
} else if (type === "FTX") {
|
|
1952
2342
|
decodeResult.formatted.description = "Free Text";
|
|
1953
2343
|
} else if (type === "INI") {
|
|
1954
|
-
decodeResult.formatted.description = "
|
|
2344
|
+
decodeResult.formatted.description = "Initial Report";
|
|
2345
|
+
} else if (type === "LDI") {
|
|
2346
|
+
decodeResult.formatted.description = "Load Distribution Information";
|
|
1955
2347
|
} else if (type === "PER") {
|
|
1956
2348
|
decodeResult.formatted.description = "Performance Report";
|
|
1957
2349
|
} else if (type === "POS") {
|
|
@@ -1960,6 +2352,12 @@ function processMessageType(decodeResult, type) {
|
|
|
1960
2352
|
decodeResult.formatted.description = "Progress Report";
|
|
1961
2353
|
} else if (type === "PWI") {
|
|
1962
2354
|
decodeResult.formatted.description = "Pilot Weather Information";
|
|
2355
|
+
} else if (type === "REJ") {
|
|
2356
|
+
decodeResult.formatted.description = "Reject";
|
|
2357
|
+
} else if (type === "REQ") {
|
|
2358
|
+
decodeResult.formatted.description = "Request";
|
|
2359
|
+
} else if (type === "RES") {
|
|
2360
|
+
decodeResult.formatted.description = "Response";
|
|
1963
2361
|
} else {
|
|
1964
2362
|
decodeResult.formatted.description = "Unknown H1 Message";
|
|
1965
2363
|
return false;
|
|
@@ -1975,6 +2373,22 @@ function processDateCode(decodeResult, data) {
|
|
|
1975
2373
|
decodeResult.raw.message_timestamp = time;
|
|
1976
2374
|
}
|
|
1977
2375
|
}
|
|
2376
|
+
function processWeatherQuery(decodeResult, data) {
|
|
2377
|
+
if (data.length !== 2) {
|
|
2378
|
+
ResultFormatter.unknown(decodeResult, data.join(":"), "WQ/");
|
|
2379
|
+
return;
|
|
2380
|
+
}
|
|
2381
|
+
const alts = data[0].split(".");
|
|
2382
|
+
const route = data[1].split(".");
|
|
2383
|
+
ResultFormatter.requestedAltitudes(
|
|
2384
|
+
decodeResult,
|
|
2385
|
+
alts.map((a) => parseInt(a, 10) * 100)
|
|
2386
|
+
);
|
|
2387
|
+
const waypoints = route.map((wp) => {
|
|
2388
|
+
return { name: wp };
|
|
2389
|
+
});
|
|
2390
|
+
ResultFormatter.route(decodeResult, { waypoints });
|
|
2391
|
+
}
|
|
1978
2392
|
function processRoute(decodeResult, last, time, next, eta, then, date) {
|
|
1979
2393
|
const lastTime = date ? DateTimeUtils.convertDateTimeToEpoch(time, date) : DateTimeUtils.convertHHMMSSToTod(time);
|
|
1980
2394
|
const nextTime = date ? DateTimeUtils.convertDateTimeToEpoch(eta, date) : DateTimeUtils.convertHHMMSSToTod(eta);
|
|
@@ -1987,24 +2401,21 @@ function processRoute(decodeResult, last, time, next, eta, then, date) {
|
|
|
1987
2401
|
nextWaypoint.timeFormat = timeFormat;
|
|
1988
2402
|
const thenWaypoint = RouteUtils.getWaypoint(then || "?");
|
|
1989
2403
|
const waypoints = [lastWaypoint, nextWaypoint, thenWaypoint];
|
|
1990
|
-
|
|
1991
|
-
decodeResult.formatted.items.push({
|
|
1992
|
-
type: "aircraft_route",
|
|
1993
|
-
code: "ROUTE",
|
|
1994
|
-
label: "Aircraft Route",
|
|
1995
|
-
value: RouteUtils.routeToString(decodeResult.raw.route)
|
|
1996
|
-
});
|
|
2404
|
+
ResultFormatter.route(decodeResult, { waypoints });
|
|
1997
2405
|
}
|
|
1998
2406
|
function processWindData(decodeResult, message) {
|
|
1999
2407
|
const wind = [];
|
|
2000
2408
|
const flightLevel = Number(message.slice(0, 3));
|
|
2001
2409
|
const fields = message.slice(4).split(".");
|
|
2002
2410
|
fields.forEach((field) => {
|
|
2411
|
+
if (field.length < 4) {
|
|
2412
|
+
return;
|
|
2413
|
+
}
|
|
2003
2414
|
const data = field.split(",");
|
|
2004
2415
|
const waypoint = { name: data[0] };
|
|
2005
2416
|
const windData = data[1];
|
|
2006
|
-
const windDirection =
|
|
2007
|
-
const windSpeed =
|
|
2417
|
+
const windDirection = parseInt(windData.slice(0, 3), 10);
|
|
2418
|
+
const windSpeed = parseInt(windData.slice(3), 10);
|
|
2008
2419
|
if (data.length === 3) {
|
|
2009
2420
|
const tempData = data[2];
|
|
2010
2421
|
const tempFlightLevel = Number(tempData.slice(0, 3));
|
|
@@ -2031,7 +2442,16 @@ function processWindData(decodeResult, message) {
|
|
|
2031
2442
|
});
|
|
2032
2443
|
ResultFormatter.windData(decodeResult, wind);
|
|
2033
2444
|
}
|
|
2034
|
-
function
|
|
2445
|
+
function processRunway(decodeResult, data) {
|
|
2446
|
+
const parts = data[0].split(".");
|
|
2447
|
+
const more = parts[0].split(",");
|
|
2448
|
+
ResultFormatter.departureRunway(decodeResult, more[0]);
|
|
2449
|
+
ResultFormatter.unknownArr(decodeResult, more.slice(1), ",");
|
|
2450
|
+
ResultFormatter.unknownArr(decodeResult, parts.slice(1), ".");
|
|
2451
|
+
ResultFormatter.departureAirport(decodeResult, data[1].split(",")[0]);
|
|
2452
|
+
ResultFormatter.unknownArr(decodeResult, data[1].split(",").slice(1), ",");
|
|
2453
|
+
}
|
|
2454
|
+
function crc16IbmSdlcRev(data) {
|
|
2035
2455
|
let crc = 65535;
|
|
2036
2456
|
const bytes = Buffer.from(data, "ascii");
|
|
2037
2457
|
for (const byte of bytes) {
|
|
@@ -2049,7 +2469,23 @@ function calculateChecksum(data) {
|
|
|
2049
2469
|
const nibble2 = crc >> 8 & 15;
|
|
2050
2470
|
const nibble3 = crc >> 4 & 15;
|
|
2051
2471
|
const nibble4 = crc & 15;
|
|
2052
|
-
return
|
|
2472
|
+
return nibble4 << 12 | nibble3 << 8 | nibble2 << 4 | nibble1;
|
|
2473
|
+
}
|
|
2474
|
+
function crc16Genibus(data) {
|
|
2475
|
+
let crc = 65535;
|
|
2476
|
+
const polynomial = 4129;
|
|
2477
|
+
const bytes = Buffer.from(data, "ascii");
|
|
2478
|
+
for (const byte of bytes) {
|
|
2479
|
+
crc ^= byte << 8;
|
|
2480
|
+
for (let i = 0; i < 8; i++) {
|
|
2481
|
+
if ((crc & 32768) !== 0) {
|
|
2482
|
+
crc = (crc << 1 ^ polynomial) & 65535;
|
|
2483
|
+
} else {
|
|
2484
|
+
crc = crc << 1 & 65535;
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2488
|
+
return (crc ^ 65535) & 65535;
|
|
2053
2489
|
}
|
|
2054
2490
|
|
|
2055
2491
|
// lib/plugins/Label_1J_2J_FTX.ts
|
|
@@ -2068,7 +2504,10 @@ var Label_1J_2J_FTX = class extends DecoderPlugin {
|
|
|
2068
2504
|
const parts = msg.split("/");
|
|
2069
2505
|
let decoded = false;
|
|
2070
2506
|
if (parts[0].length > 3) {
|
|
2071
|
-
decoded = H1Helper.decodeH1Message(
|
|
2507
|
+
decoded = H1Helper.decodeH1Message(
|
|
2508
|
+
decodeResult,
|
|
2509
|
+
msg.slice(parts[0].length - 3)
|
|
2510
|
+
);
|
|
2072
2511
|
decodeResult.remaining.text = parts[0].slice(0, 3) + "/" + decodeResult.remaining.text;
|
|
2073
2512
|
} else {
|
|
2074
2513
|
decoded = H1Helper.decodeH1Message(decodeResult, msg);
|
|
@@ -2104,16 +2543,26 @@ var Label_1M_Slash = class extends DecoderPlugin {
|
|
|
2104
2543
|
const results = message.text.split(/\n|\//).slice(1);
|
|
2105
2544
|
if (results) {
|
|
2106
2545
|
if (options.debug) {
|
|
2107
|
-
console.log(
|
|
2546
|
+
console.log("Label 1M ETA: results");
|
|
2108
2547
|
console.log(results);
|
|
2109
2548
|
}
|
|
2110
2549
|
decodeResult.raw.flight_number = results[0];
|
|
2111
2550
|
ResultFormatter.departureAirport(decodeResult, results[3]);
|
|
2112
2551
|
ResultFormatter.arrivalAirport(decodeResult, results[4]);
|
|
2113
2552
|
ResultFormatter.alternateAirport(decodeResult, results[5]);
|
|
2114
|
-
ResultFormatter.arrivalRunway(
|
|
2553
|
+
ResultFormatter.arrivalRunway(
|
|
2554
|
+
decodeResult,
|
|
2555
|
+
results[8].replace(results[4], "")
|
|
2556
|
+
);
|
|
2115
2557
|
const yymmdd = results[2];
|
|
2116
|
-
ResultFormatter.eta(
|
|
2558
|
+
ResultFormatter.eta(
|
|
2559
|
+
decodeResult,
|
|
2560
|
+
DateTimeUtils.convertDateTimeToEpoch(
|
|
2561
|
+
results[7] + "00",
|
|
2562
|
+
yymmdd.substring(2, 4) + yymmdd.substring(4, 6) + yymmdd.substring(0, 2)
|
|
2563
|
+
),
|
|
2564
|
+
"epoch"
|
|
2565
|
+
);
|
|
2117
2566
|
}
|
|
2118
2567
|
decodeResult.decoded = true;
|
|
2119
2568
|
decodeResult.decoder.decodeLevel = "partial";
|
|
@@ -2123,7 +2572,6 @@ var Label_1M_Slash = class extends DecoderPlugin {
|
|
|
2123
2572
|
|
|
2124
2573
|
// lib/plugins/Label_1L_3-line.ts
|
|
2125
2574
|
var Label_1L_3Line = class extends DecoderPlugin {
|
|
2126
|
-
// eslint-disable-line camelcase
|
|
2127
2575
|
name = "label-1l-3-line";
|
|
2128
2576
|
qualifiers() {
|
|
2129
2577
|
return {
|
|
@@ -2211,7 +2659,6 @@ var Label_1L_3Line = class extends DecoderPlugin {
|
|
|
2211
2659
|
|
|
2212
2660
|
// lib/plugins/Label_1L_070.ts
|
|
2213
2661
|
var Label_1L_070 = class extends DecoderPlugin {
|
|
2214
|
-
// eslint-disable-line camelcase
|
|
2215
2662
|
name = "label-1l-070";
|
|
2216
2663
|
qualifiers() {
|
|
2217
2664
|
return {
|
|
@@ -2245,8 +2692,14 @@ var Label_1L_070 = class extends DecoderPlugin {
|
|
|
2245
2692
|
}
|
|
2246
2693
|
ResultFormatter.departureAirport(decodeResult, parts[0]);
|
|
2247
2694
|
ResultFormatter.arrivalAirport(decodeResult, parts[1]);
|
|
2248
|
-
ResultFormatter.time_of_day(
|
|
2249
|
-
|
|
2695
|
+
ResultFormatter.time_of_day(
|
|
2696
|
+
decodeResult,
|
|
2697
|
+
DateTimeUtils.convertHHMMSSToTod(parts[2])
|
|
2698
|
+
);
|
|
2699
|
+
ResultFormatter.eta(
|
|
2700
|
+
decodeResult,
|
|
2701
|
+
DateTimeUtils.convertHHMMSSToTod(parts[3])
|
|
2702
|
+
);
|
|
2250
2703
|
ResultFormatter.position(decodeResult, {
|
|
2251
2704
|
latitude: CoordinateUtils.getDirection(parts[4][0]) * Number(parts[4].substring(1)),
|
|
2252
2705
|
longitude: CoordinateUtils.getDirection(parts[5][0]) * Number(parts[5].substring(1))
|
|
@@ -2260,7 +2713,6 @@ var Label_1L_070 = class extends DecoderPlugin {
|
|
|
2260
2713
|
|
|
2261
2714
|
// lib/plugins/Label_1L_660.ts
|
|
2262
2715
|
var Label_1L_660 = class extends DecoderPlugin {
|
|
2263
|
-
// eslint-disable-line camelcase
|
|
2264
2716
|
name = "label-1l-660";
|
|
2265
2717
|
qualifiers() {
|
|
2266
2718
|
return {
|
|
@@ -2292,12 +2744,17 @@ var Label_1L_660 = class extends DecoderPlugin {
|
|
|
2292
2744
|
decodeResult.decoder.decodeLevel = "none";
|
|
2293
2745
|
return decodeResult;
|
|
2294
2746
|
}
|
|
2295
|
-
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
2747
|
+
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
2748
|
+
parts[0]
|
|
2749
|
+
);
|
|
2296
2750
|
if (position) {
|
|
2297
2751
|
ResultFormatter.position(decodeResult, position);
|
|
2298
2752
|
}
|
|
2299
2753
|
const hhmmss = parts[1].substring(0, 6);
|
|
2300
|
-
ResultFormatter.time_of_day(
|
|
2754
|
+
ResultFormatter.time_of_day(
|
|
2755
|
+
decodeResult,
|
|
2756
|
+
DateTimeUtils.convertHHMMSSToTod(hhmmss)
|
|
2757
|
+
);
|
|
2301
2758
|
const fl = parts[1].substring(6, 9);
|
|
2302
2759
|
ResultFormatter.altitude(decodeResult, Number(fl) * 100);
|
|
2303
2760
|
const next = parts[1].substring(9);
|
|
@@ -2311,7 +2768,6 @@ var Label_1L_660 = class extends DecoderPlugin {
|
|
|
2311
2768
|
|
|
2312
2769
|
// lib/plugins/Label_1L_Slash.ts
|
|
2313
2770
|
var Label_1L_Slash = class extends DecoderPlugin {
|
|
2314
|
-
// eslint-disable-line camelcase
|
|
2315
2771
|
name = "label-1l-1-line";
|
|
2316
2772
|
qualifiers() {
|
|
2317
2773
|
return {
|
|
@@ -2350,7 +2806,10 @@ var Label_1L_Slash = class extends DecoderPlugin {
|
|
|
2350
2806
|
ResultFormatter.position(decodeResult, position);
|
|
2351
2807
|
const utc = data.get("UTC");
|
|
2352
2808
|
if (utc) {
|
|
2353
|
-
ResultFormatter.time_of_day(
|
|
2809
|
+
ResultFormatter.time_of_day(
|
|
2810
|
+
decodeResult,
|
|
2811
|
+
DateTimeUtils.convertHHMMSSToTod(utc)
|
|
2812
|
+
);
|
|
2354
2813
|
data.delete("UTC");
|
|
2355
2814
|
}
|
|
2356
2815
|
const alt = data.get("ALT");
|
|
@@ -2401,7 +2860,10 @@ var Label_20_POS = class extends DecoderPlugin {
|
|
|
2401
2860
|
console.log(`DEBUG: ${this.name}: Variation 1 detected`);
|
|
2402
2861
|
}
|
|
2403
2862
|
const rawCoords = fields[0];
|
|
2404
|
-
ResultFormatter.position(
|
|
2863
|
+
ResultFormatter.position(
|
|
2864
|
+
decodeResult,
|
|
2865
|
+
CoordinateUtils.decodeStringCoordinates(rawCoords)
|
|
2866
|
+
);
|
|
2405
2867
|
decodeResult.decoded = true;
|
|
2406
2868
|
decodeResult.decoder.decodeLevel = "full";
|
|
2407
2869
|
} else if (fields.length == 5) {
|
|
@@ -2416,7 +2878,9 @@ var Label_20_POS = class extends DecoderPlugin {
|
|
|
2416
2878
|
decodeResult.decoder.decodeLevel = "full";
|
|
2417
2879
|
} else {
|
|
2418
2880
|
if (options.debug) {
|
|
2419
|
-
console.log(
|
|
2881
|
+
console.log(
|
|
2882
|
+
`DEBUG: ${this.name}: Unknown variation. Field count: ${fields.length}, content: ${content}`
|
|
2883
|
+
);
|
|
2420
2884
|
}
|
|
2421
2885
|
decodeResult.decoded = false;
|
|
2422
2886
|
decodeResult.decoder.decodeLevel = "none";
|
|
@@ -2444,17 +2908,29 @@ var Label_21_POS = class extends DecoderPlugin {
|
|
|
2444
2908
|
const fields = content.split(",");
|
|
2445
2909
|
if (fields.length == 9) {
|
|
2446
2910
|
processPosition(decodeResult, fields[0].trim());
|
|
2447
|
-
ResultFormatter.time_of_day(
|
|
2911
|
+
ResultFormatter.time_of_day(
|
|
2912
|
+
decodeResult,
|
|
2913
|
+
DateTimeUtils.convertHHMMSSToTod(fields[2])
|
|
2914
|
+
);
|
|
2448
2915
|
ResultFormatter.altitude(decodeResult, Number(fields[3]));
|
|
2449
2916
|
ResultFormatter.temperature(decodeResult, fields[6].replace(/ /g, ""));
|
|
2450
|
-
ResultFormatter.eta(
|
|
2917
|
+
ResultFormatter.eta(
|
|
2918
|
+
decodeResult,
|
|
2919
|
+
DateTimeUtils.convertHHMMSSToTod(fields[7])
|
|
2920
|
+
);
|
|
2451
2921
|
ResultFormatter.arrivalAirport(decodeResult, fields[8]);
|
|
2452
|
-
ResultFormatter.unknownArr(decodeResult, [
|
|
2922
|
+
ResultFormatter.unknownArr(decodeResult, [
|
|
2923
|
+
fields[1],
|
|
2924
|
+
fields[4],
|
|
2925
|
+
fields[5]
|
|
2926
|
+
]);
|
|
2453
2927
|
decodeResult.decoded = true;
|
|
2454
2928
|
decodeResult.decoder.decodeLevel = "partial";
|
|
2455
2929
|
} else {
|
|
2456
2930
|
if (options.debug) {
|
|
2457
|
-
console.log(
|
|
2931
|
+
console.log(
|
|
2932
|
+
`DEBUG: ${this.name}: Unknown variation. Field count: ${fields.length}, content: ${content}`
|
|
2933
|
+
);
|
|
2458
2934
|
}
|
|
2459
2935
|
decodeResult.decoded = false;
|
|
2460
2936
|
decodeResult.decoder.decodeLevel = "none";
|
|
@@ -2497,12 +2973,27 @@ var Label_22_OFF = class extends DecoderPlugin {
|
|
|
2497
2973
|
return decodeResult;
|
|
2498
2974
|
}
|
|
2499
2975
|
ResultFormatter.flightNumber(decodeResult, fields[0]);
|
|
2500
|
-
ResultFormatter.departureDay(
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2976
|
+
ResultFormatter.departureDay(
|
|
2977
|
+
decodeResult,
|
|
2978
|
+
Number(fields[1].substring(0, 2))
|
|
2979
|
+
);
|
|
2980
|
+
ResultFormatter.arrivalDay(
|
|
2981
|
+
decodeResult,
|
|
2982
|
+
Number(fields[1].substring(2, 4))
|
|
2983
|
+
);
|
|
2984
|
+
ResultFormatter.time_of_day(
|
|
2985
|
+
decodeResult,
|
|
2986
|
+
DateTimeUtils.convertHHMMSSToTod(fields[1].substring(4, 8))
|
|
2987
|
+
);
|
|
2988
|
+
ResultFormatter.departureAirport(
|
|
2989
|
+
decodeResult,
|
|
2990
|
+
fields[1].substring(8, 12)
|
|
2991
|
+
);
|
|
2504
2992
|
ResultFormatter.arrivalAirport(decodeResult, fields[1].substring(12, 16));
|
|
2505
|
-
ResultFormatter.off(
|
|
2993
|
+
ResultFormatter.off(
|
|
2994
|
+
decodeResult,
|
|
2995
|
+
DateTimeUtils.convertHHMMSSToTod(fields[1].substring(16, 22))
|
|
2996
|
+
);
|
|
2506
2997
|
ResultFormatter.unknown(decodeResult, fields[1].substring(22));
|
|
2507
2998
|
decodeResult.decoded = true;
|
|
2508
2999
|
decodeResult.decoder.decodeLevel = "partial";
|
|
@@ -2515,7 +3006,10 @@ var Label_22_OFF = class extends DecoderPlugin {
|
|
|
2515
3006
|
}
|
|
2516
3007
|
ResultFormatter.departureAirport(decodeResult, fields[0]);
|
|
2517
3008
|
ResultFormatter.arrivalAirport(decodeResult, fields[1]);
|
|
2518
|
-
ResultFormatter.off(
|
|
3009
|
+
ResultFormatter.off(
|
|
3010
|
+
decodeResult,
|
|
3011
|
+
DateTimeUtils.convertHHMMSSToTod(fields[2])
|
|
3012
|
+
);
|
|
2519
3013
|
ResultFormatter.unknown(decodeResult, fields[3]);
|
|
2520
3014
|
decodeResult.decoded = true;
|
|
2521
3015
|
decodeResult.decoder.decodeLevel = "partial";
|
|
@@ -2527,17 +3021,31 @@ var Label_22_OFF = class extends DecoderPlugin {
|
|
|
2527
3021
|
return decodeResult;
|
|
2528
3022
|
}
|
|
2529
3023
|
ResultFormatter.flightNumber(decodeResult, fields[0]);
|
|
2530
|
-
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
3024
|
+
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
3025
|
+
fields[1].substring(0, 14)
|
|
3026
|
+
);
|
|
2531
3027
|
if (position) {
|
|
2532
3028
|
ResultFormatter.position(decodeResult, position);
|
|
2533
3029
|
}
|
|
2534
3030
|
ResultFormatter.day(decodeResult, Number(fields[1].substring(14, 16)));
|
|
2535
|
-
ResultFormatter.time_of_day(
|
|
2536
|
-
|
|
3031
|
+
ResultFormatter.time_of_day(
|
|
3032
|
+
decodeResult,
|
|
3033
|
+
DateTimeUtils.convertHHMMSSToTod(fields[1].substring(16, 20))
|
|
3034
|
+
);
|
|
3035
|
+
ResultFormatter.departureAirport(
|
|
3036
|
+
decodeResult,
|
|
3037
|
+
fields[1].substring(20, 24)
|
|
3038
|
+
);
|
|
2537
3039
|
ResultFormatter.arrivalAirport(decodeResult, fields[1].substring(24, 28));
|
|
2538
|
-
ResultFormatter.off(
|
|
3040
|
+
ResultFormatter.off(
|
|
3041
|
+
decodeResult,
|
|
3042
|
+
DateTimeUtils.convertHHMMSSToTod(fields[1].substring(28, 32))
|
|
3043
|
+
);
|
|
2539
3044
|
ResultFormatter.unknown(decodeResult, fields[1].substring(32, 36));
|
|
2540
|
-
ResultFormatter.eta(
|
|
3045
|
+
ResultFormatter.eta(
|
|
3046
|
+
decodeResult,
|
|
3047
|
+
DateTimeUtils.convertHHMMSSToTod(fields[1].substring(36, 40))
|
|
3048
|
+
);
|
|
2541
3049
|
decodeResult.decoded = true;
|
|
2542
3050
|
decodeResult.decoder.decodeLevel = "partial";
|
|
2543
3051
|
} else {
|
|
@@ -2568,7 +3076,9 @@ var Label_22_POS = class extends DecoderPlugin {
|
|
|
2568
3076
|
const fields = message.text.split(",");
|
|
2569
3077
|
if (fields.length !== 11) {
|
|
2570
3078
|
if (options.debug) {
|
|
2571
|
-
console.log(
|
|
3079
|
+
console.log(
|
|
3080
|
+
`DEBUG: ${this.name}: Unknown variation. Field count: ${fields.length}, content: ${fields.join(",")}`
|
|
3081
|
+
);
|
|
2572
3082
|
}
|
|
2573
3083
|
decodeResult.decoded = false;
|
|
2574
3084
|
decodeResult.decoder.decodeLevel = "none";
|
|
@@ -2582,7 +3092,10 @@ var Label_22_POS = class extends DecoderPlugin {
|
|
|
2582
3092
|
latitude: CoordinateUtils.getDirection(fields[0][0]) * lat,
|
|
2583
3093
|
longitude: CoordinateUtils.getDirection(fields[0][8]) * lon
|
|
2584
3094
|
});
|
|
2585
|
-
ResultFormatter.time_of_day(
|
|
3095
|
+
ResultFormatter.time_of_day(
|
|
3096
|
+
decodeResult,
|
|
3097
|
+
DateTimeUtils.convertHHMMSSToTod(fields[2])
|
|
3098
|
+
);
|
|
2586
3099
|
ResultFormatter.altitude(decodeResult, Number(fields[3]));
|
|
2587
3100
|
ResultFormatter.unknownArr(decodeResult, [fields[1], ...fields.slice(4)]);
|
|
2588
3101
|
decodeResult.decoded = true;
|
|
@@ -2618,11 +3131,20 @@ var Label_2P_FM3 = class extends DecoderPlugin {
|
|
|
2618
3131
|
ResultFormatter.flightNumber(decodeResult, header[0].substring(4));
|
|
2619
3132
|
}
|
|
2620
3133
|
if (header[1].length === 4) {
|
|
2621
|
-
ResultFormatter.time_of_day(
|
|
3134
|
+
ResultFormatter.time_of_day(
|
|
3135
|
+
decodeResult,
|
|
3136
|
+
DateTimeUtils.convertHHMMSSToTod(header[1])
|
|
3137
|
+
);
|
|
2622
3138
|
} else {
|
|
2623
|
-
ResultFormatter.time_of_day(
|
|
3139
|
+
ResultFormatter.time_of_day(
|
|
3140
|
+
decodeResult,
|
|
3141
|
+
DateTimeUtils.convertHHMMSSToTod(header[1])
|
|
3142
|
+
);
|
|
2624
3143
|
}
|
|
2625
|
-
ResultFormatter.eta(
|
|
3144
|
+
ResultFormatter.eta(
|
|
3145
|
+
decodeResult,
|
|
3146
|
+
DateTimeUtils.convertHHMMSSToTod(parts[1])
|
|
3147
|
+
);
|
|
2626
3148
|
const lat = parts[2].replaceAll(" ", "");
|
|
2627
3149
|
const lon = parts[3].replaceAll(" ", "");
|
|
2628
3150
|
if (lat[0] === "N" || lat[0] === "S") {
|
|
@@ -2631,7 +3153,10 @@ var Label_2P_FM3 = class extends DecoderPlugin {
|
|
|
2631
3153
|
longitude: CoordinateUtils.getDirection(lon[0]) * Number(lon.substring(1))
|
|
2632
3154
|
});
|
|
2633
3155
|
} else {
|
|
2634
|
-
ResultFormatter.position(decodeResult, {
|
|
3156
|
+
ResultFormatter.position(decodeResult, {
|
|
3157
|
+
latitude: Number(lat),
|
|
3158
|
+
longitude: Number(lon)
|
|
3159
|
+
});
|
|
2635
3160
|
}
|
|
2636
3161
|
ResultFormatter.altitude(decodeResult, Number(parts[4]));
|
|
2637
3162
|
ResultFormatter.unknown(decodeResult, parts[5]);
|
|
@@ -2679,9 +3204,18 @@ var Label_2P_FM4 = class extends DecoderPlugin {
|
|
|
2679
3204
|
ResultFormatter.departureAirport(decodeResult, header[1]);
|
|
2680
3205
|
ResultFormatter.arrivalAirport(decodeResult, parts[1]);
|
|
2681
3206
|
ResultFormatter.day(decodeResult, Number(parts[2].substring(0, 2)));
|
|
2682
|
-
ResultFormatter.time_of_day(
|
|
2683
|
-
|
|
2684
|
-
|
|
3207
|
+
ResultFormatter.time_of_day(
|
|
3208
|
+
decodeResult,
|
|
3209
|
+
DateTimeUtils.convertHHMMSSToTod(parts[2].substring(2))
|
|
3210
|
+
);
|
|
3211
|
+
ResultFormatter.eta(
|
|
3212
|
+
decodeResult,
|
|
3213
|
+
DateTimeUtils.convertHHMMSSToTod(parts[3])
|
|
3214
|
+
);
|
|
3215
|
+
ResultFormatter.position(decodeResult, {
|
|
3216
|
+
latitude: Number(parts[4].replaceAll(" ", "")),
|
|
3217
|
+
longitude: Number(parts[5].replaceAll(" ", ""))
|
|
3218
|
+
});
|
|
2685
3219
|
ResultFormatter.altitude(decodeResult, Number(parts[6]));
|
|
2686
3220
|
ResultFormatter.heading(decodeResult, Number(parts[7]));
|
|
2687
3221
|
ResultFormatter.unknown(decodeResult, parts[8]);
|
|
@@ -2724,9 +3258,18 @@ var Label_2P_FM5 = class extends DecoderPlugin {
|
|
|
2724
3258
|
}
|
|
2725
3259
|
ResultFormatter.departureAirport(decodeResult, header[1]);
|
|
2726
3260
|
ResultFormatter.arrivalAirport(decodeResult, parts[1]);
|
|
2727
|
-
ResultFormatter.time_of_day(
|
|
2728
|
-
|
|
2729
|
-
|
|
3261
|
+
ResultFormatter.time_of_day(
|
|
3262
|
+
decodeResult,
|
|
3263
|
+
DateTimeUtils.convertHHMMSSToTod(parts[2])
|
|
3264
|
+
);
|
|
3265
|
+
ResultFormatter.eta(
|
|
3266
|
+
decodeResult,
|
|
3267
|
+
DateTimeUtils.convertHHMMSSToTod(parts[3])
|
|
3268
|
+
);
|
|
3269
|
+
ResultFormatter.position(decodeResult, {
|
|
3270
|
+
latitude: Number(parts[4].replaceAll(" ", "")),
|
|
3271
|
+
longitude: Number(parts[5].replaceAll(" ", ""))
|
|
3272
|
+
});
|
|
2730
3273
|
ResultFormatter.altitude(decodeResult, Number(parts[6]));
|
|
2731
3274
|
ResultFormatter.unknown(decodeResult, parts[7]);
|
|
2732
3275
|
ResultFormatter.unknown(decodeResult, parts[8]);
|
|
@@ -2763,7 +3306,10 @@ var Label_2P_POS = class extends DecoderPlugin {
|
|
|
2763
3306
|
const parts = msg.split("/");
|
|
2764
3307
|
let decoded = false;
|
|
2765
3308
|
if (parts[0].length > 3) {
|
|
2766
|
-
decoded = H1Helper.decodeH1Message(
|
|
3309
|
+
decoded = H1Helper.decodeH1Message(
|
|
3310
|
+
decodeResult,
|
|
3311
|
+
msg.slice(parts[0].length - 3)
|
|
3312
|
+
);
|
|
2767
3313
|
decodeResult.remaining.text = parts[0].slice(0, 3) + "/" + decodeResult.remaining.text;
|
|
2768
3314
|
} else {
|
|
2769
3315
|
decoded = H1Helper.decodeH1Message(decodeResult, msg);
|
|
@@ -2800,7 +3346,10 @@ var Label_24_Slash = class extends DecoderPlugin {
|
|
|
2800
3346
|
if (fields.length == 10 && fields[0] == "" && fields[9] == "") {
|
|
2801
3347
|
const mmddyy = fields[1].substring(4, 6) + fields[1].substring(2, 4) + fields[1].substring(0, 2);
|
|
2802
3348
|
const hhmmss = fields[2] + "00";
|
|
2803
|
-
decodeResult.raw.message_timestamp = DateTimeUtils.convertDateTimeToEpoch(
|
|
3349
|
+
decodeResult.raw.message_timestamp = DateTimeUtils.convertDateTimeToEpoch(
|
|
3350
|
+
hhmmss,
|
|
3351
|
+
mmddyy
|
|
3352
|
+
);
|
|
2804
3353
|
ResultFormatter.flightNumber(decodeResult, fields[3]);
|
|
2805
3354
|
ResultFormatter.altitude(decodeResult, Number(fields[4]));
|
|
2806
3355
|
const lat = fields[5];
|
|
@@ -2810,13 +3359,18 @@ var Label_24_Slash = class extends DecoderPlugin {
|
|
|
2810
3359
|
longitude: (lon[0] === "E" ? 1 : -1) * Number(lon.substring(1))
|
|
2811
3360
|
};
|
|
2812
3361
|
ResultFormatter.position(decodeResult, position);
|
|
2813
|
-
ResultFormatter.eta(
|
|
3362
|
+
ResultFormatter.eta(
|
|
3363
|
+
decodeResult,
|
|
3364
|
+
DateTimeUtils.convertHHMMSSToTod(fields[8])
|
|
3365
|
+
);
|
|
2814
3366
|
ResultFormatter.unknown(decodeResult, fields[7]);
|
|
2815
3367
|
decodeResult.decoded = true;
|
|
2816
3368
|
decodeResult.decoder.decodeLevel = "partial";
|
|
2817
3369
|
} else {
|
|
2818
3370
|
if (options.debug) {
|
|
2819
|
-
console.log(
|
|
3371
|
+
console.log(
|
|
3372
|
+
`DEBUG: ${this.name}: Unknown variation. Field count: ${fields.length}. Message: ${message.text}`
|
|
3373
|
+
);
|
|
2820
3374
|
}
|
|
2821
3375
|
decodeResult.decoded = false;
|
|
2822
3376
|
decodeResult.decoder.decodeLevel = "none";
|
|
@@ -2842,16 +3396,22 @@ var Label_30_Slash_EA = class extends DecoderPlugin {
|
|
|
2842
3396
|
const results = message.text.split(/\n|\//).slice(1);
|
|
2843
3397
|
if (results) {
|
|
2844
3398
|
if (options.debug) {
|
|
2845
|
-
console.log(
|
|
3399
|
+
console.log("Label 30 EA: results");
|
|
2846
3400
|
console.log(results);
|
|
2847
3401
|
}
|
|
2848
3402
|
}
|
|
2849
|
-
ResultFormatter.eta(
|
|
3403
|
+
ResultFormatter.eta(
|
|
3404
|
+
decodeResult,
|
|
3405
|
+
DateTimeUtils.convertHHMMSSToTod(results[0].substr(2, 4))
|
|
3406
|
+
);
|
|
2850
3407
|
if (results[1].substring(0, 2) === "DS") {
|
|
2851
3408
|
ResultFormatter.arrivalAirport(decodeResult, results[1].substring(2, 6));
|
|
2852
3409
|
ResultFormatter.unknown(decodeResult, "/".concat(results[2]));
|
|
2853
3410
|
} else {
|
|
2854
|
-
ResultFormatter.unknown(
|
|
3411
|
+
ResultFormatter.unknown(
|
|
3412
|
+
decodeResult,
|
|
3413
|
+
"/".concat(results[1], "/", results[2])
|
|
3414
|
+
);
|
|
2855
3415
|
}
|
|
2856
3416
|
decodeResult.decoded = true;
|
|
2857
3417
|
decodeResult.decoder.decodeLevel = "partial";
|
|
@@ -2876,17 +3436,26 @@ var Label_44_ETA = class extends DecoderPlugin {
|
|
|
2876
3436
|
const data = message.text.split(",");
|
|
2877
3437
|
if (data.length >= 9) {
|
|
2878
3438
|
if (options.debug) {
|
|
2879
|
-
console.log(
|
|
3439
|
+
console.log("Label 44 ETA Report: groups");
|
|
2880
3440
|
console.log(data);
|
|
2881
3441
|
}
|
|
2882
|
-
ResultFormatter.position(
|
|
3442
|
+
ResultFormatter.position(
|
|
3443
|
+
decodeResult,
|
|
3444
|
+
CoordinateUtils.decodeStringCoordinatesDecimalMinutes(data[1])
|
|
3445
|
+
);
|
|
2883
3446
|
ResultFormatter.altitude(decodeResult, 100 * Number(data[2]));
|
|
2884
3447
|
ResultFormatter.departureAirport(decodeResult, data[3]);
|
|
2885
3448
|
ResultFormatter.arrivalAirport(decodeResult, data[4]);
|
|
2886
3449
|
ResultFormatter.month(decodeResult, Number(data[5].substring(0, 2)));
|
|
2887
3450
|
ResultFormatter.day(decodeResult, Number(data[5].substring(2, 4)));
|
|
2888
|
-
ResultFormatter.time_of_day(
|
|
2889
|
-
|
|
3451
|
+
ResultFormatter.time_of_day(
|
|
3452
|
+
decodeResult,
|
|
3453
|
+
DateTimeUtils.convertHHMMSSToTod(data[6])
|
|
3454
|
+
);
|
|
3455
|
+
ResultFormatter.eta(
|
|
3456
|
+
decodeResult,
|
|
3457
|
+
DateTimeUtils.convertHHMMSSToTod(data[7])
|
|
3458
|
+
);
|
|
2890
3459
|
const fuel = Number(data[8]);
|
|
2891
3460
|
if (!isNaN(fuel)) {
|
|
2892
3461
|
ResultFormatter.remainingFuel(decodeResult, Number(fuel));
|
|
@@ -2926,15 +3495,21 @@ var Label_44_IN = class extends DecoderPlugin {
|
|
|
2926
3495
|
const data = message.text.split(",");
|
|
2927
3496
|
if (data.length >= 7) {
|
|
2928
3497
|
if (options.debug) {
|
|
2929
|
-
console.log(
|
|
3498
|
+
console.log("Label 44 In Air Report: groups");
|
|
2930
3499
|
console.log(data);
|
|
2931
3500
|
}
|
|
2932
|
-
ResultFormatter.position(
|
|
3501
|
+
ResultFormatter.position(
|
|
3502
|
+
decodeResult,
|
|
3503
|
+
CoordinateUtils.decodeStringCoordinatesDecimalMinutes(data[1])
|
|
3504
|
+
);
|
|
2933
3505
|
ResultFormatter.departureAirport(decodeResult, data[2]);
|
|
2934
3506
|
ResultFormatter.arrivalAirport(decodeResult, data[3]);
|
|
2935
3507
|
ResultFormatter.month(decodeResult, Number(data[4].substring(0, 2)));
|
|
2936
3508
|
ResultFormatter.day(decodeResult, Number(data[4].substring(2, 4)));
|
|
2937
|
-
ResultFormatter.in(
|
|
3509
|
+
ResultFormatter.in(
|
|
3510
|
+
decodeResult,
|
|
3511
|
+
DateTimeUtils.convertHHMMSSToTod(data[5])
|
|
3512
|
+
);
|
|
2938
3513
|
const fuel = Number(data[6]);
|
|
2939
3514
|
if (!isNaN(fuel)) {
|
|
2940
3515
|
ResultFormatter.remainingFuel(decodeResult, Number(fuel));
|
|
@@ -2974,16 +3549,25 @@ var Label_44_OFF = class extends DecoderPlugin {
|
|
|
2974
3549
|
const data = message.text.split(",");
|
|
2975
3550
|
if (data.length >= 8) {
|
|
2976
3551
|
if (options.debug) {
|
|
2977
|
-
console.log(
|
|
3552
|
+
console.log("Label 44 Off Runway Report: groups");
|
|
2978
3553
|
console.log(data);
|
|
2979
3554
|
}
|
|
2980
|
-
ResultFormatter.position(
|
|
3555
|
+
ResultFormatter.position(
|
|
3556
|
+
decodeResult,
|
|
3557
|
+
CoordinateUtils.decodeStringCoordinatesDecimalMinutes(data[1])
|
|
3558
|
+
);
|
|
2981
3559
|
ResultFormatter.departureAirport(decodeResult, data[2]);
|
|
2982
3560
|
ResultFormatter.arrivalAirport(decodeResult, data[3]);
|
|
2983
3561
|
ResultFormatter.month(decodeResult, Number(data[4].substring(0, 2)));
|
|
2984
3562
|
ResultFormatter.day(decodeResult, Number(data[4].substring(2, 4)));
|
|
2985
|
-
ResultFormatter.off(
|
|
2986
|
-
|
|
3563
|
+
ResultFormatter.off(
|
|
3564
|
+
decodeResult,
|
|
3565
|
+
DateTimeUtils.convertHHMMSSToTod(data[5])
|
|
3566
|
+
);
|
|
3567
|
+
ResultFormatter.eta(
|
|
3568
|
+
decodeResult,
|
|
3569
|
+
DateTimeUtils.convertHHMMSSToTod(data[6])
|
|
3570
|
+
);
|
|
2987
3571
|
const fuel = Number(data[7]);
|
|
2988
3572
|
if (!isNaN(fuel)) {
|
|
2989
3573
|
ResultFormatter.remainingFuel(decodeResult, Number(fuel));
|
|
@@ -3023,15 +3607,21 @@ var Label_44_ON = class extends DecoderPlugin {
|
|
|
3023
3607
|
const data = message.text.split(",");
|
|
3024
3608
|
if (data.length >= 7) {
|
|
3025
3609
|
if (options.debug) {
|
|
3026
|
-
console.log(
|
|
3610
|
+
console.log("Label 44 On Runway Report: groups");
|
|
3027
3611
|
console.log(data);
|
|
3028
3612
|
}
|
|
3029
|
-
ResultFormatter.position(
|
|
3613
|
+
ResultFormatter.position(
|
|
3614
|
+
decodeResult,
|
|
3615
|
+
CoordinateUtils.decodeStringCoordinatesDecimalMinutes(data[1])
|
|
3616
|
+
);
|
|
3030
3617
|
ResultFormatter.departureAirport(decodeResult, data[2]);
|
|
3031
3618
|
ResultFormatter.arrivalAirport(decodeResult, data[3]);
|
|
3032
3619
|
ResultFormatter.month(decodeResult, Number(data[4].substring(0, 2)));
|
|
3033
3620
|
ResultFormatter.day(decodeResult, Number(data[4].substring(2, 4)));
|
|
3034
|
-
ResultFormatter.on(
|
|
3621
|
+
ResultFormatter.on(
|
|
3622
|
+
decodeResult,
|
|
3623
|
+
DateTimeUtils.convertHHMMSSToTod(data[5])
|
|
3624
|
+
);
|
|
3035
3625
|
const fuel = Number(data[6]);
|
|
3036
3626
|
if (!isNaN(fuel)) {
|
|
3037
3627
|
ResultFormatter.remainingFuel(decodeResult, Number(fuel));
|
|
@@ -3072,19 +3662,39 @@ var Label_44_POS = class extends DecoderPlugin {
|
|
|
3072
3662
|
const results = message.text.match(regex);
|
|
3073
3663
|
if (results?.groups) {
|
|
3074
3664
|
if (options.debug) {
|
|
3075
|
-
console.log(
|
|
3665
|
+
console.log("Label 44 Position Report: groups");
|
|
3076
3666
|
console.log(results.groups);
|
|
3077
3667
|
}
|
|
3078
|
-
ResultFormatter.position(
|
|
3668
|
+
ResultFormatter.position(
|
|
3669
|
+
decodeResult,
|
|
3670
|
+
CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
3671
|
+
results.groups.unsplit_coords
|
|
3672
|
+
)
|
|
3673
|
+
);
|
|
3079
3674
|
const flight_level = results.groups.flight_level_or_ground == "GRD" || results.groups.flight_level_or_ground == "***" ? 0 : Number(results.groups.flight_level_or_ground);
|
|
3080
|
-
ResultFormatter.month(
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3675
|
+
ResultFormatter.month(
|
|
3676
|
+
decodeResult,
|
|
3677
|
+
Number(results.groups.current_date.substring(0, 2))
|
|
3678
|
+
);
|
|
3679
|
+
ResultFormatter.day(
|
|
3680
|
+
decodeResult,
|
|
3681
|
+
Number(results.groups.current_date.substring(2, 4))
|
|
3682
|
+
);
|
|
3683
|
+
ResultFormatter.time_of_day(
|
|
3684
|
+
decodeResult,
|
|
3685
|
+
DateTimeUtils.convertHHMMSSToTod(results.groups.current_time + "00")
|
|
3686
|
+
);
|
|
3687
|
+
ResultFormatter.eta(
|
|
3688
|
+
decodeResult,
|
|
3689
|
+
DateTimeUtils.convertHHMMSSToTod(results.groups.eta_time + "00")
|
|
3690
|
+
);
|
|
3084
3691
|
if (results.groups.fuel_in_tons != "***" && results.groups.fuel_in_tons != "****") {
|
|
3085
3692
|
decodeResult.raw.fuel_in_tons = Number(results.groups.fuel_in_tons);
|
|
3086
3693
|
}
|
|
3087
|
-
ResultFormatter.departureAirport(
|
|
3694
|
+
ResultFormatter.departureAirport(
|
|
3695
|
+
decodeResult,
|
|
3696
|
+
results.groups.departure_icao
|
|
3697
|
+
);
|
|
3088
3698
|
ResultFormatter.arrivalAirport(decodeResult, results.groups.arrival_icao);
|
|
3089
3699
|
ResultFormatter.altitude(decodeResult, flight_level * 100);
|
|
3090
3700
|
}
|
|
@@ -3122,7 +3732,7 @@ var Label_44_Slash = class extends DecoderPlugin {
|
|
|
3122
3732
|
const data = fields[3].split(",");
|
|
3123
3733
|
if (data.length >= 6) {
|
|
3124
3734
|
if (options.debug) {
|
|
3125
|
-
console.log(
|
|
3735
|
+
console.log("Label 44 Slash: groups");
|
|
3126
3736
|
console.log(data);
|
|
3127
3737
|
}
|
|
3128
3738
|
ResultFormatter.position(decodeResult, {
|
|
@@ -3172,34 +3782,33 @@ var Label_4A = class extends DecoderPlugin {
|
|
|
3172
3782
|
decodeResult.decoder.name = this.name;
|
|
3173
3783
|
decodeResult.message = message;
|
|
3174
3784
|
decodeResult.formatted.description = "Latest New Format";
|
|
3175
|
-
let text = message.text;
|
|
3176
|
-
if (text.match(/^M\d{2}A\w{6}/)) {
|
|
3177
|
-
ResultFormatter.flightNumber(decodeResult, message.text.substring(4, 10).replace(/^([A-Z]+)0*/g, "$1"));
|
|
3178
|
-
text = text.substring(10);
|
|
3179
|
-
}
|
|
3180
3785
|
decodeResult.decoded = true;
|
|
3181
|
-
const fields = text.split(",");
|
|
3786
|
+
const fields = message.text.split(",");
|
|
3182
3787
|
if (fields.length === 11) {
|
|
3183
|
-
ResultFormatter.time_of_day(
|
|
3788
|
+
ResultFormatter.time_of_day(
|
|
3789
|
+
decodeResult,
|
|
3790
|
+
DateTimeUtils.convertHHMMSSToTod(fields[0])
|
|
3791
|
+
);
|
|
3184
3792
|
ResultFormatter.tail(decodeResult, fields[2].replace(".", ""));
|
|
3185
|
-
if (fields[3])
|
|
3186
|
-
ResultFormatter.callsign(decodeResult, fields[3]);
|
|
3793
|
+
if (fields[3]) ResultFormatter.callsign(decodeResult, fields[3]);
|
|
3187
3794
|
ResultFormatter.departureAirport(decodeResult, fields[4]);
|
|
3188
3795
|
ResultFormatter.arrivalAirport(decodeResult, fields[5]);
|
|
3189
|
-
const alt = text.substring(48, 51);
|
|
3190
|
-
if (alt !== "") {
|
|
3191
|
-
ResultFormatter.altitude(decodeResult, Number(alt) * 100);
|
|
3192
|
-
}
|
|
3193
3796
|
ResultFormatter.unknownArr(decodeResult, fields.slice(8));
|
|
3194
3797
|
} else if (fields.length === 6) {
|
|
3195
3798
|
if (fields[0].match(/^[NS]/)) {
|
|
3196
|
-
ResultFormatter.position(
|
|
3799
|
+
ResultFormatter.position(
|
|
3800
|
+
decodeResult,
|
|
3801
|
+
CoordinateUtils.decodeStringCoordinates(fields[0].substring(0, 13))
|
|
3802
|
+
);
|
|
3197
3803
|
let wp1 = {
|
|
3198
3804
|
name: fields[0].substring(13).trim(),
|
|
3199
3805
|
time: DateTimeUtils.convertHHMMSSToTod(fields[1].substring(0, 6)),
|
|
3200
3806
|
timeFormat: "tod"
|
|
3201
3807
|
};
|
|
3202
|
-
ResultFormatter.altitude(
|
|
3808
|
+
ResultFormatter.altitude(
|
|
3809
|
+
decodeResult,
|
|
3810
|
+
Number(fields[1].substring(6, 9)) * 100
|
|
3811
|
+
);
|
|
3203
3812
|
let wp2 = {
|
|
3204
3813
|
name: fields[1].substring(9).trim(),
|
|
3205
3814
|
time: DateTimeUtils.convertHHMMSSToTod(fields[2]),
|
|
@@ -3209,21 +3818,31 @@ var Label_4A = class extends DecoderPlugin {
|
|
|
3209
3818
|
ResultFormatter.temperature(decodeResult, fields[3]);
|
|
3210
3819
|
ResultFormatter.unknownArr(decodeResult, fields.slice(4));
|
|
3211
3820
|
} else {
|
|
3212
|
-
ResultFormatter.time_of_day(
|
|
3213
|
-
|
|
3821
|
+
ResultFormatter.time_of_day(
|
|
3822
|
+
decodeResult,
|
|
3823
|
+
DateTimeUtils.convertHHMMSSToTod(fields[0])
|
|
3824
|
+
);
|
|
3825
|
+
ResultFormatter.eta(
|
|
3826
|
+
decodeResult,
|
|
3827
|
+
DateTimeUtils.convertHHMMSSToTod(fields[1])
|
|
3828
|
+
);
|
|
3214
3829
|
ResultFormatter.unknown(decodeResult, fields[2]);
|
|
3215
3830
|
ResultFormatter.altitude(decodeResult, Number(fields[3]));
|
|
3216
|
-
ResultFormatter.position(
|
|
3831
|
+
ResultFormatter.position(
|
|
3832
|
+
decodeResult,
|
|
3833
|
+
CoordinateUtils.decodeStringCoordinates(
|
|
3834
|
+
(fields[4] + fields[5]).replace(/[ \.]/g, "")
|
|
3835
|
+
)
|
|
3836
|
+
);
|
|
3217
3837
|
}
|
|
3218
3838
|
} else {
|
|
3219
3839
|
decodeResult.decoded = false;
|
|
3220
|
-
ResultFormatter.unknown(decodeResult, text);
|
|
3840
|
+
ResultFormatter.unknown(decodeResult, message.text);
|
|
3221
3841
|
}
|
|
3222
3842
|
if (decodeResult.decoded) {
|
|
3223
3843
|
if (!decodeResult.remaining.text)
|
|
3224
3844
|
decodeResult.decoder.decodeLevel = "full";
|
|
3225
|
-
else
|
|
3226
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
3845
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
3227
3846
|
} else {
|
|
3228
3847
|
decodeResult.decoder.decodeLevel = "none";
|
|
3229
3848
|
}
|
|
@@ -3246,11 +3865,16 @@ var Label_4A_01 = class extends DecoderPlugin {
|
|
|
3246
3865
|
decodeResult.message = message;
|
|
3247
3866
|
decodeResult.formatted.description = "Latest New Format";
|
|
3248
3867
|
decodeResult.decoded = true;
|
|
3249
|
-
let rgx = message.text.match(
|
|
3868
|
+
let rgx = message.text.match(
|
|
3869
|
+
/^01([A-Z]{2})([A-Z]{2})\s*(\w+)\/(\d{6})([A-Z]{4})([A-Z]{4})\r\n([+-]\s*\d+)(\d{3}\.\d)([+-]\s*\d+\.\d)/
|
|
3870
|
+
);
|
|
3250
3871
|
if (rgx) {
|
|
3251
3872
|
ResultFormatter.state_change(decodeResult, rgx[1], rgx[2]);
|
|
3252
3873
|
ResultFormatter.callsign(decodeResult, rgx[3]);
|
|
3253
|
-
ResultFormatter.time_of_day(
|
|
3874
|
+
ResultFormatter.time_of_day(
|
|
3875
|
+
decodeResult,
|
|
3876
|
+
DateTimeUtils.convertHHMMSSToTod(rgx[4] + "00")
|
|
3877
|
+
);
|
|
3254
3878
|
ResultFormatter.departureAirport(decodeResult, rgx[5]);
|
|
3255
3879
|
ResultFormatter.arrivalAirport(decodeResult, rgx[6]);
|
|
3256
3880
|
ResultFormatter.altitude(decodeResult, Number(rgx[7].replace(/ /g, "")));
|
|
@@ -3263,8 +3887,7 @@ var Label_4A_01 = class extends DecoderPlugin {
|
|
|
3263
3887
|
if (decodeResult.decoded) {
|
|
3264
3888
|
if (!decodeResult.remaining.text)
|
|
3265
3889
|
decodeResult.decoder.decodeLevel = "full";
|
|
3266
|
-
else
|
|
3267
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
3890
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
3268
3891
|
} else {
|
|
3269
3892
|
decodeResult.decoder.decodeLevel = "none";
|
|
3270
3893
|
}
|
|
@@ -3288,14 +3911,16 @@ var Label_4A_DIS = class extends DecoderPlugin {
|
|
|
3288
3911
|
decodeResult.formatted.description = "Latest New Format";
|
|
3289
3912
|
decodeResult.decoded = true;
|
|
3290
3913
|
const fields = message.text.split(",");
|
|
3291
|
-
ResultFormatter.time_of_day(
|
|
3914
|
+
ResultFormatter.time_of_day(
|
|
3915
|
+
decodeResult,
|
|
3916
|
+
DateTimeUtils.convertHHMMSSToTod(fields[1].substring(2) + "00")
|
|
3917
|
+
);
|
|
3292
3918
|
ResultFormatter.callsign(decodeResult, fields[2]);
|
|
3293
3919
|
ResultFormatter.freetext(decodeResult, fields.slice(3).join(""));
|
|
3294
3920
|
if (decodeResult.decoded) {
|
|
3295
3921
|
if (!decodeResult.remaining.text)
|
|
3296
3922
|
decodeResult.decoder.decodeLevel = "full";
|
|
3297
|
-
else
|
|
3298
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
3923
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
3299
3924
|
} else {
|
|
3300
3925
|
decodeResult.decoder.decodeLevel = "none";
|
|
3301
3926
|
}
|
|
@@ -3320,8 +3945,15 @@ var Label_4A_DOOR = class extends DecoderPlugin {
|
|
|
3320
3945
|
decodeResult.decoded = true;
|
|
3321
3946
|
const fields = message.text.split(" ");
|
|
3322
3947
|
if (fields.length === 3) {
|
|
3323
|
-
ResultFormatter.door_event(
|
|
3324
|
-
|
|
3948
|
+
ResultFormatter.door_event(
|
|
3949
|
+
decodeResult,
|
|
3950
|
+
fields[0].split("/")[1],
|
|
3951
|
+
fields[1]
|
|
3952
|
+
);
|
|
3953
|
+
ResultFormatter.time_of_day(
|
|
3954
|
+
decodeResult,
|
|
3955
|
+
DateTimeUtils.convertHHMMSSToTod(fields[2] + "00")
|
|
3956
|
+
);
|
|
3325
3957
|
} else {
|
|
3326
3958
|
decodeResult.decoded = false;
|
|
3327
3959
|
ResultFormatter.unknown(decodeResult, message.text);
|
|
@@ -3329,8 +3961,7 @@ var Label_4A_DOOR = class extends DecoderPlugin {
|
|
|
3329
3961
|
if (decodeResult.decoded) {
|
|
3330
3962
|
if (!decodeResult.remaining.text)
|
|
3331
3963
|
decodeResult.decoder.decodeLevel = "full";
|
|
3332
|
-
else
|
|
3333
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
3964
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
3334
3965
|
} else {
|
|
3335
3966
|
decodeResult.decoder.decodeLevel = "none";
|
|
3336
3967
|
}
|
|
@@ -3362,8 +3993,7 @@ var Label_4A_Slash_01 = class extends DecoderPlugin {
|
|
|
3362
3993
|
if (decodeResult.decoded) {
|
|
3363
3994
|
if (!decodeResult.remaining.text)
|
|
3364
3995
|
decodeResult.decoder.decodeLevel = "full";
|
|
3365
|
-
else
|
|
3366
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
3996
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
3367
3997
|
} else {
|
|
3368
3998
|
decodeResult.decoder.decodeLevel = "none";
|
|
3369
3999
|
}
|
|
@@ -3416,24 +4046,35 @@ var Label_4N = class extends DecoderPlugin {
|
|
|
3416
4046
|
decodeResult.decoder.name = this.name;
|
|
3417
4047
|
decodeResult.message = message;
|
|
3418
4048
|
decodeResult.formatted.description = "Airline Defined";
|
|
3419
|
-
let text = message.text;
|
|
3420
|
-
if (text.match(/^M\d{2}A\w{6}/)) {
|
|
3421
|
-
ResultFormatter.flightNumber(decodeResult, message.text.substring(4, 10).replace(/^([A-Z]+)0*/g, "$1"));
|
|
3422
|
-
text = text.substring(10);
|
|
3423
|
-
}
|
|
3424
4049
|
decodeResult.decoded = true;
|
|
4050
|
+
const text = message.text;
|
|
3425
4051
|
const fields = text.split(",");
|
|
3426
4052
|
if (text.length === 51) {
|
|
3427
4053
|
decodeResult.raw.day = text.substring(0, 2);
|
|
3428
4054
|
ResultFormatter.departureAirport(decodeResult, text.substring(8, 11));
|
|
3429
4055
|
ResultFormatter.arrivalAirport(decodeResult, text.substring(13, 16));
|
|
3430
|
-
ResultFormatter.position(
|
|
3431
|
-
|
|
3432
|
-
|
|
4056
|
+
ResultFormatter.position(
|
|
4057
|
+
decodeResult,
|
|
4058
|
+
CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
4059
|
+
text.substring(30, 45).replace(/^(.)0/, "$1")
|
|
4060
|
+
)
|
|
4061
|
+
);
|
|
4062
|
+
ResultFormatter.altitude(
|
|
4063
|
+
decodeResult,
|
|
4064
|
+
Number(text.substring(48, 51)) * 100
|
|
4065
|
+
);
|
|
4066
|
+
ResultFormatter.unknownArr(
|
|
4067
|
+
decodeResult,
|
|
4068
|
+
[text.substring(2, 4), text.substring(19, 29)],
|
|
4069
|
+
" "
|
|
4070
|
+
);
|
|
3433
4071
|
} else if (fields.length === 33) {
|
|
3434
4072
|
decodeResult.raw.date = fields[3];
|
|
3435
4073
|
if (fields[1] === "B") {
|
|
3436
|
-
ResultFormatter.position(decodeResult, {
|
|
4074
|
+
ResultFormatter.position(decodeResult, {
|
|
4075
|
+
latitude: Number(fields[4]),
|
|
4076
|
+
longitude: Number(fields[5])
|
|
4077
|
+
});
|
|
3437
4078
|
ResultFormatter.altitude(decodeResult, Number(fields[6]));
|
|
3438
4079
|
}
|
|
3439
4080
|
ResultFormatter.departureAirport(decodeResult, fields[8]);
|
|
@@ -3443,8 +4084,13 @@ var Label_4N = class extends DecoderPlugin {
|
|
|
3443
4084
|
if (fields[12].length > 1) {
|
|
3444
4085
|
ResultFormatter.alternateRunway(decodeResult, fields[12].split("/")[0]);
|
|
3445
4086
|
}
|
|
3446
|
-
ResultFormatter.checksum(decodeResult, fields[32]);
|
|
3447
|
-
ResultFormatter.unknownArr(
|
|
4087
|
+
ResultFormatter.checksum(decodeResult, parseInt(fields[32], 16));
|
|
4088
|
+
ResultFormatter.unknownArr(
|
|
4089
|
+
decodeResult,
|
|
4090
|
+
[...fields.slice(1, 3), fields[7], ...fields.slice(13, 32)].filter(
|
|
4091
|
+
(f) => f != ""
|
|
4092
|
+
)
|
|
4093
|
+
);
|
|
3448
4094
|
} else {
|
|
3449
4095
|
decodeResult.decoded = false;
|
|
3450
4096
|
ResultFormatter.unknown(decodeResult, text);
|
|
@@ -3452,8 +4098,7 @@ var Label_4N = class extends DecoderPlugin {
|
|
|
3452
4098
|
if (decodeResult.decoded) {
|
|
3453
4099
|
if (!decodeResult.remaining.text)
|
|
3454
4100
|
decodeResult.decoder.decodeLevel = "full";
|
|
3455
|
-
else
|
|
3456
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
4101
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
3457
4102
|
} else {
|
|
3458
4103
|
decodeResult.decoder.decodeLevel = "none";
|
|
3459
4104
|
}
|
|
@@ -3488,9 +4133,16 @@ var Label_4T_AGFSR = class extends DecoderPlugin {
|
|
|
3488
4133
|
ResultFormatter.flightNumber(decodeResult, data[0].trim());
|
|
3489
4134
|
ResultFormatter.departureDay(decodeResult, Number(data[1]));
|
|
3490
4135
|
ResultFormatter.arrivalDay(decodeResult, Number(data[2]));
|
|
3491
|
-
ResultFormatter.departureAirport(
|
|
4136
|
+
ResultFormatter.departureAirport(
|
|
4137
|
+
decodeResult,
|
|
4138
|
+
data[3].substring(0, 3),
|
|
4139
|
+
"IATA"
|
|
4140
|
+
);
|
|
3492
4141
|
ResultFormatter.arrivalAirport(decodeResult, data[3].substring(3), "IATA");
|
|
3493
|
-
ResultFormatter.time_of_day(
|
|
4142
|
+
ResultFormatter.time_of_day(
|
|
4143
|
+
decodeResult,
|
|
4144
|
+
DateTimeUtils.convertHHMMSSToTod(data[4].substring(0, 4))
|
|
4145
|
+
);
|
|
3494
4146
|
ResultFormatter.unknown(decodeResult, data[5], "/");
|
|
3495
4147
|
const lat = data[6].substring(0, 7);
|
|
3496
4148
|
const lon = data[6].substring(7, 15);
|
|
@@ -3523,7 +4175,10 @@ var Label_58 = class extends DecoderPlugin {
|
|
|
3523
4175
|
if (data.length === 8) {
|
|
3524
4176
|
ResultFormatter.flightNumber(decodeResult, data[0]);
|
|
3525
4177
|
ResultFormatter.day(decodeResult, Number(data[1]));
|
|
3526
|
-
ResultFormatter.time_of_day(
|
|
4178
|
+
ResultFormatter.time_of_day(
|
|
4179
|
+
decodeResult,
|
|
4180
|
+
DateTimeUtils.convertHHMMSSToTod(data[2])
|
|
4181
|
+
);
|
|
3527
4182
|
const lat = data[3];
|
|
3528
4183
|
const lon = data[4];
|
|
3529
4184
|
ResultFormatter.position(decodeResult, {
|
|
@@ -3577,7 +4232,10 @@ var Label_4T_ETA = class extends DecoderPlugin {
|
|
|
3577
4232
|
const etaData = data[2].split(" ");
|
|
3578
4233
|
ResultFormatter.arrivalDay(decodeResult, Number(etaData[0]));
|
|
3579
4234
|
ResultFormatter.arrivalAirport(decodeResult, etaData[1], "IATA");
|
|
3580
|
-
ResultFormatter.eta(
|
|
4235
|
+
ResultFormatter.eta(
|
|
4236
|
+
decodeResult,
|
|
4237
|
+
DateTimeUtils.convertHHMMSSToTod(etaData[2].substring(0, 4))
|
|
4238
|
+
);
|
|
3581
4239
|
decodeResult.decoded = true;
|
|
3582
4240
|
decodeResult.decoder.decodeLevel = "full";
|
|
3583
4241
|
return decodeResult;
|
|
@@ -3609,7 +4267,10 @@ var Label_80 = class extends DecoderPlugin {
|
|
|
3609
4267
|
this.parseTags(more.trim(), decodeResult);
|
|
3610
4268
|
}
|
|
3611
4269
|
}
|
|
3612
|
-
this.parseHeader(
|
|
4270
|
+
this.parseHeader(
|
|
4271
|
+
headerParts[headerParts.length - 1].trim(),
|
|
4272
|
+
decodeResult
|
|
4273
|
+
);
|
|
3613
4274
|
for (let i = 1; i < lines.length; i++) {
|
|
3614
4275
|
const line = lines[i];
|
|
3615
4276
|
const parts = line.split("/");
|
|
@@ -3697,10 +4358,16 @@ var Label_80 = class extends DecoderPlugin {
|
|
|
3697
4358
|
case "FB":
|
|
3698
4359
|
break;
|
|
3699
4360
|
case "FOB":
|
|
3700
|
-
ResultFormatter.currentFuel(
|
|
4361
|
+
ResultFormatter.currentFuel(
|
|
4362
|
+
results,
|
|
4363
|
+
parseInt(val.replace(/\D/g, ""), 10)
|
|
4364
|
+
);
|
|
3701
4365
|
break;
|
|
3702
4366
|
case "UTC":
|
|
3703
|
-
ResultFormatter.time_of_day(
|
|
4367
|
+
ResultFormatter.time_of_day(
|
|
4368
|
+
results,
|
|
4369
|
+
DateTimeUtils.convertHHMMSSToTod(val)
|
|
4370
|
+
);
|
|
3704
4371
|
break;
|
|
3705
4372
|
case "ETA":
|
|
3706
4373
|
const hhmm = val.split(".")[0].replace(":", "");
|
|
@@ -3729,11 +4396,20 @@ var Label_80 = class extends DecoderPlugin {
|
|
|
3729
4396
|
const header = csvParts[0].trim().split(/\s+/);
|
|
3730
4397
|
ResultFormatter.unknown(results, header[0], " ");
|
|
3731
4398
|
ResultFormatter.unknown(results, header[1], " ");
|
|
3732
|
-
ResultFormatter.position(
|
|
4399
|
+
ResultFormatter.position(
|
|
4400
|
+
results,
|
|
4401
|
+
CoordinateUtils.decodeStringCoordinates(header[2])
|
|
4402
|
+
);
|
|
3733
4403
|
ResultFormatter.unknown(results, csvParts[1]);
|
|
3734
|
-
ResultFormatter.time_of_day(
|
|
4404
|
+
ResultFormatter.time_of_day(
|
|
4405
|
+
results,
|
|
4406
|
+
DateTimeUtils.convertHHMMSSToTod(csvParts[2])
|
|
4407
|
+
);
|
|
3735
4408
|
ResultFormatter.unknownArr(results, csvParts.slice(4, 6), ",");
|
|
3736
|
-
ResultFormatter.temperature(
|
|
4409
|
+
ResultFormatter.temperature(
|
|
4410
|
+
results,
|
|
4411
|
+
((csvParts[6].charAt(0) === "M" ? -1 : 1) * parseInt(csvParts[6].slice(1), 10)).toString()
|
|
4412
|
+
);
|
|
3737
4413
|
ResultFormatter.airspeed(results, parseInt(csvParts[7], 10));
|
|
3738
4414
|
ResultFormatter.currentFuel(results, parseInt(csvParts[8], 10));
|
|
3739
4415
|
}
|
|
@@ -3752,12 +4428,8 @@ var Label_83 = class extends DecoderPlugin {
|
|
|
3752
4428
|
decodeResult.decoder.name = this.name;
|
|
3753
4429
|
decodeResult.message = message;
|
|
3754
4430
|
decodeResult.formatted.description = "Airline Defined";
|
|
3755
|
-
let text = message.text;
|
|
3756
|
-
if (text.match(/^M\d{2}A\w{6}/)) {
|
|
3757
|
-
ResultFormatter.flightNumber(decodeResult, message.text.substring(4, 10).replace(/^([A-Z]+)0*/g, "$1"));
|
|
3758
|
-
text = text.substring(10);
|
|
3759
|
-
}
|
|
3760
4431
|
decodeResult.decoded = true;
|
|
4432
|
+
const text = message.text;
|
|
3761
4433
|
if (text.substring(0, 10) === "4DH3 ETAT2") {
|
|
3762
4434
|
const fields = text.split(/\s+/);
|
|
3763
4435
|
if (fields[2].length > 5) {
|
|
@@ -3768,10 +4440,15 @@ var Label_83 = class extends DecoderPlugin {
|
|
|
3768
4440
|
ResultFormatter.departureAirport(decodeResult, subfields[0]);
|
|
3769
4441
|
ResultFormatter.arrivalAirport(decodeResult, subfields[1]);
|
|
3770
4442
|
ResultFormatter.tail(decodeResult, fields[4].replace(/\./g, ""));
|
|
3771
|
-
ResultFormatter.eta(
|
|
4443
|
+
ResultFormatter.eta(
|
|
4444
|
+
decodeResult,
|
|
4445
|
+
DateTimeUtils.convertHHMMSSToTod(fields[6] + "00")
|
|
4446
|
+
);
|
|
3772
4447
|
} else if (text.substring(0, 5) === "001PR") {
|
|
3773
4448
|
decodeResult.raw.day = text.substring(5, 7);
|
|
3774
|
-
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
4449
|
+
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
4450
|
+
text.substring(13, 28).replace(/\./g, "")
|
|
4451
|
+
);
|
|
3775
4452
|
if (position) {
|
|
3776
4453
|
ResultFormatter.position(decodeResult, position);
|
|
3777
4454
|
}
|
|
@@ -3784,27 +4461,23 @@ var Label_83 = class extends DecoderPlugin {
|
|
|
3784
4461
|
ResultFormatter.arrivalAirport(decodeResult, fields[1]);
|
|
3785
4462
|
decodeResult.raw.day = fields[2].substring(0, 2);
|
|
3786
4463
|
decodeResult.raw.time = fields[2].substring(2);
|
|
3787
|
-
ResultFormatter.position(
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
longitude: Number(fields[4].replace(/\s/g, ""))
|
|
3792
|
-
}
|
|
3793
|
-
);
|
|
4464
|
+
ResultFormatter.position(decodeResult, {
|
|
4465
|
+
latitude: Number(fields[3].replace(/\s/g, "")),
|
|
4466
|
+
longitude: Number(fields[4].replace(/\s/g, ""))
|
|
4467
|
+
});
|
|
3794
4468
|
ResultFormatter.altitude(decodeResult, Number(fields[5]));
|
|
3795
4469
|
ResultFormatter.groundspeed(decodeResult, Number(fields[6]));
|
|
3796
4470
|
ResultFormatter.heading(decodeResult, Number(fields[7]));
|
|
3797
4471
|
ResultFormatter.unknown(decodeResult, fields[8]);
|
|
3798
4472
|
} else {
|
|
3799
4473
|
decodeResult.decoded = false;
|
|
3800
|
-
ResultFormatter.unknown(decodeResult,
|
|
4474
|
+
ResultFormatter.unknown(decodeResult, text);
|
|
3801
4475
|
}
|
|
3802
4476
|
}
|
|
3803
4477
|
if (decodeResult.decoded) {
|
|
3804
4478
|
if (!decodeResult.remaining.text)
|
|
3805
4479
|
decodeResult.decoder.decodeLevel = "full";
|
|
3806
|
-
else
|
|
3807
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
4480
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
3808
4481
|
} else {
|
|
3809
4482
|
decodeResult.decoder.decodeLevel = "none";
|
|
3810
4483
|
}
|
|
@@ -3829,10 +4502,13 @@ var Label_8E = class extends DecoderPlugin {
|
|
|
3829
4502
|
const results = message.text.match(regex);
|
|
3830
4503
|
if (results?.groups) {
|
|
3831
4504
|
if (options.debug) {
|
|
3832
|
-
console.log(
|
|
4505
|
+
console.log("Label 8E ETA: groups");
|
|
3833
4506
|
console.log(results.groups);
|
|
3834
4507
|
}
|
|
3835
|
-
ResultFormatter.eta(
|
|
4508
|
+
ResultFormatter.eta(
|
|
4509
|
+
decodeResult,
|
|
4510
|
+
DateTimeUtils.convertHHMMSSToTod(results.groups.arrival_eta)
|
|
4511
|
+
);
|
|
3836
4512
|
ResultFormatter.arrivalAirport(decodeResult, results.groups.arrival_icao);
|
|
3837
4513
|
}
|
|
3838
4514
|
decodeResult.decoded = true;
|
|
@@ -3902,11 +4578,26 @@ var Label_H1 = class extends DecoderPlugin {
|
|
|
3902
4578
|
const msg = message.text.replace(/\n|\r/g, "");
|
|
3903
4579
|
const parts = msg.split("#");
|
|
3904
4580
|
let decoded = false;
|
|
3905
|
-
if (
|
|
4581
|
+
if (msg.startsWith("/")) {
|
|
4582
|
+
const headerData = msg.split(".");
|
|
4583
|
+
const decoded2 = H1Helper.decodeH1Message(
|
|
4584
|
+
decodeResult,
|
|
4585
|
+
headerData.slice(1).join(".")
|
|
4586
|
+
);
|
|
4587
|
+
if (decoded2) {
|
|
4588
|
+
decodeResult.remaining.text = headerData[0] + "." + decodeResult.remaining.text;
|
|
4589
|
+
decodeResult.decoded = decoded2;
|
|
4590
|
+
decodeResult.decoder.decodeLevel = "partial";
|
|
4591
|
+
}
|
|
4592
|
+
return decodeResult;
|
|
4593
|
+
} else if (parts.length === 1) {
|
|
3906
4594
|
decoded = H1Helper.decodeH1Message(decodeResult, msg);
|
|
3907
4595
|
} else if (parts.length == 2) {
|
|
3908
|
-
const offset = isNaN(parseInt(parts[1][1])) ? 3 : 4;
|
|
3909
|
-
decoded = H1Helper.decodeH1Message(
|
|
4596
|
+
const offset = parts[0] === "- " || isNaN(parseInt(parts[1][1])) ? 3 : 4;
|
|
4597
|
+
decoded = H1Helper.decodeH1Message(
|
|
4598
|
+
decodeResult,
|
|
4599
|
+
msg.slice(parts[0].length + offset)
|
|
4600
|
+
);
|
|
3910
4601
|
if (decoded && parts[0].length > 0) {
|
|
3911
4602
|
ResultFormatter.flightNumber(decodeResult, parts[0].substring(4));
|
|
3912
4603
|
decodeResult.remaining.text = parts[0].substring(0, 4) + "#" + parts[1].substring(0, offset - 1) + "/" + decodeResult.remaining.text;
|
|
@@ -4040,7 +4731,10 @@ var Label_H1_FLR = class extends DecoderPlugin {
|
|
|
4040
4731
|
const datetime = data.substring(0, 12);
|
|
4041
4732
|
const date = datetime.substring(4, 6) + datetime.substring(2, 4) + datetime.substring(0, 2);
|
|
4042
4733
|
ResultFormatter.unknown(decodeResult, data.substring(12), "/");
|
|
4043
|
-
decodeResult.raw.message_timestamp = DateTimeUtils.convertDateTimeToEpoch(
|
|
4734
|
+
decodeResult.raw.message_timestamp = DateTimeUtils.convertDateTimeToEpoch(
|
|
4735
|
+
datetime.substring(6),
|
|
4736
|
+
date
|
|
4737
|
+
);
|
|
4044
4738
|
decodeResult.raw.fault_message = msg;
|
|
4045
4739
|
decodeResult.formatted.items.push({
|
|
4046
4740
|
type: "fault",
|
|
@@ -4120,64 +4814,65 @@ var Label_H1_OHMA = class extends DecoderPlugin {
|
|
|
4120
4814
|
}
|
|
4121
4815
|
};
|
|
4122
4816
|
|
|
4123
|
-
// lib/plugins/
|
|
4124
|
-
var
|
|
4125
|
-
name = "label-h1-
|
|
4817
|
+
// lib/plugins/Label_H1_Paren.ts
|
|
4818
|
+
var Label_H1_Paren = class extends DecoderPlugin {
|
|
4819
|
+
name = "label-h1-paren";
|
|
4126
4820
|
qualifiers() {
|
|
4127
4821
|
return {
|
|
4128
4822
|
labels: ["H1"],
|
|
4129
|
-
preambles: ["
|
|
4823
|
+
preambles: ["("]
|
|
4130
4824
|
};
|
|
4131
4825
|
}
|
|
4132
|
-
decode(message
|
|
4826
|
+
decode(message) {
|
|
4133
4827
|
let decodeResult = this.defaultResult();
|
|
4134
4828
|
decodeResult.decoder.name = this.name;
|
|
4135
|
-
decodeResult.formatted.description = "Position Report";
|
|
4136
4829
|
decodeResult.message = message;
|
|
4137
|
-
|
|
4138
|
-
const data = message.text.slice(0, message.text.length - 4);
|
|
4139
|
-
const fields = data.split("/");
|
|
4140
|
-
if (fields[0] !== "") {
|
|
4141
|
-
ResultFormatter.unknown(decodeResult, message.text);
|
|
4830
|
+
if (!message.text || !message.text.startsWith("(")) {
|
|
4142
4831
|
decodeResult.decoded = false;
|
|
4143
|
-
decodeResult.decoder.decodeLevel = "none";
|
|
4144
4832
|
return decodeResult;
|
|
4145
4833
|
}
|
|
4146
|
-
const
|
|
4147
|
-
|
|
4148
|
-
if (
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
console.log(`Decoder: Unknown H1 message: ${message.text}`);
|
|
4169
|
-
}
|
|
4170
|
-
ResultFormatter.unknown(decodeResult, message.text);
|
|
4171
|
-
decodeResult.decoded = false;
|
|
4172
|
-
decodeResult.decoder.decodeLevel = "none";
|
|
4173
|
-
return decodeResult;
|
|
4834
|
+
const regex = /^\(POS-(?<flight>\w+)\s+(?<lat>-?\d{4,5}[NS])(?<lon>\d{5}[EW])\/(?<timestamp>\d{6})\s+F(?<alt>\d{3})\r?\nRMK\/FUEL\s+(?<fuel>\d{2,3}\.\d)\s+M(?<mach>\d\.\d{2})\)/;
|
|
4835
|
+
const match = message.text.match(regex);
|
|
4836
|
+
if (match && match.groups) {
|
|
4837
|
+
decodeResult.decoded = true;
|
|
4838
|
+
decodeResult.decoder.decodeLevel = "partial";
|
|
4839
|
+
decodeResult.formatted.description = "Position Report";
|
|
4840
|
+
ResultFormatter.flightNumber(decodeResult, match.groups.flight);
|
|
4841
|
+
ResultFormatter.position(decodeResult, {
|
|
4842
|
+
latitude: parseLat(match.groups.lat),
|
|
4843
|
+
longitude: parseLon(match.groups.lon)
|
|
4844
|
+
});
|
|
4845
|
+
ResultFormatter.time_of_day(
|
|
4846
|
+
decodeResult,
|
|
4847
|
+
DateTimeUtils.convertHHMMSSToTod(match.groups.timestamp)
|
|
4848
|
+
);
|
|
4849
|
+
ResultFormatter.altitude(
|
|
4850
|
+
decodeResult,
|
|
4851
|
+
parseInt(match.groups.alt, 10) * 100
|
|
4852
|
+
);
|
|
4853
|
+
ResultFormatter.currentFuel(decodeResult, parseFloat(match.groups.fuel));
|
|
4854
|
+
ResultFormatter.mach(decodeResult, parseFloat(match.groups.mach));
|
|
4855
|
+
ResultFormatter.unknown(decodeResult, "RMK");
|
|
4174
4856
|
}
|
|
4175
|
-
ResultFormatter.checksum(decodeResult, checksum);
|
|
4176
|
-
decodeResult.decoded = true;
|
|
4177
|
-
decodeResult.decoder.decodeLevel = !decodeResult.remaining.text ? "full" : "partial";
|
|
4178
4857
|
return decodeResult;
|
|
4179
4858
|
}
|
|
4180
4859
|
};
|
|
4860
|
+
function parseLat(latStr) {
|
|
4861
|
+
const match = latStr.match(/(-?)(\d{2})(\d{2})([NS])/);
|
|
4862
|
+
if (!match) return NaN;
|
|
4863
|
+
let deg = parseInt(match[2]);
|
|
4864
|
+
let min = parseInt(match[3]);
|
|
4865
|
+
let sign = match[4] === "S" ? -1 : 1;
|
|
4866
|
+
return sign * (deg + min / 60);
|
|
4867
|
+
}
|
|
4868
|
+
function parseLon(lonStr) {
|
|
4869
|
+
const match = lonStr.match(/(\d{3})(\d{2})([EW])/);
|
|
4870
|
+
if (!match) return NaN;
|
|
4871
|
+
let deg = parseInt(match[1]);
|
|
4872
|
+
let min = parseInt(match[2]);
|
|
4873
|
+
let sign = match[3] === "W" ? -1 : 1;
|
|
4874
|
+
return sign * (deg + min / 60);
|
|
4875
|
+
}
|
|
4181
4876
|
|
|
4182
4877
|
// lib/plugins/Label_H1_StarPOS.ts
|
|
4183
4878
|
var Label_H1_StarPOS = class extends DecoderPlugin {
|
|
@@ -4205,7 +4900,10 @@ var Label_H1_StarPOS = class extends DecoderPlugin {
|
|
|
4205
4900
|
}
|
|
4206
4901
|
ResultFormatter.month(decodeResult, Number(msg.substring(4, 6)));
|
|
4207
4902
|
ResultFormatter.day(decodeResult, Number(msg.substring(6, 8)));
|
|
4208
|
-
ResultFormatter.time_of_day(
|
|
4903
|
+
ResultFormatter.time_of_day(
|
|
4904
|
+
decodeResult,
|
|
4905
|
+
DateTimeUtils.convertHHMMSSToTod(msg.substring(8, 12))
|
|
4906
|
+
);
|
|
4209
4907
|
ResultFormatter.position(decodeResult, {
|
|
4210
4908
|
// Deg Min, no sec
|
|
4211
4909
|
latitude: CoordinateUtils.getDirection(msg.substring(12, 13)) * (Number(msg.substring(13, 15)) + Number(msg.substring(15, 17)) / 60),
|
|
@@ -4242,7 +4940,10 @@ var Label_H1_WRN = class extends DecoderPlugin {
|
|
|
4242
4940
|
const datetime = data.substring(0, 12);
|
|
4243
4941
|
const date = datetime.substring(4, 6) + datetime.substring(2, 4) + datetime.substring(0, 2);
|
|
4244
4942
|
ResultFormatter.unknown(decodeResult, data.substring(12), "/");
|
|
4245
|
-
decodeResult.raw.message_timestamp = DateTimeUtils.convertDateTimeToEpoch(
|
|
4943
|
+
decodeResult.raw.message_timestamp = DateTimeUtils.convertDateTimeToEpoch(
|
|
4944
|
+
datetime.substring(6),
|
|
4945
|
+
date
|
|
4946
|
+
);
|
|
4246
4947
|
decodeResult.raw.warning_message = msg;
|
|
4247
4948
|
decodeResult.formatted.items.push({
|
|
4248
4949
|
type: "warning",
|
|
@@ -4302,8 +5003,7 @@ var Label_HX = class extends DecoderPlugin {
|
|
|
4302
5003
|
if (decodeResult.decoded) {
|
|
4303
5004
|
if (!decodeResult.remaining.text)
|
|
4304
5005
|
decodeResult.decoder.decodeLevel = "full";
|
|
4305
|
-
else
|
|
4306
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
5006
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
4307
5007
|
} else {
|
|
4308
5008
|
decodeResult.decoder.decodeLevel = "none";
|
|
4309
5009
|
}
|
|
@@ -4435,10 +5135,16 @@ var MIAMCoreUtils = class {
|
|
|
4435
5135
|
}
|
|
4436
5136
|
},
|
|
4437
5137
|
["F" /* FileTransferRequest */]: () => {
|
|
4438
|
-
return {
|
|
5138
|
+
return {
|
|
5139
|
+
decoded: false,
|
|
5140
|
+
error: "File Transfer Request not implemented"
|
|
5141
|
+
};
|
|
4439
5142
|
},
|
|
4440
5143
|
["K" /* FileTransferAccept */]: () => {
|
|
4441
|
-
return {
|
|
5144
|
+
return {
|
|
5145
|
+
decoded: false,
|
|
5146
|
+
error: "File Transfer Accept not implemented"
|
|
5147
|
+
};
|
|
4442
5148
|
},
|
|
4443
5149
|
["S" /* FileSegment */]: () => {
|
|
4444
5150
|
return { decoded: false, error: "File Segment not implemented" };
|
|
@@ -5020,7 +5726,9 @@ var MIAMCoreUtils = class {
|
|
|
5020
5726
|
const msgSize = hdr.length + (body === void 0 ? 0 : body.length);
|
|
5021
5727
|
if (pduSize > msgSize) {
|
|
5022
5728
|
pduIsComplete = false;
|
|
5023
|
-
pduErrors.push(
|
|
5729
|
+
pduErrors.push(
|
|
5730
|
+
"v1 PDU truncated: expecting " + pduSize + ", got " + msgSize
|
|
5731
|
+
);
|
|
5024
5732
|
}
|
|
5025
5733
|
hdr = hdr.subarray(4);
|
|
5026
5734
|
tail = hdr.subarray(0, 7).toString("ascii");
|
|
@@ -5068,7 +5776,9 @@ var MIAMCoreUtils = class {
|
|
|
5068
5776
|
}
|
|
5069
5777
|
hdr = hdr.subarray(crcLen);
|
|
5070
5778
|
if (body !== void 0 && body.length > 0) {
|
|
5071
|
-
if ([1 /* Deflate */, 1 /* Deflate */].indexOf(
|
|
5779
|
+
if ([1 /* Deflate */, 1 /* Deflate */].indexOf(
|
|
5780
|
+
pduCompression
|
|
5781
|
+
) >= 0) {
|
|
5072
5782
|
try {
|
|
5073
5783
|
const decompress = new zlib2.InflateRaw({});
|
|
5074
5784
|
decompress.write(body);
|
|
@@ -5077,10 +5787,14 @@ var MIAMCoreUtils = class {
|
|
|
5077
5787
|
} catch (e) {
|
|
5078
5788
|
pduErrors.push("Inflation failed for body: " + e);
|
|
5079
5789
|
}
|
|
5080
|
-
} else if ([0 /* None */, 0 /* None */].indexOf(
|
|
5790
|
+
} else if ([0 /* None */, 0 /* None */].indexOf(
|
|
5791
|
+
pduCompression
|
|
5792
|
+
) >= 0) {
|
|
5081
5793
|
pduData = body;
|
|
5082
5794
|
} else {
|
|
5083
|
-
pduErrors.push(
|
|
5795
|
+
pduErrors.push(
|
|
5796
|
+
"Unsupported v" + version + " compression type: " + pduCompression
|
|
5797
|
+
);
|
|
5084
5798
|
}
|
|
5085
5799
|
if (pduData !== null) {
|
|
5086
5800
|
const crcAlgoHandlerByVersion = {
|
|
@@ -5100,7 +5814,9 @@ var MIAMCoreUtils = class {
|
|
|
5100
5814
|
if (crcCheck === pduCrc) {
|
|
5101
5815
|
pduCrcIsOk = true;
|
|
5102
5816
|
} else {
|
|
5103
|
-
pduErrors.push(
|
|
5817
|
+
pduErrors.push(
|
|
5818
|
+
"Body failed CRC check: provided=" + pduCrc + ", generated=" + crcCheck
|
|
5819
|
+
);
|
|
5104
5820
|
}
|
|
5105
5821
|
}
|
|
5106
5822
|
} else {
|
|
@@ -5143,7 +5859,13 @@ var MIAMCoreUtils = class {
|
|
|
5143
5859
|
static VersionPduHandlerTable = {
|
|
5144
5860
|
[1 /* V1 */]: {
|
|
5145
5861
|
[0 /* Data */]: (hdr, body) => {
|
|
5146
|
-
return this.corePduDataHandler(
|
|
5862
|
+
return this.corePduDataHandler(
|
|
5863
|
+
1 /* V1 */,
|
|
5864
|
+
20,
|
|
5865
|
+
MIAMCoreV1CRCLength,
|
|
5866
|
+
hdr,
|
|
5867
|
+
body
|
|
5868
|
+
);
|
|
5147
5869
|
},
|
|
5148
5870
|
[1 /* Ack */]: () => {
|
|
5149
5871
|
return { decoded: false, error: "v1 Ack PDU not implemented" };
|
|
@@ -5157,7 +5879,13 @@ var MIAMCoreUtils = class {
|
|
|
5157
5879
|
},
|
|
5158
5880
|
[2 /* V2 */]: {
|
|
5159
5881
|
[0 /* Data */]: (hdr, body) => {
|
|
5160
|
-
return this.corePduDataHandler(
|
|
5882
|
+
return this.corePduDataHandler(
|
|
5883
|
+
2 /* V2 */,
|
|
5884
|
+
7,
|
|
5885
|
+
MIAMCoreV2CRCLength,
|
|
5886
|
+
hdr,
|
|
5887
|
+
body
|
|
5888
|
+
);
|
|
5161
5889
|
},
|
|
5162
5890
|
[1 /* Ack */]: () => {
|
|
5163
5891
|
return { decoded: false, error: "v2 Ack PDU not implemented" };
|
|
@@ -5189,28 +5917,39 @@ var Label_MA = class extends DecoderPlugin {
|
|
|
5189
5917
|
decodeResult.decoded = true;
|
|
5190
5918
|
ResultFormatter.label(decodeResult, miamResult.message.data.acars.label);
|
|
5191
5919
|
if (miamResult.message.data.acars.sublabel) {
|
|
5192
|
-
ResultFormatter.sublabel(
|
|
5920
|
+
ResultFormatter.sublabel(
|
|
5921
|
+
decodeResult,
|
|
5922
|
+
miamResult.message.data.acars.sublabel
|
|
5923
|
+
);
|
|
5193
5924
|
}
|
|
5194
5925
|
if (miamResult.message.data.acars.tail) {
|
|
5195
|
-
ResultFormatter.tail(
|
|
5926
|
+
ResultFormatter.tail(
|
|
5927
|
+
decodeResult,
|
|
5928
|
+
miamResult.message.data.acars.tail.replace(".", "")
|
|
5929
|
+
);
|
|
5196
5930
|
}
|
|
5197
5931
|
const messageText = miamResult.message.data.acars.text;
|
|
5198
5932
|
if (miamResult.message.data.crcOk && miamResult.message.data.complete && messageText) {
|
|
5199
5933
|
decodeResult.decoder.decodeLevel = "full";
|
|
5200
|
-
const decoded = this.decoder.decode(
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5934
|
+
const decoded = this.decoder.decode(
|
|
5935
|
+
{
|
|
5936
|
+
label: miamResult.message.data.acars.label,
|
|
5937
|
+
sublabel: miamResult.message.data.acars.sublabel,
|
|
5938
|
+
text: messageText
|
|
5939
|
+
},
|
|
5940
|
+
options
|
|
5941
|
+
);
|
|
5205
5942
|
if (decoded.decoded) {
|
|
5206
5943
|
decodeResult.raw = { ...decodeResult.raw, ...decoded.raw };
|
|
5207
5944
|
decodeResult.formatted.items.push(...decoded.formatted.items);
|
|
5945
|
+
decodeResult.remaining = decoded.remaining;
|
|
5208
5946
|
} else {
|
|
5209
5947
|
ResultFormatter.text(decodeResult, messageText);
|
|
5948
|
+
decodeResult.remaining = { text: messageText };
|
|
5210
5949
|
}
|
|
5211
5950
|
} else if (messageText) {
|
|
5212
5951
|
decodeResult.decoder.decodeLevel = "partial";
|
|
5213
|
-
|
|
5952
|
+
decodeResult.remaining = { text: messageText };
|
|
5214
5953
|
} else {
|
|
5215
5954
|
decodeResult.decoder.decodeLevel = "partial";
|
|
5216
5955
|
}
|
|
@@ -5338,15 +6077,19 @@ var Label_QR = class extends DecoderPlugin {
|
|
|
5338
6077
|
const decodeResult = this.defaultResult();
|
|
5339
6078
|
decodeResult.decoder.name = this.name;
|
|
5340
6079
|
decodeResult.formatted.description = "ON Report";
|
|
5341
|
-
ResultFormatter.departureAirport(
|
|
6080
|
+
ResultFormatter.departureAirport(
|
|
6081
|
+
decodeResult,
|
|
6082
|
+
message.text.substring(0, 4)
|
|
6083
|
+
);
|
|
5342
6084
|
ResultFormatter.arrivalAirport(decodeResult, message.text.substring(4, 8));
|
|
5343
|
-
ResultFormatter.on(
|
|
6085
|
+
ResultFormatter.on(
|
|
6086
|
+
decodeResult,
|
|
6087
|
+
DateTimeUtils.convertHHMMSSToTod(message.text.substring(8, 12))
|
|
6088
|
+
);
|
|
5344
6089
|
ResultFormatter.unknown(decodeResult, message.text.substring(12));
|
|
5345
6090
|
decodeResult.decoded = true;
|
|
5346
|
-
if (!decodeResult.remaining.text)
|
|
5347
|
-
|
|
5348
|
-
else
|
|
5349
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
6091
|
+
if (!decodeResult.remaining.text) decodeResult.decoder.decodeLevel = "full";
|
|
6092
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
5350
6093
|
return decodeResult;
|
|
5351
6094
|
}
|
|
5352
6095
|
};
|
|
@@ -5363,15 +6106,19 @@ var Label_QP = class extends DecoderPlugin {
|
|
|
5363
6106
|
const decodeResult = this.defaultResult();
|
|
5364
6107
|
decodeResult.decoder.name = this.name;
|
|
5365
6108
|
decodeResult.formatted.description = "OUT Report";
|
|
5366
|
-
ResultFormatter.departureAirport(
|
|
6109
|
+
ResultFormatter.departureAirport(
|
|
6110
|
+
decodeResult,
|
|
6111
|
+
message.text.substring(0, 4)
|
|
6112
|
+
);
|
|
5367
6113
|
ResultFormatter.arrivalAirport(decodeResult, message.text.substring(4, 8));
|
|
5368
|
-
ResultFormatter.out(
|
|
6114
|
+
ResultFormatter.out(
|
|
6115
|
+
decodeResult,
|
|
6116
|
+
DateTimeUtils.convertHHMMSSToTod(message.text.substring(8, 12))
|
|
6117
|
+
);
|
|
5369
6118
|
ResultFormatter.unknown(decodeResult, message.text.substring(12));
|
|
5370
6119
|
decodeResult.decoded = true;
|
|
5371
|
-
if (!decodeResult.remaining.text)
|
|
5372
|
-
|
|
5373
|
-
else
|
|
5374
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
6120
|
+
if (!decodeResult.remaining.text) decodeResult.decoder.decodeLevel = "full";
|
|
6121
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
5375
6122
|
return decodeResult;
|
|
5376
6123
|
}
|
|
5377
6124
|
};
|
|
@@ -5388,15 +6135,19 @@ var Label_QS = class extends DecoderPlugin {
|
|
|
5388
6135
|
const decodeResult = this.defaultResult();
|
|
5389
6136
|
decodeResult.decoder.name = this.name;
|
|
5390
6137
|
decodeResult.formatted.description = "IN Report";
|
|
5391
|
-
ResultFormatter.departureAirport(
|
|
6138
|
+
ResultFormatter.departureAirport(
|
|
6139
|
+
decodeResult,
|
|
6140
|
+
message.text.substring(0, 4)
|
|
6141
|
+
);
|
|
5392
6142
|
ResultFormatter.arrivalAirport(decodeResult, message.text.substring(4, 8));
|
|
5393
|
-
ResultFormatter.in(
|
|
6143
|
+
ResultFormatter.in(
|
|
6144
|
+
decodeResult,
|
|
6145
|
+
DateTimeUtils.convertHHMMSSToTod(message.text.substring(8, 12))
|
|
6146
|
+
);
|
|
5394
6147
|
ResultFormatter.unknown(decodeResult, message.text.substring(12));
|
|
5395
6148
|
decodeResult.decoded = true;
|
|
5396
|
-
if (!decodeResult.remaining.text)
|
|
5397
|
-
|
|
5398
|
-
else
|
|
5399
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
6149
|
+
if (!decodeResult.remaining.text) decodeResult.decoder.decodeLevel = "full";
|
|
6150
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
5400
6151
|
return decodeResult;
|
|
5401
6152
|
}
|
|
5402
6153
|
};
|
|
@@ -5414,11 +6165,17 @@ var Label_QQ = class extends DecoderPlugin {
|
|
|
5414
6165
|
decodeResult.decoder.name = this.name;
|
|
5415
6166
|
decodeResult.message = message;
|
|
5416
6167
|
decodeResult.formatted.description = "OFF Report";
|
|
5417
|
-
ResultFormatter.departureAirport(
|
|
6168
|
+
ResultFormatter.departureAirport(
|
|
6169
|
+
decodeResult,
|
|
6170
|
+
message.text.substring(0, 4)
|
|
6171
|
+
);
|
|
5418
6172
|
ResultFormatter.arrivalAirport(decodeResult, message.text.substring(4, 8));
|
|
5419
6173
|
if (message.text.substring(12, 19) === "\r\n001FE") {
|
|
5420
6174
|
decodeResult.raw.day = message.text.substring(19, 21);
|
|
5421
|
-
ResultFormatter.off(
|
|
6175
|
+
ResultFormatter.off(
|
|
6176
|
+
decodeResult,
|
|
6177
|
+
DateTimeUtils.convertHHMMSSToTod(message.text.substring(21, 27))
|
|
6178
|
+
);
|
|
5422
6179
|
let latdir = message.text.substring(27, 28);
|
|
5423
6180
|
let latdeg = Number(message.text.substring(28, 30));
|
|
5424
6181
|
let latmin = Number(message.text.substring(30, 34));
|
|
@@ -5432,20 +6189,24 @@ var Label_QQ = class extends DecoderPlugin {
|
|
|
5432
6189
|
ResultFormatter.unknown(decodeResult, message.text.substring(42, 45));
|
|
5433
6190
|
ResultFormatter.position(decodeResult, pos);
|
|
5434
6191
|
if (decodeResult.remaining.text !== "---") {
|
|
5435
|
-
ResultFormatter.groundspeed(
|
|
6192
|
+
ResultFormatter.groundspeed(
|
|
6193
|
+
decodeResult,
|
|
6194
|
+
Number(message.text.substring(45, 48))
|
|
6195
|
+
);
|
|
5436
6196
|
} else {
|
|
5437
6197
|
ResultFormatter.unknown(decodeResult, message.text.substring(45, 48));
|
|
5438
6198
|
}
|
|
5439
6199
|
ResultFormatter.unknown(decodeResult, message.text.substring(48));
|
|
5440
6200
|
} else {
|
|
5441
|
-
ResultFormatter.off(
|
|
6201
|
+
ResultFormatter.off(
|
|
6202
|
+
decodeResult,
|
|
6203
|
+
DateTimeUtils.convertHHMMSSToTod(message.text.substring(8, 12) + "00")
|
|
6204
|
+
);
|
|
5442
6205
|
ResultFormatter.unknown(decodeResult, message.text.substring(12));
|
|
5443
6206
|
}
|
|
5444
6207
|
decodeResult.decoded = true;
|
|
5445
|
-
if (!decodeResult.remaining.text)
|
|
5446
|
-
|
|
5447
|
-
else
|
|
5448
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
6208
|
+
if (!decodeResult.remaining.text) decodeResult.decoder.decodeLevel = "full";
|
|
6209
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
5449
6210
|
return decodeResult;
|
|
5450
6211
|
}
|
|
5451
6212
|
};
|
|
@@ -5459,6 +6220,7 @@ var MessageDecoder = class {
|
|
|
5459
6220
|
this.name = "acars-decoder-typescript";
|
|
5460
6221
|
this.plugins = [];
|
|
5461
6222
|
this.debug = false;
|
|
6223
|
+
this.registerPlugin(new CBand(this));
|
|
5462
6224
|
this.registerPlugin(new Label_ColonComma(this));
|
|
5463
6225
|
this.registerPlugin(new Label_5Z_Slash(this));
|
|
5464
6226
|
this.registerPlugin(new Label_10_LDR(this));
|
|
@@ -5507,9 +6269,9 @@ var MessageDecoder = class {
|
|
|
5507
6269
|
this.registerPlugin(new Label_H2_02E(this));
|
|
5508
6270
|
this.registerPlugin(new Label_H1_FLR(this));
|
|
5509
6271
|
this.registerPlugin(new Label_H1_OHMA(this));
|
|
6272
|
+
this.registerPlugin(new Label_H1_Paren(this));
|
|
5510
6273
|
this.registerPlugin(new Label_H1_WRN(this));
|
|
5511
6274
|
this.registerPlugin(new Label_H1(this));
|
|
5512
|
-
this.registerPlugin(new Label_H1_Slash(this));
|
|
5513
6275
|
this.registerPlugin(new Label_H1_StarPOS(this));
|
|
5514
6276
|
this.registerPlugin(new Label_HX(this));
|
|
5515
6277
|
this.registerPlugin(new Label_58(this));
|
|
@@ -5525,14 +6287,13 @@ var MessageDecoder = class {
|
|
|
5525
6287
|
this.registerPlugin(new Label_QS(this));
|
|
5526
6288
|
}
|
|
5527
6289
|
registerPlugin(plugin) {
|
|
5528
|
-
const pluginInstance = plugin;
|
|
5529
6290
|
this.plugins.push(plugin);
|
|
5530
6291
|
return true;
|
|
5531
6292
|
}
|
|
5532
6293
|
decode(message, options = {}) {
|
|
5533
6294
|
const usablePlugins = this.plugins.filter((plugin) => {
|
|
5534
6295
|
const qualifiers = plugin.qualifiers();
|
|
5535
|
-
if (qualifiers.labels.includes(message.label)) {
|
|
6296
|
+
if (qualifiers.labels.includes(message.label) || qualifiers.labels.length === 1 && qualifiers.labels[0] === "*") {
|
|
5536
6297
|
if (qualifiers.preambles && qualifiers.preambles.length > 0) {
|
|
5537
6298
|
const matching = qualifiers.preambles.filter((preamble) => {
|
|
5538
6299
|
return message.text.substring(0, preamble.length) === preamble;
|