@airframes/acars-decoder 1.9.3 → 1.9.4
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/bin/acars-decoder-test.js +158 -72
- package/dist/bin/acars-decoder-test.js.map +1 -1
- package/dist/bin/acars-decoder-test.mjs +158 -72
- package/dist/bin/acars-decoder-test.mjs.map +1 -1
- package/dist/bin/acars-decoder.js +158 -72
- package/dist/bin/acars-decoder.js.map +1 -1
- package/dist/bin/acars-decoder.mjs +158 -72
- package/dist/bin/acars-decoder.mjs.map +1 -1
- package/dist/index.js +158 -72
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +158 -72
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -904,6 +904,9 @@ var ResultFormatter = class {
|
|
|
904
904
|
}
|
|
905
905
|
}
|
|
906
906
|
static version(decodeResult, value) {
|
|
907
|
+
if (isNaN(value)) {
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
907
910
|
decodeResult.raw.version = value;
|
|
908
911
|
decodeResult.formatted.items.push({
|
|
909
912
|
type: "version",
|
|
@@ -940,6 +943,9 @@ var ResultFormatter = class {
|
|
|
940
943
|
});
|
|
941
944
|
}
|
|
942
945
|
static desiredAltitude(decodeResult, value) {
|
|
946
|
+
if (isNaN(value)) {
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
943
949
|
decodeResult.raw.desired_alt = value;
|
|
944
950
|
decodeResult.formatted.items.push({
|
|
945
951
|
type: "desired_altitude",
|
|
@@ -1514,6 +1520,9 @@ var Arinc702Helper = class _Arinc702Helper {
|
|
|
1514
1520
|
case "TD":
|
|
1515
1521
|
processTimeOfDeparture(decodeResult, data2.split(","));
|
|
1516
1522
|
break;
|
|
1523
|
+
case "TR":
|
|
1524
|
+
processTR(decodeResult, data2.split(","));
|
|
1525
|
+
break;
|
|
1517
1526
|
case "TS":
|
|
1518
1527
|
_Arinc702Helper.processTimeStamp(decodeResult, data2.split(","));
|
|
1519
1528
|
break;
|
|
@@ -1694,6 +1703,21 @@ function processLandingReport(decodeResult, data) {
|
|
|
1694
1703
|
ResultFormatter.unknown(decodeResult, data.join(","));
|
|
1695
1704
|
}
|
|
1696
1705
|
}
|
|
1706
|
+
function processTR(decodeResult, data) {
|
|
1707
|
+
if (data.length !== 21) {
|
|
1708
|
+
ResultFormatter.unknownArr(decodeResult, data, ",");
|
|
1709
|
+
return;
|
|
1710
|
+
}
|
|
1711
|
+
ResultFormatter.unknownArr(decodeResult, data.slice(0, 5), ",");
|
|
1712
|
+
ResultFormatter.off(decodeResult, DateTimeUtils.convertHHMMSSToTod(data[5]));
|
|
1713
|
+
ResultFormatter.unknownArr(decodeResult, data.slice(6, 11), ",");
|
|
1714
|
+
ResultFormatter.departureAirport(decodeResult, data[11]);
|
|
1715
|
+
ResultFormatter.arrivalAirport(decodeResult, data[12]);
|
|
1716
|
+
ResultFormatter.departureRunway(decodeResult, data[13]);
|
|
1717
|
+
ResultFormatter.unknownArr(decodeResult, data.slice(14, 16), ",");
|
|
1718
|
+
ResultFormatter.flightNumber(decodeResult, data[16]);
|
|
1719
|
+
ResultFormatter.unknownArr(decodeResult, data.slice(17), ",");
|
|
1720
|
+
}
|
|
1697
1721
|
function processCenterOfGravity(decodeResult, data) {
|
|
1698
1722
|
if (data.length === 1) {
|
|
1699
1723
|
if (data[0] !== void 0 && data[0] !== "") {
|
|
@@ -1754,6 +1778,8 @@ function processIMI(decodeResult, type) {
|
|
|
1754
1778
|
decodeResult.formatted.description = "Load Distribution Information";
|
|
1755
1779
|
} else if (type === "PER") {
|
|
1756
1780
|
decodeResult.formatted.description = "Performance Report";
|
|
1781
|
+
} else if (type === "PRF") {
|
|
1782
|
+
decodeResult.formatted.description = "Profile Report";
|
|
1757
1783
|
} else if (type === "POS") {
|
|
1758
1784
|
decodeResult.formatted.description = "Position Report";
|
|
1759
1785
|
} else if (type === "PRG") {
|
|
@@ -4779,91 +4805,60 @@ var Label_ColonComma = class extends DecoderPlugin {
|
|
|
4779
4805
|
}
|
|
4780
4806
|
};
|
|
4781
4807
|
|
|
4782
|
-
// lib/plugins/
|
|
4783
|
-
var
|
|
4784
|
-
name = "label-
|
|
4808
|
+
// lib/plugins/Label_H1_76401.ts
|
|
4809
|
+
var Label_H1_76401 = class extends DecoderPlugin {
|
|
4810
|
+
name = "label-h1-76401";
|
|
4785
4811
|
qualifiers() {
|
|
4786
4812
|
return {
|
|
4787
|
-
labels: ["
|
|
4788
|
-
preambles: ["
|
|
4813
|
+
labels: ["H1"],
|
|
4814
|
+
preambles: ["76401\r\n"]
|
|
4789
4815
|
};
|
|
4790
4816
|
}
|
|
4791
4817
|
decode(message, options = {}) {
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
decodeResult.message = message;
|
|
4796
|
-
const parts = message.text.split(" ");
|
|
4797
|
-
if (parts[parts.length - 1] !== "Q") {
|
|
4798
|
-
decodeResult.remaining.text = message.text;
|
|
4799
|
-
decodeResult.decoded = false;
|
|
4800
|
-
decodeResult.decoder.decodeLevel = "none";
|
|
4818
|
+
const decodeResult = this.initResult(message, "Position Report");
|
|
4819
|
+
const lines = message.text.split("\r\n");
|
|
4820
|
+
if (lines.length < 3) {
|
|
4801
4821
|
return decodeResult;
|
|
4802
4822
|
}
|
|
4803
|
-
|
|
4804
|
-
decodeResult.
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
const
|
|
4811
|
-
|
|
4812
|
-
|
|
4823
|
+
ResultFormatter.unknown(decodeResult, lines[0], "\r\n");
|
|
4824
|
+
ResultFormatter.unknown(decodeResult, lines[1].substring(0, 5), "\r\n");
|
|
4825
|
+
ResultFormatter.departureAirport(decodeResult, lines[1].substring(5, 9));
|
|
4826
|
+
ResultFormatter.arrivalAirport(decodeResult, lines[1].substring(9, 13));
|
|
4827
|
+
ResultFormatter.unknown(decodeResult, lines[1].substring(13), "");
|
|
4828
|
+
const waypoints = [];
|
|
4829
|
+
for (const line of lines.slice(2)) {
|
|
4830
|
+
const position = CoordinateUtils.decodeStringCoordinates(
|
|
4831
|
+
line.substring(0, 13)
|
|
4832
|
+
);
|
|
4833
|
+
if (position) {
|
|
4834
|
+
waypoints.push({
|
|
4835
|
+
name: CoordinateUtils.coordinateString(position),
|
|
4836
|
+
latitude: position.latitude,
|
|
4837
|
+
longitude: position.longitude,
|
|
4838
|
+
time: DateTimeUtils.convertHHMMSSToTod(line.substring(13, 19))
|
|
4839
|
+
});
|
|
4813
4840
|
} else {
|
|
4814
|
-
|
|
4841
|
+
ResultFormatter.unknown(decodeResult, line.substring(0, 19), "");
|
|
4815
4842
|
}
|
|
4843
|
+
ResultFormatter.unknown(decodeResult, line.substring(19), "\r\n");
|
|
4816
4844
|
}
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4845
|
+
ResultFormatter.route(decodeResult, { waypoints });
|
|
4846
|
+
if (waypoints.length > 0) {
|
|
4847
|
+
const lastWaypoint = waypoints[waypoints.length - 1];
|
|
4848
|
+
if (lastWaypoint.latitude !== void 0 && lastWaypoint.longitude !== void 0) {
|
|
4849
|
+
ResultFormatter.position(decodeResult, {
|
|
4850
|
+
latitude: lastWaypoint.latitude,
|
|
4851
|
+
longitude: lastWaypoint.longitude
|
|
4852
|
+
});
|
|
4822
4853
|
}
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
windData.push(wind);
|
|
4826
|
-
} else {
|
|
4827
|
-
decodeResult.remaining.text += (decodeResult.remaining.text ? " " : "") + part;
|
|
4854
|
+
if (lastWaypoint.time !== void 0) {
|
|
4855
|
+
ResultFormatter.timestamp(decodeResult, lastWaypoint.time);
|
|
4828
4856
|
}
|
|
4829
4857
|
}
|
|
4830
|
-
ResultFormatter.windData(decodeResult, windData);
|
|
4831
4858
|
decodeResult.decoded = true;
|
|
4832
|
-
decodeResult.decoder.decodeLevel =
|
|
4859
|
+
decodeResult.decoder.decodeLevel = "partial";
|
|
4833
4860
|
return decodeResult;
|
|
4834
4861
|
}
|
|
4835
|
-
parseWeatherReport(text) {
|
|
4836
|
-
const posString = text.substring(0, 13);
|
|
4837
|
-
const pos = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(posString);
|
|
4838
|
-
if (text.length !== 32 || !pos) {
|
|
4839
|
-
return null;
|
|
4840
|
-
}
|
|
4841
|
-
const tod = DateTimeUtils.convertHHMMSSToTod(text.substring(13, 17));
|
|
4842
|
-
const flightLevel = parseInt(text.substring(17, 20), 10);
|
|
4843
|
-
const tempSign = text[21] === "M" ? -1 : 1;
|
|
4844
|
-
const tempDegreesRaw = parseInt(text.substring(22, 25), 10);
|
|
4845
|
-
const tempDegrees = tempSign * (tempDegreesRaw / 10);
|
|
4846
|
-
const windDirection = parseInt(text.substring(25, 28), 10);
|
|
4847
|
-
const windSpeed = parseInt(text.substring(28, 31), 10);
|
|
4848
|
-
if (text[31] !== "G") {
|
|
4849
|
-
return null;
|
|
4850
|
-
}
|
|
4851
|
-
return {
|
|
4852
|
-
waypoint: {
|
|
4853
|
-
name: posString,
|
|
4854
|
-
latitude: pos.latitude,
|
|
4855
|
-
longitude: pos.longitude,
|
|
4856
|
-
time: tod
|
|
4857
|
-
},
|
|
4858
|
-
flightLevel,
|
|
4859
|
-
windDirection,
|
|
4860
|
-
windSpeed,
|
|
4861
|
-
temperature: {
|
|
4862
|
-
flightLevel,
|
|
4863
|
-
degreesC: tempDegrees
|
|
4864
|
-
}
|
|
4865
|
-
};
|
|
4866
|
-
}
|
|
4867
4862
|
};
|
|
4868
4863
|
|
|
4869
4864
|
// lib/plugins/Label_H1_ATIS.ts
|
|
@@ -5521,6 +5516,93 @@ var Label_H1_WRN = class extends DecoderPlugin {
|
|
|
5521
5516
|
}
|
|
5522
5517
|
};
|
|
5523
5518
|
|
|
5519
|
+
// lib/plugins/Label_H2_02E.ts
|
|
5520
|
+
var Label_H2_02E = class extends DecoderPlugin {
|
|
5521
|
+
name = "label-h2-02e";
|
|
5522
|
+
qualifiers() {
|
|
5523
|
+
return {
|
|
5524
|
+
labels: ["H2"],
|
|
5525
|
+
preambles: ["02E"]
|
|
5526
|
+
};
|
|
5527
|
+
}
|
|
5528
|
+
decode(message, options = {}) {
|
|
5529
|
+
let decodeResult = this.defaultResult();
|
|
5530
|
+
decodeResult.decoder.name = this.name;
|
|
5531
|
+
decodeResult.formatted.description = "Weather Report";
|
|
5532
|
+
decodeResult.message = message;
|
|
5533
|
+
const parts = message.text.split(" ");
|
|
5534
|
+
if (parts[parts.length - 1] !== "Q") {
|
|
5535
|
+
decodeResult.remaining.text = message.text;
|
|
5536
|
+
decodeResult.decoded = false;
|
|
5537
|
+
decodeResult.decoder.decodeLevel = "none";
|
|
5538
|
+
return decodeResult;
|
|
5539
|
+
}
|
|
5540
|
+
const windData = [];
|
|
5541
|
+
decodeResult.remaining.text = "";
|
|
5542
|
+
const header = parts[0];
|
|
5543
|
+
if (header.length === 45) {
|
|
5544
|
+
ResultFormatter.day(decodeResult, parseInt(header.substring(3, 5), 10));
|
|
5545
|
+
ResultFormatter.departureAirport(decodeResult, header.substring(5, 9));
|
|
5546
|
+
ResultFormatter.arrivalAirport(decodeResult, header.substring(9, 13));
|
|
5547
|
+
const firstWind = this.parseWeatherReport(header.substring(13));
|
|
5548
|
+
if (firstWind) {
|
|
5549
|
+
windData.push(firstWind);
|
|
5550
|
+
} else {
|
|
5551
|
+
decodeResult.remaining.text += (decodeResult.remaining.text ? " " : "") + header.substring(13);
|
|
5552
|
+
}
|
|
5553
|
+
}
|
|
5554
|
+
for (let i = 1; i < parts.length - 1; i++) {
|
|
5555
|
+
const part = parts[i];
|
|
5556
|
+
if (part[0] !== "Q") {
|
|
5557
|
+
decodeResult.remaining.text += (decodeResult.remaining.text ? " " : "") + part;
|
|
5558
|
+
continue;
|
|
5559
|
+
}
|
|
5560
|
+
const wind = this.parseWeatherReport(part.substring(1));
|
|
5561
|
+
if (wind) {
|
|
5562
|
+
windData.push(wind);
|
|
5563
|
+
} else {
|
|
5564
|
+
decodeResult.remaining.text += (decodeResult.remaining.text ? " " : "") + part;
|
|
5565
|
+
}
|
|
5566
|
+
}
|
|
5567
|
+
ResultFormatter.windData(decodeResult, windData);
|
|
5568
|
+
decodeResult.decoded = true;
|
|
5569
|
+
decodeResult.decoder.decodeLevel = decodeResult.remaining.text.length === 0 ? "full" : "partial";
|
|
5570
|
+
return decodeResult;
|
|
5571
|
+
}
|
|
5572
|
+
parseWeatherReport(text) {
|
|
5573
|
+
const posString = text.substring(0, 13);
|
|
5574
|
+
const pos = CoordinateUtils.decodeStringCoordinatesDecimalMinutes(posString);
|
|
5575
|
+
if (text.length !== 32 || !pos) {
|
|
5576
|
+
return null;
|
|
5577
|
+
}
|
|
5578
|
+
const tod = DateTimeUtils.convertHHMMSSToTod(text.substring(13, 17));
|
|
5579
|
+
const flightLevel = parseInt(text.substring(17, 20), 10);
|
|
5580
|
+
const tempSign = text[21] === "M" ? -1 : 1;
|
|
5581
|
+
const tempDegreesRaw = parseInt(text.substring(22, 25), 10);
|
|
5582
|
+
const tempDegrees = tempSign * (tempDegreesRaw / 10);
|
|
5583
|
+
const windDirection = parseInt(text.substring(25, 28), 10);
|
|
5584
|
+
const windSpeed = parseInt(text.substring(28, 31), 10);
|
|
5585
|
+
if (text[31] !== "G") {
|
|
5586
|
+
return null;
|
|
5587
|
+
}
|
|
5588
|
+
return {
|
|
5589
|
+
waypoint: {
|
|
5590
|
+
name: posString,
|
|
5591
|
+
latitude: pos.latitude,
|
|
5592
|
+
longitude: pos.longitude,
|
|
5593
|
+
time: tod
|
|
5594
|
+
},
|
|
5595
|
+
flightLevel,
|
|
5596
|
+
windDirection,
|
|
5597
|
+
windSpeed,
|
|
5598
|
+
temperature: {
|
|
5599
|
+
flightLevel,
|
|
5600
|
+
degreesC: tempDegrees
|
|
5601
|
+
}
|
|
5602
|
+
};
|
|
5603
|
+
}
|
|
5604
|
+
};
|
|
5605
|
+
|
|
5524
5606
|
// lib/plugins/Label_HX.ts
|
|
5525
5607
|
var Label_HX = class extends DecoderPlugin {
|
|
5526
5608
|
name = "label-hx";
|
|
@@ -5593,8 +5675,8 @@ function ascii85Decode(input) {
|
|
|
5593
5675
|
if (digit < 0 || digit > 84) return null;
|
|
5594
5676
|
value = value * 85 + digit;
|
|
5595
5677
|
}
|
|
5596
|
-
if (
|
|
5597
|
-
const v = value
|
|
5678
|
+
if (value > 4294967295) return null;
|
|
5679
|
+
const v = value;
|
|
5598
5680
|
const numBytes = chunkLen === 5 ? 4 : chunkLen - 1;
|
|
5599
5681
|
if (numBytes >= 1) output.push(v >>> 24 & 255);
|
|
5600
5682
|
if (numBytes >= 2) output.push(v >>> 16 & 255);
|
|
@@ -6856,7 +6938,7 @@ var pluginClasses = [
|
|
|
6856
6938
|
Label_4T_AGFSR,
|
|
6857
6939
|
Label_4T_ETA,
|
|
6858
6940
|
Label_B6_Forwardslash,
|
|
6859
|
-
|
|
6941
|
+
Label_H1_76401,
|
|
6860
6942
|
Label_H1_ATIS,
|
|
6861
6943
|
Label_H1_EZF,
|
|
6862
6944
|
Label_H1_FLR,
|
|
@@ -6866,6 +6948,7 @@ var pluginClasses = [
|
|
|
6866
6948
|
Label_H1_Paren,
|
|
6867
6949
|
Label_H1_WRN,
|
|
6868
6950
|
Label_H1_StarPOS,
|
|
6951
|
+
Label_H2_02E,
|
|
6869
6952
|
Label_HX,
|
|
6870
6953
|
Label_58,
|
|
6871
6954
|
Label_80,
|
|
@@ -6911,6 +6994,9 @@ var MessageDecoder = class {
|
|
|
6911
6994
|
this.wildcardSet.add(plugin);
|
|
6912
6995
|
const wildcardInsertIndex = this.wildcardEntries.length - 1;
|
|
6913
6996
|
for (const bucket of this.candidatesByLabel.values()) {
|
|
6997
|
+
if (bucket.some((e) => e.plugin === plugin)) {
|
|
6998
|
+
continue;
|
|
6999
|
+
}
|
|
6914
7000
|
bucket.splice(wildcardInsertIndex, 0, entry);
|
|
6915
7001
|
}
|
|
6916
7002
|
}
|