@airframes/acars-decoder 1.6.4 → 1.6.6
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 +57 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +57 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1574,6 +1574,59 @@ function addChecksum(decodeResult, value) {
|
|
|
1574
1574
|
});
|
|
1575
1575
|
}
|
|
1576
1576
|
|
|
1577
|
+
// lib/plugins/Label_H1_OHMA.ts
|
|
1578
|
+
var zlib = __toESM(require("minizlib"));
|
|
1579
|
+
var Label_H1_OHMA = class extends DecoderPlugin {
|
|
1580
|
+
name = "label-h1-ohma";
|
|
1581
|
+
qualifiers() {
|
|
1582
|
+
return {
|
|
1583
|
+
labels: ["H1"],
|
|
1584
|
+
preambles: ["OHMA", "/RTNBOCR.OHMA", "#T1B/RTNBOCR.OHMA"]
|
|
1585
|
+
};
|
|
1586
|
+
}
|
|
1587
|
+
decode(message, options = {}) {
|
|
1588
|
+
let decodeResult = this.defaultResult;
|
|
1589
|
+
decodeResult.decoder.name = this.name;
|
|
1590
|
+
decodeResult.formatted.description = "OHMA Message";
|
|
1591
|
+
decodeResult.message = message;
|
|
1592
|
+
decodeResult.remaining.text = "";
|
|
1593
|
+
const data = message.text.split("OHMA")[1];
|
|
1594
|
+
try {
|
|
1595
|
+
const compressedBuffer = Buffer.from(data, "base64");
|
|
1596
|
+
const decompress = new zlib.Inflate({ windowBits: 15 });
|
|
1597
|
+
decompress.write(compressedBuffer);
|
|
1598
|
+
decompress.flush(zlib.constants.Z_SYNC_FLUSH);
|
|
1599
|
+
const result = decompress.read();
|
|
1600
|
+
const jsonText = result.toString();
|
|
1601
|
+
const json = JSON.parse(jsonText);
|
|
1602
|
+
let formattedMsg;
|
|
1603
|
+
if (json.message.startsWith("{")) {
|
|
1604
|
+
const ohmaMsg = JSON.parse(json.message);
|
|
1605
|
+
formattedMsg = JSON.stringify(ohmaMsg, null, 2);
|
|
1606
|
+
} else {
|
|
1607
|
+
formattedMsg = json.message;
|
|
1608
|
+
}
|
|
1609
|
+
decodeResult.decoded = true;
|
|
1610
|
+
decodeResult.decoder.decodeLevel = "full";
|
|
1611
|
+
decodeResult.raw.ohma = jsonText;
|
|
1612
|
+
decodeResult.formatted.items.push({
|
|
1613
|
+
type: "ohma",
|
|
1614
|
+
code: "OHMA",
|
|
1615
|
+
label: "OHMA Downlink",
|
|
1616
|
+
value: formattedMsg
|
|
1617
|
+
});
|
|
1618
|
+
} catch (e) {
|
|
1619
|
+
if (options.debug) {
|
|
1620
|
+
console.log(`Decoder: Unknown H1 OHMA message: ${message.text}`, e);
|
|
1621
|
+
}
|
|
1622
|
+
decodeResult.remaining.text += message.text;
|
|
1623
|
+
decodeResult.decoded = false;
|
|
1624
|
+
decodeResult.decoder.decodeLevel = "none";
|
|
1625
|
+
}
|
|
1626
|
+
return decodeResult;
|
|
1627
|
+
}
|
|
1628
|
+
};
|
|
1629
|
+
|
|
1577
1630
|
// lib/plugins/Label_H1_POS.ts
|
|
1578
1631
|
var Label_H1_POS = class extends DecoderPlugin {
|
|
1579
1632
|
name = "label-h1-pos";
|
|
@@ -2147,7 +2200,7 @@ var Label_QQ = class extends DecoderPlugin {
|
|
|
2147
2200
|
|
|
2148
2201
|
// lib/utils/miam.ts
|
|
2149
2202
|
var Base85 = __toESM(require("base85"));
|
|
2150
|
-
var
|
|
2203
|
+
var zlib2 = __toESM(require("minizlib"));
|
|
2151
2204
|
var MIAMCoreV1CRCLength = 4;
|
|
2152
2205
|
var MIAMCoreV2CRCLength = 2;
|
|
2153
2206
|
var MIAMCoreUtils = class {
|
|
@@ -2857,9 +2910,9 @@ var MIAMCoreUtils = class {
|
|
|
2857
2910
|
if (body !== void 0 && body.length > 0) {
|
|
2858
2911
|
if ([1 /* Deflate */, 1 /* Deflate */].indexOf(pduCompression) >= 0) {
|
|
2859
2912
|
try {
|
|
2860
|
-
const decompress = new
|
|
2913
|
+
const decompress = new zlib2.InflateRaw({ windowBits: 15 });
|
|
2861
2914
|
decompress.write(body);
|
|
2862
|
-
decompress.flush(
|
|
2915
|
+
decompress.flush(zlib2.constants.Z_SYNC_FLUSH);
|
|
2863
2916
|
pduData = decompress.read();
|
|
2864
2917
|
} catch (e) {
|
|
2865
2918
|
pduErrors.push("Inflation failed for body: " + e);
|
|
@@ -2971,6 +3024,7 @@ var MessageDecoder = class {
|
|
|
2971
3024
|
this.registerPlugin(new Label_44_POS(this));
|
|
2972
3025
|
this.registerPlugin(new Label_B6_Forwardslash(this));
|
|
2973
3026
|
this.registerPlugin(new Label_H1_FPN(this));
|
|
3027
|
+
this.registerPlugin(new Label_H1_OHMA(this));
|
|
2974
3028
|
this.registerPlugin(new Label_H1_POS(this));
|
|
2975
3029
|
this.registerPlugin(new Label_H1_WRN(this));
|
|
2976
3030
|
this.registerPlugin(new Label_80(this));
|