private boolean flashOn = false;
|
|
public void timer()
|
{
|
flashOn = !flashOn;
|
status();
|
}
|
|
public void status()
|
{
|
Device device = getDevice();
|
art.library.model.devices.vms.pvv.PvvStatus status = (art.library.model.devices.vms.pvv.PvvStatus) device.getDeviceStatus();
|
art.library.model.devices.vms.pvv.PvvAlarms alarms = (art.library.model.devices.vms.pvv.PvvAlarms) device.getDeviceAlarms();
|
String color1 = "#000000";
|
String color2 = "#000000";
|
setAttribute("text-1", "display", "none", 999);
|
setAttribute("text-2", "display", "none", 999);
|
switch (status.status)
|
{
|
case DeviceStatus.STATUS_ONLINE:
|
color1 = "#00FF00";
|
color2 = "#007C00";
|
break;
|
case DeviceStatus.STATUS_WARNING:
|
color1 = "#FFFF00";
|
color2 = "#7C7C00";
|
break;
|
case DeviceStatus.STATUS_ALARM:
|
color1 = "#FF0000";
|
color2 = "#7C0000";
|
break;
|
case DeviceStatus.STATUS_INVALID:
|
color1 = "#B97A57";
|
color2 = "#5A3B2A";
|
break;
|
case DeviceStatus.STATUS_DISABLE:
|
color1 = "#7C7C7C";
|
color2 = "#3E3E3E";
|
break;
|
case DeviceStatus.STATUS_SIMULATION:
|
color1 = "#0000FF";
|
color2 = "#00007C";
|
break;
|
case DeviceStatus.STATUS_OFFLINE:
|
color1 = "#FF00FF";
|
color2 = "#7C007C";
|
break;
|
case DeviceStatus.STATUS_UNKNOWN:
|
color1 = "#FF00FF";
|
color2 = "#7C007C";
|
break;
|
}
|
if (status.speed > 99)
|
{
|
setText("text-2", String.valueOf(status.speed));
|
setAttribute("text-2", "display", "inline", 999);
|
} else
|
{
|
setText("text-1", "" + String.valueOf(status.speed));
|
setAttribute("text-1", "display", "inline", 999);
|
}
|
if (status.state == art.library.model.devices.vms.pvv.PvvStatus.STATE_OFF || status.state == art.library.model.devices.vms.pvv.PvvStatus.STATE_UNKNOWN || status.status == art.library.model.devices.vms.pvv.PvvStatus.STATUS_OFFLINE || status.status == art.library.model.devices.vms.pvv.PvvStatus.STATUS_UNKNOWN)
|
{
|
setAttribute("text-1", "display", "none", 999);
|
setAttribute("text-2", "display", "none", 999);
|
setAttribute("alarm", "display", "none", 999);
|
}
|
|
setAttribute("text-1", "fill", color2, 999);
|
setAttribute("text-2", "fill", color2, 999);
|
setAttribute("background", "fill", color1, 999);
|
setAttribute("border", "stroke", color2, 999);
|
setAttribute("alarm", "stroke", color1, 999);
|
setAttribute(getElement("alarm"), "stroke-width", alarms.getServerityAlarm() * 10, 999);
|
}
|
|
public void commands()
|
{
|
DeviceCommands deviceCommands = getDeviceCommands();
|
String color1 = "#0000FF";
|
String color2 = "#00007C";
|
if (!deviceCommands.isEmpty())
|
{
|
color1 = "#00FF00";
|
color2 = "#007C00";
|
}
|
setText("Information text", String.valueOf(device.getDeviceInformation().number));
|
setAttribute("text", "display", "none", 999);
|
setAttribute(getElement("alarm"), "stroke-width", 0, 999);
|
setAttribute("Border", "stroke", color2);
|
}
|