inserita lettura file di conf allarmi CNC...
This commit is contained in:
@@ -27,6 +27,11 @@ namespace MTC_Adapter
|
||||
/// </summary>
|
||||
public otherData[] mapIOT_String;
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto elenco allarmi SOLO CNC (OCCHIO codice numerico = INDICE!!!)
|
||||
/// </summary>
|
||||
public allarme[] elencoAllarmiCNC;
|
||||
|
||||
/// <summary>
|
||||
/// dimensione buffer BYTE (da file map)
|
||||
/// </summary>
|
||||
@@ -54,6 +59,7 @@ namespace MTC_Adapter
|
||||
loadWordListMap();
|
||||
loadDWordListMap();
|
||||
loadStringListMap();
|
||||
loadAllarmiCNC();
|
||||
}
|
||||
/// <summary>
|
||||
/// Carico conf vettore dati STRING
|
||||
@@ -86,6 +92,50 @@ namespace MTC_Adapter
|
||||
loadConfFile(ref mapIOT_Byte, filePath("IOTByteFilePath"), 1, ref numByte);
|
||||
}
|
||||
/// <summary>
|
||||
/// caricamento allarmi da file (CON RIEMPIMENTO MANCANTI!!!!)
|
||||
/// </summary>
|
||||
protected void loadAllarmiCNC()
|
||||
{
|
||||
if (utils.CRB("verbose")) lg.Info("Inizio caricamento vettore allarmi");
|
||||
int totRighe = 0;
|
||||
string fileName = string.Format(@"{0}\{1}", utils.confDir, utils.CRS("AlarmListCNC"));
|
||||
string linea;
|
||||
try
|
||||
{
|
||||
string lastLine = File.ReadLines(fileName).Last();
|
||||
//totRighe = Convert.ToInt32(lastLine.Substring(0, lastLine.IndexOf('|')));
|
||||
totRighe = startNumb(lastLine, utils.CRC("testCharSep"));
|
||||
}
|
||||
catch
|
||||
{
|
||||
totRighe = File.ReadLines(fileName).Count();
|
||||
}
|
||||
// creo un vettore della dimensione corretta... PRENDO IL MASSIMO dei valori...
|
||||
elencoAllarmi = new allarme[totRighe];
|
||||
// ora creo un vettore di allarmi VUOTI...
|
||||
for (int i = 1; i <= totRighe; i++)
|
||||
{
|
||||
elencoAllarmi[i - 1] = new allarme(i.ToString(), "CNC", "WARNING", "");
|
||||
}
|
||||
// carica da file...
|
||||
System.IO.StreamReader file = new System.IO.StreamReader(fileName);
|
||||
// leggo 1 linea alla volta...
|
||||
int numRiga = 0;
|
||||
while ((linea = file.ReadLine()) != null)
|
||||
{
|
||||
// SE non è un commento...
|
||||
if (linea.Substring(0, 1) != "#")
|
||||
{
|
||||
// recupero numRiga da prima parte linea...
|
||||
numRiga = startNumb(linea, utils.CRC("testCharSep"));
|
||||
elencoAllarmi[numRiga - 1] = decodeAlarmLine(linea, utils.CRC("testCharSep"));
|
||||
}
|
||||
}
|
||||
// chiudo file
|
||||
file.Close();
|
||||
if (utils.CRB("verbose")) lg.Info(string.Format("Fine caricamento vettore allarmi CNC: {0} allarmi caricati!", numRiga));
|
||||
}
|
||||
/// <summary>
|
||||
/// Restituisce path completo file da chaive configurazione
|
||||
/// </summary>
|
||||
/// <param name="keyFile">chaive conf x file richiesto</param>
|
||||
@@ -503,13 +553,30 @@ namespace MTC_Adapter
|
||||
lg.Error("Errore connessione mancante in getIotMem_Word");
|
||||
}
|
||||
|
||||
int numAlarmCNC = 0;
|
||||
int numero = 0;
|
||||
int byteNum = 0;
|
||||
// Processing area WORD
|
||||
for (int i = 0; i < mapIOT_Word.Length; i++)
|
||||
{
|
||||
int.TryParse(mapIOT_Word[i].memAddr, out byteNum);
|
||||
if (mapIOT_Word[i].varName.StartsWith("IOT_S_MD_"))
|
||||
|
||||
if (mapIOT_Word[i].varName == "IOT_CN_MSG")
|
||||
{
|
||||
// leggo codice allarme...
|
||||
numAlarmCNC = ncDevice.PLC_MemoryAreaIOT_Word[byteNum];
|
||||
// controllo, SE è 0 --> normal/niente, altrimenti è l'allarme indicato!!!
|
||||
if (numAlarmCNC == 0)
|
||||
{
|
||||
mAlarmCNC.Normal();
|
||||
}
|
||||
else
|
||||
{
|
||||
allarme currAllarm;
|
||||
//elencoAllarmiCNC
|
||||
}
|
||||
}
|
||||
else if (mapIOT_Word[i].varName.StartsWith("IOT_S_MD_"))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user