/* public ConveyorBasicInfo(SerializationInfo info, StreamingContext context) : base() * { * AlarmID = info.GetInt16("AlarmID"); * Fault = info.GetInt16("Fault"); * AlarmList = (List<ALARM>) info.GetValue("AlarmList", AlarmList.GetType()); * SensorList = (List<Sensor>)info.GetValue("SensorList", SensorList.GetType()); * ActiveAlarms = (List<int>) info.GetValue("ActiveAlarms", ActiveAlarms.GetType()); * }*/ public void SetAlarms(BitArray alarms, BasicWarehouse wh) { try { if (AlarmList != null) { // ActiveAlarms.Clear(); foreach (ALARM a in AlarmList) { for (int i = 0; i < a.Range; i++) { if (alarms[a.Offset + i] && !ActiveAlarms.Any(aa => aa == a.ID + i)) { ActiveAlarms.Add(a.ID + i); wh.DBService.AddAlarm(Name, (a.ID + i).ToString(), Alarm.EnumAlarmStatus.Active, Alarm.EnumAlarmSeverity.Error); } else if (!alarms[a.Offset + i] && ActiveAlarms.Any(aa => aa == a.ID + i)) { ActiveAlarms.Remove(a.ID + i); wh.DBService.UpdateAlarm(Name, (a.ID + i).ToString(), Alarm.EnumAlarmStatus.Removed); } } } } } catch (Exception ex) { throw new ConveyorBasicException(String.Format("ConveyorBasicInfo.SetAlarms failed. Reason:{0}", ex.Message)); } }
public void SetRightFuelTankEmpty() { RightFuelTankEmpty = true; if (!ActiveAlarms.Contains("RightFuelTankEmpty")) { ActiveAlarms.Add("RightFuelTankEmpty"); ActiveAlarmsString += "RightFuelEmpty"; } }