From f570022a187ae77b51eabdb49b2efb2aa7a6317e Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Sat, 23 Nov 2019 12:08:12 +0100 Subject: [PATCH 1/3] Abbozzata gestione rec dati allarmi (incidents) --- MP-IO/Controllers/IOBController.cs | 49 ++++++++++++++++- MapoDb/AlarmsArchive.cs | 74 +++++++++++++++++++++++++ MapoDb/FluxArchive.cs | 2 +- MapoDb/MapoDb.csproj | 1 + MapoSDK/.editorconfig | 4 ++ MapoSDK/Enums.cs | 1 + MapoSDK/MapoSDK.csproj | 1 + MapoSDK/Objects.cs | 87 ++++++++++++++++++++++++++++++ 8 files changed, 217 insertions(+), 2 deletions(-) create mode 100644 MapoDb/AlarmsArchive.cs create mode 100644 MapoSDK/.editorconfig diff --git a/MP-IO/Controllers/IOBController.cs b/MP-IO/Controllers/IOBController.cs index db25d901..144aec8b 100644 --- a/MP-IO/Controllers/IOBController.cs +++ b/MP-IO/Controllers/IOBController.cs @@ -346,7 +346,7 @@ namespace MP_IO.Controllers } /// /// Processa una chiamata POST per l'invio di un array Json di oggetti plcMemConf - /// PUT: IOB/flogJson/SIMUL_03 + /// PUT: IOB/saveConf/SIMUL_03 /// /// ID dell'IOB /// @@ -388,6 +388,53 @@ namespace MP_IO.Controllers return answ; } /// + /// Processa una chiamata POST per l'invio di un array Json di oggetti di conf DataItems (es per MTC) + /// PUT: IOB/saveDataItems/SIMUL_03 + /// + /// ID dell'IOB + /// + [HttpPost] + public string saveDataItems(string id) + { + string answ = ""; + if (string.IsNullOrWhiteSpace(id)) + { + answ = "Missing IOB"; + } + else + { + // questa classe è derivata da Controller.Response... x cui recupero lo stream in altro modo... + string content = ""; + System.Web.HttpContext.Current.Request.InputStream.Position = 0; + using (var reader = new StreamReader(Request.InputStream, System.Text.Encoding.UTF8, true, 4096, true)) + { + content = reader.ReadToEnd(); + } + // Rest + System.Web.HttpContext.Current.Request.InputStream.Position = 0; + + +#if false + // procedo a deserializzare in blocco l'oggetto... + plcMemMap currMemMap = null; + try + { + // deserializzo. + currMemMap = JsonConvert.DeserializeObject(content); + // se != null --> salvo! + if (currMemMap != null) + { + DataLayer.setIobMemMap(id, currMemMap); + answ = "OK"; + } + } + catch + { } +#endif + } + return answ; + } + /// /// restituisce elenco parametri correnti come una List Json di oggetti objItem /// GET: IOB/getObjItems/SIMUL_03 /// diff --git a/MapoDb/AlarmsArchive.cs b/MapoDb/AlarmsArchive.cs new file mode 100644 index 00000000..2e2fae5a --- /dev/null +++ b/MapoDb/AlarmsArchive.cs @@ -0,0 +1,74 @@ +using MapoSDK; +using MongoDB.Driver; +using System; +using System.Collections.Generic; + +namespace MapoDb +{ + /// + /// Classe gestione ALLARMI coem eventi speciali (documenti registrati su MongoDb) + /// + public class AlarmsArchive + { + string mdbConnString = "mongodb://W2019-MONGODB:27017"; + //string mdbConnString = "mongodb://localhost:27017"; + MongoClient client; + IMongoDatabase database; + public AlarmsArchive() + { + // rifare avvio con lettura da web.config... + client = new MongoClient(mdbConnString); + database = client.GetDatabase("MAPO"); + + } + /// + /// Singleton gestione istanza AlarmsManager + /// + public static AlarmsArchive man = new AlarmsArchive(); + /// + /// Crea una registrazione incidente su MongoDB + /// + /// + /// + /// numero di minuti precedenti di dati FluxLog da includere + /// + public int createIncident(string idxMacchina, List elencoAllarmi, int lastMinutes) + { + int answ = 0; + string currDateStr = ""; + int startYMD = 0; + DateTime adesso = DateTime.Now; + int anno = adesso.Year; + currDateStr = adesso.ToString("yyyyMMdd"); + int.TryParse(currDateStr, out startYMD); + // in primis recupero contatore allarmi correnti, lo incremento salvandolo e genero nuovo documento... + var collAlarmStats = database.GetCollection("AlarmStats"); + var builderAlarmStat = Builders.Filter; + var filtThisYear = builderAlarmStat.Eq(u => u.year, anno); + + var datiCorrenti = collAlarmStats.Find(filtThisYear); + var collAlarmEvents = database.GetCollection("AlarmEvents"); + + List lastFluxLog = new List(); + DS_applicazione.FluxLogDataTable tabDati = DataLayer.obj.taFL.getFiltOrd(idxMacchina, adesso.AddMinutes(-lastMinutes), adesso, true); + if (tabDati.Count > 0) + { + // chiamo procedura x conversione + lastFluxLog = FluxArchive.man.convertTable(tabDati, adesso, timeWindow.free); + } + alarmEvent nuovoAllarme = new alarmEvent() + { + yCurr = anno, + yCounter = answ, + dateYMD = startYMD, + started = DateTime.Now, + blackBoxData = lastFluxLog, + activeConditions = elencoAllarmi + }; + + collAlarmEvents.InsertOne(nuovoAllarme); + + return answ; + } + } +} diff --git a/MapoDb/FluxArchive.cs b/MapoDb/FluxArchive.cs index 351a78a7..5e91d4ba 100644 --- a/MapoDb/FluxArchive.cs +++ b/MapoDb/FluxArchive.cs @@ -138,7 +138,7 @@ namespace MapoDb /// Tabelal dei dati RAW registrati /// Data di riferimento /// Periodo del campionamento desiderato (e passato coi dati che sono relativi a tale periodo...) - protected List convertTable(DS_applicazione.FluxLogDataTable tabDati, DateTime tStamp, timeWindow periodo) + public List convertTable(DS_applicazione.FluxLogDataTable tabDati, DateTime tStamp, timeWindow periodo) { // init oggetti List listaRecords = new List(); diff --git a/MapoDb/MapoDb.csproj b/MapoDb/MapoDb.csproj index 150ef558..c1fb0fa8 100644 --- a/MapoDb/MapoDb.csproj +++ b/MapoDb/MapoDb.csproj @@ -120,6 +120,7 @@ + DS_applicazione.xsd diff --git a/MapoSDK/.editorconfig b/MapoSDK/.editorconfig new file mode 100644 index 00000000..f07b59b1 --- /dev/null +++ b/MapoSDK/.editorconfig @@ -0,0 +1,4 @@ +[*.cs] + +# CA2227: Le proprietà delle raccolte devono essere di sola lettura +dotnet_diagnostic.CA2227.severity = none diff --git a/MapoSDK/Enums.cs b/MapoSDK/Enums.cs index 17def9d2..1c49c2f6 100644 --- a/MapoSDK/Enums.cs +++ b/MapoSDK/Enums.cs @@ -62,6 +62,7 @@ /// public enum timeWindow { + free, hour, day, week, diff --git a/MapoSDK/MapoSDK.csproj b/MapoSDK/MapoSDK.csproj index af77f46a..7d1bba26 100644 --- a/MapoSDK/MapoSDK.csproj +++ b/MapoSDK/MapoSDK.csproj @@ -58,6 +58,7 @@ + diff --git a/MapoSDK/Objects.cs b/MapoSDK/Objects.cs index 3ea9750f..0c4a1f2d 100644 --- a/MapoSDK/Objects.cs +++ b/MapoSDK/Objects.cs @@ -439,6 +439,93 @@ namespace MapoSDK /// public string message { get; set; } = ""; } + /// + /// Definizione classe evento allarme + /// + public class alarmEvent + { + /// + /// Anno di riferimento allarme (per chiave yyyy.n) + /// + public int yCurr { get; set; } = 0; + /// + /// Contatore incrementale univoco annuale (per chiave yyyy.n) + /// + public int yCounter { get; set; } = 0; + /// + /// Data riferimento campione in formato YMD = yyyyMMdd + /// + public int dateYMD { get; set; } = 0; + /// + /// Data-Ora inizio evento + /// + public DateTime started { get; set; } = DateTime.Now; + /// + /// Data-Ora inizio evento + /// + public DateTime ended { get; set; } = DateTime.Now; + /// + /// Lista delle condizioni di allarme attive ad inizio evento + /// + public List activeConditions { get; set; } = null; + /// + /// Elenco dei dati di tipo FluxLog nei minuti antecedenti l'evento + /// + public List blackBoxData { get; set; } = null; + } + /// + /// Definizione classe evento allarme + /// + public class alarmStats + { + /// + /// Anno riferimento + /// + public int year { get; set; } = 0; + /// + /// Valore Contatore univoco annuale raggiunto yyyy.n + /// + public int yCounter { get; set; } = 1; + /// + /// Valore cumulato complessivo degli allarmi registrati + /// + public double totalDuration { get; set; } = 0; + /// + /// Durata media annuale allarmi + /// + public double avgDuration + { + get + { + double answ = 0; + try + { + answ = totalDuration / yCounter; + } + catch + { } + return answ; + } + } + } + /// + /// Definizione allarme + /// + public class alarmData + { + /// + /// Codice univoco + /// + public string code { get; set; } = ""; + /// + /// Descrizione + /// + public string description { get; set; } = ""; + /// + /// Severity (0....1000, minimo...massimo) + /// + public int severity { get; set; } = 0; + } #endregion From e4f0ffbaeef8b8f574b71a10d22e49e39d4dc50b Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Sat, 23 Nov 2019 16:17:01 +0100 Subject: [PATCH 2/3] Aggiunto oggetti x salvare dataItems da MTC --- MP-ADM/Web.config | 4 + MP-IO/Controllers/IOBController.cs | 14 +- MP-IO/Web.config | 430 +++++++++++++++-------------- MP-LAND/Web.config | 4 + MP-MON/Web.config | 4 + MP-Site/Web.config | 4 + MP-TAB/Web.config | 4 + MapoDb/AlarmsArchive.cs | 19 +- MapoDb/FluxArchive.cs | 14 +- MapoDb/MapoDb.csproj | 1 + MapoDb/MtcDataModelArchive.cs | 57 ++++ MapoDb/packages.config | 1 + MapoSDK/Enums.cs | 6 + MapoSDK/Objects.cs | 109 +++++++- 14 files changed, 445 insertions(+), 226 deletions(-) create mode 100644 MapoDb/MtcDataModelArchive.cs diff --git a/MP-ADM/Web.config b/MP-ADM/Web.config index bbace0f0..041a7094 100644 --- a/MP-ADM/Web.config +++ b/MP-ADM/Web.config @@ -325,6 +325,10 @@ + + + + diff --git a/MP-IO/Controllers/IOBController.cs b/MP-IO/Controllers/IOBController.cs index 144aec8b..42697b31 100644 --- a/MP-IO/Controllers/IOBController.cs +++ b/MP-IO/Controllers/IOBController.cs @@ -413,24 +413,22 @@ namespace MP_IO.Controllers // Rest System.Web.HttpContext.Current.Request.InputStream.Position = 0; - -#if false // procedo a deserializzare in blocco l'oggetto... - plcMemMap currMemMap = null; + List dataItems = null; try { // deserializzo. - currMemMap = JsonConvert.DeserializeObject(content); + dataItems = JsonConvert.DeserializeObject>(content); // se != null --> salvo! - if (currMemMap != null) + if (dataItems != null) { - DataLayer.setIobMemMap(id, currMemMap); + // chiamo metodo update direttamente! + MtcDataModelArchive.man.saveMachineDataItems(id, dataItems); answ = "OK"; } } catch - { } -#endif + { } } return answ; } diff --git a/MP-IO/Web.config b/MP-IO/Web.config index ddb66fdd..67ce31a4 100644 --- a/MP-IO/Web.config +++ b/MP-IO/Web.config @@ -18,6 +18,8 @@ + + @@ -43,218 +45,218 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -307,6 +309,10 @@ + + + + diff --git a/MP-LAND/Web.config b/MP-LAND/Web.config index b63064ba..9619a59c 100644 --- a/MP-LAND/Web.config +++ b/MP-LAND/Web.config @@ -326,6 +326,10 @@ + + + + diff --git a/MP-MON/Web.config b/MP-MON/Web.config index 22d7674f..122cc939 100644 --- a/MP-MON/Web.config +++ b/MP-MON/Web.config @@ -317,6 +317,10 @@ + + + + diff --git a/MP-Site/Web.config b/MP-Site/Web.config index d0184caa..5fe00903 100644 --- a/MP-Site/Web.config +++ b/MP-Site/Web.config @@ -334,6 +334,10 @@ + + + + diff --git a/MP-TAB/Web.config b/MP-TAB/Web.config index 52fddae0..2c1898b4 100644 --- a/MP-TAB/Web.config +++ b/MP-TAB/Web.config @@ -325,6 +325,10 @@ + + + + diff --git a/MapoDb/AlarmsArchive.cs b/MapoDb/AlarmsArchive.cs index 2e2fae5a..d3c5ecf5 100644 --- a/MapoDb/AlarmsArchive.cs +++ b/MapoDb/AlarmsArchive.cs @@ -1,5 +1,6 @@ using MapoSDK; using MongoDB.Driver; +using SteamWare; using System; using System.Collections.Generic; @@ -10,15 +11,27 @@ namespace MapoDb /// public class AlarmsArchive { +#if false string mdbConnString = "mongodb://W2019-MONGODB:27017"; //string mdbConnString = "mongodb://localhost:27017"; - MongoClient client; + MongoClient client; +#endif + /// + /// Database corrente MongoDB + /// IMongoDatabase database; + /// + /// Classe gestione archivio allarmi + /// public AlarmsArchive() { +#if false // rifare avvio con lettura da web.config... client = new MongoClient(mdbConnString); - database = client.GetDatabase("MAPO"); + database = client.GetDatabase("MAPO"); +#endif + + database = memLayer.ML.getMongoDatabase("MAPO"); } /// @@ -32,7 +45,7 @@ namespace MapoDb /// /// numero di minuti precedenti di dati FluxLog da includere /// - public int createIncident(string idxMacchina, List elencoAllarmi, int lastMinutes) + public int createAlarmEvent(string idxMacchina, List elencoAllarmi, int lastMinutes) { int answ = 0; string currDateStr = ""; diff --git a/MapoDb/FluxArchive.cs b/MapoDb/FluxArchive.cs index 5e91d4ba..b81bc853 100644 --- a/MapoDb/FluxArchive.cs +++ b/MapoDb/FluxArchive.cs @@ -1,5 +1,6 @@ using MapoSDK; using MongoDB.Driver; +using SteamWare; using System; using System.Collections.Generic; using System.Diagnostics; @@ -44,16 +45,27 @@ namespace MapoDb /// public class FluxArchive { +#if false string mdbConnString = "mongodb://W2019-MONGODB:27017"; //string mdbConnString = "mongodb://localhost:27017"; - MongoClient client; + MongoClient client; +#endif + /// + /// Database corrente MongoDB + /// IMongoDatabase database; + /// + /// Classe gestione archivio allarmi + /// public FluxArchive() { +#if false // rifare avvio con lettura da web.config... client = new MongoClient(mdbConnString); database = client.GetDatabase("MAPO"); +#endif + database = memLayer.ML.getMongoDatabase("MAPO"); } public static FluxArchive man = new FluxArchive(); /// diff --git a/MapoDb/MapoDb.csproj b/MapoDb/MapoDb.csproj index c1fb0fa8..49aa14d8 100644 --- a/MapoDb/MapoDb.csproj +++ b/MapoDb/MapoDb.csproj @@ -159,6 +159,7 @@ + True diff --git a/MapoDb/MtcDataModelArchive.cs b/MapoDb/MtcDataModelArchive.cs new file mode 100644 index 00000000..ced619d9 --- /dev/null +++ b/MapoDb/MtcDataModelArchive.cs @@ -0,0 +1,57 @@ +using MapoSDK; +using MongoDB.Driver; +using SteamWare; +using System.Collections.Generic; + +namespace MapoDb +{ + /// + /// Classe gestione archivio modelli MTC dei vari IOB + /// + public class MtcDataModelArchive + { + /// + /// Database corrente MongoDB + /// + IMongoDatabase database; + /// + /// Dizionario conf macchine + /// + public Dictionary> machineDataItems = new Dictionary>(); + + /// + /// Classe gestione archivio allarmi + /// + public MtcDataModelArchive() + { + database = memLayer.ML.getMongoDatabase("MAPO"); + } + /// + /// Singleton gestione istanza AlarmsManager + /// + public static MtcDataModelArchive man = new MtcDataModelArchive(); + /// + /// Salva il DataModel XML della macchina indicata + /// + /// + /// + /// + public bool saveMachineDataItems(string idxMacchina, List dataItems) + { + bool answ = false; + try + { + var collMtcSetup = database.GetCollection("MtcSetup"); + // compongo filtro ricerca e metodo update + var filter = Builders.Filter.Eq(u => u.idxMacchina, idxMacchina); + var update = Builders.Update.Set(u => u.dataItems, dataItems); + // chiamo update: cerco riga, se c'è aggiorno sennò creo + collMtcSetup.UpdateOne(filter, update); + answ = true; + } + catch + { } + return answ; + } + } +} diff --git a/MapoDb/packages.config b/MapoDb/packages.config index f0cb93ca..20a39ad6 100644 --- a/MapoDb/packages.config +++ b/MapoDb/packages.config @@ -12,6 +12,7 @@ + \ No newline at end of file diff --git a/MapoSDK/Enums.cs b/MapoSDK/Enums.cs index 1c49c2f6..08005c68 100644 --- a/MapoSDK/Enums.cs +++ b/MapoSDK/Enums.cs @@ -180,6 +180,12 @@ /// delete } + public enum DataItemCategory + { + CONDITION = 0, + EVENT = 1, + SAMPLE = 2 + } public enum tipoBarcode { diff --git a/MapoSDK/Objects.cs b/MapoSDK/Objects.cs index 0c4a1f2d..3eb75d54 100644 --- a/MapoSDK/Objects.cs +++ b/MapoSDK/Objects.cs @@ -2,6 +2,7 @@ using Newtonsoft.Json.Converters; using System; using System.Collections.Generic; +using System.Xml.Serialization; namespace MapoSDK { @@ -322,6 +323,8 @@ namespace MapoSDK } + #region gestione dati FluxLog + /// /// Classe oggetto statistiche sui dati /// @@ -362,7 +365,6 @@ namespace MapoSDK /// public string value { get; set; } = ""; } - /// /// Raccolta dati di storici sintetici per Macchina e Variabile /// @@ -423,7 +425,6 @@ namespace MapoSDK /// public List samples { get; set; } = null; } - /// /// Classe x inviare messaggi di tipo esecuzione di una generica esecuzione /// @@ -439,6 +440,11 @@ namespace MapoSDK /// public string message { get; set; } = ""; } + + #endregion + + #region gestione ALARMS / CONDITIONS + /// /// Definizione classe evento allarme /// @@ -529,6 +535,105 @@ namespace MapoSDK #endregion + #region gestione oggetti conf MNTConnect + + /// + /// Configurazione delle macchine MTC + /// + public class MtcSetup + { + /// + /// IdxMacchina cui ci riferiamo + /// + public string idxMacchina { get; set; } = ""; + /// + /// Setup della macchina + /// + public List dataItems { get; set; } + } + + public class MTConnDataItem + { + public MTConnDataItem() + { } + + [XmlAttribute("significantDigits")] + public int SignificantDigits { get; set; } + [XmlAttribute("respresentation")] + public string Representation { get; set; } + [XmlAttribute("sampleRate")] + public double SampleRate { get; set; } + [XmlAttribute("units")] + public string Units { get; set; } + [XmlAttribute("statistic")] + public string Statistic { get; set; } + [XmlAttribute("subType")] + public string SubType { get; set; } + [XmlAttribute("nativeUnits")] + public string NativeUnits { get; set; } + [XmlAttribute("nativeScale")] + public string NativeScale { get; set; } + [XmlAttribute("name")] + public string Name { get; set; } + [XmlAttribute("coordinateSystem")] + public string CoordinateSystem { get; set; } + [XmlAttribute("type")] + public string Type { get; set; } + [XmlAttribute("id")] + public string Id { get; set; } + [XmlAttribute("category")] + public DataItemCategory Category { get; set; } + [XmlIgnore] + public string TypePath { get; set; } + [XmlIgnore] + public string XPath { get; set; } + [XmlElement("Source")] + public Source Source { get; set; } + [XmlElement("Constraints")] + public Constraints Constraints { get; set; } + } + + public class Source + { + public Source() + { } + + [XmlAttribute("componentId")] + public string ComponentID { get; set; } + [XmlAttribute("dataItemId")] + public string DataItemID { get; set; } + [XmlText] + public string CDATA { get; set; } + } + + public class Constraints + { + [XmlElement("Filter")] + public Filter Filter; + + public Constraints() + { } + + [XmlElement("Maximum")] + public string Maximum { get; set; } + [XmlElement("Minimum")] + public string Minimum { get; set; } + [XmlElement("Value")] + public string Value { get; set; } + } + public class Filter + { + public Filter() + { } + + [XmlAttribute("type")] + public string Type { get; set; } + } + + #endregion + + #endregion + #if false /// From 0cd22631ab939b580dfca75dec393f4c78eb44f7 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Sat, 23 Nov 2019 16:34:38 +0100 Subject: [PATCH 3/3] Modifica oggetto dataItem x ridurre dimensione oggetti da trasferire... --- MP-IO/Controllers/IOBController.cs | 4 +- MapoDb/MtcDataModelArchive.cs | 4 +- MapoSDK/Objects.cs | 102 ++++++++--------------------- 3 files changed, 32 insertions(+), 78 deletions(-) diff --git a/MP-IO/Controllers/IOBController.cs b/MP-IO/Controllers/IOBController.cs index 42697b31..a9a9103d 100644 --- a/MP-IO/Controllers/IOBController.cs +++ b/MP-IO/Controllers/IOBController.cs @@ -414,11 +414,11 @@ namespace MP_IO.Controllers System.Web.HttpContext.Current.Request.InputStream.Position = 0; // procedo a deserializzare in blocco l'oggetto... - List dataItems = null; + List dataItems = null; try { // deserializzo. - dataItems = JsonConvert.DeserializeObject>(content); + dataItems = JsonConvert.DeserializeObject>(content); // se != null --> salvo! if (dataItems != null) { diff --git a/MapoDb/MtcDataModelArchive.cs b/MapoDb/MtcDataModelArchive.cs index ced619d9..b4b5b13e 100644 --- a/MapoDb/MtcDataModelArchive.cs +++ b/MapoDb/MtcDataModelArchive.cs @@ -17,7 +17,7 @@ namespace MapoDb /// /// Dizionario conf macchine /// - public Dictionary> machineDataItems = new Dictionary>(); + public Dictionary> machineDataItems = new Dictionary>(); /// /// Classe gestione archivio allarmi @@ -36,7 +36,7 @@ namespace MapoDb /// /// /// - public bool saveMachineDataItems(string idxMacchina, List dataItems) + public bool saveMachineDataItems(string idxMacchina, List dataItems) { bool answ = false; try diff --git a/MapoSDK/Objects.cs b/MapoSDK/Objects.cs index 3eb75d54..c2555e18 100644 --- a/MapoSDK/Objects.cs +++ b/MapoSDK/Objects.cs @@ -549,85 +549,39 @@ namespace MapoSDK /// /// Setup della macchina /// - public List dataItems { get; set; } + public List dataItems { get; set; } } - - public class MTConnDataItem + /// + /// Descrittore oggetto DataItem generico + /// + public class machDataItem { - public MTConnDataItem() + public machDataItem() { } - - [XmlAttribute("significantDigits")] - public int SignificantDigits { get; set; } - [XmlAttribute("respresentation")] - public string Representation { get; set; } - [XmlAttribute("sampleRate")] - public double SampleRate { get; set; } - [XmlAttribute("units")] - public string Units { get; set; } - [XmlAttribute("statistic")] - public string Statistic { get; set; } - [XmlAttribute("subType")] - public string SubType { get; set; } - [XmlAttribute("nativeUnits")] - public string NativeUnits { get; set; } - [XmlAttribute("nativeScale")] - public string NativeScale { get; set; } - [XmlAttribute("name")] - public string Name { get; set; } - [XmlAttribute("coordinateSystem")] - public string CoordinateSystem { get; set; } - [XmlAttribute("type")] - public string Type { get; set; } - [XmlAttribute("id")] - public string Id { get; set; } - [XmlAttribute("category")] + /// + /// ID generico + /// + public string uuid { get; set; } + /// + /// Categoria oggetto + /// public DataItemCategory Category { get; set; } - [XmlIgnore] - public string TypePath { get; set; } - [XmlIgnore] - public string XPath { get; set; } - [XmlElement("Source")] - public Source Source { get; set; } - [XmlElement("Constraints")] - public Constraints Constraints { get; set; } - } - - public class Source - { - public Source() - { } - - [XmlAttribute("componentId")] - public string ComponentID { get; set; } - [XmlAttribute("dataItemId")] - public string DataItemID { get; set; } - [XmlText] - public string CDATA { get; set; } - } - - public class Constraints - { - [XmlElement("Filter")] - public Filter Filter; - - public Constraints() - { } - - [XmlElement("Maximum")] - public string Maximum { get; set; } - [XmlElement("Minimum")] - public string Minimum { get; set; } - [XmlElement("Value")] - public string Value { get; set; } - } - public class Filter - { - public Filter() - { } - - [XmlAttribute("type")] + /// + /// Nome / descrizione + /// + public string Name { get; set; } + /// + /// Tipologia principale + /// public string Type { get; set; } + /// + /// Tipologia specifica + /// + public string SubType { get; set; } + /// + /// Unità di misura + /// + public string Units { get; set; } } #endregion