Subscribe

The Subscribe function is part of the HMIPanel class in the ARDI Javascript API.

You use the command to subscribe to changes in a single data point.

Parameters

Point: The point code for the property you want to monitor. Note that if you're creating a dynamic SVG file, you might be able to use an embedding code.

Callback: The function to be called when a change happens. The callback function has a single parameter, the new value. Note that this value might be a string - if performing math on it, you should ensure to run parseFloat before use.

Animated: An optional parameter, indicating if you would like this data to animate between values. TRUE (the default) will animate, while FALSE will snap to the new value immediately.

Usage

var connection = HMIPanel();
connection.Subscribe("10:20:measurement",function (val) {
   console.log("New Value: " + parseFloat(val).toFixed(2));
});
connection.ConnectTo("myardiserver");

Normally, your Subscribe calls should be before a call to ConnectTo.