Skip to content

Commit

Permalink
Merge pull request #25 from makrsmark/h1-post-update
Browse files Browse the repository at this point in the history
updating H1-POS parsing
  • Loading branch information
kevinelliott authored Feb 5, 2024
2 parents 2c80ef3 + d38b8ce commit a0f1de3
Show file tree
Hide file tree
Showing 15 changed files with 394 additions and 121 deletions.
5 changes: 3 additions & 2 deletions lib/plugins/Label_15.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DecoderPlugin } from '../DecoderPlugin';
import { CoordinateUtils } from '../utils/coordinate_utils';

// General Aviation Position Report
export class Label_15 extends DecoderPlugin {
Expand All @@ -21,13 +22,13 @@ export class Label_15 extends DecoderPlugin {
if (results) {
// Style: (2N38111W 82211266 76400-64(Z
// console.log(`Label 15 Position Report: between = ${results.groups.between}`);
decodeResult.raw.position = this.decodeStringCoordinates(results.groups.between.substr(0,13));
decodeResult.raw.position = CoordinateUtils.decodeStringCoordinates(results.groups.between.substr(0,13));
if(decodeResult.raw.position) {
decodeResult.formatted.items.push({
type: 'position',
code: 'POS' ,
label: 'Position',
value: this.coordinateString(decodeResult.raw.position),
value: CoordinateUtils.coordinateString(decodeResult.raw.position),
});
}
}
Expand Down
3 changes: 2 additions & 1 deletion lib/plugins/Label_15_FST.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DecoderPlugin } from '../DecoderPlugin';
import { CoordinateUtils } from '../utils/coordinate_utils';

// Position Report
export class Label_15_FST extends DecoderPlugin {
Expand Down Expand Up @@ -43,7 +44,7 @@ export class Label_15_FST extends DecoderPlugin {
decodeResult.formatted.items.push({
type: 'position',
label: 'Position',
value: this.coordinateString(decodeResult.raw.position)
value: CoordinateUtils.coordinateString(decodeResult.raw.position)
});

decodeResult.formatted.items.push({
Expand Down
5 changes: 3 additions & 2 deletions lib/plugins/Label_20_CFB.01.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DecoderPlugin } from '../DecoderPlugin';
import { CoordinateUtils } from '../utils/coordinate_utils';

// In Air Report
export class Label_20_CFB01 extends DecoderPlugin {
Expand Down Expand Up @@ -27,7 +28,7 @@ export class Label_20_CFB01 extends DecoderPlugin {
console.log(results.groups);
}

decodeResult.raw.position = this.decodeStringCoordinates(results.groups.unsplit_coords);
decodeResult.raw.position = CoordinateUtils.decodeStringCoordinates(results.groups.unsplit_coords);

decodeResult.raw.departure_icao = results.groups.departure_icao;
decodeResult.raw.arrival_icao = results.groups.arrival_icao;
Expand All @@ -48,7 +49,7 @@ export class Label_20_CFB01 extends DecoderPlugin {
type: 'position',
code: 'POS' ,
label: 'Position',
value: this.coordinateString(decodeResult.raw.position),
value: CoordinateUtils.coordinateString(decodeResult.raw.position),
});
}

Expand Down
9 changes: 5 additions & 4 deletions lib/plugins/Label_20_POS.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DecoderPlugin } from '../DecoderPlugin';
import { CoordinateUtils } from '../utils/coordinate_utils';

// Position Report
export class Label_20_POS extends DecoderPlugin {
Expand Down Expand Up @@ -31,12 +32,12 @@ export class Label_20_POS extends DecoderPlugin {

// Field 1: Coordinates
const rawCoords = fields[0];
decodeResult.raw.position = this.decodeStringCoordinates(rawCoords);
decodeResult.raw.position = CoordinateUtils.decodeStringCoordinates(rawCoords);
if(decodeResult.raw.position) {
decodeResult.formatted.items.push({
type: 'position',
label: 'Position',
value: this.coordinateString(decodeResult.raw.position),
value: CoordinateUtils.coordinateString(decodeResult.raw.position),
});
}

Expand All @@ -48,11 +49,11 @@ export class Label_20_POS extends DecoderPlugin {

// Field 1: Coordinates
const rawCoords = fields[0];
decodeResult.raw.position = this.decodeStringCoordinates(rawCoords);
decodeResult.raw.position = CoordinateUtils.decodeStringCoordinates(rawCoords);
decodeResult.formatted.items.push({
type: 'position',
label: 'Position',
value: this.coordinateString(decodeResult.raw.position),
value: CoordinateUtils.coordinateString(decodeResult.raw.position),
});

decodeResult.decoded = true;
Expand Down
5 changes: 3 additions & 2 deletions lib/plugins/Label_44_ETA.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DecoderPlugin } from '../DecoderPlugin';
import { CoordinateUtils } from '../utils/coordinate_utils';

// In Air Report
export class Label_44_ETA extends DecoderPlugin {
Expand Down Expand Up @@ -27,7 +28,7 @@ export class Label_44_ETA extends DecoderPlugin {
console.log(results.groups);
}

decodeResult.raw.position = this.decodeStringCoordinates(results.groups.unsplit_coords);
decodeResult.raw.position = CoordinateUtils.decodeStringCoordinates(results.groups.unsplit_coords);

decodeResult.raw.departure_icao = results.groups.departure_icao;
decodeResult.raw.arrival_icao = results.groups.arrival_icao;
Expand All @@ -48,7 +49,7 @@ export class Label_44_ETA extends DecoderPlugin {
type: 'position',
code: 'POS' ,
label: 'Position',
value: this.coordinateString(decodeResult.raw.position),
value: CoordinateUtils.coordinateString(decodeResult.raw.position),
});
}

Expand Down
5 changes: 3 additions & 2 deletions lib/plugins/Label_44_IN.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DecoderPlugin } from '../DecoderPlugin';
import { CoordinateUtils } from '../utils/coordinate_utils';

// In Air Report
export class Label_44_IN extends DecoderPlugin {
Expand Down Expand Up @@ -27,7 +28,7 @@ export class Label_44_IN extends DecoderPlugin {
console.log(results.groups);
}

decodeResult.raw.position = this.decodeStringCoordinates(results.groups.unsplit_coords);
decodeResult.raw.position = CoordinateUtils.decodeStringCoordinates(results.groups.unsplit_coords);

decodeResult.raw.departure_icao = results.groups.departure_icao;
decodeResult.raw.arrival_icao = results.groups.arrival_icao;
Expand All @@ -48,7 +49,7 @@ export class Label_44_IN extends DecoderPlugin {
type: 'position',
code: 'POS' ,
label: 'Position',
value: this.coordinateString(decodeResult.raw.position),
value: CoordinateUtils.coordinateString(decodeResult.raw.position),
});
}

Expand Down
5 changes: 3 additions & 2 deletions lib/plugins/Label_44_OFF.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DecoderPlugin } from '../DecoderPlugin';
import { CoordinateUtils } from '../utils/coordinate_utils';

// Off Runway Report
export class Label_44_OFF extends DecoderPlugin {
Expand Down Expand Up @@ -48,13 +49,13 @@ export class Label_44_OFF extends DecoderPlugin {
decodeResult.raw.fuel_in_tons = Number(results.groups.fuel_in_tons);
}

decodeResult.raw.position = this.decodeStringCoordinates(results.groups.unsplit_coords);
decodeResult.raw.position = CoordinateUtils.decodeStringCoordinates(results.groups.unsplit_coords);
if(decodeResult.raw.position) {
decodeResult.formatted.items.push({
type: 'position',
code: 'POS' ,
label: 'Position',
value: this.coordinateString(decodeResult.raw.position),
value: CoordinateUtils.coordinateString(decodeResult.raw.position),
});
}

Expand Down
5 changes: 3 additions & 2 deletions lib/plugins/Label_44_ON.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DecoderPlugin } from '../DecoderPlugin';
import { CoordinateUtils } from '../utils/coordinate_utils';

// On Runway Report
export class Label_44_ON extends DecoderPlugin {
Expand Down Expand Up @@ -27,7 +28,7 @@ export class Label_44_ON extends DecoderPlugin {
console.log(results.groups);
}

decodeResult.raw.position = this.decodeStringCoordinates(results.groups.unsplit_coords);
decodeResult.raw.position = CoordinateUtils.decodeStringCoordinates(results.groups.unsplit_coords);

decodeResult.raw.departure_icao = results.groups.departure_icao;
decodeResult.raw.arrival_icao = results.groups.arrival_icao;
Expand All @@ -48,7 +49,7 @@ export class Label_44_ON extends DecoderPlugin {
type: 'position',
code: 'POS' ,
label: 'Position',
value: this.coordinateString(decodeResult.raw.position),
value: CoordinateUtils.coordinateString(decodeResult.raw.position),
});
}

Expand Down
5 changes: 3 additions & 2 deletions lib/plugins/Label_44_POS.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DecoderPlugin } from '../DecoderPlugin';
import { CoordinateUtils } from '../utils/coordinate_utils';

// General Aviation Position Report
export class Label_44_POS extends DecoderPlugin {
Expand Down Expand Up @@ -27,7 +28,7 @@ export class Label_44_POS extends DecoderPlugin {
console.log(results.groups);
}

decodeResult.raw.position = this.decodeStringCoordinates(results.groups.unsplit_coords);
decodeResult.raw.position = CoordinateUtils.decodeStringCoordinates(results.groups.unsplit_coords);
decodeResult.raw.flight_level = results.groups.flight_level_or_ground == 'GRD' || results.groups.flight_level_or_ground == '***' ? '0' : Number(results.groups.flight_level_or_ground);
decodeResult.raw.departure_icao = results.groups.departure_icao;
decodeResult.raw.arrival_icao = results.groups.arrival_icao;
Expand Down Expand Up @@ -55,7 +56,7 @@ export class Label_44_POS extends DecoderPlugin {
type: 'position',
code: 'POS' ,
label: 'Position',
value: this.coordinateString(decodeResult.raw.position),
value: CoordinateUtils.coordinateString(decodeResult.raw.position),
});
}

Expand Down
5 changes: 3 additions & 2 deletions lib/plugins/Label_H1_M1BPOS.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DecoderPlugin } from '../DecoderPlugin';
import { CoordinateUtils } from '../utils/coordinate_utils';

export class Label_H1_M1BPOS extends DecoderPlugin { // eslint-disable-line camelcase
name = 'label-h1-m1bpos';
Expand All @@ -22,13 +23,13 @@ export class Label_H1_M1BPOS extends DecoderPlugin { // eslint-disable-line came
const secondHalf = parts[1];
const items = firstHalf.split(',');

decodeResult.raw.position = this.decodeStringCoordinates(items[0]);
decodeResult.raw.position = CoordinateUtils.decodeStringCoordinates(items[0]);
if(decodeResult.raw.position) {
decodeResult.formatted.items.push({
type: 'position',
code: 'POS' ,
label: 'Position',
value: this.coordinateString(decodeResult.raw.position),
value: CoordinateUtils.coordinateString(decodeResult.raw.position),
});
}

Expand Down
Loading

0 comments on commit a0f1de3

Please sign in to comment.