@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.js
CHANGED
|
@@ -1340,6 +1340,62 @@ var Label_ColonComma = class extends DecoderPlugin {
|
|
|
1340
1340
|
}
|
|
1341
1341
|
};
|
|
1342
1342
|
|
|
1343
|
+
// lib/plugins/Label_H1_FLR.ts
|
|
1344
|
+
var Label_H1_FLR = class extends DecoderPlugin {
|
|
1345
|
+
name = "label-h1-flr";
|
|
1346
|
+
qualifiers() {
|
|
1347
|
+
return {
|
|
1348
|
+
labels: ["H1"],
|
|
1349
|
+
preambles: ["FLR", "#CFBFLR"]
|
|
1350
|
+
};
|
|
1351
|
+
}
|
|
1352
|
+
decode(message, options = {}) {
|
|
1353
|
+
let decodeResult = this.defaultResult();
|
|
1354
|
+
decodeResult.decoder.name = this.name;
|
|
1355
|
+
decodeResult.formatted.description = "Fault Log Report";
|
|
1356
|
+
decodeResult.message = message;
|
|
1357
|
+
const parts = message.text.split("/FR");
|
|
1358
|
+
if (parts.length > 1) {
|
|
1359
|
+
decodeResult.remaining.text = "";
|
|
1360
|
+
const fields = parts[0].split("/");
|
|
1361
|
+
for (let i = 1; i < fields.length; i++) {
|
|
1362
|
+
const field = fields[i];
|
|
1363
|
+
if (field.startsWith("PN")) {
|
|
1364
|
+
processUnknown(decodeResult, "/" + field);
|
|
1365
|
+
} else {
|
|
1366
|
+
processUnknown(decodeResult, "/" + field);
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
const data = parts[1].substring(0, 20);
|
|
1370
|
+
const msg = parts[1].substring(20);
|
|
1371
|
+
const datetime = data.substring(0, 12);
|
|
1372
|
+
const date = datetime.substring(4, 6) + datetime.substring(2, 4) + datetime.substring(0, 2);
|
|
1373
|
+
processUnknown(decodeResult, data.substring(12));
|
|
1374
|
+
decodeResult.raw.message_timestamp = DateTimeUtils.convertDateTimeToEpoch(datetime.substring(6), date);
|
|
1375
|
+
decodeResult.raw.fault_message = msg;
|
|
1376
|
+
decodeResult.formatted.items.push({
|
|
1377
|
+
type: "fault",
|
|
1378
|
+
code: "FR",
|
|
1379
|
+
label: "Fault Report",
|
|
1380
|
+
value: decodeResult.raw.fault_message
|
|
1381
|
+
});
|
|
1382
|
+
decodeResult.decoded = true;
|
|
1383
|
+
decodeResult.decoder.decodeLevel = "partial";
|
|
1384
|
+
} else {
|
|
1385
|
+
if (options.debug) {
|
|
1386
|
+
console.log(`Decoder: Unknown H1 message: ${message.text}`);
|
|
1387
|
+
}
|
|
1388
|
+
decodeResult.remaining.text = message.text;
|
|
1389
|
+
decodeResult.decoded = false;
|
|
1390
|
+
decodeResult.decoder.decodeLevel = "none";
|
|
1391
|
+
}
|
|
1392
|
+
return decodeResult;
|
|
1393
|
+
}
|
|
1394
|
+
};
|
|
1395
|
+
function processUnknown(decodeResult, value) {
|
|
1396
|
+
decodeResult.remaining.text += value;
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1343
1399
|
// lib/utils/result_formatter.ts
|
|
1344
1400
|
var ResultFormatter = class {
|
|
1345
1401
|
static altitude(decodeResult, value) {
|
|
@@ -1708,21 +1764,7 @@ var H1Helper = class {
|
|
|
1708
1764
|
const dt = processDT(decodeResult, data2);
|
|
1709
1765
|
allKnownFields = allKnownFields && dt;
|
|
1710
1766
|
} else if (fields[i].startsWith("ID")) {
|
|
1711
|
-
|
|
1712
|
-
decodeResult.raw.tail = data2[0];
|
|
1713
|
-
decodeResult.formatted.items.push({
|
|
1714
|
-
type: "tail",
|
|
1715
|
-
code: "TAIL",
|
|
1716
|
-
label: "Tail",
|
|
1717
|
-
value: decodeResult.raw.tail
|
|
1718
|
-
});
|
|
1719
|
-
if (data2.length > 1) {
|
|
1720
|
-
decodeResult.raw.flight_number = data2[1];
|
|
1721
|
-
}
|
|
1722
|
-
if (data2.length > 2) {
|
|
1723
|
-
allKnownFields = false;
|
|
1724
|
-
decodeResult.remaining.text += "," + data2.slice(2).join(",");
|
|
1725
|
-
}
|
|
1767
|
+
processIdentification(decodeResult, fields[i].substring(2).split(","));
|
|
1726
1768
|
} else if (fields[i].startsWith("LR")) {
|
|
1727
1769
|
const data2 = fields[i].substring(2).split(",");
|
|
1728
1770
|
const lr = processLR(decodeResult, data2);
|
|
@@ -1736,6 +1778,20 @@ var H1Helper = class {
|
|
|
1736
1778
|
} else if (fields[i].startsWith("PS")) {
|
|
1737
1779
|
allKnownFields = false;
|
|
1738
1780
|
decodeResult.remaining.text += fields[i];
|
|
1781
|
+
} else if (fields[i].startsWith("AF")) {
|
|
1782
|
+
const af = processAirField(decodeResult, fields[i].substring(2).split(","));
|
|
1783
|
+
allKnownFields = allKnownFields && af;
|
|
1784
|
+
} else if (fields[i].startsWith("TD")) {
|
|
1785
|
+
const td = processTimeOfDeparture(decodeResult, fields[i].substring(2).split(","));
|
|
1786
|
+
allKnownFields = allKnownFields && td;
|
|
1787
|
+
} else if (fields[i].startsWith("FX")) {
|
|
1788
|
+
decodeResult.raw.free_text = fields[i].substring(2);
|
|
1789
|
+
decodeResult.formatted.items.push({
|
|
1790
|
+
type: "text",
|
|
1791
|
+
code: "TEXT",
|
|
1792
|
+
label: "Free Text",
|
|
1793
|
+
value: decodeResult.raw.free_text
|
|
1794
|
+
});
|
|
1739
1795
|
} else {
|
|
1740
1796
|
decodeResult.remaining.text += "/" + fields[i];
|
|
1741
1797
|
allKnownFields = false;
|
|
@@ -1747,6 +1803,51 @@ var H1Helper = class {
|
|
|
1747
1803
|
return allKnownFields;
|
|
1748
1804
|
}
|
|
1749
1805
|
};
|
|
1806
|
+
function processAirField(decodeResult, data) {
|
|
1807
|
+
if (data.length === 2) {
|
|
1808
|
+
ResultFormatter.departureAirport(decodeResult, data[0]);
|
|
1809
|
+
ResultFormatter.arrivalAirport(decodeResult, data[1]);
|
|
1810
|
+
return true;
|
|
1811
|
+
}
|
|
1812
|
+
decodeResult.remaining.text += "AF/" + data.join(",");
|
|
1813
|
+
return false;
|
|
1814
|
+
}
|
|
1815
|
+
function processTimeOfDeparture(decodeResult, data) {
|
|
1816
|
+
if (data.length === 2) {
|
|
1817
|
+
decodeResult.raw.plannedDepartureTime = data[0];
|
|
1818
|
+
decodeResult.formatted.items.push({
|
|
1819
|
+
type: "ptd",
|
|
1820
|
+
code: "ptd",
|
|
1821
|
+
label: "Planned Departure Time",
|
|
1822
|
+
value: `YYYY-MM-${data[0].substring(0, 2)}T${data[0].substring(2, 4)}:${data[0].substring(4)}:00Z`
|
|
1823
|
+
});
|
|
1824
|
+
decodeResult.raw.plannedDepartureTime = data[1];
|
|
1825
|
+
decodeResult.formatted.items.push({
|
|
1826
|
+
type: "etd",
|
|
1827
|
+
code: "etd",
|
|
1828
|
+
label: "Estimated Departure Time",
|
|
1829
|
+
value: `${data[1].substring(0, 2)}:${data[1].substring(2)}`
|
|
1830
|
+
});
|
|
1831
|
+
return true;
|
|
1832
|
+
}
|
|
1833
|
+
decodeResult.remaining.text += "/TD" + data.join(",");
|
|
1834
|
+
return false;
|
|
1835
|
+
}
|
|
1836
|
+
function processIdentification(decodeResult, data) {
|
|
1837
|
+
decodeResult.raw.tail = data[0];
|
|
1838
|
+
decodeResult.formatted.items.push({
|
|
1839
|
+
type: "tail",
|
|
1840
|
+
code: "TAIL",
|
|
1841
|
+
label: "Tail",
|
|
1842
|
+
value: decodeResult.raw.tail
|
|
1843
|
+
});
|
|
1844
|
+
if (data.length > 1) {
|
|
1845
|
+
decodeResult.raw.flight_number = data[1];
|
|
1846
|
+
}
|
|
1847
|
+
if (data.length > 2) {
|
|
1848
|
+
decodeResult.raw.mission_number = data[2];
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1750
1851
|
function processDT(decodeResult, data) {
|
|
1751
1852
|
let allKnownFields = true;
|
|
1752
1853
|
if (!decodeResult.raw.arrival_icao) {
|
|
@@ -1824,7 +1925,7 @@ function processDC(decodeResult, data) {
|
|
|
1824
1925
|
}
|
|
1825
1926
|
function processPS(decodeResult, data) {
|
|
1826
1927
|
let allKnownFields = true;
|
|
1827
|
-
const position = CoordinateUtils.
|
|
1928
|
+
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(data[0]);
|
|
1828
1929
|
if (position) {
|
|
1829
1930
|
decodeResult.raw.position = position;
|
|
1830
1931
|
decodeResult.formatted.items.push({
|
|
@@ -1860,7 +1961,7 @@ function processPS(decodeResult, data) {
|
|
|
1860
1961
|
}
|
|
1861
1962
|
function processPosition2(decodeResult, data) {
|
|
1862
1963
|
let allKnownFields = true;
|
|
1863
|
-
const position = CoordinateUtils.
|
|
1964
|
+
const position = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(data[0]);
|
|
1864
1965
|
if (position) {
|
|
1865
1966
|
decodeResult.raw.position = position;
|
|
1866
1967
|
decodeResult.formatted.items.push({
|
|
@@ -1942,6 +2043,67 @@ var Label_H1_FPN = class extends DecoderPlugin {
|
|
|
1942
2043
|
}
|
|
1943
2044
|
};
|
|
1944
2045
|
|
|
2046
|
+
// lib/plugins/Label_H1_FTX.ts
|
|
2047
|
+
var Label_H1_FTX = class extends DecoderPlugin {
|
|
2048
|
+
name = "label-h1-ftx";
|
|
2049
|
+
qualifiers() {
|
|
2050
|
+
return {
|
|
2051
|
+
labels: ["H1"],
|
|
2052
|
+
preambles: ["FTX", "- #MDFTX"]
|
|
2053
|
+
};
|
|
2054
|
+
}
|
|
2055
|
+
decode(message, options = {}) {
|
|
2056
|
+
let decodeResult = this.defaultResult();
|
|
2057
|
+
decodeResult.decoder.name = this.name;
|
|
2058
|
+
decodeResult.formatted.description = "Free Text";
|
|
2059
|
+
decodeResult.message = message;
|
|
2060
|
+
decodeResult.remaining.text = "";
|
|
2061
|
+
const fulllyDecoded = H1Helper.decodeH1Message(decodeResult, message.text);
|
|
2062
|
+
decodeResult.decoded = true;
|
|
2063
|
+
decodeResult.decoder.decodeLevel = fulllyDecoded ? "full" : "partial";
|
|
2064
|
+
if (decodeResult.formatted.items.length === 0) {
|
|
2065
|
+
if (options?.debug) {
|
|
2066
|
+
console.log(`Decoder: Unknown H1 message: ${message.text}`);
|
|
2067
|
+
}
|
|
2068
|
+
decodeResult.remaining.text = message.text;
|
|
2069
|
+
decodeResult.decoded = false;
|
|
2070
|
+
decodeResult.decoder.decodeLevel = "none";
|
|
2071
|
+
}
|
|
2072
|
+
return decodeResult;
|
|
2073
|
+
}
|
|
2074
|
+
};
|
|
2075
|
+
|
|
2076
|
+
// lib/plugins/Label_H1_INI.ts
|
|
2077
|
+
var Label_H1_INI = class extends DecoderPlugin {
|
|
2078
|
+
// eslint-disable-line camelcase
|
|
2079
|
+
name = "label-h1-ini";
|
|
2080
|
+
qualifiers() {
|
|
2081
|
+
return {
|
|
2082
|
+
labels: ["H1"],
|
|
2083
|
+
preambles: ["INI", "- #MDINI"]
|
|
2084
|
+
};
|
|
2085
|
+
}
|
|
2086
|
+
decode(message, options = {}) {
|
|
2087
|
+
const decodeResult = this.defaultResult();
|
|
2088
|
+
decodeResult.decoder.name = this.name;
|
|
2089
|
+
decodeResult.formatted.description = "Flight Plan Initial Report";
|
|
2090
|
+
decodeResult.message = message;
|
|
2091
|
+
decodeResult.remaining.text = "";
|
|
2092
|
+
const fulllyDecoded = H1Helper.decodeH1Message(decodeResult, message.text);
|
|
2093
|
+
decodeResult.decoded = true;
|
|
2094
|
+
decodeResult.decoder.decodeLevel = fulllyDecoded ? "full" : "partial";
|
|
2095
|
+
if (decodeResult.formatted.items.length === 0) {
|
|
2096
|
+
if (options?.debug) {
|
|
2097
|
+
console.log(`Decoder: Unknown H1 message: ${message.text}`);
|
|
2098
|
+
}
|
|
2099
|
+
decodeResult.remaining.text = message.text;
|
|
2100
|
+
decodeResult.decoded = false;
|
|
2101
|
+
decodeResult.decoder.decodeLevel = "none";
|
|
2102
|
+
}
|
|
2103
|
+
return decodeResult;
|
|
2104
|
+
}
|
|
2105
|
+
};
|
|
2106
|
+
|
|
1945
2107
|
// lib/plugins/Label_H1_OHMA.ts
|
|
1946
2108
|
var zlib = __toESM(require("minizlib"));
|
|
1947
2109
|
var Label_H1_OHMA = class extends DecoderPlugin {
|
|
@@ -2052,16 +2214,16 @@ var Label_H1_WRN = class extends DecoderPlugin {
|
|
|
2052
2214
|
for (let i = 1; i < fields.length; i++) {
|
|
2053
2215
|
const field = fields[i];
|
|
2054
2216
|
if (field.startsWith("PN")) {
|
|
2055
|
-
|
|
2217
|
+
processUnknown2(decodeResult, "/" + field);
|
|
2056
2218
|
} else {
|
|
2057
|
-
|
|
2219
|
+
processUnknown2(decodeResult, "/" + field);
|
|
2058
2220
|
}
|
|
2059
2221
|
}
|
|
2060
2222
|
const data = parts[1].substring(0, 20);
|
|
2061
2223
|
const msg = parts[1].substring(20);
|
|
2062
2224
|
const datetime = data.substring(0, 12);
|
|
2063
2225
|
const date = datetime.substring(4, 6) + datetime.substring(2, 4) + datetime.substring(0, 2);
|
|
2064
|
-
|
|
2226
|
+
processUnknown2(decodeResult, data.substring(12));
|
|
2065
2227
|
decodeResult.raw.message_timestamp = DateTimeUtils.convertDateTimeToEpoch(datetime.substring(6), date);
|
|
2066
2228
|
decodeResult.raw.warning_message = msg;
|
|
2067
2229
|
decodeResult.formatted.items.push({
|
|
@@ -2083,7 +2245,7 @@ var Label_H1_WRN = class extends DecoderPlugin {
|
|
|
2083
2245
|
return decodeResult;
|
|
2084
2246
|
}
|
|
2085
2247
|
};
|
|
2086
|
-
function
|
|
2248
|
+
function processUnknown2(decodeResult, value) {
|
|
2087
2249
|
decodeResult.remaining.text += value;
|
|
2088
2250
|
}
|
|
2089
2251
|
|
|
@@ -3193,6 +3355,9 @@ var MessageDecoder = class {
|
|
|
3193
3355
|
this.registerPlugin(new Label_44_POS(this));
|
|
3194
3356
|
this.registerPlugin(new Label_B6_Forwardslash(this));
|
|
3195
3357
|
this.registerPlugin(new Label_H1_FPN(this));
|
|
3358
|
+
this.registerPlugin(new Label_H1_FLR(this));
|
|
3359
|
+
this.registerPlugin(new Label_H1_FTX(this));
|
|
3360
|
+
this.registerPlugin(new Label_H1_INI(this));
|
|
3196
3361
|
this.registerPlugin(new Label_H1_OHMA(this));
|
|
3197
3362
|
this.registerPlugin(new Label_H1_POS(this));
|
|
3198
3363
|
this.registerPlugin(new Label_H1_WRN(this));
|