@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/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  [![NPM Version](https://badge.fury.io/js/@airframes%2Facars-decoder.svg)](https://badge.fury.io/js/@airframes%2Facars-decoder)
4
4
  [![GitHub Actions Workflow Status](https://github.com/airframesio/acars-decoder-typescript/actions/workflows/yarn-test.yml/badge.svg)
5
5
  ](https://github.com/airframesio/acars-decoder-typescript/actions/workflows/yarn-test.yml)
6
+ ![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/airframesio/acars-decoder-typescript)
6
7
  [![Contributors](https://img.shields.io/github/contributors/airframesio/acars-decoder-typescript)](https://github.com/airframesio/acars-decoder-typescript/graphs/contributors)
7
8
  [![Activity](https://img.shields.io/github/commit-activity/m/airframesio/acars-decoder-typescript)](https://github.com/airframesio/acars-decoder-typescript/pulse)
8
9
  [![Discord](https://img.shields.io/discord/1067697487927853077?logo=discord)](https://discord.gg/8Ksch7zE)
package/dist/index.js CHANGED
@@ -2060,12 +2060,10 @@ var Label_44_POS = class extends DecoderPlugin {
2060
2060
  }
2061
2061
  ResultFormatter.position(decodeResult, CoordinateUtils.decodeStringCoordinatesDecimalMinutes(results.groups.unsplit_coords));
2062
2062
  const flight_level = results.groups.flight_level_or_ground == "GRD" || results.groups.flight_level_or_ground == "***" ? 0 : Number(results.groups.flight_level_or_ground);
2063
- decodeResult.raw.current_time = Date.parse(
2064
- (/* @__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"
2065
- );
2066
- decodeResult.raw.eta_time = Date.parse(
2067
- (/* @__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"
2068
- );
2063
+ ResultFormatter.month(decodeResult, Number(results.groups.current_date.substring(0, 2)));
2064
+ ResultFormatter.day(decodeResult, Number(results.groups.current_date.substring(2, 4)));
2065
+ ResultFormatter.time_of_day(decodeResult, DateTimeUtils.convertHHMMSSToTod(results.groups.current_time + "00"));
2066
+ ResultFormatter.eta(decodeResult, DateTimeUtils.convertHHMMSSToTod(results.groups.eta_time + "00"));
2069
2067
  if (results.groups.fuel_in_tons != "***" && results.groups.fuel_in_tons != "****") {
2070
2068
  decodeResult.raw.fuel_in_tons = Number(results.groups.fuel_in_tons);
2071
2069
  }
@@ -2494,6 +2492,8 @@ var H1Helper = class _H1Helper {
2494
2492
  } else {
2495
2493
  ResultFormatter.unknown(decodeResult, fields[i], "/");
2496
2494
  }
2495
+ } else if (fields[i].startsWith("WD")) {
2496
+ processWindData(decodeResult, fields[i].substring(2));
2497
2497
  } else {
2498
2498
  ResultFormatter.unknown(decodeResult, fields[i], "/");
2499
2499
  }
@@ -2660,6 +2660,8 @@ function processMessageType(decodeResult, type) {
2660
2660
  decodeResult.formatted.description = "Position Report";
2661
2661
  } else if (type === "PRG") {
2662
2662
  decodeResult.formatted.description = "Progress Report";
2663
+ } else if (type === "PWI") {
2664
+ decodeResult.formatted.description = "Weather Report";
2663
2665
  } else {
2664
2666
  decodeResult.formatted.description = "Unknown H1 Message";
2665
2667
  return false;
@@ -2695,6 +2697,55 @@ function processRoute(decodeResult, last, time, next, eta, then, date) {
2695
2697
  value: RouteUtils.routeToString(decodeResult.raw.route)
2696
2698
  });
2697
2699
  }
2700
+ function processWindData(decodeResult, message) {
2701
+ if (decodeResult.raw.wind_data === void 0) {
2702
+ decodeResult.raw.wind_data = [];
2703
+ }
2704
+ const flightLevel = Number(message.slice(0, 3));
2705
+ const fields = message.slice(4).split(".");
2706
+ fields.forEach((field) => {
2707
+ const data = field.split(",");
2708
+ const waypoint = data[0];
2709
+ const windData = data[1];
2710
+ const windDirection = Number(windData.slice(0, 3));
2711
+ const windSpeed = Number(windData.slice(3));
2712
+ if (data.length === 3) {
2713
+ const tempData = data[2];
2714
+ const tempFlightLevel = Number(tempData.slice(0, 3));
2715
+ const tempString = tempData.slice(3);
2716
+ const tempDegrees = Number(tempString.substring(1)) * (tempString.charAt(0) === "M" ? -1 : 1);
2717
+ decodeResult.raw.wind_data.push({
2718
+ waypoint,
2719
+ flightLevel,
2720
+ windDirection,
2721
+ windSpeed,
2722
+ temperature: {
2723
+ flightLevel: tempFlightLevel,
2724
+ degreesC: tempDegrees
2725
+ }
2726
+ });
2727
+ decodeResult.formatted.items.push({
2728
+ type: "wind_data",
2729
+ code: "WIND",
2730
+ label: "Wind Data",
2731
+ value: `${waypoint} at FL${flightLevel}: ${windDirection}\xB0 at ${windSpeed}kt, ${tempDegrees}\xB0C at FL${tempFlightLevel}`
2732
+ });
2733
+ } else {
2734
+ decodeResult.raw.wind_data.push({
2735
+ waypoint,
2736
+ flightLevel,
2737
+ windDirection,
2738
+ windSpeed
2739
+ });
2740
+ decodeResult.formatted.items.push({
2741
+ type: "wind_data",
2742
+ code: "WIND",
2743
+ label: "Wind Data",
2744
+ value: `${waypoint} at FL${flightLevel}: ${windDirection}\xB0 at ${windSpeed}kt`
2745
+ });
2746
+ }
2747
+ });
2748
+ }
2698
2749
 
2699
2750
  // lib/plugins/Label_4J_POS.ts
2700
2751
  var Label_4J_POS = class extends DecoderPlugin {