Hi Dalot,
Assuming that you want to set a Crosspoint, please find below a sample custom panel source code on how to achieve it.
In the source code below, we have two params displayed as combo choices.
The first param stores the source and the second param stores the destination. To populate the combo box choices (int choices), we use the loadUltrixTable function. You can use the (CTRL + I) shortchut key to inspect the values, by double-clicking the dropdowns which should match available sources of your ultrix.
The most important function you are probably looking for is the doUltrixSwitch, which is the one used by the take button. In this scenario, the doUltrixSwitch creates a multiset to update all levels you wish to update using the relevant oid, and executes it.
I have created a second doUltrixSwitch function which uses rosstalk commands to achieve the same thing, the code snippet will be added below the first one.
<abs contexttype="opengear" gridsize="20" keepalive="true">
<meta>
<params>
<param access="1" constrainttype="INT_CHOICE" name="Sources" oid="Sources" precision="0" stateless="true" type="INT32" value="0" widget="combo">
<constraint key="0">Nothing</constraint>
</param>
<param access="1" constrainttype="INT_CHOICE" name="Destinations" oid="Destinations" precision="0" stateless="true" type="INT32" value="0" widget="combo">
<constraint key="0">Nothing</constraint>
</param>
</params>
<ogscript handles="onload">function loadUltrixTable(sources) {
var uOid = sources ? 'params.sources' : 'params.dests';
var pOid = sources ? 'Sources' : 'Destinations';
var newValues = [];
var numValuesP = params.getParam('ultrix', 'params.sources', 0);
var numValues = 0;
if (numValuesP != null)
{
numValues = numValuesP.getElementCount();
}
for (var i = 0; i < numValues; i++)
{
var name = params.getParam('ultrix', uOid + '.' + i + '.name', 0).getValue();
newValues[i] = { "key": i, "value": name };
}
if (newValues.length == 0)
{
newValues.push({"key": 0, "value": "Nothing Found"});
}
params.replaceConstraint(pOid, params.createIntChoiceConstraint(newValues));
}
function loadUltrixInfo()
{
loadUltrixTable(true);
loadUltrixTable(false);
}
loadUltrixInfo();</ogscript>
<api>function doUltrixSwitch(context, source, destination, level_string) {
level_string = level_string + "";
level_string = level_string.replace(/\s/g, ' ');
var levels = level_string.split(",");
var multiset = params.createMultiSet(context);
for(i=0; i<levels.length; i++) {
multiset.setValue("params.statusByDestination." + destination + ".inputstatus", (levels[i] - 1), source);
}
multiset.execute();
}</api>
</meta>
<param expand="true" height="60" left="80" oid="Sources" top="100" width="280"/>
<param expand="true" height="60" left="80" oid="Destinations" showlabel="false" top="40" width="280"/>
<button buttontype="push" height="120" left="360" name="Take" top="40" width="200">
<task tasktype="ogscript">doUltrixSwitch("ultrix", params.getValue('Sources', 0), params.getValue('Destinations', 0), "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17")</task>
</button>
<simplegrid contexttype="opengear" height="40" id="ultrix" left="80" objectid="UltricoreBCS-TLO-0000-C8931<br>Slot 0<br>UltricoreBCS" objecttype="UltricoreBCS" rows="1" top="180" width="480">
<param element="0" expand="true" oid="0x105" showlabel="false" widget="1"/>
</simplegrid>
</abs>
function doUltrixSwitch(source, destination, level_string) {
ultrixIP = "yourIP or domain name";
var ultrixRossTalkPort = 7788;
var newDestination = parseInt(destination) + 1;
var newSource = parseInt(source) + 1;
var rossTalkCommand = "XPT D:" + newDestination + " S:" + newSource + " I:7 L:" + level_string;
rosstalk.sendMessage(ultrixIP, ultrixRossTalkPort, rossTalkCommand);
}
Hope this helps!
You can also find documentation on supported rosstalk commands here.
------------------
Aury R.
Ross Video
------------------
------------------------------
Aury Rukazana
Senior Software Developer
Ross Video
------------------------------
Original Message:
Sent: 01-24-2024 13:21
From: Dalot Adroit
Subject: Custom Panel to control Ultrix
Hi,
I'm using an Ultrix router with BCS/Dashboard interface. I'm very new to all this and i'm trying to go a little beyond the basic softpanels editing.
For example I'm trying to make a simple custom panel where I can switch between a few sources and a few destinations with some basic buttons.
I only achieve this by drag-and-dropping a softpanel into a blank canvas and customize it. I also saw the built in api but the only command available is "take a switch"
Could you provide a simple example please?
Many Thanks
------------------------------
Dalot Adroit
------------------------------