diff --git a/MapoSDK/MapoSDK.csproj b/MapoSDK/MapoSDK.csproj
index bbe64b21..99951053 100644
--- a/MapoSDK/MapoSDK.csproj
+++ b/MapoSDK/MapoSDK.csproj
@@ -49,11 +49,19 @@
MoonPro.cs
+
+
+
+
+
+
+
+
Component
diff --git a/MapoSDK/Objects.cs b/MapoSDK/Objects.cs
index 2a8ac1bc..81bfe66f 100644
--- a/MapoSDK/Objects.cs
+++ b/MapoSDK/Objects.cs
@@ -144,269 +144,6 @@ namespace MapoSDK
#endregion Public Methods
}
- ///
- /// Definizione allarme
- ///
- public class alarmData
- {
- #region Public Properties
-
- ///
- /// 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 Public Properties
- }
-
- ///
- /// Definizione classe evento allarme
- ///
- public class alarmEvent
- {
- #region Public Properties
-
- ///
- /// 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;
-
- ///
- /// Data riferimento campione in formato YMD = yyyyMMdd
- ///
- public int dateYMD { get; set; } = 0;
-
- ///
- /// Data-Ora inizio evento
- ///
- public DateTime ended { get; set; } = DateTime.Now;
-
- ///
- /// Data-Ora inizio evento
- ///
- public DateTime started { get; set; } = DateTime.Now;
-
- ///
- /// Contatore incrementale univoco annuale (per chiave yyyy.n)
- ///
- public int yCounter { get; set; } = 0;
-
- ///
- /// Anno di riferimento allarme (per chiave yyyy.n)
- ///
- public int yCurr { get; set; } = 0;
-
- #endregion Public Properties
- }
-
- ///
- /// Definizione classe evento allarme
- ///
- public class alarmStats
- {
- #region Public Properties
-
- ///
- /// Durata media annuale allarmi
- ///
- public double avgDuration
- {
- get
- {
- double answ = 0;
- try
- {
- answ = totalDuration / yCounter;
- }
- catch
- { }
- return answ;
- }
- }
-
- ///
- /// Valore cumulato complessivo degli allarmi registrati
- ///
- public double totalDuration { get; set; } = 0;
-
- ///
- /// Valore Contatore univoco annuale raggiunto yyyy.n
- ///
- public int yCounter { get; set; } = 1;
-
- ///
- /// Anno riferimento
- ///
- public int year { get; set; } = 0;
-
- #endregion Public Properties
- }
-
- ///
- /// Struttura conf tipo dati
- ///
- public class dataConf
- {
- #region Public Properties
-
- ///
- /// DESCRIZIONE parametro
- ///
- public string description { get; set; } = "";
-
- ///
- /// Fattore per eventuale divisione (es leggo 1234 --> 12,34 con factor=100)
- ///
- public int factor { get; set; } = 1;
-
- ///
- /// Indice nell'area di memoria (da valore iniziale = 0)
- ///
- public int index { get; set; } = 0;
-
- ///
- /// Valore massimo ammesso (ove usato, es simulazione)
- ///
- public int maxVal { get; set; } = 9999;
-
- ///
- /// Nome "assoluto" della posizione nell'area di memoria (anche diverso da indice)
- ///
- public string memAddr { get; set; } = "";
-
- ///
- /// Valore minimo ammesso (ove usato, es simulazione)
- ///
- public int minVal { get; set; } = 0;
-
- ///
- /// NOME parametro
- ///
- public string name { get; set; } = "none";
-
- ///
- /// Size in byte
- ///
- public int size { get; set; } = 0;
-
- ///
- /// Tipo di dato
- ///
- [JsonConverter(typeof(StringEnumConverter))]
- public plcDataType tipoMem { get; set; } = plcDataType.Int;
-
- ///
- /// Unità di misura del parametro
- ///
- public string unit { get; set; } = "";
-
- ///
- /// Valore parametro (come stringa, decimali con ",", default VUOTO), poi LETTO da PLC (o appena scritto)
- ///
- public string value { get; set; } = "";
-
- #endregion Public Properties
- }
-
- ///
- /// Struttura conf tipo dati
- ///
- public class dataConfTSVC : dataConf
- {
- #region Public Properties
-
- ///
- /// Tipo di funzione da applicare al dato
- ///
- [JsonConverter(typeof(StringEnumConverter))]
- public VC_func func { get; set; } = VC_func.MAX;
-
- ///
- /// Periodo campionamento
- ///
- public int period { get; set; } = 60;
-
- #endregion Public Properties
- }
-
- ///
- /// Tracciato InputEvents in formato JSON valido
- /// Derivato da input realtime valore=3&dtEve=20181206180600000&dtCurr=20181206180600000&cnt=999
- ///
- public class evData
- {
- #region Public Properties
-
- ///
- /// Contatore incrementale x riordino invio (opzionale)
- ///
- public int cnt { get; set; } = 0;
-
- ///
- /// DataOra corrente della trasmissione
- ///
- public DateTime dtCurr { get; set; } = DateTime.Now;
-
- ///
- /// DataOra evento
- ///
- public DateTime dtEve { get; set; } = DateTime.Now;
-
- ///
- /// Valore del dato di flusso registrato
- ///
- public string valore { get; set; } = "-";
-
- #endregion Public Properties
- }
-
- ///
- /// Singolo dettaglio evento
- ///
- public class EventDetail
- {
- #region Public Properties
-
- ///
- /// Nome evento
- ///
- public string what { get; set; } = "";
-
- ///
- /// Data di riferimento
- ///
- public DateTime when { get; set; }
-
- #endregion Public Properties
- }
-
- ///
- /// Array valori tipo evData inviati come JSon
- ///
- public class evJsonPayload
- {
- #region Public Properties
-
- public List eventList { get; set; }
-
- #endregion Public Properties
- }
-
///
/// Classe x inviare messaggi di tipo esecuzione di una generica esecuzione
///
@@ -428,123 +165,6 @@ namespace MapoSDK
#endregion Public Properties
}
- public class fileEmbed
- {
- #region Public Properties
-
- ///
- /// Array di file da inviare
- ///
- public List fileList { get; set; } = new List();
-
- #endregion Public Properties
- }
-
- ///
- /// Tracciato FluxLog in formato JSON valido
- ///
- public class flogData : evData
- {
- #region Public Properties
-
- ///
- /// nome del flusso
- ///
- public string flux { get; set; } = "ND";
-
- #endregion Public Properties
- }
-
- ///
- /// Array valori tipo flogData inviati come JSon
- ///
- public class flogJsonPayload
- {
- #region Public Properties
-
- public List fluxData { get; set; }
-
- #endregion Public Properties
- }
-
-
-
- ///
- /// Tracciato UserLog in formato JSON valido
- ///
- public class ulogData : evData
- {
- #region Public Properties
-
- ///
- /// Nome del flusso (RC/RS/DI)
- ///
- public string flux { get; set; } = "DI";
- ///
- /// Operatore di riferimento
- ///
- public int matrOpr { get; set; } = 0;
- ///
- /// [OPZIONALE] label = causale scarto / tagCode
- ///
- public string label { get; set; } = "";
- ///
- /// [OPZIONALE] valNum = esitoOk (0/1) / Quantità di scarto associata
- ///
- public int valNum { get; set; } = 0;
-
- #endregion Public Properties
- }
-
- ///
- /// Array valori tipo flogData inviati come JSon
- ///
- public class ulogJsonPayload
- {
- #region Public Properties
-
- public List fluxData { get; set; }
-
- #endregion Public Properties
- }
-
- ///
- /// Raccolta dati di storici sintetici per Macchina e Variabile
- ///
- public class histData
- {
- #region Public Properties
-
- ///
- /// Data riferimento campione in formato YMD = yyyyMMdd
- ///
- public int dateYMD { get; set; } = 0;
-
- ///
- /// Macchina
- ///
- public string macName { get; set; } = "";
-
- ///
- /// Periodo di aggregazione di riferimento
- ///
- //[JsonConverter(typeof(StringEnumConverter))]
- public timeWindow period { get; set; } = timeWindow.day;
-
- ///
- /// Statistiche raccolte nel periodo
- ///
- public List stats { get; set; } = null;
-
- ///
- /// Tipo di valore registrato (internamente è string)
- ///
- //[JsonConverter(typeof(StringEnumConverter))]
- public plcDataType varType { get; set; } = plcDataType.Int;
-
- #endregion Public Properties
- }
-
///
/// Dati resoconto IOB
///
@@ -760,9 +380,6 @@ namespace MapoSDK
#endregion Public Properties
}
-
-
-
///
/// Struttura conf memorie PLC (inizialmente SIEMENS)
///
@@ -808,81 +425,6 @@ namespace MapoSDK
#endregion Public Properties
}
- ///
- /// Raccolta dati di storici raw per Macchina e Variabile
- ///
- public class rawData
- {
- #region Public Properties
-
- ///
- /// Data riferimento campione in formato YMD = yyyyMMdd
- ///
- public int dateYMD { get; set; } = 0;
-
- ///
- /// Macchina
- ///
- public string macName { get; set; } = "";
-
- ///
- /// Periodo di aggregazione di riferimento
- ///
- //[JsonConverter(typeof(StringEnumConverter))]
- public timeWindow period { get; set; } = timeWindow.day;
-
- ///
- /// Dati raw registrati nel periodo
- ///
- public List samples { get; set; } = null;
-
- ///
- /// Nome della Variabile tracciata
- ///
- public string varName { get; set; } = "";
-
- ///
- /// Tipo di valore registrato (internamente è string)
- ///
- //[JsonConverter(typeof(StringEnumConverter))]
- public plcDataType varType { get; set; } = plcDataType.Int;
-
- #endregion Public Properties
- }
-
- ///
- /// Classe oggetto base TimeSeries
- ///
- public class rawSample
- {
- #region Public Properties
-
- ///
- /// Data-Ora riferimento campione
- ///
- public DateTime timeStamp { get; set; } = DateTime.Now;
-
- ///
- /// Valore in formato stringa
- ///
- public string value { get; set; } = "";
-
- #endregion Public Properties
- }
-
- ///
- /// Classe x definire un file (corto) inviato come Json tramite httpost
- ///
- public class smallFile
- {
- #region Public Properties
-
- public string content { get; set; } = "";
- public string fileName { get; set; } = "";
-
- #endregion Public Properties
- }
-
public class StCheckOverride
{
#region Public Properties
@@ -896,168 +438,4 @@ namespace MapoSDK
#endregion Public Properties
}
-
- ///
- /// Classe oggetto base TimeSeries
- ///
- public class tsData
- {
- #region Public Properties
-
- ///
- /// In base al tipo di oggetto restituisce il valore cona deguata conversione......
- ///
- public object actValue
- {
- get
- {
- object answ = null;
- bool currBool = false;
- int currInt = 0;
- double currDouble = 0;
- switch (vcType)
- {
- case plcDataType.Boolean:
- _ = bool.TryParse(strValue, out currBool);
- answ = currBool;
- break;
-
- case plcDataType.Int:
- case plcDataType.DInt:
- _ = int.TryParse(strValue, out currInt);
- answ = currInt;
- break;
-
- case plcDataType.Real:
- _ = double.TryParse(strValue, out currDouble);
- answ = currDouble;
- break;
-
- case plcDataType.String:
- default:
- answ = strValue;
- break;
- }
- return answ;
- }
- }
-
- ///
- /// Valore float
- ///
- public float floatVal { get; set; } = 0;
-
- ///
- /// Valore intero
- ///
- public int intVal { get; set; } = 0;
-
- ///
- /// Valore in formato stringa (che può venire customizzato)
- ///
- public string strValue { get; set; } = "";
-
- ///
- /// Data-Ora riferimento campione
- ///
- public DateTime timeStamp { get; set; } = DateTime.Now;
-
- ///
- /// Nome Macchina
- ///
- public string vcMachine { get; set; } = "";
-
- ///
- /// Nome della Var Casuale
- ///
- public string vcName { get; set; } = "";
-
- ///
- /// Tipo di valore gestito
- ///
- [JsonConverter(typeof(StringEnumConverter))]
- public plcDataType vcType { get; set; } = plcDataType.Int;
-
- #endregion Public Properties
- }
-
- ///
- /// Aggregazione dati VC
- ///
- public class tsGrouped
- {
- #region Public Properties
-
- ///
- /// Valore medio (NON definito)
- ///
- public object avgValue { get; set; }
-
- ///
- /// Periodo di aggregazione di riferimento
- ///
- public timeWindow period { get; set; } = timeWindow.hour;
-
- ///
- /// Campioni effettivi nel periodo
- ///
- public List samples { get; set; }
-
- ///
- /// Data-Ora riferimento campione
- ///
- public DateTime timeStamp { get; set; } = DateTime.Now;
-
- ///
- /// Unità di Misura
- ///
- public string UM { get; set; } = "#";
-
- ///
- /// Nome Macchina
- ///
- public string vcMachine { get; set; } = "";
-
- ///
- /// Nome della Var Casuale
- ///
- public string vcName { get; set; } = "";
-
- #endregion Public Properties
- }
-
- ///
- /// Classe oggetto statistiche sui dati
- ///
- public class varStats
- {
- #region Public Properties
-
- ///
- /// Valore medio/mediano
- ///
- public float avg { get; set; } = 0;
-
- ///
- /// Valore max
- ///
- public float max { get; set; } = 0;
-
- ///
- /// Valore min
- ///
- public float min { get; set; } = 0;
-
- ///
- /// Num record
- ///
- public int numRec { get; set; } = 0;
-
- ///
- /// Nome della Variabile tracciata
- ///
- public string varName { get; set; } = "";
-
- #endregion Public Properties
- }
}
\ No newline at end of file
diff --git a/MapoSDK/alarm.cs b/MapoSDK/alarm.cs
new file mode 100644
index 00000000..f0beaa11
--- /dev/null
+++ b/MapoSDK/alarm.cs
@@ -0,0 +1,118 @@
+using System;
+using System.Collections.Generic;
+
+namespace MapoSDK
+{
+ ///
+ /// Definizione allarme
+ ///
+ public class alarmData
+ {
+ #region Public Properties
+
+ ///
+ /// 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 Public Properties
+ }
+
+ ///
+ /// Definizione classe evento allarme
+ ///
+ public class alarmEvent
+ {
+ #region Public Properties
+
+ ///
+ /// 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;
+
+ ///
+ /// Data riferimento campione in formato YMD = yyyyMMdd
+ ///
+ public int dateYMD { get; set; } = 0;
+
+ ///
+ /// Data-Ora inizio evento
+ ///
+ public DateTime ended { get; set; } = DateTime.Now;
+
+ ///
+ /// Data-Ora inizio evento
+ ///
+ public DateTime started { get; set; } = DateTime.Now;
+
+ ///
+ /// Contatore incrementale univoco annuale (per chiave yyyy.n)
+ ///
+ public int yCounter { get; set; } = 0;
+
+ ///
+ /// Anno di riferimento allarme (per chiave yyyy.n)
+ ///
+ public int yCurr { get; set; } = 0;
+
+ #endregion Public Properties
+ }
+
+ ///
+ /// Definizione classe evento allarme
+ ///
+ public class alarmStats
+ {
+ #region Public Properties
+
+ ///
+ /// Durata media annuale allarmi
+ ///
+ public double avgDuration
+ {
+ get
+ {
+ double answ = 0;
+ try
+ {
+ answ = totalDuration / yCounter;
+ }
+ catch
+ { }
+ return answ;
+ }
+ }
+
+ ///
+ /// Valore cumulato complessivo degli allarmi registrati
+ ///
+ public double totalDuration { get; set; } = 0;
+
+ ///
+ /// Valore Contatore univoco annuale raggiunto yyyy.n
+ ///
+ public int yCounter { get; set; } = 1;
+
+ ///
+ /// Anno riferimento
+ ///
+ public int year { get; set; } = 0;
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/MapoSDK/dataConf.cs b/MapoSDK/dataConf.cs
new file mode 100644
index 00000000..1c91903b
--- /dev/null
+++ b/MapoSDK/dataConf.cs
@@ -0,0 +1,92 @@
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+
+namespace MapoSDK
+{
+ ///
+ /// Struttura conf tipo dati
+ ///
+ public class dataConf
+ {
+ #region Public Properties
+
+ ///
+ /// DESCRIZIONE parametro
+ ///
+ public string description { get; set; } = "";
+
+ ///
+ /// Fattore per eventuale divisione (es leggo 1234 --> 12,34 con factor=100)
+ ///
+ public int factor { get; set; } = 1;
+
+ ///
+ /// Indice nell'area di memoria (da valore iniziale = 0)
+ ///
+ public int index { get; set; } = 0;
+
+ ///
+ /// Valore massimo ammesso (ove usato, es simulazione)
+ ///
+ public int maxVal { get; set; } = 9999;
+
+ ///
+ /// Nome "assoluto" della posizione nell'area di memoria (anche diverso da indice)
+ ///
+ public string memAddr { get; set; } = "";
+
+ ///
+ /// Valore minimo ammesso (ove usato, es simulazione)
+ ///
+ public int minVal { get; set; } = 0;
+
+ ///
+ /// NOME parametro
+ ///
+ public string name { get; set; } = "none";
+
+ ///
+ /// Size in byte
+ ///
+ public int size { get; set; } = 0;
+
+ ///
+ /// Tipo di dato
+ ///
+ [JsonConverter(typeof(StringEnumConverter))]
+ public plcDataType tipoMem { get; set; } = plcDataType.Int;
+
+ ///
+ /// Unità di misura del parametro
+ ///
+ public string unit { get; set; } = "";
+
+ ///
+ /// Valore parametro (come stringa, decimali con ",", default VUOTO), poi LETTO da PLC (o appena scritto)
+ ///
+ public string value { get; set; } = "";
+
+ #endregion Public Properties
+ }
+
+ ///
+ /// Struttura conf tipo dati
+ ///
+ public class dataConfTSVC : dataConf
+ {
+ #region Public Properties
+
+ ///
+ /// Tipo di funzione da applicare al dato
+ ///
+ [JsonConverter(typeof(StringEnumConverter))]
+ public VC_func func { get; set; } = VC_func.MAX;
+
+ ///
+ /// Periodo campionamento
+ ///
+ public int period { get; set; } = 60;
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/MapoSDK/events.cs b/MapoSDK/events.cs
new file mode 100644
index 00000000..8e231419
--- /dev/null
+++ b/MapoSDK/events.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+
+namespace MapoSDK
+{
+ ///
+ /// Tracciato InputEvents in formato JSON valido
+ /// Derivato da input realtime valore=3&dtEve=20181206180600000&dtCurr=20181206180600000&cnt=999
+ ///
+ public class evData
+ {
+ #region Public Properties
+
+ ///
+ /// Contatore incrementale x riordino invio (opzionale)
+ ///
+ public int cnt { get; set; } = 0;
+
+ ///
+ /// DataOra corrente della trasmissione
+ ///
+ public DateTime dtCurr { get; set; } = DateTime.Now;
+
+ ///
+ /// DataOra evento
+ ///
+ public DateTime dtEve { get; set; } = DateTime.Now;
+
+ ///
+ /// Valore del dato di flusso registrato
+ ///
+ public string valore { get; set; } = "-";
+
+ #endregion Public Properties
+ }
+
+ ///
+ /// Singolo dettaglio evento
+ ///
+ public class EventDetail
+ {
+ #region Public Properties
+
+ ///
+ /// Nome evento
+ ///
+ public string what { get; set; } = "";
+
+ ///
+ /// Data di riferimento
+ ///
+ public DateTime when { get; set; }
+
+ #endregion Public Properties
+ }
+
+ ///
+ /// Array valori tipo evData inviati come JSon
+ ///
+ public class evJsonPayload
+ {
+ #region Public Properties
+
+ public List eventList { get; set; }
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/MapoSDK/fileEmbed.cs b/MapoSDK/fileEmbed.cs
new file mode 100644
index 00000000..fc5d6276
--- /dev/null
+++ b/MapoSDK/fileEmbed.cs
@@ -0,0 +1,29 @@
+using System.Collections.Generic;
+
+namespace MapoSDK
+{
+ public class fileEmbed
+ {
+ #region Public Properties
+
+ ///
+ /// Array di file da inviare
+ ///
+ public List fileList { get; set; } = new List();
+
+ #endregion Public Properties
+ }
+
+ ///
+ /// Classe x definire un file (corto) inviato come Json tramite httpost
+ ///
+ public class smallFile
+ {
+ #region Public Properties
+
+ public string content { get; set; } = "";
+ public string fileName { get; set; } = "";
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/MapoSDK/flog.cs b/MapoSDK/flog.cs
new file mode 100644
index 00000000..c3371c5c
--- /dev/null
+++ b/MapoSDK/flog.cs
@@ -0,0 +1,31 @@
+using System.Collections.Generic;
+
+namespace MapoSDK
+{
+ ///
+ /// Tracciato FluxLog in formato JSON valido
+ ///
+ public class flogData : evData
+ {
+ #region Public Properties
+
+ ///
+ /// nome del flusso
+ ///
+ public string flux { get; set; } = "ND";
+
+ #endregion Public Properties
+ }
+
+ ///
+ /// Array valori tipo flogData inviati come JSon
+ ///
+ public class flogJsonPayload
+ {
+ #region Public Properties
+
+ public List fluxData { get; set; }
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/MapoSDK/samples.cs b/MapoSDK/samples.cs
new file mode 100644
index 00000000..c6d0b97a
--- /dev/null
+++ b/MapoSDK/samples.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Collections.Generic;
+
+namespace MapoSDK
+{
+ ///
+ /// Raccolta dati di storici raw per Macchina e Variabile
+ ///
+ public class rawData
+ {
+ #region Public Properties
+
+ ///
+ /// Data riferimento campione in formato YMD = yyyyMMdd
+ ///
+ public int dateYMD { get; set; } = 0;
+
+ ///
+ /// Macchina
+ ///
+ public string macName { get; set; } = "";
+
+ ///
+ /// Periodo di aggregazione di riferimento
+ ///
+ //[JsonConverter(typeof(StringEnumConverter))]
+ public timeWindow period { get; set; } = timeWindow.day;
+
+ ///
+ /// Dati raw registrati nel periodo
+ ///
+ public List samples { get; set; } = null;
+
+ ///
+ /// Nome della Variabile tracciata
+ ///
+ public string varName { get; set; } = "";
+
+ ///
+ /// Tipo di valore registrato (internamente è string)
+ ///
+ //[JsonConverter(typeof(StringEnumConverter))]
+ public plcDataType varType { get; set; } = plcDataType.Int;
+
+ #endregion Public Properties
+ }
+
+ ///
+ /// Classe oggetto base TimeSeries
+ ///
+ public class rawSample
+ {
+ #region Public Properties
+
+ ///
+ /// Data-Ora riferimento campione
+ ///
+ public DateTime timeStamp { get; set; } = DateTime.Now;
+
+ ///
+ /// Valore in formato stringa
+ ///
+ public string value { get; set; } = "";
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/MapoSDK/stats.cs b/MapoSDK/stats.cs
new file mode 100644
index 00000000..95e956a5
--- /dev/null
+++ b/MapoSDK/stats.cs
@@ -0,0 +1,208 @@
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+using System;
+using System.Collections.Generic;
+
+namespace MapoSDK
+{
+ ///
+ /// Raccolta dati di storici sintetici per Macchina e Variabile
+ ///
+ public class histData
+ {
+ #region Public Properties
+
+ ///
+ /// Data riferimento campione in formato YMD = yyyyMMdd
+ ///
+ public int dateYMD { get; set; } = 0;
+
+ ///
+ /// Macchina
+ ///
+ public string macName { get; set; } = "";
+
+ ///
+ /// Periodo di aggregazione di riferimento
+ ///
+ //[JsonConverter(typeof(StringEnumConverter))]
+ public timeWindow period { get; set; } = timeWindow.day;
+
+ ///
+ /// Statistiche raccolte nel periodo
+ ///
+ public List stats { get; set; } = null;
+
+ ///
+ /// Tipo di valore registrato (internamente è string)
+ ///
+ //[JsonConverter(typeof(StringEnumConverter))]
+ public plcDataType varType { get; set; } = plcDataType.Int;
+
+ #endregion Public Properties
+ }
+
+ ///
+ /// Classe oggetto base TimeSeries
+ ///
+ public class tsData
+ {
+ #region Public Properties
+
+ ///
+ /// In base al tipo di oggetto restituisce il valore cona deguata conversione......
+ ///
+ public object actValue
+ {
+ get
+ {
+ object answ = null;
+ bool currBool = false;
+ int currInt = 0;
+ double currDouble = 0;
+ switch (vcType)
+ {
+ case plcDataType.Boolean:
+ _ = bool.TryParse(strValue, out currBool);
+ answ = currBool;
+ break;
+
+ case plcDataType.Int:
+ case plcDataType.DInt:
+ _ = int.TryParse(strValue, out currInt);
+ answ = currInt;
+ break;
+
+ case plcDataType.Real:
+ _ = double.TryParse(strValue, out currDouble);
+ answ = currDouble;
+ break;
+
+ case plcDataType.String:
+ default:
+ answ = strValue;
+ break;
+ }
+ return answ;
+ }
+ }
+
+ ///
+ /// Valore float
+ ///
+ public float floatVal { get; set; } = 0;
+
+ ///
+ /// Valore intero
+ ///
+ public int intVal { get; set; } = 0;
+
+ ///
+ /// Valore in formato stringa (che può venire customizzato)
+ ///
+ public string strValue { get; set; } = "";
+
+ ///
+ /// Data-Ora riferimento campione
+ ///
+ public DateTime timeStamp { get; set; } = DateTime.Now;
+
+ ///
+ /// Nome Macchina
+ ///
+ public string vcMachine { get; set; } = "";
+
+ ///
+ /// Nome della Var Casuale
+ ///
+ public string vcName { get; set; } = "";
+
+ ///
+ /// Tipo di valore gestito
+ ///
+ [JsonConverter(typeof(StringEnumConverter))]
+ public plcDataType vcType { get; set; } = plcDataType.Int;
+
+ #endregion Public Properties
+ }
+
+ ///
+ /// Aggregazione dati VC
+ ///
+ public class tsGrouped
+ {
+ #region Public Properties
+
+ ///
+ /// Valore medio (NON definito)
+ ///
+ public object avgValue { get; set; }
+
+ ///
+ /// Periodo di aggregazione di riferimento
+ ///
+ public timeWindow period { get; set; } = timeWindow.hour;
+
+ ///
+ /// Campioni effettivi nel periodo
+ ///
+ public List samples { get; set; }
+
+ ///
+ /// Data-Ora riferimento campione
+ ///
+ public DateTime timeStamp { get; set; } = DateTime.Now;
+
+ ///
+ /// Unità di Misura
+ ///
+ public string UM { get; set; } = "#";
+
+ ///
+ /// Nome Macchina
+ ///
+ public string vcMachine { get; set; } = "";
+
+ ///
+ /// Nome della Var Casuale
+ ///
+ public string vcName { get; set; } = "";
+
+ #endregion Public Properties
+ }
+
+ ///
+ /// Classe oggetto statistiche sui dati
+ ///
+ public class varStats
+ {
+ #region Public Properties
+
+ ///
+ /// Valore medio/mediano
+ ///
+ public float avg { get; set; } = 0;
+
+ ///
+ /// Valore max
+ ///
+ public float max { get; set; } = 0;
+
+ ///
+ /// Valore min
+ ///
+ public float min { get; set; } = 0;
+
+ ///
+ /// Num record
+ ///
+ public int numRec { get; set; } = 0;
+
+ ///
+ /// Nome della Variabile tracciata
+ ///
+ public string varName { get; set; } = "";
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/MapoSDK/ulog.cs b/MapoSDK/ulog.cs
new file mode 100644
index 00000000..ebf67baa
--- /dev/null
+++ b/MapoSDK/ulog.cs
@@ -0,0 +1,46 @@
+using System.Collections.Generic;
+
+namespace MapoSDK
+{
+ ///
+ /// Tracciato UserLog in formato JSON valido
+ ///
+ public class ulogData : evData
+ {
+ #region Public Properties
+
+ ///
+ /// Nome del flusso (RC/RS/DI)
+ ///
+ public string flux { get; set; } = "DI";
+
+ ///
+ /// [OPZIONALE] label = causale scarto / tagCode
+ ///
+ public string label { get; set; } = "";
+
+ ///
+ /// Operatore di riferimento
+ ///
+ public int matrOpr { get; set; } = 0;
+
+ ///
+ /// [OPZIONALE] valNum = esitoOk (0/1) / Quantità di scarto associata
+ ///
+ public int valNum { get; set; } = 0;
+
+ #endregion Public Properties
+ }
+
+ ///
+ /// Array valori tipo flogData inviati come JSon
+ ///
+ public class ulogJsonPayload
+ {
+ #region Public Properties
+
+ public List fluxData { get; set; }
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file