@airframes/acars-decoder 1.6.3 → 1.6.5
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 +226 -69
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +226 -69
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -1240,12 +1240,19 @@ var RouteUtils = class _RouteUtils {
|
|
|
1240
1240
|
if (waypoint.latitude && waypoint.longitude) {
|
|
1241
1241
|
s += `(${CoordinateUtils.coordinateString({ latitude: waypoint.latitude, longitude: waypoint.longitude })})`;
|
|
1242
1242
|
}
|
|
1243
|
+
if (waypoint.offset) {
|
|
1244
|
+
s += `[${waypoint.offset.bearing}\xB0 ${waypoint.offset.distance}nm]`;
|
|
1245
|
+
}
|
|
1243
1246
|
if (waypoint.time && waypoint.timeFormat) {
|
|
1244
1247
|
s += `@${_RouteUtils.timestampToString(waypoint.time, waypoint.timeFormat)}`;
|
|
1245
1248
|
}
|
|
1246
1249
|
return s;
|
|
1247
1250
|
}
|
|
1248
1251
|
static getWaypoint(leg) {
|
|
1252
|
+
const regex = leg.match(/^([A-Z]+)(\d{3})-(\d{4})$/);
|
|
1253
|
+
if (regex?.length == 4) {
|
|
1254
|
+
return { name: regex[1], offset: { bearing: parseInt(regex[2]), distance: parseInt(regex[3]) / 10 } };
|
|
1255
|
+
}
|
|
1249
1256
|
const waypoint = leg.split(",");
|
|
1250
1257
|
if (waypoint.length == 2) {
|
|
1251
1258
|
const position = CoordinateUtils.decodeStringCoordinates(waypoint[1]);
|
|
@@ -1253,10 +1260,11 @@ var RouteUtils = class _RouteUtils {
|
|
|
1253
1260
|
return { name: waypoint[0], latitude: position.latitude, longitude: position.longitude };
|
|
1254
1261
|
}
|
|
1255
1262
|
}
|
|
1256
|
-
if (leg.length == 14) {
|
|
1263
|
+
if (leg.length == 13 || leg.length == 14) {
|
|
1257
1264
|
const position = CoordinateUtils.decodeStringCoordinates(leg);
|
|
1265
|
+
const name = waypoint.length == 2 ? waypoint[0] : "";
|
|
1258
1266
|
if (position) {
|
|
1259
|
-
return { name
|
|
1267
|
+
return { name, latitude: position.latitude, longitude: position.longitude };
|
|
1260
1268
|
}
|
|
1261
1269
|
}
|
|
1262
1270
|
return { name: leg };
|
|
@@ -1317,7 +1325,7 @@ var FlightPlanUtils = class {
|
|
|
1317
1325
|
addRoute(decodeResult, value);
|
|
1318
1326
|
break;
|
|
1319
1327
|
case "R":
|
|
1320
|
-
|
|
1328
|
+
addRunway(decodeResult, value);
|
|
1321
1329
|
break;
|
|
1322
1330
|
default:
|
|
1323
1331
|
if (allKnownFields) {
|
|
@@ -1331,41 +1339,106 @@ var FlightPlanUtils = class {
|
|
|
1331
1339
|
return allKnownFields;
|
|
1332
1340
|
}
|
|
1333
1341
|
};
|
|
1342
|
+
function parseMessageType(decodeResult, messageType) {
|
|
1343
|
+
let decoded = true;
|
|
1344
|
+
const parts = messageType.split("#");
|
|
1345
|
+
if (parts.length == 1) {
|
|
1346
|
+
if (parts[0].startsWith("POS") && parts[0].length !== 3 && !parts[0].startsWith("POS/")) {
|
|
1347
|
+
decoded = processPosition(decodeResult, parts[0].substring(3));
|
|
1348
|
+
}
|
|
1349
|
+
return decoded;
|
|
1350
|
+
} else if (parts.length == 2) {
|
|
1351
|
+
if (parts[0].length > 0) {
|
|
1352
|
+
decodeResult.remaining.text += parts[0].substring(0, 3);
|
|
1353
|
+
decodeResult.raw.flight_number = parts[0].substring(3);
|
|
1354
|
+
decodeResult.remaining.text += "#" + parts[1].substring(0, 3);
|
|
1355
|
+
}
|
|
1356
|
+
if (parts[1].substring(3, 6) === "POS" && parts[1].length !== 6 && parts[1].substring(3, 7) !== "POS/") {
|
|
1357
|
+
decoded = processPosition(decodeResult, parts[1].substring(6));
|
|
1358
|
+
}
|
|
1359
|
+
decodeResult.raw.message_type = messageType;
|
|
1360
|
+
return decoded;
|
|
1361
|
+
}
|
|
1362
|
+
decodeResult.remaining.text += messageType;
|
|
1363
|
+
return false;
|
|
1364
|
+
}
|
|
1334
1365
|
function parseHeader(decodeResult, header) {
|
|
1335
1366
|
let allKnownFields = true;
|
|
1336
1367
|
const fields = header.split("/");
|
|
1337
|
-
|
|
1368
|
+
allKnownFields = allKnownFields && parseMessageType(decodeResult, fields[0]);
|
|
1369
|
+
for (let i = 1; i < fields.length; ++i) {
|
|
1338
1370
|
if (fields[i].startsWith("FN")) {
|
|
1339
1371
|
decodeResult.raw.flight_number = fields[i].substring(2);
|
|
1340
1372
|
} else if (fields[i].startsWith("SN")) {
|
|
1341
1373
|
decodeResult.raw.serial_number = fields[i].substring(2);
|
|
1342
1374
|
} else if (fields[i].startsWith("TS")) {
|
|
1343
1375
|
const ts = fields[i].substring(2).split(",");
|
|
1344
|
-
|
|
1376
|
+
let time = DateTimeUtils.convertDateTimeToEpoch(ts[0], ts[1]);
|
|
1377
|
+
if (Number.isNaN(time)) {
|
|
1378
|
+
const date = ts[1].substring(2, 4) + ts[1].substring(0, 2) + ts[1].substring(4, 6);
|
|
1379
|
+
time = DateTimeUtils.convertDateTimeToEpoch(ts[0], date);
|
|
1380
|
+
}
|
|
1381
|
+
decodeResult.raw.message_timestamp = time;
|
|
1382
|
+
} else if (fields[i].startsWith("PS")) {
|
|
1383
|
+
const pos = fields[i].substring(2);
|
|
1384
|
+
allKnownFields == allKnownFields && processPosition(decodeResult, pos);
|
|
1385
|
+
} else if (fields[i].startsWith("DT")) {
|
|
1386
|
+
const icao = fields[i].substring(2);
|
|
1387
|
+
decodeResult.raw.arrival_icao = icao;
|
|
1388
|
+
decodeResult.formatted.items.push({
|
|
1389
|
+
type: "destination",
|
|
1390
|
+
code: "DST",
|
|
1391
|
+
label: "Destination",
|
|
1392
|
+
value: decodeResult.raw.arrival_icao
|
|
1393
|
+
});
|
|
1394
|
+
} else if (fields[i].startsWith("RF")) {
|
|
1395
|
+
decodeResult.formatted.items.push({
|
|
1396
|
+
type: "status",
|
|
1397
|
+
code: "ROUTE_STATUS",
|
|
1398
|
+
label: "Route Status",
|
|
1399
|
+
value: "Route Filed"
|
|
1400
|
+
});
|
|
1401
|
+
decodeResult.raw.route_status = "RF";
|
|
1402
|
+
if (fields[i].length > 2) {
|
|
1403
|
+
addRoute(decodeResult, fields[i].substring(2));
|
|
1404
|
+
}
|
|
1405
|
+
} else if (fields[i] == "RP") {
|
|
1406
|
+
decodeResult.raw.route_status = "RP";
|
|
1407
|
+
decodeResult.formatted.items.push({
|
|
1408
|
+
type: "status",
|
|
1409
|
+
code: "ROUTE_STATUS",
|
|
1410
|
+
label: "Route Status",
|
|
1411
|
+
value: "Route Planned"
|
|
1412
|
+
});
|
|
1413
|
+
decodeResult.raw.route_status = fields[i];
|
|
1414
|
+
} else if (fields[i] == "RI") {
|
|
1415
|
+
decodeResult.raw.route_status = "RI";
|
|
1416
|
+
decodeResult.formatted.items.push({
|
|
1417
|
+
type: "status",
|
|
1418
|
+
code: "ROUTE_STATUS",
|
|
1419
|
+
label: "Route Status",
|
|
1420
|
+
value: "Route Inactive"
|
|
1421
|
+
});
|
|
1345
1422
|
} else {
|
|
1346
1423
|
decodeResult.remaining.text += "/" + fields[i];
|
|
1347
1424
|
allKnownFields = false;
|
|
1348
1425
|
}
|
|
1349
1426
|
}
|
|
1350
|
-
decodeResult.raw.route_status = fields[fields.length - 1];
|
|
1351
|
-
var text;
|
|
1352
|
-
if (decodeResult.raw.route_status == "RP") {
|
|
1353
|
-
text = "Route Planned";
|
|
1354
|
-
} else if (decodeResult.raw.route_status == "RI") {
|
|
1355
|
-
text = "Route Inactive";
|
|
1356
|
-
} else if (decodeResult.raw.route_status == "RF") {
|
|
1357
|
-
text = "Route Filed";
|
|
1358
|
-
} else {
|
|
1359
|
-
text = decodeResult.raw.route_status;
|
|
1360
|
-
}
|
|
1361
|
-
decodeResult.formatted.items.push({
|
|
1362
|
-
type: "status",
|
|
1363
|
-
code: "ROUTE_STATUS",
|
|
1364
|
-
label: "Route Status",
|
|
1365
|
-
value: text
|
|
1366
|
-
});
|
|
1367
1427
|
return allKnownFields;
|
|
1368
1428
|
}
|
|
1429
|
+
function processPosition(decodeResult, value) {
|
|
1430
|
+
const position = CoordinateUtils.decodeStringCoordinates(value);
|
|
1431
|
+
if (position) {
|
|
1432
|
+
decodeResult.raw.position = position;
|
|
1433
|
+
decodeResult.formatted.items.push({
|
|
1434
|
+
type: "aircraft_position",
|
|
1435
|
+
code: "POS",
|
|
1436
|
+
label: "Aircraft Position",
|
|
1437
|
+
value: CoordinateUtils.coordinateString(position)
|
|
1438
|
+
});
|
|
1439
|
+
}
|
|
1440
|
+
return !!position;
|
|
1441
|
+
}
|
|
1369
1442
|
function addArrivalAirport(decodeResult, value) {
|
|
1370
1443
|
decodeResult.raw.arrival_icao = value;
|
|
1371
1444
|
decodeResult.formatted.items.push({
|
|
@@ -1384,12 +1457,20 @@ function addDepartureAirport(decodeResult, value) {
|
|
|
1384
1457
|
value: decodeResult.raw.departure_icao
|
|
1385
1458
|
});
|
|
1386
1459
|
}
|
|
1387
|
-
function
|
|
1388
|
-
|
|
1460
|
+
function addRunway(decodeResult, value) {
|
|
1461
|
+
if (value.length === 8) {
|
|
1462
|
+
decodeResult.raw.arrival_runway = value.substring(4, 7);
|
|
1463
|
+
decodeResult.formatted.items.push({
|
|
1464
|
+
type: "runway",
|
|
1465
|
+
label: "Arrival Runway",
|
|
1466
|
+
value: decodeResult.raw.arrival_runway
|
|
1467
|
+
});
|
|
1468
|
+
}
|
|
1469
|
+
decodeResult.raw.departure_runway = value.substring(0, 3);
|
|
1389
1470
|
decodeResult.formatted.items.push({
|
|
1390
1471
|
type: "runway",
|
|
1391
|
-
label: "Runway",
|
|
1392
|
-
value: decodeResult.raw.
|
|
1472
|
+
label: "Departure Runway",
|
|
1473
|
+
value: decodeResult.raw.departure_runway
|
|
1393
1474
|
});
|
|
1394
1475
|
}
|
|
1395
1476
|
function addRoute(decodeResult, value) {
|
|
@@ -1493,13 +1574,66 @@ function addChecksum(decodeResult, value) {
|
|
|
1493
1574
|
});
|
|
1494
1575
|
}
|
|
1495
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
|
+
|
|
1496
1630
|
// lib/plugins/Label_H1_POS.ts
|
|
1497
1631
|
var Label_H1_POS = class extends DecoderPlugin {
|
|
1498
1632
|
name = "label-h1-pos";
|
|
1499
1633
|
qualifiers() {
|
|
1500
1634
|
return {
|
|
1501
1635
|
labels: ["H1"],
|
|
1502
|
-
preambles: ["POS", "#M1BPOS"]
|
|
1636
|
+
preambles: ["POS", "#M1BPOS", "/.POS"]
|
|
1503
1637
|
//TODO - support data before #
|
|
1504
1638
|
};
|
|
1505
1639
|
}
|
|
@@ -1508,29 +1642,25 @@ var Label_H1_POS = class extends DecoderPlugin {
|
|
|
1508
1642
|
decodeResult.decoder.name = this.name;
|
|
1509
1643
|
decodeResult.formatted.description = "Position Report";
|
|
1510
1644
|
decodeResult.message = message;
|
|
1645
|
+
decodeResult.remaining.text = "";
|
|
1511
1646
|
const checksum = message.text.slice(-4);
|
|
1512
|
-
const
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
})
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
}
|
|
1528
|
-
processChecksum(decodeResult, checksum);
|
|
1529
|
-
decodeResult.decoded = true;
|
|
1530
|
-
decodeResult.decoder.decodeLevel = "full";
|
|
1647
|
+
const header = findHeader(message.text.slice(0, -4));
|
|
1648
|
+
const decoded = FlightPlanUtils.processFlightPlan(decodeResult, header.split(":"));
|
|
1649
|
+
const parts = message.text.replace(header, "").slice(0, -4).split(",");
|
|
1650
|
+
if (parts.length == 1) {
|
|
1651
|
+
if (decoded) {
|
|
1652
|
+
processChecksum(decodeResult, checksum);
|
|
1653
|
+
decodeResult.decoded = true;
|
|
1654
|
+
decodeResult.decoder.decodeLevel = "full";
|
|
1655
|
+
} else if (decodeResult.remaining.text.length > 0) {
|
|
1656
|
+
processChecksum(decodeResult, checksum);
|
|
1657
|
+
decodeResult.decoded = true;
|
|
1658
|
+
decodeResult.decoder.decodeLevel = "partial";
|
|
1659
|
+
} else {
|
|
1660
|
+
decodeResult.decoded = false;
|
|
1661
|
+
decodeResult.decoder.decodeLevel = "none";
|
|
1662
|
+
}
|
|
1531
1663
|
} else if (parts.length === 10) {
|
|
1532
|
-
decodeResult.remaining.text = "";
|
|
1533
|
-
processPosition(decodeResult, parts[0]);
|
|
1534
1664
|
processAlt(decodeResult, parts[3]);
|
|
1535
1665
|
processRoute(decodeResult, parts[1], parts[2], parts[4], parts[5], parts[6]);
|
|
1536
1666
|
processTemp(decodeResult, parts[7]);
|
|
@@ -1540,8 +1670,6 @@ var Label_H1_POS = class extends DecoderPlugin {
|
|
|
1540
1670
|
decodeResult.decoded = true;
|
|
1541
1671
|
decodeResult.decoder.decodeLevel = "partial";
|
|
1542
1672
|
} else if (parts.length === 11) {
|
|
1543
|
-
decodeResult.remaining.text = "";
|
|
1544
|
-
processPosition(decodeResult, parts[0]);
|
|
1545
1673
|
processAlt(decodeResult, parts[3]);
|
|
1546
1674
|
processRoute(decodeResult, parts[1], parts[2], parts[4], parts[5], parts[6], parts[10]);
|
|
1547
1675
|
processTemp(decodeResult, parts[7]);
|
|
@@ -1550,9 +1678,18 @@ var Label_H1_POS = class extends DecoderPlugin {
|
|
|
1550
1678
|
processChecksum(decodeResult, checksum);
|
|
1551
1679
|
decodeResult.decoded = true;
|
|
1552
1680
|
decodeResult.decoder.decodeLevel = "partial";
|
|
1681
|
+
} else if (parts.length === 12) {
|
|
1682
|
+
const date = parts[11].substring(2, 4) + parts[11].substring(0, 2) + parts[11].substring(4, 6);
|
|
1683
|
+
processUnknown(decodeResult, parts[3]);
|
|
1684
|
+
processRoute(decodeResult, parts[1], parts[2], parts[4], parts[5], parts[6], date);
|
|
1685
|
+
processTemp(decodeResult, parts[7]);
|
|
1686
|
+
processUnknown(decodeResult, parts[8]);
|
|
1687
|
+
processUnknown(decodeResult, parts[9]);
|
|
1688
|
+
processUnknown(decodeResult, parts[10]);
|
|
1689
|
+
processChecksum(decodeResult, checksum);
|
|
1690
|
+
decodeResult.decoded = true;
|
|
1691
|
+
decodeResult.decoder.decodeLevel = "partial";
|
|
1553
1692
|
} else if (parts.length === 14) {
|
|
1554
|
-
decodeResult.remaining.text = "";
|
|
1555
|
-
processPosition(decodeResult, parts[0]);
|
|
1556
1693
|
processAlt(decodeResult, parts[3]);
|
|
1557
1694
|
processRoute(decodeResult, parts[1], parts[2], parts[4], parts[5], parts[6]);
|
|
1558
1695
|
processTemp(decodeResult, parts[7]);
|
|
@@ -1566,8 +1703,6 @@ var Label_H1_POS = class extends DecoderPlugin {
|
|
|
1566
1703
|
decodeResult.decoded = true;
|
|
1567
1704
|
decodeResult.decoder.decodeLevel = "partial";
|
|
1568
1705
|
} else if (parts.length === 15) {
|
|
1569
|
-
decodeResult.remaining.text = "";
|
|
1570
|
-
processUnknown(decodeResult, parts[0]);
|
|
1571
1706
|
processUnknown(decodeResult, parts[1]);
|
|
1572
1707
|
let date = void 0;
|
|
1573
1708
|
if (parts[2].startsWith("/DC")) {
|
|
@@ -1580,7 +1715,7 @@ var Label_H1_POS = class extends DecoderPlugin {
|
|
|
1580
1715
|
for (let i = 0; i < fields.length; ++i) {
|
|
1581
1716
|
const field = fields[i];
|
|
1582
1717
|
if (field.startsWith("PS")) {
|
|
1583
|
-
|
|
1718
|
+
processPosition2(decodeResult, field.substring(2));
|
|
1584
1719
|
} else {
|
|
1585
1720
|
if (i === 0) {
|
|
1586
1721
|
processUnknown(decodeResult, field);
|
|
@@ -1599,9 +1734,16 @@ var Label_H1_POS = class extends DecoderPlugin {
|
|
|
1599
1734
|
processChecksum(decodeResult, checksum);
|
|
1600
1735
|
decodeResult.decoded = true;
|
|
1601
1736
|
decodeResult.decoder.decodeLevel = "partial";
|
|
1737
|
+
} else if (parts.length === 21) {
|
|
1738
|
+
processRunway(decodeResult, parts[1]);
|
|
1739
|
+
processUnknown(decodeResult, parts.slice(2, 11).join(","));
|
|
1740
|
+
processTemp(decodeResult, parts[11]);
|
|
1741
|
+
processUnknown(decodeResult, parts.slice(12, 20).join(","));
|
|
1742
|
+
FlightPlanUtils.processFlightPlan(decodeResult, parts[20].split(":"));
|
|
1743
|
+
processChecksum(decodeResult, checksum);
|
|
1744
|
+
decodeResult.decoded = true;
|
|
1745
|
+
decodeResult.decoder.decodeLevel = "partial";
|
|
1602
1746
|
} else if (parts.length === 32) {
|
|
1603
|
-
decodeResult.remaining.text = "";
|
|
1604
|
-
processPosition(decodeResult, parts[0]);
|
|
1605
1747
|
processRunway(decodeResult, parts[1]);
|
|
1606
1748
|
const time = parts[2];
|
|
1607
1749
|
processUnknown(decodeResult, parts[3]);
|
|
@@ -1626,7 +1768,7 @@ var Label_H1_POS = class extends DecoderPlugin {
|
|
|
1626
1768
|
if (options.debug) {
|
|
1627
1769
|
console.log(`Decoder: Unknown H1 message: ${message.text}`);
|
|
1628
1770
|
}
|
|
1629
|
-
decodeResult.remaining.text
|
|
1771
|
+
decodeResult.remaining.text += message.text;
|
|
1630
1772
|
decodeResult.decoded = false;
|
|
1631
1773
|
decodeResult.decoder.decodeLevel = "none";
|
|
1632
1774
|
}
|
|
@@ -1636,7 +1778,7 @@ var Label_H1_POS = class extends DecoderPlugin {
|
|
|
1636
1778
|
function processUnknown(decodeResult, value) {
|
|
1637
1779
|
decodeResult.remaining.text += "," + value;
|
|
1638
1780
|
}
|
|
1639
|
-
function
|
|
1781
|
+
function processPosition2(decodeResult, value) {
|
|
1640
1782
|
const position = CoordinateUtils.decodeStringCoordinates(value);
|
|
1641
1783
|
if (position) {
|
|
1642
1784
|
decodeResult.raw.position = position;
|
|
@@ -1667,11 +1809,11 @@ function processTemp(decodeResult, value) {
|
|
|
1667
1809
|
});
|
|
1668
1810
|
}
|
|
1669
1811
|
function processRunway(decodeResult, value) {
|
|
1670
|
-
decodeResult.raw.
|
|
1812
|
+
decodeResult.raw.arrival_runway = value.replace("RW", "");
|
|
1671
1813
|
decodeResult.formatted.items.push({
|
|
1672
1814
|
type: "runway",
|
|
1673
|
-
label: "Runway",
|
|
1674
|
-
value: decodeResult.raw.
|
|
1815
|
+
label: "Arrival Runway",
|
|
1816
|
+
value: decodeResult.raw.arrival_runway
|
|
1675
1817
|
});
|
|
1676
1818
|
}
|
|
1677
1819
|
function processGndspd(decodeResult, value) {
|
|
@@ -1684,14 +1826,17 @@ function processGndspd(decodeResult, value) {
|
|
|
1684
1826
|
});
|
|
1685
1827
|
}
|
|
1686
1828
|
function processRoute(decodeResult, last, time, next, eta, then, date) {
|
|
1687
|
-
const lastCoords = CoordinateUtils.decodeStringCoordinates(last);
|
|
1688
|
-
const nextCoords = CoordinateUtils.decodeStringCoordinates(next);
|
|
1689
1829
|
const lastTime = date ? DateTimeUtils.convertDateTimeToEpoch(time, date) : DateTimeUtils.convertHHMMSSToTod(time);
|
|
1690
1830
|
const nextTime = date ? DateTimeUtils.convertDateTimeToEpoch(eta, date) : DateTimeUtils.convertHHMMSSToTod(eta);
|
|
1691
1831
|
const timeFormat = date ? "epoch" : "tod";
|
|
1692
|
-
const lastWaypoint =
|
|
1693
|
-
|
|
1694
|
-
|
|
1832
|
+
const lastWaypoint = RouteUtils.getWaypoint(last);
|
|
1833
|
+
lastWaypoint.time = lastTime;
|
|
1834
|
+
lastWaypoint.timeFormat = timeFormat;
|
|
1835
|
+
const nextWaypoint = RouteUtils.getWaypoint(next);
|
|
1836
|
+
nextWaypoint.time = nextTime;
|
|
1837
|
+
nextWaypoint.timeFormat = timeFormat;
|
|
1838
|
+
const thenWaypoint = RouteUtils.getWaypoint(then || "?");
|
|
1839
|
+
const waypoints = [lastWaypoint, nextWaypoint, thenWaypoint];
|
|
1695
1840
|
decodeResult.raw.route = { waypoints };
|
|
1696
1841
|
decodeResult.formatted.items.push({
|
|
1697
1842
|
type: "aircraft_route",
|
|
@@ -1709,6 +1854,14 @@ function processChecksum(decodeResult, value) {
|
|
|
1709
1854
|
value: "0x" + ("0000" + decodeResult.raw.checksum.toString(16)).slice(-4)
|
|
1710
1855
|
});
|
|
1711
1856
|
}
|
|
1857
|
+
function findHeader(text) {
|
|
1858
|
+
const parts = text.split(",");
|
|
1859
|
+
const header = parts[0];
|
|
1860
|
+
if (header.indexOf("/TS") === -1) {
|
|
1861
|
+
return header;
|
|
1862
|
+
}
|
|
1863
|
+
return parts[0] + "," + parts[1];
|
|
1864
|
+
}
|
|
1712
1865
|
|
|
1713
1866
|
// lib/plugins/Label_H1_WRN.ts
|
|
1714
1867
|
var Label_H1_WRN = class extends DecoderPlugin {
|
|
@@ -2047,7 +2200,7 @@ var Label_QQ = class extends DecoderPlugin {
|
|
|
2047
2200
|
|
|
2048
2201
|
// lib/utils/miam.ts
|
|
2049
2202
|
var Base85 = __toESM(require("base85"));
|
|
2050
|
-
var
|
|
2203
|
+
var zlib2 = __toESM(require("minizlib"));
|
|
2051
2204
|
var MIAMCoreV1CRCLength = 4;
|
|
2052
2205
|
var MIAMCoreV2CRCLength = 2;
|
|
2053
2206
|
var MIAMCoreUtils = class {
|
|
@@ -2757,7 +2910,10 @@ var MIAMCoreUtils = class {
|
|
|
2757
2910
|
if (body !== void 0 && body.length > 0) {
|
|
2758
2911
|
if ([1 /* Deflate */, 1 /* Deflate */].indexOf(pduCompression) >= 0) {
|
|
2759
2912
|
try {
|
|
2760
|
-
|
|
2913
|
+
const decompress = new zlib2.InflateRaw({ windowBits: 15 });
|
|
2914
|
+
decompress.write(body);
|
|
2915
|
+
decompress.flush(zlib2.constants.Z_SYNC_FLUSH);
|
|
2916
|
+
pduData = decompress.read();
|
|
2761
2917
|
} catch (e) {
|
|
2762
2918
|
pduErrors.push("Inflation failed for body: " + e);
|
|
2763
2919
|
}
|
|
@@ -2868,6 +3024,7 @@ var MessageDecoder = class {
|
|
|
2868
3024
|
this.registerPlugin(new Label_44_POS(this));
|
|
2869
3025
|
this.registerPlugin(new Label_B6_Forwardslash(this));
|
|
2870
3026
|
this.registerPlugin(new Label_H1_FPN(this));
|
|
3027
|
+
this.registerPlugin(new Label_H1_OHMA(this));
|
|
2871
3028
|
this.registerPlugin(new Label_H1_POS(this));
|
|
2872
3029
|
this.registerPlugin(new Label_H1_WRN(this));
|
|
2873
3030
|
this.registerPlugin(new Label_80(this));
|