1 contributor
<?xml version="1.0"?>
<PropertyList>
<multikey>
<nasal>
<script><![CDATA[
var zkv1000_devices = [];
foreach (var c; zkv1000.zkv.getChildren()) {
if (c.getNode('status') != nil) {
var name = c.getName();
var role = substr(name, 0, 3);
if (role == 'MFD' or role == 'PFD') {
append(zkv1000_devices, name);
printf("ZKV1000 multikey added %s (:z%u)", name, size(zkv1000_devices));
}
}
}
var zkv1000_device_available = func (device) {
return contains(zkv1000.flightdeck, device)
and zkv1000.zkv.getNode(device).getValue("status") == 1;
}
var zkv1000_pushButton = func (device_id, button) {
if (device_id > 0 and device_id <= size(zkv1000_devices)) {
var device_name = zkv1000_devices[device_id - 1];
if (zkv1000_device_available(device_name))
call(zkv1000.flightdeck[device_name].buttons[button], nil, zkv1000.flightdeck[device_name].buttons);
}
}
var zkv1000_turnKnob = func (device_id, knob, dir, display_name) {
if (device_id > 0 and device_id <= size(zkv1000_devices)) {
var device_name = zkv1000_devices[device_id - 1];
if (zkv1000_device_available(device_name)) {
_ = sprintf("%s %s", device_name, display_name, dir > 0 ? "clockwise" : "counterclockwise");
call(zkv1000.flightdeck[device_name].knobs[knob], [ dir ], zkv1000.flightdeck[device_name].knobs);
}
}
}
]]></script>
</nasal>
<key n="122">
<name>z</name>
<desc>ZKV1000 commands</desc>
<key n="111">
<name>o</name>
<desc>Power ON device</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000.powerOn();</script>
</binding>
</key>
<key n="100">
<name>d</name>
<desc>display list of available devices and their numeric label</desc>
<no-exit/>
<binding>
<command>nasal</command>
<script>
var list = "List of available ZKV1000 devices";
forindex (var i; zkv1000_devices)
list ~= sprintf("\n%u: %s", i+1, zkv1000_devices[i]);
gui.popupTip(list);
</script>
</binding>
</key>
<key n="902">
<name>%u</name>
<desc>zkv1000 device index %u</desc>
<key n="100">
<name>d</name>
<desc>DirectTo</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000_pushButton(arg[0], "DirectTo");</script>
</binding>
</key>
<key n="109">
<name>m</name>
<desc>MENU</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000_pushButton(arg[0], "MENU");</script>
</binding>
</key>
<key n="102">
<name>f</name>
<desc>FPL</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000_pushButton(arg[0], "FPL");</script>
</binding>
</key>
<key n="112">
<name>p</name>
<desc>PROC</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000_pushButton(arg[0], "PROC");</script>
</binding>
</key>
<key n="99">
<name>c</name>
<desc>CLR</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000_pushButton(arg[0], "CLR");</script>
</binding>
</key>
<key n="101">
<name>e</name>
<desc>ENT</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000_pushButton(arg[0], "ENT");</script>
</binding>
</key>
<key n="105">
<name>i</name>
<desc>FMS inner knob</desc>
<key n="94">
<name>^</name>
<desc>clockwise</desc>
<no-exit/>
<binding>
<command>nasal</command>
<script>zkv1000_turnKnob(arg[0], "FmsInner", 1, "FMS inner");</script>
</binding>
</key>
<key n="95">
<name>_</name>
<desc>clockwise</desc>
<no-exit/>
<binding>
<command>nasal</command>
<script>zkv1000_turnKnob(arg[0], "FmsInner", -1, "FMS inner");</script>
</binding>
</key>
<key n="99">
<name>c</name>
<desc>CLR</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000_pushButton(arg[0], "CLR");</script>
</binding>
</key>
<key n="101">
<name>e</name>
<desc>ENT</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000_pushButton(arg[0], "ENT");</script>
</binding>
</key>
</key>
<key n="111">
<name>o</name>
<desc>FMS outer knob</desc>
<key n="94">
<name>^</name>
<desc>clockwise</desc>
<no-exit/>
<binding>
<command>nasal</command>
<script>zkv1000_turnKnob(arg[0], "FmsOuter", -1, "FMS outer");</script>
</binding>
</key>
<key n="95">
<name>_</name>
<desc>counterclockwise</desc>
<no-exit/>
<binding>
<command>nasal</command>
<script>zkv1000_turnKnob(arg[0], "FmsOuter", 1, "FMS outer");</script>
</binding>
</key>
<key n="99">
<name>c</name>
<desc>CLR</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000_pushButton(arg[0], "CLR");</script>
</binding>
</key>
<key n="101">
<name>e</name>
<desc>ENT</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000_pushButton(arg[0], "ENT");</script>
</binding>
</key>
</key>
</key>
<key n="97">
<name>a</name>
<desc>Autopilot buttons</desc>
<key n="111">
<name>o</name>
<desc>AP</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000.autopilot.softkey('L', 0, 1);</script>
</binding>
</key>
<key n="102">
<name>f</name>
<desc>FD</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000.autopilot.softkey('L', 1, 1);</script>
</binding>
</key>
<key n="110">
<name>n</name>
<desc>NAV</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000.autopilot.softkey('L', 2, 1);</script>
</binding>
</key>
<key n="97">
<name>a</name>
<desc>ALT</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000.autopilot.softkey('L', 3, 1);</script>
</binding>
</key>
<key n="118">
<name>v</name>
<desc>VS</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000.autopilot.softkey('L', 4, 1);</script>
</binding>
</key>
<key n="99">
<name>c</name>
<desc>FLC</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000.autopilot.softkey('L', 5, 1);</script>
</binding>
</key>
<key n="121">
<name>y</name>
<desc>YD</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000.autopilot.softkey('R', 0, 1);</script>
</binding>
</key>
<key n="104">
<name>h</name>
<desc>HDG</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000.autopilot.softkey('R', 1, 1);</script>
</binding>
</key>
<key n="65">
<name>A</name>
<desc>APR</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000.autopilot.softkey('R', 2, 1);</script>
</binding>
</key>
<key n="">
<name>V</name>
<desc>VNV</desc>
<exit/>
<binding>
<command>nasal</command>
<script>zkv1000.autopilot.softkey('R', 3, 1);</script>
</binding>
</key>
<key n="117">
<name>u</name>
<desc>nose UP</desc>
<binding>
<command>nasal</command>
<script>zkv1000.autopilot.softkey('R', 4, 1);</script>
</binding>
</key>
<key n="100">
<name>d</name>
<desc>nose DOWN</desc>
<binding>
<command>nasal</command>
<script>zkv1000.autopilot.softkey('R', 5, 1);</script>
</binding>
</key>
</key>
</key>
</multikey>
</PropertyList>