@airframes/acars-decoder 1.6.8 → 1.6.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 +186 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +186 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1303,6 +1303,62 @@ var Label_ColonComma = class extends DecoderPlugin {
|
|
|
1303
1303
|
}
|
|
1304
1304
|
};
|
|
1305
1305
|
|
|
1306
|
+
// lib/plugins/Label_H1_FLR.ts
|
|
1307
|
+
var Label_H1_FLR = class extends DecoderPlugin {
|
|
1308
|
+
name = "label-h1-flr";
|
|
1309
|
+
qualifiers() {
|
|
1310
|
+
return {
|
|
1311
|
+
labels: ["H1"],
|
|
1312
|
+
preambles: ["FLR", "#CFBFLR"]
|
|
1313
|
+
};
|
|
1314
|
+
}
|
|
1315
|
+
decode(message, options = {}) {
|
|
1316
|
+
let decodeResult = this.defaultResult();
|
|
1317
|
+
decodeResult.decoder.name = this.name;
|
|
1318
|
+
decodeResult.formatted.description = "Fault Log Report";
|
|
1319
|
+
decodeResult.message = message;
|
|
1320
|
+
const parts = message.text.split("/FR");
|
|
1321
|
+
if (parts.length > 1) {
|
|
1322
|
+
decodeResult.remaining.text = "";
|
|
1323
|
+
const fields = parts[0].split("/");
|
|
1324
|
+
for (let i = 1; i < fields.length; i++) {
|
|
1325
|
+
const field = fields[i];
|
|
1326
|
+
if (field.startsWith("PN")) {
|
|
1327
|
+
processUnknown(decodeResult, "/" + field);
|
|
1328
|
+
} else {
|
|
1329
|
+
processUnknown(decodeResult, "/" + field);
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
const data = parts[1].substring(0, 20);
|
|
1333
|
+
const msg = parts[1].substring(20);
|
|
1334
|
+
const datetime = data.substring(0, 12);
|
|
1335
|
+
const date = datetime.substring(4, 6) + datetime.substring(2, 4) + datetime.substring(0, 2);
|
|
1336
|
+
processUnknown(decodeResult, data.substring(12));
|
|
1337
|
+
decodeResult.raw.message_timestamp = DateTimeUtils.convertDateTimeToEpoch(datetime.substring(6), date);
|
|
1338
|
+
decodeResult.raw.fault_message = msg;
|
|
1339
|
+
decodeResult.formatted.items.push({
|
|
1340
|
+
type: "fault",
|
|
1341
|
+
code: "FR",
|
|
1342
|
+
label: "Fault Report",
|
|
1343
|
+
value: decodeResult.raw.fault_message
|
|
1344
|
+
});
|
|
1345
|
+
decodeResult.decoded = true;
|
|
1346
|
+
decodeResult.decoder.decodeLevel = "partial";
|
|
1347
|
+
} else {
|
|
1348
|
+
if (options.debug) {
|
|
1349
|
+
console.log(`Decoder: Unknown H1 message: ${message.text}`);
|
|
1350
|
+
}
|
|
1351
|
+
decodeResult.remaining.text = message.text;
|
|
1352
|
+
decodeResult.decoded = false;
|
|
1353
|
+
decodeResult.decoder.decodeLevel = "none";
|
|
1354
|
+
}
|
|
1355
|
+
return decodeResult;
|
|
1356
|
+
}
|
|
1357
|
+
};
|
|
1358
|
+
function processUnknown(decodeResult, value) {
|
|
1359
|
+
decodeResult.remaining.text += value;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1306
1362
|
// lib/utils/result_formatter.ts
|
|
1307
1363
|
var ResultFormatter = class {
|
|
1308
1364
|
static altitude(decodeResult, value) {
|
|
@@ -1671,21 +1727,7 @@ var H1Helper = class {
|
|
|
1671
1727
|
const dt = processDT(decodeResult, data2);
|
|
1672
1728
|
allKnownFields = allKnownFields && dt;
|
|
1673
1729
|
} else if (fields[i].startsWith("ID")) {
|
|
1674
|
-
|
|
1675
|
-
decodeResult.raw.tail = data2[0];
|
|
1676
|
-
decodeResult.formatted.items.push({
|
|
1677
|
-
type: "tail",
|
|
1678
|
-
code: "TAIL",
|
|
1679
|
-
label: "Tail",
|
|
1680
|
-
value: decodeResult.raw.tail
|
|
1681
|
-
});
|
|
1682
|
-
if (data2.length > 1) {
|
|
1683
|
-
decodeResult.raw.flight_number = data2[1];
|
|
1684
|
-
}
|
|
1685
|
-
if (data2.length > 2) {
|
|
1686
|
-
allKnownFields = false;
|
|
1687
|
-
decodeResult.remaining.text += "," + data2.slice(2).join(",");
|
|
1688
|
-
}
|
|
1730
|
+
processIdentification(decodeResult, fields[i].substring(2).split(","));
|
|
1689
1731
|
} else if (fields[i].startsWith("LR")) {
|
|
1690
1732
|
const data2 = fields[i].substring(2).split(",");
|
|
1691
1733
|
const lr = processLR(decodeResult, data2);
|
|
@@ -1699,6 +1741,20 @@ var H1Helper = class {
|
|
|
1699
1741
|
} else if (fields[i].startsWith("PS")) {
|
|
1700
1742
|
allKnownFields = false;
|
|
1701
1743
|
decodeResult.remaining.text += fields[i];
|
|
1744
|
+
} else if (fields[i].startsWith("AF")) {
|
|
1745
|
+
const af = processAirField(decodeResult, fields[i].substring(2).split(","));
|
|
1746
|
+
allKnownFields = allKnownFields && af;
|
|
1747
|
+
} else if (fields[i].startsWith("TD")) {
|
|
1748
|
+
const td = processTimeOfDeparture(decodeResult, fields[i].substring(2).split(","));
|
|
1749
|
+
allKnownFields = allKnownFields && td;
|
|
1750
|
+
} else if (fields[i].startsWith("FX")) {
|
|
1751
|
+
decodeResult.raw.free_text = fields[i].substring(2);
|
|
1752
|
+
decodeResult.formatted.items.push({
|
|
1753
|
+
type: "text",
|
|
1754
|
+
code: "TEXT",
|
|
1755
|
+
label: "Free Text",
|
|
1756
|
+
value: decodeResult.raw.free_text
|
|
1757
|
+
});
|
|
1702
1758
|
} else {
|
|
1703
1759
|
decodeResult.remaining.text += "/" + fields[i];
|
|
1704
1760
|
allKnownFields = false;
|
|
@@ -1710,6 +1766,51 @@ var H1Helper = class {
|
|
|
1710
1766
|
return allKnownFields;
|
|
1711
1767
|
}
|
|
1712
1768
|
};
|
|
1769
|
+
function processAirField(decodeResult, data) {
|
|
1770
|
+
if (data.length === 2) {
|
|
1771
|
+
ResultFormatter.departureAirport(decodeResult, data[0]);
|
|
1772
|
+
ResultFormatter.arrivalAirport(decodeResult, data[1]);
|
|
1773
|
+
return true;
|
|
1774
|
+
}
|
|
1775
|
+
decodeResult.remaining.text += "AF/" + data.join(",");
|
|
1776
|
+
return false;
|
|
1777
|
+
}
|
|
1778
|
+
function processTimeOfDeparture(decodeResult, data) {
|
|
1779
|
+
if (data.length === 2) {
|
|
1780
|
+
decodeResult.raw.plannedDepartureTime = data[0];
|
|
1781
|
+
decodeResult.formatted.items.push({
|
|
1782
|
+
type: "ptd",
|
|
1783
|
+
code: "ptd",
|
|
1784
|
+
label: "Planned Departure Time",
|
|
1785
|
+
value: `YYYY-MM-${data[0].substring(0, 2)}T${data[0].substring(2, 4)}:${data[0].substring(4)}:00Z`
|
|
1786
|
+
});
|
|
1787
|
+
decodeResult.raw.plannedDepartureTime = data[1];
|
|
1788
|
+
decodeResult.formatted.items.push({
|
|
1789
|
+
type: "etd",
|
|
1790
|
+
code: "etd",
|
|
1791
|
+
label: "Estimated Departure Time",
|
|
1792
|
+
value: `${data[1].substring(0, 2)}:${data[1].substring(2)}`
|
|
1793
|
+
});
|
|
1794
|
+
return true;
|
|
1795
|
+
}
|
|
1796
|
+
decodeResult.remaining.text += "/TD" + data.join(",");
|
|
1797
|
+
return false;
|
|
1798
|
+
}
|
|
1799
|
+
function processIdentification(decodeResult, data) {
|
|
1800
|
+
decodeResult.raw.tail = data[0];
|
|
1801
|
+
decodeResult.formatted.items.push({
|
|
1802
|
+
type: "tail",
|
|
1803
|
+
code: "TAIL",
|
|
1804
|
+
label: "Tail",
|
|
1805
|
+
value: decodeResult.raw.tail
|
|
1806
|
+
});
|
|
1807
|
+
if (data.length > 1) {
|
|
1808
|
+
decodeResult.raw.flight_number = data[1];
|
|
1809
|
+
}
|
|
1810
|
+
if (data.length > 2) {
|
|
1811
|
+
decodeResult.raw.mission_number = data[2];
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1713
1814
|
function processDT(decodeResult, data) {
|
|
1714
1815
|
let allKnownFields = true;
|
|
1715
1816
|
if (!decodeResult.raw.arrival_icao) {
|
|
@@ -1787,7 +1888,7 @@ function processDC(decodeResult, data) {
|
|
|
1787
1888
|
}
|
|
1788
1889
|
function processPS(decodeResult, data) {
|
|
1789
1890
|
let allKnownFields = true;
|
|
1790
|
-
const position = CoordinateUtils.
|
|
1891
|
+
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(data[0]);
|
|
1791
1892
|
if (position) {
|
|
1792
1893
|
decodeResult.raw.position = position;
|
|
1793
1894
|
decodeResult.formatted.items.push({
|
|
@@ -1823,7 +1924,7 @@ function processPS(decodeResult, data) {
|
|
|
1823
1924
|
}
|
|
1824
1925
|
function processPosition2(decodeResult, data) {
|
|
1825
1926
|
let allKnownFields = true;
|
|
1826
|
-
const position = CoordinateUtils.
|
|
1927
|
+
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(data[0]);
|
|
1827
1928
|
if (position) {
|
|
1828
1929
|
decodeResult.raw.position = position;
|
|
1829
1930
|
decodeResult.formatted.items.push({
|
|
@@ -1905,6 +2006,67 @@ var Label_H1_FPN = class extends DecoderPlugin {
|
|
|
1905
2006
|
}
|
|
1906
2007
|
};
|
|
1907
2008
|
|
|
2009
|
+
// lib/plugins/Label_H1_FTX.ts
|
|
2010
|
+
var Label_H1_FTX = class extends DecoderPlugin {
|
|
2011
|
+
name = "label-h1-ftx";
|
|
2012
|
+
qualifiers() {
|
|
2013
|
+
return {
|
|
2014
|
+
labels: ["H1"],
|
|
2015
|
+
preambles: ["FTX", "- #MDFTX"]
|
|
2016
|
+
};
|
|
2017
|
+
}
|
|
2018
|
+
decode(message, options = {}) {
|
|
2019
|
+
let decodeResult = this.defaultResult();
|
|
2020
|
+
decodeResult.decoder.name = this.name;
|
|
2021
|
+
decodeResult.formatted.description = "Free Text";
|
|
2022
|
+
decodeResult.message = message;
|
|
2023
|
+
decodeResult.remaining.text = "";
|
|
2024
|
+
const fulllyDecoded = H1Helper.decodeH1Message(decodeResult, message.text);
|
|
2025
|
+
decodeResult.decoded = true;
|
|
2026
|
+
decodeResult.decoder.decodeLevel = fulllyDecoded ? "full" : "partial";
|
|
2027
|
+
if (decodeResult.formatted.items.length === 0) {
|
|
2028
|
+
if (options?.debug) {
|
|
2029
|
+
console.log(`Decoder: Unknown H1 message: ${message.text}`);
|
|
2030
|
+
}
|
|
2031
|
+
decodeResult.remaining.text = message.text;
|
|
2032
|
+
decodeResult.decoded = false;
|
|
2033
|
+
decodeResult.decoder.decodeLevel = "none";
|
|
2034
|
+
}
|
|
2035
|
+
return decodeResult;
|
|
2036
|
+
}
|
|
2037
|
+
};
|
|
2038
|
+
|
|
2039
|
+
// lib/plugins/Label_H1_INI.ts
|
|
2040
|
+
var Label_H1_INI = class extends DecoderPlugin {
|
|
2041
|
+
// eslint-disable-line camelcase
|
|
2042
|
+
name = "label-h1-ini";
|
|
2043
|
+
qualifiers() {
|
|
2044
|
+
return {
|
|
2045
|
+
labels: ["H1"],
|
|
2046
|
+
preambles: ["INI", "- #MDINI"]
|
|
2047
|
+
};
|
|
2048
|
+
}
|
|
2049
|
+
decode(message, options = {}) {
|
|
2050
|
+
const decodeResult = this.defaultResult();
|
|
2051
|
+
decodeResult.decoder.name = this.name;
|
|
2052
|
+
decodeResult.formatted.description = "Flight Plan Initial Report";
|
|
2053
|
+
decodeResult.message = message;
|
|
2054
|
+
decodeResult.remaining.text = "";
|
|
2055
|
+
const fulllyDecoded = H1Helper.decodeH1Message(decodeResult, message.text);
|
|
2056
|
+
decodeResult.decoded = true;
|
|
2057
|
+
decodeResult.decoder.decodeLevel = fulllyDecoded ? "full" : "partial";
|
|
2058
|
+
if (decodeResult.formatted.items.length === 0) {
|
|
2059
|
+
if (options?.debug) {
|
|
2060
|
+
console.log(`Decoder: Unknown H1 message: ${message.text}`);
|
|
2061
|
+
}
|
|
2062
|
+
decodeResult.remaining.text = message.text;
|
|
2063
|
+
decodeResult.decoded = false;
|
|
2064
|
+
decodeResult.decoder.decodeLevel = "none";
|
|
2065
|
+
}
|
|
2066
|
+
return decodeResult;
|
|
2067
|
+
}
|
|
2068
|
+
};
|
|
2069
|
+
|
|
1908
2070
|
// lib/plugins/Label_H1_OHMA.ts
|
|
1909
2071
|
import * as zlib from "minizlib";
|
|
1910
2072
|
var Label_H1_OHMA = class extends DecoderPlugin {
|
|
@@ -2015,16 +2177,16 @@ var Label_H1_WRN = class extends DecoderPlugin {
|
|
|
2015
2177
|
for (let i = 1; i < fields.length; i++) {
|
|
2016
2178
|
const field = fields[i];
|
|
2017
2179
|
if (field.startsWith("PN")) {
|
|
2018
|
-
|
|
2180
|
+
processUnknown2(decodeResult, "/" + field);
|
|
2019
2181
|
} else {
|
|
2020
|
-
|
|
2182
|
+
processUnknown2(decodeResult, "/" + field);
|
|
2021
2183
|
}
|
|
2022
2184
|
}
|
|
2023
2185
|
const data = parts[1].substring(0, 20);
|
|
2024
2186
|
const msg = parts[1].substring(20);
|
|
2025
2187
|
const datetime = data.substring(0, 12);
|
|
2026
2188
|
const date = datetime.substring(4, 6) + datetime.substring(2, 4) + datetime.substring(0, 2);
|
|
2027
|
-
|
|
2189
|
+
processUnknown2(decodeResult, data.substring(12));
|
|
2028
2190
|
decodeResult.raw.message_timestamp = DateTimeUtils.convertDateTimeToEpoch(datetime.substring(6), date);
|
|
2029
2191
|
decodeResult.raw.warning_message = msg;
|
|
2030
2192
|
decodeResult.formatted.items.push({
|
|
@@ -2046,7 +2208,7 @@ var Label_H1_WRN = class extends DecoderPlugin {
|
|
|
2046
2208
|
return decodeResult;
|
|
2047
2209
|
}
|
|
2048
2210
|
};
|
|
2049
|
-
function
|
|
2211
|
+
function processUnknown2(decodeResult, value) {
|
|
2050
2212
|
decodeResult.remaining.text += value;
|
|
2051
2213
|
}
|
|
2052
2214
|
|
|
@@ -3156,6 +3318,9 @@ var MessageDecoder = class {
|
|
|
3156
3318
|
this.registerPlugin(new Label_44_POS(this));
|
|
3157
3319
|
this.registerPlugin(new Label_B6_Forwardslash(this));
|
|
3158
3320
|
this.registerPlugin(new Label_H1_FPN(this));
|
|
3321
|
+
this.registerPlugin(new Label_H1_FLR(this));
|
|
3322
|
+
this.registerPlugin(new Label_H1_FTX(this));
|
|
3323
|
+
this.registerPlugin(new Label_H1_INI(this));
|
|
3159
3324
|
this.registerPlugin(new Label_H1_OHMA(this));
|
|
3160
3325
|
this.registerPlugin(new Label_H1_POS(this));
|
|
3161
3326
|
this.registerPlugin(new Label_H1_WRN(this));
|