@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.mjs
CHANGED
|
@@ -1203,12 +1203,19 @@ var RouteUtils = class _RouteUtils {
|
|
|
1203
1203
|
if (waypoint.latitude && waypoint.longitude) {
|
|
1204
1204
|
s += `(${CoordinateUtils.coordinateString({ latitude: waypoint.latitude, longitude: waypoint.longitude })})`;
|
|
1205
1205
|
}
|
|
1206
|
+
if (waypoint.offset) {
|
|
1207
|
+
s += `[${waypoint.offset.bearing}\xB0 ${waypoint.offset.distance}nm]`;
|
|
1208
|
+
}
|
|
1206
1209
|
if (waypoint.time && waypoint.timeFormat) {
|
|
1207
1210
|
s += `@${_RouteUtils.timestampToString(waypoint.time, waypoint.timeFormat)}`;
|
|
1208
1211
|
}
|
|
1209
1212
|
return s;
|
|
1210
1213
|
}
|
|
1211
1214
|
static getWaypoint(leg) {
|
|
1215
|
+
const regex = leg.match(/^([A-Z]+)(\d{3})-(\d{4})$/);
|
|
1216
|
+
if (regex?.length == 4) {
|
|
1217
|
+
return { name: regex[1], offset: { bearing: parseInt(regex[2]), distance: parseInt(regex[3]) / 10 } };
|
|
1218
|
+
}
|
|
1212
1219
|
const waypoint = leg.split(",");
|
|
1213
1220
|
if (waypoint.length == 2) {
|
|
1214
1221
|
const position = CoordinateUtils.decodeStringCoordinates(waypoint[1]);
|
|
@@ -1216,10 +1223,11 @@ var RouteUtils = class _RouteUtils {
|
|
|
1216
1223
|
return { name: waypoint[0], latitude: position.latitude, longitude: position.longitude };
|
|
1217
1224
|
}
|
|
1218
1225
|
}
|
|
1219
|
-
if (leg.length == 14) {
|
|
1226
|
+
if (leg.length == 13 || leg.length == 14) {
|
|
1220
1227
|
const position = CoordinateUtils.decodeStringCoordinates(leg);
|
|
1228
|
+
const name = waypoint.length == 2 ? waypoint[0] : "";
|
|
1221
1229
|
if (position) {
|
|
1222
|
-
return { name
|
|
1230
|
+
return { name, latitude: position.latitude, longitude: position.longitude };
|
|
1223
1231
|
}
|
|
1224
1232
|
}
|
|
1225
1233
|
return { name: leg };
|
|
@@ -1280,7 +1288,7 @@ var FlightPlanUtils = class {
|
|
|
1280
1288
|
addRoute(decodeResult, value);
|
|
1281
1289
|
break;
|
|
1282
1290
|
case "R":
|
|
1283
|
-
|
|
1291
|
+
addRunway(decodeResult, value);
|
|
1284
1292
|
break;
|
|
1285
1293
|
default:
|
|
1286
1294
|
if (allKnownFields) {
|
|
@@ -1294,41 +1302,106 @@ var FlightPlanUtils = class {
|
|
|
1294
1302
|
return allKnownFields;
|
|
1295
1303
|
}
|
|
1296
1304
|
};
|
|
1305
|
+
function parseMessageType(decodeResult, messageType) {
|
|
1306
|
+
let decoded = true;
|
|
1307
|
+
const parts = messageType.split("#");
|
|
1308
|
+
if (parts.length == 1) {
|
|
1309
|
+
if (parts[0].startsWith("POS") && parts[0].length !== 3 && !parts[0].startsWith("POS/")) {
|
|
1310
|
+
decoded = processPosition(decodeResult, parts[0].substring(3));
|
|
1311
|
+
}
|
|
1312
|
+
return decoded;
|
|
1313
|
+
} else if (parts.length == 2) {
|
|
1314
|
+
if (parts[0].length > 0) {
|
|
1315
|
+
decodeResult.remaining.text += parts[0].substring(0, 3);
|
|
1316
|
+
decodeResult.raw.flight_number = parts[0].substring(3);
|
|
1317
|
+
decodeResult.remaining.text += "#" + parts[1].substring(0, 3);
|
|
1318
|
+
}
|
|
1319
|
+
if (parts[1].substring(3, 6) === "POS" && parts[1].length !== 6 && parts[1].substring(3, 7) !== "POS/") {
|
|
1320
|
+
decoded = processPosition(decodeResult, parts[1].substring(6));
|
|
1321
|
+
}
|
|
1322
|
+
decodeResult.raw.message_type = messageType;
|
|
1323
|
+
return decoded;
|
|
1324
|
+
}
|
|
1325
|
+
decodeResult.remaining.text += messageType;
|
|
1326
|
+
return false;
|
|
1327
|
+
}
|
|
1297
1328
|
function parseHeader(decodeResult, header) {
|
|
1298
1329
|
let allKnownFields = true;
|
|
1299
1330
|
const fields = header.split("/");
|
|
1300
|
-
|
|
1331
|
+
allKnownFields = allKnownFields && parseMessageType(decodeResult, fields[0]);
|
|
1332
|
+
for (let i = 1; i < fields.length; ++i) {
|
|
1301
1333
|
if (fields[i].startsWith("FN")) {
|
|
1302
1334
|
decodeResult.raw.flight_number = fields[i].substring(2);
|
|
1303
1335
|
} else if (fields[i].startsWith("SN")) {
|
|
1304
1336
|
decodeResult.raw.serial_number = fields[i].substring(2);
|
|
1305
1337
|
} else if (fields[i].startsWith("TS")) {
|
|
1306
1338
|
const ts = fields[i].substring(2).split(",");
|
|
1307
|
-
|
|
1339
|
+
let time = DateTimeUtils.convertDateTimeToEpoch(ts[0], ts[1]);
|
|
1340
|
+
if (Number.isNaN(time)) {
|
|
1341
|
+
const date = ts[1].substring(2, 4) + ts[1].substring(0, 2) + ts[1].substring(4, 6);
|
|
1342
|
+
time = DateTimeUtils.convertDateTimeToEpoch(ts[0], date);
|
|
1343
|
+
}
|
|
1344
|
+
decodeResult.raw.message_timestamp = time;
|
|
1345
|
+
} else if (fields[i].startsWith("PS")) {
|
|
1346
|
+
const pos = fields[i].substring(2);
|
|
1347
|
+
allKnownFields == allKnownFields && processPosition(decodeResult, pos);
|
|
1348
|
+
} else if (fields[i].startsWith("DT")) {
|
|
1349
|
+
const icao = fields[i].substring(2);
|
|
1350
|
+
decodeResult.raw.arrival_icao = icao;
|
|
1351
|
+
decodeResult.formatted.items.push({
|
|
1352
|
+
type: "destination",
|
|
1353
|
+
code: "DST",
|
|
1354
|
+
label: "Destination",
|
|
1355
|
+
value: decodeResult.raw.arrival_icao
|
|
1356
|
+
});
|
|
1357
|
+
} else if (fields[i].startsWith("RF")) {
|
|
1358
|
+
decodeResult.formatted.items.push({
|
|
1359
|
+
type: "status",
|
|
1360
|
+
code: "ROUTE_STATUS",
|
|
1361
|
+
label: "Route Status",
|
|
1362
|
+
value: "Route Filed"
|
|
1363
|
+
});
|
|
1364
|
+
decodeResult.raw.route_status = "RF";
|
|
1365
|
+
if (fields[i].length > 2) {
|
|
1366
|
+
addRoute(decodeResult, fields[i].substring(2));
|
|
1367
|
+
}
|
|
1368
|
+
} else if (fields[i] == "RP") {
|
|
1369
|
+
decodeResult.raw.route_status = "RP";
|
|
1370
|
+
decodeResult.formatted.items.push({
|
|
1371
|
+
type: "status",
|
|
1372
|
+
code: "ROUTE_STATUS",
|
|
1373
|
+
label: "Route Status",
|
|
1374
|
+
value: "Route Planned"
|
|
1375
|
+
});
|
|
1376
|
+
decodeResult.raw.route_status = fields[i];
|
|
1377
|
+
} else if (fields[i] == "RI") {
|
|
1378
|
+
decodeResult.raw.route_status = "RI";
|
|
1379
|
+
decodeResult.formatted.items.push({
|
|
1380
|
+
type: "status",
|
|
1381
|
+
code: "ROUTE_STATUS",
|
|
1382
|
+
label: "Route Status",
|
|
1383
|
+
value: "Route Inactive"
|
|
1384
|
+
});
|
|
1308
1385
|
} else {
|
|
1309
1386
|
decodeResult.remaining.text += "/" + fields[i];
|
|
1310
1387
|
allKnownFields = false;
|
|
1311
1388
|
}
|
|
1312
1389
|
}
|
|
1313
|
-
decodeResult.raw.route_status = fields[fields.length - 1];
|
|
1314
|
-
var text;
|
|
1315
|
-
if (decodeResult.raw.route_status == "RP") {
|
|
1316
|
-
text = "Route Planned";
|
|
1317
|
-
} else if (decodeResult.raw.route_status == "RI") {
|
|
1318
|
-
text = "Route Inactive";
|
|
1319
|
-
} else if (decodeResult.raw.route_status == "RF") {
|
|
1320
|
-
text = "Route Filed";
|
|
1321
|
-
} else {
|
|
1322
|
-
text = decodeResult.raw.route_status;
|
|
1323
|
-
}
|
|
1324
|
-
decodeResult.formatted.items.push({
|
|
1325
|
-
type: "status",
|
|
1326
|
-
code: "ROUTE_STATUS",
|
|
1327
|
-
label: "Route Status",
|
|
1328
|
-
value: text
|
|
1329
|
-
});
|
|
1330
1390
|
return allKnownFields;
|
|
1331
1391
|
}
|
|
1392
|
+
function processPosition(decodeResult, value) {
|
|
1393
|
+
const position = CoordinateUtils.decodeStringCoordinates(value);
|
|
1394
|
+
if (position) {
|
|
1395
|
+
decodeResult.raw.position = position;
|
|
1396
|
+
decodeResult.formatted.items.push({
|
|
1397
|
+
type: "aircraft_position",
|
|
1398
|
+
code: "POS",
|
|
1399
|
+
label: "Aircraft Position",
|
|
1400
|
+
value: CoordinateUtils.coordinateString(position)
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1403
|
+
return !!position;
|
|
1404
|
+
}
|
|
1332
1405
|
function addArrivalAirport(decodeResult, value) {
|
|
1333
1406
|
decodeResult.raw.arrival_icao = value;
|
|
1334
1407
|
decodeResult.formatted.items.push({
|
|
@@ -1347,12 +1420,20 @@ function addDepartureAirport(decodeResult, value) {
|
|
|
1347
1420
|
value: decodeResult.raw.departure_icao
|
|
1348
1421
|
});
|
|
1349
1422
|
}
|
|
1350
|
-
function
|
|
1351
|
-
|
|
1423
|
+
function addRunway(decodeResult, value) {
|
|
1424
|
+
if (value.length === 8) {
|
|
1425
|
+
decodeResult.raw.arrival_runway = value.substring(4, 7);
|
|
1426
|
+
decodeResult.formatted.items.push({
|
|
1427
|
+
type: "runway",
|
|
1428
|
+
label: "Arrival Runway",
|
|
1429
|
+
value: decodeResult.raw.arrival_runway
|
|
1430
|
+
});
|
|
1431
|
+
}
|
|
1432
|
+
decodeResult.raw.departure_runway = value.substring(0, 3);
|
|
1352
1433
|
decodeResult.formatted.items.push({
|
|
1353
1434
|
type: "runway",
|
|
1354
|
-
label: "Runway",
|
|
1355
|
-
value: decodeResult.raw.
|
|
1435
|
+
label: "Departure Runway",
|
|
1436
|
+
value: decodeResult.raw.departure_runway
|
|
1356
1437
|
});
|
|
1357
1438
|
}
|
|
1358
1439
|
function addRoute(decodeResult, value) {
|
|
@@ -1456,13 +1537,66 @@ function addChecksum(decodeResult, value) {
|
|
|
1456
1537
|
});
|
|
1457
1538
|
}
|
|
1458
1539
|
|
|
1540
|
+
// lib/plugins/Label_H1_OHMA.ts
|
|
1541
|
+
import * as zlib from "minizlib";
|
|
1542
|
+
var Label_H1_OHMA = class extends DecoderPlugin {
|
|
1543
|
+
name = "label-h1-ohma";
|
|
1544
|
+
qualifiers() {
|
|
1545
|
+
return {
|
|
1546
|
+
labels: ["H1"],
|
|
1547
|
+
preambles: ["OHMA", "/RTNBOCR.OHMA", "#T1B/RTNBOCR.OHMA"]
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1550
|
+
decode(message, options = {}) {
|
|
1551
|
+
let decodeResult = this.defaultResult;
|
|
1552
|
+
decodeResult.decoder.name = this.name;
|
|
1553
|
+
decodeResult.formatted.description = "OHMA Message";
|
|
1554
|
+
decodeResult.message = message;
|
|
1555
|
+
decodeResult.remaining.text = "";
|
|
1556
|
+
const data = message.text.split("OHMA")[1];
|
|
1557
|
+
try {
|
|
1558
|
+
const compressedBuffer = Buffer.from(data, "base64");
|
|
1559
|
+
const decompress = new zlib.Inflate({ windowBits: 15 });
|
|
1560
|
+
decompress.write(compressedBuffer);
|
|
1561
|
+
decompress.flush(zlib.constants.Z_SYNC_FLUSH);
|
|
1562
|
+
const result = decompress.read();
|
|
1563
|
+
const jsonText = result.toString();
|
|
1564
|
+
const json = JSON.parse(jsonText);
|
|
1565
|
+
let formattedMsg;
|
|
1566
|
+
if (json.message.startsWith("{")) {
|
|
1567
|
+
const ohmaMsg = JSON.parse(json.message);
|
|
1568
|
+
formattedMsg = JSON.stringify(ohmaMsg, null, 2);
|
|
1569
|
+
} else {
|
|
1570
|
+
formattedMsg = json.message;
|
|
1571
|
+
}
|
|
1572
|
+
decodeResult.decoded = true;
|
|
1573
|
+
decodeResult.decoder.decodeLevel = "full";
|
|
1574
|
+
decodeResult.raw.ohma = jsonText;
|
|
1575
|
+
decodeResult.formatted.items.push({
|
|
1576
|
+
type: "ohma",
|
|
1577
|
+
code: "OHMA",
|
|
1578
|
+
label: "OHMA Downlink",
|
|
1579
|
+
value: formattedMsg
|
|
1580
|
+
});
|
|
1581
|
+
} catch (e) {
|
|
1582
|
+
if (options.debug) {
|
|
1583
|
+
console.log(`Decoder: Unknown H1 OHMA message: ${message.text}`, e);
|
|
1584
|
+
}
|
|
1585
|
+
decodeResult.remaining.text += message.text;
|
|
1586
|
+
decodeResult.decoded = false;
|
|
1587
|
+
decodeResult.decoder.decodeLevel = "none";
|
|
1588
|
+
}
|
|
1589
|
+
return decodeResult;
|
|
1590
|
+
}
|
|
1591
|
+
};
|
|
1592
|
+
|
|
1459
1593
|
// lib/plugins/Label_H1_POS.ts
|
|
1460
1594
|
var Label_H1_POS = class extends DecoderPlugin {
|
|
1461
1595
|
name = "label-h1-pos";
|
|
1462
1596
|
qualifiers() {
|
|
1463
1597
|
return {
|
|
1464
1598
|
labels: ["H1"],
|
|
1465
|
-
preambles: ["POS", "#M1BPOS"]
|
|
1599
|
+
preambles: ["POS", "#M1BPOS", "/.POS"]
|
|
1466
1600
|
//TODO - support data before #
|
|
1467
1601
|
};
|
|
1468
1602
|
}
|
|
@@ -1471,29 +1605,25 @@ var Label_H1_POS = class extends DecoderPlugin {
|
|
|
1471
1605
|
decodeResult.decoder.name = this.name;
|
|
1472
1606
|
decodeResult.formatted.description = "Position Report";
|
|
1473
1607
|
decodeResult.message = message;
|
|
1608
|
+
decodeResult.remaining.text = "";
|
|
1474
1609
|
const checksum = message.text.slice(-4);
|
|
1475
|
-
const
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
})
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
}
|
|
1491
|
-
processChecksum(decodeResult, checksum);
|
|
1492
|
-
decodeResult.decoded = true;
|
|
1493
|
-
decodeResult.decoder.decodeLevel = "full";
|
|
1610
|
+
const header = findHeader(message.text.slice(0, -4));
|
|
1611
|
+
const decoded = FlightPlanUtils.processFlightPlan(decodeResult, header.split(":"));
|
|
1612
|
+
const parts = message.text.replace(header, "").slice(0, -4).split(",");
|
|
1613
|
+
if (parts.length == 1) {
|
|
1614
|
+
if (decoded) {
|
|
1615
|
+
processChecksum(decodeResult, checksum);
|
|
1616
|
+
decodeResult.decoded = true;
|
|
1617
|
+
decodeResult.decoder.decodeLevel = "full";
|
|
1618
|
+
} else if (decodeResult.remaining.text.length > 0) {
|
|
1619
|
+
processChecksum(decodeResult, checksum);
|
|
1620
|
+
decodeResult.decoded = true;
|
|
1621
|
+
decodeResult.decoder.decodeLevel = "partial";
|
|
1622
|
+
} else {
|
|
1623
|
+
decodeResult.decoded = false;
|
|
1624
|
+
decodeResult.decoder.decodeLevel = "none";
|
|
1625
|
+
}
|
|
1494
1626
|
} else if (parts.length === 10) {
|
|
1495
|
-
decodeResult.remaining.text = "";
|
|
1496
|
-
processPosition(decodeResult, parts[0]);
|
|
1497
1627
|
processAlt(decodeResult, parts[3]);
|
|
1498
1628
|
processRoute(decodeResult, parts[1], parts[2], parts[4], parts[5], parts[6]);
|
|
1499
1629
|
processTemp(decodeResult, parts[7]);
|
|
@@ -1503,8 +1633,6 @@ var Label_H1_POS = class extends DecoderPlugin {
|
|
|
1503
1633
|
decodeResult.decoded = true;
|
|
1504
1634
|
decodeResult.decoder.decodeLevel = "partial";
|
|
1505
1635
|
} else if (parts.length === 11) {
|
|
1506
|
-
decodeResult.remaining.text = "";
|
|
1507
|
-
processPosition(decodeResult, parts[0]);
|
|
1508
1636
|
processAlt(decodeResult, parts[3]);
|
|
1509
1637
|
processRoute(decodeResult, parts[1], parts[2], parts[4], parts[5], parts[6], parts[10]);
|
|
1510
1638
|
processTemp(decodeResult, parts[7]);
|
|
@@ -1513,9 +1641,18 @@ var Label_H1_POS = class extends DecoderPlugin {
|
|
|
1513
1641
|
processChecksum(decodeResult, checksum);
|
|
1514
1642
|
decodeResult.decoded = true;
|
|
1515
1643
|
decodeResult.decoder.decodeLevel = "partial";
|
|
1644
|
+
} else if (parts.length === 12) {
|
|
1645
|
+
const date = parts[11].substring(2, 4) + parts[11].substring(0, 2) + parts[11].substring(4, 6);
|
|
1646
|
+
processUnknown(decodeResult, parts[3]);
|
|
1647
|
+
processRoute(decodeResult, parts[1], parts[2], parts[4], parts[5], parts[6], date);
|
|
1648
|
+
processTemp(decodeResult, parts[7]);
|
|
1649
|
+
processUnknown(decodeResult, parts[8]);
|
|
1650
|
+
processUnknown(decodeResult, parts[9]);
|
|
1651
|
+
processUnknown(decodeResult, parts[10]);
|
|
1652
|
+
processChecksum(decodeResult, checksum);
|
|
1653
|
+
decodeResult.decoded = true;
|
|
1654
|
+
decodeResult.decoder.decodeLevel = "partial";
|
|
1516
1655
|
} else if (parts.length === 14) {
|
|
1517
|
-
decodeResult.remaining.text = "";
|
|
1518
|
-
processPosition(decodeResult, parts[0]);
|
|
1519
1656
|
processAlt(decodeResult, parts[3]);
|
|
1520
1657
|
processRoute(decodeResult, parts[1], parts[2], parts[4], parts[5], parts[6]);
|
|
1521
1658
|
processTemp(decodeResult, parts[7]);
|
|
@@ -1529,8 +1666,6 @@ var Label_H1_POS = class extends DecoderPlugin {
|
|
|
1529
1666
|
decodeResult.decoded = true;
|
|
1530
1667
|
decodeResult.decoder.decodeLevel = "partial";
|
|
1531
1668
|
} else if (parts.length === 15) {
|
|
1532
|
-
decodeResult.remaining.text = "";
|
|
1533
|
-
processUnknown(decodeResult, parts[0]);
|
|
1534
1669
|
processUnknown(decodeResult, parts[1]);
|
|
1535
1670
|
let date = void 0;
|
|
1536
1671
|
if (parts[2].startsWith("/DC")) {
|
|
@@ -1543,7 +1678,7 @@ var Label_H1_POS = class extends DecoderPlugin {
|
|
|
1543
1678
|
for (let i = 0; i < fields.length; ++i) {
|
|
1544
1679
|
const field = fields[i];
|
|
1545
1680
|
if (field.startsWith("PS")) {
|
|
1546
|
-
|
|
1681
|
+
processPosition2(decodeResult, field.substring(2));
|
|
1547
1682
|
} else {
|
|
1548
1683
|
if (i === 0) {
|
|
1549
1684
|
processUnknown(decodeResult, field);
|
|
@@ -1562,9 +1697,16 @@ var Label_H1_POS = class extends DecoderPlugin {
|
|
|
1562
1697
|
processChecksum(decodeResult, checksum);
|
|
1563
1698
|
decodeResult.decoded = true;
|
|
1564
1699
|
decodeResult.decoder.decodeLevel = "partial";
|
|
1700
|
+
} else if (parts.length === 21) {
|
|
1701
|
+
processRunway(decodeResult, parts[1]);
|
|
1702
|
+
processUnknown(decodeResult, parts.slice(2, 11).join(","));
|
|
1703
|
+
processTemp(decodeResult, parts[11]);
|
|
1704
|
+
processUnknown(decodeResult, parts.slice(12, 20).join(","));
|
|
1705
|
+
FlightPlanUtils.processFlightPlan(decodeResult, parts[20].split(":"));
|
|
1706
|
+
processChecksum(decodeResult, checksum);
|
|
1707
|
+
decodeResult.decoded = true;
|
|
1708
|
+
decodeResult.decoder.decodeLevel = "partial";
|
|
1565
1709
|
} else if (parts.length === 32) {
|
|
1566
|
-
decodeResult.remaining.text = "";
|
|
1567
|
-
processPosition(decodeResult, parts[0]);
|
|
1568
1710
|
processRunway(decodeResult, parts[1]);
|
|
1569
1711
|
const time = parts[2];
|
|
1570
1712
|
processUnknown(decodeResult, parts[3]);
|
|
@@ -1589,7 +1731,7 @@ var Label_H1_POS = class extends DecoderPlugin {
|
|
|
1589
1731
|
if (options.debug) {
|
|
1590
1732
|
console.log(`Decoder: Unknown H1 message: ${message.text}`);
|
|
1591
1733
|
}
|
|
1592
|
-
decodeResult.remaining.text
|
|
1734
|
+
decodeResult.remaining.text += message.text;
|
|
1593
1735
|
decodeResult.decoded = false;
|
|
1594
1736
|
decodeResult.decoder.decodeLevel = "none";
|
|
1595
1737
|
}
|
|
@@ -1599,7 +1741,7 @@ var Label_H1_POS = class extends DecoderPlugin {
|
|
|
1599
1741
|
function processUnknown(decodeResult, value) {
|
|
1600
1742
|
decodeResult.remaining.text += "," + value;
|
|
1601
1743
|
}
|
|
1602
|
-
function
|
|
1744
|
+
function processPosition2(decodeResult, value) {
|
|
1603
1745
|
const position = CoordinateUtils.decodeStringCoordinates(value);
|
|
1604
1746
|
if (position) {
|
|
1605
1747
|
decodeResult.raw.position = position;
|
|
@@ -1630,11 +1772,11 @@ function processTemp(decodeResult, value) {
|
|
|
1630
1772
|
});
|
|
1631
1773
|
}
|
|
1632
1774
|
function processRunway(decodeResult, value) {
|
|
1633
|
-
decodeResult.raw.
|
|
1775
|
+
decodeResult.raw.arrival_runway = value.replace("RW", "");
|
|
1634
1776
|
decodeResult.formatted.items.push({
|
|
1635
1777
|
type: "runway",
|
|
1636
|
-
label: "Runway",
|
|
1637
|
-
value: decodeResult.raw.
|
|
1778
|
+
label: "Arrival Runway",
|
|
1779
|
+
value: decodeResult.raw.arrival_runway
|
|
1638
1780
|
});
|
|
1639
1781
|
}
|
|
1640
1782
|
function processGndspd(decodeResult, value) {
|
|
@@ -1647,14 +1789,17 @@ function processGndspd(decodeResult, value) {
|
|
|
1647
1789
|
});
|
|
1648
1790
|
}
|
|
1649
1791
|
function processRoute(decodeResult, last, time, next, eta, then, date) {
|
|
1650
|
-
const lastCoords = CoordinateUtils.decodeStringCoordinates(last);
|
|
1651
|
-
const nextCoords = CoordinateUtils.decodeStringCoordinates(next);
|
|
1652
1792
|
const lastTime = date ? DateTimeUtils.convertDateTimeToEpoch(time, date) : DateTimeUtils.convertHHMMSSToTod(time);
|
|
1653
1793
|
const nextTime = date ? DateTimeUtils.convertDateTimeToEpoch(eta, date) : DateTimeUtils.convertHHMMSSToTod(eta);
|
|
1654
1794
|
const timeFormat = date ? "epoch" : "tod";
|
|
1655
|
-
const lastWaypoint =
|
|
1656
|
-
|
|
1657
|
-
|
|
1795
|
+
const lastWaypoint = RouteUtils.getWaypoint(last);
|
|
1796
|
+
lastWaypoint.time = lastTime;
|
|
1797
|
+
lastWaypoint.timeFormat = timeFormat;
|
|
1798
|
+
const nextWaypoint = RouteUtils.getWaypoint(next);
|
|
1799
|
+
nextWaypoint.time = nextTime;
|
|
1800
|
+
nextWaypoint.timeFormat = timeFormat;
|
|
1801
|
+
const thenWaypoint = RouteUtils.getWaypoint(then || "?");
|
|
1802
|
+
const waypoints = [lastWaypoint, nextWaypoint, thenWaypoint];
|
|
1658
1803
|
decodeResult.raw.route = { waypoints };
|
|
1659
1804
|
decodeResult.formatted.items.push({
|
|
1660
1805
|
type: "aircraft_route",
|
|
@@ -1672,6 +1817,14 @@ function processChecksum(decodeResult, value) {
|
|
|
1672
1817
|
value: "0x" + ("0000" + decodeResult.raw.checksum.toString(16)).slice(-4)
|
|
1673
1818
|
});
|
|
1674
1819
|
}
|
|
1820
|
+
function findHeader(text) {
|
|
1821
|
+
const parts = text.split(",");
|
|
1822
|
+
const header = parts[0];
|
|
1823
|
+
if (header.indexOf("/TS") === -1) {
|
|
1824
|
+
return header;
|
|
1825
|
+
}
|
|
1826
|
+
return parts[0] + "," + parts[1];
|
|
1827
|
+
}
|
|
1675
1828
|
|
|
1676
1829
|
// lib/plugins/Label_H1_WRN.ts
|
|
1677
1830
|
var Label_H1_WRN = class extends DecoderPlugin {
|
|
@@ -2010,7 +2163,7 @@ var Label_QQ = class extends DecoderPlugin {
|
|
|
2010
2163
|
|
|
2011
2164
|
// lib/utils/miam.ts
|
|
2012
2165
|
import * as Base85 from "base85";
|
|
2013
|
-
import * as
|
|
2166
|
+
import * as zlib2 from "minizlib";
|
|
2014
2167
|
var MIAMCoreV1CRCLength = 4;
|
|
2015
2168
|
var MIAMCoreV2CRCLength = 2;
|
|
2016
2169
|
var MIAMCoreUtils = class {
|
|
@@ -2720,7 +2873,10 @@ var MIAMCoreUtils = class {
|
|
|
2720
2873
|
if (body !== void 0 && body.length > 0) {
|
|
2721
2874
|
if ([1 /* Deflate */, 1 /* Deflate */].indexOf(pduCompression) >= 0) {
|
|
2722
2875
|
try {
|
|
2723
|
-
|
|
2876
|
+
const decompress = new zlib2.InflateRaw({ windowBits: 15 });
|
|
2877
|
+
decompress.write(body);
|
|
2878
|
+
decompress.flush(zlib2.constants.Z_SYNC_FLUSH);
|
|
2879
|
+
pduData = decompress.read();
|
|
2724
2880
|
} catch (e) {
|
|
2725
2881
|
pduErrors.push("Inflation failed for body: " + e);
|
|
2726
2882
|
}
|
|
@@ -2831,6 +2987,7 @@ var MessageDecoder = class {
|
|
|
2831
2987
|
this.registerPlugin(new Label_44_POS(this));
|
|
2832
2988
|
this.registerPlugin(new Label_B6_Forwardslash(this));
|
|
2833
2989
|
this.registerPlugin(new Label_H1_FPN(this));
|
|
2990
|
+
this.registerPlugin(new Label_H1_OHMA(this));
|
|
2834
2991
|
this.registerPlugin(new Label_H1_POS(this));
|
|
2835
2992
|
this.registerPlugin(new Label_H1_WRN(this));
|
|
2836
2993
|
this.registerPlugin(new Label_80(this));
|