diff --git a/CVCncLib/testSam.dll b/CVCncLib/testSam.dll
index 80054d6b..40235d91 100644
Binary files a/CVCncLib/testSam.dll and b/CVCncLib/testSam.dll differ
diff --git a/IOB-WIN/IobOSAI.cs b/IOB-WIN/IobOSAI.cs
index a68b2d6e..95a0e234 100644
--- a/IOB-WIN/IobOSAI.cs
+++ b/IOB-WIN/IobOSAI.cs
@@ -27,184 +27,10 @@ namespace IOB_WIN
/// Stato corrente (da classe ENUM)
///
public CNC_STATUS_OSAI currStatus;
-
-#if false
- ///
- /// wrapper chiamata lettura/scrittura OSAI x BYTE...
- ///
- ///
- ///
- ///
- /// 0/1 orimo o secondo byte della word...
- ///
- ///
- public bool OsaiMemRW_Byte(bool bWrite, OSAI.MemTypeWord MemType, Int32 memIndex, Int32 memOrderStart, ref byte[] Value)
- {
- bool answ = false;
-#if false
- if (OSAI_ref.Connected)
- {
- try
- {
- parentForm.commPlcActive = true;
- answ = OSAI_ref.O_RW_Byte(bWrite, MemType, memIndex, memOrderStart, ref Value);
- }
- catch (Exception exc)
- {
- lg.Error(exc, "Eccezione in OsaiMemRW_Byte");
- }
- }
-#endif
- parentForm.commPlcActive = false;
- return answ;
- }
- ///
- /// wrapper chiamata lettura/scrittura x WORD...
- ///
- ///
- ///
- ///
- ///
- ///
- public bool OsaiMemRW_Word(bool bWrite, OSAI.MemTypeWord MemType, Int32 memIndex, ref ushort[] Value)
- {
- bool answ = false;
- if (OSAI_ref.Connected)
- {
-#if false
- try
- {
- parentForm.commPlcActive = true;
- answ = OSAI_ref.O_RW_Word(bWrite, MemType, memIndex, ref Value);
- }
- catch (Exception exc)
- {
- lg.Error(exc, "Eccezione in OsaiMemRW_Word");
- }
-#endif
- }
- parentForm.commPlcActive = false;
- return answ;
- }
- ///
- /// wrapper chiamata lettura/scrittura x DOUBLE-WORD...
- ///
- ///
- ///
- ///
- ///
- ///
- public bool OsaiMemRW_DWord(bool bWrite, OSAI.MemTypeWord MemType, Int32 memIndex, ref uint[] Value)
- {
- bool answ = false;
- if (OSAI_ref.Connected)
- {
-#if false
- try
- {
- parentForm.commPlcActive = true;
- answ = OSAI_ref.O_RW_DWord(bWrite, MemType, memIndex, ref Value);
- }
- catch (Exception exc)
- {
- lg.Error(exc, "Eccezione in OsaiMemRW_DWord");
- }
-#endif
- }
- parentForm.commPlcActive = false;
- return answ;
- }
- ///
- /// wrapper chiamata lettura/scrittura x Short...
- ///
- ///
- ///
- ///
- ///
- ///
- public bool OsaiMemRW_Short(bool bWrite, OSAI.MemTypeWord MemType, Int32 memIndex, ref short[] Value)
- {
- bool answ = false;
- if (OSAI_ref.Connected)
- {
-#if false
- try
- {
- parentForm.commPlcActive = true;
- answ = OSAI_ref.O_RW_Short(bWrite, MemType, memIndex, ref Value);
- }
- catch (Exception exc)
- {
- lg.Error(exc, "Eccezione in OsaiMemRW_Short");
- }
-#endif
- }
- parentForm.commPlcActive = false;
- return answ;
- }
- ///
- /// wrapper chiamata lettura/scrittura x INT...
- ///
- ///
- ///
- ///
- ///
- ///
- public bool OsaiMemRW_Integer(bool bWrite, OSAI.MemTypeWord MemType, Int32 memIndex, ref int[] Value)
- {
- bool answ = false;
-#if false
- if (OSAI_ref.Connected)
- {
- try
- {
- parentForm.commPlcActive = true;
- answ = OSAI_ref.O_RW_Integer(bWrite, MemType, memIndex, ref Value);
- }
- catch (Exception exc)
- {
- lg.Error(exc, "Eccezione in OsaiMemRW_Integer");
- }
- }
-#endif
- parentForm.commPlcActive = false;
- return answ;
- }
- ///
- /// wrapper chiamata lettura/scrittura x Double...
- ///
- ///
- ///
- ///
- ///
- ///
- public bool OsaiMemRW_Double(bool bWrite, OSAI.MemTypeDouble MemType, Int32 memIndex, ref double[] Value)
- {
- bool answ = false;
-#if false
- if (OSAI_ref.Connected)
- {
- try
- {
- parentForm.commPlcActive = true;
- answ = OSAI_ref.O_RW_Double(bWrite, MemType, memIndex, ref Value);
- }
- catch (Exception exc)
- {
- lg.Error(exc, "Eccezione in OsaiMemRW_Double");
- }
- }
-#endif
- parentForm.commPlcActive = false;
- return answ;
- }
-#endif
-
///
/// Oggetto MAIN x connessione OSAI
///
protected ComCNOsai OSAI_ref;
-
///
/// estende l'init della classe base...
///
@@ -296,71 +122,6 @@ namespace IOB_WIN
bitStatus += 1;
}
- // lettura variabili (es contapezzi)
- ComCNOsai.stVAR temp;
- temp.nAddress = 29; // impostare da conf
- temp.nBit = 0;
- temp.nNumCn = 1;
- temp.szVarName = "";
-
- short risultato;
- risultato = OSAI_ref.ReadShortVar(temp);
-
-
- // area vb di riferimento x decodifica...
-#if false
- ' valore bitmap dello statup IOB
- Dim status As Short = 0
-
- ' power on
- If CnOsai.Connected Then
- status += 1
- End If
-
- ' RUN mode
- If (machineStatus = ComCNOsai.CYCLE_ And modeSelected = ComCNOsai.AUTO) Then
- status += 2
- End If
-
- ' Allarme
- If (machineStatus = ComCNOsai.ERRO_) Then
- status += 8
- End If
-
- ' Manuale
- If (modeSelected <> ComCNOsai.AUTO) Then
- status += 16
- End If
-
- ' Allarme
- If (machineStatus = ComCNOsai.EMERG_) Then
- status += 32
- End If
-
-
- ' compongo i bit di status...
- Dim IobBitmap As String
- IobBitmap = "--------------" + vbCrLf
- IobBitmap += "Bitmap IOB:" + vbCrLf
- IobBitmap += status.ToString() + vbCrLf
- IobBitmap += "--------------" + vbCrLf + vbCrLf
-
- ' per leggere variabili dichiaro la struttura
- Dim temp As ComCNOsai.stVAR
- temp.nAddress = nVar_NC_state ' da conf che vale 352 da
- temp.nBit = 0
- temp.nNumCn = 1
- temp.szVarName = ""
-
- Dim risultato As Short
- risultato = CnOsai.ReadShortVar(temp)
-
- IobBitmap += vbCrLf
- IobBitmap += "Variabile " + nVar_NC_state.ToString() + ": " + risultato.ToString()
-#endif
-
-
-
if (utils.CRB("enableContapezzi"))
{
lgInfo("OSAI: inizio gestione contapezzi");
@@ -690,48 +451,6 @@ namespace IOB_WIN
return prgName;
}
///
- /// Recupero programma in lavorazione come Dictionary CNC...
- /// - SYSINFO: (prima KEY globale) TUTTI i valori separati da # (x fare check modifica)
- /// - altre stringhe: ogni singolo parametro / valore
- ///
- ///
- public override Dictionary getSysInfo()
- {
- Dictionary outVal = new Dictionary();
- stopwatch.Restart();
-#if false
- CncLib.Focas1.ODBSYS answ = OSAI_ref.getSysInfo();
- if (utils.CRB("recTime"))
- {
- TimingData.addResult(currIobConf.codIOB, string.Format("SYS-INFO"), stopwatch.ElapsedTicks);
- }
-
- try
- {
- string cnc_type = new string(answ.cnc_type);
- string mt_type = new string(answ.mt_type);
- string series = new string(answ.series);
- string version = new string(answ.version);
- string axes = new string(answ.axes);
- //short addInfo = answ.addinfo;
- short max_axis = answ.max_axis;
- // preparo i singoli valori dell'array...
- outVal.Add("SYSINFO", string.Format("{0}#{1}#{2}#{3}#{4}#{5}", cnc_type, mt_type, series, version, axes, max_axis));
- outVal.Add("CNC", cnc_type);
- outVal.Add("MTT", mt_type);
- outVal.Add("SER", series);
- outVal.Add("VER", version);
- outVal.Add("AXS", string.Format("{0}|{1}", axes, max_axis));
- }
- catch (Exception exc)
- {
- lgError(exc, "Errore in getSysInfo");
- connectionOk = false;
- }
-#endif
- return outVal;
- }
- ///
/// Effettua vero processing contapezzi appoggiato ad area specifica da CONF
///
public override void processContapezzi()
@@ -765,13 +484,7 @@ namespace IOB_WIN
int resVal = 0;
// lettura variabili (es contapezzi)
resVal = (int)OSAI_ref.ReadVarSN((short)cntAddr);
- //ComCNOsai.stVAR tmpVar;
- //tmpVar.nAddress = cntAddr;
- //tmpVar.nBit = 0;
- //tmpVar.nNumCn = 1;
- //tmpVar.szVarName = "";
- //// vera lettura
- //resVal = OSAI_ref.ReadShortVar(tmpVar);
+
if (utils.CRB("recTime"))
{
TimingData.addResult(currIobConf.codIOB, string.Format("R{0}-MEM", 2), stopwatch.ElapsedTicks);
@@ -954,181 +667,5 @@ namespace IOB_WIN
}
return outVal;
}
-#if false
-
- ///
- /// Override salvataggio valori in memoria...
- ///
- /// tipo di DUMP
- public override void saveMemDump(dumpType tipo)
- {
-#if false
- // se l'area ha una size > 0...
- if (areaD.arraySize > 0)
- {
- dump_MemArea(tipo, FANUC.MemType.D, areaD.startIdx, areaD.arraySize);
- }
- // se l'area ha una size > 0...
- if (areaR.arraySize > 0)
- {
- dump_MemArea(tipo, FANUC.MemType.R, areaR.startIdx, areaR.arraySize);
- }
- // se l'area ha una size > 0...
- if (areaX.arraySize > 0)
- {
- dump_MemArea(tipo, FANUC.MemType.X, areaX.startIdx, areaX.arraySize);
- }
- // se l'area ha una size > 0...
- if (areaY.arraySize > 0)
- {
- dump_MemArea(tipo, FANUC.MemType.Y, areaY.startIdx, areaY.arraySize);
- }
- // se l'area ha una size > 0...
- if (areaPAR.arraySize > 0)
- {
- dump_ParArea(tipo, areaPAR.startIdx, areaPAR.arraySize);
- }
-#endif
- }
- ///
- /// Dump area D della memoria
- ///
- /// tipo di DUMP: START (sovrascrivendo) / SAMPLE (salva tanti campionamenti)
- /// tipo memoria
- /// area memoria di partenza
- /// dimensione memoria
- private void dump_MemArea(dumpType tipo, FANUC.MemType tipoMem, int memIndex, int memSizeByte)
- {
- DateTime adesso = DateTime.Now;
- string nomeFileB = "";
- string nomeFileW = "";
- string nomeFileDW = "";
- Dictionary mappaValori = new Dictionary();
- // per sicurezza verifico < 9999 byte
- if (memSizeByte > 9999)
- {
- memSizeByte = 9999;
- }
- // leggo TUTTI i (MAX 9999) byte della memoria D...
- byte[] MemBlockCurr = new byte[memSizeByte];
- if (verboseLog)
- {
- lgInfo("START MemDump", tipoMem);
- }
-
- stopwatch.Restart();
-#if false
- OsaiMemRW(R, tipoMem, memIndex, ref MemBlockCurr);
- if (utils.CRB("recTime"))
- {
- TimingData.addResult(currIobConf.codIOB, string.Format("R{0}-{1}", MemBlockCurr.Length, tipoMem), stopwatch.ElapsedTicks);
- }
-#endif
-
- if (verboseLog)
- {
- lgInfo("END MemDump", tipoMem);
- }
-
- // seconda del tipo di lettura definisco i nomi delle variabili...
- if (tipo == dumpType.SAMPLE)
- {
- nomeFileB = string.Format(@"{0}\SAMPLES\{1}_{2}_Byte_{3:yyyyMMdd_HHmmss}.dat", utils.dataDatDir, currIobConf.codIOB, tipoMem, adesso);
- nomeFileW = string.Format(@"{0}\SAMPLES\{1}_{2}_W_{3:yyyyMMdd_HHmmss}.dat", utils.dataDatDir, currIobConf.codIOB, tipoMem, adesso);
- nomeFileDW = string.Format(@"{0}\SAMPLES\{1}_{2}_DW_{3:yyyyMMdd_HHmmss}.dat", utils.dataDatDir, currIobConf.codIOB, tipoMem, adesso);
- }
- else
- {
- // salvo in file i dati letti come BYTE
- nomeFileB = string.Format(@"{0}\{1}_{2}_Byte.dat", utils.dataDatDir, currIobConf.codIOB, tipoMem);
- nomeFileW = string.Format(@"{0}\{1}_{2}_W.dat", utils.dataDatDir, currIobConf.codIOB, tipoMem);
- nomeFileDW = string.Format(@"{0}\{1}_{2}_DW.dat", utils.dataDatDir, currIobConf.codIOB, tipoMem);
- }
-
- // salvo in file i dati letti come BYTE
- mappaValori = new Dictionary();
- for (int i = 0; i < MemBlockCurr.Length; i++)
- {
- mappaValori.Add(i.ToString("0000"), MemBlockCurr[i].ToString());
- }
- utils.WritePlain(mappaValori, nomeFileB);
-
- // salvo in file i dati letti come Word (2byte)
- mappaValori = new Dictionary();
- for (int i = 0; i < MemBlockCurr.Length / 2; i++)
- {
- mappaValori.Add(i.ToString("0000"), BitConverter.ToUInt16(MemBlockCurr, i * 2).ToString());
- }
- utils.WritePlain(mappaValori, nomeFileW);
-
- // salvo in file i dati letti come DWord (4byte)
- mappaValori = new Dictionary();
- for (int i = 0; i < MemBlockCurr.Length / 4; i++)
- {
- mappaValori.Add(i.ToString("0000"), BitConverter.ToUInt32(MemBlockCurr, i * 4).ToString());
- }
- utils.WritePlain(mappaValori, nomeFileDW);
- }
- ///
- /// Dump area PARAMETRI
- ///
- /// tipo di DUMP: START (sovrascrivendo) / SAMPLE (salva tanti campionamenti)
- /// Parametro di partenza
- /// Numero parametri da esportare... memoria
- private void dump_ParArea(dumpType tipo, int memIndex, int numPar)
- {
- DateTime adesso = DateTime.Now;
- string nomeFile = "";
- Dictionary mappaValori = new Dictionary();
- // per sicurezza verifico < 9999 parametri
- if (numPar > 9999)
- {
- numPar = 9999;
- }
-
- // leggo TUTTI i (MAX 9999) byte della memoria D...
- object[] paramsArray = new object[numPar];
- if (verboseLog)
- {
- lgInfo("START ParamDump");
- }
-
- stopwatch.Restart();
-#if false
- for (int i = 0; i < numPar; i++)
- {
- OSAI_ref.F_RW_Param_Integer(false, memIndex + i, 3, ref paramsArray[i]);
- }
-#endif
-
- if (utils.CRB("recTime"))
- {
- TimingData.addResult(currIobConf.codIOB, string.Format("R{0}-PAR", 4 * numPar), stopwatch.ElapsedTicks);
- }
-
- if (verboseLog)
- {
- lgInfo("END ParamDump");
- }
-
- // seconda del tipo di lettura definisco i nomi delle variabili...
- if (tipo == dumpType.SAMPLE)
- {
- nomeFile = string.Format(@"{0}\SAMPLES\{1}_{2}_{3:yyyyMMdd_HHmmss}.dat", utils.dataDatDir, currIobConf.codIOB, "PAR", adesso);
- }
- else
- {
- nomeFile = string.Format(@"{0}\{1}_{2}.dat", utils.dataDatDir, currIobConf.codIOB, "PAR");
- }
-
- // salvo in file i dati letti
- mappaValori = new Dictionary();
- for (int i = 0; i < paramsArray.Length; i++)
- {
- mappaValori.Add(i.ToString("0000"), paramsArray[i].ToString());
- }
- utils.WritePlain(mappaValori, nomeFile);
- }
-#endif
}
}