<?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 OBSERVER
*
* THIS WILL NOT WORK UNTIL THE A320 SUPPORTS A 3rd MCDU!!!
*
********************************************
-->
<PropertyList>
    <vendor-name>winctrl</vendor-name>
    <model-name>mcdu32</model-name>
    <name>Winwing WINWING MCDU-32-OBSERVER</name>
    <name>Winwing WINCTRL 32 MCDU OBSERVER</name>
    <nasal>
        <open>
            <![CDATA[
                logprint(LOG_DEBUG,"WINCTRL MCDU Nasal (event) open");
                var mcdu32 = input_helpers.winctrl.new("mcdu32",cmdarg(),device,"obs");
                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/obs/lux1", 1);
                setprop("/input/winctrl/mcdu32/obs/lux2", 1);

                var initDisplay = func() { return mcdu32.initDisplay(); }
                var updateDisplay = func() { return mcdu32.updateDisplay(); }
            ]]>
        </open>
        <close>
            <![CDATA[
                logprint(LOG_DEBUG,"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/obs/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/obs/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/obs/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/obs/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/obs/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/obs/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/obs/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/obs/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/obs/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/obs/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/obs/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/obs/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/obs/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/obs/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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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/mcdu3</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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/mcdu3</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2);</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", 2, "down");</script>
        </binding>
        <mod-up>
            <binding>
                <command>nasal</command>
                <script>mcdu.button("CLR", 2, "up");</script>
            </binding>
        </mod-up>
    </event>
    <event>
        <desc>MCDU lux1</desc>
        <name>abs-x-rotate</name>
        <output-mode>direct</output-mode>
        <binding>
            <command>property-scale</command>
            <property>/input/winctrl/mcdu32/obs/lux1</property>
        </binding>
    </event>
    <event>
        <desc>MCDU lux2</desc>
        <name>abs-y-rotate</name>
        <output-mode>direct</output-mode>
        <binding>
            <command>property-scale</command>
            <property>/input/winctrl/mcdu32/obs/lux2</property>
        </binding>
    </event>
</PropertyList>
