Skip to main content

Class: UiService

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:24

A service which manages the state of a G3X Touch instrument's UI panes and views.

Constructors

Constructor

new UiService(instrumentIndex, config, instrumentConfig, bus, isPfdPaneVisible, isMfdPaneVisible, displaySettingManager): UiService

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:173

Creates a new instance of UiService.

Parameters

ParameterTypeDescription
instrumentIndexnumberThe index of this service's parent instrument.
configAvionicsConfigThe general avionics configuration object.
instrumentConfigInstrumentConfigThe configuration object of this service's parent instrument.
busEventBusThe event bus.
isPfdPaneVisibleMutableSubscribable<boolean>A MutableSubscribable which controls whether this service's parent instrument's PFD UI pane is visible.
isMfdPaneVisibleMutableSubscribable<boolean>A MutableSubscribable which controls whether this service's parent instrument's MFD UI pane is visible.
displaySettingManagerUserSettingManager<DisplayUserSettingTypes>A manager for display user settings for this service's parent instrument.

Returns

UiService

Properties

bus

readonly bus: EventBus

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:177

The event bus.


gdu460EisLayout

readonly gdu460EisLayout: Subscribable<EisLayouts>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:78

The current EIS layout. Only applicable for GDU460 displays.


gdu460EisSize

readonly gdu460EisSize: undefined | EisSizes

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:81

The current EIS size, or undefined if the EIS is not included. Only applicable for GDU460 displays.


gdu460PfdPaneSide

readonly gdu460PfdPaneSide: Subscribable<PfdPaneSide>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:54

The side on which the PFD pane is positioned. Only applicable for GDU460 displays.


gduFormat

readonly gduFormat: GduFormat

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:35

The format of this service's parent GDU.


gduIndex

readonly gduIndex: number

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:32

The index of this service's parent GDU.


instrumentIndex

readonly instrumentIndex: number

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:174

The index of this service's parent instrument.


instrumentType

readonly instrumentType: InstrumentType

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:38

The instrument type of this service's parent instrument.


isInStartupPhase

readonly isInStartupPhase: Subscribable<boolean>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:50

Whether this service is in the startup phase.


isPaneSplit

readonly isPaneSplit: Subscribable<boolean>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:85

Whether the UI panes are currently displayed in split mode.


isReversionaryMode

readonly isReversionaryMode: Subscribable<boolean>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:42

Whether this service is operating in reversionary mode.


knobLabelState

readonly knobLabelState: Readonly<Record<UiKnobId, Subscribable<string>>>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:151

This service's computed label state for the bezel rotary knobs.


mfdPaneKnobControlSide

readonly mfdPaneKnobControlSide: Subscribable<number>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:137

The side(s) for which the MFD pane controls the bezel rotary knobs.


operatingType

readonly operatingType: Subscribable<InstrumentType>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:46

The current operating type of this service's parent instrument.


pfdPaneKnobControlSide

readonly pfdPaneKnobControlSide: Subscribable<number>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:133

The side(s) for which the PFD pane controls the bezel rotary knobs.


selectedMfdMainPageKey

readonly selectedMfdMainPageKey: Subscribable<string>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:93

The key of the currently selected MFD main page.


selectedMfdNrstPageKey

readonly selectedMfdNrstPageKey: Subscribable<string>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:97

The key of the currently selected MFD NRST page.


selectedPfdPageKey

readonly selectedPfdPageKey: Subscribable<string>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:89

The key of the currently selected PFD page.


validKnobIds

readonly validKnobIds: readonly UiKnobId[]

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:100

An array of IDs of the valid bezel rotary knobs supported by this service's parent GDU.

Methods

attachViewStackContainers()

attachViewStackContainers(pfdContainer, mfdContainer): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:192

Attaches containers to this service's view stacks.

Parameters

ParameterTypeDescription
pfdContainerUiViewStackContainerThe container to which to attach the PFD view stack.
mfdContainerUiViewStackContainerThe container to which to attach the MFD view stack.

Returns

void

Throws

Error if this service's view stacks have already been attached to containers.


changeMfdPage()

changeMfdPage<T>(key): null | RenderedUiViewEntry<T>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:793

Changes the open MFD page. Changing the page also closes all open MFD popups. If the MFD pane is not visible, then this method does nothing.

Type Parameters

Type ParameterDefault type
T extends UiView<UiViewProps>UiView<UiViewProps>

Parameters

ParameterTypeDescription
keystringThe key of the view to open.

Returns

null | RenderedUiViewEntry<T>

The entry of the opened view, or null if the MFD pane is not visible.

Throws

Error if this service is not initialized, the specified key is equal to UiViewKeys.EmptyPage, there is no view registered under the specified key, or the view to open is already open.


closeAllMfdOverlayViews()

closeAllMfdOverlayViews(closeMfdPaneIfEmpty): null | RenderedUiViewEntry

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:1034

Returns to the most recent history state of the MFD view stack in which the overlay layer contains no open views. If the MFD pane is not visible, then this method does nothing.

Parameters

ParameterTypeDefault valueDescription
closeMfdPaneIfEmptybooleantrueWhether to close the MFD pane if possible should the operation result in the MFD view stack containing no open views except the empty page. Defaults to true.

Returns

null | RenderedUiViewEntry

The active view entry in the MFD view stack after the operation is complete, or null if the MFD pane is not visible after the operation is complete.

Throws

Error if this service is not initialized.


closeAllMfdPopups()

closeAllMfdPopups(closeMfdPaneIfEmpty): null | RenderedUiViewEntry

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:1062

Returns to the most recent history state of the MFD view stack in which the MFD view stack contains no open popups. If the MFD pane is not visible, then this method does nothing.

Parameters

ParameterTypeDefault valueDescription
closeMfdPaneIfEmptybooleantrueWhether to close the MFD pane if possible should the operation result in the MFD view stack containing no open views except the empty page. Defaults to true.

Returns

null | RenderedUiViewEntry

The active view entry in the MFD view stack after the operation is complete, or null if the MFD pane is not visible after the operation is complete.

Throws

Error if this service is not initialized.


closeAllPfdPopups()

closeAllPfdPopups(): null | RenderedUiViewEntry

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:739

Returns to the most recent history state of the PFD view stack in which the view stack contains no open popups. If the PFD pane is not visible, then this method does nothing.

Returns

null | RenderedUiViewEntry

The active view entry in the PFD view stack after the operation is complete, or null if the PFD pane is not visible.

Throws

Error if this service is not initialized.


closeMfdPopup()

closeMfdPopup<F>(filter, closeMfdPaneIfEmpty): boolean

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:988

Attempts to close a popup in the MFD view stack by rewinding the history state of the view stack until the target popup is no longer open. If the MFD pane is not visible, then this method does nothing.

Type Parameters

Type ParameterDefault type
F extends RenderedUiViewEntryRenderedUiViewEntry

Parameters

ParameterTypeDefault valueDescription
filter(popup) => booleanundefinedA filter function which takes in a popup with the specified key and returns whether it is the popup to close.
closeMfdPaneIfEmptybooleantrueWhether to close the MFD pane if possible should the operation result in the MFD view stack containing no open views except the empty page. Defaults to true.

Returns

boolean

true if the specified popup was closed, or false if the popup was not open in the first place.

Throws

Error if this service is not initialized.


closePfdPopup()

closePfdPopup<F>(filter): boolean

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:700

Attempts to close a popup in the PFD view stack by rewinding the history state of the view stack until the target popup is no longer open. If the PFD pane is not visible, then this method does nothing.

Type Parameters

Type ParameterDefault type
F extends RenderedUiViewEntryRenderedUiViewEntry

Parameters

ParameterTypeDescription
filter(popup) => booleanA filter function which takes in a popup with the specified key and returns whether it is the popup to close.

Returns

boolean

true if the specified popup was closed, or false if the popup was not open in the first place.

Throws

Error if this service is not initialized.


enterStartupPhase()

enterStartupPhase(): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:357

Enters the startup phase. When entering the startup phase, the MFD pane is made visible (split screen if this service's parent instrument is operating as a PFD, and full screen if operating as an MFD), all popups on both panes are closed, and the MFD startup view is opened.

Returns

void


exitStartupPhase()

exitStartupPhase(): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:389

Exits the startup phase. When exiting the startup phase, the full/split screen mode defined by the displayStartupSplitMode user setting is applied, and if the MFD pane is visible the MFD main view is opened.

Returns

void


goBackMfd()

goBackMfd(closeMfdPaneIfEmpty): null | RenderedUiViewEntry

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:864

Returns to the most recent previous history state of the MFD view stack. If the MFD pane is not visible, then this method does nothing.

Parameters

ParameterTypeDefault valueDescription
closeMfdPaneIfEmptybooleantrueWhether to close the MFD pane if possible should there be no previous history state to which to return or should the operation result in the MFD view stack containing no open views except the empty page. Defaults to true.

Returns

null | RenderedUiViewEntry

The active view entry in the MFD view stack after the operation is complete, or null if the MFD pane is not visible after the operation is complete.

Throws

Error if this service is not initialized.


goBackPfd()

goBackPfd(): null | RenderedUiViewEntry

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:631

Returns to the most recent previous history state of the PFD view stack. If the PFD pane is not visible, then this method does nothing.

Returns

null | RenderedUiViewEntry

The active view entry in the PFD view stack after the operation is complete, or null if the PFD pane is not visible.

Throws

Error if this service is not initialized.


goBackToMfd()

goBackToMfd(selector, closeMfdPaneIfEmpty): null | RenderedUiViewEntry

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:930

Attempts to return to a previous history state of the MFD view stack. If the MFD pane is not visible, then this method does nothing.

Parameters

ParameterTypeDefault valueDescription
selector(steps, stackPeeker) => booleanundefinedA function which selects the history state to which to return. The function is called once for each history state in order of increasing age and takes two arguments: the number of steps from the present state to the selected state and a function which allows one to peek into the selected state's view stack. The function should return true if the operation should return to the selected state and false otherwise. If the function returns false for every selected state, then the operation is aborted.
closeMfdPaneIfEmptybooleantrueWhether to close the MFD pane if possible should the operation result in the MFD view stack containing no open views except the empty page. Defaults to true.

Returns

null | RenderedUiViewEntry

The active view entry in the MFD view stack after the operation is complete, or null if the MFD pane is not visible after the operation is complete.

Throws

Error if this service is not initialized.


goBackToPfd()

goBackToPfd(selector): null | RenderedUiViewEntry

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:662

Attempts to return to a previous history state of the PFD view stack. If the PFD pane is not visible, then this method does nothing.

Parameters

ParameterTypeDescription
selector(steps, stackPeeker) => booleanA function which selects the history state to which to return. The function is called once for each history state in order of increasing age and takes two arguments: the number of steps from the present state to the selected state and a function which allows one to peek into the selected state's view stack. The function should return true if the operation should return to the selected state and false otherwise. If the function returns false for every selected state, then the operation is aborted.

Returns

null | RenderedUiViewEntry

The active view entry in the MFD view stack after the operation is complete, or null if the MFD pane is not visible after the operation is complete.

Throws

Error if this service is not initialized.


initialize()

initialize(): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:243

Initializes this service.

Returns

void

Throws

Error if this service's view stacks are not attached to containers.


openMfdPane()

openMfdPane(openMfdPageKey): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:505

Opens the MFD pane. This method does nothing if the MFD pane is already visible.

Parameters

ParameterTypeDefault valueDescription
openMfdPageKeystringUiViewKeys.MfdMainThe MFD view page to open if the MFD pane is made visible as a result of this operation. Defaults to UiViewKeys.MfdMain.

Returns

void


openMfdPopup()

openMfdPopup<T>(layer, key, closeOtherPopups, popupOptions?): RenderedUiViewEntry<T>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:824

Opens an MFD view as a popup. The opened view will be brought to the top of its view stack layer.

Type Parameters

Type ParameterDefault type
T extends UiView<UiViewProps>UiView<UiViewProps>

Parameters

ParameterTypeDefault valueDescription
layerUiViewStackLayerundefinedThe view stack layer in which to open the view.
keystringundefinedThe key of the view to open.
closeOtherPopupsbooleanfalseWhether to close other popups before opening the new popup. If true and the new popup is opened in the overlay layer, then all popups in the overlay layer will be closed. If true and the new popup is opened in the main layer, then all popups in both the main and overlay layers will be closed. Defaults to false.
popupOptions?Readonly<UiPopupOpenOptions>undefinedOptions describing how to open the popup. If not defined, then the popup will default to type 'normal' and with a background occlusion type of 'darken'.

Returns

RenderedUiViewEntry<T>

The entry of the opened view.

Throws

Error if this service is not initialized, the specified key is equal to UiViewKeys.EmptyPage, there is no view registered under the specified key, or the view to open is already open.


openPfdPopup()

openPfdPopup<T>(key, closeOtherPopups, popupOptions?): RenderedUiViewEntry<T>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:599

Opens a PFD view as a popup. The opened view will be brought to the top of the view stack.

Type Parameters

Type ParameterDefault type
T extends UiView<UiViewProps>UiView<UiViewProps>

Parameters

ParameterTypeDefault valueDescription
keystringundefinedThe key of the view to open.
closeOtherPopupsbooleanfalseWhether to close other popups before opening the new popup. If true and the new popup is opened in the overlay layer, then all popups in the overlay layer will be closed. If true and the new popup is opened in the main layer, then all popups in both the main and overlay layers will be closed. Defaults to false.
popupOptions?Readonly<UiPopupOpenOptions>undefinedOptions describing how to open the popup. If not defined, then the popup will default to type 'normal' and with a background occlusion type of 'darken'.

Returns

RenderedUiViewEntry<T>

The entry of the opened view.

Throws

Error if this service is not initialized, the specified key is equal to UiViewKeys.EmptyPage, there is no view registered under the specified key, or the view to open is already open.


registerMfdView()

registerMfdView(layer, lifecyclePolicy, key, factory): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:230

Registers and renders a view with this service's MFD view stack. Once a view is registered, it may be opened by referencing its key.

Parameters

ParameterTypeDescription
layerUiViewStackLayerThe view stack layer to which to assign the view.
lifecyclePolicyUiViewLifecyclePolicyThe lifecycle policy to apply to the view.
keystringThe key to register the view under.
factory(uiService, containerRef) => VNodeA function which renders the view.

Returns

void

Throws

Error if the specified key is invalid.


registerPfdView()

registerPfdView(layer, lifecyclePolicy, key, factory): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:212

Registers and renders a view with this service's PFD view stack. Once a view is registered, it may be opened by referencing its key.

Parameters

ParameterTypeDescription
layerUiViewStackLayerThe view stack layer to which to assign the view.
lifecyclePolicyUiViewLifecyclePolicyThe lifecycle policy to apply to the view.
keystringThe key to register the view under.
factory(uiService, containerRef) => VNodeA function which renders the view.

Returns

void

Throws

Error if the specified key is invalid.


resetMfdToPage()

resetMfdToPage<T>(key): null | RenderedUiViewEntry<T>

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:761

Resets the state of the MFD pane such that the open page and active view is a page with a given key. First, an attempt is made to rewind the history state of the MFD pane until the above conditions are met. If this is not possible, then the history state is rewound until only the empty page is open and then the page with the specified key is opened. If the MFD pane is not visible, then this method does nothing.

Type Parameters

Type ParameterDefault type
T extends UiView<UiViewProps>UiView<UiViewProps>

Parameters

ParameterTypeDescription
keystringThe key of the page view to which to reset.

Returns

null | RenderedUiViewEntry<T>

The entry of the page view to which the MFD pane was reset, or null if the MFD pane is not visible.

Throws

Error if this service is not initialized, the specified key is equal to UiViewKeys.EmptyPage, or there is no view registered under the specified key.


selectMfdMainPage()

selectMfdMainPage(key): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:1085

Selects an MFD main page to display.

Parameters

ParameterTypeDescription
keystringThe key of the page to select.

Returns

void


selectMfdNrstPage()

selectMfdNrstPage(key): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:1093

Selects an MFD NRST page to display.

Parameters

ParameterTypeDescription
keystringThe key of the page to select.

Returns

void


setReversionaryMode()

setReversionaryMode(isReversionaryMode): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:416

Sets whether this service is operating in reversionary mode.

Parameters

ParameterTypeDescription
isReversionaryModebooleanWhether this service is operating in reversionary mode.

Returns

void


sleep()

sleep(): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:341

Puts this service to sleep.

Returns

void


toggleSplitPaneMode()

toggleSplitPaneMode(force?, openMfdPageKey?): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:519

Toggles whether the UI panes should be displayed in split mode.

Parameters

ParameterTypeDefault valueDescription
force?booleanundefinedThe split mode state to which to toggle (true = split, false = full). If not defined, then the state will be toggled to the opposite of the current state.
openMfdPageKey?stringUiViewKeys.MfdMainThe MFD view page to open if the MFD pane is made visible as a result of turning split mode on. Defaults to UiViewKeys.MfdMain.

Returns

void

Throws

Error if this service is not initialized.


updateMfdViewStack()

updateMfdViewStack(time): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:494

Updates this service's MFD view stack. Has no effect if this service is not initialized or is asleep.

Parameters

ParameterTypeDescription
timenumberThe current real (operating system) time, as a Javascript timestamp.

Returns

void


updatePfdViewStack()

updatePfdViewStack(time): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:484

Updates this service's PFD view stack. Has no effect if this service is not initialized or is asleep.

Parameters

ParameterTypeDescription
timenumberThe current real (operating system) time, as a Javascript timestamp.

Returns

void


wake()

wake(): void

Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:327

Wakes this service.

Returns

void