@airframes/acars-decoder 1.8.2 → 1.8.3
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 +239 -83
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +243 -87
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -475,6 +475,15 @@ var ResultFormatter = class {
|
|
|
475
475
|
value: decodeResult.raw.fuel_on_board.toString()
|
|
476
476
|
});
|
|
477
477
|
}
|
|
478
|
+
static burnedFuel(decodeResult, value) {
|
|
479
|
+
decodeResult.raw.fuel_burned = value;
|
|
480
|
+
decodeResult.formatted.items.push({
|
|
481
|
+
type: "fuel_burned",
|
|
482
|
+
code: "FB",
|
|
483
|
+
label: "Fuel Burned",
|
|
484
|
+
value: decodeResult.raw.fuel_burned.toString()
|
|
485
|
+
});
|
|
486
|
+
}
|
|
478
487
|
static remainingFuel(decodeResult, value) {
|
|
479
488
|
decodeResult.raw.fuel_remaining = value;
|
|
480
489
|
decodeResult.formatted.items.push({
|
|
@@ -650,6 +659,24 @@ var ResultFormatter = class {
|
|
|
650
659
|
value: text
|
|
651
660
|
});
|
|
652
661
|
}
|
|
662
|
+
static mac(decodeResult, mac) {
|
|
663
|
+
decodeResult.raw.mac = mac;
|
|
664
|
+
decodeResult.formatted.items.push({
|
|
665
|
+
type: "mac",
|
|
666
|
+
code: "MAC",
|
|
667
|
+
label: "Mean Aerodynamic Chord",
|
|
668
|
+
value: `${mac} %`
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
static trim(decodeResult, trim) {
|
|
672
|
+
decodeResult.raw.trim = trim;
|
|
673
|
+
decodeResult.formatted.items.push({
|
|
674
|
+
type: "trim",
|
|
675
|
+
code: "TRIM",
|
|
676
|
+
label: "Trim",
|
|
677
|
+
value: `${trim} units`
|
|
678
|
+
});
|
|
679
|
+
}
|
|
653
680
|
static windData(decodeResult, windData) {
|
|
654
681
|
decodeResult.raw.wind_data = windData;
|
|
655
682
|
for (const wind of windData) {
|
|
@@ -665,6 +692,46 @@ var ResultFormatter = class {
|
|
|
665
692
|
});
|
|
666
693
|
}
|
|
667
694
|
}
|
|
695
|
+
static cg(decodeResult, value, type = "center") {
|
|
696
|
+
switch (type) {
|
|
697
|
+
case "center":
|
|
698
|
+
decodeResult.raw.center_of_gravity = value;
|
|
699
|
+
decodeResult.formatted.items.push({
|
|
700
|
+
type: "center_of_gravity",
|
|
701
|
+
code: "CG",
|
|
702
|
+
label: "Center of Gravity",
|
|
703
|
+
value: `${decodeResult.raw.center_of_gravity} %`
|
|
704
|
+
});
|
|
705
|
+
break;
|
|
706
|
+
case "lower":
|
|
707
|
+
decodeResult.raw.cg_lower_limit = value;
|
|
708
|
+
decodeResult.formatted.items.push({
|
|
709
|
+
type: "cg_lower_limit",
|
|
710
|
+
code: "CG_LOWER",
|
|
711
|
+
label: "Center of Gravity Lower Limit",
|
|
712
|
+
value: `${decodeResult.raw.cg_lower_limit} %`
|
|
713
|
+
});
|
|
714
|
+
break;
|
|
715
|
+
case "upper":
|
|
716
|
+
decodeResult.raw.cg_upper_limit = value;
|
|
717
|
+
decodeResult.formatted.items.push({
|
|
718
|
+
type: "cg_upper_limit",
|
|
719
|
+
code: "CG_UPPER",
|
|
720
|
+
label: "Center of Gravity Upper Limit",
|
|
721
|
+
value: `${decodeResult.raw.cg_upper_limit} %`
|
|
722
|
+
});
|
|
723
|
+
break;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
static version(decodeResult, value) {
|
|
727
|
+
decodeResult.raw.version = value;
|
|
728
|
+
decodeResult.formatted.items.push({
|
|
729
|
+
type: "version",
|
|
730
|
+
code: "VERSION",
|
|
731
|
+
label: "Message Version",
|
|
732
|
+
value: `v${decodeResult.raw.version.toFixed(1)}`
|
|
733
|
+
});
|
|
734
|
+
}
|
|
668
735
|
static unknown(decodeResult, value, sep = ",") {
|
|
669
736
|
if (!decodeResult.remaining.text)
|
|
670
737
|
decodeResult.remaining.text = value;
|
|
@@ -1498,6 +1565,14 @@ var FlightPlanUtils = class _FlightPlanUtils {
|
|
|
1498
1565
|
label: "Route Status",
|
|
1499
1566
|
value: "Route Inactive"
|
|
1500
1567
|
});
|
|
1568
|
+
} else if (header.startsWith("RM")) {
|
|
1569
|
+
decodeResult.raw.route_status = "RM";
|
|
1570
|
+
decodeResult.formatted.items.push({
|
|
1571
|
+
type: "status",
|
|
1572
|
+
code: "ROUTE_STATUS",
|
|
1573
|
+
label: "Route Status",
|
|
1574
|
+
value: "Route Mapped"
|
|
1575
|
+
});
|
|
1501
1576
|
} else {
|
|
1502
1577
|
decodeResult.remaining.text += header;
|
|
1503
1578
|
allKnownFields = false;
|
|
@@ -1573,6 +1648,11 @@ var H1Helper = class _H1Helper {
|
|
|
1573
1648
|
static decodeH1Message(decodeResult, message) {
|
|
1574
1649
|
const checksum = message.slice(-4);
|
|
1575
1650
|
const data = message.slice(0, message.length - 4);
|
|
1651
|
+
if (calculateChecksum(data) !== checksum) {
|
|
1652
|
+
decodeResult.decoded = false;
|
|
1653
|
+
decodeResult.decoder.decodeLevel = "none";
|
|
1654
|
+
return false;
|
|
1655
|
+
}
|
|
1576
1656
|
const fields = data.split("/");
|
|
1577
1657
|
const canDecode = parseMessageType(decodeResult, fields[0]);
|
|
1578
1658
|
if (!canDecode) {
|
|
@@ -1581,53 +1661,71 @@ var H1Helper = class _H1Helper {
|
|
|
1581
1661
|
return false;
|
|
1582
1662
|
}
|
|
1583
1663
|
for (let i = 1; i < fields.length; ++i) {
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
ResultFormatter.
|
|
1619
|
-
|
|
1664
|
+
const key = fields[i].substring(0, 2);
|
|
1665
|
+
const data2 = fields[i].substring(2);
|
|
1666
|
+
switch (key) {
|
|
1667
|
+
case "AF":
|
|
1668
|
+
processAirField(decodeResult, data2.split(","));
|
|
1669
|
+
break;
|
|
1670
|
+
case "CG":
|
|
1671
|
+
processCenterOfGravity(decodeResult, data2.split(","));
|
|
1672
|
+
break;
|
|
1673
|
+
case "DC":
|
|
1674
|
+
processDateCode(decodeResult, data2.split(","));
|
|
1675
|
+
break;
|
|
1676
|
+
case "DT":
|
|
1677
|
+
processDT(decodeResult, data2.split(","));
|
|
1678
|
+
break;
|
|
1679
|
+
case "ET":
|
|
1680
|
+
processETA(data2, decodeResult, fields, i);
|
|
1681
|
+
break;
|
|
1682
|
+
case "FB":
|
|
1683
|
+
ResultFormatter.currentFuel(decodeResult, parseInt(data2, 10));
|
|
1684
|
+
break;
|
|
1685
|
+
case "FN":
|
|
1686
|
+
decodeResult.raw.flight_number = data2;
|
|
1687
|
+
break;
|
|
1688
|
+
case "FX":
|
|
1689
|
+
ResultFormatter.freetext(decodeResult, data2);
|
|
1690
|
+
break;
|
|
1691
|
+
case "ID":
|
|
1692
|
+
processIdentification(decodeResult, data2.split(","));
|
|
1693
|
+
break;
|
|
1694
|
+
case "LR":
|
|
1695
|
+
processLandingReport(decodeResult, data2.split(","));
|
|
1696
|
+
break;
|
|
1697
|
+
case "PR":
|
|
1698
|
+
ResultFormatter.unknown(decodeResult, fields[i], "/");
|
|
1699
|
+
break;
|
|
1700
|
+
case "PS":
|
|
1701
|
+
_H1Helper.processPS(decodeResult, data2.split(","));
|
|
1702
|
+
break;
|
|
1703
|
+
case "RF":
|
|
1704
|
+
case "RI":
|
|
1705
|
+
case "RM":
|
|
1706
|
+
case "RP":
|
|
1707
|
+
FlightPlanUtils.processFlightPlan(decodeResult, fields[i].split(":"));
|
|
1708
|
+
break;
|
|
1709
|
+
case "SN":
|
|
1710
|
+
decodeResult.raw.serial_number = data2;
|
|
1711
|
+
break;
|
|
1712
|
+
case "TD":
|
|
1713
|
+
processTimeOfDeparture(decodeResult, data2.split(","));
|
|
1714
|
+
break;
|
|
1715
|
+
case "TS":
|
|
1716
|
+
_H1Helper.processTimeStamp(decodeResult, data2.split(","));
|
|
1717
|
+
break;
|
|
1718
|
+
case "VR":
|
|
1719
|
+
ResultFormatter.version(decodeResult, parseInt(data2, 10) / 10);
|
|
1720
|
+
break;
|
|
1721
|
+
case "WD":
|
|
1722
|
+
processWindData(decodeResult, data2);
|
|
1723
|
+
break;
|
|
1724
|
+
default:
|
|
1620
1725
|
ResultFormatter.unknown(decodeResult, fields[i], "/");
|
|
1621
|
-
}
|
|
1622
|
-
} else if (fields[i].startsWith("WD")) {
|
|
1623
|
-
processWindData(decodeResult, fields[i].substring(2));
|
|
1624
|
-
} else {
|
|
1625
|
-
ResultFormatter.unknown(decodeResult, fields[i], "/");
|
|
1626
1726
|
}
|
|
1627
1727
|
}
|
|
1628
|
-
|
|
1629
|
-
ResultFormatter.checksum(decodeResult, checksum);
|
|
1630
|
-
}
|
|
1728
|
+
ResultFormatter.checksum(decodeResult, checksum);
|
|
1631
1729
|
return true;
|
|
1632
1730
|
}
|
|
1633
1731
|
static processPS(decodeResult, data) {
|
|
@@ -1671,16 +1769,26 @@ var H1Helper = class _H1Helper {
|
|
|
1671
1769
|
ResultFormatter.unknownArr(decodeResult, data.slice(10));
|
|
1672
1770
|
}
|
|
1673
1771
|
}
|
|
1674
|
-
static
|
|
1772
|
+
static processTimeStamp(decodeResult, data) {
|
|
1675
1773
|
let time = DateTimeUtils.convertDateTimeToEpoch(data[0], data[1]);
|
|
1676
1774
|
if (Number.isNaN(time)) {
|
|
1677
1775
|
const date = data[1].substring(2, 4) + data[1].substring(0, 2) + data[1].substring(4, 6);
|
|
1678
1776
|
time = DateTimeUtils.convertDateTimeToEpoch(data[0], date);
|
|
1679
1777
|
}
|
|
1680
|
-
decodeResult.raw.message_date = data[1];
|
|
1681
1778
|
decodeResult.raw.message_timestamp = time;
|
|
1682
1779
|
}
|
|
1683
1780
|
};
|
|
1781
|
+
function processETA(data, decodeResult, fields, i) {
|
|
1782
|
+
if (data.length === 5) {
|
|
1783
|
+
ResultFormatter.day(decodeResult, Number(data.substring(0, 1)));
|
|
1784
|
+
ResultFormatter.eta(decodeResult, DateTimeUtils.convertHHMMSSToTod(data.substring(1)));
|
|
1785
|
+
} else if (data.length === 6) {
|
|
1786
|
+
ResultFormatter.day(decodeResult, Number(data.substring(0, 2)));
|
|
1787
|
+
ResultFormatter.eta(decodeResult, DateTimeUtils.convertHHMMSSToTod(data.substring(2)));
|
|
1788
|
+
} else {
|
|
1789
|
+
ResultFormatter.unknown(decodeResult, fields[i], "/");
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1684
1792
|
function processAirField(decodeResult, data) {
|
|
1685
1793
|
if (data.length === 2) {
|
|
1686
1794
|
ResultFormatter.departureAirport(decodeResult, data[0]);
|
|
@@ -1740,7 +1848,7 @@ function processDT(decodeResult, data) {
|
|
|
1740
1848
|
ResultFormatter.unknownArr(decodeResult, data);
|
|
1741
1849
|
}
|
|
1742
1850
|
}
|
|
1743
|
-
function
|
|
1851
|
+
function processLandingReport(decodeResult, data) {
|
|
1744
1852
|
if (data.length === 19) {
|
|
1745
1853
|
ResultFormatter.unknown(decodeResult, data[1]);
|
|
1746
1854
|
ResultFormatter.flightNumber(decodeResult, data[2]);
|
|
@@ -1752,35 +1860,37 @@ function processLR(decodeResult, data) {
|
|
|
1752
1860
|
ResultFormatter.unknown(decodeResult, data.join(","));
|
|
1753
1861
|
}
|
|
1754
1862
|
}
|
|
1755
|
-
function
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
if (parts[0].length > 0) {
|
|
1771
|
-
ResultFormatter.unknown(decodeResult, parts[0].substring(0, 4));
|
|
1772
|
-
ResultFormatter.flightNumber(decodeResult, parts[0].substring(4));
|
|
1773
|
-
ResultFormatter.unknown(decodeResult, parts[1].length == 5 ? parts[1].substring(0, 2) : parts[1].substring(0, 3), "#");
|
|
1774
|
-
}
|
|
1775
|
-
const type = parts[1].length == 5 ? parts[1].substring(2, 5) : parts[1].substring(3, 6);
|
|
1776
|
-
if (parts[1].substring(3, 6) === "POS" && parts[1].length > 6) {
|
|
1777
|
-
H1Helper.processPosition(decodeResult, parts[1].substring(6).split(","));
|
|
1778
|
-
}
|
|
1779
|
-
return processMessageType(decodeResult, type);
|
|
1863
|
+
function processCenterOfGravity(decodeResult, data) {
|
|
1864
|
+
if (data.length === 1) {
|
|
1865
|
+
if (data[0] !== void 0 && data[0] !== "") {
|
|
1866
|
+
ResultFormatter.cg(decodeResult, parseInt(data[0], 10) / 10);
|
|
1867
|
+
}
|
|
1868
|
+
} else if (data.length === 3) {
|
|
1869
|
+
if (data[0] !== void 0 && data[0] !== "") {
|
|
1870
|
+
ResultFormatter.cg(decodeResult, parseInt(data[0], 10) / 10, "center");
|
|
1871
|
+
}
|
|
1872
|
+
if (data[1] !== void 0 && data[1] !== "") {
|
|
1873
|
+
ResultFormatter.cg(decodeResult, parseInt(data[1], 10) / 10, "lower");
|
|
1874
|
+
}
|
|
1875
|
+
if (data[2] !== void 0 && data[2] !== "") {
|
|
1876
|
+
ResultFormatter.cg(decodeResult, parseInt(data[2], 10) / 10, "upper");
|
|
1877
|
+
}
|
|
1780
1878
|
} else {
|
|
1781
|
-
ResultFormatter.unknown(decodeResult,
|
|
1782
|
-
|
|
1879
|
+
ResultFormatter.unknown(decodeResult, data.join(","));
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
function parseMessageType(decodeResult, messageType) {
|
|
1883
|
+
if (messageType.startsWith("POS")) {
|
|
1884
|
+
H1Helper.processPosition(decodeResult, messageType.substring(3).split(","));
|
|
1885
|
+
return processMessageType(decodeResult, "POS");
|
|
1886
|
+
} else if (messageType.length === 13) {
|
|
1887
|
+
if (processMessageType(decodeResult, messageType.substring(10))) {
|
|
1888
|
+
ResultFormatter.unknown(decodeResult, messageType.substring(0, 4));
|
|
1889
|
+
ResultFormatter.flightNumber(decodeResult, messageType.slice(4, 10));
|
|
1890
|
+
return true;
|
|
1891
|
+
}
|
|
1783
1892
|
}
|
|
1893
|
+
return processMessageType(decodeResult, messageType.substring(0, 3));
|
|
1784
1894
|
}
|
|
1785
1895
|
function processMessageType(decodeResult, type) {
|
|
1786
1896
|
if (type === "FPN") {
|
|
@@ -1789,19 +1899,21 @@ function processMessageType(decodeResult, type) {
|
|
|
1789
1899
|
decodeResult.formatted.description = "Free Text";
|
|
1790
1900
|
} else if (type === "INI") {
|
|
1791
1901
|
decodeResult.formatted.description = "Flight Plan Initial Report";
|
|
1902
|
+
} else if (type === "PER") {
|
|
1903
|
+
decodeResult.formatted.description = "Performance Report";
|
|
1792
1904
|
} else if (type === "POS") {
|
|
1793
1905
|
decodeResult.formatted.description = "Position Report";
|
|
1794
1906
|
} else if (type === "PRG") {
|
|
1795
1907
|
decodeResult.formatted.description = "Progress Report";
|
|
1796
1908
|
} else if (type === "PWI") {
|
|
1797
|
-
decodeResult.formatted.description = "Weather
|
|
1909
|
+
decodeResult.formatted.description = "Pilot Weather Information";
|
|
1798
1910
|
} else {
|
|
1799
1911
|
decodeResult.formatted.description = "Unknown H1 Message";
|
|
1800
1912
|
return false;
|
|
1801
1913
|
}
|
|
1802
1914
|
return true;
|
|
1803
1915
|
}
|
|
1804
|
-
function
|
|
1916
|
+
function processDateCode(decodeResult, data) {
|
|
1805
1917
|
decodeResult.raw.message_date = data[0];
|
|
1806
1918
|
if (data.length === 1) {
|
|
1807
1919
|
} else if (data.length === 2) {
|
|
@@ -1866,6 +1978,26 @@ function processWindData(decodeResult, message) {
|
|
|
1866
1978
|
});
|
|
1867
1979
|
ResultFormatter.windData(decodeResult, wind);
|
|
1868
1980
|
}
|
|
1981
|
+
function calculateChecksum(data) {
|
|
1982
|
+
let crc = 65535;
|
|
1983
|
+
const bytes = Buffer.from(data, "ascii");
|
|
1984
|
+
for (const byte of bytes) {
|
|
1985
|
+
crc ^= byte;
|
|
1986
|
+
for (let i = 0; i < 8; i++) {
|
|
1987
|
+
if ((crc & 1) !== 0) {
|
|
1988
|
+
crc = crc >>> 1 ^ 33800;
|
|
1989
|
+
} else {
|
|
1990
|
+
crc = crc >>> 1;
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
crc = (crc ^ 65535) & 65535;
|
|
1995
|
+
const nibble1 = crc >> 12 & 15;
|
|
1996
|
+
const nibble2 = crc >> 8 & 15;
|
|
1997
|
+
const nibble3 = crc >> 4 & 15;
|
|
1998
|
+
const nibble4 = crc & 15;
|
|
1999
|
+
return `${nibble4.toString(16)}${nibble3.toString(16)}${nibble2.toString(16)}${nibble1.toString(16)}`.toUpperCase();
|
|
2000
|
+
}
|
|
1869
2001
|
|
|
1870
2002
|
// lib/plugins/Label_1J_2J_FTX.ts
|
|
1871
2003
|
var Label_1J_2J_FTX = class extends DecoderPlugin {
|
|
@@ -1880,7 +2012,14 @@ var Label_1J_2J_FTX = class extends DecoderPlugin {
|
|
|
1880
2012
|
decodeResult.decoder.name = this.name;
|
|
1881
2013
|
decodeResult.message = message;
|
|
1882
2014
|
const msg = message.text.replace(/\n|\r/g, "");
|
|
1883
|
-
const
|
|
2015
|
+
const parts = msg.split("/");
|
|
2016
|
+
let decoded = false;
|
|
2017
|
+
if (parts[0].length > 3) {
|
|
2018
|
+
decoded = H1Helper.decodeH1Message(decodeResult, msg.slice(parts[0].length - 3));
|
|
2019
|
+
decodeResult.remaining.text = parts[0].slice(0, 3) + "/" + decodeResult.remaining.text;
|
|
2020
|
+
} else {
|
|
2021
|
+
decoded = H1Helper.decodeH1Message(decodeResult, msg);
|
|
2022
|
+
}
|
|
1884
2023
|
decodeResult.decoded = decoded;
|
|
1885
2024
|
decodeResult.decoder.decodeLevel = !decodeResult.remaining.text ? "full" : "partial";
|
|
1886
2025
|
if (decodeResult.formatted.items.length === 0) {
|
|
@@ -2425,7 +2564,6 @@ var Label_2P_FM3 = class extends DecoderPlugin {
|
|
|
2425
2564
|
ResultFormatter.unknown(decodeResult, header[0].substring(0, 4));
|
|
2426
2565
|
ResultFormatter.flightNumber(decodeResult, header[0].substring(4));
|
|
2427
2566
|
}
|
|
2428
|
-
console.log(header[1]);
|
|
2429
2567
|
if (header[1].length === 4) {
|
|
2430
2568
|
ResultFormatter.time_of_day(decodeResult, DateTimeUtils.convertHHMMSSToTod(header[1]));
|
|
2431
2569
|
} else {
|
|
@@ -2569,7 +2707,14 @@ var Label_2P_POS = class extends DecoderPlugin {
|
|
|
2569
2707
|
decodeResult.decoder.name = this.name;
|
|
2570
2708
|
decodeResult.message = message;
|
|
2571
2709
|
const msg = message.text.replace(/\n|\r/g, "");
|
|
2572
|
-
const
|
|
2710
|
+
const parts = msg.split("/");
|
|
2711
|
+
let decoded = false;
|
|
2712
|
+
if (parts[0].length > 3) {
|
|
2713
|
+
decoded = H1Helper.decodeH1Message(decodeResult, msg.slice(parts[0].length - 3));
|
|
2714
|
+
decodeResult.remaining.text = parts[0].slice(0, 3) + "/" + decodeResult.remaining.text;
|
|
2715
|
+
} else {
|
|
2716
|
+
decoded = H1Helper.decodeH1Message(decodeResult, msg);
|
|
2717
|
+
}
|
|
2573
2718
|
decodeResult.decoded = decoded;
|
|
2574
2719
|
decodeResult.decoder.decodeLevel = !decodeResult.remaining.text ? "full" : "partial";
|
|
2575
2720
|
if (decodeResult.formatted.items.length === 0) {
|
|
@@ -3702,7 +3847,18 @@ var Label_H1 = class extends DecoderPlugin {
|
|
|
3702
3847
|
decodeResult.decoder.name = this.name;
|
|
3703
3848
|
decodeResult.message = message;
|
|
3704
3849
|
const msg = message.text.replace(/\n|\r/g, "");
|
|
3705
|
-
const
|
|
3850
|
+
const parts = msg.split("#");
|
|
3851
|
+
let decoded = false;
|
|
3852
|
+
if (parts.length === 1) {
|
|
3853
|
+
decoded = H1Helper.decodeH1Message(decodeResult, msg);
|
|
3854
|
+
} else if (parts.length == 2) {
|
|
3855
|
+
const offset = isNaN(parseInt(parts[1][1])) ? 3 : 4;
|
|
3856
|
+
decoded = H1Helper.decodeH1Message(decodeResult, msg.slice(parts[0].length + offset));
|
|
3857
|
+
if (decoded && parts[0].length > 0) {
|
|
3858
|
+
ResultFormatter.flightNumber(decodeResult, parts[0].substring(4));
|
|
3859
|
+
decodeResult.remaining.text = parts[0].substring(0, 4) + "#" + parts[1].substring(0, offset - 1) + "/" + decodeResult.remaining.text;
|
|
3860
|
+
}
|
|
3861
|
+
}
|
|
3706
3862
|
decodeResult.decoded = decoded;
|
|
3707
3863
|
decodeResult.decoder.decodeLevel = !decodeResult.remaining.text ? "full" : "partial";
|
|
3708
3864
|
if (decodeResult.formatted.items.length === 0) {
|
|
@@ -3855,7 +4011,7 @@ var Label_H1_FLR = class extends DecoderPlugin {
|
|
|
3855
4011
|
|
|
3856
4012
|
// lib/plugins/Label_H1_OHMA.ts
|
|
3857
4013
|
import * as zlib from "minizlib";
|
|
3858
|
-
import { Buffer } from "buffer";
|
|
4014
|
+
import { Buffer as Buffer2 } from "buffer";
|
|
3859
4015
|
var Label_H1_OHMA = class extends DecoderPlugin {
|
|
3860
4016
|
name = "label-h1-ohma";
|
|
3861
4017
|
qualifiers() {
|
|
@@ -3871,12 +4027,12 @@ var Label_H1_OHMA = class extends DecoderPlugin {
|
|
|
3871
4027
|
decodeResult.message = message;
|
|
3872
4028
|
const data = message.text.split("OHMA")[1];
|
|
3873
4029
|
try {
|
|
3874
|
-
const compressedBuffer =
|
|
3875
|
-
const decompress = new zlib.Inflate({
|
|
4030
|
+
const compressedBuffer = Buffer2.from(data, "base64");
|
|
4031
|
+
const decompress = new zlib.Inflate({});
|
|
3876
4032
|
decompress.write(compressedBuffer);
|
|
3877
4033
|
decompress.flush(zlib.constants.Z_SYNC_FLUSH);
|
|
3878
4034
|
const result = decompress.read();
|
|
3879
|
-
const jsonText = result
|
|
4035
|
+
const jsonText = result?.toString() || "";
|
|
3880
4036
|
let formattedMsg;
|
|
3881
4037
|
let jsonMessage;
|
|
3882
4038
|
try {
|
|
@@ -3947,7 +4103,7 @@ var Label_H1_Slash = class extends DecoderPlugin {
|
|
|
3947
4103
|
for (let i = 2; i < fields.length; i++) {
|
|
3948
4104
|
const field = fields[i];
|
|
3949
4105
|
if (field.startsWith("TS")) {
|
|
3950
|
-
H1Helper.
|
|
4106
|
+
H1Helper.processTimeStamp(decodeResult, field.substring(2, 15).split(","));
|
|
3951
4107
|
} else if (field.startsWith("PS")) {
|
|
3952
4108
|
H1Helper.processPS(decodeResult, field.substring(2).split(","));
|
|
3953
4109
|
} else {
|
|
@@ -4336,7 +4492,7 @@ var Label_QQ = class extends DecoderPlugin {
|
|
|
4336
4492
|
// lib/utils/miam.ts
|
|
4337
4493
|
import * as Base85 from "base85";
|
|
4338
4494
|
import * as zlib2 from "minizlib";
|
|
4339
|
-
import { Buffer as
|
|
4495
|
+
import { Buffer as Buffer3 } from "buffer";
|
|
4340
4496
|
var MIAMCoreV1CRCLength = 4;
|
|
4341
4497
|
var MIAMCoreV2CRCLength = 2;
|
|
4342
4498
|
var MIAMCoreUtils = class {
|
|
@@ -4407,7 +4563,7 @@ var MIAMCoreUtils = class {
|
|
|
4407
4563
|
body = body.subarray(0, body.length - bpadValue);
|
|
4408
4564
|
}
|
|
4409
4565
|
} else if (bpad === "-") {
|
|
4410
|
-
body =
|
|
4566
|
+
body = Buffer3.from(rawBody);
|
|
4411
4567
|
}
|
|
4412
4568
|
}
|
|
4413
4569
|
hdr = hdr.subarray(0, hdr.length - hpad);
|