Facility Control

 View Only
  • 1.  UDP String

    Posted 03-26-2020 18:13

    I am able to send UDP Strings to trigger lighting looks for our Arena. Currently I am having a problem. While this worked the first time I did it, it is now broken. Any thoughts why when a setting up a string using visual logic as "<312>" without the parentheses of course, it will not fire. When I go back into the button this is what the code says.

     

    <button buttontype="push" height="164" left="12" name="Test" top="17" width="190">
    <task tasktype="ogscript">


    /*! block id=1012 !*/
    ogscript.sendUDPString("10.101.101.151", 27001, "&lt;312&gt;");
    /*!!
    &lt;block id="1012" type="ogscript_sendudpasstring" x="464" y="251" w="318" HOST="10.101.101.151" PORT="27001" STRING="&amp;lt;312&amp;gt;" /&gt;
    !!*/
    /*!!&lt;checksum&gt;189398fdd64efdc35eb4799f35663b11&lt;/checksum&gt;!!*/</task>
    </button>

     

    On either side of 312 it turns into Garbage and removes < >. 

      



  • 2.  RE: UDP String

    Posted 03-27-2020 10:35

    Hi Jeff,

    <312> will be encoded to &lt;312&gt; but this should still send encoded chars and you should get &lt;312&gt; on the other side.

    I've created a quick example for you to test UDP sending and receiving. You will need to have two instance of DashBoard running to do this which on windows is relatively straight forward, if you navigate to the DashBoard.exe double click on it to open it then repeat to open another instance.

    If you create a new panel and paste the following code in, this will be your sender panel, I have included your code example in visiual logic and also one using ogscript alone. I have also hooked up two params to allow you to change the host and port at runtime.

    <abs contexttype="opengear" id="_top" keepalive="false">
    <meta>
    <params>
    <param access="1" maxlength="0" name="host" oid="host" type="STRING" value="127.0.0.1" widget="default"/>
    <param access="1" constraint="80.0;99999.0;80.0;99999.0;1" constrainttype="INT_STEP_RANGE" name="port" oid="port" precision="0" type="INT32" value="27001" widget="default"/>
    </params>
    </meta>
    <button buttontype="push" height="164" left="16" name="Visual Logic Test" top="165" width="190">
    <task tasktype="ogscript">/*! block id=1012,1014,1015 !*/
    ogscript.sendUDPString(params.getValue('host', 0), params.getValue('port', 0), "&amp;lt;312&amp;gt;");
    /*!!
    &lt;block id="1012" type="ogscript_sendudpasstring" x="464" y="251" w="318" HOST="ID:1014" PORT="ID:1015" STRING="&amp;amp;lt;312&amp;amp;gt;" /&gt;
    &lt;block id="1014" type="param__top&amp;amp;host (host)[0]" x="137" y="188" w="243" SET="" /&gt;
    &lt;block id="1015" type="param__top&amp;amp;port (port)[0]" x="139" y="279" w="243" SET="" /&gt;
    !!*/
    /*!!&lt;checksum&gt;b2867cb777b710acabe3328247b60179&lt;/checksum&gt;!!*/</task>
    </button>
    <button buttontype="push" height="164" left="18" name="Ogscript Test" top="337" width="190">
    <task tasktype="ogscript">var sendToHost = params.getValue( "host", 0 );
    var sendToPort = params.getValue( "port", 0 );
    ogscript.debug( "HOST: " + sendToHost + " : " + sendToPort );
    ogscript.sendUDPString(sendToHost, sendToPort, "&amp;lt;312&amp;gt;");</task>
    </button>
    <table height="134" left="16" style="bg#tabbg;" top="19" width="439">
    <tr>
    <label colspan="1" fill="both" insets="4,4,4,4" name="Host" rowspan="1" style="txt-align:east;" weightx="1.0" weighty="1.0"/>
    <param colspan="1" expand="true" fill="both" oid="host" rowspan="1" showlabel="false" weightx="1.0" weighty="1.0"/>
    </tr>
    <tr>
    <label colspan="1" fill="both" insets="4,4,4,4" name="Port" rowspan="1" style="txt-align:east;" weightx="1.0" weighty="1.0"/>
    <param colspan="1" expand="true" fill="both" oid="port" rowspan="1" showlabel="false" weightx="1.0" weighty="1.0"/>
    </tr>
    </table>
    </abs>

    And in the other instance of DashBoard create anther panel which will be your receiver and paste in the following code:

    <abs contexttype="opengear" id="_top" keepalive="false">
    <meta>
    <params>
    <param access="1" maxlength="0" name="received" oid="received" type="STRING" value="" widget="default"/>
    </params>
    </meta>
    <meta>
    <listener autostart="true" listenport="27001" maxlength="1024" udp="true">
    <task tasktype="ogscript">ogscript.debug( "Got a UDP message: " + event.getBytesAsString() );
    params.setValue( "received", 0, event.getBytesAsString() );</task>
    </listener>
    </meta>
    <param expand="true" height="113" left="33" oid="received" showlabel="false" top="56" width="330"/>
    </abs>

    This will allow you to test the UDP message is being sent and received and also check the format that's being sent.

    Let me know how you get on and if this works. If the receiver is working then you can try hooking this into your lighting and see if that works.

    I hope this helps.

    Thanks

     

    Colin.

     


    #DashBoard