@airframes/acars-decoder 1.8.8 → 1.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +33 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -290,14 +290,14 @@ var DateTimeUtils = class {
|
|
|
290
290
|
/**
|
|
291
291
|
*
|
|
292
292
|
* @param time HHMMSS
|
|
293
|
-
* @param date
|
|
293
|
+
* @param date DDMMYY or DDMMYYYY
|
|
294
294
|
* @returns seconds since epoch
|
|
295
295
|
*/
|
|
296
296
|
static convertDateTimeToEpoch(time, date) {
|
|
297
297
|
if (date.length === 6) {
|
|
298
298
|
date = date.substring(0, 4) + `20${date.substring(4, 6)}`;
|
|
299
299
|
}
|
|
300
|
-
const timestamp = `${date.substring(4, 8)}-${date.substring(
|
|
300
|
+
const timestamp = `${date.substring(4, 8)}-${date.substring(2, 4)}-${date.substring(0, 2)}T${time.substring(0, 2)}:${time.substring(2, 4)}:${time.substring(4, 6)}.000Z`;
|
|
301
301
|
const millis = Date.parse(timestamp);
|
|
302
302
|
return millis / 1e3;
|
|
303
303
|
}
|
|
@@ -680,6 +680,20 @@ var ResultFormatter = class {
|
|
|
680
680
|
value: `${decodeResult.raw.outside_air_temperature} degrees`
|
|
681
681
|
});
|
|
682
682
|
}
|
|
683
|
+
static totalAirTemp(decodeResult, value) {
|
|
684
|
+
if (value.length === 0) {
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
decodeResult.raw.total_air_temperature = Number(
|
|
688
|
+
value.replace("M", "-").replace("P", "+")
|
|
689
|
+
);
|
|
690
|
+
decodeResult.formatted.items.push({
|
|
691
|
+
type: "temperature",
|
|
692
|
+
code: "TATEMP",
|
|
693
|
+
label: "Total Air Temperature (C)",
|
|
694
|
+
value: `${decodeResult.raw.total_air_temperature} degrees`
|
|
695
|
+
});
|
|
696
|
+
}
|
|
683
697
|
static heading(decodeResult, value) {
|
|
684
698
|
decodeResult.raw.heading = value;
|
|
685
699
|
decodeResult.formatted.items.push({
|
|
@@ -943,6 +957,15 @@ var ResultFormatter = class {
|
|
|
943
957
|
value: `${decodeResult.raw.ground_address}`
|
|
944
958
|
});
|
|
945
959
|
}
|
|
960
|
+
static timestamp(decodeResult, value) {
|
|
961
|
+
decodeResult.raw.message_timestamp = value;
|
|
962
|
+
decodeResult.formatted.items.push({
|
|
963
|
+
type: "epoch",
|
|
964
|
+
code: "TIMESTAMP",
|
|
965
|
+
label: "Message Timestamp",
|
|
966
|
+
value: DateTimeUtils.timestampToString(value, "epoch")
|
|
967
|
+
});
|
|
968
|
+
}
|
|
946
969
|
static unknown(decodeResult, value, sep = ",") {
|
|
947
970
|
if (!decodeResult.remaining.text) decodeResult.remaining.text = value;
|
|
948
971
|
else decodeResult.remaining.text += sep + value;
|
|
@@ -1545,10 +1568,9 @@ var Label_15 = class extends DecoderPlugin {
|
|
|
1545
1568
|
const ddmmyy = between.substring(16, 22);
|
|
1546
1569
|
const hhmm = between.substring(22, 26);
|
|
1547
1570
|
if (ddmmyy != "------") {
|
|
1548
|
-
const mmddyy = ddmmyy.substring(2, 4) + ddmmyy.substring(0, 2) + ddmmyy.substring(4);
|
|
1549
1571
|
ResultFormatter.off(
|
|
1550
1572
|
decodeResult,
|
|
1551
|
-
DateTimeUtils.convertDateTimeToEpoch(hhmm + "00",
|
|
1573
|
+
DateTimeUtils.convertDateTimeToEpoch(hhmm + "00", ddmmyy),
|
|
1552
1574
|
"epoch"
|
|
1553
1575
|
);
|
|
1554
1576
|
} else {
|
|
@@ -2342,6 +2364,8 @@ function processMessageType(decodeResult, type) {
|
|
|
2342
2364
|
decodeResult.formatted.description = "Free Text";
|
|
2343
2365
|
} else if (type === "INI") {
|
|
2344
2366
|
decodeResult.formatted.description = "Initial Report";
|
|
2367
|
+
} else if (type === "INR") {
|
|
2368
|
+
decodeResult.formatted.description = "In-Range Report";
|
|
2345
2369
|
} else if (type === "LDI") {
|
|
2346
2370
|
decodeResult.formatted.description = "Load Distribution Information";
|
|
2347
2371
|
} else if (type === "PER") {
|
|
@@ -2352,6 +2376,8 @@ function processMessageType(decodeResult, type) {
|
|
|
2352
2376
|
decodeResult.formatted.description = "Progress Report";
|
|
2353
2377
|
} else if (type === "PWI") {
|
|
2354
2378
|
decodeResult.formatted.description = "Pilot Weather Information";
|
|
2379
|
+
} else if (type === "WXR") {
|
|
2380
|
+
decodeResult.formatted.description = "Weather Report";
|
|
2355
2381
|
} else if (type === "REJ") {
|
|
2356
2382
|
decodeResult.formatted.description = "Reject";
|
|
2357
2383
|
} else if (type === "REQ") {
|
|
@@ -2365,7 +2391,6 @@ function processMessageType(decodeResult, type) {
|
|
|
2365
2391
|
return true;
|
|
2366
2392
|
}
|
|
2367
2393
|
function processDateCode(decodeResult, data) {
|
|
2368
|
-
decodeResult.raw.message_date = data[0];
|
|
2369
2394
|
if (data.length === 1) {
|
|
2370
2395
|
} else if (data.length === 2) {
|
|
2371
2396
|
const date = data[0].substring(2, 4) + data[0].substring(0, 2) + data[0].substring(4, 6);
|
|
@@ -2559,7 +2584,7 @@ var Label_1M_Slash = class extends DecoderPlugin {
|
|
|
2559
2584
|
decodeResult,
|
|
2560
2585
|
DateTimeUtils.convertDateTimeToEpoch(
|
|
2561
2586
|
results[7] + "00",
|
|
2562
|
-
yymmdd.substring(
|
|
2587
|
+
yymmdd.substring(4, 6) + yymmdd.substring(2, 4) + yymmdd.substring(0, 2)
|
|
2563
2588
|
),
|
|
2564
2589
|
"epoch"
|
|
2565
2590
|
);
|
|
@@ -3344,11 +3369,11 @@ var Label_24_Slash = class extends DecoderPlugin {
|
|
|
3344
3369
|
decodeResult.message = message;
|
|
3345
3370
|
const fields = message.text.split("/");
|
|
3346
3371
|
if (fields.length == 10 && fields[0] == "" && fields[9] == "") {
|
|
3347
|
-
const
|
|
3372
|
+
const ddmmyy = fields[1].substring(2, 4) + fields[1].substring(4, 6) + fields[1].substring(0, 2);
|
|
3348
3373
|
const hhmmss = fields[2] + "00";
|
|
3349
3374
|
decodeResult.raw.message_timestamp = DateTimeUtils.convertDateTimeToEpoch(
|
|
3350
3375
|
hhmmss,
|
|
3351
|
-
|
|
3376
|
+
ddmmyy
|
|
3352
3377
|
);
|
|
3353
3378
|
ResultFormatter.flightNumber(decodeResult, fields[3]);
|
|
3354
3379
|
ResultFormatter.altitude(decodeResult, Number(fields[4]));
|