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

********************************************
*
* Bindings for Winwing WINCTRL 32 RMP C
*
********************************************
-->
<PropertyList>
    <vendor-name>winctrl</vendor-name>
    <model-name>rmpc32</model-name>
    <vendor-id>winctrl</vendor-id>
    <model-id>rmpc32</model-id>
    <!--<vendor-id>4098</vendor-id>
    <model-id>bb85</model-id>-->
    <name>Winwing WINCTRL 32 RMP C</name>
    <debug-events type="bool">false</debug-events>
    <hid-debug-raw type="bool">false</hid-debug-raw>
    <nasal>
        <open>
            <![CDATA[
                logprint(LOG_DEBUG,"WINCTRL 32  RMP C Nasal (event) open");
                rmpc32 = input_helpers.winctrl.new("rmpc32",cmdarg());
                var panelBright = onOff= func() { return rmpc32.leds.panel.update(); }
                var ledBrtLED = func() { return rmpc32.leds.ledBrt.update(); }
                var lcdBright = func() { return rmpc32.leds.lcd.update(); }
                var selLED = func() { return rmpc32.leds.sel.update(); }
                var vhf1LED = func() { return rmpc32.leds.vhf1.update(); }
                var vhf2LED = func() { return rmpc32.leds.vhf2.update(); }
                var vhf3LED = func() { return rmpc32.leds.vhf3.update(); }
                var loadLED = func() { return rmpc32.leds.load.update(); }
                var hf1LED = func() { return rmpc32.leds.hf1.update(); }
                var hf2LED = func() { return rmpc32.leds.hf2.update(); }
                var amLED = func() { return rmpc32.leds.am.update(); }
                var navLED = func() { return rmpc32.leds.nav.update(); }
                var vorLED = func() { return rmpc32.leds.vor.update(); }
                var lsLED = func() { return rmpc32.leds.ls.update(); }
                var glsLED = func() { return rmpc32.leds.gls.update(); }
                var mlsLED = func() { return rmpc32.leds.mls.update(); }
                var adfLED = func() { return rmpc32.leds.adf.update(); }
                var refreshDisp = func() { return rmpc32.refreshDisp(); }
                var updateRMPCDisplay = func() { return rmpc32.updateDisp(); }
            ]]>
        </open>
        <close>
            <![CDATA[
                logprint(LOG_DEBUG,"WINCTRL 32 RMP C Nasal (event) close");
                rmpc32.close(cmdarg());
            ]]>
        </close>
    </nasal>
    <!-- HID BUTTONS  -->
    <event>
        <name>button-1</name>
        <desc>switchFreq</desc>
        <repeatable>false</repeatable>
        <binding>
            <command>nasal</command>
            <script>rmp.transfer(1);</script>
        </binding>
    </event>
    <event>
        <name>button-2</name>
        <desc>VHF1</desc>
        <repeatable>true</repeatable>
        <binding>
            <command>property-assign</command>
            <property>systems/radio/rmp[0]/sel_chan</property>
            <value>vhf1</value>
            <condition>
                <and>
                    <greater-than-equals>
                        <property>systems/electrical/bus/dc-ess</property>
                        <value>25</value>
                    </greater-than-equals>
                    <property>controls/radio/rmp[0]/on</property>
                </and>
            </condition>
        </binding>
    </event>
    <event>
        <name>button-3</name>
        <desc>VHF2</desc>
        <repeatable>true</repeatable>
        <binding>
            <command>property-assign</command>
            <property>systems/radio/rmp[0]/sel_chan</property>
            <value>vhf2</value>
            <condition>
                <and>
                    <greater-than-equals>
                        <property>systems/electrical/bus/dc-ess</property>
                        <value>25</value>
                    </greater-than-equals>
                    <property>controls/radio/rmp[0]/on</property>
                </and>
            </condition>
        </binding>
    </event>
    <event>
        <name>button-4</name>
        <desc>VHF3</desc>
        <repeatable>true</repeatable>
        <binding>
            <command>property-assign</command>
            <property>systems/radio/rmp[0]/sel_chan</property>
            <value>vhf3</value>
            <condition>
                <and>
                    <greater-than-equals>
                        <property>systems/electrical/bus/dc-ess</property>
                        <value>25</value>
                    </greater-than-equals>
                    <property>controls/radio/rmp[0]/on</property>
                </and>
            </condition>
        </binding>
    </event>
    <event>
        <name>button-5</name>
        <desc>LOAD</desc>
        <repeatable>false</repeatable>
        <binding>
            <command>property-assign</command>
            <property>/input/winctrl/rmpc32/buttons/load</property>
           <value>1</value>
        </binding>
        <mod-up>
            <binding>
                <command>property-assign</command>
                <property>/input/winctrl/rmpc32/buttons/load</property>
               <value>0</value>
            </binding>
        </mod-up>
    </event>
    <event>
        <name>button-6</name>
        <desc>HF1</desc>
        <repeatable>true</repeatable>
        <binding>
            <command>property-assign</command>
            <property>systems/radio/rmp[0]/sel_chan</property>
            <value>hf1</value>
            <condition>
                <and>
                    <greater-than-equals>
                        <property>systems/electrical/bus/dc-ess</property>
                        <value>25</value>
                    </greater-than-equals>
                    <property>controls/radio/rmp[0]/on</property>
                </and>
            </condition>
        </binding>
    </event>
    <event>
        <name>button-7</name>
        <desc>HF2</desc>
        <repeatable>true</repeatable>
        <binding>
            <command>property-assign</command>
            <property>systems/radio/rmp[0]/sel_chan</property>
            <value>hf2</value>
            <condition>
                <and>
                    <greater-than-equals>
                        <property>systems/electrical/bus/dc-ess</property>
                        <value>25</value>
                    </greater-than-equals>
                    <property>controls/radio/rmp[0]/on</property>
                </and>
            </condition>
        </binding>
    </event>
    <event>
        <name>button-8</name>
        <desc>AM</desc>
        <repeatable>false</repeatable>
        <binding>
            <command>property-toggle</command>
            <property>systems/radio/rmp[0]/am-active</property>
            <condition>
                <and>
                    <greater-than-equals>
                        <property>systems/electrical/bus/dc-ess</property>
                        <value>25</value>
                    </greater-than-equals>
                    <property>controls/radio/rmp[0]/on</property>
                    <or>
                        <equals>
                            <property>systems/radio/rmp[0]/sel_chan</property>
                            <value>hf1</value>
                        </equals>
                        <equals>
                            <property>systems/radio/rmp[0]/sel_chan</property>
                            <value>hf2</value>
                        </equals>
                    </or>
                </and>
            </condition>
        </binding>
    </event>
    <event>
        <name>button-9</name>
        <desc>NAV</desc>
        <repeatable>false</repeatable>
        <binding>
        <command>property-toggle</command>
        <property>systems/radio/rmp[0]/nav</property>
        <condition>
            <and>
                <greater-than-equals>
                    <property>systems/electrical/bus/dc-ess</property>
                    <value>25</value>
                </greater-than-equals>
                <property>controls/radio/rmp[0]/on</property>
            </and>
        </condition>
        </binding>
    </event>
    <event>
        <name>button-10</name>
        <desc>VOR</desc>
        <binding>
            <command>property-assign</command>
            <property>systems/radio/rmp[0]/sel_chan</property>
            <value>vor</value>
            <condition>
                <and>
                    <greater-than-equals>
                        <property>systems/electrical/bus/dc-ess</property>
                        <value>25</value>
                    </greater-than-equals>
                    <property>controls/radio/rmp[0]/on</property>
                    <property>systems/radio/rmp[0]/nav</property>
                </and>
            </condition>
        </binding>
    </event>
    <event>
        <name>button-11</name>
        <desc>ls</desc>
        <repeatable>true</repeatable>
        <binding>
            <command>property-assign</command>
            <property>systems/radio/rmp[0]/sel_chan</property>
            <value>ls</value>
            <condition>
                <and>
                    <greater-than-equals>
                        <property>systems/electrical/bus/dc-ess</property>
                        <value>25</value>
                    </greater-than-equals>
                    <property>controls/radio/rmp[0]/on</property>
                    <property>systems/radio/rmp[0]/nav</property>
                </and>
            </condition>
        </binding>
    </event>
    <event>
        <name>button-12</name>
        <desc>GLS</desc>
        <repeatable>false</repeatable>
        <binding>
            <command>property-assign</command>
            <property>/input/winctrl/rmpc32/buttons/gls</property>
           <value>1</value>
        </binding>
        <mod-up>
            <binding>
                <command>property-assign</command>
                <property>/input/winctrl/rmpc32/buttons/gls</property>
               <value>0</value>
            </binding>
        </mod-up>
    </event>
    <event>
        <name>button-13</name>
        <desc>MLS</desc>
        <repeatable>false</repeatable>
        <binding>
            <command>property-assign</command>
            <property>/input/winctrl/rmpc32/buttons/mls</property>
           <value>1</value>
        </binding>
        <mod-up>
            <binding>
                <command>property-assign</command>
                <property>/input/winctrl/rmpc32/buttons/mls</property>
               <value>0</value>
            </binding>
        </mod-up>
    </event>
    <event>
        <name>button-14</name>
        <desc>ADF</desc>
        <repeatable>true</repeatable>
        <binding>
            <command>property-assign</command>
            <property>systems/radio/rmp[0]/sel_chan</property>
            <value>adf</value>
            <condition>
                <and>
                    <greater-than-equals>
                        <property>systems/electrical/bus/dc-ess</property>
                        <value>25</value>
                    </greater-than-equals>
                    <property>controls/radio/rmp[0]/on</property>
                    <property>systems/radio/rmp[0]/nav</property>
                </and>
            </condition>
        </binding>
    </event>
    <event>
        <name>button-15</name>
        <desc>outer-left</desc>
        <repeatable>false</repeatable>
        <binding>
            <command>nasal</command>
            <script>rmpc32.turnKnob(0,-1);</script>
        </binding>
        <binding>
            <command>property-assign</command>
            <property>/input/winctrl/rmpc32/buttons/outer-left</property>
            <value>1</value>
        </binding>
        <mod-up>
            <binding>
                <command>property-assign</command>
                <property>/input/winctrl/rmpc32/buttons/outer-left</property>
                <value>0</value>
            </binding>
        </mod-up>
    </event>
    <event>
        <name>button-16</name>
        <desc>outer-right</desc>
        <repeatable>false</repeatable>
        <binding>
            <command>nasal</command>
            <script>rmpc32.turnKnob(0,1);</script>
        </binding>
        <binding>
            <command>property-assign</command>
            <property>/input/winctrl/rmpc32/buttons/outer-right</property>
            <value>1</value>
        </binding>
        <mod-up>
            <binding>
                <command>property-assign</command>
                <property>/input/winctrl/rmpc32/buttons/outer-right</property>
                <value>0</value>
            </binding>
        </mod-up>
    </event>
    <event>
        <name>button-17</name>
        <desc>inner-left</desc>
        <repeatable>false</repeatable>
        <binding>
            <command>nasal</command>
            <script>rmpc32.turnKnob(1,-1);</script>
        </binding>
        <binding>
            <command>property-assign</command>
            <property>/input/winctrl/rmpc32/buttons/inner-left</property>
            <value>1</value>
        </binding>
        <mod-up>
            <binding>
                <command>property-assign</command>
                <property>/input/winctrl/rmpc32/buttons/inner-left</property>
                <value>0</value>
            </binding>
        </mod-up>
    </event>
    <event>
        <name>button-18</name>
        <desc>inner-right</desc>
        <repeatable>false</repeatable>
        <binding>
            <command>nasal</command>
            <script>rmpc32.turnKnob(1,1);</script>
        </binding>
        <binding>
            <command>property-assign</command>
            <property>/input/winctrl/rmpc32/buttons/inner-right</property>
            <value>1</value>
        </binding>
        <mod-up>
            <binding>
                <command>property-assign</command>
                <property>/input/winctrl/rmpc32/buttons/inner-right</property>
                <value>0</value>
            </binding>
        </mod-up>
    </event>
    <event>
        <name>button-19</name>
        <desc>knob-press</desc>
        <repeatable>false</repeatable>
        <binding>
            <command>property-assign</command>
            <property>/input/winctrl/rmpc32/buttons/knob-press</property>
           <value>1</value>
        </binding>
        <mod-up>
            <binding>
                <command>property-assign</command>
                <property>/input/winctrl/rmpc32/buttons/knob-press</property>
               <value>0</value>
            </binding>
        </mod-up>
    </event>
    <event>
        <name>button-20</name>
        <desc>RMP ON</desc>
        <repeatable>false</repeatable>
        <binding>
            <command>property-assign</command>
            <property>/controls/radio/rmp[0]/on</property>
            <value>1</value>
        </binding>
        <binding>
            <command>property-assign</command>
            <property>/input/winctrl/rmpc32/buttons/powerOn</property>
           <value>1</value>
        </binding>
        <mod-up>
            <binding>
                <command>property-assign</command>
                <property>/input/winctrl/rmpc32/buttons/powerOn</property>
               <value>0</value>
            </binding>
        </mod-up>
    </event>
    <event>
        <name>button-21</name>
        <desc>RMP OFF</desc>
        <repeatable>false</repeatable>
        <binding>
            <command>property-assign</command>
            <property>/controls/radio/rmp[0]/on</property>
            <value>0</value>
        </binding>
    </event>
    <!-- begin lighting voodoo -->
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/rmpc32/leds/panel</watch>
        <nasal-function>panelBright</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/rmpc32/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/rmpc32/leds/lcd</watch>
        <nasal-function>lcdBright</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/rmpc32/leds/sel</watch>
        <nasal-function>selLED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/rmpc32/leds/vhf1</watch>
        <nasal-function>vhf1LED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/rmpc32/leds/vhf2</watch>
        <nasal-function>vhf2LED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/rmpc32/leds/vhf3</watch>
        <nasal-function>vhf3LED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/rmpc32/leds/load</watch>
        <nasal-function>loadLED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/rmpc32/leds/hf1</watch>
        <nasal-function>hf1LED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/rmpc32/leds/hf2</watch>
        <nasal-function>hf2LED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/rmpc32/leds/am</watch>
        <nasal-function>amLED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/rmpc32/leds/nav</watch>
        <nasal-function>navLED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/rmpc32/leds/vor</watch>
        <nasal-function>vorLED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/rmpc32/leds/ls</watch>
        <nasal-function>lsLED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/rmpc32/leds/gls</watch>
        <nasal-function>glsLED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/rmpc32/leds/mls</watch>
        <nasal-function>mlsLED</nasal-function>
    </report>
    <report>
        <report-id type="int">2</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/rmpc32/leds/adf</watch>
        <nasal-function>adfLED</nasal-function>
    </report>
    <report>
        <report-id type="int">240</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/rmpc32/active</watch>
        <nasal-function>updateRMPCDisplay</nasal-function>
    </report>
    <report>
        <report-id type="int">240</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/rmpc32/stby</watch>
        <nasal-function>updateRMPCDisplay</nasal-function>
    </report>
    <report>
        <report-id type="int">240</report-id>
        <report-type>output</report-type>
        <watch>/input/winctrl/rmpc32/rmpc-refresh-display</watch>
        <nasal-function>refreshDisp</nasal-function>
    </report>
</PropertyList>
