예제 #1
0
		/// <summary>Reads the data.</summary>
		/// <returns>Modules value.</returns>
		public ModulesData ReadData()
		{
			var modulesData = new ModulesData();

			//Ask to read data to evry module IO.
			this.modules.ReadData();
			// Scan evry module to copy data.
			foreach (var module in this.modules.ModuleList)
			{
				//Transform chanels => ChanelData to transfert by WCF.
				var chanelsData = module.Chanels.Select(chanel => new ChanelData {Id = chanel.Id, Key = chanel.Key, ValueAnalog = chanel.ValueAnalog, ValueDigital = chanel.ValueDigital}).ToList();

				// Add to module liste
				modulesData.Modules.Add(new ModuleData {Name = module.Name, IpAddress = module.IpAddress, ModuleType = module.ModuleModel, ModuleSerie = module.ModuleSerie, Chanels = chanelsData});
			}
			return modulesData;
		}
예제 #2
0
		/// <summary>Reads the config in memory.</summary>
		/// <returns>The config of all modules.</returns>
		public ModulesData ReadConfig()
		{
			var modulesData = new ModulesData();

			// Scan evry module to copy data.
			foreach (var module in this.modules.ModuleList)
			{
				//Transform chanels => ChanelData to transfert by WCF.
				var chanelsData = module.Chanels.Select(chanel => new ChanelData {Id = chanel.Id, Key = chanel.Key, ValueAnalog = chanel.ValueAnalog, ValueDigital = chanel.ValueDigital, ValueAnalogBrut = chanel.ValueAnalogBrut, Gain = chanel.Gain, Offset = chanel.Offset, TypeOfValue = chanel.TypeOfValue, Direction = chanel.Direction, Description = chanel.Description, Comment = chanel.Comment}).ToList();

				// Add to module liste
				modulesData.Modules.Add(new ModuleData {Name = module.Name, IpAddress = module.IpAddress, ModuleType = module.ModuleModel, ModuleSerie = module.ModuleSerie, Chanels = chanelsData});
			}
			return modulesData;
		}