@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.mjs
CHANGED
|
@@ -1,85 +1,87 @@
|
|
|
1
1
|
// lib/IcaoDecoder.ts
|
|
2
|
-
var IcaoDecoder = class {
|
|
2
|
+
var IcaoDecoder = class _IcaoDecoder {
|
|
3
3
|
name;
|
|
4
4
|
icao;
|
|
5
|
+
// Military ICAO address ranges (as [start, end] tuples, inclusive)
|
|
6
|
+
static MILITARY_RANGES = [
|
|
7
|
+
[65648, 65679],
|
|
8
|
+
// Egypt
|
|
9
|
+
[671744, 675839],
|
|
10
|
+
// Algeria
|
|
11
|
+
[3407616, 3407871],
|
|
12
|
+
// Italy
|
|
13
|
+
[3473408, 3670015],
|
|
14
|
+
// Spain
|
|
15
|
+
[3842048, 3866623],
|
|
16
|
+
// France 1
|
|
17
|
+
[3895296, 3932159],
|
|
18
|
+
// France 2
|
|
19
|
+
[4104192, 4112383],
|
|
20
|
+
// Germany 1
|
|
21
|
+
[4145152, 4177919],
|
|
22
|
+
// Germany 2
|
|
23
|
+
[4194304, 4194367],
|
|
24
|
+
// UK 1
|
|
25
|
+
[4440064, 4444159],
|
|
26
|
+
// UK 2
|
|
27
|
+
[4472832, 4485119],
|
|
28
|
+
// Austria
|
|
29
|
+
[4517888, 4521983],
|
|
30
|
+
// Belgium
|
|
31
|
+
[4550656, 4554751],
|
|
32
|
+
// Bulgaria
|
|
33
|
+
[4584448, 4584703],
|
|
34
|
+
// Denmark
|
|
35
|
+
[4620288, 4621311],
|
|
36
|
+
// Greece
|
|
37
|
+
[4668416, 4668431],
|
|
38
|
+
// Hungary
|
|
39
|
+
[4686080, 4686335],
|
|
40
|
+
// Norway
|
|
41
|
+
[4718592, 4722687],
|
|
42
|
+
// Netherlands
|
|
43
|
+
[4773888, 4774015],
|
|
44
|
+
// Poland
|
|
45
|
+
[4815872, 4816127],
|
|
46
|
+
// Portugal
|
|
47
|
+
[4817952, 4817967],
|
|
48
|
+
// Czech
|
|
49
|
+
[4943872, 4947967],
|
|
50
|
+
// Switzerland
|
|
51
|
+
[4948480, 4948735],
|
|
52
|
+
// Turkey
|
|
53
|
+
[7389296, 7389311],
|
|
54
|
+
// Oman
|
|
55
|
+
[7406168, 7406223],
|
|
56
|
+
// Saudi 1
|
|
57
|
+
[7406464, 7406495],
|
|
58
|
+
// Saudi 2
|
|
59
|
+
[7571968, 7572223],
|
|
60
|
+
// Israel
|
|
61
|
+
[8189952, 8190719],
|
|
62
|
+
// Australia
|
|
63
|
+
[8389120, 8389375],
|
|
64
|
+
// India
|
|
65
|
+
[11401160, 11534335],
|
|
66
|
+
// USA
|
|
67
|
+
[12713984, 12845055],
|
|
68
|
+
// Canada
|
|
69
|
+
[14942208, 14950399]
|
|
70
|
+
// Brazil
|
|
71
|
+
];
|
|
5
72
|
constructor(icao) {
|
|
6
73
|
this.name = "icao-decoder-typescript";
|
|
7
74
|
this.icao = icao;
|
|
8
75
|
}
|
|
9
76
|
isMilitary() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var DateTimeUtils = class {
|
|
17
|
-
// Expects a four digit UTC time string (HHMM)
|
|
18
|
-
static UTCToString(UTCString) {
|
|
19
|
-
let utcDate = /* @__PURE__ */ new Date();
|
|
20
|
-
utcDate.setUTCHours(+UTCString.substr(0, 2), +UTCString.substr(2, 2), 0);
|
|
21
|
-
return utcDate.toTimeString();
|
|
22
|
-
}
|
|
23
|
-
// Expects a six digit date string and a four digit UTC time string
|
|
24
|
-
// (DDMMYY) (HHMM)
|
|
25
|
-
static UTCDateTimeToString(dateString, timeString) {
|
|
26
|
-
let utcDate = /* @__PURE__ */ new Date();
|
|
27
|
-
utcDate.setUTCDate(+dateString.substr(0, 2));
|
|
28
|
-
utcDate.setUTCMonth(+dateString.substr(2, 2));
|
|
29
|
-
if (dateString.length === 6) {
|
|
30
|
-
utcDate.setUTCFullYear(2e3 + +dateString.substr(4, 2));
|
|
31
|
-
}
|
|
32
|
-
if (timeString.length === 6) {
|
|
33
|
-
utcDate.setUTCHours(+timeString.substr(0, 2), +timeString.substr(2, 2), +timeString.substr(4, 2));
|
|
34
|
-
} else {
|
|
35
|
-
utcDate.setUTCHours(+timeString.substr(0, 2), +timeString.substr(2, 2), 0);
|
|
36
|
-
}
|
|
37
|
-
return utcDate.toUTCString();
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
41
|
-
* @param time HHMMSS or HHMM
|
|
42
|
-
* @returns seconds since midnight
|
|
43
|
-
*/
|
|
44
|
-
static convertHHMMSSToTod(time) {
|
|
45
|
-
if (time.length === 4) {
|
|
46
|
-
time += "00";
|
|
47
|
-
}
|
|
48
|
-
const h = Number(time.substring(0, 2));
|
|
49
|
-
const m = Number(time.substring(2, 4));
|
|
50
|
-
const s = Number(time.substring(4, 6));
|
|
51
|
-
const tod = h * 3600 + m * 60 + s;
|
|
52
|
-
return tod;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
* @param time HHMMSS
|
|
57
|
-
* @param date MMDDYY or MMDDYYYY
|
|
58
|
-
* @returns seconds since epoch
|
|
59
|
-
*/
|
|
60
|
-
static convertDateTimeToEpoch(time, date) {
|
|
61
|
-
if (date.length === 6) {
|
|
62
|
-
date = date.substring(0, 4) + `20${date.substring(4, 6)}`;
|
|
63
|
-
}
|
|
64
|
-
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`;
|
|
65
|
-
const millis = Date.parse(timestamp);
|
|
66
|
-
return millis / 1e3;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Converts a timestamp to a string
|
|
70
|
-
*
|
|
71
|
-
* ISO-8601 format for 'epoch'
|
|
72
|
-
* HH:MM:SS for 'tod'
|
|
73
|
-
* @param time
|
|
74
|
-
* @param format
|
|
75
|
-
* @returns
|
|
76
|
-
*/
|
|
77
|
-
static timestampToString(time, format) {
|
|
78
|
-
const date = new Date(time * 1e3);
|
|
79
|
-
if (format == "tod") {
|
|
80
|
-
return date.toISOString().slice(11, 19);
|
|
77
|
+
const i = this.icao;
|
|
78
|
+
const n = parseInt(i, 16);
|
|
79
|
+
for (const [start, end] of _IcaoDecoder.MILITARY_RANGES) {
|
|
80
|
+
if (start <= n && n <= end) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
81
83
|
}
|
|
82
|
-
return
|
|
84
|
+
return false;
|
|
83
85
|
}
|
|
84
86
|
};
|
|
85
87
|
|
|
@@ -109,7 +111,9 @@ var DecoderPlugin = class {
|
|
|
109
111
|
this.options = options;
|
|
110
112
|
}
|
|
111
113
|
id() {
|
|
112
|
-
console.log(
|
|
114
|
+
console.log(
|
|
115
|
+
"DecoderPlugin subclass has not overriden id() to provide a unique ID for this plugin!"
|
|
116
|
+
);
|
|
113
117
|
return "abstract_decoder_plugin";
|
|
114
118
|
}
|
|
115
119
|
meetsStateRequirements() {
|
|
@@ -136,7 +140,7 @@ var CoordinateUtils = class _CoordinateUtils {
|
|
|
136
140
|
/**
|
|
137
141
|
* Decode a string of coordinates into an object with latitude and longitude in millidegrees
|
|
138
142
|
* @param stringCoords - The string of coordinates to decode
|
|
139
|
-
*
|
|
143
|
+
*
|
|
140
144
|
* @returns An object with latitude and longitude properties
|
|
141
145
|
*/
|
|
142
146
|
static decodeStringCoordinates(stringCoords) {
|
|
@@ -156,11 +160,11 @@ var CoordinateUtils = class _CoordinateUtils {
|
|
|
156
160
|
return void 0;
|
|
157
161
|
}
|
|
158
162
|
/**
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
163
|
+
* Decode a string of coordinates into an object with latitude and longitude in degrees and decimal minutes
|
|
164
|
+
* @param stringCoords - The string of coordinates to decode
|
|
165
|
+
*
|
|
166
|
+
* @returns An object with latitude and longitude properties
|
|
167
|
+
*/
|
|
164
168
|
static decodeStringCoordinatesDecimalMinutes(stringCoords) {
|
|
165
169
|
const firstChar = stringCoords.substring(0, 1);
|
|
166
170
|
let middleChar = stringCoords.substring(6, 7);
|
|
@@ -199,6 +203,85 @@ var CoordinateUtils = class _CoordinateUtils {
|
|
|
199
203
|
}
|
|
200
204
|
};
|
|
201
205
|
|
|
206
|
+
// lib/DateTimeUtils.ts
|
|
207
|
+
var DateTimeUtils = class {
|
|
208
|
+
// Expects a four digit UTC time string (HHMM)
|
|
209
|
+
static UTCToString(UTCString) {
|
|
210
|
+
let utcDate = /* @__PURE__ */ new Date();
|
|
211
|
+
utcDate.setUTCHours(+UTCString.substr(0, 2), +UTCString.substr(2, 2), 0);
|
|
212
|
+
return utcDate.toTimeString();
|
|
213
|
+
}
|
|
214
|
+
// Expects a six digit date string and a four digit UTC time string
|
|
215
|
+
// (DDMMYY) (HHMM)
|
|
216
|
+
static UTCDateTimeToString(dateString, timeString) {
|
|
217
|
+
let utcDate = /* @__PURE__ */ new Date();
|
|
218
|
+
utcDate.setUTCDate(+dateString.substr(0, 2));
|
|
219
|
+
utcDate.setUTCMonth(+dateString.substr(2, 2));
|
|
220
|
+
if (dateString.length === 6) {
|
|
221
|
+
utcDate.setUTCFullYear(2e3 + +dateString.substr(4, 2));
|
|
222
|
+
}
|
|
223
|
+
if (timeString.length === 6) {
|
|
224
|
+
utcDate.setUTCHours(
|
|
225
|
+
+timeString.substr(0, 2),
|
|
226
|
+
+timeString.substr(2, 2),
|
|
227
|
+
+timeString.substr(4, 2)
|
|
228
|
+
);
|
|
229
|
+
} else {
|
|
230
|
+
utcDate.setUTCHours(
|
|
231
|
+
+timeString.substr(0, 2),
|
|
232
|
+
+timeString.substr(2, 2),
|
|
233
|
+
0
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
return utcDate.toUTCString();
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
*
|
|
240
|
+
* @param time HHMMSS or HHMM
|
|
241
|
+
* @returns seconds since midnight
|
|
242
|
+
*/
|
|
243
|
+
static convertHHMMSSToTod(time) {
|
|
244
|
+
if (time.length === 4) {
|
|
245
|
+
time += "00";
|
|
246
|
+
}
|
|
247
|
+
const h = Number(time.substring(0, 2));
|
|
248
|
+
const m = Number(time.substring(2, 4));
|
|
249
|
+
const s = Number(time.substring(4, 6));
|
|
250
|
+
const tod = h * 3600 + m * 60 + s;
|
|
251
|
+
return tod;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
*
|
|
255
|
+
* @param time HHMMSS
|
|
256
|
+
* @param date MMDDYY or MMDDYYYY
|
|
257
|
+
* @returns seconds since epoch
|
|
258
|
+
*/
|
|
259
|
+
static convertDateTimeToEpoch(time, date) {
|
|
260
|
+
if (date.length === 6) {
|
|
261
|
+
date = date.substring(0, 4) + `20${date.substring(4, 6)}`;
|
|
262
|
+
}
|
|
263
|
+
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`;
|
|
264
|
+
const millis = Date.parse(timestamp);
|
|
265
|
+
return millis / 1e3;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Converts a timestamp to a string
|
|
269
|
+
*
|
|
270
|
+
* ISO-8601 format for 'epoch'
|
|
271
|
+
* HH:MM:SS for 'tod'
|
|
272
|
+
* @param time
|
|
273
|
+
* @param format
|
|
274
|
+
* @returns
|
|
275
|
+
*/
|
|
276
|
+
static timestampToString(time, format) {
|
|
277
|
+
const date = new Date(time * 1e3);
|
|
278
|
+
if (format == "tod") {
|
|
279
|
+
return date.toISOString().slice(11, 19);
|
|
280
|
+
}
|
|
281
|
+
return date.toISOString().slice(0, -5) + "Z";
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
|
|
202
285
|
// lib/utils/route_utils.ts
|
|
203
286
|
var RouteUtils = class _RouteUtils {
|
|
204
287
|
static formatFlightState(state) {
|
|
@@ -253,20 +336,36 @@ var RouteUtils = class _RouteUtils {
|
|
|
253
336
|
static getWaypoint(leg) {
|
|
254
337
|
const regex = leg.match(/^([A-Z]+)(\d{3})-(\d{4})$/);
|
|
255
338
|
if (regex?.length == 4) {
|
|
256
|
-
return {
|
|
339
|
+
return {
|
|
340
|
+
name: regex[1],
|
|
341
|
+
offset: {
|
|
342
|
+
bearing: parseInt(regex[2]),
|
|
343
|
+
distance: parseInt(regex[3]) / 10
|
|
344
|
+
}
|
|
345
|
+
};
|
|
257
346
|
}
|
|
258
347
|
const waypoint = leg.split(",");
|
|
259
348
|
if (waypoint.length == 2) {
|
|
260
|
-
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
349
|
+
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
350
|
+
waypoint[1]
|
|
351
|
+
);
|
|
261
352
|
if (position) {
|
|
262
|
-
return {
|
|
353
|
+
return {
|
|
354
|
+
name: waypoint[0],
|
|
355
|
+
latitude: position.latitude,
|
|
356
|
+
longitude: position.longitude
|
|
357
|
+
};
|
|
263
358
|
}
|
|
264
359
|
}
|
|
265
360
|
if (leg.length == 13 || leg.length == 14) {
|
|
266
361
|
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(leg);
|
|
267
362
|
const name = waypoint.length == 2 ? waypoint[0] : "";
|
|
268
363
|
if (position) {
|
|
269
|
-
return {
|
|
364
|
+
return {
|
|
365
|
+
name,
|
|
366
|
+
latitude: position.latitude,
|
|
367
|
+
longitude: position.longitude
|
|
368
|
+
};
|
|
270
369
|
}
|
|
271
370
|
}
|
|
272
371
|
return { name: leg };
|
|
@@ -491,8 +590,11 @@ var ResultFormatter = class {
|
|
|
491
590
|
value: decodeResult.raw.fuel_remaining.toString()
|
|
492
591
|
});
|
|
493
592
|
}
|
|
593
|
+
static checksumAlgorithm(decodeResult, value) {
|
|
594
|
+
decodeResult.raw.checksum_algorithm = value;
|
|
595
|
+
}
|
|
494
596
|
static checksum(decodeResult, value) {
|
|
495
|
-
decodeResult.raw.checksum =
|
|
597
|
+
decodeResult.raw.checksum = value;
|
|
496
598
|
decodeResult.formatted.items.push({
|
|
497
599
|
type: "message_checksum",
|
|
498
600
|
code: "CHECKSUM",
|
|
@@ -531,7 +633,9 @@ var ResultFormatter = class {
|
|
|
531
633
|
if (value.length === 0) {
|
|
532
634
|
return;
|
|
533
635
|
}
|
|
534
|
-
decodeResult.raw.outside_air_temperature = Number(
|
|
636
|
+
decodeResult.raw.outside_air_temperature = Number(
|
|
637
|
+
value.replace("M", "-").replace("P", "+")
|
|
638
|
+
);
|
|
535
639
|
decodeResult.formatted.items.push({
|
|
536
640
|
type: "outside_air_temperature",
|
|
537
641
|
code: "OATEMP",
|
|
@@ -748,17 +852,112 @@ var ResultFormatter = class {
|
|
|
748
852
|
value: `${decodeResult.raw.sublabel}`
|
|
749
853
|
});
|
|
750
854
|
}
|
|
855
|
+
static requestedAltitudes(decodeResult, values) {
|
|
856
|
+
decodeResult.raw.requested_alts = values;
|
|
857
|
+
decodeResult.formatted.items.push({
|
|
858
|
+
type: "requested_altitudes",
|
|
859
|
+
code: "REQ_ALTS",
|
|
860
|
+
label: "Requested Altitudes",
|
|
861
|
+
value: `${decodeResult.raw.requested_alts.join(", ")}`
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
static desiredAltitude(decodeResult, value) {
|
|
865
|
+
decodeResult.raw.desired_alt = value;
|
|
866
|
+
decodeResult.formatted.items.push({
|
|
867
|
+
type: "desired_altitude",
|
|
868
|
+
code: "DES_ALT",
|
|
869
|
+
label: "Desired Altitude",
|
|
870
|
+
value: `${decodeResult.raw.desired_alt}`
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
static startPoint(decodeResult, value) {
|
|
874
|
+
decodeResult.raw.start_point = value;
|
|
875
|
+
decodeResult.formatted.items.push({
|
|
876
|
+
type: "start_point",
|
|
877
|
+
code: "START",
|
|
878
|
+
label: "Start Point",
|
|
879
|
+
value: `${decodeResult.raw.start_point}`
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
static routeNumber(decodeResult, value) {
|
|
883
|
+
decodeResult.raw.route_number = value;
|
|
884
|
+
decodeResult.formatted.items.push({
|
|
885
|
+
type: "route_number",
|
|
886
|
+
code: "RTE_NUM",
|
|
887
|
+
label: "Route Number",
|
|
888
|
+
value: `${decodeResult.raw.route_number}`
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
static flightPlan(decodeResult, value) {
|
|
892
|
+
decodeResult.raw.flight_plan = value;
|
|
893
|
+
decodeResult.formatted.items.push({
|
|
894
|
+
type: "flight_plan",
|
|
895
|
+
code: "FPN",
|
|
896
|
+
label: "Flight Plan",
|
|
897
|
+
value: `${decodeResult.raw.flight_plan}`
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
static groundAddress(decodeResult, value) {
|
|
901
|
+
decodeResult.raw.ground_address = value;
|
|
902
|
+
decodeResult.formatted.items.push({
|
|
903
|
+
type: "ground_address",
|
|
904
|
+
code: "GND_ADDR",
|
|
905
|
+
label: "Ground Address",
|
|
906
|
+
value: `${decodeResult.raw.ground_address}`
|
|
907
|
+
});
|
|
908
|
+
}
|
|
751
909
|
static unknown(decodeResult, value, sep = ",") {
|
|
752
|
-
if (!decodeResult.remaining.text)
|
|
753
|
-
|
|
754
|
-
else
|
|
755
|
-
decodeResult.remaining.text += sep + value;
|
|
910
|
+
if (!decodeResult.remaining.text) decodeResult.remaining.text = value;
|
|
911
|
+
else decodeResult.remaining.text += sep + value;
|
|
756
912
|
}
|
|
757
913
|
static unknownArr(decodeResult, value, sep = ",") {
|
|
758
914
|
this.unknown(decodeResult, value.join(sep), sep);
|
|
759
915
|
}
|
|
760
916
|
};
|
|
761
917
|
|
|
918
|
+
// lib/plugins/CBand.ts
|
|
919
|
+
var CBand = class extends DecoderPlugin {
|
|
920
|
+
name = "c-band";
|
|
921
|
+
qualifiers() {
|
|
922
|
+
return {
|
|
923
|
+
labels: ["*"]
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
decode(message, options = {}) {
|
|
927
|
+
let decodeResult = this.defaultResult();
|
|
928
|
+
decodeResult.decoder.name = this.name;
|
|
929
|
+
decodeResult.message = message;
|
|
930
|
+
let cband = message.text.match(
|
|
931
|
+
/^(?<msgno>[A-Z]\d{2}[A-Z])(?<airline>[A-Z0-9]{2})(?<number>[0-9]{4})/
|
|
932
|
+
);
|
|
933
|
+
if (cband?.groups) {
|
|
934
|
+
const messageText = message.text.substring(10);
|
|
935
|
+
const decoded = this.decoder.decode(
|
|
936
|
+
{
|
|
937
|
+
label: message.label,
|
|
938
|
+
sublabel: message.sublabel,
|
|
939
|
+
text: messageText
|
|
940
|
+
},
|
|
941
|
+
options
|
|
942
|
+
);
|
|
943
|
+
if (decoded.decoded) {
|
|
944
|
+
ResultFormatter.flightNumber(
|
|
945
|
+
decodeResult,
|
|
946
|
+
cband.groups.airline + Number(cband.groups.number)
|
|
947
|
+
);
|
|
948
|
+
decodeResult.decoded = true;
|
|
949
|
+
decodeResult.decoder.decodeLevel = decoded.decoder.decodeLevel;
|
|
950
|
+
decodeResult.decoder.name = this.name + "-" + decoded.decoder.name;
|
|
951
|
+
decodeResult.raw = { ...decodeResult.raw, ...decoded.raw };
|
|
952
|
+
decodeResult.formatted.description = decoded.formatted.description;
|
|
953
|
+
decodeResult.formatted.items.push(...decoded.formatted.items);
|
|
954
|
+
decodeResult.remaining = decoded.remaining;
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
return decodeResult;
|
|
958
|
+
}
|
|
959
|
+
};
|
|
960
|
+
|
|
762
961
|
// lib/plugins/Label_5Z_Slash.ts
|
|
763
962
|
var Label_5Z_Slash = class extends DecoderPlugin {
|
|
764
963
|
name = "label-5z-slash";
|
|
@@ -829,12 +1028,23 @@ var Label_5Z_Slash = class extends DecoderPlugin {
|
|
|
829
1028
|
ResultFormatter.departureAirport(decodeResult, info[1]);
|
|
830
1029
|
ResultFormatter.arrivalAirport(decodeResult, info[2]);
|
|
831
1030
|
decodeResult.raw.day = Number(info[3]);
|
|
832
|
-
ResultFormatter.time_of_day(
|
|
1031
|
+
ResultFormatter.time_of_day(
|
|
1032
|
+
decodeResult,
|
|
1033
|
+
DateTimeUtils.convertHHMMSSToTod(info[4])
|
|
1034
|
+
);
|
|
833
1035
|
ResultFormatter.arrivalRunway(decodeResult, info[5].slice(1));
|
|
834
1036
|
ResultFormatter.unknownArr(decodeResult, data.slice(3), "/");
|
|
835
1037
|
} else if (type === "B3") {
|
|
836
|
-
ResultFormatter.departureAirport(
|
|
837
|
-
|
|
1038
|
+
ResultFormatter.departureAirport(
|
|
1039
|
+
decodeResult,
|
|
1040
|
+
header[1].substring(0, 3),
|
|
1041
|
+
"IATA"
|
|
1042
|
+
);
|
|
1043
|
+
ResultFormatter.arrivalAirport(
|
|
1044
|
+
decodeResult,
|
|
1045
|
+
header[1].substring(3),
|
|
1046
|
+
"IATA"
|
|
1047
|
+
);
|
|
838
1048
|
decodeResult.raw.day = Number(header[2]);
|
|
839
1049
|
ResultFormatter.arrivalRunway(decodeResult, header[3].slice(1));
|
|
840
1050
|
if (header.length > 4) {
|
|
@@ -845,19 +1055,36 @@ var Label_5Z_Slash = class extends DecoderPlugin {
|
|
|
845
1055
|
ResultFormatter.departureAirport(decodeResult, info[1]);
|
|
846
1056
|
ResultFormatter.arrivalAirport(decodeResult, info[2]);
|
|
847
1057
|
decodeResult.raw.day = Number(info[3]);
|
|
848
|
-
ResultFormatter.time_of_day(
|
|
1058
|
+
ResultFormatter.time_of_day(
|
|
1059
|
+
decodeResult,
|
|
1060
|
+
DateTimeUtils.convertHHMMSSToTod(info[4])
|
|
1061
|
+
);
|
|
849
1062
|
ResultFormatter.unknownArr(decodeResult, info.slice(5), " ");
|
|
850
1063
|
} else if (type === "C3") {
|
|
851
|
-
ResultFormatter.departureAirport(
|
|
852
|
-
|
|
1064
|
+
ResultFormatter.departureAirport(
|
|
1065
|
+
decodeResult,
|
|
1066
|
+
header[1].substring(0, 3),
|
|
1067
|
+
"IATA"
|
|
1068
|
+
);
|
|
1069
|
+
ResultFormatter.arrivalAirport(
|
|
1070
|
+
decodeResult,
|
|
1071
|
+
header[1].substring(3),
|
|
1072
|
+
"IATA"
|
|
1073
|
+
);
|
|
853
1074
|
} else if (type === "ET") {
|
|
854
1075
|
const airports = data[2].split(" ");
|
|
855
1076
|
ResultFormatter.departureAirport(decodeResult, airports[1]);
|
|
856
1077
|
ResultFormatter.arrivalAirport(decodeResult, airports[2]);
|
|
857
1078
|
decodeResult.raw.day = Number(airports[3]);
|
|
858
|
-
ResultFormatter.time_of_day(
|
|
1079
|
+
ResultFormatter.time_of_day(
|
|
1080
|
+
decodeResult,
|
|
1081
|
+
DateTimeUtils.convertHHMMSSToTod(airports[4])
|
|
1082
|
+
);
|
|
859
1083
|
const estimates = data[3].split(" ");
|
|
860
|
-
ResultFormatter.eta(
|
|
1084
|
+
ResultFormatter.eta(
|
|
1085
|
+
decodeResult,
|
|
1086
|
+
DateTimeUtils.convertHHMMSSToTod(estimates[1])
|
|
1087
|
+
);
|
|
861
1088
|
ResultFormatter.unknown(decodeResult, estimates[2]);
|
|
862
1089
|
} else {
|
|
863
1090
|
if (options.debug) {
|
|
@@ -880,7 +1107,6 @@ var Label_5Z_Slash = class extends DecoderPlugin {
|
|
|
880
1107
|
|
|
881
1108
|
// lib/plugins/Label_10_LDR.ts
|
|
882
1109
|
var Label_10_LDR = class extends DecoderPlugin {
|
|
883
|
-
// eslint-disable-line camelcase
|
|
884
1110
|
name = "label-10-ldr";
|
|
885
1111
|
qualifiers() {
|
|
886
1112
|
return {
|
|
@@ -919,7 +1145,10 @@ var Label_10_LDR = class extends DecoderPlugin {
|
|
|
919
1145
|
if (altRwy != "") {
|
|
920
1146
|
ResultFormatter.alternateRunway(decodeResult, altRwy);
|
|
921
1147
|
}
|
|
922
|
-
ResultFormatter.unknownArr(decodeResult, [
|
|
1148
|
+
ResultFormatter.unknownArr(decodeResult, [
|
|
1149
|
+
...parts.slice(0, 5),
|
|
1150
|
+
...parts.slice(15)
|
|
1151
|
+
]);
|
|
923
1152
|
decodeResult.decoded = true;
|
|
924
1153
|
decodeResult.decoder.decodeLevel = "partial";
|
|
925
1154
|
return decodeResult;
|
|
@@ -928,7 +1157,6 @@ var Label_10_LDR = class extends DecoderPlugin {
|
|
|
928
1157
|
|
|
929
1158
|
// lib/plugins/Label_10_POS.ts
|
|
930
1159
|
var Label_10_POS = class extends DecoderPlugin {
|
|
931
|
-
// eslint-disable-line camelcase
|
|
932
1160
|
name = "label-10-pos";
|
|
933
1161
|
qualifiers() {
|
|
934
1162
|
return {
|
|
@@ -959,7 +1187,11 @@ var Label_10_POS = class extends DecoderPlugin {
|
|
|
959
1187
|
};
|
|
960
1188
|
ResultFormatter.position(decodeResult, position);
|
|
961
1189
|
ResultFormatter.altitude(decodeResult, Number(parts[7]));
|
|
962
|
-
ResultFormatter.unknownArr(decodeResult, [
|
|
1190
|
+
ResultFormatter.unknownArr(decodeResult, [
|
|
1191
|
+
parts[0],
|
|
1192
|
+
...parts.slice(3, 7),
|
|
1193
|
+
...parts.slice(8)
|
|
1194
|
+
]);
|
|
963
1195
|
decodeResult.decoded = true;
|
|
964
1196
|
decodeResult.decoder.decodeLevel = "partial";
|
|
965
1197
|
return decodeResult;
|
|
@@ -968,7 +1200,6 @@ var Label_10_POS = class extends DecoderPlugin {
|
|
|
968
1200
|
|
|
969
1201
|
// lib/plugins/Label_10_Slash.ts
|
|
970
1202
|
var Label_10_Slash = class extends DecoderPlugin {
|
|
971
|
-
// eslint-disable-line camelcase
|
|
972
1203
|
name = "label-10-slash";
|
|
973
1204
|
qualifiers() {
|
|
974
1205
|
return {
|
|
@@ -1001,23 +1232,34 @@ var Label_10_Slash = class extends DecoderPlugin {
|
|
|
1001
1232
|
ResultFormatter.heading(decodeResult, Number(parts[5]));
|
|
1002
1233
|
ResultFormatter.altitude(decodeResult, 100 * Number(parts[6]));
|
|
1003
1234
|
ResultFormatter.arrivalAirport(decodeResult, parts[7]);
|
|
1004
|
-
ResultFormatter.eta(
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1235
|
+
ResultFormatter.eta(
|
|
1236
|
+
decodeResult,
|
|
1237
|
+
DateTimeUtils.convertHHMMSSToTod(parts[8])
|
|
1238
|
+
);
|
|
1239
|
+
const waypoints = [
|
|
1240
|
+
{
|
|
1241
|
+
name: parts[11]
|
|
1242
|
+
},
|
|
1243
|
+
{
|
|
1244
|
+
name: parts[12],
|
|
1245
|
+
time: DateTimeUtils.convertHHMMSSToTod(parts[13]),
|
|
1246
|
+
timeFormat: "tod"
|
|
1247
|
+
},
|
|
1248
|
+
{
|
|
1249
|
+
name: parts[14],
|
|
1250
|
+
time: DateTimeUtils.convertHHMMSSToTod(parts[15]),
|
|
1251
|
+
timeFormat: "tod"
|
|
1252
|
+
}
|
|
1253
|
+
];
|
|
1016
1254
|
ResultFormatter.route(decodeResult, { waypoints });
|
|
1017
1255
|
if (parts[16]) {
|
|
1018
1256
|
ResultFormatter.departureAirport(decodeResult, parts[16]);
|
|
1019
1257
|
}
|
|
1020
|
-
ResultFormatter.unknownArr(
|
|
1258
|
+
ResultFormatter.unknownArr(
|
|
1259
|
+
decodeResult,
|
|
1260
|
+
[parts[3], parts[4], ...parts.slice(9, 11), ...parts.slice(17)],
|
|
1261
|
+
"/"
|
|
1262
|
+
);
|
|
1021
1263
|
decodeResult.decoded = true;
|
|
1022
1264
|
decodeResult.decoder.decodeLevel = "partial";
|
|
1023
1265
|
return decodeResult;
|
|
@@ -1042,7 +1284,7 @@ var Label_12_N_Space = class extends DecoderPlugin {
|
|
|
1042
1284
|
let results = message.text.match(variant1Regex);
|
|
1043
1285
|
if (results?.groups) {
|
|
1044
1286
|
if (options.debug) {
|
|
1045
|
-
console.log(
|
|
1287
|
+
console.log("Label 12 N : results");
|
|
1046
1288
|
console.log(results);
|
|
1047
1289
|
}
|
|
1048
1290
|
ResultFormatter.position(decodeResult, {
|
|
@@ -1051,7 +1293,11 @@ var Label_12_N_Space = class extends DecoderPlugin {
|
|
|
1051
1293
|
});
|
|
1052
1294
|
const altitude = results.groups.alt == "GRD" || results.groups.alt == "***" ? 0 : Number(results.groups.alt);
|
|
1053
1295
|
ResultFormatter.altitude(decodeResult, altitude);
|
|
1054
|
-
ResultFormatter.unknownArr(decodeResult, [
|
|
1296
|
+
ResultFormatter.unknownArr(decodeResult, [
|
|
1297
|
+
results.groups.unkwn1,
|
|
1298
|
+
results.groups.unkwn2,
|
|
1299
|
+
results.groups.unkwn3
|
|
1300
|
+
]);
|
|
1055
1301
|
decodeResult.decoded = true;
|
|
1056
1302
|
decodeResult.decoder.decodeLevel = "partial";
|
|
1057
1303
|
return decodeResult;
|
|
@@ -1093,15 +1339,32 @@ var Label_12_POS = class extends DecoderPlugin {
|
|
|
1093
1339
|
const lat = data[0].substring(0, 8);
|
|
1094
1340
|
const lon = data[0].substring(8);
|
|
1095
1341
|
ResultFormatter.position(decodeResult, {
|
|
1096
|
-
latitude: CoordinateUtils.getDirection(lat[0]) * CoordinateUtils.dmsToDecimalDegrees(
|
|
1097
|
-
|
|
1342
|
+
latitude: CoordinateUtils.getDirection(lat[0]) * CoordinateUtils.dmsToDecimalDegrees(
|
|
1343
|
+
Number(lat.substring(1, 4)),
|
|
1344
|
+
Number(lat.substring(4, 6)),
|
|
1345
|
+
Number(lat.substring(6, 8))
|
|
1346
|
+
),
|
|
1347
|
+
longitude: CoordinateUtils.getDirection(lon[0]) * CoordinateUtils.dmsToDecimalDegrees(
|
|
1348
|
+
Number(lon.substring(1, 4)),
|
|
1349
|
+
Number(lon.substring(4, 6)),
|
|
1350
|
+
Number(lon.substring(6, 8))
|
|
1351
|
+
)
|
|
1098
1352
|
});
|
|
1099
1353
|
ResultFormatter.unknown(decodeResult, data[1]);
|
|
1100
|
-
ResultFormatter.time_of_day(
|
|
1354
|
+
ResultFormatter.time_of_day(
|
|
1355
|
+
decodeResult,
|
|
1356
|
+
DateTimeUtils.convertHHMMSSToTod(data[2])
|
|
1357
|
+
);
|
|
1101
1358
|
ResultFormatter.altitude(decodeResult, 10 * Number(data[3]));
|
|
1102
1359
|
ResultFormatter.unknownArr(decodeResult, data.slice(4, 7));
|
|
1103
|
-
ResultFormatter.currentFuel(
|
|
1104
|
-
|
|
1360
|
+
ResultFormatter.currentFuel(
|
|
1361
|
+
decodeResult,
|
|
1362
|
+
Number(data[7].substring(3).trim())
|
|
1363
|
+
);
|
|
1364
|
+
ResultFormatter.eta(
|
|
1365
|
+
decodeResult,
|
|
1366
|
+
DateTimeUtils.convertHHMMSSToTod(data[8].substring(3).trim())
|
|
1367
|
+
);
|
|
1105
1368
|
ResultFormatter.departureAirport(decodeResult, data[9]);
|
|
1106
1369
|
ResultFormatter.arrivalAirport(decodeResult, data[10]);
|
|
1107
1370
|
ResultFormatter.unknown(decodeResult, data[11]);
|
|
@@ -1113,7 +1376,6 @@ var Label_12_POS = class extends DecoderPlugin {
|
|
|
1113
1376
|
|
|
1114
1377
|
// lib/plugins/Label_13Through18_Slash.ts
|
|
1115
1378
|
var Label_13Through18_Slash = class extends DecoderPlugin {
|
|
1116
|
-
// eslint-disable-line camelcase
|
|
1117
1379
|
name = "label-13-18-slash";
|
|
1118
1380
|
qualifiers() {
|
|
1119
1381
|
return {
|
|
@@ -1160,11 +1422,22 @@ var Label_13Through18_Slash = class extends DecoderPlugin {
|
|
|
1160
1422
|
const location = lines[i].substring(5).split(",");
|
|
1161
1423
|
let position;
|
|
1162
1424
|
if (location[0].startsWith("+") || location[0].startsWith("-")) {
|
|
1163
|
-
position = {
|
|
1425
|
+
position = {
|
|
1426
|
+
latitude: Number(location[0]),
|
|
1427
|
+
longitude: Number(location[1])
|
|
1428
|
+
};
|
|
1164
1429
|
} else {
|
|
1165
1430
|
position = {
|
|
1166
|
-
latitude: CoordinateUtils.getDirection(location[0][0]) * CoordinateUtils.dmsToDecimalDegrees(
|
|
1167
|
-
|
|
1431
|
+
latitude: CoordinateUtils.getDirection(location[0][0]) * CoordinateUtils.dmsToDecimalDegrees(
|
|
1432
|
+
Number(location[0].substring(1, 3)),
|
|
1433
|
+
Number(location[0].substring(3, 5)),
|
|
1434
|
+
Number(location[0].substring(5, 7))
|
|
1435
|
+
),
|
|
1436
|
+
longitude: CoordinateUtils.getDirection(location[1][0]) * CoordinateUtils.dmsToDecimalDegrees(
|
|
1437
|
+
Number(location[1].substring(1, 4)),
|
|
1438
|
+
Number(location[1].substring(4, 6)),
|
|
1439
|
+
Number(location[1].substring(6, 8))
|
|
1440
|
+
)
|
|
1168
1441
|
};
|
|
1169
1442
|
}
|
|
1170
1443
|
ResultFormatter.position(decodeResult, position);
|
|
@@ -1215,22 +1488,38 @@ var Label_15 = class extends DecoderPlugin {
|
|
|
1215
1488
|
decodeResult.message = message;
|
|
1216
1489
|
if (message.text.startsWith("(2") && message.text.endsWith("(Z")) {
|
|
1217
1490
|
const between = message.text.substring(2, message.text.length - 2);
|
|
1218
|
-
ResultFormatter.position(
|
|
1491
|
+
ResultFormatter.position(
|
|
1492
|
+
decodeResult,
|
|
1493
|
+
CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
1494
|
+
between.substring(0, 13)
|
|
1495
|
+
)
|
|
1496
|
+
);
|
|
1219
1497
|
if (between.length === 25) {
|
|
1220
1498
|
ResultFormatter.unknown(decodeResult, between.substring(13, 19));
|
|
1221
1499
|
const alt = between.substring(19, 22);
|
|
1222
1500
|
if (alt != "---") {
|
|
1223
1501
|
ResultFormatter.altitude(decodeResult, 100 * Number(alt));
|
|
1224
1502
|
}
|
|
1225
|
-
ResultFormatter.temperature(
|
|
1503
|
+
ResultFormatter.temperature(
|
|
1504
|
+
decodeResult,
|
|
1505
|
+
between.substring(22).replaceAll(" ", "0")
|
|
1506
|
+
);
|
|
1226
1507
|
} else if (between.substring(13, 16) === "OFF") {
|
|
1227
1508
|
const ddmmyy = between.substring(16, 22);
|
|
1228
1509
|
const hhmm = between.substring(22, 26);
|
|
1229
1510
|
if (ddmmyy != "------") {
|
|
1230
1511
|
const mmddyy = ddmmyy.substring(2, 4) + ddmmyy.substring(0, 2) + ddmmyy.substring(4);
|
|
1231
|
-
ResultFormatter.off(
|
|
1512
|
+
ResultFormatter.off(
|
|
1513
|
+
decodeResult,
|
|
1514
|
+
DateTimeUtils.convertDateTimeToEpoch(hhmm + "00", mmddyy),
|
|
1515
|
+
"epoch"
|
|
1516
|
+
);
|
|
1232
1517
|
} else {
|
|
1233
|
-
ResultFormatter.off(
|
|
1518
|
+
ResultFormatter.off(
|
|
1519
|
+
decodeResult,
|
|
1520
|
+
DateTimeUtils.convertHHMMSSToTod(hhmm),
|
|
1521
|
+
"tod"
|
|
1522
|
+
);
|
|
1234
1523
|
}
|
|
1235
1524
|
ResultFormatter.unknown(decodeResult, between.substring(26));
|
|
1236
1525
|
} else {
|
|
@@ -1275,7 +1564,10 @@ var Label_15_FST = class extends DecoderPlugin {
|
|
|
1275
1564
|
const lat = Number(stringCoords.substring(1, 7)) / 1e4 * (firstChar === "S" ? -1 : 1);
|
|
1276
1565
|
const lon = Number(stringCoords.substring(8, 15)) / 1e4 * (middleChar === "W" ? -1 : 1);
|
|
1277
1566
|
ResultFormatter.position(decodeResult, { latitude: lat, longitude: lon });
|
|
1278
|
-
ResultFormatter.altitude(
|
|
1567
|
+
ResultFormatter.altitude(
|
|
1568
|
+
decodeResult,
|
|
1569
|
+
Number(stringCoords.substring(15)) * 100
|
|
1570
|
+
);
|
|
1279
1571
|
} else {
|
|
1280
1572
|
decodeResult.decoded = false;
|
|
1281
1573
|
decodeResult.decoder.decodeLevel = "none";
|
|
@@ -1371,7 +1663,7 @@ var Label_16_N_Space = class extends DecoderPlugin {
|
|
|
1371
1663
|
let results = message.text.match(variant1Regex);
|
|
1372
1664
|
if (results?.groups) {
|
|
1373
1665
|
if (options.debug) {
|
|
1374
|
-
console.log(
|
|
1666
|
+
console.log("Label 16 N : results");
|
|
1375
1667
|
console.log(results);
|
|
1376
1668
|
}
|
|
1377
1669
|
let pos = {
|
|
@@ -1381,7 +1673,10 @@ var Label_16_N_Space = class extends DecoderPlugin {
|
|
|
1381
1673
|
const altitude = results.groups.alt == "GRD" || results.groups.alt == "***" ? 0 : Number(results.groups.alt);
|
|
1382
1674
|
ResultFormatter.position(decodeResult, pos);
|
|
1383
1675
|
ResultFormatter.altitude(decodeResult, altitude);
|
|
1384
|
-
ResultFormatter.unknownArr(decodeResult, [
|
|
1676
|
+
ResultFormatter.unknownArr(decodeResult, [
|
|
1677
|
+
results.groups.unkwn1,
|
|
1678
|
+
results.groups.unkwn2
|
|
1679
|
+
]);
|
|
1385
1680
|
decodeResult.decoded = true;
|
|
1386
1681
|
decodeResult.decoder.decodeLevel = "partial";
|
|
1387
1682
|
return decodeResult;
|
|
@@ -1389,7 +1684,7 @@ var Label_16_N_Space = class extends DecoderPlugin {
|
|
|
1389
1684
|
results = message.text.match(variant2Regex);
|
|
1390
1685
|
if (results?.groups) {
|
|
1391
1686
|
if (options.debug) {
|
|
1392
|
-
console.log(
|
|
1687
|
+
console.log("Label 16 N : results");
|
|
1393
1688
|
console.log(results);
|
|
1394
1689
|
}
|
|
1395
1690
|
let pos = {
|
|
@@ -1435,17 +1730,22 @@ var Label_16_POSA1 = class extends DecoderPlugin {
|
|
|
1435
1730
|
decodeResult.decoder.decodeLevel = "none";
|
|
1436
1731
|
return decodeResult;
|
|
1437
1732
|
}
|
|
1438
|
-
ResultFormatter.position(
|
|
1733
|
+
ResultFormatter.position(
|
|
1734
|
+
decodeResult,
|
|
1735
|
+
CoordinateUtils.decodeStringCoordinates(fields[0].substring(5))
|
|
1736
|
+
);
|
|
1439
1737
|
const waypoint = fields[1].trim();
|
|
1440
1738
|
const time = DateTimeUtils.convertHHMMSSToTod(fields[2]);
|
|
1441
1739
|
ResultFormatter.altitude(decodeResult, Number(fields[3]) * 100);
|
|
1442
1740
|
const nextWaypoint = fields[4].trim();
|
|
1443
1741
|
const nextTime = DateTimeUtils.convertHHMMSSToTod(fields[5]);
|
|
1444
1742
|
ResultFormatter.unknownArr(decodeResult, fields.slice(6), ",");
|
|
1445
|
-
ResultFormatter.route(decodeResult, {
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1743
|
+
ResultFormatter.route(decodeResult, {
|
|
1744
|
+
waypoints: [
|
|
1745
|
+
{ name: waypoint, time, timeFormat: "tod" },
|
|
1746
|
+
{ name: nextWaypoint, time: nextTime, timeFormat: "tod" }
|
|
1747
|
+
]
|
|
1748
|
+
});
|
|
1449
1749
|
decodeResult.decoded = true;
|
|
1450
1750
|
decodeResult.decoder.decodeLevel = "partial";
|
|
1451
1751
|
return decodeResult;
|
|
@@ -1480,7 +1780,10 @@ var Label_16_TOD = class extends DecoderPlugin {
|
|
|
1480
1780
|
if (fields[1] !== "") {
|
|
1481
1781
|
ResultFormatter.altitude(decodeResult, Number(fields[1]));
|
|
1482
1782
|
}
|
|
1483
|
-
ResultFormatter.eta(
|
|
1783
|
+
ResultFormatter.eta(
|
|
1784
|
+
decodeResult,
|
|
1785
|
+
DateTimeUtils.convertHHMMSSToTod(fields[2])
|
|
1786
|
+
);
|
|
1484
1787
|
ResultFormatter.unknown(decodeResult, fields[3]);
|
|
1485
1788
|
const temp = fields[4].split("/");
|
|
1486
1789
|
const posFields = temp[0].split(" ");
|
|
@@ -1501,9 +1804,9 @@ var Label_16_TOD = class extends DecoderPlugin {
|
|
|
1501
1804
|
var FlightPlanUtils = class _FlightPlanUtils {
|
|
1502
1805
|
/**
|
|
1503
1806
|
* Processes flight plan data
|
|
1504
|
-
*
|
|
1807
|
+
*
|
|
1505
1808
|
* Expected format is [header, key1, val1, ... keyN, valN]
|
|
1506
|
-
*
|
|
1809
|
+
*
|
|
1507
1810
|
* @param decodeResult - results
|
|
1508
1811
|
* @param data - original message split by ':'
|
|
1509
1812
|
* @returns whether all fields were processed or not
|
|
@@ -1535,6 +1838,9 @@ var FlightPlanUtils = class _FlightPlanUtils {
|
|
|
1535
1838
|
case "F":
|
|
1536
1839
|
addRoute(decodeResult, value);
|
|
1537
1840
|
break;
|
|
1841
|
+
case "FP":
|
|
1842
|
+
ResultFormatter.flightPlan(decodeResult, value.trim());
|
|
1843
|
+
break;
|
|
1538
1844
|
case "R":
|
|
1539
1845
|
addRunway(decodeResult, value);
|
|
1540
1846
|
break;
|
|
@@ -1589,6 +1895,14 @@ var FlightPlanUtils = class _FlightPlanUtils {
|
|
|
1589
1895
|
label: "Route Status",
|
|
1590
1896
|
value: "Route Mapped"
|
|
1591
1897
|
});
|
|
1898
|
+
} else if (header.startsWith("RS")) {
|
|
1899
|
+
decodeResult.raw.route_status = "RS";
|
|
1900
|
+
decodeResult.formatted.items.push({
|
|
1901
|
+
type: "status",
|
|
1902
|
+
code: "ROUTE_STATUS",
|
|
1903
|
+
label: "Route Status",
|
|
1904
|
+
value: "Route Saved"
|
|
1905
|
+
});
|
|
1592
1906
|
} else {
|
|
1593
1907
|
decodeResult.remaining.text += header;
|
|
1594
1908
|
allKnownFields = false;
|
|
@@ -1608,7 +1922,7 @@ var FlightPlanUtils = class _FlightPlanUtils {
|
|
|
1608
1922
|
decodeResult.raw.procedures.push({ type, route });
|
|
1609
1923
|
const procedureName = type.substring(0, 1).toUpperCase() + type.slice(1);
|
|
1610
1924
|
decodeResult.formatted.items.push({
|
|
1611
|
-
type:
|
|
1925
|
+
type: "procedure",
|
|
1612
1926
|
code: "proc",
|
|
1613
1927
|
label: `${procedureName} Procedure`,
|
|
1614
1928
|
value: RouteUtils.routeToString(route)
|
|
@@ -1629,7 +1943,9 @@ function addRunway(decodeResult, value) {
|
|
|
1629
1943
|
}
|
|
1630
1944
|
function addRoute(decodeResult, value) {
|
|
1631
1945
|
const route = value.split(".");
|
|
1632
|
-
ResultFormatter.route(decodeResult, {
|
|
1946
|
+
ResultFormatter.route(decodeResult, {
|
|
1947
|
+
waypoints: route.map((leg) => RouteUtils.getWaypoint(leg))
|
|
1948
|
+
});
|
|
1633
1949
|
}
|
|
1634
1950
|
function addCompanyRoute(decodeResult, value) {
|
|
1635
1951
|
const segments = value.split(".");
|
|
@@ -1662,9 +1978,14 @@ function addCompanyRoute(decodeResult, value) {
|
|
|
1662
1978
|
// lib/utils/h1_helper.ts
|
|
1663
1979
|
var H1Helper = class _H1Helper {
|
|
1664
1980
|
static decodeH1Message(decodeResult, message) {
|
|
1665
|
-
const checksum = message.slice(-4);
|
|
1981
|
+
const checksum = parseInt(message.slice(-4), 16);
|
|
1666
1982
|
const data = message.slice(0, message.length - 4);
|
|
1667
|
-
|
|
1983
|
+
let checksumAlgorithmUsed = "";
|
|
1984
|
+
if (crc16IbmSdlcRev(data) === checksum) {
|
|
1985
|
+
checksumAlgorithmUsed = "IBM-SDLC reversed";
|
|
1986
|
+
} else if (crc16Genibus(data) === checksum) {
|
|
1987
|
+
checksumAlgorithmUsed = "GENIBUS";
|
|
1988
|
+
} else {
|
|
1668
1989
|
decodeResult.decoded = false;
|
|
1669
1990
|
decodeResult.decoder.decodeLevel = "none";
|
|
1670
1991
|
return false;
|
|
@@ -1683,15 +2004,27 @@ var H1Helper = class _H1Helper {
|
|
|
1683
2004
|
case "AF":
|
|
1684
2005
|
processAirField(decodeResult, data2.split(","));
|
|
1685
2006
|
break;
|
|
2007
|
+
case "AK":
|
|
2008
|
+
ResultFormatter.unknown(decodeResult, fields[i], "/");
|
|
2009
|
+
break;
|
|
1686
2010
|
case "CG":
|
|
1687
2011
|
processCenterOfGravity(decodeResult, data2.split(","));
|
|
1688
2012
|
break;
|
|
1689
2013
|
case "DC":
|
|
1690
2014
|
processDateCode(decodeResult, data2.split(","));
|
|
1691
2015
|
break;
|
|
2016
|
+
case "DI":
|
|
2017
|
+
ResultFormatter.unknown(decodeResult, fields[i], "/");
|
|
2018
|
+
break;
|
|
1692
2019
|
case "DT":
|
|
1693
2020
|
processDT(decodeResult, data2.split(","));
|
|
1694
2021
|
break;
|
|
2022
|
+
case "DQ":
|
|
2023
|
+
ResultFormatter.desiredAltitude(
|
|
2024
|
+
decodeResult,
|
|
2025
|
+
parseInt(data2, 10) * 100
|
|
2026
|
+
);
|
|
2027
|
+
break;
|
|
1695
2028
|
case "ET":
|
|
1696
2029
|
processETA(data2, decodeResult, fields, i);
|
|
1697
2030
|
break;
|
|
@@ -1704,6 +2037,9 @@ var H1Helper = class _H1Helper {
|
|
|
1704
2037
|
case "FX":
|
|
1705
2038
|
ResultFormatter.freetext(decodeResult, data2);
|
|
1706
2039
|
break;
|
|
2040
|
+
case "GA":
|
|
2041
|
+
ResultFormatter.groundAddress(decodeResult, data2);
|
|
2042
|
+
break;
|
|
1707
2043
|
case "ID":
|
|
1708
2044
|
processIdentification(decodeResult, data2.split(","));
|
|
1709
2045
|
break;
|
|
@@ -1720,11 +2056,21 @@ var H1Helper = class _H1Helper {
|
|
|
1720
2056
|
case "RI":
|
|
1721
2057
|
case "RM":
|
|
1722
2058
|
case "RP":
|
|
2059
|
+
case "RS":
|
|
1723
2060
|
FlightPlanUtils.processFlightPlan(decodeResult, fields[i].split(":"));
|
|
1724
2061
|
break;
|
|
2062
|
+
case "RN":
|
|
2063
|
+
ResultFormatter.routeNumber(decodeResult, data2);
|
|
2064
|
+
break;
|
|
2065
|
+
case "RW":
|
|
2066
|
+
processRunway(decodeResult, data2.split(":"));
|
|
2067
|
+
break;
|
|
1725
2068
|
case "SN":
|
|
1726
2069
|
decodeResult.raw.serial_number = data2;
|
|
1727
2070
|
break;
|
|
2071
|
+
case "SP":
|
|
2072
|
+
ResultFormatter.startPoint(decodeResult, data2);
|
|
2073
|
+
break;
|
|
1728
2074
|
case "TD":
|
|
1729
2075
|
processTimeOfDeparture(decodeResult, data2.split(","));
|
|
1730
2076
|
break;
|
|
@@ -1737,23 +2083,23 @@ var H1Helper = class _H1Helper {
|
|
|
1737
2083
|
case "WD":
|
|
1738
2084
|
processWindData(decodeResult, data2);
|
|
1739
2085
|
break;
|
|
2086
|
+
case "WQ":
|
|
2087
|
+
processWeatherQuery(decodeResult, data2.split(":"));
|
|
2088
|
+
break;
|
|
1740
2089
|
default:
|
|
1741
2090
|
ResultFormatter.unknown(decodeResult, fields[i], "/");
|
|
1742
2091
|
}
|
|
1743
2092
|
}
|
|
2093
|
+
ResultFormatter.checksumAlgorithm(decodeResult, checksumAlgorithmUsed);
|
|
1744
2094
|
ResultFormatter.checksum(decodeResult, checksum);
|
|
1745
2095
|
return true;
|
|
1746
2096
|
}
|
|
1747
2097
|
static processPS(decodeResult, data) {
|
|
1748
|
-
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
2098
|
+
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
2099
|
+
data[0]
|
|
2100
|
+
);
|
|
1749
2101
|
if (position) {
|
|
1750
|
-
|
|
1751
|
-
decodeResult.formatted.items.push({
|
|
1752
|
-
type: "aircraft_position",
|
|
1753
|
-
code: "POS",
|
|
1754
|
-
label: "Aircraft Position",
|
|
1755
|
-
value: CoordinateUtils.coordinateString(position)
|
|
1756
|
-
});
|
|
2102
|
+
ResultFormatter.position(decodeResult, position);
|
|
1757
2103
|
}
|
|
1758
2104
|
if (data.length === 9) {
|
|
1759
2105
|
processRoute(decodeResult, data[3], data[1], data[5], data[4], void 0);
|
|
@@ -1770,7 +2116,9 @@ var H1Helper = class _H1Helper {
|
|
|
1770
2116
|
}
|
|
1771
2117
|
}
|
|
1772
2118
|
static processPosition(decodeResult, data) {
|
|
1773
|
-
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
2119
|
+
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
2120
|
+
data[0]
|
|
2121
|
+
);
|
|
1774
2122
|
if (position) {
|
|
1775
2123
|
ResultFormatter.position(decodeResult, position);
|
|
1776
2124
|
}
|
|
@@ -1786,7 +2134,15 @@ var H1Helper = class _H1Helper {
|
|
|
1786
2134
|
}
|
|
1787
2135
|
}
|
|
1788
2136
|
static processTimeStamp(decodeResult, data) {
|
|
1789
|
-
|
|
2137
|
+
if (data.length > 2) {
|
|
2138
|
+
const positionData = data.slice(1);
|
|
2139
|
+
positionData[0] = positionData[0].substring(6);
|
|
2140
|
+
this.processPosition(decodeResult, positionData);
|
|
2141
|
+
}
|
|
2142
|
+
let time = DateTimeUtils.convertDateTimeToEpoch(
|
|
2143
|
+
data[0],
|
|
2144
|
+
data[1].substring(0, 6)
|
|
2145
|
+
);
|
|
1790
2146
|
if (Number.isNaN(time)) {
|
|
1791
2147
|
const date = data[1].substring(2, 4) + data[1].substring(0, 2) + data[1].substring(4, 6);
|
|
1792
2148
|
time = DateTimeUtils.convertDateTimeToEpoch(data[0], date);
|
|
@@ -1797,10 +2153,16 @@ var H1Helper = class _H1Helper {
|
|
|
1797
2153
|
function processETA(data, decodeResult, fields, i) {
|
|
1798
2154
|
if (data.length === 5) {
|
|
1799
2155
|
ResultFormatter.day(decodeResult, Number(data.substring(0, 1)));
|
|
1800
|
-
ResultFormatter.eta(
|
|
2156
|
+
ResultFormatter.eta(
|
|
2157
|
+
decodeResult,
|
|
2158
|
+
DateTimeUtils.convertHHMMSSToTod(data.substring(1))
|
|
2159
|
+
);
|
|
1801
2160
|
} else if (data.length === 6) {
|
|
1802
2161
|
ResultFormatter.day(decodeResult, Number(data.substring(0, 2)));
|
|
1803
|
-
ResultFormatter.eta(
|
|
2162
|
+
ResultFormatter.eta(
|
|
2163
|
+
decodeResult,
|
|
2164
|
+
DateTimeUtils.convertHHMMSSToTod(data.substring(2))
|
|
2165
|
+
);
|
|
1804
2166
|
} else {
|
|
1805
2167
|
ResultFormatter.unknown(decodeResult, fields[i], "/");
|
|
1806
2168
|
}
|
|
@@ -1843,26 +2205,42 @@ function processIdentification(decodeResult, data) {
|
|
|
1843
2205
|
}
|
|
1844
2206
|
}
|
|
1845
2207
|
function processDT(decodeResult, data) {
|
|
1846
|
-
if (
|
|
1847
|
-
ResultFormatter.
|
|
1848
|
-
|
|
1849
|
-
|
|
2208
|
+
if (data.length === 9) {
|
|
2209
|
+
ResultFormatter.unknown(decodeResult, data[0]);
|
|
2210
|
+
if (!decodeResult.raw.arrival_icao) {
|
|
2211
|
+
ResultFormatter.arrivalAirport(decodeResult, data[1]);
|
|
2212
|
+
}
|
|
2213
|
+
ResultFormatter.arrivalRunway(decodeResult, data[2]);
|
|
2214
|
+
ResultFormatter.currentFuel(decodeResult, parseInt(data[3], 10));
|
|
2215
|
+
ResultFormatter.eta(
|
|
2216
|
+
decodeResult,
|
|
2217
|
+
DateTimeUtils.convertHHMMSSToTod(data[4])
|
|
2218
|
+
);
|
|
2219
|
+
ResultFormatter.unknown(decodeResult, data[5]);
|
|
2220
|
+
ResultFormatter.position(
|
|
2221
|
+
decodeResult,
|
|
2222
|
+
CoordinateUtils.decodeStringCoordinates(data[6])
|
|
2223
|
+
);
|
|
2224
|
+
ResultFormatter.unknown(decodeResult, data[7]);
|
|
2225
|
+
ResultFormatter.unknown(decodeResult, data[8]);
|
|
2226
|
+
return;
|
|
1850
2227
|
}
|
|
1851
|
-
if (data.length
|
|
2228
|
+
if (data.length === 4 || data.length === 5) {
|
|
2229
|
+
if (!decodeResult.raw.arrival_icao) {
|
|
2230
|
+
ResultFormatter.arrivalAirport(decodeResult, data[0]);
|
|
2231
|
+
}
|
|
1852
2232
|
ResultFormatter.arrivalRunway(decodeResult, data[1]);
|
|
2233
|
+
ResultFormatter.currentFuel(decodeResult, parseInt(data[2], 10));
|
|
2234
|
+
ResultFormatter.eta(
|
|
2235
|
+
decodeResult,
|
|
2236
|
+
DateTimeUtils.convertHHMMSSToTod(data[3])
|
|
2237
|
+
);
|
|
2238
|
+
if (data.length > 4) {
|
|
2239
|
+
ResultFormatter.remainingFuel(decodeResult, Number(data[4]));
|
|
2240
|
+
}
|
|
2241
|
+
return;
|
|
1853
2242
|
}
|
|
1854
|
-
|
|
1855
|
-
ResultFormatter.currentFuel(decodeResult, Number(data[2]));
|
|
1856
|
-
}
|
|
1857
|
-
if (data.length > 3) {
|
|
1858
|
-
ResultFormatter.eta(decodeResult, DateTimeUtils.convertHHMMSSToTod(data[3]));
|
|
1859
|
-
}
|
|
1860
|
-
if (data.length > 4) {
|
|
1861
|
-
ResultFormatter.remainingFuel(decodeResult, Number(data[4]));
|
|
1862
|
-
}
|
|
1863
|
-
if (data.length > 5) {
|
|
1864
|
-
ResultFormatter.unknownArr(decodeResult, data);
|
|
1865
|
-
}
|
|
2243
|
+
ResultFormatter.unknownArr(decodeResult, data, ",");
|
|
1866
2244
|
}
|
|
1867
2245
|
function processLandingReport(decodeResult, data) {
|
|
1868
2246
|
if (data.length === 19) {
|
|
@@ -1895,18 +2273,30 @@ function processCenterOfGravity(decodeResult, data) {
|
|
|
1895
2273
|
ResultFormatter.unknown(decodeResult, data.join(","));
|
|
1896
2274
|
}
|
|
1897
2275
|
}
|
|
1898
|
-
function parseMessageType(decodeResult,
|
|
2276
|
+
function parseMessageType(decodeResult, messagePart) {
|
|
2277
|
+
const messageParts = messagePart.split(",");
|
|
2278
|
+
const messageType = messageParts[0];
|
|
1899
2279
|
if (messageType.startsWith("POS")) {
|
|
1900
|
-
H1Helper.processPosition(decodeResult,
|
|
2280
|
+
H1Helper.processPosition(decodeResult, messagePart.substring(3).split(","));
|
|
1901
2281
|
return processMessageType(decodeResult, "POS");
|
|
1902
|
-
} else if (messageType.length ===
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
2282
|
+
} else if (messageType.length === 6) {
|
|
2283
|
+
const part1 = processMessageType(decodeResult, messageType.substring(0, 3));
|
|
2284
|
+
const description = decodeResult.formatted.description;
|
|
2285
|
+
const part2 = processMessageType(decodeResult, messageType.substring(3, 6));
|
|
2286
|
+
decodeResult.formatted.description = description + " for " + decodeResult.formatted.description;
|
|
2287
|
+
if (messageParts.length > 1) {
|
|
2288
|
+
ResultFormatter.unknown(
|
|
2289
|
+
decodeResult,
|
|
2290
|
+
messageParts.slice(1).join(","),
|
|
2291
|
+
"/"
|
|
2292
|
+
);
|
|
1907
2293
|
}
|
|
2294
|
+
return part1 && part2;
|
|
1908
2295
|
}
|
|
1909
|
-
|
|
2296
|
+
if (messageParts.length > 1) {
|
|
2297
|
+
ResultFormatter.unknown(decodeResult, messageParts.slice(1).join(","), "/");
|
|
2298
|
+
}
|
|
2299
|
+
return processMessageType(decodeResult, messageType);
|
|
1910
2300
|
}
|
|
1911
2301
|
function processMessageType(decodeResult, type) {
|
|
1912
2302
|
if (type === "FPN") {
|
|
@@ -1914,7 +2304,9 @@ function processMessageType(decodeResult, type) {
|
|
|
1914
2304
|
} else if (type === "FTX") {
|
|
1915
2305
|
decodeResult.formatted.description = "Free Text";
|
|
1916
2306
|
} else if (type === "INI") {
|
|
1917
|
-
decodeResult.formatted.description = "
|
|
2307
|
+
decodeResult.formatted.description = "Initial Report";
|
|
2308
|
+
} else if (type === "LDI") {
|
|
2309
|
+
decodeResult.formatted.description = "Load Distribution Information";
|
|
1918
2310
|
} else if (type === "PER") {
|
|
1919
2311
|
decodeResult.formatted.description = "Performance Report";
|
|
1920
2312
|
} else if (type === "POS") {
|
|
@@ -1923,6 +2315,12 @@ function processMessageType(decodeResult, type) {
|
|
|
1923
2315
|
decodeResult.formatted.description = "Progress Report";
|
|
1924
2316
|
} else if (type === "PWI") {
|
|
1925
2317
|
decodeResult.formatted.description = "Pilot Weather Information";
|
|
2318
|
+
} else if (type === "REJ") {
|
|
2319
|
+
decodeResult.formatted.description = "Reject";
|
|
2320
|
+
} else if (type === "REQ") {
|
|
2321
|
+
decodeResult.formatted.description = "Request";
|
|
2322
|
+
} else if (type === "RES") {
|
|
2323
|
+
decodeResult.formatted.description = "Response";
|
|
1926
2324
|
} else {
|
|
1927
2325
|
decodeResult.formatted.description = "Unknown H1 Message";
|
|
1928
2326
|
return false;
|
|
@@ -1938,6 +2336,22 @@ function processDateCode(decodeResult, data) {
|
|
|
1938
2336
|
decodeResult.raw.message_timestamp = time;
|
|
1939
2337
|
}
|
|
1940
2338
|
}
|
|
2339
|
+
function processWeatherQuery(decodeResult, data) {
|
|
2340
|
+
if (data.length !== 2) {
|
|
2341
|
+
ResultFormatter.unknown(decodeResult, data.join(":"), "WQ/");
|
|
2342
|
+
return;
|
|
2343
|
+
}
|
|
2344
|
+
const alts = data[0].split(".");
|
|
2345
|
+
const route = data[1].split(".");
|
|
2346
|
+
ResultFormatter.requestedAltitudes(
|
|
2347
|
+
decodeResult,
|
|
2348
|
+
alts.map((a) => parseInt(a, 10) * 100)
|
|
2349
|
+
);
|
|
2350
|
+
const waypoints = route.map((wp) => {
|
|
2351
|
+
return { name: wp };
|
|
2352
|
+
});
|
|
2353
|
+
ResultFormatter.route(decodeResult, { waypoints });
|
|
2354
|
+
}
|
|
1941
2355
|
function processRoute(decodeResult, last, time, next, eta, then, date) {
|
|
1942
2356
|
const lastTime = date ? DateTimeUtils.convertDateTimeToEpoch(time, date) : DateTimeUtils.convertHHMMSSToTod(time);
|
|
1943
2357
|
const nextTime = date ? DateTimeUtils.convertDateTimeToEpoch(eta, date) : DateTimeUtils.convertHHMMSSToTod(eta);
|
|
@@ -1950,24 +2364,21 @@ function processRoute(decodeResult, last, time, next, eta, then, date) {
|
|
|
1950
2364
|
nextWaypoint.timeFormat = timeFormat;
|
|
1951
2365
|
const thenWaypoint = RouteUtils.getWaypoint(then || "?");
|
|
1952
2366
|
const waypoints = [lastWaypoint, nextWaypoint, thenWaypoint];
|
|
1953
|
-
|
|
1954
|
-
decodeResult.formatted.items.push({
|
|
1955
|
-
type: "aircraft_route",
|
|
1956
|
-
code: "ROUTE",
|
|
1957
|
-
label: "Aircraft Route",
|
|
1958
|
-
value: RouteUtils.routeToString(decodeResult.raw.route)
|
|
1959
|
-
});
|
|
2367
|
+
ResultFormatter.route(decodeResult, { waypoints });
|
|
1960
2368
|
}
|
|
1961
2369
|
function processWindData(decodeResult, message) {
|
|
1962
2370
|
const wind = [];
|
|
1963
2371
|
const flightLevel = Number(message.slice(0, 3));
|
|
1964
2372
|
const fields = message.slice(4).split(".");
|
|
1965
2373
|
fields.forEach((field) => {
|
|
2374
|
+
if (field.length < 4) {
|
|
2375
|
+
return;
|
|
2376
|
+
}
|
|
1966
2377
|
const data = field.split(",");
|
|
1967
2378
|
const waypoint = { name: data[0] };
|
|
1968
2379
|
const windData = data[1];
|
|
1969
|
-
const windDirection =
|
|
1970
|
-
const windSpeed =
|
|
2380
|
+
const windDirection = parseInt(windData.slice(0, 3), 10);
|
|
2381
|
+
const windSpeed = parseInt(windData.slice(3), 10);
|
|
1971
2382
|
if (data.length === 3) {
|
|
1972
2383
|
const tempData = data[2];
|
|
1973
2384
|
const tempFlightLevel = Number(tempData.slice(0, 3));
|
|
@@ -1994,7 +2405,16 @@ function processWindData(decodeResult, message) {
|
|
|
1994
2405
|
});
|
|
1995
2406
|
ResultFormatter.windData(decodeResult, wind);
|
|
1996
2407
|
}
|
|
1997
|
-
function
|
|
2408
|
+
function processRunway(decodeResult, data) {
|
|
2409
|
+
const parts = data[0].split(".");
|
|
2410
|
+
const more = parts[0].split(",");
|
|
2411
|
+
ResultFormatter.departureRunway(decodeResult, more[0]);
|
|
2412
|
+
ResultFormatter.unknownArr(decodeResult, more.slice(1), ",");
|
|
2413
|
+
ResultFormatter.unknownArr(decodeResult, parts.slice(1), ".");
|
|
2414
|
+
ResultFormatter.departureAirport(decodeResult, data[1].split(",")[0]);
|
|
2415
|
+
ResultFormatter.unknownArr(decodeResult, data[1].split(",").slice(1), ",");
|
|
2416
|
+
}
|
|
2417
|
+
function crc16IbmSdlcRev(data) {
|
|
1998
2418
|
let crc = 65535;
|
|
1999
2419
|
const bytes = Buffer.from(data, "ascii");
|
|
2000
2420
|
for (const byte of bytes) {
|
|
@@ -2012,7 +2432,23 @@ function calculateChecksum(data) {
|
|
|
2012
2432
|
const nibble2 = crc >> 8 & 15;
|
|
2013
2433
|
const nibble3 = crc >> 4 & 15;
|
|
2014
2434
|
const nibble4 = crc & 15;
|
|
2015
|
-
return
|
|
2435
|
+
return nibble4 << 12 | nibble3 << 8 | nibble2 << 4 | nibble1;
|
|
2436
|
+
}
|
|
2437
|
+
function crc16Genibus(data) {
|
|
2438
|
+
let crc = 65535;
|
|
2439
|
+
const polynomial = 4129;
|
|
2440
|
+
const bytes = Buffer.from(data, "ascii");
|
|
2441
|
+
for (const byte of bytes) {
|
|
2442
|
+
crc ^= byte << 8;
|
|
2443
|
+
for (let i = 0; i < 8; i++) {
|
|
2444
|
+
if ((crc & 32768) !== 0) {
|
|
2445
|
+
crc = (crc << 1 ^ polynomial) & 65535;
|
|
2446
|
+
} else {
|
|
2447
|
+
crc = crc << 1 & 65535;
|
|
2448
|
+
}
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
return (crc ^ 65535) & 65535;
|
|
2016
2452
|
}
|
|
2017
2453
|
|
|
2018
2454
|
// lib/plugins/Label_1J_2J_FTX.ts
|
|
@@ -2031,7 +2467,10 @@ var Label_1J_2J_FTX = class extends DecoderPlugin {
|
|
|
2031
2467
|
const parts = msg.split("/");
|
|
2032
2468
|
let decoded = false;
|
|
2033
2469
|
if (parts[0].length > 3) {
|
|
2034
|
-
decoded = H1Helper.decodeH1Message(
|
|
2470
|
+
decoded = H1Helper.decodeH1Message(
|
|
2471
|
+
decodeResult,
|
|
2472
|
+
msg.slice(parts[0].length - 3)
|
|
2473
|
+
);
|
|
2035
2474
|
decodeResult.remaining.text = parts[0].slice(0, 3) + "/" + decodeResult.remaining.text;
|
|
2036
2475
|
} else {
|
|
2037
2476
|
decoded = H1Helper.decodeH1Message(decodeResult, msg);
|
|
@@ -2067,16 +2506,26 @@ var Label_1M_Slash = class extends DecoderPlugin {
|
|
|
2067
2506
|
const results = message.text.split(/\n|\//).slice(1);
|
|
2068
2507
|
if (results) {
|
|
2069
2508
|
if (options.debug) {
|
|
2070
|
-
console.log(
|
|
2509
|
+
console.log("Label 1M ETA: results");
|
|
2071
2510
|
console.log(results);
|
|
2072
2511
|
}
|
|
2073
2512
|
decodeResult.raw.flight_number = results[0];
|
|
2074
2513
|
ResultFormatter.departureAirport(decodeResult, results[3]);
|
|
2075
2514
|
ResultFormatter.arrivalAirport(decodeResult, results[4]);
|
|
2076
2515
|
ResultFormatter.alternateAirport(decodeResult, results[5]);
|
|
2077
|
-
ResultFormatter.arrivalRunway(
|
|
2516
|
+
ResultFormatter.arrivalRunway(
|
|
2517
|
+
decodeResult,
|
|
2518
|
+
results[8].replace(results[4], "")
|
|
2519
|
+
);
|
|
2078
2520
|
const yymmdd = results[2];
|
|
2079
|
-
ResultFormatter.eta(
|
|
2521
|
+
ResultFormatter.eta(
|
|
2522
|
+
decodeResult,
|
|
2523
|
+
DateTimeUtils.convertDateTimeToEpoch(
|
|
2524
|
+
results[7] + "00",
|
|
2525
|
+
yymmdd.substring(2, 4) + yymmdd.substring(4, 6) + yymmdd.substring(0, 2)
|
|
2526
|
+
),
|
|
2527
|
+
"epoch"
|
|
2528
|
+
);
|
|
2080
2529
|
}
|
|
2081
2530
|
decodeResult.decoded = true;
|
|
2082
2531
|
decodeResult.decoder.decodeLevel = "partial";
|
|
@@ -2086,7 +2535,6 @@ var Label_1M_Slash = class extends DecoderPlugin {
|
|
|
2086
2535
|
|
|
2087
2536
|
// lib/plugins/Label_1L_3-line.ts
|
|
2088
2537
|
var Label_1L_3Line = class extends DecoderPlugin {
|
|
2089
|
-
// eslint-disable-line camelcase
|
|
2090
2538
|
name = "label-1l-3-line";
|
|
2091
2539
|
qualifiers() {
|
|
2092
2540
|
return {
|
|
@@ -2174,7 +2622,6 @@ var Label_1L_3Line = class extends DecoderPlugin {
|
|
|
2174
2622
|
|
|
2175
2623
|
// lib/plugins/Label_1L_070.ts
|
|
2176
2624
|
var Label_1L_070 = class extends DecoderPlugin {
|
|
2177
|
-
// eslint-disable-line camelcase
|
|
2178
2625
|
name = "label-1l-070";
|
|
2179
2626
|
qualifiers() {
|
|
2180
2627
|
return {
|
|
@@ -2208,8 +2655,14 @@ var Label_1L_070 = class extends DecoderPlugin {
|
|
|
2208
2655
|
}
|
|
2209
2656
|
ResultFormatter.departureAirport(decodeResult, parts[0]);
|
|
2210
2657
|
ResultFormatter.arrivalAirport(decodeResult, parts[1]);
|
|
2211
|
-
ResultFormatter.time_of_day(
|
|
2212
|
-
|
|
2658
|
+
ResultFormatter.time_of_day(
|
|
2659
|
+
decodeResult,
|
|
2660
|
+
DateTimeUtils.convertHHMMSSToTod(parts[2])
|
|
2661
|
+
);
|
|
2662
|
+
ResultFormatter.eta(
|
|
2663
|
+
decodeResult,
|
|
2664
|
+
DateTimeUtils.convertHHMMSSToTod(parts[3])
|
|
2665
|
+
);
|
|
2213
2666
|
ResultFormatter.position(decodeResult, {
|
|
2214
2667
|
latitude: CoordinateUtils.getDirection(parts[4][0]) * Number(parts[4].substring(1)),
|
|
2215
2668
|
longitude: CoordinateUtils.getDirection(parts[5][0]) * Number(parts[5].substring(1))
|
|
@@ -2223,7 +2676,6 @@ var Label_1L_070 = class extends DecoderPlugin {
|
|
|
2223
2676
|
|
|
2224
2677
|
// lib/plugins/Label_1L_660.ts
|
|
2225
2678
|
var Label_1L_660 = class extends DecoderPlugin {
|
|
2226
|
-
// eslint-disable-line camelcase
|
|
2227
2679
|
name = "label-1l-660";
|
|
2228
2680
|
qualifiers() {
|
|
2229
2681
|
return {
|
|
@@ -2255,12 +2707,17 @@ var Label_1L_660 = class extends DecoderPlugin {
|
|
|
2255
2707
|
decodeResult.decoder.decodeLevel = "none";
|
|
2256
2708
|
return decodeResult;
|
|
2257
2709
|
}
|
|
2258
|
-
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
2710
|
+
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
2711
|
+
parts[0]
|
|
2712
|
+
);
|
|
2259
2713
|
if (position) {
|
|
2260
2714
|
ResultFormatter.position(decodeResult, position);
|
|
2261
2715
|
}
|
|
2262
2716
|
const hhmmss = parts[1].substring(0, 6);
|
|
2263
|
-
ResultFormatter.time_of_day(
|
|
2717
|
+
ResultFormatter.time_of_day(
|
|
2718
|
+
decodeResult,
|
|
2719
|
+
DateTimeUtils.convertHHMMSSToTod(hhmmss)
|
|
2720
|
+
);
|
|
2264
2721
|
const fl = parts[1].substring(6, 9);
|
|
2265
2722
|
ResultFormatter.altitude(decodeResult, Number(fl) * 100);
|
|
2266
2723
|
const next = parts[1].substring(9);
|
|
@@ -2274,7 +2731,6 @@ var Label_1L_660 = class extends DecoderPlugin {
|
|
|
2274
2731
|
|
|
2275
2732
|
// lib/plugins/Label_1L_Slash.ts
|
|
2276
2733
|
var Label_1L_Slash = class extends DecoderPlugin {
|
|
2277
|
-
// eslint-disable-line camelcase
|
|
2278
2734
|
name = "label-1l-1-line";
|
|
2279
2735
|
qualifiers() {
|
|
2280
2736
|
return {
|
|
@@ -2313,7 +2769,10 @@ var Label_1L_Slash = class extends DecoderPlugin {
|
|
|
2313
2769
|
ResultFormatter.position(decodeResult, position);
|
|
2314
2770
|
const utc = data.get("UTC");
|
|
2315
2771
|
if (utc) {
|
|
2316
|
-
ResultFormatter.time_of_day(
|
|
2772
|
+
ResultFormatter.time_of_day(
|
|
2773
|
+
decodeResult,
|
|
2774
|
+
DateTimeUtils.convertHHMMSSToTod(utc)
|
|
2775
|
+
);
|
|
2317
2776
|
data.delete("UTC");
|
|
2318
2777
|
}
|
|
2319
2778
|
const alt = data.get("ALT");
|
|
@@ -2364,7 +2823,10 @@ var Label_20_POS = class extends DecoderPlugin {
|
|
|
2364
2823
|
console.log(`DEBUG: ${this.name}: Variation 1 detected`);
|
|
2365
2824
|
}
|
|
2366
2825
|
const rawCoords = fields[0];
|
|
2367
|
-
ResultFormatter.position(
|
|
2826
|
+
ResultFormatter.position(
|
|
2827
|
+
decodeResult,
|
|
2828
|
+
CoordinateUtils.decodeStringCoordinates(rawCoords)
|
|
2829
|
+
);
|
|
2368
2830
|
decodeResult.decoded = true;
|
|
2369
2831
|
decodeResult.decoder.decodeLevel = "full";
|
|
2370
2832
|
} else if (fields.length == 5) {
|
|
@@ -2379,7 +2841,9 @@ var Label_20_POS = class extends DecoderPlugin {
|
|
|
2379
2841
|
decodeResult.decoder.decodeLevel = "full";
|
|
2380
2842
|
} else {
|
|
2381
2843
|
if (options.debug) {
|
|
2382
|
-
console.log(
|
|
2844
|
+
console.log(
|
|
2845
|
+
`DEBUG: ${this.name}: Unknown variation. Field count: ${fields.length}, content: ${content}`
|
|
2846
|
+
);
|
|
2383
2847
|
}
|
|
2384
2848
|
decodeResult.decoded = false;
|
|
2385
2849
|
decodeResult.decoder.decodeLevel = "none";
|
|
@@ -2407,17 +2871,29 @@ var Label_21_POS = class extends DecoderPlugin {
|
|
|
2407
2871
|
const fields = content.split(",");
|
|
2408
2872
|
if (fields.length == 9) {
|
|
2409
2873
|
processPosition(decodeResult, fields[0].trim());
|
|
2410
|
-
ResultFormatter.time_of_day(
|
|
2874
|
+
ResultFormatter.time_of_day(
|
|
2875
|
+
decodeResult,
|
|
2876
|
+
DateTimeUtils.convertHHMMSSToTod(fields[2])
|
|
2877
|
+
);
|
|
2411
2878
|
ResultFormatter.altitude(decodeResult, Number(fields[3]));
|
|
2412
2879
|
ResultFormatter.temperature(decodeResult, fields[6].replace(/ /g, ""));
|
|
2413
|
-
ResultFormatter.eta(
|
|
2880
|
+
ResultFormatter.eta(
|
|
2881
|
+
decodeResult,
|
|
2882
|
+
DateTimeUtils.convertHHMMSSToTod(fields[7])
|
|
2883
|
+
);
|
|
2414
2884
|
ResultFormatter.arrivalAirport(decodeResult, fields[8]);
|
|
2415
|
-
ResultFormatter.unknownArr(decodeResult, [
|
|
2885
|
+
ResultFormatter.unknownArr(decodeResult, [
|
|
2886
|
+
fields[1],
|
|
2887
|
+
fields[4],
|
|
2888
|
+
fields[5]
|
|
2889
|
+
]);
|
|
2416
2890
|
decodeResult.decoded = true;
|
|
2417
2891
|
decodeResult.decoder.decodeLevel = "partial";
|
|
2418
2892
|
} else {
|
|
2419
2893
|
if (options.debug) {
|
|
2420
|
-
console.log(
|
|
2894
|
+
console.log(
|
|
2895
|
+
`DEBUG: ${this.name}: Unknown variation. Field count: ${fields.length}, content: ${content}`
|
|
2896
|
+
);
|
|
2421
2897
|
}
|
|
2422
2898
|
decodeResult.decoded = false;
|
|
2423
2899
|
decodeResult.decoder.decodeLevel = "none";
|
|
@@ -2460,12 +2936,27 @@ var Label_22_OFF = class extends DecoderPlugin {
|
|
|
2460
2936
|
return decodeResult;
|
|
2461
2937
|
}
|
|
2462
2938
|
ResultFormatter.flightNumber(decodeResult, fields[0]);
|
|
2463
|
-
ResultFormatter.departureDay(
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2939
|
+
ResultFormatter.departureDay(
|
|
2940
|
+
decodeResult,
|
|
2941
|
+
Number(fields[1].substring(0, 2))
|
|
2942
|
+
);
|
|
2943
|
+
ResultFormatter.arrivalDay(
|
|
2944
|
+
decodeResult,
|
|
2945
|
+
Number(fields[1].substring(2, 4))
|
|
2946
|
+
);
|
|
2947
|
+
ResultFormatter.time_of_day(
|
|
2948
|
+
decodeResult,
|
|
2949
|
+
DateTimeUtils.convertHHMMSSToTod(fields[1].substring(4, 8))
|
|
2950
|
+
);
|
|
2951
|
+
ResultFormatter.departureAirport(
|
|
2952
|
+
decodeResult,
|
|
2953
|
+
fields[1].substring(8, 12)
|
|
2954
|
+
);
|
|
2467
2955
|
ResultFormatter.arrivalAirport(decodeResult, fields[1].substring(12, 16));
|
|
2468
|
-
ResultFormatter.off(
|
|
2956
|
+
ResultFormatter.off(
|
|
2957
|
+
decodeResult,
|
|
2958
|
+
DateTimeUtils.convertHHMMSSToTod(fields[1].substring(16, 22))
|
|
2959
|
+
);
|
|
2469
2960
|
ResultFormatter.unknown(decodeResult, fields[1].substring(22));
|
|
2470
2961
|
decodeResult.decoded = true;
|
|
2471
2962
|
decodeResult.decoder.decodeLevel = "partial";
|
|
@@ -2478,7 +2969,10 @@ var Label_22_OFF = class extends DecoderPlugin {
|
|
|
2478
2969
|
}
|
|
2479
2970
|
ResultFormatter.departureAirport(decodeResult, fields[0]);
|
|
2480
2971
|
ResultFormatter.arrivalAirport(decodeResult, fields[1]);
|
|
2481
|
-
ResultFormatter.off(
|
|
2972
|
+
ResultFormatter.off(
|
|
2973
|
+
decodeResult,
|
|
2974
|
+
DateTimeUtils.convertHHMMSSToTod(fields[2])
|
|
2975
|
+
);
|
|
2482
2976
|
ResultFormatter.unknown(decodeResult, fields[3]);
|
|
2483
2977
|
decodeResult.decoded = true;
|
|
2484
2978
|
decodeResult.decoder.decodeLevel = "partial";
|
|
@@ -2490,17 +2984,31 @@ var Label_22_OFF = class extends DecoderPlugin {
|
|
|
2490
2984
|
return decodeResult;
|
|
2491
2985
|
}
|
|
2492
2986
|
ResultFormatter.flightNumber(decodeResult, fields[0]);
|
|
2493
|
-
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
2987
|
+
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
2988
|
+
fields[1].substring(0, 14)
|
|
2989
|
+
);
|
|
2494
2990
|
if (position) {
|
|
2495
2991
|
ResultFormatter.position(decodeResult, position);
|
|
2496
2992
|
}
|
|
2497
2993
|
ResultFormatter.day(decodeResult, Number(fields[1].substring(14, 16)));
|
|
2498
|
-
ResultFormatter.time_of_day(
|
|
2499
|
-
|
|
2994
|
+
ResultFormatter.time_of_day(
|
|
2995
|
+
decodeResult,
|
|
2996
|
+
DateTimeUtils.convertHHMMSSToTod(fields[1].substring(16, 20))
|
|
2997
|
+
);
|
|
2998
|
+
ResultFormatter.departureAirport(
|
|
2999
|
+
decodeResult,
|
|
3000
|
+
fields[1].substring(20, 24)
|
|
3001
|
+
);
|
|
2500
3002
|
ResultFormatter.arrivalAirport(decodeResult, fields[1].substring(24, 28));
|
|
2501
|
-
ResultFormatter.off(
|
|
3003
|
+
ResultFormatter.off(
|
|
3004
|
+
decodeResult,
|
|
3005
|
+
DateTimeUtils.convertHHMMSSToTod(fields[1].substring(28, 32))
|
|
3006
|
+
);
|
|
2502
3007
|
ResultFormatter.unknown(decodeResult, fields[1].substring(32, 36));
|
|
2503
|
-
ResultFormatter.eta(
|
|
3008
|
+
ResultFormatter.eta(
|
|
3009
|
+
decodeResult,
|
|
3010
|
+
DateTimeUtils.convertHHMMSSToTod(fields[1].substring(36, 40))
|
|
3011
|
+
);
|
|
2504
3012
|
decodeResult.decoded = true;
|
|
2505
3013
|
decodeResult.decoder.decodeLevel = "partial";
|
|
2506
3014
|
} else {
|
|
@@ -2531,7 +3039,9 @@ var Label_22_POS = class extends DecoderPlugin {
|
|
|
2531
3039
|
const fields = message.text.split(",");
|
|
2532
3040
|
if (fields.length !== 11) {
|
|
2533
3041
|
if (options.debug) {
|
|
2534
|
-
console.log(
|
|
3042
|
+
console.log(
|
|
3043
|
+
`DEBUG: ${this.name}: Unknown variation. Field count: ${fields.length}, content: ${fields.join(",")}`
|
|
3044
|
+
);
|
|
2535
3045
|
}
|
|
2536
3046
|
decodeResult.decoded = false;
|
|
2537
3047
|
decodeResult.decoder.decodeLevel = "none";
|
|
@@ -2545,7 +3055,10 @@ var Label_22_POS = class extends DecoderPlugin {
|
|
|
2545
3055
|
latitude: CoordinateUtils.getDirection(fields[0][0]) * lat,
|
|
2546
3056
|
longitude: CoordinateUtils.getDirection(fields[0][8]) * lon
|
|
2547
3057
|
});
|
|
2548
|
-
ResultFormatter.time_of_day(
|
|
3058
|
+
ResultFormatter.time_of_day(
|
|
3059
|
+
decodeResult,
|
|
3060
|
+
DateTimeUtils.convertHHMMSSToTod(fields[2])
|
|
3061
|
+
);
|
|
2549
3062
|
ResultFormatter.altitude(decodeResult, Number(fields[3]));
|
|
2550
3063
|
ResultFormatter.unknownArr(decodeResult, [fields[1], ...fields.slice(4)]);
|
|
2551
3064
|
decodeResult.decoded = true;
|
|
@@ -2581,11 +3094,20 @@ var Label_2P_FM3 = class extends DecoderPlugin {
|
|
|
2581
3094
|
ResultFormatter.flightNumber(decodeResult, header[0].substring(4));
|
|
2582
3095
|
}
|
|
2583
3096
|
if (header[1].length === 4) {
|
|
2584
|
-
ResultFormatter.time_of_day(
|
|
3097
|
+
ResultFormatter.time_of_day(
|
|
3098
|
+
decodeResult,
|
|
3099
|
+
DateTimeUtils.convertHHMMSSToTod(header[1])
|
|
3100
|
+
);
|
|
2585
3101
|
} else {
|
|
2586
|
-
ResultFormatter.time_of_day(
|
|
3102
|
+
ResultFormatter.time_of_day(
|
|
3103
|
+
decodeResult,
|
|
3104
|
+
DateTimeUtils.convertHHMMSSToTod(header[1])
|
|
3105
|
+
);
|
|
2587
3106
|
}
|
|
2588
|
-
ResultFormatter.eta(
|
|
3107
|
+
ResultFormatter.eta(
|
|
3108
|
+
decodeResult,
|
|
3109
|
+
DateTimeUtils.convertHHMMSSToTod(parts[1])
|
|
3110
|
+
);
|
|
2589
3111
|
const lat = parts[2].replaceAll(" ", "");
|
|
2590
3112
|
const lon = parts[3].replaceAll(" ", "");
|
|
2591
3113
|
if (lat[0] === "N" || lat[0] === "S") {
|
|
@@ -2594,7 +3116,10 @@ var Label_2P_FM3 = class extends DecoderPlugin {
|
|
|
2594
3116
|
longitude: CoordinateUtils.getDirection(lon[0]) * Number(lon.substring(1))
|
|
2595
3117
|
});
|
|
2596
3118
|
} else {
|
|
2597
|
-
ResultFormatter.position(decodeResult, {
|
|
3119
|
+
ResultFormatter.position(decodeResult, {
|
|
3120
|
+
latitude: Number(lat),
|
|
3121
|
+
longitude: Number(lon)
|
|
3122
|
+
});
|
|
2598
3123
|
}
|
|
2599
3124
|
ResultFormatter.altitude(decodeResult, Number(parts[4]));
|
|
2600
3125
|
ResultFormatter.unknown(decodeResult, parts[5]);
|
|
@@ -2642,9 +3167,18 @@ var Label_2P_FM4 = class extends DecoderPlugin {
|
|
|
2642
3167
|
ResultFormatter.departureAirport(decodeResult, header[1]);
|
|
2643
3168
|
ResultFormatter.arrivalAirport(decodeResult, parts[1]);
|
|
2644
3169
|
ResultFormatter.day(decodeResult, Number(parts[2].substring(0, 2)));
|
|
2645
|
-
ResultFormatter.time_of_day(
|
|
2646
|
-
|
|
2647
|
-
|
|
3170
|
+
ResultFormatter.time_of_day(
|
|
3171
|
+
decodeResult,
|
|
3172
|
+
DateTimeUtils.convertHHMMSSToTod(parts[2].substring(2))
|
|
3173
|
+
);
|
|
3174
|
+
ResultFormatter.eta(
|
|
3175
|
+
decodeResult,
|
|
3176
|
+
DateTimeUtils.convertHHMMSSToTod(parts[3])
|
|
3177
|
+
);
|
|
3178
|
+
ResultFormatter.position(decodeResult, {
|
|
3179
|
+
latitude: Number(parts[4].replaceAll(" ", "")),
|
|
3180
|
+
longitude: Number(parts[5].replaceAll(" ", ""))
|
|
3181
|
+
});
|
|
2648
3182
|
ResultFormatter.altitude(decodeResult, Number(parts[6]));
|
|
2649
3183
|
ResultFormatter.heading(decodeResult, Number(parts[7]));
|
|
2650
3184
|
ResultFormatter.unknown(decodeResult, parts[8]);
|
|
@@ -2687,9 +3221,18 @@ var Label_2P_FM5 = class extends DecoderPlugin {
|
|
|
2687
3221
|
}
|
|
2688
3222
|
ResultFormatter.departureAirport(decodeResult, header[1]);
|
|
2689
3223
|
ResultFormatter.arrivalAirport(decodeResult, parts[1]);
|
|
2690
|
-
ResultFormatter.time_of_day(
|
|
2691
|
-
|
|
2692
|
-
|
|
3224
|
+
ResultFormatter.time_of_day(
|
|
3225
|
+
decodeResult,
|
|
3226
|
+
DateTimeUtils.convertHHMMSSToTod(parts[2])
|
|
3227
|
+
);
|
|
3228
|
+
ResultFormatter.eta(
|
|
3229
|
+
decodeResult,
|
|
3230
|
+
DateTimeUtils.convertHHMMSSToTod(parts[3])
|
|
3231
|
+
);
|
|
3232
|
+
ResultFormatter.position(decodeResult, {
|
|
3233
|
+
latitude: Number(parts[4].replaceAll(" ", "")),
|
|
3234
|
+
longitude: Number(parts[5].replaceAll(" ", ""))
|
|
3235
|
+
});
|
|
2693
3236
|
ResultFormatter.altitude(decodeResult, Number(parts[6]));
|
|
2694
3237
|
ResultFormatter.unknown(decodeResult, parts[7]);
|
|
2695
3238
|
ResultFormatter.unknown(decodeResult, parts[8]);
|
|
@@ -2726,7 +3269,10 @@ var Label_2P_POS = class extends DecoderPlugin {
|
|
|
2726
3269
|
const parts = msg.split("/");
|
|
2727
3270
|
let decoded = false;
|
|
2728
3271
|
if (parts[0].length > 3) {
|
|
2729
|
-
decoded = H1Helper.decodeH1Message(
|
|
3272
|
+
decoded = H1Helper.decodeH1Message(
|
|
3273
|
+
decodeResult,
|
|
3274
|
+
msg.slice(parts[0].length - 3)
|
|
3275
|
+
);
|
|
2730
3276
|
decodeResult.remaining.text = parts[0].slice(0, 3) + "/" + decodeResult.remaining.text;
|
|
2731
3277
|
} else {
|
|
2732
3278
|
decoded = H1Helper.decodeH1Message(decodeResult, msg);
|
|
@@ -2763,7 +3309,10 @@ var Label_24_Slash = class extends DecoderPlugin {
|
|
|
2763
3309
|
if (fields.length == 10 && fields[0] == "" && fields[9] == "") {
|
|
2764
3310
|
const mmddyy = fields[1].substring(4, 6) + fields[1].substring(2, 4) + fields[1].substring(0, 2);
|
|
2765
3311
|
const hhmmss = fields[2] + "00";
|
|
2766
|
-
decodeResult.raw.message_timestamp = DateTimeUtils.convertDateTimeToEpoch(
|
|
3312
|
+
decodeResult.raw.message_timestamp = DateTimeUtils.convertDateTimeToEpoch(
|
|
3313
|
+
hhmmss,
|
|
3314
|
+
mmddyy
|
|
3315
|
+
);
|
|
2767
3316
|
ResultFormatter.flightNumber(decodeResult, fields[3]);
|
|
2768
3317
|
ResultFormatter.altitude(decodeResult, Number(fields[4]));
|
|
2769
3318
|
const lat = fields[5];
|
|
@@ -2773,13 +3322,18 @@ var Label_24_Slash = class extends DecoderPlugin {
|
|
|
2773
3322
|
longitude: (lon[0] === "E" ? 1 : -1) * Number(lon.substring(1))
|
|
2774
3323
|
};
|
|
2775
3324
|
ResultFormatter.position(decodeResult, position);
|
|
2776
|
-
ResultFormatter.eta(
|
|
3325
|
+
ResultFormatter.eta(
|
|
3326
|
+
decodeResult,
|
|
3327
|
+
DateTimeUtils.convertHHMMSSToTod(fields[8])
|
|
3328
|
+
);
|
|
2777
3329
|
ResultFormatter.unknown(decodeResult, fields[7]);
|
|
2778
3330
|
decodeResult.decoded = true;
|
|
2779
3331
|
decodeResult.decoder.decodeLevel = "partial";
|
|
2780
3332
|
} else {
|
|
2781
3333
|
if (options.debug) {
|
|
2782
|
-
console.log(
|
|
3334
|
+
console.log(
|
|
3335
|
+
`DEBUG: ${this.name}: Unknown variation. Field count: ${fields.length}. Message: ${message.text}`
|
|
3336
|
+
);
|
|
2783
3337
|
}
|
|
2784
3338
|
decodeResult.decoded = false;
|
|
2785
3339
|
decodeResult.decoder.decodeLevel = "none";
|
|
@@ -2805,16 +3359,22 @@ var Label_30_Slash_EA = class extends DecoderPlugin {
|
|
|
2805
3359
|
const results = message.text.split(/\n|\//).slice(1);
|
|
2806
3360
|
if (results) {
|
|
2807
3361
|
if (options.debug) {
|
|
2808
|
-
console.log(
|
|
3362
|
+
console.log("Label 30 EA: results");
|
|
2809
3363
|
console.log(results);
|
|
2810
3364
|
}
|
|
2811
3365
|
}
|
|
2812
|
-
ResultFormatter.eta(
|
|
3366
|
+
ResultFormatter.eta(
|
|
3367
|
+
decodeResult,
|
|
3368
|
+
DateTimeUtils.convertHHMMSSToTod(results[0].substr(2, 4))
|
|
3369
|
+
);
|
|
2813
3370
|
if (results[1].substring(0, 2) === "DS") {
|
|
2814
3371
|
ResultFormatter.arrivalAirport(decodeResult, results[1].substring(2, 6));
|
|
2815
3372
|
ResultFormatter.unknown(decodeResult, "/".concat(results[2]));
|
|
2816
3373
|
} else {
|
|
2817
|
-
ResultFormatter.unknown(
|
|
3374
|
+
ResultFormatter.unknown(
|
|
3375
|
+
decodeResult,
|
|
3376
|
+
"/".concat(results[1], "/", results[2])
|
|
3377
|
+
);
|
|
2818
3378
|
}
|
|
2819
3379
|
decodeResult.decoded = true;
|
|
2820
3380
|
decodeResult.decoder.decodeLevel = "partial";
|
|
@@ -2839,17 +3399,26 @@ var Label_44_ETA = class extends DecoderPlugin {
|
|
|
2839
3399
|
const data = message.text.split(",");
|
|
2840
3400
|
if (data.length >= 9) {
|
|
2841
3401
|
if (options.debug) {
|
|
2842
|
-
console.log(
|
|
3402
|
+
console.log("Label 44 ETA Report: groups");
|
|
2843
3403
|
console.log(data);
|
|
2844
3404
|
}
|
|
2845
|
-
ResultFormatter.position(
|
|
3405
|
+
ResultFormatter.position(
|
|
3406
|
+
decodeResult,
|
|
3407
|
+
CoordinateUtils.decodeStringCoordinatesDecimalMinutes(data[1])
|
|
3408
|
+
);
|
|
2846
3409
|
ResultFormatter.altitude(decodeResult, 100 * Number(data[2]));
|
|
2847
3410
|
ResultFormatter.departureAirport(decodeResult, data[3]);
|
|
2848
3411
|
ResultFormatter.arrivalAirport(decodeResult, data[4]);
|
|
2849
3412
|
ResultFormatter.month(decodeResult, Number(data[5].substring(0, 2)));
|
|
2850
3413
|
ResultFormatter.day(decodeResult, Number(data[5].substring(2, 4)));
|
|
2851
|
-
ResultFormatter.time_of_day(
|
|
2852
|
-
|
|
3414
|
+
ResultFormatter.time_of_day(
|
|
3415
|
+
decodeResult,
|
|
3416
|
+
DateTimeUtils.convertHHMMSSToTod(data[6])
|
|
3417
|
+
);
|
|
3418
|
+
ResultFormatter.eta(
|
|
3419
|
+
decodeResult,
|
|
3420
|
+
DateTimeUtils.convertHHMMSSToTod(data[7])
|
|
3421
|
+
);
|
|
2853
3422
|
const fuel = Number(data[8]);
|
|
2854
3423
|
if (!isNaN(fuel)) {
|
|
2855
3424
|
ResultFormatter.remainingFuel(decodeResult, Number(fuel));
|
|
@@ -2889,15 +3458,21 @@ var Label_44_IN = class extends DecoderPlugin {
|
|
|
2889
3458
|
const data = message.text.split(",");
|
|
2890
3459
|
if (data.length >= 7) {
|
|
2891
3460
|
if (options.debug) {
|
|
2892
|
-
console.log(
|
|
3461
|
+
console.log("Label 44 In Air Report: groups");
|
|
2893
3462
|
console.log(data);
|
|
2894
3463
|
}
|
|
2895
|
-
ResultFormatter.position(
|
|
3464
|
+
ResultFormatter.position(
|
|
3465
|
+
decodeResult,
|
|
3466
|
+
CoordinateUtils.decodeStringCoordinatesDecimalMinutes(data[1])
|
|
3467
|
+
);
|
|
2896
3468
|
ResultFormatter.departureAirport(decodeResult, data[2]);
|
|
2897
3469
|
ResultFormatter.arrivalAirport(decodeResult, data[3]);
|
|
2898
3470
|
ResultFormatter.month(decodeResult, Number(data[4].substring(0, 2)));
|
|
2899
3471
|
ResultFormatter.day(decodeResult, Number(data[4].substring(2, 4)));
|
|
2900
|
-
ResultFormatter.in(
|
|
3472
|
+
ResultFormatter.in(
|
|
3473
|
+
decodeResult,
|
|
3474
|
+
DateTimeUtils.convertHHMMSSToTod(data[5])
|
|
3475
|
+
);
|
|
2901
3476
|
const fuel = Number(data[6]);
|
|
2902
3477
|
if (!isNaN(fuel)) {
|
|
2903
3478
|
ResultFormatter.remainingFuel(decodeResult, Number(fuel));
|
|
@@ -2937,16 +3512,25 @@ var Label_44_OFF = class extends DecoderPlugin {
|
|
|
2937
3512
|
const data = message.text.split(",");
|
|
2938
3513
|
if (data.length >= 8) {
|
|
2939
3514
|
if (options.debug) {
|
|
2940
|
-
console.log(
|
|
3515
|
+
console.log("Label 44 Off Runway Report: groups");
|
|
2941
3516
|
console.log(data);
|
|
2942
3517
|
}
|
|
2943
|
-
ResultFormatter.position(
|
|
3518
|
+
ResultFormatter.position(
|
|
3519
|
+
decodeResult,
|
|
3520
|
+
CoordinateUtils.decodeStringCoordinatesDecimalMinutes(data[1])
|
|
3521
|
+
);
|
|
2944
3522
|
ResultFormatter.departureAirport(decodeResult, data[2]);
|
|
2945
3523
|
ResultFormatter.arrivalAirport(decodeResult, data[3]);
|
|
2946
3524
|
ResultFormatter.month(decodeResult, Number(data[4].substring(0, 2)));
|
|
2947
3525
|
ResultFormatter.day(decodeResult, Number(data[4].substring(2, 4)));
|
|
2948
|
-
ResultFormatter.off(
|
|
2949
|
-
|
|
3526
|
+
ResultFormatter.off(
|
|
3527
|
+
decodeResult,
|
|
3528
|
+
DateTimeUtils.convertHHMMSSToTod(data[5])
|
|
3529
|
+
);
|
|
3530
|
+
ResultFormatter.eta(
|
|
3531
|
+
decodeResult,
|
|
3532
|
+
DateTimeUtils.convertHHMMSSToTod(data[6])
|
|
3533
|
+
);
|
|
2950
3534
|
const fuel = Number(data[7]);
|
|
2951
3535
|
if (!isNaN(fuel)) {
|
|
2952
3536
|
ResultFormatter.remainingFuel(decodeResult, Number(fuel));
|
|
@@ -2986,15 +3570,21 @@ var Label_44_ON = class extends DecoderPlugin {
|
|
|
2986
3570
|
const data = message.text.split(",");
|
|
2987
3571
|
if (data.length >= 7) {
|
|
2988
3572
|
if (options.debug) {
|
|
2989
|
-
console.log(
|
|
3573
|
+
console.log("Label 44 On Runway Report: groups");
|
|
2990
3574
|
console.log(data);
|
|
2991
3575
|
}
|
|
2992
|
-
ResultFormatter.position(
|
|
3576
|
+
ResultFormatter.position(
|
|
3577
|
+
decodeResult,
|
|
3578
|
+
CoordinateUtils.decodeStringCoordinatesDecimalMinutes(data[1])
|
|
3579
|
+
);
|
|
2993
3580
|
ResultFormatter.departureAirport(decodeResult, data[2]);
|
|
2994
3581
|
ResultFormatter.arrivalAirport(decodeResult, data[3]);
|
|
2995
3582
|
ResultFormatter.month(decodeResult, Number(data[4].substring(0, 2)));
|
|
2996
3583
|
ResultFormatter.day(decodeResult, Number(data[4].substring(2, 4)));
|
|
2997
|
-
ResultFormatter.on(
|
|
3584
|
+
ResultFormatter.on(
|
|
3585
|
+
decodeResult,
|
|
3586
|
+
DateTimeUtils.convertHHMMSSToTod(data[5])
|
|
3587
|
+
);
|
|
2998
3588
|
const fuel = Number(data[6]);
|
|
2999
3589
|
if (!isNaN(fuel)) {
|
|
3000
3590
|
ResultFormatter.remainingFuel(decodeResult, Number(fuel));
|
|
@@ -3035,19 +3625,39 @@ var Label_44_POS = class extends DecoderPlugin {
|
|
|
3035
3625
|
const results = message.text.match(regex);
|
|
3036
3626
|
if (results?.groups) {
|
|
3037
3627
|
if (options.debug) {
|
|
3038
|
-
console.log(
|
|
3628
|
+
console.log("Label 44 Position Report: groups");
|
|
3039
3629
|
console.log(results.groups);
|
|
3040
3630
|
}
|
|
3041
|
-
ResultFormatter.position(
|
|
3631
|
+
ResultFormatter.position(
|
|
3632
|
+
decodeResult,
|
|
3633
|
+
CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
3634
|
+
results.groups.unsplit_coords
|
|
3635
|
+
)
|
|
3636
|
+
);
|
|
3042
3637
|
const flight_level = results.groups.flight_level_or_ground == "GRD" || results.groups.flight_level_or_ground == "***" ? 0 : Number(results.groups.flight_level_or_ground);
|
|
3043
|
-
ResultFormatter.month(
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3638
|
+
ResultFormatter.month(
|
|
3639
|
+
decodeResult,
|
|
3640
|
+
Number(results.groups.current_date.substring(0, 2))
|
|
3641
|
+
);
|
|
3642
|
+
ResultFormatter.day(
|
|
3643
|
+
decodeResult,
|
|
3644
|
+
Number(results.groups.current_date.substring(2, 4))
|
|
3645
|
+
);
|
|
3646
|
+
ResultFormatter.time_of_day(
|
|
3647
|
+
decodeResult,
|
|
3648
|
+
DateTimeUtils.convertHHMMSSToTod(results.groups.current_time + "00")
|
|
3649
|
+
);
|
|
3650
|
+
ResultFormatter.eta(
|
|
3651
|
+
decodeResult,
|
|
3652
|
+
DateTimeUtils.convertHHMMSSToTod(results.groups.eta_time + "00")
|
|
3653
|
+
);
|
|
3047
3654
|
if (results.groups.fuel_in_tons != "***" && results.groups.fuel_in_tons != "****") {
|
|
3048
3655
|
decodeResult.raw.fuel_in_tons = Number(results.groups.fuel_in_tons);
|
|
3049
3656
|
}
|
|
3050
|
-
ResultFormatter.departureAirport(
|
|
3657
|
+
ResultFormatter.departureAirport(
|
|
3658
|
+
decodeResult,
|
|
3659
|
+
results.groups.departure_icao
|
|
3660
|
+
);
|
|
3051
3661
|
ResultFormatter.arrivalAirport(decodeResult, results.groups.arrival_icao);
|
|
3052
3662
|
ResultFormatter.altitude(decodeResult, flight_level * 100);
|
|
3053
3663
|
}
|
|
@@ -3085,7 +3695,7 @@ var Label_44_Slash = class extends DecoderPlugin {
|
|
|
3085
3695
|
const data = fields[3].split(",");
|
|
3086
3696
|
if (data.length >= 6) {
|
|
3087
3697
|
if (options.debug) {
|
|
3088
|
-
console.log(
|
|
3698
|
+
console.log("Label 44 Slash: groups");
|
|
3089
3699
|
console.log(data);
|
|
3090
3700
|
}
|
|
3091
3701
|
ResultFormatter.position(decodeResult, {
|
|
@@ -3135,34 +3745,33 @@ var Label_4A = class extends DecoderPlugin {
|
|
|
3135
3745
|
decodeResult.decoder.name = this.name;
|
|
3136
3746
|
decodeResult.message = message;
|
|
3137
3747
|
decodeResult.formatted.description = "Latest New Format";
|
|
3138
|
-
let text = message.text;
|
|
3139
|
-
if (text.match(/^M\d{2}A\w{6}/)) {
|
|
3140
|
-
ResultFormatter.flightNumber(decodeResult, message.text.substring(4, 10).replace(/^([A-Z]+)0*/g, "$1"));
|
|
3141
|
-
text = text.substring(10);
|
|
3142
|
-
}
|
|
3143
3748
|
decodeResult.decoded = true;
|
|
3144
|
-
const fields = text.split(",");
|
|
3749
|
+
const fields = message.text.split(",");
|
|
3145
3750
|
if (fields.length === 11) {
|
|
3146
|
-
ResultFormatter.time_of_day(
|
|
3751
|
+
ResultFormatter.time_of_day(
|
|
3752
|
+
decodeResult,
|
|
3753
|
+
DateTimeUtils.convertHHMMSSToTod(fields[0])
|
|
3754
|
+
);
|
|
3147
3755
|
ResultFormatter.tail(decodeResult, fields[2].replace(".", ""));
|
|
3148
|
-
if (fields[3])
|
|
3149
|
-
ResultFormatter.callsign(decodeResult, fields[3]);
|
|
3756
|
+
if (fields[3]) ResultFormatter.callsign(decodeResult, fields[3]);
|
|
3150
3757
|
ResultFormatter.departureAirport(decodeResult, fields[4]);
|
|
3151
3758
|
ResultFormatter.arrivalAirport(decodeResult, fields[5]);
|
|
3152
|
-
const alt = text.substring(48, 51);
|
|
3153
|
-
if (alt !== "") {
|
|
3154
|
-
ResultFormatter.altitude(decodeResult, Number(alt) * 100);
|
|
3155
|
-
}
|
|
3156
3759
|
ResultFormatter.unknownArr(decodeResult, fields.slice(8));
|
|
3157
3760
|
} else if (fields.length === 6) {
|
|
3158
3761
|
if (fields[0].match(/^[NS]/)) {
|
|
3159
|
-
ResultFormatter.position(
|
|
3762
|
+
ResultFormatter.position(
|
|
3763
|
+
decodeResult,
|
|
3764
|
+
CoordinateUtils.decodeStringCoordinates(fields[0].substring(0, 13))
|
|
3765
|
+
);
|
|
3160
3766
|
let wp1 = {
|
|
3161
3767
|
name: fields[0].substring(13).trim(),
|
|
3162
3768
|
time: DateTimeUtils.convertHHMMSSToTod(fields[1].substring(0, 6)),
|
|
3163
3769
|
timeFormat: "tod"
|
|
3164
3770
|
};
|
|
3165
|
-
ResultFormatter.altitude(
|
|
3771
|
+
ResultFormatter.altitude(
|
|
3772
|
+
decodeResult,
|
|
3773
|
+
Number(fields[1].substring(6, 9)) * 100
|
|
3774
|
+
);
|
|
3166
3775
|
let wp2 = {
|
|
3167
3776
|
name: fields[1].substring(9).trim(),
|
|
3168
3777
|
time: DateTimeUtils.convertHHMMSSToTod(fields[2]),
|
|
@@ -3172,21 +3781,31 @@ var Label_4A = class extends DecoderPlugin {
|
|
|
3172
3781
|
ResultFormatter.temperature(decodeResult, fields[3]);
|
|
3173
3782
|
ResultFormatter.unknownArr(decodeResult, fields.slice(4));
|
|
3174
3783
|
} else {
|
|
3175
|
-
ResultFormatter.time_of_day(
|
|
3176
|
-
|
|
3784
|
+
ResultFormatter.time_of_day(
|
|
3785
|
+
decodeResult,
|
|
3786
|
+
DateTimeUtils.convertHHMMSSToTod(fields[0])
|
|
3787
|
+
);
|
|
3788
|
+
ResultFormatter.eta(
|
|
3789
|
+
decodeResult,
|
|
3790
|
+
DateTimeUtils.convertHHMMSSToTod(fields[1])
|
|
3791
|
+
);
|
|
3177
3792
|
ResultFormatter.unknown(decodeResult, fields[2]);
|
|
3178
3793
|
ResultFormatter.altitude(decodeResult, Number(fields[3]));
|
|
3179
|
-
ResultFormatter.position(
|
|
3794
|
+
ResultFormatter.position(
|
|
3795
|
+
decodeResult,
|
|
3796
|
+
CoordinateUtils.decodeStringCoordinates(
|
|
3797
|
+
(fields[4] + fields[5]).replace(/[ \.]/g, "")
|
|
3798
|
+
)
|
|
3799
|
+
);
|
|
3180
3800
|
}
|
|
3181
3801
|
} else {
|
|
3182
3802
|
decodeResult.decoded = false;
|
|
3183
|
-
ResultFormatter.unknown(decodeResult, text);
|
|
3803
|
+
ResultFormatter.unknown(decodeResult, message.text);
|
|
3184
3804
|
}
|
|
3185
3805
|
if (decodeResult.decoded) {
|
|
3186
3806
|
if (!decodeResult.remaining.text)
|
|
3187
3807
|
decodeResult.decoder.decodeLevel = "full";
|
|
3188
|
-
else
|
|
3189
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
3808
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
3190
3809
|
} else {
|
|
3191
3810
|
decodeResult.decoder.decodeLevel = "none";
|
|
3192
3811
|
}
|
|
@@ -3209,11 +3828,16 @@ var Label_4A_01 = class extends DecoderPlugin {
|
|
|
3209
3828
|
decodeResult.message = message;
|
|
3210
3829
|
decodeResult.formatted.description = "Latest New Format";
|
|
3211
3830
|
decodeResult.decoded = true;
|
|
3212
|
-
let rgx = message.text.match(
|
|
3831
|
+
let rgx = message.text.match(
|
|
3832
|
+
/^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)/
|
|
3833
|
+
);
|
|
3213
3834
|
if (rgx) {
|
|
3214
3835
|
ResultFormatter.state_change(decodeResult, rgx[1], rgx[2]);
|
|
3215
3836
|
ResultFormatter.callsign(decodeResult, rgx[3]);
|
|
3216
|
-
ResultFormatter.time_of_day(
|
|
3837
|
+
ResultFormatter.time_of_day(
|
|
3838
|
+
decodeResult,
|
|
3839
|
+
DateTimeUtils.convertHHMMSSToTod(rgx[4] + "00")
|
|
3840
|
+
);
|
|
3217
3841
|
ResultFormatter.departureAirport(decodeResult, rgx[5]);
|
|
3218
3842
|
ResultFormatter.arrivalAirport(decodeResult, rgx[6]);
|
|
3219
3843
|
ResultFormatter.altitude(decodeResult, Number(rgx[7].replace(/ /g, "")));
|
|
@@ -3226,8 +3850,7 @@ var Label_4A_01 = class extends DecoderPlugin {
|
|
|
3226
3850
|
if (decodeResult.decoded) {
|
|
3227
3851
|
if (!decodeResult.remaining.text)
|
|
3228
3852
|
decodeResult.decoder.decodeLevel = "full";
|
|
3229
|
-
else
|
|
3230
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
3853
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
3231
3854
|
} else {
|
|
3232
3855
|
decodeResult.decoder.decodeLevel = "none";
|
|
3233
3856
|
}
|
|
@@ -3251,14 +3874,16 @@ var Label_4A_DIS = class extends DecoderPlugin {
|
|
|
3251
3874
|
decodeResult.formatted.description = "Latest New Format";
|
|
3252
3875
|
decodeResult.decoded = true;
|
|
3253
3876
|
const fields = message.text.split(",");
|
|
3254
|
-
ResultFormatter.time_of_day(
|
|
3877
|
+
ResultFormatter.time_of_day(
|
|
3878
|
+
decodeResult,
|
|
3879
|
+
DateTimeUtils.convertHHMMSSToTod(fields[1].substring(2) + "00")
|
|
3880
|
+
);
|
|
3255
3881
|
ResultFormatter.callsign(decodeResult, fields[2]);
|
|
3256
3882
|
ResultFormatter.freetext(decodeResult, fields.slice(3).join(""));
|
|
3257
3883
|
if (decodeResult.decoded) {
|
|
3258
3884
|
if (!decodeResult.remaining.text)
|
|
3259
3885
|
decodeResult.decoder.decodeLevel = "full";
|
|
3260
|
-
else
|
|
3261
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
3886
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
3262
3887
|
} else {
|
|
3263
3888
|
decodeResult.decoder.decodeLevel = "none";
|
|
3264
3889
|
}
|
|
@@ -3283,8 +3908,15 @@ var Label_4A_DOOR = class extends DecoderPlugin {
|
|
|
3283
3908
|
decodeResult.decoded = true;
|
|
3284
3909
|
const fields = message.text.split(" ");
|
|
3285
3910
|
if (fields.length === 3) {
|
|
3286
|
-
ResultFormatter.door_event(
|
|
3287
|
-
|
|
3911
|
+
ResultFormatter.door_event(
|
|
3912
|
+
decodeResult,
|
|
3913
|
+
fields[0].split("/")[1],
|
|
3914
|
+
fields[1]
|
|
3915
|
+
);
|
|
3916
|
+
ResultFormatter.time_of_day(
|
|
3917
|
+
decodeResult,
|
|
3918
|
+
DateTimeUtils.convertHHMMSSToTod(fields[2] + "00")
|
|
3919
|
+
);
|
|
3288
3920
|
} else {
|
|
3289
3921
|
decodeResult.decoded = false;
|
|
3290
3922
|
ResultFormatter.unknown(decodeResult, message.text);
|
|
@@ -3292,8 +3924,7 @@ var Label_4A_DOOR = class extends DecoderPlugin {
|
|
|
3292
3924
|
if (decodeResult.decoded) {
|
|
3293
3925
|
if (!decodeResult.remaining.text)
|
|
3294
3926
|
decodeResult.decoder.decodeLevel = "full";
|
|
3295
|
-
else
|
|
3296
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
3927
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
3297
3928
|
} else {
|
|
3298
3929
|
decodeResult.decoder.decodeLevel = "none";
|
|
3299
3930
|
}
|
|
@@ -3325,8 +3956,7 @@ var Label_4A_Slash_01 = class extends DecoderPlugin {
|
|
|
3325
3956
|
if (decodeResult.decoded) {
|
|
3326
3957
|
if (!decodeResult.remaining.text)
|
|
3327
3958
|
decodeResult.decoder.decodeLevel = "full";
|
|
3328
|
-
else
|
|
3329
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
3959
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
3330
3960
|
} else {
|
|
3331
3961
|
decodeResult.decoder.decodeLevel = "none";
|
|
3332
3962
|
}
|
|
@@ -3379,24 +4009,35 @@ var Label_4N = class extends DecoderPlugin {
|
|
|
3379
4009
|
decodeResult.decoder.name = this.name;
|
|
3380
4010
|
decodeResult.message = message;
|
|
3381
4011
|
decodeResult.formatted.description = "Airline Defined";
|
|
3382
|
-
let text = message.text;
|
|
3383
|
-
if (text.match(/^M\d{2}A\w{6}/)) {
|
|
3384
|
-
ResultFormatter.flightNumber(decodeResult, message.text.substring(4, 10).replace(/^([A-Z]+)0*/g, "$1"));
|
|
3385
|
-
text = text.substring(10);
|
|
3386
|
-
}
|
|
3387
4012
|
decodeResult.decoded = true;
|
|
4013
|
+
const text = message.text;
|
|
3388
4014
|
const fields = text.split(",");
|
|
3389
4015
|
if (text.length === 51) {
|
|
3390
4016
|
decodeResult.raw.day = text.substring(0, 2);
|
|
3391
4017
|
ResultFormatter.departureAirport(decodeResult, text.substring(8, 11));
|
|
3392
4018
|
ResultFormatter.arrivalAirport(decodeResult, text.substring(13, 16));
|
|
3393
|
-
ResultFormatter.position(
|
|
3394
|
-
|
|
3395
|
-
|
|
4019
|
+
ResultFormatter.position(
|
|
4020
|
+
decodeResult,
|
|
4021
|
+
CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
4022
|
+
text.substring(30, 45).replace(/^(.)0/, "$1")
|
|
4023
|
+
)
|
|
4024
|
+
);
|
|
4025
|
+
ResultFormatter.altitude(
|
|
4026
|
+
decodeResult,
|
|
4027
|
+
Number(text.substring(48, 51)) * 100
|
|
4028
|
+
);
|
|
4029
|
+
ResultFormatter.unknownArr(
|
|
4030
|
+
decodeResult,
|
|
4031
|
+
[text.substring(2, 4), text.substring(19, 29)],
|
|
4032
|
+
" "
|
|
4033
|
+
);
|
|
3396
4034
|
} else if (fields.length === 33) {
|
|
3397
4035
|
decodeResult.raw.date = fields[3];
|
|
3398
4036
|
if (fields[1] === "B") {
|
|
3399
|
-
ResultFormatter.position(decodeResult, {
|
|
4037
|
+
ResultFormatter.position(decodeResult, {
|
|
4038
|
+
latitude: Number(fields[4]),
|
|
4039
|
+
longitude: Number(fields[5])
|
|
4040
|
+
});
|
|
3400
4041
|
ResultFormatter.altitude(decodeResult, Number(fields[6]));
|
|
3401
4042
|
}
|
|
3402
4043
|
ResultFormatter.departureAirport(decodeResult, fields[8]);
|
|
@@ -3406,8 +4047,13 @@ var Label_4N = class extends DecoderPlugin {
|
|
|
3406
4047
|
if (fields[12].length > 1) {
|
|
3407
4048
|
ResultFormatter.alternateRunway(decodeResult, fields[12].split("/")[0]);
|
|
3408
4049
|
}
|
|
3409
|
-
ResultFormatter.checksum(decodeResult, fields[32]);
|
|
3410
|
-
ResultFormatter.unknownArr(
|
|
4050
|
+
ResultFormatter.checksum(decodeResult, parseInt(fields[32], 16));
|
|
4051
|
+
ResultFormatter.unknownArr(
|
|
4052
|
+
decodeResult,
|
|
4053
|
+
[...fields.slice(1, 3), fields[7], ...fields.slice(13, 32)].filter(
|
|
4054
|
+
(f) => f != ""
|
|
4055
|
+
)
|
|
4056
|
+
);
|
|
3411
4057
|
} else {
|
|
3412
4058
|
decodeResult.decoded = false;
|
|
3413
4059
|
ResultFormatter.unknown(decodeResult, text);
|
|
@@ -3415,8 +4061,7 @@ var Label_4N = class extends DecoderPlugin {
|
|
|
3415
4061
|
if (decodeResult.decoded) {
|
|
3416
4062
|
if (!decodeResult.remaining.text)
|
|
3417
4063
|
decodeResult.decoder.decodeLevel = "full";
|
|
3418
|
-
else
|
|
3419
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
4064
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
3420
4065
|
} else {
|
|
3421
4066
|
decodeResult.decoder.decodeLevel = "none";
|
|
3422
4067
|
}
|
|
@@ -3451,9 +4096,16 @@ var Label_4T_AGFSR = class extends DecoderPlugin {
|
|
|
3451
4096
|
ResultFormatter.flightNumber(decodeResult, data[0].trim());
|
|
3452
4097
|
ResultFormatter.departureDay(decodeResult, Number(data[1]));
|
|
3453
4098
|
ResultFormatter.arrivalDay(decodeResult, Number(data[2]));
|
|
3454
|
-
ResultFormatter.departureAirport(
|
|
4099
|
+
ResultFormatter.departureAirport(
|
|
4100
|
+
decodeResult,
|
|
4101
|
+
data[3].substring(0, 3),
|
|
4102
|
+
"IATA"
|
|
4103
|
+
);
|
|
3455
4104
|
ResultFormatter.arrivalAirport(decodeResult, data[3].substring(3), "IATA");
|
|
3456
|
-
ResultFormatter.time_of_day(
|
|
4105
|
+
ResultFormatter.time_of_day(
|
|
4106
|
+
decodeResult,
|
|
4107
|
+
DateTimeUtils.convertHHMMSSToTod(data[4].substring(0, 4))
|
|
4108
|
+
);
|
|
3457
4109
|
ResultFormatter.unknown(decodeResult, data[5], "/");
|
|
3458
4110
|
const lat = data[6].substring(0, 7);
|
|
3459
4111
|
const lon = data[6].substring(7, 15);
|
|
@@ -3486,7 +4138,10 @@ var Label_58 = class extends DecoderPlugin {
|
|
|
3486
4138
|
if (data.length === 8) {
|
|
3487
4139
|
ResultFormatter.flightNumber(decodeResult, data[0]);
|
|
3488
4140
|
ResultFormatter.day(decodeResult, Number(data[1]));
|
|
3489
|
-
ResultFormatter.time_of_day(
|
|
4141
|
+
ResultFormatter.time_of_day(
|
|
4142
|
+
decodeResult,
|
|
4143
|
+
DateTimeUtils.convertHHMMSSToTod(data[2])
|
|
4144
|
+
);
|
|
3490
4145
|
const lat = data[3];
|
|
3491
4146
|
const lon = data[4];
|
|
3492
4147
|
ResultFormatter.position(decodeResult, {
|
|
@@ -3540,7 +4195,10 @@ var Label_4T_ETA = class extends DecoderPlugin {
|
|
|
3540
4195
|
const etaData = data[2].split(" ");
|
|
3541
4196
|
ResultFormatter.arrivalDay(decodeResult, Number(etaData[0]));
|
|
3542
4197
|
ResultFormatter.arrivalAirport(decodeResult, etaData[1], "IATA");
|
|
3543
|
-
ResultFormatter.eta(
|
|
4198
|
+
ResultFormatter.eta(
|
|
4199
|
+
decodeResult,
|
|
4200
|
+
DateTimeUtils.convertHHMMSSToTod(etaData[2].substring(0, 4))
|
|
4201
|
+
);
|
|
3544
4202
|
decodeResult.decoded = true;
|
|
3545
4203
|
decodeResult.decoder.decodeLevel = "full";
|
|
3546
4204
|
return decodeResult;
|
|
@@ -3572,7 +4230,10 @@ var Label_80 = class extends DecoderPlugin {
|
|
|
3572
4230
|
this.parseTags(more.trim(), decodeResult);
|
|
3573
4231
|
}
|
|
3574
4232
|
}
|
|
3575
|
-
this.parseHeader(
|
|
4233
|
+
this.parseHeader(
|
|
4234
|
+
headerParts[headerParts.length - 1].trim(),
|
|
4235
|
+
decodeResult
|
|
4236
|
+
);
|
|
3576
4237
|
for (let i = 1; i < lines.length; i++) {
|
|
3577
4238
|
const line = lines[i];
|
|
3578
4239
|
const parts = line.split("/");
|
|
@@ -3660,10 +4321,16 @@ var Label_80 = class extends DecoderPlugin {
|
|
|
3660
4321
|
case "FB":
|
|
3661
4322
|
break;
|
|
3662
4323
|
case "FOB":
|
|
3663
|
-
ResultFormatter.currentFuel(
|
|
4324
|
+
ResultFormatter.currentFuel(
|
|
4325
|
+
results,
|
|
4326
|
+
parseInt(val.replace(/\D/g, ""), 10)
|
|
4327
|
+
);
|
|
3664
4328
|
break;
|
|
3665
4329
|
case "UTC":
|
|
3666
|
-
ResultFormatter.time_of_day(
|
|
4330
|
+
ResultFormatter.time_of_day(
|
|
4331
|
+
results,
|
|
4332
|
+
DateTimeUtils.convertHHMMSSToTod(val)
|
|
4333
|
+
);
|
|
3667
4334
|
break;
|
|
3668
4335
|
case "ETA":
|
|
3669
4336
|
const hhmm = val.split(".")[0].replace(":", "");
|
|
@@ -3692,11 +4359,20 @@ var Label_80 = class extends DecoderPlugin {
|
|
|
3692
4359
|
const header = csvParts[0].trim().split(/\s+/);
|
|
3693
4360
|
ResultFormatter.unknown(results, header[0], " ");
|
|
3694
4361
|
ResultFormatter.unknown(results, header[1], " ");
|
|
3695
|
-
ResultFormatter.position(
|
|
4362
|
+
ResultFormatter.position(
|
|
4363
|
+
results,
|
|
4364
|
+
CoordinateUtils.decodeStringCoordinates(header[2])
|
|
4365
|
+
);
|
|
3696
4366
|
ResultFormatter.unknown(results, csvParts[1]);
|
|
3697
|
-
ResultFormatter.time_of_day(
|
|
4367
|
+
ResultFormatter.time_of_day(
|
|
4368
|
+
results,
|
|
4369
|
+
DateTimeUtils.convertHHMMSSToTod(csvParts[2])
|
|
4370
|
+
);
|
|
3698
4371
|
ResultFormatter.unknownArr(results, csvParts.slice(4, 6), ",");
|
|
3699
|
-
ResultFormatter.temperature(
|
|
4372
|
+
ResultFormatter.temperature(
|
|
4373
|
+
results,
|
|
4374
|
+
((csvParts[6].charAt(0) === "M" ? -1 : 1) * parseInt(csvParts[6].slice(1), 10)).toString()
|
|
4375
|
+
);
|
|
3700
4376
|
ResultFormatter.airspeed(results, parseInt(csvParts[7], 10));
|
|
3701
4377
|
ResultFormatter.currentFuel(results, parseInt(csvParts[8], 10));
|
|
3702
4378
|
}
|
|
@@ -3715,12 +4391,8 @@ var Label_83 = class extends DecoderPlugin {
|
|
|
3715
4391
|
decodeResult.decoder.name = this.name;
|
|
3716
4392
|
decodeResult.message = message;
|
|
3717
4393
|
decodeResult.formatted.description = "Airline Defined";
|
|
3718
|
-
let text = message.text;
|
|
3719
|
-
if (text.match(/^M\d{2}A\w{6}/)) {
|
|
3720
|
-
ResultFormatter.flightNumber(decodeResult, message.text.substring(4, 10).replace(/^([A-Z]+)0*/g, "$1"));
|
|
3721
|
-
text = text.substring(10);
|
|
3722
|
-
}
|
|
3723
4394
|
decodeResult.decoded = true;
|
|
4395
|
+
const text = message.text;
|
|
3724
4396
|
if (text.substring(0, 10) === "4DH3 ETAT2") {
|
|
3725
4397
|
const fields = text.split(/\s+/);
|
|
3726
4398
|
if (fields[2].length > 5) {
|
|
@@ -3731,10 +4403,15 @@ var Label_83 = class extends DecoderPlugin {
|
|
|
3731
4403
|
ResultFormatter.departureAirport(decodeResult, subfields[0]);
|
|
3732
4404
|
ResultFormatter.arrivalAirport(decodeResult, subfields[1]);
|
|
3733
4405
|
ResultFormatter.tail(decodeResult, fields[4].replace(/\./g, ""));
|
|
3734
|
-
ResultFormatter.eta(
|
|
4406
|
+
ResultFormatter.eta(
|
|
4407
|
+
decodeResult,
|
|
4408
|
+
DateTimeUtils.convertHHMMSSToTod(fields[6] + "00")
|
|
4409
|
+
);
|
|
3735
4410
|
} else if (text.substring(0, 5) === "001PR") {
|
|
3736
4411
|
decodeResult.raw.day = text.substring(5, 7);
|
|
3737
|
-
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
4412
|
+
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(
|
|
4413
|
+
text.substring(13, 28).replace(/\./g, "")
|
|
4414
|
+
);
|
|
3738
4415
|
if (position) {
|
|
3739
4416
|
ResultFormatter.position(decodeResult, position);
|
|
3740
4417
|
}
|
|
@@ -3747,27 +4424,23 @@ var Label_83 = class extends DecoderPlugin {
|
|
|
3747
4424
|
ResultFormatter.arrivalAirport(decodeResult, fields[1]);
|
|
3748
4425
|
decodeResult.raw.day = fields[2].substring(0, 2);
|
|
3749
4426
|
decodeResult.raw.time = fields[2].substring(2);
|
|
3750
|
-
ResultFormatter.position(
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
longitude: Number(fields[4].replace(/\s/g, ""))
|
|
3755
|
-
}
|
|
3756
|
-
);
|
|
4427
|
+
ResultFormatter.position(decodeResult, {
|
|
4428
|
+
latitude: Number(fields[3].replace(/\s/g, "")),
|
|
4429
|
+
longitude: Number(fields[4].replace(/\s/g, ""))
|
|
4430
|
+
});
|
|
3757
4431
|
ResultFormatter.altitude(decodeResult, Number(fields[5]));
|
|
3758
4432
|
ResultFormatter.groundspeed(decodeResult, Number(fields[6]));
|
|
3759
4433
|
ResultFormatter.heading(decodeResult, Number(fields[7]));
|
|
3760
4434
|
ResultFormatter.unknown(decodeResult, fields[8]);
|
|
3761
4435
|
} else {
|
|
3762
4436
|
decodeResult.decoded = false;
|
|
3763
|
-
ResultFormatter.unknown(decodeResult,
|
|
4437
|
+
ResultFormatter.unknown(decodeResult, text);
|
|
3764
4438
|
}
|
|
3765
4439
|
}
|
|
3766
4440
|
if (decodeResult.decoded) {
|
|
3767
4441
|
if (!decodeResult.remaining.text)
|
|
3768
4442
|
decodeResult.decoder.decodeLevel = "full";
|
|
3769
|
-
else
|
|
3770
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
4443
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
3771
4444
|
} else {
|
|
3772
4445
|
decodeResult.decoder.decodeLevel = "none";
|
|
3773
4446
|
}
|
|
@@ -3792,10 +4465,13 @@ var Label_8E = class extends DecoderPlugin {
|
|
|
3792
4465
|
const results = message.text.match(regex);
|
|
3793
4466
|
if (results?.groups) {
|
|
3794
4467
|
if (options.debug) {
|
|
3795
|
-
console.log(
|
|
4468
|
+
console.log("Label 8E ETA: groups");
|
|
3796
4469
|
console.log(results.groups);
|
|
3797
4470
|
}
|
|
3798
|
-
ResultFormatter.eta(
|
|
4471
|
+
ResultFormatter.eta(
|
|
4472
|
+
decodeResult,
|
|
4473
|
+
DateTimeUtils.convertHHMMSSToTod(results.groups.arrival_eta)
|
|
4474
|
+
);
|
|
3799
4475
|
ResultFormatter.arrivalAirport(decodeResult, results.groups.arrival_icao);
|
|
3800
4476
|
}
|
|
3801
4477
|
decodeResult.decoded = true;
|
|
@@ -3865,11 +4541,26 @@ var Label_H1 = class extends DecoderPlugin {
|
|
|
3865
4541
|
const msg = message.text.replace(/\n|\r/g, "");
|
|
3866
4542
|
const parts = msg.split("#");
|
|
3867
4543
|
let decoded = false;
|
|
3868
|
-
if (
|
|
4544
|
+
if (msg.startsWith("/")) {
|
|
4545
|
+
const headerData = msg.split(".");
|
|
4546
|
+
const decoded2 = H1Helper.decodeH1Message(
|
|
4547
|
+
decodeResult,
|
|
4548
|
+
headerData.slice(1).join(".")
|
|
4549
|
+
);
|
|
4550
|
+
if (decoded2) {
|
|
4551
|
+
decodeResult.remaining.text = headerData[0] + "." + decodeResult.remaining.text;
|
|
4552
|
+
decodeResult.decoded = decoded2;
|
|
4553
|
+
decodeResult.decoder.decodeLevel = "partial";
|
|
4554
|
+
}
|
|
4555
|
+
return decodeResult;
|
|
4556
|
+
} else if (parts.length === 1) {
|
|
3869
4557
|
decoded = H1Helper.decodeH1Message(decodeResult, msg);
|
|
3870
4558
|
} else if (parts.length == 2) {
|
|
3871
|
-
const offset = isNaN(parseInt(parts[1][1])) ? 3 : 4;
|
|
3872
|
-
decoded = H1Helper.decodeH1Message(
|
|
4559
|
+
const offset = parts[0] === "- " || isNaN(parseInt(parts[1][1])) ? 3 : 4;
|
|
4560
|
+
decoded = H1Helper.decodeH1Message(
|
|
4561
|
+
decodeResult,
|
|
4562
|
+
msg.slice(parts[0].length + offset)
|
|
4563
|
+
);
|
|
3873
4564
|
if (decoded && parts[0].length > 0) {
|
|
3874
4565
|
ResultFormatter.flightNumber(decodeResult, parts[0].substring(4));
|
|
3875
4566
|
decodeResult.remaining.text = parts[0].substring(0, 4) + "#" + parts[1].substring(0, offset - 1) + "/" + decodeResult.remaining.text;
|
|
@@ -4003,7 +4694,10 @@ var Label_H1_FLR = class extends DecoderPlugin {
|
|
|
4003
4694
|
const datetime = data.substring(0, 12);
|
|
4004
4695
|
const date = datetime.substring(4, 6) + datetime.substring(2, 4) + datetime.substring(0, 2);
|
|
4005
4696
|
ResultFormatter.unknown(decodeResult, data.substring(12), "/");
|
|
4006
|
-
decodeResult.raw.message_timestamp = DateTimeUtils.convertDateTimeToEpoch(
|
|
4697
|
+
decodeResult.raw.message_timestamp = DateTimeUtils.convertDateTimeToEpoch(
|
|
4698
|
+
datetime.substring(6),
|
|
4699
|
+
date
|
|
4700
|
+
);
|
|
4007
4701
|
decodeResult.raw.fault_message = msg;
|
|
4008
4702
|
decodeResult.formatted.items.push({
|
|
4009
4703
|
type: "fault",
|
|
@@ -4083,64 +4777,65 @@ var Label_H1_OHMA = class extends DecoderPlugin {
|
|
|
4083
4777
|
}
|
|
4084
4778
|
};
|
|
4085
4779
|
|
|
4086
|
-
// lib/plugins/
|
|
4087
|
-
var
|
|
4088
|
-
name = "label-h1-
|
|
4780
|
+
// lib/plugins/Label_H1_Paren.ts
|
|
4781
|
+
var Label_H1_Paren = class extends DecoderPlugin {
|
|
4782
|
+
name = "label-h1-paren";
|
|
4089
4783
|
qualifiers() {
|
|
4090
4784
|
return {
|
|
4091
4785
|
labels: ["H1"],
|
|
4092
|
-
preambles: ["
|
|
4786
|
+
preambles: ["("]
|
|
4093
4787
|
};
|
|
4094
4788
|
}
|
|
4095
|
-
decode(message
|
|
4789
|
+
decode(message) {
|
|
4096
4790
|
let decodeResult = this.defaultResult();
|
|
4097
4791
|
decodeResult.decoder.name = this.name;
|
|
4098
|
-
decodeResult.formatted.description = "Position Report";
|
|
4099
4792
|
decodeResult.message = message;
|
|
4100
|
-
|
|
4101
|
-
const data = message.text.slice(0, message.text.length - 4);
|
|
4102
|
-
const fields = data.split("/");
|
|
4103
|
-
if (fields[0] !== "") {
|
|
4104
|
-
ResultFormatter.unknown(decodeResult, message.text);
|
|
4793
|
+
if (!message.text || !message.text.startsWith("(")) {
|
|
4105
4794
|
decodeResult.decoded = false;
|
|
4106
|
-
decodeResult.decoder.decodeLevel = "none";
|
|
4107
4795
|
return decodeResult;
|
|
4108
4796
|
}
|
|
4109
|
-
const
|
|
4110
|
-
|
|
4111
|
-
if (
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
console.log(`Decoder: Unknown H1 message: ${message.text}`);
|
|
4132
|
-
}
|
|
4133
|
-
ResultFormatter.unknown(decodeResult, message.text);
|
|
4134
|
-
decodeResult.decoded = false;
|
|
4135
|
-
decodeResult.decoder.decodeLevel = "none";
|
|
4136
|
-
return decodeResult;
|
|
4797
|
+
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})\)/;
|
|
4798
|
+
const match = message.text.match(regex);
|
|
4799
|
+
if (match && match.groups) {
|
|
4800
|
+
decodeResult.decoded = true;
|
|
4801
|
+
decodeResult.decoder.decodeLevel = "partial";
|
|
4802
|
+
decodeResult.formatted.description = "Position Report";
|
|
4803
|
+
ResultFormatter.flightNumber(decodeResult, match.groups.flight);
|
|
4804
|
+
ResultFormatter.position(decodeResult, {
|
|
4805
|
+
latitude: parseLat(match.groups.lat),
|
|
4806
|
+
longitude: parseLon(match.groups.lon)
|
|
4807
|
+
});
|
|
4808
|
+
ResultFormatter.time_of_day(
|
|
4809
|
+
decodeResult,
|
|
4810
|
+
DateTimeUtils.convertHHMMSSToTod(match.groups.timestamp)
|
|
4811
|
+
);
|
|
4812
|
+
ResultFormatter.altitude(
|
|
4813
|
+
decodeResult,
|
|
4814
|
+
parseInt(match.groups.alt, 10) * 100
|
|
4815
|
+
);
|
|
4816
|
+
ResultFormatter.currentFuel(decodeResult, parseFloat(match.groups.fuel));
|
|
4817
|
+
ResultFormatter.mach(decodeResult, parseFloat(match.groups.mach));
|
|
4818
|
+
ResultFormatter.unknown(decodeResult, "RMK");
|
|
4137
4819
|
}
|
|
4138
|
-
ResultFormatter.checksum(decodeResult, checksum);
|
|
4139
|
-
decodeResult.decoded = true;
|
|
4140
|
-
decodeResult.decoder.decodeLevel = !decodeResult.remaining.text ? "full" : "partial";
|
|
4141
4820
|
return decodeResult;
|
|
4142
4821
|
}
|
|
4143
4822
|
};
|
|
4823
|
+
function parseLat(latStr) {
|
|
4824
|
+
const match = latStr.match(/(-?)(\d{2})(\d{2})([NS])/);
|
|
4825
|
+
if (!match) return NaN;
|
|
4826
|
+
let deg = parseInt(match[2]);
|
|
4827
|
+
let min = parseInt(match[3]);
|
|
4828
|
+
let sign = match[4] === "S" ? -1 : 1;
|
|
4829
|
+
return sign * (deg + min / 60);
|
|
4830
|
+
}
|
|
4831
|
+
function parseLon(lonStr) {
|
|
4832
|
+
const match = lonStr.match(/(\d{3})(\d{2})([EW])/);
|
|
4833
|
+
if (!match) return NaN;
|
|
4834
|
+
let deg = parseInt(match[1]);
|
|
4835
|
+
let min = parseInt(match[2]);
|
|
4836
|
+
let sign = match[3] === "W" ? -1 : 1;
|
|
4837
|
+
return sign * (deg + min / 60);
|
|
4838
|
+
}
|
|
4144
4839
|
|
|
4145
4840
|
// lib/plugins/Label_H1_StarPOS.ts
|
|
4146
4841
|
var Label_H1_StarPOS = class extends DecoderPlugin {
|
|
@@ -4168,7 +4863,10 @@ var Label_H1_StarPOS = class extends DecoderPlugin {
|
|
|
4168
4863
|
}
|
|
4169
4864
|
ResultFormatter.month(decodeResult, Number(msg.substring(4, 6)));
|
|
4170
4865
|
ResultFormatter.day(decodeResult, Number(msg.substring(6, 8)));
|
|
4171
|
-
ResultFormatter.time_of_day(
|
|
4866
|
+
ResultFormatter.time_of_day(
|
|
4867
|
+
decodeResult,
|
|
4868
|
+
DateTimeUtils.convertHHMMSSToTod(msg.substring(8, 12))
|
|
4869
|
+
);
|
|
4172
4870
|
ResultFormatter.position(decodeResult, {
|
|
4173
4871
|
// Deg Min, no sec
|
|
4174
4872
|
latitude: CoordinateUtils.getDirection(msg.substring(12, 13)) * (Number(msg.substring(13, 15)) + Number(msg.substring(15, 17)) / 60),
|
|
@@ -4205,7 +4903,10 @@ var Label_H1_WRN = class extends DecoderPlugin {
|
|
|
4205
4903
|
const datetime = data.substring(0, 12);
|
|
4206
4904
|
const date = datetime.substring(4, 6) + datetime.substring(2, 4) + datetime.substring(0, 2);
|
|
4207
4905
|
ResultFormatter.unknown(decodeResult, data.substring(12), "/");
|
|
4208
|
-
decodeResult.raw.message_timestamp = DateTimeUtils.convertDateTimeToEpoch(
|
|
4906
|
+
decodeResult.raw.message_timestamp = DateTimeUtils.convertDateTimeToEpoch(
|
|
4907
|
+
datetime.substring(6),
|
|
4908
|
+
date
|
|
4909
|
+
);
|
|
4209
4910
|
decodeResult.raw.warning_message = msg;
|
|
4210
4911
|
decodeResult.formatted.items.push({
|
|
4211
4912
|
type: "warning",
|
|
@@ -4265,8 +4966,7 @@ var Label_HX = class extends DecoderPlugin {
|
|
|
4265
4966
|
if (decodeResult.decoded) {
|
|
4266
4967
|
if (!decodeResult.remaining.text)
|
|
4267
4968
|
decodeResult.decoder.decodeLevel = "full";
|
|
4268
|
-
else
|
|
4269
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
4969
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
4270
4970
|
} else {
|
|
4271
4971
|
decodeResult.decoder.decodeLevel = "none";
|
|
4272
4972
|
}
|
|
@@ -4398,10 +5098,16 @@ var MIAMCoreUtils = class {
|
|
|
4398
5098
|
}
|
|
4399
5099
|
},
|
|
4400
5100
|
["F" /* FileTransferRequest */]: () => {
|
|
4401
|
-
return {
|
|
5101
|
+
return {
|
|
5102
|
+
decoded: false,
|
|
5103
|
+
error: "File Transfer Request not implemented"
|
|
5104
|
+
};
|
|
4402
5105
|
},
|
|
4403
5106
|
["K" /* FileTransferAccept */]: () => {
|
|
4404
|
-
return {
|
|
5107
|
+
return {
|
|
5108
|
+
decoded: false,
|
|
5109
|
+
error: "File Transfer Accept not implemented"
|
|
5110
|
+
};
|
|
4405
5111
|
},
|
|
4406
5112
|
["S" /* FileSegment */]: () => {
|
|
4407
5113
|
return { decoded: false, error: "File Segment not implemented" };
|
|
@@ -4983,7 +5689,9 @@ var MIAMCoreUtils = class {
|
|
|
4983
5689
|
const msgSize = hdr.length + (body === void 0 ? 0 : body.length);
|
|
4984
5690
|
if (pduSize > msgSize) {
|
|
4985
5691
|
pduIsComplete = false;
|
|
4986
|
-
pduErrors.push(
|
|
5692
|
+
pduErrors.push(
|
|
5693
|
+
"v1 PDU truncated: expecting " + pduSize + ", got " + msgSize
|
|
5694
|
+
);
|
|
4987
5695
|
}
|
|
4988
5696
|
hdr = hdr.subarray(4);
|
|
4989
5697
|
tail = hdr.subarray(0, 7).toString("ascii");
|
|
@@ -5031,7 +5739,9 @@ var MIAMCoreUtils = class {
|
|
|
5031
5739
|
}
|
|
5032
5740
|
hdr = hdr.subarray(crcLen);
|
|
5033
5741
|
if (body !== void 0 && body.length > 0) {
|
|
5034
|
-
if ([1 /* Deflate */, 1 /* Deflate */].indexOf(
|
|
5742
|
+
if ([1 /* Deflate */, 1 /* Deflate */].indexOf(
|
|
5743
|
+
pduCompression
|
|
5744
|
+
) >= 0) {
|
|
5035
5745
|
try {
|
|
5036
5746
|
const decompress = new zlib2.InflateRaw({});
|
|
5037
5747
|
decompress.write(body);
|
|
@@ -5040,10 +5750,14 @@ var MIAMCoreUtils = class {
|
|
|
5040
5750
|
} catch (e) {
|
|
5041
5751
|
pduErrors.push("Inflation failed for body: " + e);
|
|
5042
5752
|
}
|
|
5043
|
-
} else if ([0 /* None */, 0 /* None */].indexOf(
|
|
5753
|
+
} else if ([0 /* None */, 0 /* None */].indexOf(
|
|
5754
|
+
pduCompression
|
|
5755
|
+
) >= 0) {
|
|
5044
5756
|
pduData = body;
|
|
5045
5757
|
} else {
|
|
5046
|
-
pduErrors.push(
|
|
5758
|
+
pduErrors.push(
|
|
5759
|
+
"Unsupported v" + version + " compression type: " + pduCompression
|
|
5760
|
+
);
|
|
5047
5761
|
}
|
|
5048
5762
|
if (pduData !== null) {
|
|
5049
5763
|
const crcAlgoHandlerByVersion = {
|
|
@@ -5063,7 +5777,9 @@ var MIAMCoreUtils = class {
|
|
|
5063
5777
|
if (crcCheck === pduCrc) {
|
|
5064
5778
|
pduCrcIsOk = true;
|
|
5065
5779
|
} else {
|
|
5066
|
-
pduErrors.push(
|
|
5780
|
+
pduErrors.push(
|
|
5781
|
+
"Body failed CRC check: provided=" + pduCrc + ", generated=" + crcCheck
|
|
5782
|
+
);
|
|
5067
5783
|
}
|
|
5068
5784
|
}
|
|
5069
5785
|
} else {
|
|
@@ -5106,7 +5822,13 @@ var MIAMCoreUtils = class {
|
|
|
5106
5822
|
static VersionPduHandlerTable = {
|
|
5107
5823
|
[1 /* V1 */]: {
|
|
5108
5824
|
[0 /* Data */]: (hdr, body) => {
|
|
5109
|
-
return this.corePduDataHandler(
|
|
5825
|
+
return this.corePduDataHandler(
|
|
5826
|
+
1 /* V1 */,
|
|
5827
|
+
20,
|
|
5828
|
+
MIAMCoreV1CRCLength,
|
|
5829
|
+
hdr,
|
|
5830
|
+
body
|
|
5831
|
+
);
|
|
5110
5832
|
},
|
|
5111
5833
|
[1 /* Ack */]: () => {
|
|
5112
5834
|
return { decoded: false, error: "v1 Ack PDU not implemented" };
|
|
@@ -5120,7 +5842,13 @@ var MIAMCoreUtils = class {
|
|
|
5120
5842
|
},
|
|
5121
5843
|
[2 /* V2 */]: {
|
|
5122
5844
|
[0 /* Data */]: (hdr, body) => {
|
|
5123
|
-
return this.corePduDataHandler(
|
|
5845
|
+
return this.corePduDataHandler(
|
|
5846
|
+
2 /* V2 */,
|
|
5847
|
+
7,
|
|
5848
|
+
MIAMCoreV2CRCLength,
|
|
5849
|
+
hdr,
|
|
5850
|
+
body
|
|
5851
|
+
);
|
|
5124
5852
|
},
|
|
5125
5853
|
[1 /* Ack */]: () => {
|
|
5126
5854
|
return { decoded: false, error: "v2 Ack PDU not implemented" };
|
|
@@ -5152,28 +5880,39 @@ var Label_MA = class extends DecoderPlugin {
|
|
|
5152
5880
|
decodeResult.decoded = true;
|
|
5153
5881
|
ResultFormatter.label(decodeResult, miamResult.message.data.acars.label);
|
|
5154
5882
|
if (miamResult.message.data.acars.sublabel) {
|
|
5155
|
-
ResultFormatter.sublabel(
|
|
5883
|
+
ResultFormatter.sublabel(
|
|
5884
|
+
decodeResult,
|
|
5885
|
+
miamResult.message.data.acars.sublabel
|
|
5886
|
+
);
|
|
5156
5887
|
}
|
|
5157
5888
|
if (miamResult.message.data.acars.tail) {
|
|
5158
|
-
ResultFormatter.tail(
|
|
5889
|
+
ResultFormatter.tail(
|
|
5890
|
+
decodeResult,
|
|
5891
|
+
miamResult.message.data.acars.tail.replace(".", "")
|
|
5892
|
+
);
|
|
5159
5893
|
}
|
|
5160
5894
|
const messageText = miamResult.message.data.acars.text;
|
|
5161
5895
|
if (miamResult.message.data.crcOk && miamResult.message.data.complete && messageText) {
|
|
5162
5896
|
decodeResult.decoder.decodeLevel = "full";
|
|
5163
|
-
const decoded = this.decoder.decode(
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5897
|
+
const decoded = this.decoder.decode(
|
|
5898
|
+
{
|
|
5899
|
+
label: miamResult.message.data.acars.label,
|
|
5900
|
+
sublabel: miamResult.message.data.acars.sublabel,
|
|
5901
|
+
text: messageText
|
|
5902
|
+
},
|
|
5903
|
+
options
|
|
5904
|
+
);
|
|
5168
5905
|
if (decoded.decoded) {
|
|
5169
5906
|
decodeResult.raw = { ...decodeResult.raw, ...decoded.raw };
|
|
5170
5907
|
decodeResult.formatted.items.push(...decoded.formatted.items);
|
|
5908
|
+
decodeResult.remaining = decoded.remaining;
|
|
5171
5909
|
} else {
|
|
5172
5910
|
ResultFormatter.text(decodeResult, messageText);
|
|
5911
|
+
decodeResult.remaining = { text: messageText };
|
|
5173
5912
|
}
|
|
5174
5913
|
} else if (messageText) {
|
|
5175
5914
|
decodeResult.decoder.decodeLevel = "partial";
|
|
5176
|
-
|
|
5915
|
+
decodeResult.remaining = { text: messageText };
|
|
5177
5916
|
} else {
|
|
5178
5917
|
decodeResult.decoder.decodeLevel = "partial";
|
|
5179
5918
|
}
|
|
@@ -5301,15 +6040,19 @@ var Label_QR = class extends DecoderPlugin {
|
|
|
5301
6040
|
const decodeResult = this.defaultResult();
|
|
5302
6041
|
decodeResult.decoder.name = this.name;
|
|
5303
6042
|
decodeResult.formatted.description = "ON Report";
|
|
5304
|
-
ResultFormatter.departureAirport(
|
|
6043
|
+
ResultFormatter.departureAirport(
|
|
6044
|
+
decodeResult,
|
|
6045
|
+
message.text.substring(0, 4)
|
|
6046
|
+
);
|
|
5305
6047
|
ResultFormatter.arrivalAirport(decodeResult, message.text.substring(4, 8));
|
|
5306
|
-
ResultFormatter.on(
|
|
6048
|
+
ResultFormatter.on(
|
|
6049
|
+
decodeResult,
|
|
6050
|
+
DateTimeUtils.convertHHMMSSToTod(message.text.substring(8, 12))
|
|
6051
|
+
);
|
|
5307
6052
|
ResultFormatter.unknown(decodeResult, message.text.substring(12));
|
|
5308
6053
|
decodeResult.decoded = true;
|
|
5309
|
-
if (!decodeResult.remaining.text)
|
|
5310
|
-
|
|
5311
|
-
else
|
|
5312
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
6054
|
+
if (!decodeResult.remaining.text) decodeResult.decoder.decodeLevel = "full";
|
|
6055
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
5313
6056
|
return decodeResult;
|
|
5314
6057
|
}
|
|
5315
6058
|
};
|
|
@@ -5326,15 +6069,19 @@ var Label_QP = class extends DecoderPlugin {
|
|
|
5326
6069
|
const decodeResult = this.defaultResult();
|
|
5327
6070
|
decodeResult.decoder.name = this.name;
|
|
5328
6071
|
decodeResult.formatted.description = "OUT Report";
|
|
5329
|
-
ResultFormatter.departureAirport(
|
|
6072
|
+
ResultFormatter.departureAirport(
|
|
6073
|
+
decodeResult,
|
|
6074
|
+
message.text.substring(0, 4)
|
|
6075
|
+
);
|
|
5330
6076
|
ResultFormatter.arrivalAirport(decodeResult, message.text.substring(4, 8));
|
|
5331
|
-
ResultFormatter.out(
|
|
6077
|
+
ResultFormatter.out(
|
|
6078
|
+
decodeResult,
|
|
6079
|
+
DateTimeUtils.convertHHMMSSToTod(message.text.substring(8, 12))
|
|
6080
|
+
);
|
|
5332
6081
|
ResultFormatter.unknown(decodeResult, message.text.substring(12));
|
|
5333
6082
|
decodeResult.decoded = true;
|
|
5334
|
-
if (!decodeResult.remaining.text)
|
|
5335
|
-
|
|
5336
|
-
else
|
|
5337
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
6083
|
+
if (!decodeResult.remaining.text) decodeResult.decoder.decodeLevel = "full";
|
|
6084
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
5338
6085
|
return decodeResult;
|
|
5339
6086
|
}
|
|
5340
6087
|
};
|
|
@@ -5351,15 +6098,19 @@ var Label_QS = class extends DecoderPlugin {
|
|
|
5351
6098
|
const decodeResult = this.defaultResult();
|
|
5352
6099
|
decodeResult.decoder.name = this.name;
|
|
5353
6100
|
decodeResult.formatted.description = "IN Report";
|
|
5354
|
-
ResultFormatter.departureAirport(
|
|
6101
|
+
ResultFormatter.departureAirport(
|
|
6102
|
+
decodeResult,
|
|
6103
|
+
message.text.substring(0, 4)
|
|
6104
|
+
);
|
|
5355
6105
|
ResultFormatter.arrivalAirport(decodeResult, message.text.substring(4, 8));
|
|
5356
|
-
ResultFormatter.in(
|
|
6106
|
+
ResultFormatter.in(
|
|
6107
|
+
decodeResult,
|
|
6108
|
+
DateTimeUtils.convertHHMMSSToTod(message.text.substring(8, 12))
|
|
6109
|
+
);
|
|
5357
6110
|
ResultFormatter.unknown(decodeResult, message.text.substring(12));
|
|
5358
6111
|
decodeResult.decoded = true;
|
|
5359
|
-
if (!decodeResult.remaining.text)
|
|
5360
|
-
|
|
5361
|
-
else
|
|
5362
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
6112
|
+
if (!decodeResult.remaining.text) decodeResult.decoder.decodeLevel = "full";
|
|
6113
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
5363
6114
|
return decodeResult;
|
|
5364
6115
|
}
|
|
5365
6116
|
};
|
|
@@ -5377,11 +6128,17 @@ var Label_QQ = class extends DecoderPlugin {
|
|
|
5377
6128
|
decodeResult.decoder.name = this.name;
|
|
5378
6129
|
decodeResult.message = message;
|
|
5379
6130
|
decodeResult.formatted.description = "OFF Report";
|
|
5380
|
-
ResultFormatter.departureAirport(
|
|
6131
|
+
ResultFormatter.departureAirport(
|
|
6132
|
+
decodeResult,
|
|
6133
|
+
message.text.substring(0, 4)
|
|
6134
|
+
);
|
|
5381
6135
|
ResultFormatter.arrivalAirport(decodeResult, message.text.substring(4, 8));
|
|
5382
6136
|
if (message.text.substring(12, 19) === "\r\n001FE") {
|
|
5383
6137
|
decodeResult.raw.day = message.text.substring(19, 21);
|
|
5384
|
-
ResultFormatter.off(
|
|
6138
|
+
ResultFormatter.off(
|
|
6139
|
+
decodeResult,
|
|
6140
|
+
DateTimeUtils.convertHHMMSSToTod(message.text.substring(21, 27))
|
|
6141
|
+
);
|
|
5385
6142
|
let latdir = message.text.substring(27, 28);
|
|
5386
6143
|
let latdeg = Number(message.text.substring(28, 30));
|
|
5387
6144
|
let latmin = Number(message.text.substring(30, 34));
|
|
@@ -5395,20 +6152,24 @@ var Label_QQ = class extends DecoderPlugin {
|
|
|
5395
6152
|
ResultFormatter.unknown(decodeResult, message.text.substring(42, 45));
|
|
5396
6153
|
ResultFormatter.position(decodeResult, pos);
|
|
5397
6154
|
if (decodeResult.remaining.text !== "---") {
|
|
5398
|
-
ResultFormatter.groundspeed(
|
|
6155
|
+
ResultFormatter.groundspeed(
|
|
6156
|
+
decodeResult,
|
|
6157
|
+
Number(message.text.substring(45, 48))
|
|
6158
|
+
);
|
|
5399
6159
|
} else {
|
|
5400
6160
|
ResultFormatter.unknown(decodeResult, message.text.substring(45, 48));
|
|
5401
6161
|
}
|
|
5402
6162
|
ResultFormatter.unknown(decodeResult, message.text.substring(48));
|
|
5403
6163
|
} else {
|
|
5404
|
-
ResultFormatter.off(
|
|
6164
|
+
ResultFormatter.off(
|
|
6165
|
+
decodeResult,
|
|
6166
|
+
DateTimeUtils.convertHHMMSSToTod(message.text.substring(8, 12) + "00")
|
|
6167
|
+
);
|
|
5405
6168
|
ResultFormatter.unknown(decodeResult, message.text.substring(12));
|
|
5406
6169
|
}
|
|
5407
6170
|
decodeResult.decoded = true;
|
|
5408
|
-
if (!decodeResult.remaining.text)
|
|
5409
|
-
|
|
5410
|
-
else
|
|
5411
|
-
decodeResult.decoder.decodeLevel = "partial";
|
|
6171
|
+
if (!decodeResult.remaining.text) decodeResult.decoder.decodeLevel = "full";
|
|
6172
|
+
else decodeResult.decoder.decodeLevel = "partial";
|
|
5412
6173
|
return decodeResult;
|
|
5413
6174
|
}
|
|
5414
6175
|
};
|
|
@@ -5422,6 +6183,7 @@ var MessageDecoder = class {
|
|
|
5422
6183
|
this.name = "acars-decoder-typescript";
|
|
5423
6184
|
this.plugins = [];
|
|
5424
6185
|
this.debug = false;
|
|
6186
|
+
this.registerPlugin(new CBand(this));
|
|
5425
6187
|
this.registerPlugin(new Label_ColonComma(this));
|
|
5426
6188
|
this.registerPlugin(new Label_5Z_Slash(this));
|
|
5427
6189
|
this.registerPlugin(new Label_10_LDR(this));
|
|
@@ -5470,9 +6232,9 @@ var MessageDecoder = class {
|
|
|
5470
6232
|
this.registerPlugin(new Label_H2_02E(this));
|
|
5471
6233
|
this.registerPlugin(new Label_H1_FLR(this));
|
|
5472
6234
|
this.registerPlugin(new Label_H1_OHMA(this));
|
|
6235
|
+
this.registerPlugin(new Label_H1_Paren(this));
|
|
5473
6236
|
this.registerPlugin(new Label_H1_WRN(this));
|
|
5474
6237
|
this.registerPlugin(new Label_H1(this));
|
|
5475
|
-
this.registerPlugin(new Label_H1_Slash(this));
|
|
5476
6238
|
this.registerPlugin(new Label_H1_StarPOS(this));
|
|
5477
6239
|
this.registerPlugin(new Label_HX(this));
|
|
5478
6240
|
this.registerPlugin(new Label_58(this));
|
|
@@ -5488,14 +6250,13 @@ var MessageDecoder = class {
|
|
|
5488
6250
|
this.registerPlugin(new Label_QS(this));
|
|
5489
6251
|
}
|
|
5490
6252
|
registerPlugin(plugin) {
|
|
5491
|
-
const pluginInstance = plugin;
|
|
5492
6253
|
this.plugins.push(plugin);
|
|
5493
6254
|
return true;
|
|
5494
6255
|
}
|
|
5495
6256
|
decode(message, options = {}) {
|
|
5496
6257
|
const usablePlugins = this.plugins.filter((plugin) => {
|
|
5497
6258
|
const qualifiers = plugin.qualifiers();
|
|
5498
|
-
if (qualifiers.labels.includes(message.label)) {
|
|
6259
|
+
if (qualifiers.labels.includes(message.label) || qualifiers.labels.length === 1 && qualifiers.labels[0] === "*") {
|
|
5499
6260
|
if (qualifiers.preambles && qualifiers.preambles.length > 0) {
|
|
5500
6261
|
const matching = qualifiers.preambles.filter((preamble) => {
|
|
5501
6262
|
return message.text.substring(0, preamble.length) === preamble;
|