Facility Control

 View Only
  • 1.  Changing toggle state from Xpression

    Posted 04-30-2018 22:37
    I have a few parameters set as toggle switches for calling in and taking out sequences from xpression. I frequently have to clear my buffer from Xpression itself but the button on dashboard remains in the active state. From what I've read my solution to this, is to add a listener but I am not sure how to set the parameter or task to a button.
    Would anyone walk me though the process.

    From what I read, I set up the listener on my grid and set the port to the default 7788, I've also activated the listener option in the preferences.

    Any help would be greatly appreciated.




  • 2.  RE: Changing toggle state from Xpression

    Posted 05-03-2018 21:25

    You might be able to trigger a GPI call into DashBoard when your buffer gets cleared but I'll admit that I'm not an expert on what XPression is able to send to DashBoard via RossTalk.

    If you can, have XPression send DashBoard a GPI trigger with a state when the buffer is cleared. DashBoard has a global GPI listener you can enable under Window->Preferences and we typically use port 7788 (though it can be configured if that port is already in use).

     

    <abs contexttype="opengear" id="_top" style="">
       <meta>
          <params>
             <param access="1" constrainttype="INT_CHOICE" name="BUTTON_PARAMETER_OID" oid="BUTTON_PARAMETER_OID" precision="0" type="INT32" value="0" widget="toggle">
                <constraint key="0">OFF</constraint>
                <constraint key="1">ON</constraint>
             </param>
          </params>
       </meta>
       <param expand="true" gpi="100" height="111" left="134" oid="BUTTON_PARAMETER_OID" style="style:toggleButton;" top="130" width="210">
          <task tasktype="ogscript">if (event &amp;&amp; event.getState &amp;&amp; event.getState() != null) //IF MY PARAMETER WAS TRIGGERED VIA GPI 100:0 or GPI 100:1
    {
       if (params.getValue('BUTTON_PARAMETER_OID', 0) != parseInt(event.getState())) //IF THE STATE VALUE (0 or 1) IS DIFFERENT FROM THE PARAMETER VALUE
       {
          params.setValue('BUTTON_PARAMETER_OID', 0, parseInt(event.getState()));  //SET THE PARAMETER VALUE
       }
       return;
    }
    
    //DO MY REGULAR TASK HERE</task>
       </param>
       <simplegrid height="75" left="115" rows="1" top="277" width="349">
          <button buttontype="push" name="OFF">
             <task tasktype="ogscript">
    
    
    /*! block id=1001 !*/
    ogscript.fireGPI(100, 0, false);
    /*!!
     &lt;block id="1001" type="ogscript_gpio" x="10" y="100" w="243" GPI="100" STATE="0" GLOBAL="false" /&gt;
    !!*/
    /*!!&lt;checksum&gt;8a6c736f64d72caf2a76a56f09383411&lt;/checksum&gt;!!*/</task>
          </button>
          <button buttontype="push" name="ON">
             <task tasktype="ogscript">
    
    
    /*! block id=1002 !*/
    ogscript.fireGPI(100, 1, false);
    /*!!
     &lt;block id="1002" type="ogscript_gpio" x="10" y="100" w="243" GPI="100" STATE="1" GLOBAL="false" /&gt;
    !!*/
    /*!!&lt;checksum&gt;e857dee00635fbc7f1826683996d66a1&lt;/checksum&gt;!!*/</task>
          </button>
       </simplegrid>
    </abs>

    The important part being this:

     
       <param expand="true" gpi="100" height="111" left="134" oid="BUTTON_PARAMETER_OID" style="style:toggleButton;" top="130" width="210">
          <task tasktype="ogscript">if (event &amp;&amp; event.getState &amp;&amp; event.getState() != null) //IF MY PARAMETER WAS TRIGGERED VIA GPI 100:0 or GPI 100:1
    {
       if (params.getValue('BUTTON_PARAMETER_OID', 0) != parseInt(event.getState())) //IF THE STATE VALUE (0 or 1) IS DIFFERENT FROM THE PARAMETER VALUE
       {
          params.setValue('BUTTON_PARAMETER_OID', 0, parseInt(event.getState()));  //SET THE PARAMETER VALUE
       }
       return;
    }
    
    //DO MY REGULAR TASK HERE</task>
       </param>

    #DashBoard