diff --git a/MTC_Adapter/OPC-UA-REDIS/AdapterRed.cs b/MTC_Adapter/OPC-UA-REDIS/AdapterRed.cs index 73ac4cd..1f4387f 100644 --- a/MTC_Adapter/OPC-UA-REDIS/AdapterRed.cs +++ b/MTC_Adapter/OPC-UA-REDIS/AdapterRed.cs @@ -53,6 +53,10 @@ namespace OPC_UA_REDIS /// public Dictionary nameReplaced = new Dictionary(); /// + /// Dizionario di TUTTE le conversioni variabili (OPC-UA-->MTC) applicate + /// + public Dictionary nameReplacedInvert = new Dictionary(); + /// /// Dizionario di TUTTE le variabili ESCLUSE (filtrate) /// public Dictionary nameExcluded = new Dictionary(); @@ -334,7 +338,7 @@ namespace OPC_UA_REDIS // SOLO se richiesto FULL RESET... if (baseUtils.CRB("fullReset")) - { + { // ora il valore delle chaivi diventa unavailable... hashVal = availStatus.NULL.ToString(); // percorro tutto l'albero nodi item ed allarmi e SCRIVO!!!! @@ -563,6 +567,16 @@ namespace OPC_UA_REDIS #region helper gestione REDIS + public string getOrigKey(string redKey) + { + string answ = redKey; + if (nameReplacedInvert.ContainsKey(redKey)) + { + answ = nameReplacedInvert[redKey]; + } + return answ; + } + /// /// Fix KEY x standard redis ("_" --> ":") /// @@ -654,6 +668,8 @@ namespace OPC_UA_REDIS } // salvo in dizionario nameReplaced.Add(origKey, answ); + // salvo in dizionario INVERSO + nameReplacedInvert.Add(answ, origKey); } } return answ; diff --git a/MTC_Adapter/SCMA/AdapterGeneric.cs b/MTC_Adapter/SCMA/AdapterGeneric.cs index f9eab30..bf89dc5 100644 --- a/MTC_Adapter/SCMA/AdapterGeneric.cs +++ b/MTC_Adapter/SCMA/AdapterGeneric.cs @@ -4119,24 +4119,19 @@ namespace SCMA // da gestire su ogni adapter... legge tutto array STROBE!!! } /// - /// Effettua check nome variabile direttamente o tramite decodifica key SOUR + /// Effettua decodifica a ritroso della key SOUR /// /// /// /// - protected bool checkName(string varName, string tgtName) + protected string getOrigName(string varName) { - bool answ = false; + string answ = varName; // se il gateway รจ sour DEVO FARE CONTROLLO con fix... if (utils.CRS("adpProto") == "SOURS") { GatewaySOURS gSour = (GatewaySOURS)currGateway; - answ = (varName == gSour.mAdapter.fixRedKey(tgtName)); - } - // altrimenti checkDiretto... - else - { - answ = (varName == tgtName); + answ = gSour.mAdapter.getOrigKey(varName); } // return! return answ; @@ -4159,15 +4154,15 @@ namespace SCMA numero = 0; valRead = 0; // decodifico... - if (checkName(maintData[i].varName, "ACC_TIME")) + if (getOrigName(maintData[i].varName) == "ACC_TIME") { istOreMaccOn.addValue(DateTime.Now, Convert.ToInt32(tabDatiMtz[i])); } - else if (checkName(maintData[i].varName , "ACC_TIME_WORK")) + else if (getOrigName(maintData[i].varName) == "ACC_TIME_WORK") { istOreMaccLav.addValue(DateTime.Now, Convert.ToInt32(tabDatiMtz[i])); } - else if (checkName(maintData[i].varName , "SlittaTastatore_Count")) + else if (getOrigName(maintData[i].varName) == "SlittaTastatore_Count") { istSlittaTast.addValue(DateTime.Now, Convert.ToInt32(tabDatiMtz[i])); }