Merge commit '0eecabad0d64687da1b5ffcfe9eeb14826b8a9f7' into HEAD

This commit is contained in:
2017-03-24 10:57:58 +01:00
3 changed files with 41 additions and 17 deletions
+2 -2
View File
@@ -241,7 +241,7 @@ namespace MTC_Adapter
// check COD_S
bitNum = 1;
gestStrobeCodMST(bitNum, ref retACK_DW1, 11, MemBlock, "S");
// check COD_T
bitNum = 2;
gestStrobeCodMST(bitNum, ref retACK_DW1, 17, MemBlock, "T");
@@ -439,11 +439,11 @@ namespace MTC_Adapter
// 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;
totRighe = File.ReadLines(fileName).Count();
// creo un vettore della dimensione corretta... conta anche commenti tanto poi riduco...
generalStatus = new Dictionary<string, string>();
try
{
totRighe = File.ReadLines(fileName).Count();
// carica da file...
System.IO.StreamReader file = new System.IO.StreamReader(fileName);
if (file != null)
+24 -3
View File
@@ -2401,7 +2401,14 @@ namespace MTC_Adapter
/// <returns></returns>
private uint getStoredValUInt(string keyVal)
{
return Convert.ToUInt32(getStoredVal(keyVal));
uint answ = 0;
try
{
answ = Convert.ToUInt32(getStoredVal(keyVal));
}
catch
{ }
return answ;
}
/// <summary>
/// recupera valore salvato in persistence layer (se non c'è crea...) come INT
@@ -2410,7 +2417,14 @@ namespace MTC_Adapter
/// <returns></returns>
private long getStoredValLong(string keyVal)
{
return Convert.ToInt64(getStoredVal(keyVal));
long answ = 0;
try
{
answ = Convert.ToInt64(getStoredVal(keyVal));
}
catch
{ }
return answ;
}
/// <summary>
/// recupera valore salvato in persistence layer (se non c'è crea...) come double
@@ -2419,7 +2433,14 @@ namespace MTC_Adapter
/// <returns></returns>
private double getStoredValDouble(string keyVal)
{
return Convert.ToDouble(getStoredVal(keyVal));
double answ = 0;
try
{
answ = Convert.ToDouble(getStoredVal(keyVal));
}
catch
{ }
return answ;
}
/// <summary>
+15 -12
View File
@@ -194,12 +194,14 @@ namespace MTC_Adapter
tryConnect();
lg.Info("End init Adapter OSAI");
// !!!FARE!!! per ora aggiunto banco ack/strobe del 2 processo IN CODA... 5DW!!!
// !!!CHECK!!! aggiunto banco ack/strobe del 2 processo IN CODA... 5DW!!!
Strobes = new byte[20];
Acknowl = new byte[20];
}
/// <summary>
/// Override disconnessione
/// </summary>
public override void tryDisconnect()
{
if (connectionOk)
@@ -222,7 +224,9 @@ namespace MTC_Adapter
lg.Error("IMPOSSIBILE effettuare disconnessione: Connessione non disponibile...");
}
}
/// <summary>
/// OVerride connessione
/// </summary>
public override void tryConnect()
{
if (!connectionOk)
@@ -254,7 +258,6 @@ namespace MTC_Adapter
}
}
}
/// <summary>
/// Verifico connessione OSAI...
/// </summary>
@@ -266,7 +269,6 @@ namespace MTC_Adapter
return OSAI_ref.Connected;
}
}
/// <summary>
/// Effettuo lettura dei 16 byte di strobe/status
/// </summary>
@@ -275,14 +277,14 @@ namespace MTC_Adapter
base.getStrobeAndAckStatus();
if (connectionOk)
{
int numByte = Acknowl.Length+Strobes.Length;
int numByte = Acknowl.Length + Strobes.Length;
// leggo TUTTO ack e strobe,
uint[] MemBlock_DW = new uint[numByte/4];
ushort[] MemBlock_W = new ushort[numByte/2];
uint[] MemBlock_DW = new uint[numByte / 4];
ushort[] MemBlock_W = new ushort[numByte / 2];
byte[] MemBlock = new byte[numByte];
int memIndex = 19018;
// !!!FARE!!! verifica tipo memoria
// !!!CHECK!!! test tempo lettura x tipo memoria
inizio = DateTime.Now;
OsaiMemRW_DWord(R, OSAI.MemTypeWord.MW_CODE, memIndex, ref MemBlock_DW);
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R-{0}-DW", MemBlock_DW.Length * 32), DateTime.Now.Subtract(inizio).Ticks);
@@ -294,7 +296,7 @@ namespace MTC_Adapter
inizio = DateTime.Now;
OsaiMemRW_Byte(R, OSAI.MemTypeWord.MW_CODE, memIndex, 0, ref MemBlock);
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R-{0}-BYTE", MemBlock.Length * 8), DateTime.Now.Subtract(inizio).Ticks);
// suddivido!
Buffer.BlockCopy(MemBlock, 0, Acknowl, 0, Acknowl.Length);
Buffer.BlockCopy(MemBlock, Acknowl.Length, Strobes, 0, Strobes.Length);
@@ -550,11 +552,11 @@ namespace MTC_Adapter
// 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;
totRighe = File.ReadLines(fileName).Count();
// creo un vettore della dimensione corretta... conta anche commenti tanto poi riduco...
generalStatus = new Dictionary<string, string>();
try
{
totRighe = File.ReadLines(fileName).Count();
// carica da file...
System.IO.StreamReader file = new System.IO.StreamReader(fileName);
if (file != null)
@@ -798,6 +800,7 @@ namespace MTC_Adapter
// HARD CODE: forzo path 1 (indice 0...)
int idxPath = 0;
// switch su run mode...
if (STRB_DW2.HasFlag(StFlag32.B01))
{
@@ -912,7 +915,7 @@ namespace MTC_Adapter
{
// INVIO SEMPRE (x prendere il reset/fronte discesa)...
vettPath[idxPath].mPathSubMode.Value = SubMode.Trim();
}
}
}
public override void getConfigParam()