Purpose:
========

Enable users to map Majestic Q400 XML-Interface functions of the Pro version, which are not reachable by standard simulator calls or by LVars, directly to buttons via FSUIPC without programming. Nevertheless you need knowledge about your installation and about the XML interface.

Implementation:
===============

Buttons are mapped to custom events defined in a macro file (Q400BUT.MCRO)
Custom events are trapped in a XML gauge and routed to the XML interface (XMLIF_write.xml)
Some sample functions are implemented for reference. Additional functions can easily be added just with an editor. The gauge is able to buffer events fired very quickly. The transfer logic of the XML interface is fully implemented.

Platform:
=========

Majestic Q400 Pro, latest 64-bit version - not tested on any other version.
P3D 5.1 latest version - not tested on any other version.
FSUIPC version 6 - not tested on any other version.


How ro install:
===============

ALWAYS make backup of files before changing them. All changes are made on your own risk. No support by Majestic and by the author can be given, if it is not working in your environment. Stepping back is easy: remove the added files and restore the original files from the backup. Alternatively you can reinstall the plane.

1.) Install the gauge

Look for the Folder "MyQ400" in the ZIP file and copy the folder and it's content into the "gauges" directory, which you will find in the main P3D directory

2.) Add the gauge to the panel

Find the panel.cfg in the folder "panel" in your Q400 installation directory.
Open the panel.cfg file with an editor.
Find the [Vcockpit00] section.
Add the following line below the laste gaugeXX entry in this section

gaugeYY=MyQ400!XMLIF_write, 0,0,1,1

Replace YY by the next number in sequence, which is in my case 02:
gauge02=MyQ400!XMLIF_write, 0,0,1,1

3.) Install the macro file

Copy the file "Q400BUT.MCRO" into your FSUIPC6 directory

Map the functions to buttons:
=============================

Start the simulator and load the Q400. Now you can map buttons in FSUIPC directly to the functions defined in the macro file (calling corresponding custom events in the gauge). That's it.

I recommend to use aircraft specific profiles (see FSUIPC documentation for futher details).


======================================
How to implement additional functions:
======================================

Three steps are necessary, to add new XML interace functions. I will demonstrate this with the APU fire test switch.


1) Find the hash code for the function

In the documentation of the XML interface you will find all controls, which you are able to control via the XML interface. In our demo case look for the function:

Fire_->controls.APU_FIRE_TEST_SW

With the supplied tool of the XML interface (IntVarCRCGen.exe) you can generate the fash code for this function:

45223

To turn the APU fire test on, you call the XML interface with that hash code and with a parameter of 1. Using 0 as parameter turns the test off. This can be found in the XML interface documentation.


2) Add two lines (On and off) with the new hash code to the gauge.

Look for the following section in the file XML_write.xml in the MyQ400 directory in the gauges directory of the simulator

<Keymap Id="Q400" Name="Q400 XML Interface">

At the end of the section add the following lines:

<Trigger id="APUFireTestOn"   KeyEvent="69664" AlwaysOn="True" Script="@XMLIF(1,45223)"/>
<Trigger id="APUFireTestOff"  KeyEvent="69665" AlwaysOn="True" Script="@XMLIF(0,45223)"/>

Always use the next number in sequence for the KeyEvent (at least it must be in the range of the custom event ids for XML gauges and they must be unique - see the SDK documentation).

In the script you call the @XMLIF macro with the parameter (1=on, 0=off) and the calculated hash code.


3) Add two new macros to the macro file

In the Q400BUT.MCRO file add the following two lines:

33=APUFireTestOn=C69664
34=APUFireTestOff=C69665

Take the next two numbers in sequence and reference the newly added KeyEvents. 

Starting now the simulator, you will find these two new functions in the button mapping dialog of FSUIPC. You can map them to the "button on" and "button off" event of every button, which you can handle by FSUIPC.

Reinhard








 
