@airframes/acars-decoder 1.8.8 → 1.8.10
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 +45 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -12
- 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 {
|
|
@@ -1824,10 +1846,18 @@ var Label_16_TOD = class extends DecoderPlugin {
|
|
|
1824
1846
|
ResultFormatter.unknown(decodeResult, fields[3]);
|
|
1825
1847
|
const temp = fields[4].split("/");
|
|
1826
1848
|
const posFields = temp[0].split(" ");
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1849
|
+
if (posFields.length === 4) {
|
|
1850
|
+
ResultFormatter.position(decodeResult, {
|
|
1851
|
+
latitude: CoordinateUtils.getDirection(posFields[0]) * Number(posFields[1]),
|
|
1852
|
+
longitude: CoordinateUtils.getDirection(posFields[2]) * Number(posFields[3])
|
|
1853
|
+
});
|
|
1854
|
+
} else if (posFields.length === 2) {
|
|
1855
|
+
ResultFormatter.position(decodeResult, {
|
|
1856
|
+
latitude: CoordinateUtils.getDirection(posFields[0][0]) * Number(posFields[0].slice(1)) / 100,
|
|
1857
|
+
longitude: CoordinateUtils.getDirection(posFields[1][0]) * Number(posFields[1].slice(1)) / 100
|
|
1858
|
+
});
|
|
1859
|
+
} else {
|
|
1860
|
+
}
|
|
1831
1861
|
if (temp.length > 1) {
|
|
1832
1862
|
ResultFormatter.flightNumber(decodeResult, temp[1]);
|
|
1833
1863
|
}
|
|
@@ -2342,6 +2372,8 @@ function processMessageType(decodeResult, type) {
|
|
|
2342
2372
|
decodeResult.formatted.description = "Free Text";
|
|
2343
2373
|
} else if (type === "INI") {
|
|
2344
2374
|
decodeResult.formatted.description = "Initial Report";
|
|
2375
|
+
} else if (type === "INR") {
|
|
2376
|
+
decodeResult.formatted.description = "In-Range Report";
|
|
2345
2377
|
} else if (type === "LDI") {
|
|
2346
2378
|
decodeResult.formatted.description = "Load Distribution Information";
|
|
2347
2379
|
} else if (type === "PER") {
|
|
@@ -2352,6 +2384,8 @@ function processMessageType(decodeResult, type) {
|
|
|
2352
2384
|
decodeResult.formatted.description = "Progress Report";
|
|
2353
2385
|
} else if (type === "PWI") {
|
|
2354
2386
|
decodeResult.formatted.description = "Pilot Weather Information";
|
|
2387
|
+
} else if (type === "WXR") {
|
|
2388
|
+
decodeResult.formatted.description = "Weather Report";
|
|
2355
2389
|
} else if (type === "REJ") {
|
|
2356
2390
|
decodeResult.formatted.description = "Reject";
|
|
2357
2391
|
} else if (type === "REQ") {
|
|
@@ -2365,7 +2399,6 @@ function processMessageType(decodeResult, type) {
|
|
|
2365
2399
|
return true;
|
|
2366
2400
|
}
|
|
2367
2401
|
function processDateCode(decodeResult, data) {
|
|
2368
|
-
decodeResult.raw.message_date = data[0];
|
|
2369
2402
|
if (data.length === 1) {
|
|
2370
2403
|
} else if (data.length === 2) {
|
|
2371
2404
|
const date = data[0].substring(2, 4) + data[0].substring(0, 2) + data[0].substring(4, 6);
|
|
@@ -2559,7 +2592,7 @@ var Label_1M_Slash = class extends DecoderPlugin {
|
|
|
2559
2592
|
decodeResult,
|
|
2560
2593
|
DateTimeUtils.convertDateTimeToEpoch(
|
|
2561
2594
|
results[7] + "00",
|
|
2562
|
-
yymmdd.substring(
|
|
2595
|
+
yymmdd.substring(4, 6) + yymmdd.substring(2, 4) + yymmdd.substring(0, 2)
|
|
2563
2596
|
),
|
|
2564
2597
|
"epoch"
|
|
2565
2598
|
);
|
|
@@ -3344,11 +3377,11 @@ var Label_24_Slash = class extends DecoderPlugin {
|
|
|
3344
3377
|
decodeResult.message = message;
|
|
3345
3378
|
const fields = message.text.split("/");
|
|
3346
3379
|
if (fields.length == 10 && fields[0] == "" && fields[9] == "") {
|
|
3347
|
-
const
|
|
3380
|
+
const ddmmyy = fields[1].substring(2, 4) + fields[1].substring(4, 6) + fields[1].substring(0, 2);
|
|
3348
3381
|
const hhmmss = fields[2] + "00";
|
|
3349
3382
|
decodeResult.raw.message_timestamp = DateTimeUtils.convertDateTimeToEpoch(
|
|
3350
3383
|
hhmmss,
|
|
3351
|
-
|
|
3384
|
+
ddmmyy
|
|
3352
3385
|
);
|
|
3353
3386
|
ResultFormatter.flightNumber(decodeResult, fields[3]);
|
|
3354
3387
|
ResultFormatter.altitude(decodeResult, Number(fields[4]));
|