diff --git a/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs b/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs
index e91ee59..395f6be 100644
--- a/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs
+++ b/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs
@@ -2604,6 +2604,95 @@ namespace MTC_Adapter
}
}
///
+ /// Verifica strobe autotest
+ ///
+ ///
+ ///
+ ///
+ public void processTestStrobe(StFlag8 currStrobe, StFlag8 currAck, int memIndexAck, int memOrderStart)
+ {
+ // byte di strobe e di acknowledge... inizializzo!!!
+ byte[] currACK_DW = new byte[1];
+ string TestingData = "";
+ // INIZIO TEST...
+ int bitNum = 6;
+ if (currStrobe.HasFlag((StFlag8)Math.Pow(2, bitNum)))
+ {
+ // formatto stringa risultato
+ TestingData = string.Format("START TEST{0}", getTestData(utils.CRS("testCharSep")));
+
+ // memorizzo allarme nel vettore ack....
+ currACK_DW = utils.setBitOnStFlag(currACK_DW, true, bitNum);
+ }
+ // FINE TEST...
+ bitNum = 7;
+ if (currStrobe.HasFlag((StFlag8)Math.Pow(2, bitNum)))
+ {
+ // formatto stringa risultato
+ TestingData = string.Format("STOP TEST{0}", getTestData(utils.CRS("testCharSep")));
+
+ // memorizzo allarme nel vettore ack....
+ currACK_DW = utils.setBitOnStFlag(currACK_DW, true, bitNum);
+ }
+
+ // INVIO stato test...
+ if (mTestingData.Value.ToString() != TestingData.Trim())
+ {
+ mTestingData.Value = TestingData.Trim();
+ }
+
+ // scrivo update ad ack SE VARIATO!!!
+ if (currAck != (StFlag8)currACK_DW[0])
+ {
+ writeMST_ACK(memIndexAck, ref currACK_DW);
+ }
+ }
+ ///
+ /// Recupero info su test: numero + elenco parametri IN/OUT
+ ///
+ ///
+ ///
+ public string getTestData(string charSep)
+ {
+ string answ = "";
+ // Area di memoria x test... (64 DWord) (la prima va splittata)
+ UInt32[] MemBlockTestData = new UInt32[64];
+ // variabili numero test e num parametri impiegati
+ int testNum = 0;
+ int numPar = 0;
+ // variabile dove parcheggiare conversione codici dei parametri del test (IN o OUT)
+ UInt32 testParam = 0;
+ readTestData(ref MemBlockTestData);
+
+ // 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!
+ if (numPar > 0)
+ {
+ for (int i = 0; i < numPar; i++)
+ {
+ testParam = MemBlockTestData[1 + i];
+ answ += string.Format("{0}{1}", charSep, testParam);
+ }
+ }
+ return answ;
+ }
+ ///
+ /// Effettua lettura dati TESTING
+ ///
+ ///
+ ///
+ public virtual bool readTestData(ref uint[] MemBlockTestData)
+ {
+ bool fatto = false;
+ return fatto;
+ }
+ ///
/// Legge area memoria dati MST
///
///
diff --git a/MTC_Adapter/MTC_Adapter/AdapterOsai.cs b/MTC_Adapter/MTC_Adapter/AdapterOsai.cs
index c091be6..753f010 100644
--- a/MTC_Adapter/MTC_Adapter/AdapterOsai.cs
+++ b/MTC_Adapter/MTC_Adapter/AdapterOsai.cs
@@ -341,157 +341,6 @@ namespace MTC_Adapter
// gestione bit di watchdog... sulal DWord successiva
sendWatchDog();
}
-#if false
- ///
- /// Processa strobe x un dato path
- ///
- /// path corrente
- /// Byte di strobe del path corrente
- /// Byte di strobe del path corrente
- /// indice x lettura memoria MST del path
- /// indice x scrittura ACK x path
- /// stringa COMPLESSIVA azioni utente
- private void procPathStrobes(int idxPath, StFlag8 currStrobe, StFlag8 currAck, int memIndexMST, int memIndexAck, ref string UserAction)
- {
- // byte di strobe e di acknowledge... inizializzo!!!
- byte[] currACK_DW = new byte[1];
- // altre variabili
- int bitNum = 0;
- inizio = DateTime.Now;
- // incomincio vera e propria gestione...
- try
- {
- // controllo TUTTI i flag: se ce ne sono di alzati DEVO processare...
- if (currStrobe != StFlag8.NONE)
- {
- // se ho un M/S/T leggo area...
- if (currStrobe.HasFlag(StFlag8.B0) || currStrobe.HasFlag(StFlag8.B1) || currStrobe.HasFlag(StFlag8.B2))
- {
-
- // blocco memoria x lettura TUTTI i dati di buffer M/S/T: 26 short(16bit) x (12+7+7) aree (attenzione: secondo set di 2 bit è VUOTO...)
- ushort[] MemBlock_W = new ushort[26];
-
- // leggo tutto!!!
- inizio = DateTime.Now;
- OsaiMemRW_Word(R, OSAI.MemTypeWord.MW_CODE, memIndexMST, ref MemBlock_W);
- if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-STRB_DW1-P{1:00}", MemBlock_W.Length, idxPath), DateTime.Now.Subtract(inizio).Ticks);
-
- // converto a byte x compatibilità...
- byte[] MemBlock = new byte[MemBlock_W.Length * 2];
- Buffer.BlockCopy(MemBlock_W, 0, MemBlock, 0, MemBlock.Length);
-
- // check COD_M
- bitNum = 0;
- gestStrobeCodMST(currStrobe, bitNum, ref currACK_DW, 0, MemBlock, "M", idxPath);
-
- // check COD_S
- bitNum = 1;
- gestStrobeCodMST(currStrobe, bitNum, ref currACK_DW, 12, MemBlock, "S", idxPath);
-
- // check COD_T
- bitNum = 2;
- gestStrobeCodMST(currStrobe, bitNum, ref currACK_DW, 19, MemBlock, "T", idxPath);
-
- }
-
- // check FILE DATI MODIFICATO: ricaricare...
- bitNum = 3;
- if (STRB_DW1.HasFlag((StFlag32)Math.Pow(2, bitNum)))
- {
- lg.Info("Notifica file modificato");
- try
- {
- // reload dati da file...
- reloadDataFromFile();
-
- // memorizzo allarme nel vettore ack....
- currACK_DW = utils.setBitOnStFlag(currACK_DW, true, bitNum);
- }
- catch
- {
- lg.Info("Errore lettura dati da file");
- }
- }
-
- // AREA strobe USER ACTION
- // chiamato Start...
- bitNum = 4;
- gestStrobeUserAction(bitNum, ref currACK_DW, ref UserAction, string.Format(" (P{0:00} START) ", idxPath));
- // chiamato Stop...
- bitNum = 5;
- gestStrobeUserAction(bitNum, ref currACK_DW, ref UserAction, string.Format(" (P{0:00} STOP) ", idxPath));
- // chiamato Reset...
- bitNum = 6;
- gestStrobeUserAction(bitNum, ref currACK_DW, ref UserAction, string.Format(" (P{0:00} RESET) ", idxPath));
-
- }
- else
- {
- // inizializzo 4 byte a zero!!!
- currACK_DW = new byte[1];
- }
- }
- catch (Exception exc)
- {
- lg.Error(string.Format("Errore in strobe:{0}{1}", Environment.NewLine, exc));
- }
-
- // scrivo update ad ack SE VARIATO!!!
- if (currAck != (StFlag8)currACK_DW[0])
- {
- inizio = DateTime.Now;
- OsaiMemRW_Byte(W, OSAI.MemTypeWord.MW_CODE, memIndexAck, 0, ref currACK_DW);
- if (utils.CRB("recTime")) TimingData.addResult(string.Format("W{0}-ACK_DW0", currACK_DW.Length), DateTime.Now.Subtract(inizio).Ticks);
- }
- }
-#endif
- ///
- /// Verifica strobe autotest
- ///
- ///
- ///
- ///
- private void processTestStrobe(StFlag8 currStrobe, StFlag8 currAck, int memIndexAck, int memOrderStart)
- {
- // byte di strobe e di acknowledge... inizializzo!!!
- byte[] currACK_DW = new byte[1];
- string TestingData = "";
- // INIZIO TEST...
- int bitNum = 6;
- if (currStrobe.HasFlag((StFlag8)Math.Pow(2, bitNum)))
- {
- // formatto stringa risultato
- TestingData = string.Format("START TEST{0}", getTestData(utils.CRS("testCharSep")));
-
- // memorizzo allarme nel vettore ack....
- currACK_DW = utils.setBitOnStFlag(currACK_DW, true, bitNum);
- }
- // FINE TEST...
- bitNum = 7;
- if (currStrobe.HasFlag((StFlag8)Math.Pow(2, bitNum)))
- {
- // formatto stringa risultato
- TestingData = string.Format("STOP TEST{0}", getTestData(utils.CRS("testCharSep")));
-
- // memorizzo allarme nel vettore ack....
- currACK_DW = utils.setBitOnStFlag(currACK_DW, true, bitNum);
- }
-
- // INVIO stato test...
- if (mTestingData.Value.ToString() != TestingData.Trim())
- {
- mTestingData.Value = TestingData.Trim();
- }
-
- // scrivo update ad ack SE VARIATO!!!
- if (currAck != (StFlag8)currACK_DW[0])
- {
- inizio = DateTime.Now;
- OsaiMemRW_Byte(W, OSAI.MemTypeWord.MW_CODE, memIndexAck, memOrderStart, ref currACK_DW);
- if (utils.CRB("recTime")) TimingData.addResult(string.Format("W{0}-ACK_DW0", currACK_DW.Length), DateTime.Now.Subtract(inizio).Ticks);
- }
- }
-
///
/// Scrive watchdog
///
@@ -501,48 +350,29 @@ namespace MTC_Adapter
{
int memIndex = 19022;
return OsaiMemRW_Byte(W, OSAI.MemTypeWord.MW_CODE, memIndex, 0, ref retACK_DW);
- }
-
+ }
///
- /// Recupero info su test: numero + elenco parametri IN/OUT
+ /// Effettua lettura dati TESTING
///
- ///
+ ///
///
- private string getTestData(string charSep)
+ public override bool readTestData(ref uint[] MemBlockTestData)
{
- string answ = "";
- // Area di memoria x test... (64 DWord) (la prima va splittata)
- UInt32[] MemBlockTestData = new UInt32[64];
- // variabili numero test e num parametri impiegati
- int testNum = 0;
- int numPar = 0;
- // variabile dove parcheggiare conversione codici dei parametri del test (IN o OUT)
- UInt32 testParam = 0;
-
- // leggo tutto!!!
- int memIndex = 19700;
- inizio = DateTime.Now;
- OsaiMemRW_DWord(R, OSAI.MemTypeWord.MW_CODE, memIndex, ref MemBlockTestData);
- if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TEST_DATA", MemBlockTestData.Length), DateTime.Now.Subtract(inizio).Ticks);
-
- // 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!
- if (numPar > 0)
+ bool fatto = false;
+ try
{
- for (int i = 0; i < numPar; i++)
- {
- testParam = MemBlockTestData[1 + i];
- answ += string.Format("{0}{1}", charSep, testParam);
- }
+ // leggo tutto!!!
+ int memIndex = 19700;
+ inizio = DateTime.Now;
+ OsaiMemRW_DWord(R, OSAI.MemTypeWord.MW_CODE, memIndex, ref MemBlockTestData);
+ if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TEST_DATA", MemBlockTestData.Length), DateTime.Now.Subtract(inizio).Ticks);
+ fatto = true;
}
-
- return answ;
+ catch (Exception exc)
+ {
+ lg.Error(string.Format("Errore in lettura dati MST:{0}{1}", Environment.NewLine, exc));
+ }
+ return fatto;
}
///
diff --git a/MTC_Adapter/MTC_Adapter/AdapterSiemens.cs b/MTC_Adapter/MTC_Adapter/AdapterSiemens.cs
index 4836aa7..603ecbc 100644
--- a/MTC_Adapter/MTC_Adapter/AdapterSiemens.cs
+++ b/MTC_Adapter/MTC_Adapter/AdapterSiemens.cs
@@ -343,52 +343,6 @@ namespace MTC_Adapter
return fatto;
}
- ///
- /// Verifica strobe autotest
- ///
- ///
- ///
- ///
- private void processTestStrobe(StFlag8 currStrobe, StFlag8 currAck, int memIndexAck, int memOrderStart)
- {
- // byte di strobe e di acknowledge... inizializzo!!!
- byte[] currACK_DW = new byte[1];
- string TestingData = "";
- // INIZIO TEST...
- int bitNum = 6;
- if (currStrobe.HasFlag((StFlag8)Math.Pow(2, bitNum)))
- {
- // formatto stringa risultato
- TestingData = string.Format("START TEST{0}", getTestData(utils.CRS("testCharSep")));
-
- // memorizzo allarme nel vettore ack....
- currACK_DW = utils.setBitOnStFlag(currACK_DW, true, bitNum);
- }
- // FINE TEST...
- bitNum = 7;
- if (currStrobe.HasFlag((StFlag8)Math.Pow(2, bitNum)))
- {
- // formatto stringa risultato
- TestingData = string.Format("STOP TEST{0}", getTestData(utils.CRS("testCharSep")));
-
- // memorizzo allarme nel vettore ack....
- currACK_DW = utils.setBitOnStFlag(currACK_DW, true, bitNum);
- }
-
- // INVIO stato test...
- if (mTestingData.Value.ToString() != TestingData.Trim())
- {
- mTestingData.Value = TestingData.Trim();
- }
-
- // scrivo update ad ack SE VARIATO!!!
- if (currAck != (StFlag8)currACK_DW[0])
- {
- inizio = DateTime.Now;
- SIEMENSMemRW_Byte(W, baseMemDb, memIndexAck, ref currACK_DW);
- if (utils.CRB("recTime")) TimingData.addResult(string.Format("W{0}-ACK_DW0", currACK_DW.Length), DateTime.Now.Subtract(inizio).Ticks);
- }
- }
///
/// Scrive watchdog
///
@@ -400,47 +354,29 @@ namespace MTC_Adapter
return SIEMENSMemRW_Byte(W, baseMemDb, memIndex, ref retACK_DW);
}
///
- /// Recupero info su test: numero + elenco parametri IN/OUT
+ /// Effettua lettura dati TESTING
///
- ///
+ ///
///
- private string getTestData(string charSep)
+ public override bool readTestData(ref uint[] MemBlockTestData)
{
- string answ = "";
- // Area di memoria x test... (64 DWord) (la prima va splittata)
- UInt32[] MemBlockTestData = new UInt32[64];
- // variabili numero test e num parametri impiegati
- int testNum = 0;
- int numPar = 0;
- // variabile dove parcheggiare conversione codici dei parametri del test (IN o OUT)
- UInt32 testParam = 0;
-
- // leggo tutto!!!
- int memIndex = 522;
- inizio = DateTime.Now;
- SIEMENSMemRW_DWord(R, baseMemDb, memIndex, ref MemBlockTestData);
- if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TEST_DATA", MemBlockTestData.Length), DateTime.Now.Subtract(inizio).Ticks);
-
- // 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!
- if (numPar > 0)
+ bool fatto = false;
+ try
{
- for (int i = 0; i < numPar; i++)
- {
- testParam = MemBlockTestData[1 + i];
- answ += string.Format("{0}{1}", charSep, testParam);
- }
+ // leggo tutto!!!
+ int memIndex = 522;
+ inizio = DateTime.Now;
+ SIEMENSMemRW_DWord(R, baseMemDb, memIndex, ref MemBlockTestData);
+ if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TEST_DATA", MemBlockTestData.Length), DateTime.Now.Subtract(inizio).Ticks);
+ fatto = true;
}
-
- return answ;
+ catch (Exception exc)
+ {
+ lg.Error(string.Format("Errore in lettura dati MST:{0}{1}", Environment.NewLine, exc));
+ }
+ return fatto;
}
-
-
+
///
/// Scrive vettore ACK degli allarmi
///