EnableAlarmBubbles

Display tooltips over equipment with alarms associated with them.

Function

void EnableAlarmBubbles(enable: bool, host: string, port: int, errorCallback: function)

Parameters

  • enable (bool): If true, start displaying the alarm bubbles. If false, any alarm bubbles on screen will stop being displayed, and no new ones will be generated. Defaults to false.
  • host (string): The host name that points to the alarm server to query for alarm bubbles. If not supplied, it defaults to location.hostname.
  • port (int): The port that the alarm server is configured to communicate on. See the relevant section on the Alarms page. If not supplied, it defaults to 20013.
  • errorCallback (function): If supplied, this function is called if the alarm server could not be contacted. It is passed no arguments.

Remarks

This is a standalone function, not a method of the SYM3 object. Call it once a project has been loaded with CreateSym3, and you’ve received a response from the SetOnProjectInitialised callback.

The alarm bubbles are generated using the default settings of the AttachTooltip function.

The amount of alarm bubbles generated is controlled using the SetMaxAlarmBubbles function, and you can check the current value using the GetMaxAlarmBubbles function. The default value is 99.

The alarm bubbles will be refreshed frequently. If you change the maximum number of bubbles, during the next refresh, the amount of alarm bubbles will change accordingly; if you increase the maximum, and there are more bubbles to be displayed, they’ll be displayed. If you reduce the maximum, and the currently displayed amount of display bubbles is over the new maximum, the excess alarms will be removed, the oldest (highest index numbers) first.

Examples

Turn on alarm bubbles.

EnableAlarmBubbles(true);

Turn off alarm bubbles.

EnableAlarmBubbles(false);

Turn on alarm bubbles, connecting to a custom server address, and registering an error handler. Note that if you’re going to do something like pop up a modal dialog, you should make sure to do it only once, and turn off alarm bubbles, as sym3.js will keep trying to contact the alarm server, and keep calling your error handler otherwise.

function errorCallback()
{
    if (errorCallback.sErrorReported === undefined)
    {
        errorCallback.sErrorReported = true;
        alert("Couldn't contact alarm server!");
    }
    EnableAlarmBubbles(false);
}
EnableAlarmBubbles(true, "example.com", 23235, errorCallback);