<?xml version="1.0"?>
<!--
SPDX-License-Identifier: GPL-2.0-or-later
SPDX-FileCopyrightText: 2026 nia
SPDX-FileCopyrightText: 2026 Kent Stevens (timeplt)

********************************************
*
* Bindings for WINCRTL MCDU-32 CO-PILOT
*
********************************************
-->

<PropertyList>
    <vendor-id>winctrl</vendor-id>
    <model-id>mcdu32</model-id>
    <name>Winwing WINWING MCDU-32-CO-PILOT</name>
    <name>Winwing WINCTRL 32 MCDU CO-PILOT</name>
    <nasal>
        <open>
            <![CDATA[
                logprint(LOG_DEBUG,"WINCTRL MCDU Nasal (event) open");
                var mcdu32 = input_helpers.winctrl.new("mcdu32",cmdarg(),"fo");
                var panelLED = func() { return mcdu32.leds.panel.update(); }
                var ledBrtLED= func() { return mcdu32.leds.ledBrt.update(); }
                var dispLED = func() { return mcdu32.leds.disp.update(); }
                var annFailLED = func() { return mcdu32.leds.annFail.update(); }
                var annFmLED = func() { return mcdu32.leds.annFm.update(); }
                var annFm1LED = func() { return mcdu32.leds.annFm1.update(); }
                var annFm2LED = func() { return mcdu32.leds.annFm2.update(); }
                var annMsg1LED = func() { return mcdu32.leds.annMsg1.update(); }
                var annMsg2LED = func() { return mcdu32.leds.annMsg2.update(); }
                var annIndLED = func() { return mcdu32.leds.annInd.update(); }
                var annIndLED = func() { return mcdu32.leds.annInd.update(); }
                var annRdyLED = func() { return mcdu32.leds.annRdy.update(); }
                var annDashLED = func() { return mcdu32.leds.annDash.update(); }

                # some props
                setprop("/input/winctrl/mcdu32/fo/lux1", 1);
                setprop("/input/winctrl/mcdu32/fo/lux2", 1);

                var initDisplay = func() { return mcdu32.initDisplay(); }
                var updateDisplay = func() { return mcdu32.updateDisplay(); }
            ]]>
        </open>
        <close>
            <![CDATA[
                logprint(2,"WINCTRL MCDU Nasal (event) close");
                mcdu32.close(cmdarg());
            ]]>
        </close>
    </nasal>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/mcdu32/fo/leds/annFail</watch>
        <nasal-function>annFailLED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/mcdu32/fo/leds/annDash</watch>
        <nasal-function>annDashLED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/mcdu32/fo/leds/annFm</watch>
        <nasal-function>annFmLED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/mcdu32/fo/leds/annFm1</watch>
        <nasal-function>annFm1LED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/mcdu32/fo/leds/annFm2</watch>
        <nasal-function>annFm2LED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/mcdu32/fo/leds/annMsg1</watch>
        <nasal-function>annMsg1LED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/mcdu32/fo/leds/annMsg2</watch>
        <nasal-function>annMsg2LED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/mcdu32/fo/leds/annRdy</watch>
        <nasal-function>annRdyLED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/mcdu32/fo/leds/annInd</watch>
        <nasal-function>annIndLED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/mcdu32/fo/leds/panel</watch>
        <nasal-function>panelLED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/mcdu32/fo/leds/ledBrt</watch>
        <nasal-function>ledBrtLED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/mcdu32/fo/leds/disp</watch>
        <nasal-function>dispLED</nasal-function>
    </report>
    <report>
        <report-id type="int">240</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/mcdu32/fo/writeCounter</watch>
        <nasal-function>initDisplay</nasal-function>
    </report>
    <report>
        <report-id type="int">242</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/mcdu32/fo/msgCounter</watch>
        <nasal-function>updateDisplay</nasal-function>
    </report>
    <event>
        <name>button-1</name>
        <desc type="string">Left LSK 1</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.lskbutton("1", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-2</name>
        <desc type="string">Left LSK 2</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.lskbutton("2", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-3</name>
        <desc type="string">Left LSK 3</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.lskbutton("3", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-4</name>
        <desc type="string">Left LSK 4</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.lskbutton("4", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-5</name>
        <desc type="string">Left LSK 5</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.lskbutton("5", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-6</name>
        <desc type="string">Left LSK 6</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.lskbutton("6", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-7</name>
        <desc type="string">Right LSK 1</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.rskbutton("1", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-8</name>
        <desc type="string">Right LSK 2</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.rskbutton("2", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-9</name>
        <desc type="string">Right LSK 3</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.rskbutton("3", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-10</name>
        <desc type="string">Right LSK 4</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.rskbutton("4", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-11</name>
        <desc type="string">Right LSK 5</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.rskbutton("5", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-12</name>
        <desc type="string">Right LSK 6</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.rskbutton("6", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-13</name>
        <desc type="string">DIR</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.pagebutton("dirto", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-14</name>
        <desc type="string">PROG</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.pagebutton("prog", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-15</name>
        <desc type="string">PERF</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.pagebutton("perf", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-16</name>
        <desc type="string">INIT</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.pagebutton("init", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-17</name>
        <desc type="string">DATA</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.pagebutton("data", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-19</name>
        <desc type="string">Brightness Increase</desc>
        <repeatable type="string">true</repeatable>
        <binding>
            <command>property-adjust</command>
            <property>controls/lighting/DU/mcdu2</property>
            <min>0.0</min>
            <max>1.0</max>
            <step>0.05</step>
            <wrap>false</wrap>
        </binding>
    </event>
    <event>
        <name>button-20</name>
        <desc type="string">FPLN</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.pagebutton("f-pln", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-21</name>
        <desc type="string">RAD NAV</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.pagebutton("radnav", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-22</name>
        <desc type="string">FUEL PRED</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.pagebutton("fuel-pred", 1);</script>
        </binding>
    </event>
    <!--event> TODO once implemented aircraft side
        <name>button-23</name>
        <desc type="string">SEC FPLN</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script></script>
        </binding>
    </event-->
    <event>
        <name>button-24</name>
        <desc type="string">ATC COMM</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.pagebutton("atc", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-25</name>
        <desc type="string">MCDU MENU</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.pagebutton("mcdu", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-26</name>
        <desc type="string">Brightness Decrease</desc>
        <repeatable type="string">true</repeatable>
        <binding>
            <command>property-adjust</command>
            <property>controls/lighting/DU/mcdu2</property>
            <min>0.0</min>
            <max>1.0</max>
            <step>-0.05</step>
            <wrap>false</wrap>
        </binding>
    </event>
    <event>
        <name>button-27</name>
        <desc type="string">AIRPORT</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.pagebutton("airport", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-29</name>
        <desc type="string">Left</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.arrowbutton("left", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-30</name>
        <desc type="string">Up</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.arrowbutton("up", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-31</name>
        <desc type="string">Right</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.arrowbutton("right", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-32</name>
        <desc type="string">Down</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.arrowbutton("down", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-33</name>
        <desc type="string">1</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("1", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-34</name>
        <desc type="string">2</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("2", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-35</name>
        <desc type="string">3</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("3", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-36</name>
        <desc type="string">4</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("4", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-37</name>
        <desc type="string">5</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("5", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-38</name>
        <desc type="string">6</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("6", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-39</name>
        <desc type="string">7</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("7", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-40</name>
        <desc type="string">8</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("8", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-41</name>
        <desc type="string">9</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("9", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-42</name>
        <desc type="string">.</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("DOT", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-43</name>
        <desc type="string">0</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("0", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-44</name>
        <desc type="string">+/-</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("PLUSMINUS", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-45</name>
        <desc type="string">A</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("A", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-46</name>
        <desc type="string">B</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("B", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-47</name>
        <desc type="string">C</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("C", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-48</name>
        <desc type="string">D</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("D", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-49</name>
        <desc type="string">E</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("E", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-50</name>
        <desc type="string">F</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("F", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-51</name>
        <desc type="string">G</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("G", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-52</name>
        <desc type="string">H</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("H", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-53</name>
        <desc type="string">I</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("I", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-54</name>
        <desc type="string">J</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("J", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-55</name>
        <desc type="string">K</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("K", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-56</name>
        <desc type="string">L</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("L", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-57</name>
        <desc type="string">M</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("M", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-58</name>
        <desc type="string">N</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("N", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-59</name>
        <desc type="string">O</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("O", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-60</name>
        <desc type="string">P</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("P", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-61</name>
        <desc type="string">Q</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("Q", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-62</name>
        <desc type="string">R</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("R", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-63</name>
        <desc type="string">S</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("S", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-64</name>
        <desc type="string">T</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("T", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-65</name>
        <desc type="string">U</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("U", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-66</name>
        <desc type="string">V</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("V", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-67</name>
        <desc type="string">W</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("W", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-68</name>
        <desc type="string">X</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("X", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-69</name>
        <desc type="string">Y</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("Y", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-70</name>
        <desc type="string">Z</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("Z", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-71</name>
        <desc type="string">/</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("SLASH", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-72</name>
        <desc type="string">SP</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("SP", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-73</name>
        <desc type="string">OVERFLY</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("OVFY", 1);</script>
        </binding>
    </event>
    <event>
        <name>button-74</name>
        <desc type="string">CLR</desc>
        <repeatable type="string">false</repeatable>
        <binding>
            <command>nasal</command>
            <script>mcdu.button("CLR", 1, "down");</script>
        </binding>
        <mod-up>
            <binding>
                <command>nasal</command>
                <script>mcdu.button("CLR", 1, "up");</script>
            </binding>
        </mod-up>
    </event>
    <event>
        <desc>MCDU lux1</desc>
        <name>abs-x-rotate</name>
        <min-range>-4095</min-range>
        <max-range>4095</max-range>
        <dead-band type="double">0.0</dead-band>
        <binding>
            <command>property-scale</command>
            <property>/input/winctrl/mcdu32/fo/lux1</property>
        </binding>
    </event>
    <event>
        <desc>MCDU lux2</desc>
        <name>abs-y-rotate</name>
        <min-range>-4095</min-range>
        <max-range>4095</max-range>
        <dead-band type="double">0.0</dead-band>
        <binding>
            <command>property-scale</command>
            <property>/input/winctrl/mcdu32/fo/lux2</property>
        </binding>
    </event>
</PropertyList>
