pulizia metodi inutilizzati

This commit is contained in:
Samuele Locatelli
2021-10-28 18:55:58 +02:00
parent 671e4346cc
commit f14eca7b5c
+2 -112
View File
@@ -849,6 +849,7 @@ namespace IOB_WIN_NEXT
}
}
#if false
/// <summary>
/// wrapper chiamata LETTURA in blocco MULTI BYTE dell'area read DI DEFAULT...
/// </summary>
@@ -873,45 +874,6 @@ namespace IOB_WIN_NEXT
{
sw.Restart();
parentForm.commPlcActive = true;
#if false
if (testCncConn())
{
// decodifico memoria...
memAreaSiemens memoria = new memAreaSiemens(memAddrRead);
Byte[] memByteRead = currPLC.ReadBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, numByte);
// copio in value, sennò do errore...
if (memByteRead.Length == Value.Length)
{
Value = memByteRead;
}
else
{
lgError($"Mismatch dimensione array memoria: indirizzo: {memAddrRead} | passato array di {Value.Length} byte, letti da S7 {memByteRead.Length} byte");
}
string titolo = $"READ BLOCK MEM BYTE: {parametri.memAddrRead} --> {numByte} byte";
if (verboseLog)
{
lgInfo(titolo);
}
string contenuto = $"Contenuto area memoria acquisita{Environment.NewLine}";
string byteVal = "";
for (int i = 0; i < memByteRead.Length; i++)
{
byteVal = Convert.ToString(memByteRead[i], 2).PadLeft(8, '0');
contenuto += string.Format("B{0:000}: {1} | {2}{3}", i, byteVal, memByteRead[i], Environment.NewLine);
}
// loggo lettura...
if (verboseLog)
{
lgInfo(contenuto);
}
}
else
{
connectionOk = false;
}
#endif
parentForm.commPlcActive = false;
sw.Stop();
if (utils.CRB("recTime"))
@@ -967,44 +929,6 @@ namespace IOB_WIN_NEXT
else
{
sw.Restart();
#if false
if (testCncConn())
{
try
{
// decodifico memoria...
memAreaSiemens memoria = new memAreaSiemens(memAddrWrite);
int numByte = Value.Length;
ErrorCode errorCode = currPLC.WriteBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, Value);
switch (errorCode)
{
case ErrorCode.NoError:
answ = true;
maybeLogWrite(memAddrWrite, $"S7WriteBB-01 Effettuata correttamente scrittura su PLC: MEMORIA {memAddrWrite} | numByte: {Value.Length} | ValOriginale: {Value}");
break;
case ErrorCode.WrongCPU_Type:
case ErrorCode.ConnectionError:
case ErrorCode.IPAddressNotAvailable:
case ErrorCode.WrongVarFormat:
case ErrorCode.WrongNumberReceivedBytes:
case ErrorCode.SendData:
case ErrorCode.ReadData:
case ErrorCode.WriteData:
lgError($"Errore in S7WriteBB su {memAddrWrite}: {errorCode.ToString()} | numByte: {Value.Length}| {Value.ValToBinString()}");
answ = false;
break;
default:
break;
}
}
catch (Exception exc)
{
lgError($"Eccezione in S7WriteBB | memAddrWrite {memAddrWrite} | numByte: {Value.Length}{Environment.NewLine}{exc}");
}
}
#endif
sw.Stop();
}
}
@@ -1034,46 +958,12 @@ namespace IOB_WIN_NEXT
else
{
sw.Restart();
#if false
if (testCncConn())
{
try
{
int numByte = Value.Length;
ErrorCode errorCode = currPLC.WriteBytes(DataType.DataBlock, DbNum, IndiceMem, Value);
switch (errorCode)
{
case ErrorCode.NoError:
lgInfo($"S7WriteBB-02 Effettuata correttamente scrittura su PLC: DB {DbNum}.{IndiceMem} | numByte: {Value.Length}| {Value.ValToBinString()}");
break;
case ErrorCode.WrongCPU_Type:
case ErrorCode.ConnectionError:
case ErrorCode.IPAddressNotAvailable:
case ErrorCode.WrongVarFormat:
case ErrorCode.WrongNumberReceivedBytes:
case ErrorCode.SendData:
case ErrorCode.ReadData:
case ErrorCode.WriteData:
lgError($"Errore in S7WriteBB su DB {DbNum}.{IndiceMem}: {errorCode.ToString()} | numByte: {Value.Length}| {Value.ValToBinString()}");
break;
default:
break;
}
answ = true;
}
catch (Exception exc)
{
lgError($"Eccezione in S7WriteBB: DbNum {DbNum}, IndiceMem: {IndiceMem}, numByte: {Value.Length}{Environment.NewLine}{exc}");
}
}
#endif
sw.Stop();
}
}
return answ;
}
#endif
/// <summary>
/// Salvo in memblock il valore Int indicato con formattazione ModBus TCP