Exemplo n.º 1
0
		public PDUPTTable(DevicePDUDirection devicePDUDirection, PanelDatabase panelDatabase)
			: base(null, devicePDUDirection.PDUGroupDevice.Device.DottedPresentationNameAndAddress)
		{
			Device = devicePDUDirection.PDUGroupDevice.Device;

			BytesDatabase = new BytesDatabase(Device.DottedPresentationNameAndAddress);
			BytesDatabase.AddByte(Device.AddressOnShleif, "Адрес");
			BytesDatabase.AddByte((Device.ShleifNo - 1), "Шлейф");
			BytesDatabase.AddByte(Device.Parent.IntAddress, "Адрес прибора");
			var deviceCode = FiresecAPI.Models.DriversHelper.GetCodeForDriver(Device.Driver.DriverType);
			BytesDatabase.AddByte(deviceCode, "Тип ИУ");

			var tableBase = panelDatabase.FlashDatabase.LocalZonesTableGroup.Tables.FirstOrDefault(x => x.UID == Device.Zone.UID);
			var localZoneNo = (tableBase as ZoneTable).BinaryZone.LocalNo;
			BytesDatabase.AddShort(localZoneNo, "Номер зоны");
			BytesDatabase.AddByte(devicePDUDirection.Device.IntAddress, "Направление");

			foreach (var tableGroup in panelDatabase.FlashDatabase.DevicesTableGroups)
			{
				tableBase = tableGroup.Tables.FirstOrDefault(x => x.UID == Device.UID);
				if (tableBase != null)
				{
					break;
				}
			}
			var offset = tableBase.BytesDatabase.ByteDescriptions.FirstOrDefault().Offset + 3;
			var offsetBytes = BitConverter.GetBytes(offset);
			for (int i = 0; i < 4; i++)
			{
				BytesDatabase.AddByte(offsetBytes[i], "Смещение");
			}
		}
Exemplo n.º 2
0
		public PanelDatabaseViewModel(PanelDatabase panelDatabase)
		{
			PanelDatabase = panelDatabase;
			ParentPanel = panelDatabase.ParentPanel;
			RomDatabase = panelDatabase.RomDatabase;
			FlashPanelDatabase = panelDatabase.FlashDatabase;

			RomUnequalBytes = new List<PanelUnequalByteViewModel>();
			FlashUnequalBytes = new List<PanelUnequalByteViewModel>();
			MergeRomDatabase();
			MergeFlashDatabase();
		}
Exemplo n.º 3
0
		public void Create(int offset)
		{
			FS2Contract.CheckCancellationAndNotify("Формирования связей");
			BinaryConfigurationHelper = new BinaryConfigurationHelper();

			foreach (var device in ConfigurationManager.Devices)
			{
				switch (device.Driver.DriverType)
				{
					case DriverType.Rubezh_2AM:
					case DriverType.Rubezh_4A:
					case DriverType.Rubezh_2OP:
					case DriverType.BUNS:
					case DriverType.Rubezh_P:
					case DriverType.USB_Rubezh_2AM:
					case DriverType.USB_Rubezh_4A:
					case DriverType.USB_Rubezh_2OP:
					case DriverType.USB_BUNS:
					case DriverType.USB_Rubezh_P:
						FS2Contract.CheckCancellationAndNotify("Формирования базы прибора " + device.DottedPresentationNameAndAddress);
						var panelDatabase = new PanelDatabase(device, offset);
						PanelDatabases.Add(panelDatabase);
						break;
				}
			}

			BytesHelper.IsRevese = true;
			foreach (var device in ConfigurationManager.Devices)
			{
				switch (device.Driver.DriverType)
				{
					case DriverType.IndicationBlock:
						FS2Contract.CheckCancellationAndNotify("Формирования базы прибора " + device.DottedPresentationNameAndAddress);
						var biDatabase = new BIDatabase(device, this);
						NonPanelDatabases.Add(biDatabase);
						break;

					case DriverType.PDU:
						FS2Contract.CheckCancellationAndNotify("Формирования базы прибора " + device.DottedPresentationNameAndAddress);
						var pduDatabase = new PDUDatabase(device, this);
						NonPanelDatabases.Add(pduDatabase);
						break;

					case DriverType.PDU_PT:
						FS2Contract.CheckCancellationAndNotify("Формирования базы прибора " + device.DottedPresentationNameAndAddress);
						var pduPTDatabase = new PDUPTDatabase(device, this);
						NonPanelDatabases.Add(pduPTDatabase);
						break;
				}
			}
			BytesHelper.IsRevese = false;
		}
Exemplo n.º 4
0
		public PDUTable(DevicePDUDirection devicePDUDirection, PanelDatabase panelDatabase)
			: base(null, devicePDUDirection.PDUGroupDevice.Device.DottedPresentationNameAndAddress)
		{
			Device = devicePDUDirection.PDUGroupDevice.Device;
			BytesDatabase = new BytesDatabase(Device.DottedPresentationNameAndAddress);
			BytesDatabase.AddByte(Device.AddressOnShleif, "Адрес");
			BytesDatabase.AddByte((Device.ShleifNo - 1), "Шлейф");
			BytesDatabase.AddByte(Device.Parent.IntAddress, "Адрес прибора");
			var deviceCode = FiresecAPI.Models.DriversHelper.GetCodeForDriver(Device.Driver.DriverType);
			BytesDatabase.AddByte(deviceCode, "Тип ИУ");
			var option = 0;
			if (devicePDUDirection.PDUGroupDevice.IsInversion)
				option = 128;
			var anotherCount = devicePDUDirection.Device.Parent.Children.Count(x => x.PDUGroupLogic.Devices.Any(y => y.DeviceUID == Device.UID));
			if (anotherCount > 1)
				option += 64;
			BytesDatabase.AddByte(option, "Опции");
			BytesDatabase.AddByte(devicePDUDirection.Device.IntAddress, "Направление");
			BytesDatabase.AddByte(0, "Пустой байт");

			TableBase tableBase = null;
			foreach (var tableGroup in panelDatabase.FlashDatabase.DevicesTableGroups)
			{
				tableBase = tableGroup.Tables.FirstOrDefault(x => x.UID == Device.UID);
				if (tableBase != null)
				{
					break;
				}
			}
			var offset = tableBase.BytesDatabase.ByteDescriptions.FirstOrDefault().Offset;
			if (Device.Driver.IsZoneLogicDevice)
			{
				offset += 3;
			}
			else
			{
				offset += 2;
			}
			var offsetBytes = BitConverter.GetBytes(offset);
			for (int i = 0; i < 4; i++)
			{
				BytesDatabase.AddByte(offsetBytes[i], "Смещение");
			}

			BytesDatabase.AddByte(devicePDUDirection.PDUGroupDevice.OnDelay, "Задержка на включение");
			BytesDatabase.AddByte(devicePDUDirection.PDUGroupDevice.OffDelay, "Задержка на выключение");
			for (int i = 0; i < 9; i++)
			{
				BytesDatabase.AddByte(255, "ПДУ привязки");
			}
			BytesDatabase.AddByte(0, "ПДУ привязки");
		}