예제 #1
0
		public static PDUGroupLogic Convert(RCGroupProperties rCGroupProperties)
		{
			var pDUGroupLogic = new PDUGroupLogic();

			pDUGroupLogic.AMTPreset = (rCGroupProperties.AMTPreset == "1");
			if (rCGroupProperties != null && rCGroupProperties.device != null)
			{
				foreach (var groupDevice in rCGroupProperties.device)
				{
					pDUGroupLogic.Devices.Add(new PDUGroupDevice()
					{
						DeviceUID = GuidHelper.ToGuid(groupDevice.UID),
						IsInversion = (groupDevice.Inverse == "1"),
						OnDelay = int.Parse(groupDevice.DelayOn),
						OffDelay = int.Parse(groupDevice.DelayOff)
					});
				}
			}

			return pDUGroupLogic;
		}
예제 #2
0
		public Device()
		{
			UID = Guid.NewGuid();
			Children = new List<Device>();
			Properties = new List<Property>();
			SystemAUProperties = new List<Property>();
			DeviceAUProperties = new List<Property>();
			IndicatorLogic = new IndicatorLogic();
			PDUGroupLogic = new PDUGroupLogic();
			PlanElementUIDs = new List<Guid>();
			ZoneLogic = new ZoneLogic();
			IsRmAlarmDevice = false;
			IsNotUsed = false;
			AllowMultipleVizualization = false;

			ShapeIds = new List<string>();
			ZonesInLogic = new List<Zone>();
			DependentDevices = new List<Device>();
			DeviceConfiguration = new DeviceConfiguration();
			StateWordBytes = new List<byte>();
			RawParametersBytes = new List<byte>();
		}
예제 #3
0
		public static RCGroupProperties ConvertBack(PDUGroupLogic pDUGroupLogic)
		{
			var rCGroupProperties = new RCGroupProperties();

			if (pDUGroupLogic != null && pDUGroupLogic.Devices.Count > 0)
			{
				rCGroupProperties.DevCount = pDUGroupLogic.Devices.Count.ToString();
				rCGroupProperties.AMTPreset = pDUGroupLogic.AMTPreset ? "1" : "0";
				var groupDevices = new List<RCGroupPropertiesDevice>();
				foreach (var device in pDUGroupLogic.Devices)
				{
					groupDevices.Add(new RCGroupPropertiesDevice()
					{
						UID = device.DeviceUID.ToString(),
						Inverse = device.IsInversion ? "1" : "0",
						DelayOn = device.OnDelay.ToString(),
						DelayOff = device.OffDelay.ToString()
					});
				}
				rCGroupProperties.device = groupDevices.ToArray();
			}

			return rCGroupProperties;
		}
        public void SetPDUGroupLogic(Device device, PDUGroupLogic pduGroupLogic)
        {
            foreach (var pduGroupDevice in device.PDUGroupLogic.Devices)
            {
                pduGroupDevice.Device = null;
                if (pduGroupDevice.DeviceUID != Guid.Empty)
                {
                    var pduDevice = DeviceConfiguration.Devices.FirstOrDefault(x => x.UID == pduGroupDevice.DeviceUID);
                    if (pduDevice != null)
                    {
                        pduGroupDevice.Device = pduDevice;
                        pduDevice.DependentDevices.Remove(device);
                    }
                }
            }

            device.PDUGroupLogic = pduGroupLogic;
            DeviceConfiguration.InvalidatePDUDirection(device);
            DeviceConfiguration.UpdateOneDeviceCrossReferences(device);
            device.OnChanged();
        }
        public void InvalidatePDUDirection(Device device)
        {
			var pduGroupLogic = new PDUGroupLogic();
			foreach (var pduGroupDevice in device.PDUGroupLogic.Devices)
			{
				if (Devices.Any(x => x.UID == pduGroupDevice.DeviceUID))
				{
					pduGroupLogic.Devices.Add(pduGroupDevice);
				}
			}
			device.PDUGroupLogic = pduGroupLogic;
        }
예제 #6
0
		protected override bool Save()
		{
			var pduGroupLogic = new PDUGroupLogic();

			pduGroupLogic.AMTPreset = Devices.Any(x => x.Device.Driver.DriverType == DriverType.AM1_T);
			foreach (var device in Devices)
			{
				var pduGroupDevice = new PDUGroupDevice()
				{
					DeviceUID = device.Device.UID,
					IsInversion = device.IsInversion,
					OnDelay = device.OnDelay,
					OffDelay = device.OffDelay
				};
				pduGroupLogic.Devices.Add(pduGroupDevice);
			}
			FiresecManager.FiresecConfiguration.SetPDUGroupLogic(Device, pduGroupLogic);
			return base.Save();
		}