inserita gestione multipath x OSAI...
This commit is contained in:
@@ -439,6 +439,7 @@ namespace MTC_Adapter
|
||||
{
|
||||
int numEv = 0;
|
||||
int codEv = 0;
|
||||
int idxPath = 0; // Hard coded path 0 soltanto...
|
||||
if (STRB_DW1.HasFlag((StFlag32)Math.Pow(2, bitNum)))
|
||||
{
|
||||
// verifico sia > 0 il numero di valori da leggere indice 0 sull'area...
|
||||
@@ -451,7 +452,7 @@ namespace MTC_Adapter
|
||||
// leggo valore Codice
|
||||
codEv = BitConverter.ToUInt16(MemBlock, 2 * (i + 1 + memShift));
|
||||
// accodo evento Codice
|
||||
appendCodeMST(Coda, codEv.ToString());
|
||||
appendCodeMST(Coda, codEv.ToString(), idxPath);
|
||||
}
|
||||
}
|
||||
// memorizzo allarme nel vettore ack....
|
||||
|
||||
@@ -939,9 +939,9 @@ namespace MTC_Adapter
|
||||
/// </summary>
|
||||
public StFlag8 ST_MACCH = 0;
|
||||
|
||||
public List<string> codaM = new List<string>();
|
||||
public List<string> codaS = new List<string>();
|
||||
public List<string> codaT = new List<string>();
|
||||
public List<string>[] codaM;
|
||||
public List<string>[] codaS;
|
||||
public List<string>[] codaT;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1070,6 +1070,7 @@ namespace MTC_Adapter
|
||||
lg = LogManager.GetCurrentClassLogger();
|
||||
lg.Info("Avvio AdapterGeneric");
|
||||
|
||||
|
||||
procIotMem = utils.CRB("procIotMem");
|
||||
|
||||
currAdpConf = adpConf;
|
||||
@@ -1277,6 +1278,17 @@ namespace MTC_Adapter
|
||||
// azioni utente
|
||||
mAdapter.AddDataItem(mUserAction);
|
||||
|
||||
// inizializzo vettori code MST x num path...
|
||||
codaM = new List<string>[adpConf.nPath];
|
||||
codaS = new List<string>[adpConf.nPath];
|
||||
codaT = new List<string>[adpConf.nPath];
|
||||
for (int i = 0; i < adpConf.nPath; i++)
|
||||
{
|
||||
codaM[i] = new List<string>();
|
||||
codaS[i] = new List<string>();
|
||||
codaT[i] = new List<string>();
|
||||
}
|
||||
|
||||
// concluso!
|
||||
lg.Info("Istanziata classe AdapterGeneric");
|
||||
}
|
||||
@@ -1903,14 +1915,13 @@ namespace MTC_Adapter
|
||||
/// </summary>
|
||||
public virtual void trySendCodMST()
|
||||
{
|
||||
// !!!FARE!!! ciclo su + path
|
||||
int idxPath = 1;
|
||||
for (int i = 0; i < idxPath; i++)
|
||||
// ciclo su + path
|
||||
for (int i = 0; i < currAdpConf.nPath; i++)
|
||||
{
|
||||
// verifico SE ho codici M/S/T da inviare...
|
||||
string codiceM = getNextMCode;
|
||||
string codiceS = getNextSCode;
|
||||
string codiceT = getNextTCode;
|
||||
string codiceM = getNextMCode(i);
|
||||
string codiceS = getNextSCode(i);
|
||||
string codiceT = getNextTCode(i);
|
||||
if (codiceM != "")
|
||||
{
|
||||
vettPath[i].mPathCodM.Value = string.Format("[M{0}]", codiceM);
|
||||
@@ -2326,6 +2337,15 @@ namespace MTC_Adapter
|
||||
/// </summary>
|
||||
public void checkSavePersDataLayer()
|
||||
{
|
||||
// aggiungo dettaglio valori ultimi codici MST
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < currAdpConf.nPath; i++)
|
||||
{
|
||||
// accodo ultimi codici in visualizzazione...
|
||||
sb.AppendLine(string.Format("P{0} last MST: {1} | {2} | {3}", i + 1, vettPath[i].mPathCodM.Value, vettPath[i].mPathCodS.Value, vettPath[i].mPathCodT.Value));
|
||||
}
|
||||
parentForm.dataMonitor_1 += sb.ToString();
|
||||
|
||||
if (persistenceLayer != null)
|
||||
{
|
||||
bool needSave = false;
|
||||
@@ -2723,77 +2743,75 @@ namespace MTC_Adapter
|
||||
/// Aggiunge nel vettore coda codici M
|
||||
/// </summary>
|
||||
/// <param name="Coda"></param>
|
||||
/// <param name="Codice da accodare"></param>
|
||||
public void appendCodeMST(string Coda, string Codice)
|
||||
/// <param name="Codice">Codice da accodare</param>
|
||||
/// <param name="idxPath">Path (0,1,...)</param>
|
||||
public void appendCodeMST(string Coda, string Codice, int idxPath)
|
||||
{
|
||||
switch (Coda)
|
||||
{
|
||||
case "S":
|
||||
codaS.Add(Codice);
|
||||
codaS[idxPath].Add(Codice);
|
||||
break;
|
||||
case "T":
|
||||
codaT.Add(Codice);
|
||||
codaT[idxPath].Add(Codice);
|
||||
break;
|
||||
case "M":
|
||||
default:
|
||||
codaM.Add(Codice);
|
||||
codaM[idxPath].Add(Codice);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// recupera primo elemento codaM
|
||||
/// recupera primo elemento coda M
|
||||
/// </summary>
|
||||
protected string getNextMCode
|
||||
/// <param name="idxPath">Path (0,1,...)</param>
|
||||
/// <returns></returns>
|
||||
protected string getNextMCode(int idxPath)
|
||||
{
|
||||
get
|
||||
string answ = "";
|
||||
if (codaM[idxPath].Count > 0)
|
||||
{
|
||||
string answ = "";
|
||||
if (codaM.Count > 0)
|
||||
{
|
||||
// recupero codice M...
|
||||
answ = codaM.First();
|
||||
// tolgo elemento
|
||||
codaM.RemoveAt(0);
|
||||
}
|
||||
return answ;
|
||||
// recupero codice M...
|
||||
answ = codaM[idxPath].First();
|
||||
// tolgo elemento
|
||||
codaM[idxPath].RemoveAt(0);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// recupera primo elemento codaS
|
||||
/// recupera primo elemento coda S
|
||||
/// </summary>
|
||||
protected string getNextSCode
|
||||
/// <param name="idxPath">Path (0,1,...)</param>
|
||||
/// <returns></returns>
|
||||
protected string getNextSCode(int idxPath)
|
||||
{
|
||||
get
|
||||
string answ = "";
|
||||
if (codaS[idxPath].Count > 0)
|
||||
{
|
||||
string answ = "";
|
||||
if (codaS.Count > 0)
|
||||
{
|
||||
// recupero codice S...
|
||||
answ = codaS.First();
|
||||
// tolgo elemento
|
||||
codaS.RemoveAt(0);
|
||||
}
|
||||
return answ;
|
||||
// recupero codice S...
|
||||
answ = codaS[idxPath].First();
|
||||
// tolgo elemento
|
||||
codaS[idxPath].RemoveAt(0);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// recupera primo elemento codaT
|
||||
/// recupera primo elemento coda T
|
||||
/// </summary>
|
||||
protected string getNextTCode
|
||||
/// <param name="idxPath">Path (0,1,...)</param>
|
||||
/// <returns></returns>
|
||||
protected string getNextTCode(int idxPath)
|
||||
{
|
||||
get
|
||||
string answ = "";
|
||||
if (codaT[idxPath].Count > 0)
|
||||
{
|
||||
string answ = "";
|
||||
if (codaT.Count > 0)
|
||||
{
|
||||
// recupero codice T...
|
||||
answ = codaT.First();
|
||||
// tolgo elemento
|
||||
codaT.RemoveAt(0);
|
||||
}
|
||||
return answ;
|
||||
// recupero codice T...
|
||||
answ = codaT[idxPath].First();
|
||||
// tolgo elemento
|
||||
codaT[idxPath].RemoveAt(0);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -394,15 +394,15 @@ namespace MTC_Adapter
|
||||
|
||||
// check COD_M
|
||||
bitNum = 0;
|
||||
gestStrobeCodMST(currStrobe, bitNum, ref currACK_DW, 0, MemBlock, "M");
|
||||
gestStrobeCodMST(currStrobe, bitNum, ref currACK_DW, 0, MemBlock, "M", idxPath);
|
||||
|
||||
// check COD_S
|
||||
bitNum = 1;
|
||||
gestStrobeCodMST(currStrobe, bitNum, ref currACK_DW, 12, MemBlock, "S");
|
||||
gestStrobeCodMST(currStrobe, bitNum, ref currACK_DW, 12, MemBlock, "S", idxPath);
|
||||
|
||||
// check COD_T
|
||||
bitNum = 2;
|
||||
gestStrobeCodMST(currStrobe, bitNum, ref currACK_DW, 19, MemBlock, "T");
|
||||
gestStrobeCodMST(currStrobe, bitNum, ref currACK_DW, 19, MemBlock, "T", idxPath);
|
||||
|
||||
}
|
||||
|
||||
@@ -579,7 +579,8 @@ namespace MTC_Adapter
|
||||
/// <param name="memShift">shift memoria x buffer dati da leggere</param>
|
||||
/// <param name="MemBlock">Vettore completo dei valori + buffer code M/S/T</param>
|
||||
/// <param name="Coda">Quale coda: M/S/T</param>
|
||||
private void gestStrobeCodMST(StFlag8 currStrobe, int bitNum, ref byte[] retACK_DW1, int memShift, byte[] MemBlock, string Coda)
|
||||
/// <param name="idxPath">Path (0,1,...)</param>
|
||||
private void gestStrobeCodMST(StFlag8 currStrobe, int bitNum, ref byte[] retACK_DW1, int memShift, byte[] MemBlock, string Coda, int idxPath)
|
||||
{
|
||||
int numEv = 0;
|
||||
int codEv = 0;
|
||||
@@ -595,7 +596,7 @@ namespace MTC_Adapter
|
||||
// leggo valore Codice
|
||||
codEv = BitConverter.ToUInt16(MemBlock, 2 * (i + 2 + memShift));
|
||||
// accodo evento Codice
|
||||
appendCodeMST(Coda, codEv.ToString());
|
||||
appendCodeMST(Coda, codEv.ToString(), idxPath);
|
||||
}
|
||||
}
|
||||
// memorizzo allarme nel vettore ack....
|
||||
|
||||
@@ -395,6 +395,7 @@ namespace MTC_Adapter
|
||||
{
|
||||
int numEv = 0;
|
||||
int codEv = 0;
|
||||
int idxPath = 0; // Hard coded path 0 soltanto...
|
||||
if (STRB_DW1.HasFlag((StFlag32)Math.Pow(2, bitNum)))
|
||||
{
|
||||
// verifico sia > 0 il numero di valori da leggere indice 0 sull'area...
|
||||
@@ -407,7 +408,7 @@ namespace MTC_Adapter
|
||||
// leggo valore Codice
|
||||
codEv = BitConverter.ToUInt16(MemBlock, 2 * (i + 1 + memShift));
|
||||
// accodo evento Codice
|
||||
appendCodeMST(Coda, codEv.ToString());
|
||||
appendCodeMST(Coda, codEv.ToString(), idxPath);
|
||||
}
|
||||
}
|
||||
// memorizzo allarme nel vettore ack....
|
||||
|
||||
@@ -755,18 +755,18 @@ namespace MTC_Adapter
|
||||
// cambio posizioni 6% casi: aggiungo codici M
|
||||
if (rnd.Next(0, 100) > 95)
|
||||
{
|
||||
agObj.appendCodeMST("M", rnd.Next(1, 30).ToString());
|
||||
agObj.appendCodeMST("M", rnd.Next(1, 30).ToString(), 0);
|
||||
}
|
||||
|
||||
// cambio posizioni 3% casi: aggiungo codici S
|
||||
if (rnd.Next(0, 100) > 97)
|
||||
{
|
||||
agObj.appendCodeMST("S", rnd.Next(100, 10000).ToString());
|
||||
agObj.appendCodeMST("S", rnd.Next(100, 10000).ToString(), 0);
|
||||
}
|
||||
// cambio posizioni 3% casi: aggiungo codici T
|
||||
if (rnd.Next(0, 100) > 97)
|
||||
{
|
||||
agObj.appendCodeMST("T", rnd.Next(1, 100).ToString());
|
||||
agObj.appendCodeMST("T", rnd.Next(1, 100).ToString(), 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -977,16 +977,16 @@ namespace MTC_Adapter
|
||||
/// </summary>
|
||||
private void refreshCodeMST()
|
||||
{
|
||||
lblCodaM.Text = string.Join(",", agObj.codaM.ToArray());
|
||||
lblCodaT.Text = string.Join(",", agObj.codaT.ToArray());
|
||||
lblCodaS.Text = string.Join(",", agObj.codaS.ToArray());
|
||||
lblCodaM.Text = string.Join(",", agObj.codaM[0].ToArray());
|
||||
lblCodaT.Text = string.Join(",", agObj.codaT[0].ToArray());
|
||||
lblCodaS.Text = string.Join(",", agObj.codaS[0].ToArray());
|
||||
}
|
||||
|
||||
private void accodaCodM()
|
||||
{
|
||||
if (addCodM.Text.Trim() != "")
|
||||
{
|
||||
agObj.appendCodeMST("M", addCodM.Text.Trim());
|
||||
agObj.appendCodeMST("M", addCodM.Text.Trim(), 0);
|
||||
addCodM.Text = "";
|
||||
}
|
||||
refreshCodeMST();
|
||||
@@ -995,7 +995,7 @@ namespace MTC_Adapter
|
||||
{
|
||||
if (addCodS.Text.Trim() != "")
|
||||
{
|
||||
agObj.appendCodeMST("S", addCodS.Text.Trim());
|
||||
agObj.appendCodeMST("S", addCodS.Text.Trim(), 0);
|
||||
addCodS.Text = "";
|
||||
}
|
||||
refreshCodeMST();
|
||||
@@ -1004,7 +1004,7 @@ namespace MTC_Adapter
|
||||
{
|
||||
if (addCodT.Text.Trim() != "")
|
||||
{
|
||||
agObj.appendCodeMST("T", addCodT.Text.Trim());
|
||||
agObj.appendCodeMST("T", addCodT.Text.Trim(), 0);
|
||||
addCodT.Text = "";
|
||||
}
|
||||
refreshCodeMST();
|
||||
|
||||
Reference in New Issue
Block a user