Hi Ryan
There are several ways to try to get this workflow. One way is to have your own copy of the parameter that you use to display/update the device's copy. You can listen for changes to the device's parameter and, if your copy is being set to the same value as the device's, you don't write anything back to the device.
<abs contexttype="opengear" keepalive="true">
<meta>
<params>
<param access="1" constraint="0.0;100.0;0.0;100.0;1" constrainttype="INT_STEP_RANGE" name="Device Parameter" oid="Device_Parameter" precision="0" type="INT32" value="83" widget="slider-horizontal"/>
<param access="1" constraint="0.0;100.0;0.0;100.0;1" constrainttype="INT_STEP_RANGE" name="My Parameter" oid="My_Parameter" precision="0" type="INT32" value="83" widget="slider-horizontal"/>
</params>
<ogscript element="0" handles="onchange,onload" oid="Device_Parameter">var deviceValue = params.getValue('Device_Parameter', 0); // get the device value
ogscript.putObject('device-value', deviceValue); // store it so you know it came from the device
params.setValue('My_Parameter', 0, deviceValue); // update your display parameter</ogscript>
</meta>
<param expand="true" height="125" left="199" oid="Device_Parameter" top="66" width="458"/>
<param expand="true" height="119" left="201" oid="My_Parameter" top="225" width="459">
<task tasktype="ogscript">if (this.getValue() != ogscript.getObject('device-value'))
{
ogscript.debug("I updated the parameter");
params.setValue('Device_Parameter', 0, this.getValue());
}</task>
</param>
<label height="48" left="29" name="Device Parameter" style="txt-align:east" top="98" width="152"/>
<label height="48" left="31" name="My Parameter" style="txt-align:east;" top="249" width="152"/>
</abs>
------------------------------
James Peltzer
Ross Video
------------------------------
Original Message:
Sent: 11-15-2022 17:57
From: Ryan Ksenich
Subject: Differentiating source of param change
Greetings,
Is there a way to know the source of a param change? I have widget controls on params that will process changes and send them to a networked device. However, if the settings on that device are changed outside of dashboard, I want to update the dashboard display to the new values. I am able to get a listener to process these messages, but if I set the params to new values via ogscript, this also triggers the changed events sending the updates back to the device and floods the network with unnecessary traffic.
I would like to find a way to have messages sent only when the user changes the values within dashboard, not when they are updated by code in the listener. Any suggestions?
#DashBoard
------------------------------
~Ryan
------------------------------