WT21 MFD Plugins
Introduction
WT21 MFD plugins allow you to render the EIS, render systems pages and implement additional text pages. MFD plugins must implement the WT21MfdAvionicsPlugin
interface.
Importing Libraries
MFD plugins can import and use code from the following framework libraries:
@microsoft/msfs-sdk
@microsoft/msfs-wt21-shared
@microsoft/msfs-wt21-mfd
When building your plugin, you should configure your build tools to consume the above libraries as global externals.
Binder
In addition to the references passed to all WT21 plugins, MFD plugins are given the following additional references through binder
:
- The display unit index
EIS
The EIS (engine indication system) display is located on the top of the MFD. EIS displays on the WT21 are highly aircraft-specific; therefore the base WT21 does not render any part of the EIS. The EIS must be rendered by an MFD plugin.
A plugin can render the EIS using the renderEis()
method. This method is called during initialization of the MFD after onInstall()
. Once an EIS is rendered by any plugin (by returning a non-null VNode
from renderEis()
), the renderEis()
methods of all subsequent plugins will be ignored.
The size of the area allocated to the EIS is 772px in width and 460px in height.
System Pages
The MFD is able to render system pages which will be shown on the bottom of the screen when the SYS key has been depressed. These displays are highly aircraft-specific and therefore the base WT21 doesn't render any system pages.
A plugin can render systems pages using the renderSystemPages()
method. This method is called during initialization of the MFD after onInstall()
. Systems pages can be rendered by any plugin (by returning an array of WT21MfdPluginSystemsPageDefinition
s from renderSystemPages()
), and multiple plugins can be responsible for rendering systems pages, however the order in which they are displayed may not be consistent.
Text Pages
The MFD can also render text pages, these text pages can be accessed through the DISPL MENU button on the FMC, or the MFD DATA button. These text pages allow for custom pages to be shown on the MFD, such as in the case of the CJ4 where they are used to render takeoff and approach performance data onto the FMC.
To render a text page the registerExtraMfdTextPages(context)
method must be used. This method is called during initialization of the MFD after onInstall()
. It has one parameter, of type MfdTextPagesContext
.
Inside of this function, you then call context.addTextPage(key, render)
:
- where
key
is an enumWt21MfdTextPage
; and - where
render
is an arrow function ((ref) => MfdTextPageComponent
) returning a component extended fromMfdTextPageComponent
.ref
is aNodeReference
for the relevant page.
Example:
registerExtraMfdTextPages(context: MfdTextPagesContext): void {
context.addTextPage(WT21MfdTextPage.TakeoffRef, (ref) => {
// TORefPage is a class extended from MfdTextPageComponent
return <TORefPage
ref={ref}
bus={this.binder.bus}
mfdIndex={this.binder.displayUnitIndex}
/>;
});
}
MfdTextPageComponent
MfdTextPageComponent
is extended from DisplayComponent
, and provides a basic set of functions and properties.
The component provides functions for showing and hiding the page which can be overwritten to provide additional functionality. In addition, it also provides a Subject shownSub
which controls the page visibility.
When rendering your component, the base div should use the ref pageContainerDivRef
inherited from the text page component, ensuring that visibility of the page is properly handled.