@airframes/acars-decoder 1.6.16 → 1.6.17

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.mjs CHANGED
@@ -2023,12 +2023,10 @@ var Label_44_POS = class extends DecoderPlugin {
2023
2023
  }
2024
2024
  ResultFormatter.position(decodeResult, CoordinateUtils.decodeStringCoordinatesDecimalMinutes(results.groups.unsplit_coords));
2025
2025
  const flight_level = results.groups.flight_level_or_ground == "GRD" || results.groups.flight_level_or_ground == "***" ? 0 : Number(results.groups.flight_level_or_ground);
2026
- decodeResult.raw.current_time = Date.parse(
2027
- (/* @__PURE__ */ new Date()).getFullYear() + "-" + results.groups.current_date.substr(0, 2) + "-" + results.groups.current_date.substr(2, 2) + "T" + results.groups.current_time.substr(0, 2) + ":" + results.groups.current_time.substr(2, 2) + ":00Z"
2028
- );
2029
- decodeResult.raw.eta_time = Date.parse(
2030
- (/* @__PURE__ */ new Date()).getFullYear() + "-" + results.groups.current_date.substr(0, 2) + "-" + results.groups.current_date.substr(2, 2) + "T" + results.groups.eta_time.substr(0, 2) + ":" + results.groups.eta_time.substr(2, 2) + ":00Z"
2031
- );
2026
+ ResultFormatter.month(decodeResult, Number(results.groups.current_date.substring(0, 2)));
2027
+ ResultFormatter.day(decodeResult, Number(results.groups.current_date.substring(2, 4)));
2028
+ ResultFormatter.time_of_day(decodeResult, DateTimeUtils.convertHHMMSSToTod(results.groups.current_time + "00"));
2029
+ ResultFormatter.eta(decodeResult, DateTimeUtils.convertHHMMSSToTod(results.groups.eta_time + "00"));
2032
2030
  if (results.groups.fuel_in_tons != "***" && results.groups.fuel_in_tons != "****") {
2033
2031
  decodeResult.raw.fuel_in_tons = Number(results.groups.fuel_in_tons);
2034
2032
  }
@@ -2457,6 +2455,8 @@ var H1Helper = class _H1Helper {
2457
2455
  } else {
2458
2456
  ResultFormatter.unknown(decodeResult, fields[i], "/");
2459
2457
  }
2458
+ } else if (fields[i].startsWith("WD")) {
2459
+ processWindData(decodeResult, fields[i].substring(2));
2460
2460
  } else {
2461
2461
  ResultFormatter.unknown(decodeResult, fields[i], "/");
2462
2462
  }
@@ -2623,6 +2623,8 @@ function processMessageType(decodeResult, type) {
2623
2623
  decodeResult.formatted.description = "Position Report";
2624
2624
  } else if (type === "PRG") {
2625
2625
  decodeResult.formatted.description = "Progress Report";
2626
+ } else if (type === "PWI") {
2627
+ decodeResult.formatted.description = "Weather Report";
2626
2628
  } else {
2627
2629
  decodeResult.formatted.description = "Unknown H1 Message";
2628
2630
  return false;
@@ -2658,6 +2660,55 @@ function processRoute(decodeResult, last, time, next, eta, then, date) {
2658
2660
  value: RouteUtils.routeToString(decodeResult.raw.route)
2659
2661
  });
2660
2662
  }
2663
+ function processWindData(decodeResult, message) {
2664
+ if (decodeResult.raw.wind_data === void 0) {
2665
+ decodeResult.raw.wind_data = [];
2666
+ }
2667
+ const flightLevel = Number(message.slice(0, 3));
2668
+ const fields = message.slice(4).split(".");
2669
+ fields.forEach((field) => {
2670
+ const data = field.split(",");
2671
+ const waypoint = data[0];
2672
+ const windData = data[1];
2673
+ const windDirection = Number(windData.slice(0, 3));
2674
+ const windSpeed = Number(windData.slice(3));
2675
+ if (data.length === 3) {
2676
+ const tempData = data[2];
2677
+ const tempFlightLevel = Number(tempData.slice(0, 3));
2678
+ const tempString = tempData.slice(3);
2679
+ const tempDegrees = Number(tempString.substring(1)) * (tempString.charAt(0) === "M" ? -1 : 1);
2680
+ decodeResult.raw.wind_data.push({
2681
+ waypoint,
2682
+ flightLevel,
2683
+ windDirection,
2684
+ windSpeed,
2685
+ temperature: {
2686
+ flightLevel: tempFlightLevel,
2687
+ degreesC: tempDegrees
2688
+ }
2689
+ });
2690
+ decodeResult.formatted.items.push({
2691
+ type: "wind_data",
2692
+ code: "WIND",
2693
+ label: "Wind Data",
2694
+ value: `${waypoint} at FL${flightLevel}: ${windDirection}\xB0 at ${windSpeed}kt, ${tempDegrees}\xB0C at FL${tempFlightLevel}`
2695
+ });
2696
+ } else {
2697
+ decodeResult.raw.wind_data.push({
2698
+ waypoint,
2699
+ flightLevel,
2700
+ windDirection,
2701
+ windSpeed
2702
+ });
2703
+ decodeResult.formatted.items.push({
2704
+ type: "wind_data",
2705
+ code: "WIND",
2706
+ label: "Wind Data",
2707
+ value: `${waypoint} at FL${flightLevel}: ${windDirection}\xB0 at ${windSpeed}kt`
2708
+ });
2709
+ }
2710
+ });
2711
+ }
2661
2712
 
2662
2713
  // lib/plugins/Label_4J_POS.ts
2663
2714
  var Label_4J_POS = class extends DecoderPlugin {