示例#1
0
 public SubCondition(SubAlarmType type, float threshold = 0f, Severity severity = Severity.Normal, string message = "", bool enabled = true)
 {
     this.SubAlarmType = type;
     this.Threshold    = threshold;
     this.Severity     = severity;
     this.Message      = message;
     this.IsEnabled    = enabled;
 }
示例#2
0
 public AlarmItem()
 {
     this._startTime = DateTime.Now;
     this._alarmType = SubAlarmType.None;
     this._alarmText = string.Empty;
     this._severity  = Severity.Normal;
     this._condiId   = -1;
     this._source    = string.Empty;
 }
示例#3
0
 public AlarmItem(DateTime time, string alarmText, object alarmValue, SubAlarmType type, Severity severity, int condId, string source)
 {
     this._startTime  = time;
     this._alarmType  = type;
     this._alarmText  = alarmText;
     this._alarmValue = alarmValue;
     this._severity   = severity;
     this._condiId    = condId;
     this._source     = source;
 }
示例#4
0
        public static SubCondition FindSubConditon(this ICondition cond, SubAlarmType alarmType)
        {
            var subs = cond.SubConditions;

            if (subs != null && subs.Count > 0)
            {
                foreach (var sub in subs)
                {
                    if (sub.SubAlarmType == alarmType)
                    {
                        return(sub);
                    }
                }
            }
            return(SubCondition.Empty);
        }
示例#5
0
        FindSubConditon(this IAlarmServer server, string sourceName, SubAlarmType alarmType)
        {
            var conds = server.QueryConditions(sourceName);

            if (conds == null)
            {
                return(SubCondition.Empty);
            }
            foreach (ICondition cond in conds)
            {
                SubCondition sub = cond.FindSubConditon(alarmType);
                if (sub.SubAlarmType == alarmType)
                {
                    return(sub);
                }
            }

            return(SubCondition.Empty);
        }
示例#6
0
        public static bool HasSubCondition(this IDataServer dserver, string sourceName, SubAlarmType alarmType)
        {
            IAlarmServer server = dserver as IAlarmServer;

            if (server == null)
            {
                return(false);
            }
            var conds = server.QueryConditions(sourceName);

            if (conds == null)
            {
                return(false);
            }
            foreach (ICondition cond in conds)
            {
                var subs = cond.SubConditions;
                if (subs != null && subs.Count > 0)
                {
                    foreach (var sub in subs)
                    {
                        if (sub.SubAlarmType == alarmType)
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }