private boolean flashOn = false; public void timer() { flashOn = !flashOn; status(); } public void status() { try { Device device = getDevice(); art.library.model.devices.vms.asf.AsfStatus status = (art.library.model.devices.vms.asf.AsfStatus) device.getDeviceStatus(); art.library.model.devices.vms.asf.AsfAlarms alarms = (art.library.model.devices.vms.asf.AsfAlarms) device.getDeviceAlarms(); art.library.model.devices.vms.asf.AsfConfiguration configuration = (art.library.model.devices.vms.asf.AsfConfiguration) device.getDeviceConfiguration(); SVGElement arrow = getElement("arrow"); SVGElement cross = getElement("cross"); SVGElement arrowRight = getElement("arrow-right"); SVGElement arrowLeft = getElement("arrow-left"); SVGElement dynamicElements = getElement("elements"); setAttribute(dynamicElements, "display", "none", 999); for (int i = 0; i <= 5; i++) { setAttribute("alarm-" + i, "display", (alarms.getServerityAlarm() == i) ? "inline" : "none", 999); } setAttribute("lock-on", "display", "inline", 999); setAttribute("brightness-icon-on", "display", "inline", 999); setAttribute("lock-on", "display", "inline", 999); setAttribute("lock-off", "display", "inline", 999); setAttribute("light-on", "display", "inline", 999); setAttribute("Auto", "display", "inline", 999); setAttribute("Manual", "display", "inline", 999); SVGElement showElement = null; switch (status.state) { case art.library.model.devices.vms.asf.AsfStatus.STATE_ARROW: showElement = arrow; break; case art.library.model.devices.vms.asf.AsfStatus.STATE_CROSS: showElement = cross; break; case art.library.model.devices.vms.asf.AsfStatus.STATE_OFF: break; case art.library.model.devices.vms.asf.AsfStatus.STATE_LEFT: showElement = arrowLeft; break; case art.library.model.devices.vms.asf.AsfStatus.STATE_RIGHT: showElement = arrowRight; break; case art.library.model.devices.vms.asf.AsfStatus.STATE_FLASHING_LEFT: showElement = (flashOn) ? arrowLeft : null; break; case art.library.model.devices.vms.asf.AsfStatus.STATE_FLASHING_RIGHT: showElement = (flashOn) ? arrowRight : null; break; } if (showElement != null) { setAttribute(showElement, "display", "inline", 999); } if (status.priority < 256) { setAttribute("lock-on", "display", "none", 999); } switch (status.brightnessMode) { case art.library.model.devices.vms.asf.AsfStatus.BRIGHTNESS_MODE_AUTO: setAttribute("Manual", "display", "none", 999); break; case art.library.model.devices.vms.asf.AsfStatus.BRIGHTNESS_MODE_MANUAL: setAttribute("Auto", "display", "none", 999); break; default: setAttribute("Auto", "display", "none", 999); setAttribute("Manual", "display", "none", 999); setAttribute("light-on", "display", "none", 999); break; } } catch (Exception ex) { } } public void commands() { art.library.model.devices.vms.asf.AsfCommands deviceCommands = (art.library.model.devices.vms.asf.AsfCommands) getDeviceCommands(); SVGElement arrow = getElement("arrow"); SVGElement cross = getElement("cross"); SVGElement arrowRight = getElement("arrow-right"); SVGElement arrowLeft = getElement("arrow-left"); SVGElement dynamicElements = getElement("elements"); setAttribute("lock-on", "display", "inline", 999); setAttribute("restart", "display", "inline", 999); setAttribute("unlock", "display", "inline", 999); setAttribute(dynamicElements, "display", "none", 999); SVGElement showElement = null; switch (deviceCommands.state) { case art.library.model.devices.vms.asf.AsfCommands.STATE_ARROW: showElement = arrow; break; case art.library.model.devices.vms.asf.AsfCommands.STATE_CROSS: showElement = cross; break; case art.library.model.devices.vms.asf.AsfCommands.STATE_OFF: break; case art.library.model.devices.vms.asf.AsfCommands.STATE_LEFT: showElement = arrowLeft; break; case art.library.model.devices.vms.asf.AsfCommands.STATE_RIGHT: showElement = arrowRight; break; case art.library.model.devices.vms.asf.AsfCommands.STATE_FLASHING_LEFT: showElement = (flashOn) ? arrowLeft : null; break; case art.library.model.devices.vms.asf.AsfCommands.STATE_FLASHING_RIGHT: showElement = (flashOn) ? arrowRight : null; break; } if (showElement != null) { setAttribute(showElement, "display", "inline", 999); } if (deviceCommands.reset != art.library.model.devices.vms.asf.AsfCommands.CONDITION_YES) { setAttribute("restart", "display", "none", 999); } if (deviceCommands.liberate != art.library.model.devices.vms.asf.AsfCommands.CONDITION_YES) { setAttribute("unlock", "display", "none", 999); } if (deviceCommands.priority < 256) { setAttribute("lock-on", "display", "none", 999); } }