control4 / docs-driverworks

Home Page for the Driverworks SDK
Other
41 stars 17 forks source link

Adding a button to a keypad doesn't seem to work. #19

Open DDevine opened 2 years ago

DDevine commented 2 years ago

I am attempting to create a keypad driver. I have the basic skeleton done, and I am trying to programmatically add buttons but they do not seem to be getting added.

My driver XML looks like this (other details omitted).

...
<proxies>
    <proxy proxybindingid="5002" name="my Keypad">keypad_proxy</proxy>
</proxies><capabilities>
    <has_leds>true</has_leds>
    <has_button_events>true</has_button_events>
    <buttons_are_virtual>false</buttons_are_virtual>
    <hide_proxy_events>false</hide_proxy_events>
    <num_buttons>32</num_buttons>
</capabilities><connections>
    <connection>
        <id>1</id>
        <facing>6</facing>
        <connectionname>my IDC</connectionname>
        <type>1</type>
        <consumer>True</consumer>
        <audiosource>False</audiosource>
        <videosource>False</videosource>
        <linelevel>False</linelevel>
        <classes>
            <class>
                <classname>MY_IDC</classname>
            </class>
        </classes>
        <hidden>False</hidden>
    </connection>
    <connection>
        <id>5002</id>
        <facing>6</facing>
        <connectionname>Keypad</connectionname>
        <type>2</type>
        <consumer>False</consumer>
        <audiosource>False</audiosource>
        <videosource>False</videosource>
        <linelevel>False</linelevel>
        <classes>
            <class>
                <classname>KEYPAD_PROXY</classname>
                <autobind>True</autobind>
            </class>
        </classes>
        <hidden>False</hidden>
    </connection>
</connections>
...

I am unsure about capabilities associated with keypads. Those are my best guess. Also, my num_buttons might be completely wrong as the documentation looks like it implies there are only 4 values?

I attempt to add a test button like this:

    C4:SendToProxy(5002, "NEW_KEYPAD_BUTTON", {
        BUTTON_ID = 1,
        NAME = "TEST Button",
        ON_COLOR = "00FF00",
        OFF_COLOR = "FF0000",
        SLOTS = 2,
    }, "NOTIFY")

I'd appreciate some guidance or a keypad example project. I could probably create a driver from scratch that does what I need, but I was hoping to use the Keypad API.