diff --git a/Thermo.Active.Config/ServerConfigController.cs b/Thermo.Active.Config/ServerConfigController.cs index 8679bc16..32e91330 100644 --- a/Thermo.Active.Config/ServerConfigController.cs +++ b/Thermo.Active.Config/ServerConfigController.cs @@ -506,7 +506,6 @@ namespace Thermo.Active.Config private static void ReadIOConfig() { XDocument xmlConfigFile = GetXmlHandlerWithValidator(IO_CONFIG_SCHEMA_PATH, IO_CONFIG_PATH); - // Read head config from XML file IOConfig = xmlConfigFile .Root @@ -514,18 +513,12 @@ namespace Thermo.Active.Config .Select(x => new IOConfigModel() { Id = Convert.ToInt16(x.Element("id").Value), - Label = x.Element("label").Value, - Type = GetTActMB_Type(x.Element("type").Value), - Section = GetTActMB_Section(x.Element("section").Value), - IdParam = Convert.ToInt16(x.Element("idParam").Value), - ShowDelay = Convert.ToBoolean(x.Element("showDelay").Value), - Priority = Convert.ToInt16(x.Element("priority").Value), - // attributi presi da default se NON presenti... - ScaleFactor = x.Element("scaleFactor") != null ? Convert.ToInt16(x.Element("scaleFactor").Value) : 1000, - NumDec = x.Element("numDec") != null ? Convert.ToInt16(x.Element("numDec").Value) : 1, - Category = x.Element("category") != null ? x.Element("category").Value : "", - SubCategory_1 = x.Element("subCategory_1") != null ? x.Element("subCategory_1").Value : "", - SubCategory_2 = x.Element("subCategory_2") != null ? x.Element("subCategory_2").Value : "" + Category = GetTActIO_Type(x.Element("category").Value), + Bank = x.Element("bank") != null ? x.Element("bank").Value : "0", + Position = x.Element("position") != null ? x.Element("position").Value : "0", + Page = x.Element("page") != null ? x.Element("page").Value : "", + Wire = x.Element("wire") != null ? x.Element("wire").Value : "", + Profinet = x.Element("profinet") != null ? x.Element("profinet").Value : "" }) .ToList(); } diff --git a/Thermo.Active.Model/ConfigModels/IOConfigModel.cs b/Thermo.Active.Model/ConfigModels/IOConfigModel.cs index e5e574cc..e8c6a2b0 100644 --- a/Thermo.Active.Model/ConfigModels/IOConfigModel.cs +++ b/Thermo.Active.Model/ConfigModels/IOConfigModel.cs @@ -12,7 +12,14 @@ namespace Thermo.Active.Model.ConfigModels public string Page { get; set; } = ""; public string Wire { get; set; } = ""; public string Profinet { get; set; } = ""; - public string Label { get; set; } = ""; + public string Label + { + get + { + string answ = $"LBL_IO_{Id}_{Bank}_{Position}"; + return answ; + } + } } } diff --git a/Thermo.Active.Model/Constants.cs b/Thermo.Active.Model/Constants.cs index e96f3f17..213147a5 100644 --- a/Thermo.Active.Model/Constants.cs +++ b/Thermo.Active.Model/Constants.cs @@ -100,22 +100,23 @@ namespace Thermo.Active.Model public enum TACT_IO_TYPE { - /// - /// Digital OUT - /// - DO = 0, + ND = 0, /// /// Digital IN /// DI, /// - /// Analog OUT + /// Digital OUT /// - AO, + DO, /// /// Analog IN /// - AI + AI, + /// + /// Analog OUT + /// + AO } public enum TACT_MBLOCK_TYPE { diff --git a/Thermo.Active.Utils/supportFunctions.cs b/Thermo.Active.Utils/supportFunctions.cs index 3cd93d2f..faab6cce 100644 --- a/Thermo.Active.Utils/supportFunctions.cs +++ b/Thermo.Active.Utils/supportFunctions.cs @@ -100,6 +100,21 @@ namespace Thermo.Active.Utils return answ; } /// + /// Conversion string --> TACT_IO_TYPE + /// + /// + /// + public static TACT_IO_TYPE GetTActIO_Type(string strValue) + { + TACT_IO_TYPE answ = TACT_IO_TYPE.ND; + try + { + answ = (TACT_IO_TYPE)Enum.Parse(typeof(TACT_IO_TYPE), strValue); + } + catch { } + return answ; + } + /// /// Conversion string --> TACT_MBLOCK_SECTION /// ///