This is an old revision of the document!
Javascript/Digital Signage API
ARDI includes a Javascript API to access live data in HTML pages and SVG images.
It's quite simple to use (particularly combined with JQuery) and requires only a few lines of code to get working.
You can find the javascript include file at /plugins/optrix/ardiclient.js.
Model
The Javascript API provides the ARDIHMI class, which is used to subscribe to updates from an ARDI server.
The process consists of…
- Creating the ARDIHMI object,
- Subscribing to Change Events
- Connecting to the Server
//Prepare the new object var connection = new ARDIHMI(); //Subscribe To Each Dynamic Property connection.Subscribe("//Dynamic Property//",function (val) { //Update HTML/SVG }); //Connect to the server connection.ConnectTo("//address//");
Where address is the IP address of the ARDI database (this includes the site or database code when an ARDI server supports multiple databases - for example, the PowerGen Demo on http://ademo.optrix.com.au has a code of pd, so the full address is http://ademo.optrix.com.au/s/pd.
You'll need to know the dynamic property code for every asset property you'd like to display in your image or web page.
This code is made up of three parts - Asset ID:PropertyID:Attribute.
The asset ID is ARDIs unique numeric ID for your asset, while the Property ID is the unique ID for the property. Finally, there's the attribute of your property.
You can discover all of this information by clicking on the 'link' icon next to any of the properties in the property details of an asset. The last two items in the URL will give the asset and property ID, while the list of connection points will give you the code.
For example, “23:20:measurement” is the code for the measured pressure on asset 23.