Пример #1
0
 void UpdateZoneAlarms()
 {
     foreach (var zone in FiresecManager.Zones)
     {
         switch (zone.ZoneType)
         {
             case ZoneType.Fire:
                 if (zone.ZoneState.StateType == StateType.Fire)
                 {
                     var newAlarm = new Alarm()
                     {
                         AlarmType = AlarmType.Fire,
                         StateType = StateType.Fire,
                         Zone = zone,
                         StateName = "Пожар"
                     };
                     Alarms.Add(newAlarm);
                 }
                 break;
             case ZoneType.Guard:
                 if (FiresecManager.IsZoneOnGuardAlarm(zone.ZoneState))
                 {
                     var newAlarm = new Alarm()
                     {
                         AlarmType = AlarmType.Guard,
                         StateType = StateType.Fire,
                         Zone = zone,
                         StateName = "Тревога"
                     };
                     Alarms.Add(newAlarm);
                 }
                 break;
         }
     }
 }
Пример #2
0
        void UpdateDeviceAlarms()
        {
            foreach (var device in FiresecManager.Devices)
            {
                foreach (var state in device.DeviceState.ThreadSafeStates)
                {
                    AlarmType? alarmType = StateToAlarmType(state, device.Driver);
                    if (alarmType.HasValue == false)
                        continue;

                    var newAlarm = new Alarm()
                    {
                        AlarmType = alarmType.Value,
                        StateType = state.DriverState.StateType,
                        Device = device,
                        Zone = device.Zone,
                        StateName = state.DriverState.Name
                    };
                    Alarms.Add(newAlarm);
                }
            }
        }
Пример #3
0
		public bool IsEqualTo(Alarm alarm)
		{
			if (alarm.AlarmType != AlarmType)
				return false;
			if (alarm.Device != null && alarm.Device != Device)
				return false;
			if (alarm.Zone != null && alarm.Zone != Zone)
				return false;
			return true;
		}
Пример #4
0
		public Alarm Clone()
		{
			var alarm = new Alarm();
			alarm.StateType = StateType;
			alarm.Device = Device;
			alarm.Zone = Zone;
			return alarm;
		}