Skip to content

Commit

Permalink
chore: rename FMS interface types
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjozork committed Nov 10, 2024
1 parent 1e8811a commit c64dce5
Show file tree
Hide file tree
Showing 18 changed files with 53 additions and 50 deletions.
2 changes: 1 addition & 1 deletion fbw-a32nx/src/systems/fmgc/src/NavigationDatabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class NavigationDatabase {
return this.backendDatabase.getWaypoints([ident]);
}

async searchAllFix(ident: string): Promise<(Waypoint | VhfNavaid | NdbNavaid)[]> {
async searchAllFix(ident: string): Promise<Fix[]> {
return [
...(await this.backendDatabase.getWaypoints([ident])),
...(await this.backendDatabase.getNavaids([ident])),
Expand Down
4 changes: 2 additions & 2 deletions fbw-a32nx/src/systems/fmgc/src/flightplanning/DataManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { NXDataStore, Waypoint } from '@flybywiresim/fbw-sdk';
import { FmsError, FmsErrorType } from '@fmgc/FmsError';
import { DisplayInterface } from '@fmgc/flightplanning/interface/DisplayInterface';
import { FmsDisplayInterface } from '@fmgc/flightplanning/interface/FmsDisplayInterface';
import { WaypointFactory } from '@fmgc/flightplanning/waypoints/WaypointFactory';
import { Coordinates } from 'msfs-geo';

Expand Down Expand Up @@ -61,7 +61,7 @@ export class DataManager {

private latLonExtendedFormat = false;

constructor(private fmc: DisplayInterface) {
constructor(private fmc: FmsDisplayInterface) {
// we keep these in localStorage so they live for the same length of time as the flightplan (that they could appear in)
// if the f-pln is not stored there anymore we can delete this
const stored = localStorage.getItem(DataManager.STORED_WP_KEY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import { jest } from '@jest/globals';
import { FlightPlanService } from '@fmgc/flightplanning/FlightPlanService';
import { setupNavigraphDatabase } from '@fmgc/flightplanning/test/Database';
import { WaypointEntryUtils } from '@fmgc/flightplanning/WaypointEntryUtils';
import { DisplayInterface } from '@fmgc/flightplanning/interface/DisplayInterface';
import { FmsDisplayInterface } from '@fmgc/flightplanning/interface/FmsDisplayInterface';
import { DatabaseItem, Waypoint } from '@flybywiresim/fbw-sdk';
import { FmsErrorType } from '@fmgc/FmsError';
import { Coordinates, placeBearingDistance, placeBearingIntersection } from 'msfs-geo';
import { WaypointFactory } from '@fmgc/flightplanning/waypoints/WaypointFactory';
import { DataInterface } from './interface/DataInterface';
import { FmsDataInterface } from './interface/FmsDataInterface';

jest.setTimeout(120_000);

const fms: DisplayInterface & DataInterface = {
const fms: FmsDisplayInterface & FmsDataInterface = {
showFmsErrorMessage(errorType: FmsErrorType) {
console.error(FmsErrorType[errorType]);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import { Fix, NdbNavaid, VhfNavaid, Waypoint } from '@flybywiresim/fbw-sdk';
import { NavigationDatabaseService } from '@fmgc/flightplanning/NavigationDatabaseService';
import { WaypointFactory } from '@fmgc/flightplanning/waypoints/WaypointFactory';
import { DisplayInterface } from '@fmgc/flightplanning/interface/DisplayInterface';
import { FmsDisplayInterface } from '@fmgc/flightplanning/interface/FmsDisplayInterface';
import { Coordinates } from 'msfs-geo';
import { DataInterface } from '@fmgc/flightplanning/interface/DataInterface';
import { FmsDataInterface } from '@fmgc/flightplanning/interface/FmsDataInterface';
import { FmsError, FmsErrorType } from '@fmgc/FmsError';
import { MagVar } from '@microsoft/msfs-sdk';

Expand All @@ -23,7 +23,7 @@ export class WaypointEntryUtils {
* @returns a waypoint, or `undefined` if the operation is cancelled
*/
static async getOrCreateWaypoint(
fms: DataInterface & DisplayInterface,
fms: FmsDataInterface & FmsDisplayInterface,
place: string,
stored: boolean,
ident?: string,
Expand Down Expand Up @@ -54,7 +54,7 @@ export class WaypointEntryUtils {
/**
* Parse a place string into a position
*/
static async parsePlace(fms: DisplayInterface & DataInterface, place: string): Promise<Fix> {
static async parsePlace(fms: FmsDisplayInterface & FmsDataInterface, place: string): Promise<Fix> {
if (WaypointEntryUtils.isRunwayFormat(place)) {
return WaypointEntryUtils.parseRunway(place);
}
Expand Down Expand Up @@ -158,7 +158,7 @@ export class WaypointEntryUtils {
*
* @returns place and true bearing * 2
*/
static async parsePbx(fms: DisplayInterface & DataInterface, str: string): Promise<[Fix, number, Fix, number]> {
static async parsePbx(fms: FmsDisplayInterface & FmsDataInterface, str: string): Promise<[Fix, number, Fix, number]> {
const pbx = str.match(/^([^\-/]+)-([0-9]{1,3})\/([^\-/]+)-([0-9]{1,3})$/);

if (pbx === null) {
Expand Down Expand Up @@ -186,7 +186,7 @@ export class WaypointEntryUtils {
* @param {string} s
*/
static async parsePbd(
fms: DataInterface & DisplayInterface,
fms: FmsDataInterface & FmsDisplayInterface,
s: string,
): Promise<[wp: Fix, trueBearing: number, dist: number]> {
const [place, brg, dist] = WaypointEntryUtils.splitPbd(s);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Coordinates, DegreesTrue } from 'msfs-geo';
import { Fix } from '@flybywiresim/fbw-sdk';
import { PilotWaypoint } from '@fmgc/flightplanning/DataManager';

export interface DataInterface {
export interface FmsDataInterface {
createLatLonWaypoint(coordinates: Coordinates, stored: boolean, ident?: string): PilotWaypoint;

createPlaceBearingPlaceBearingWaypoint(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { DatabaseItem, Waypoint } from '@flybywiresim/fbw-sdk';
import { FmsErrorType } from '@fmgc/FmsError';

export interface DisplayInterface {
export interface FmsDisplayInterface {
/**
* Called when a flight plan uplink is in progress
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { FlightPlanIndex } from '@fmgc/flightplanning/FlightPlanManager';
import { NavigationDatabaseService } from '@fmgc/flightplanning/NavigationDatabaseService';
import { Fix, Airway } from '@flybywiresim/fbw-sdk';
import { Coordinates, distanceTo } from 'msfs-geo';
import { DisplayInterface } from '@fmgc/flightplanning/interface/DisplayInterface';
import { FmsDisplayInterface } from '@fmgc/flightplanning/interface/FmsDisplayInterface';
import type { Fix as CoRouteFix } from '@simbridge/Coroute/Fix';
import { DataInterface } from '../interface/DataInterface';
import { FmsDataInterface } from '../interface/FmsDataInterface';
import { FmsErrorType } from '@fmgc/FmsError';

export interface OfpRoute {
Expand Down Expand Up @@ -104,7 +104,7 @@ type CoRoute = {

export class CoRouteUplinkAdapter {
static async uplinkFlightPlanFromCoRoute(
fms: DataInterface & DisplayInterface,
fms: FmsDataInterface & FmsDisplayInterface,
flightPlanService: FlightPlanService,
ofp: CoRoute,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import { FlightPlanIndex } from '@fmgc/flightplanning/FlightPlanManager';
import { NavigationDatabaseService } from '@fmgc/flightplanning/NavigationDatabaseService';
import { Airway, Fix } from '@flybywiresim/fbw-sdk';
import { Coordinates, distanceTo } from 'msfs-geo';
import { DisplayInterface } from '@fmgc/flightplanning/interface/DisplayInterface';
import { FmsDisplayInterface } from '@fmgc/flightplanning/interface/FmsDisplayInterface';
import { FlightPlanPerformanceData } from '@fmgc/flightplanning/plans/performance/FlightPlanPerformanceData';
import { FmsErrorType } from '@fmgc/FmsError';
import {
ISimbriefData,
simbriefDataParser,
} from '../../../../../../../fbw-common/src/systems/instruments/src/EFB/Apis/Simbrief';
import { DataInterface } from '../interface/DataInterface';
import { FmsDataInterface } from '../interface/FmsDataInterface';

const SIMBRIEF_API_URL = 'https://www.simbrief.com/api/xml.fetcher.php?json=1';

Expand Down Expand Up @@ -114,7 +114,7 @@ export interface SimBriefUplinkOptions {

export class SimBriefUplinkAdapter {
static async uplinkFlightPlanFromSimbrief<P extends FlightPlanPerformanceData>(
fms: DataInterface & DisplayInterface,
fms: FmsDataInterface & FmsDisplayInterface,
flightPlanService: FlightPlanService<P>,
ofp: ISimbriefData,
options: SimBriefUplinkOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
} from 'instruments/src/MFD/shared/NXSystemMessages';
import { PilotWaypoint } from '@fmgc/flightplanning/DataManager';
import { distanceTo, Coordinates } from 'msfs-geo';
import { DisplayInterface } from '@fmgc/flightplanning/interface/DisplayInterface';
import { FmsDisplayInterface } from '@fmgc/flightplanning/interface/FmsDisplayInterface';
import { MfdDisplayInterface } from 'instruments/src/MFD/MFD';
import { FmcIndex } from 'instruments/src/MFD/FMC/FmcServiceInterface';
import { FmsErrorType } from '@fmgc/FmsError';
Expand All @@ -64,13 +64,13 @@ export interface FmsErrorMessage {
export class FlightManagementComputer implements FmcInterface {
protected subs = [] as Subscription[];

#mfdReference: (DisplayInterface & MfdDisplayInterface) | null;
#mfdReference: (FmsDisplayInterface & MfdDisplayInterface) | null;

get mfdReference() {
return this.#mfdReference;
}

set mfdReference(value: (DisplayInterface & MfdDisplayInterface) | null) {
set mfdReference(value: (FmsDisplayInterface & MfdDisplayInterface) | null) {
this.#mfdReference = value;

if (value) {
Expand Down Expand Up @@ -174,7 +174,7 @@ export class FlightManagementComputer implements FmcInterface {
operatingMode: FmcOperatingModes,
private readonly bus: EventBus,
private readonly isPowered: Subscribable<boolean>,
mfdReference: (DisplayInterface & MfdDisplayInterface) | null,
mfdReference: (FmsDisplayInterface & MfdDisplayInterface) | null,
private readonly failuresConsumer: FailuresConsumer,
) {
this.#operatingMode = operatingMode;
Expand Down
10 changes: 5 additions & 5 deletions fbw-a380x/src/systems/instruments/src/MFD/FMC/FmcInterface.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FmsErrorType } from '@fmgc/FmsError';
import { DataInterface } from '@fmgc/flightplanning/interface/DataInterface';
import { DisplayInterface } from '@fmgc/flightplanning/interface/DisplayInterface';
import { FmsDataInterface } from '@fmgc/flightplanning/interface/FmsDataInterface';
import { FmsDisplayInterface } from '@fmgc/flightplanning/interface/FmsDisplayInterface';
import { DataManager, FlightPlanIndex, FlightPlanService, GuidanceController } from '@fmgc/index';
import { NavaidTuner } from '@fmgc/navigation/NavaidTuner';
import { NavigationProvider } from '@fmgc/navigation/NavigationProvider';
Expand Down Expand Up @@ -34,7 +34,7 @@ export interface FlightPhaseManagerProxyInterface {
* Handles requests inside each FlightManagementComputer (FMC).
* DisplayInterface shouldn't be here, but WaypointEntryUtils requires on parameter with both DisplayInterface and DataInterface
*/
export interface FmcInterface extends FlightPhaseManagerProxyInterface, DataInterface, DisplayInterface {
export interface FmcInterface extends FlightPhaseManagerProxyInterface, FmsDataInterface, FmsDisplayInterface {
/**
* Which operation mode is FMC in? Can be master, slave or standby.
*/
Expand All @@ -44,8 +44,8 @@ export interface FmcInterface extends FlightPhaseManagerProxyInterface, DataInte
/**
* Mfd reference, used for navigating to pages and opening prompts
*/
get mfdReference(): (DisplayInterface & MfdDisplayInterface) | null;
set mfdReference(value: DisplayInterface & MfdDisplayInterface);
get mfdReference(): (FmsDisplayInterface & MfdDisplayInterface) | null;
set mfdReference(value: FmsDisplayInterface & MfdDisplayInterface);

/**
* FlightPlanService interface
Expand Down
8 changes: 4 additions & 4 deletions fbw-a380x/src/systems/instruments/src/MFD/FMC/FmcService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FailuresConsumer } from '@flybywiresim/fbw-sdk';
import { DisplayInterface } from '@fmgc/flightplanning/interface/DisplayInterface';
import { FmsDisplayInterface } from '@fmgc/flightplanning/interface/FmsDisplayInterface';
import { ConsumerSubject, EventBus, Subscription } from '@microsoft/msfs-sdk';
import { FlightManagementComputer } from 'instruments/src/MFD/FMC/FlightManagementComputer';
import { FmcInterface, FmcOperatingModes } from 'instruments/src/MFD/FMC/FmcInterface';
Expand All @@ -25,7 +25,7 @@ export class FmcService implements FmcServiceInterface {

constructor(
private bus: EventBus,
mfdReference: (DisplayInterface & MfdDisplayInterface) | null,
mfdReference: (FmsDisplayInterface & MfdDisplayInterface) | null,
private readonly failuresConsumer: FailuresConsumer,
) {
this.createFmc(mfdReference);
Expand All @@ -43,7 +43,7 @@ export class FmcService implements FmcServiceInterface {
return this.fmc.find((it) => it.operatingMode === FmcOperatingModes.Standby) ?? null;
}

createFmc(mfdReference: (DisplayInterface & MfdDisplayInterface) | null): void {
createFmc(mfdReference: (FmsDisplayInterface & MfdDisplayInterface) | null): void {
// Only FMC-A is operative for now, this takes up enough resources already
// Before more FMC can be added, they have to be synced
this.fmc.push(
Expand Down Expand Up @@ -91,7 +91,7 @@ export class FmcService implements FmcServiceInterface {
return this.fmc[forFmcIndex];
}

setMfdReference(forFmcIndex: FmcIndex, mfd: DisplayInterface & MfdDisplayInterface) {
setMfdReference(forFmcIndex: FmcIndex, mfd: FmsDisplayInterface & MfdDisplayInterface) {
if (this.fmc[forFmcIndex] === undefined) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DisplayInterface } from '@fmgc/flightplanning/interface/DisplayInterface';
import { FmsDisplayInterface } from '@fmgc/flightplanning/interface/FmsDisplayInterface';
import { FmcInterface } from 'instruments/src/MFD/FMC/FmcInterface';
import { MfdDisplayInterface } from 'instruments/src/MFD/MFD';

Expand Down Expand Up @@ -30,7 +30,7 @@ export interface FmcServiceInterface {
/**
* Instantiate FMCs. Currently, only FMC-A is instantiated.
*/
createFmc(mfdReference: DisplayInterface & MfdDisplayInterface): void;
createFmc(mfdReference: FmsDisplayInterface & MfdDisplayInterface): void;

/**
* Check whether given FMC is instantiated
Expand All @@ -45,5 +45,5 @@ export interface FmcServiceInterface {
/**
* Sets mfd reference for given FMC, used for navigating to pages and opening prompts
*/
setMfdReference(forFmcIndex: FmcIndex, mfd: DisplayInterface & MfdDisplayInterface): void;
setMfdReference(forFmcIndex: FmcIndex, mfd: FmsDisplayInterface & MfdDisplayInterface): void;
}
9 changes: 6 additions & 3 deletions fbw-a380x/src/systems/instruments/src/MFD/MFD.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { MfdMsgList } from 'instruments/src/MFD/pages/FMS/MfdMsgList';
import { ActiveUriInformation, MfdUiService } from 'instruments/src/MFD/pages/common/MfdUiService';
import { MfdFmsFplnDuplicateNames } from 'instruments/src/MFD/pages/FMS/F-PLN/MfdFmsFplnDuplicateNames';
import { headerForSystem, pageForUrl } from 'instruments/src/MFD/MfdPageDirectory';
import { DisplayInterface } from '@fmgc/flightplanning/interface/DisplayInterface';
import { FmsDisplayInterface } from '@fmgc/flightplanning/interface/FmsDisplayInterface';
import { FmsErrorType } from '@fmgc/FmsError';
import { FmcServiceInterface } from 'instruments/src/MFD/FMC/FmcServiceInterface';
import { CdsDisplayUnit, DisplayUnitID } from '../MsfsAvionicsCommon/CdsDisplayUnit';
Expand All @@ -36,7 +36,7 @@ export const getDisplayIndex = () => {
export interface AbstractMfdPageProps extends ComponentProps {
pageTitle?: string;
bus: EventBus;
mfd: DisplayInterface & MfdDisplayInterface;
mfd: FmsDisplayInterface & MfdDisplayInterface;
fmcService: FmcServiceInterface;
}

Expand All @@ -62,7 +62,10 @@ export enum InteractionMode {
Kccu,
}

export class MfdComponent extends DisplayComponent<MfdComponentProps> implements DisplayInterface, MfdDisplayInterface {
export class MfdComponent
extends DisplayComponent<MfdComponentProps>
implements FmsDisplayInterface, MfdDisplayInterface
{
private readonly sub = this.props.bus.getSubscriber<ClockEvents & MfdSimvars>();

#uiService = new MfdUiService(this.props.captOrFo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { FcuBkupHeader } from 'instruments/src/MFD/pages/common/FcuBkupHeader';
import { FmsHeader } from 'instruments/src/MFD/pages/common/FmsHeader';
import { SurvHeader } from 'instruments/src/MFD/pages/common/SurvHeader';
import { FmcServiceInterface } from 'instruments/src/MFD/FMC/FmcServiceInterface';
import { DisplayInterface } from '@fmgc/flightplanning/interface/DisplayInterface';
import { FmsDisplayInterface } from '@fmgc/flightplanning/interface/FmsDisplayInterface';
import { MfdDisplayInterface } from 'instruments/src/MFD/MFD';
import { MfdUiService } from 'instruments/src/MFD/pages/common/MfdUiService';
import { MfdFmsDataDebug } from 'instruments/src/MFD/pages/FMS/DATA/MfdFmsDataDebug';
Expand All @@ -32,7 +32,7 @@ import { MfdFmsFplnFixInfo } from './pages/FMS/F-PLN/MfdFmsFplnFixInfo';
export function pageForUrl(
url: string,
bus: EventBus,
mfd: DisplayInterface & MfdDisplayInterface,
mfd: FmsDisplayInterface & MfdDisplayInterface,
fmcService: FmcServiceInterface,
): VNode {
switch (url) {
Expand Down Expand Up @@ -103,7 +103,7 @@ export function pageForUrl(

export function headerForSystem(
sys: string,
mfd: DisplayInterface & MfdDisplayInterface,
mfd: FmsDisplayInterface & MfdDisplayInterface,
atcCallsign: Subscribable<string>,
activeFmsSource: Subscribable<'FMS 1' | 'FMS 2' | 'FMS 1-C' | 'FMS 2-C'>,
uiService: MfdUiService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import '../../common/style.scss';
import { Button } from 'instruments/src/MFD/pages/common/Button';
import { InputField } from 'instruments/src/MFD/pages/common/InputField';
import { AirportFormat } from 'instruments/src/MFD/pages/common/DataEntryFormats';
import { DisplayInterface } from '@fmgc/flightplanning/interface/DisplayInterface';
import { FmsDisplayInterface } from '@fmgc/flightplanning/interface/FmsDisplayInterface';
import { MfdDisplayInterface } from 'instruments/src/MFD/MFD';
import { FmcServiceInterface } from 'instruments/src/MFD/FMC/FmcServiceInterface';

interface DestinationWindowProps extends ComponentProps {
fmcService: FmcServiceInterface;
mfd: DisplayInterface & MfdDisplayInterface;
mfd: FmsDisplayInterface & MfdDisplayInterface;
visible: Subject<boolean>;
}
export class DestinationWindow extends DisplayComponent<DestinationWindowProps> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { DropdownMenu } from 'instruments/src/MFD/pages/common/DropdownMenu';
import { WaypointEntryUtils } from '@fmgc/flightplanning/WaypointEntryUtils';
import { FmcServiceInterface } from 'instruments/src/MFD/FMC/FmcServiceInterface';
import { FlightPlanIndex } from '@fmgc/index';
import { DisplayInterface } from '@fmgc/flightplanning/interface/DisplayInterface';
import { FmsDisplayInterface } from '@fmgc/flightplanning/interface/FmsDisplayInterface';
import { MfdDisplayInterface } from 'instruments/src/MFD/MFD';
import { FmsError } from '@fmgc/FmsError';

Expand All @@ -25,7 +25,7 @@ export type NextWptInfo = {
};
interface InsertNextWptFromWindowProps extends ComponentProps {
fmcService: FmcServiceInterface;
mfd: DisplayInterface & MfdDisplayInterface;
mfd: FmsDisplayInterface & MfdDisplayInterface;
availableWaypoints: SubscribableArray<NextWptInfo>;
visible: Subject<boolean>;
contentContainerStyle?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { NXSystemMessages } from 'instruments/src/MFD/shared/NXSystemMessages';
import { FmcInterface } from 'instruments/src/MFD/FMC/FmcInterface';
import { NavigationDatabaseService } from '@fmgc/flightplanning/NavigationDatabaseService';
import { Fix } from '@flybywiresim/fbw-sdk';
import { DisplayInterface } from '@fmgc/flightplanning/interface/DisplayInterface';
import { FmsDisplayInterface } from '@fmgc/flightplanning/interface/FmsDisplayInterface';

interface MfdFmsFplnAirwaysProps extends AbstractMfdPageProps {}

Expand Down Expand Up @@ -169,7 +169,7 @@ export class MfdFmsFplnAirways extends FmsPage<MfdFmsFplnAirwaysProps> {

interface AirwayLineProps extends ComponentProps {
fmc: FmcInterface;
mfd: DisplayInterface & MfdDisplayInterface;
mfd: FmsDisplayInterface & MfdDisplayInterface;
pendingAirways: PendingAirways;
fromFix: Fix;
isFirstLine: boolean;
Expand Down
Loading

0 comments on commit c64dce5

Please sign in to comment.