1 /** 2 * Copyright (C) 2010-14 pvmanager developers. See COPYRIGHT.TXT 3 * All rights reserved. Use is subject to license terms. See LICENSE.TXT 4 */ 5 package org.epics.vtype; 6 7 import java.util.AbstractList; 8 import java.util.List; 9 10 /** 11 * Severity of an alarm. 12 * <p> 13 * Values are provided in order of increasing severity, so you can rely on 14 * {@link #ordinal() } and {@link #compareTo(java.lang.Enum) } for comparison 15 * and ordering. In case additional AlarmSeverity values are added in the future, 16 * which is very unlikely, they will be added in order as well. 17 * <p> 18 * One should always bear in mind that the alarm severity of the IOC is set on 19 * the record, and not on the individual channel. If one is not connecting 20 * to the value field of the record, the severity does not reflect the state 21 * of that field. 22 * <p> 23 * For example: a record may be INVALID meaning that the value of the field 24 * was not correctly read by the hardware; if one connects to the display limit 25 * field, the value of that field will still be ok, but the alarm severity (if 26 * requested) would say INVALID. 27 * 28 * @author carcassi 29 */ 30 public enum AlarmSeverity { 31 32 /** 33 * The current value is valid, and there is no alarm. 34 */ 35 NONE, 36 37 /** 38 * There is a minor problem with the value: the exact meaning is defined 39 * by the channel, but typically this means that the value is valid and is 40 * outside some working range. 41 */ 42 MINOR, 43 44 /** 45 * There is a major problem with the value: the exact meaning is defined 46 * by the channel, but typically this means that the value is valid and is 47 * outside some working range. 48 */ 49 MAJOR, 50 51 /** 52 * There is a major problem with the value itself: the exact meaning is defined 53 * by the channel, but typically this means that the returned value is not a 54 * real representation of the actual value. 55 */ 56 INVALID, 57 58 /** 59 * The channel cannot be read and its state is undefined: the exact meaning is defined 60 * by the channel, but typically this means that the client is either disconnected 61 * or connected with no read access. The value is either stale or invalid. 62 */ 63 UNDEFINED; 64 65 private static final List<String> labels = new AbstractList<String>() { 66 @Override 67 public String get(int index) { 68 return AlarmSeverity.values()[index].name(); 69 } 70 71 @Override 72 public int size() { 73 return AlarmSeverity.values().length; 74 } 75 }; 76 77 /** 78 * Returns the list of labels for the severity. 79 * <p> 80 * This is useful to create VEnums containing severities. 81 * 82 * @return an immutable list with the labels 83 */ 84 public static List<String> labels() { 85 return labels; 86 } 87 }