You can also pull the parser out of the timer and ask it to take care of translating the hours, minutes, and seconds into milliseconds for you. We have an example panel that does this with a timer using an hours:minutes encoding.
<abs contexttype="opengear" gridsize="20" style="">
<meta>
<params>
<param access="1" maxlength="0" name="cddisplay" oid="cddisplay" stateless="true" type="STRING" value="37:55" widget="label"/>
<param access="1" maxlength="0" name="cdvalue" oid="cdvalue" type="STRING" value="40:00" widget="text"/>
<param access="1" maxlength="0" name="cdstop" oid="cdstop" type="STRING" value="39:45" widget="text"/>
<param access="1" maxlength="0" name="cdcurrent" oid="cdcurrent" type="STRING" value="20:00" widget="text"/>
</params>
</meta>
<timer autostart="false" id="cdtimer" pattern="mm:ss" rate="500" start="999:59" stop="00:00">
<timertask tasktype="ogparamset">params.setValue('cddisplay', 0, event.getDisplay());</timertask>
</timer>
<param expand="true" height="60" left="40" oid="cddisplay" style="style:timerLabel" top="40" width="120"/>
<param expand="true" height="60" left="40" oid="cdvalue" top="120" width="120"/>
<button buttontype="push" height="60" left="180" name="Start / Pause" top="40" width="120">
<task tasktype="ogscript">var timer = ogscript.getTimerManager().getTimer("cdtimer");
if (!timer.isRunning())
{
timer.startTimer(false);
}
else
{
timer.stopTimer(false);
}</task>
</button>
<button buttontype="push" height="60" left="180" name="Set Start" top="120" width="120">
<task tasktype="timercontrol">var startValue = params.getValue('cdvalue', 0);
var timer = ogscript.getTimerManager().getTimer('cdtimer');
var parsedStartValue = timer.getFormat().parseObject(startValue);
timer.setStart(parsedStartValue);
timer.setTime(parsedStartValue);</task>
</button>
<button buttontype="push" height="220" left="320" name="Reset" top="40" width="80">
<task tasktype="ogscript">var timer = ogscript.getTimerManager().getTimer('cdtimer');
timer.resetTimer();</task>
</button>
<param expand="true" height="60" left="40" oid="cdstop" top="200" width="120"/>
<button buttontype="push" height="60" left="180" name="Set Stop" top="200" width="120">
<task tasktype="timercontrol">var startValue = params.getValue('cdstop', 0);
var timer = ogscript.getTimerManager().getTimer('cdtimer');
var parsedStartValue = timer.getFormat().parseObject(startValue);
timer.setStop(parsedStartValue);
//timer.setTime(parsedStartValue);</task>
</button>
<param expand="true" height="60" left="40" oid="cdcurrent" top="280" width="120"/>
<button buttontype="push" height="60" left="180" name="Set Current" top="280" width="120">
<task tasktype="timercontrol">var startValue = params.getValue('cdcurrent', 0);
var timer = ogscript.getTimerManager().getTimer('cdtimer');
var parsedStartValue = timer.getFormat().parseObject(startValue);
timer.setTime(parsedStartValue);
</task>
</button>
</abs>
The key part of the code is this:
var timer = ogscript.getTimerManager().getTimer('cdtimer');
var parsedStartValue = timer.getFormat().parseObject(startTimeAsText);
timer.setStart(parsedStartValue); //set the starting value of the timer
timer.setTime(parsedStartValue); //set the current value of the timer
------------------------------
James Peltzer
Ross Video
------------------------------
Original Message:
Sent: 10-10-2022 18:27
From: Aleksander Stalsberg
Subject: DashBoard Text Field Updates Xpression Clock Timer Widget
I dont have time right now to give you a good example... But it's a fairly straight forward process...
Can be done without scripting as well if you need to I believe.
The timer in DashBoard accepts milliseconds on it's set value, so:
- First you got to separate the minutes and seconds you punch in in DashBoard.
- Then do seconds * 1000
- Do minutes * 60 * 1000
- Add those two together, and then send that value to the "setTimer" command.
- Possibly add a start/stopp button(s) for the timer.
- And all you do to get it over do Xpression then is to send that parameter over via DataLinq like any other.
------------------------------
Aleksander Stalsberg
Inland Norway University of Applied Sciences/Lillehammer Icehockey Club
Norway
Original Message:
Sent: 10-10-2022 14:05
From: Nick Kubinski
Subject: DashBoard Text Field Updates Xpression Clock Timer Widget
Hi Matt,
Actually I wasn't able to figure out either option so this project got left by the wayside.
Sorry I can't be of any help to you. Do let me know if you get anything to work.
------------------------------
Nick Kubinski
Original Message:
Sent: 10-07-2022 16:57
From: Matt Finlayson
Subject: DashBoard Text Field Updates Xpression Clock Timer Widget
Hi Nick,
Did you ever get the steps to option 2? If so, can you share? I have a similar scenario. I want the Dashboard operator to enter the time in a text field and then click a button that starts the countdown. I am using a Clock parameter in Dashboard at the moment, but it seems to be limited to whatever start time you specify when setting up the parameter.
------------------------------
Matt Finlayson
Brigham Young University
Original Message:
Sent: 12-16-2021 14:48
From: Nick Kubinski
Subject: DashBoard Text Field Updates Xpression Clock Timer Widget
Hey Aleksander,
Option 2 sounds great, but our network isn't 100% reliable so option 1 is probably what I'd want to pursue. However, I'd still like to know the steps for option 2.
------------------------------
Nick Kubinski
Original Message:
Sent: 12-16-2021 06:32
From: Aleksander Stalsberg
Subject: DashBoard Text Field Updates Xpression Clock Timer Widget
Figured I could chime in with my two cents here...
As Jos asked here, from my experience you have the two options...
- Have a widget controlling the timer in Xpression. This way you have to map up the GPI/RossTalks to control each button.
However as far as I know, this will not let you set the time (other than reset) in the timer.
Might be possible with some Xpression scripting? I'll leave that one to others to decide.
Pros: All computing of the timer are within Xpression, and even if you loose the connection with the DashBoard, the timer will still work/run.
No latency in the timer. The timer is on Xpression locally and is not affected by latency in the network.
Cons: Not as much control over the timer as you can get with DashBoard.
- Have the timer in DashBoard and stream the value of that parameter through DataLinq. Requires a bit of setup, but once you're done, you can have a very versatile timer in DashBoard streaming over into Xpression. Relatively simple to set up the buttons required in DashBoard without much coding knowledge. If you have that knowledge however, it can be even more rewarding.
Pros: Plenty of options and loads of customization etc you can do based on the value of the timer. Sky's the limit really...
Cons: You are 100% reliable on both DashBoard and DataLinq and a connection with both of them in order to get the data over to XPression.
Not had this as an issue yet, but it's worth noting if you're on an unreliable network for example.
------------------------------
Aleksander Stalsberg
Lillehammer Icehockey Club
Original Message:
Sent: 12-15-2021 11:57
From: Nick Kubinski
Subject: DashBoard Text Field Updates Xpression Clock Timer Widget
Hi Jos,
We do have access to Xpression Datalinq Server, so either of the methods you mentioned would work.
------------------------------
Nick Kubinski
Original Message:
Sent: 12-13-2021 01:17
From: Jos Ford
Subject: DashBoard Text Field Updates Xpression Clock Timer Widget
The other question, do you want the XPression Timer Widget to be controlled by DashBoard or do you have datalinq and want to use a DashBoard Timer sending data to XPression?
------------------------------
Jos Ford
Ross Video
Original Message:
Sent: 12-08-2021 15:51
From: Nick Kubinski
Subject: DashBoard Text Field Updates Xpression Clock Timer Widget
Hail and Well Met,
I'm a DashBoard and Xpression newbie so please forgive me if this is a silly question.
I'm trying to create an editable text field in a custom DashBoard panel that updates a clock timer widget in Xpression whenever an operator enters text into it (HH:MM:SS format). I'm able to achieve this using a Choice Parameter button and assigning GPI/RossTalk numbers to the various times, but I was hoping to give our operators the option to fully customize the timer via DashBoard.
------------------------------
Nick Kubinski
------------------------------