diff --git a/MTC_Adapter/MTC_Adapter/AdapterFanuc.cs b/MTC_Adapter/MTC_Adapter/AdapterFanuc.cs index 511c094..3572a5d 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterFanuc.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterFanuc.cs @@ -447,114 +447,6 @@ namespace MTC_Adapter } } /// - /// Ricarica dati da file di scambio con CMSConnect - /// - private void reloadDataFromFile() - { - if (utils.CRB("verbose")) lg.Info("Inizio lettura dati da file"); - int totRighe = 0; - // da rivedere: se sono N+1 file (N=path + generale) deve essere ad esempio nomeComune_*.mtc --> ciclo per leggerne N - string fileName = string.Format(@"{0}\{1}", utils.dataDir, utils.CRS("GeneralStatusFilePath")); - string linea; - // creo un vettore della dimensione corretta... conta anche commenti tanto poi riduco... - generalStatus = new Dictionary(); - try - { - totRighe = File.ReadLines(fileName).Count(); - // carica da file... - System.IO.StreamReader file = new System.IO.StreamReader(fileName); - if (file != null) - { - // leggo 1 linea alla volta... - string[] valori; - while ((linea = file.ReadLine()) != null) - { - // SE non è un commento... - if (linea.Substring(0, 1) != "#") - { - valori = linea.Split(utils.CRC("testCharSep")); - generalStatus.Add(valori[0], valori[1]); - } - } - // chiudo file - file.Close(); - if (utils.CRB("verbose")) lg.Info("Fine lettura dati da file"); - } - } - catch - { - lg.Info("Errore in lettura dati da file"); - } - - - // ora salvo valori letti... - foreach (KeyValuePair item in generalStatus) - { - // verifico la chiave e nel caso aggiorno... - switch (item.Key) - { - case "OperatorId": - mOperator.Value = item.Value; - break; - case "Path_01_CurrProg": - istPathProgrName[0] = item.Value; - break; - case "Path_02_CurrProg": - istPathProgrName[1] = item.Value; - break; - case "Path_03_CurrProg": - istPathProgrName[2] = item.Value; - break; - case "Path_04_CurrProg": - istPathProgrName[3] = item.Value; - break; - case "Path_05_CurrProg": - istPathProgrName[4] = item.Value; - break; - case "Path_06_CurrProg": - istPathProgrName[5] = item.Value; - break; - case "Path_01_PartId": - istPathPartId[0] = item.Value; - break; - case "Path_02_PartId": - istPathPartId[1] = item.Value; - break; - case "Path_03_PartId": - istPathPartId[2] = item.Value; - break; - case "Path_04_PartId": - istPathPartId[3] = item.Value; - break; - case "Path_05_PartId": - istPathPartId[4] = item.Value; - break; - case "Path_06_PartId": - istPathPartId[5] = item.Value; - break; - default: - break; - } - } - } - /// - /// Gestione strobe UserAction: salva dati e gestione ACK - /// - /// - /// - /// - /// - private void gestStrobeUserAction(int bitNum, ref byte[] retACK_DW1, ref string UserAction, string azione) - { - if (STRB_DW1.HasFlag((StFlag32)Math.Pow(2, bitNum))) - { - // salvo evento UserAction in variabile... - UserAction += azione; - // memorizzo allarme nel vettore ack.... - retACK_DW1 = utils.setBitOnStFlag(retACK_DW1, true, bitNum); - } - } - /// /// recupera allarmi ed aggiorna strobe (privato) degli allarmi /// /// 32bit mask degli allarmi da aggiornare diff --git a/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs b/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs index c21eb3f..3f618e7 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs @@ -2231,6 +2231,98 @@ namespace MTC_Adapter retACK_DW1 = utils.setBitOnStFlag(retACK_DW1, true, bitNum); } } + + /// + /// Ricarica dati da file di scambio con CMSConnect + /// + public void reloadDataFromFile() + { + if (utils.CRB("verbose")) lg.Info("Inizio lettura dati da file"); + int totRighe = 0; + // da rivedere: se sono N+1 file (N=path + generale) deve essere ad esempio nomeComune_*.mtc --> ciclo per leggerne N + string fileName = string.Format(@"{0}\{1}", utils.dataDir, utils.CRS("GeneralStatusFilePath")); + string linea; + // creo un vettore della dimensione corretta... conta anche commenti tanto poi riduco... + generalStatus = new Dictionary(); + try + { + totRighe = File.ReadLines(fileName).Count(); + // carica da file... + System.IO.StreamReader file = new System.IO.StreamReader(fileName); + if (file != null) + { + // leggo 1 linea alla volta... + string[] valori; + while ((linea = file.ReadLine()) != null) + { + // SE non è un commento... + if (linea.Substring(0, 1) != "#") + { + valori = linea.Split(utils.CRC("testCharSep")); + generalStatus.Add(valori[0], valori[1]); + } + } + // chiudo file + file.Close(); + if (utils.CRB("verbose")) lg.Info("Fine lettura dati da file"); + } + } + catch + { + lg.Info("Errore in lettura dati da file"); + } + + + // ora salvo valori letti... + foreach (KeyValuePair item in generalStatus) + { + // verifico la chiave e nel caso aggiorno... + switch (item.Key) + { + case "OperatorId": + mOperator.Value = item.Value; + break; + case "Path_01_CurrProg": + istPathProgrName[0] = item.Value; + break; + case "Path_02_CurrProg": + istPathProgrName[1] = item.Value; + break; + case "Path_03_CurrProg": + istPathProgrName[2] = item.Value; + break; + case "Path_04_CurrProg": + istPathProgrName[3] = item.Value; + break; + case "Path_05_CurrProg": + istPathProgrName[4] = item.Value; + break; + case "Path_06_CurrProg": + istPathProgrName[5] = item.Value; + break; + case "Path_01_PartId": + istPathPartId[0] = item.Value; + break; + case "Path_02_PartId": + istPathPartId[1] = item.Value; + break; + case "Path_03_PartId": + istPathPartId[2] = item.Value; + break; + case "Path_04_PartId": + istPathPartId[3] = item.Value; + break; + case "Path_05_PartId": + istPathPartId[4] = item.Value; + break; + case "Path_06_PartId": + istPathPartId[5] = item.Value; + break; + default: + break; + } + } + } /// /// verifica gli status attivi /// diff --git a/MTC_Adapter/MTC_Adapter/AdapterOsai.cs b/MTC_Adapter/MTC_Adapter/AdapterOsai.cs index 6f3f95a..7247683 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterOsai.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterOsai.cs @@ -560,97 +560,6 @@ namespace MTC_Adapter return answ; } /// - /// Ricarica dati da file di scambio con CMSConnect - /// - private void reloadDataFromFile() - { - if (utils.CRB("verbose")) lg.Info("Inizio lettura dati da file"); - int totRighe = 0; - // da rivedere: se sono N+1 file (N=path + generale) deve essere ad esempio nomeComune_*.mtc --> ciclo per leggerne N - string fileName = string.Format(@"{0}\{1}", utils.dataDir, utils.CRS("GeneralStatusFilePath")); - string linea; - // creo un vettore della dimensione corretta... conta anche commenti tanto poi riduco... - generalStatus = new Dictionary(); - try - { - totRighe = File.ReadLines(fileName).Count(); - // carica da file... - System.IO.StreamReader file = new System.IO.StreamReader(fileName); - if (file != null) - { - // leggo 1 linea alla volta... - string[] valori; - while ((linea = file.ReadLine()) != null) - { - // SE non è un commento... - if (linea.Substring(0, 1) != "#") - { - valori = linea.Split(utils.CRC("testCharSep")); - generalStatus.Add(valori[0], valori[1]); - } - } - // chiudo file - file.Close(); - if (utils.CRB("verbose")) lg.Info("Fine lettura dati da file"); - } - } - catch - { - lg.Info("Errore in lettura dati da file"); - } - - - // ora salvo valori letti... - foreach (KeyValuePair item in generalStatus) - { - // verifico la chiave e nel caso aggiorno... - switch (item.Key) - { - case "OperatorId": - mOperator.Value = item.Value; - break; - case "Path_01_CurrProg": - istPathProgrName[0] = item.Value; - break; - case "Path_02_CurrProg": - istPathProgrName[1] = item.Value; - break; - case "Path_03_CurrProg": - istPathProgrName[2] = item.Value; - break; - case "Path_04_CurrProg": - istPathProgrName[3] = item.Value; - break; - case "Path_05_CurrProg": - istPathProgrName[4] = item.Value; - break; - case "Path_06_CurrProg": - istPathProgrName[5] = item.Value; - break; - case "Path_01_PartId": - istPathPartId[0] = item.Value; - break; - case "Path_02_PartId": - istPathPartId[1] = item.Value; - break; - case "Path_03_PartId": - istPathPartId[2] = item.Value; - break; - case "Path_04_PartId": - istPathPartId[3] = item.Value; - break; - case "Path_05_PartId": - istPathPartId[4] = item.Value; - break; - case "Path_06_PartId": - istPathPartId[5] = item.Value; - break; - default: - break; - } - } - } - /// /// recupera allarmi ed aggiorna strobe (privato) degli allarmi /// /// 32bit mask degli allarmi da aggiornare diff --git a/MTC_Adapter/MTC_Adapter/AdapterSiemens.cs b/MTC_Adapter/MTC_Adapter/AdapterSiemens.cs index 31d59b7..3187ea5 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterSiemens.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterSiemens.cs @@ -495,8 +495,7 @@ namespace MTC_Adapter // recupero cod univoco test e numero parametri impiegati testNum = BitConverter.ToUInt16(BitConverter.GetBytes(MemBlockTestData[0]), 0); numPar = BitConverter.ToUInt16(BitConverter.GetBytes(MemBlockTestData[0]), 2); - - + // riporto separatore + numero test + num parametri answ = string.Format("{0}TN:{1}{0}NP:{2}", charSep, testNum, numPar); // se ci sono parametri da accodare li recupero! @@ -512,97 +511,6 @@ namespace MTC_Adapter return answ; } /// - /// Ricarica dati da file di scambio con CMSConnect - /// - private void reloadDataFromFile() - { - if (utils.CRB("verbose")) lg.Info("Inizio lettura dati da file"); - int totRighe = 0; - // da rivedere: se sono N+1 file (N=path + generale) deve essere ad esempio nomeComune_*.mtc --> ciclo per leggerne N - string fileName = string.Format(@"{0}\{1}", utils.dataDir, utils.CRS("GeneralStatusFilePath")); - string linea; - // creo un vettore della dimensione corretta... conta anche commenti tanto poi riduco... - generalStatus = new Dictionary(); - try - { - totRighe = File.ReadLines(fileName).Count(); - // carica da file... - System.IO.StreamReader file = new System.IO.StreamReader(fileName); - if (file != null) - { - // leggo 1 linea alla volta... - string[] valori; - while ((linea = file.ReadLine()) != null) - { - // SE non è un commento... - if (linea.Substring(0, 1) != "#") - { - valori = linea.Split(utils.CRC("testCharSep")); - generalStatus.Add(valori[0], valori[1]); - } - } - // chiudo file - file.Close(); - if (utils.CRB("verbose")) lg.Info("Fine lettura dati da file"); - } - } - catch - { - lg.Info("Errore in lettura dati da file"); - } - - - // ora salvo valori letti... - foreach (KeyValuePair item in generalStatus) - { - // verifico la chiave e nel caso aggiorno... - switch (item.Key) - { - case "OperatorId": - mOperator.Value = item.Value; - break; - case "Path_01_CurrProg": - istPathProgrName[0] = item.Value; - break; - case "Path_02_CurrProg": - istPathProgrName[1] = item.Value; - break; - case "Path_03_CurrProg": - istPathProgrName[2] = item.Value; - break; - case "Path_04_CurrProg": - istPathProgrName[3] = item.Value; - break; - case "Path_05_CurrProg": - istPathProgrName[4] = item.Value; - break; - case "Path_06_CurrProg": - istPathProgrName[5] = item.Value; - break; - case "Path_01_PartId": - istPathPartId[0] = item.Value; - break; - case "Path_02_PartId": - istPathPartId[1] = item.Value; - break; - case "Path_03_PartId": - istPathPartId[2] = item.Value; - break; - case "Path_04_PartId": - istPathPartId[3] = item.Value; - break; - case "Path_05_PartId": - istPathPartId[4] = item.Value; - break; - case "Path_06_PartId": - istPathPartId[5] = item.Value; - break; - default: - break; - } - } - } - /// /// recupera allarmi ed aggiorna strobe (privato) degli allarmi /// /// 32bit mask degli allarmi da aggiornare