ok gestione CONF x IO

This commit is contained in:
Samuele E. Locatelli
2021-02-03 08:47:33 +01:00
parent fb16f616e5
commit 64e8bd0331
4 changed files with 37 additions and 21 deletions
+6 -13
View File
@@ -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();
}
@@ -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;
}
}
}
}
+8 -7
View File
@@ -100,22 +100,23 @@ namespace Thermo.Active.Model
public enum TACT_IO_TYPE
{
/// <summary>
/// Digital OUT
/// </summary>
DO = 0,
ND = 0,
/// <summary>
/// Digital IN
/// </summary>
DI,
/// <summary>
/// Analog OUT
/// Digital OUT
/// </summary>
AO,
DO,
/// <summary>
/// Analog IN
/// </summary>
AI
AI,
/// <summary>
/// Analog OUT
/// </summary>
AO
}
public enum TACT_MBLOCK_TYPE
{
+15
View File
@@ -100,6 +100,21 @@ namespace Thermo.Active.Utils
return answ;
}
/// <summary>
/// Conversion string --> TACT_IO_TYPE
/// </summary>
/// <param name="strValue"></param>
/// <returns></returns>
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;
}
/// <summary>
/// Conversion string --> TACT_MBLOCK_SECTION
/// </summary>
/// <param name="strValue"></param>