diff --git a/MP-IO/Controllers/IOBController.cs b/MP-IO/Controllers/IOBController.cs
index 1c21f990..522716d4 100644
--- a/MP-IO/Controllers/IOBController.cs
+++ b/MP-IO/Controllers/IOBController.cs
@@ -1883,6 +1883,50 @@ namespace MP_IO.Controllers
return answ;
}
+ ///
+ /// Processa una chiamata POST per l'invio di un oggetto YAML testuale corrispondente alla configurazione dell'IOB
+ /// PUT: IOB/saveConfYaml/SIMUL_03
+ ///
+ /// ID dell'IOB
+ ///
+ [HttpPost]
+ public string saveConfYaml(string id)
+ {
+ string answ = "";
+ if (string.IsNullOrEmpty(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 (content != null)
+ {
+
+ try
+ {
+ DataLayer DataLayerObj = new DataLayer();
+ DataLayerObj.setIobConfYaml(id, content);
+ answ = "OK";
+ }
+ catch (Exception exc)
+ {
+ logger.lg.scriviLog($"Errore in saveConfYaml{Environment.NewLine}{exc}");
+ }
+ }
+ }
+ return answ;
+ }
+
///
/// Processa una chiamata POST per l'invio di un array Json di oggetti di conf DataItems (es
/// per MTC)
@@ -2129,18 +2173,13 @@ namespace MP_IO.Controllers
// uso datalayer che COMPRENDE MapoDb...
DataLayer DataLayerObj = new DataLayer();
int num2keep = 5;
- var rConf = DataLayerObj.ListConfig.Where(x => x.chiave == "").FirstOrDefault();
+ var rConf = DataLayerObj.ListConfig.Where(x => x.chiave == "IO_NumReboot2Keep").FirstOrDefault();
if (rConf != null)
{
int.TryParse(rConf.valore, out num2keep);
}
// chiamo registrazione reboot
DataLayerObj.MapoDbObj.registraStartup(id, IPv4, agent, mac, num2keep);
-#if false
- // ora salvo che la macchina è stata (ri)avviata...
- MapoDb.MapoDb MapoDbObj = new MapoDb.MapoDb();
- MapoDbObj.registraStartup(id, IPv4, agent, mac);
-#endif
answ = "OK";
}
catch (Exception exc)
diff --git a/MapoDb/DataLayer.cs b/MapoDb/DataLayer.cs
index fa50d152..f611fc38 100644
--- a/MapoDb/DataLayer.cs
+++ b/MapoDb/DataLayer.cs
@@ -470,6 +470,15 @@ namespace MapoDb
{
return mHash($"MemMap:{idxMacchina}");
}
+ ///
+ /// Hash dati di configurazione IOB in formato YAML x la macchina specificata
+ ///
+ ///
+ ///
+ public static string ConfYamlHash(string idxMacchina)
+ {
+ return mHash($"ConfYaml:{idxMacchina}");
+ }
///
/// Hash Redis contenente i dati MP di una specifico TYPE (es StatusMacchina,
@@ -4086,7 +4095,7 @@ namespace MapoDb
}
///
- /// Salvataggio su della mappa di memoria dell'IOB x ulteriori impieghi
+ /// Salvataggio della mappa di memoria dell'IOB x ulteriori impieghi
///
///
///
@@ -4104,6 +4113,24 @@ namespace MapoDb
return answ;
}
+ ///
+ /// Salvataggio YAML completo di configurazione dell'IOB
+ ///
+ ///
+ ///
+ ///
+ public bool setIobConfYaml(string idxMacchina, string iobConfFull)
+ {
+ bool answ = false;
+ // se ho un area memoria valida...
+ if (!string.IsNullOrEmpty(iobConfFull))
+ {
+ // salvo!
+ memLayer.ML.setRSV(ConfYamlHash(idxMacchina), iobConfFull);
+ }
+ return answ;
+ }
+
///
/// Restituisce il valore booleano se la macchina sia abilitata all'inserimento COMPLETO nel
/// Signal Log