diff --git a/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI.vb b/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI.vb
index a39778e..a0878de 100644
--- a/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI.vb
+++ b/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI.vb
@@ -924,6 +924,14 @@ Namespace CNC
Public Overridable Function O_GetNcInfo1(ByRef NcInfo As OPENcontrol.GETINFO1DATA) As Boolean
Return True
End Function
+ '''
+ ''' Chiama ReadErrMsg x ottenere elenco errori
+ '''
+ '''
+ '''
+ Public Overridable Function O_ReadErrMsg(ByRef ErrMsg As OPENcontrol.ERRMSG) As Boolean
+ Return True
+ End Function
#End Region
diff --git a/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI_SOAP.vb b/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI_SOAP.vb
index a06f1c1..3f0d308 100644
--- a/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI_SOAP.vb
+++ b/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI_SOAP.vb
@@ -974,7 +974,6 @@ Retry: nRetry += 1
#Region "Funzioni specifiche IOT"
-
Public Overloads Overrides Function O_GetNcInfo1(ByRef NcInfo As OPENcontrol.GETINFO1DATA) As Boolean
' RIFERIMENTO:
' CndexLinkUser.pdf | pag 148, 266
@@ -1006,6 +1005,37 @@ Retry: nRetry += 1
End Function
+ Public Overloads Overrides Function O_ReadErrMsg(ByRef ErrMsg As OPENcontrol.ERRMSG) As Boolean
+ ' RIFERIMENTO:
+ ' CndexLinkUser.pdf | pag 160, 270
+
+ Dim szReturn As String = ""
+ Dim myReadErrMsgR As OPENcontrol.ReadErrMsgR
+ Dim myReadErrMsg As New OPENcontrol.ReadErrMsg
+ Dim ProcessId As Short
+ Dim nRetry As Integer
+Retry: nRetry += 1
+
+ Try
+ O_GetSelectedProcess(ProcessId)
+
+ myReadErrMsg.ProcNum = ProcessId
+ myReadErrMsgR = OPENws.ReadErrMsg(myReadErrMsg)
+ If O_CheckRetError(myReadErrMsgR.retval, myReadErrMsgR.ErrClass, myReadErrMsgR.ErrNum, "GetNcInfo1() O_GetNcInfo1 CNC.OSAI_OPEN", szReturn) Then
+ Throw New CmsNcException(szReturn)
+ Return False
+ End If
+
+ ErrMsg = myReadErrMsgR.SysErrMsg
+ Return True
+ Catch ex As System.ServiceModel.CommunicationException
+ If nRetry < MAXRET Then GoTo Retry
+ Throw New CmsNcException(ex.Message)
+ Return False
+ End Try
+
+ End Function
+
#If False Then
Public Function getAllAxisPos() As Focas1.ODBPOS
' RIFERIMENTO:
diff --git a/MTC_Adapter/MTC_Adapter/AdapterOsai.cs b/MTC_Adapter/MTC_Adapter/AdapterOsai.cs
index 7bece99..5268fff 100644
--- a/MTC_Adapter/MTC_Adapter/AdapterOsai.cs
+++ b/MTC_Adapter/MTC_Adapter/AdapterOsai.cs
@@ -167,7 +167,7 @@ namespace MTC_Adapter
///
/// Vettore degli allarmi CNC attivi
///
- public CMSCncLib.Focas1.ODBALMMSG2 allarmiCNC;
+ public CMSCncLib.OPENcontrol.ERRMSG allarmiCNC;
///
/// estende l'init della classe base...
@@ -416,7 +416,7 @@ namespace MTC_Adapter
// check FILE DATI MODIFICATO: ricaricare...
bitNum = 3;
- if (STRB_DW1.HasFlag((StFlag8)Math.Pow(2, bitNum)))
+ if (STRB_DW1.HasFlag((StFlag32)Math.Pow(2, bitNum)))
{
lg.Info("Notifica file modificato");
try
@@ -451,9 +451,9 @@ namespace MTC_Adapter
currACK_DW = new byte[1];
}
}
- catch
+ catch(Exception exc)
{
- lg.Info("Errore in strobe");
+ lg.Error(string.Format("Errore in strobe:{0}{1}", Environment.NewLine, exc));
}
// scrivo update ad ack SE VARIATO!!!
@@ -1425,7 +1425,7 @@ namespace MTC_Adapter
// leggo dati globali...
inizio = DateTime.Now;
- OSAI_ref.O_GetNcInfo1(ref allNcData);
+ OSAI_ref.O_GetNcInfo1(ref allNcData);
if (utils.CRB("recTime")) TimingData.addResult("R-NcInfo", DateTime.Now.Subtract(inizio).Ticks);
// recupero feed...
FeedRate = Convert.ToInt32(allNcData.realfeed);
@@ -1452,22 +1452,24 @@ namespace MTC_Adapter
// anche il secondo!
procPathOverride(1, currPathData, ref sb);
}
-#if false
+
+ allarmiCNC = new CMSCncLib.OPENcontrol.ERRMSG();
+#if false
// se ho allarmi li accodo...
- if (allNcData.alarm != 0)
+ if (allNcData.lastncerror != 0)
{
- sb.AppendLine(string.Format("Allarmi CNC: {0}", allNcData.alarm));
+ sb.AppendLine(string.Format("Allarmi CNC: {0}", allNcData.lastncerror));
inizio = DateTime.Now;
- allarmiCNC = OSAI_ref.getCncAlarm();
+ OSAI_ref.O_ReadErrMsg(ref allarmiCNC);
if (utils.CRB("recTime")) TimingData.addResult("R-CNC-ALARMS", DateTime.Now.Subtract(inizio).Ticks);
checkCNCAlarms();
}
else
{
- allarmiCNC = new CMSCncLib.Focas1.ODBALMMSG2();
- }
+ allarmiCNC = new CMSCncLib.OPENcontrol.ERRMSG();
+ }
#endif
parentForm.dataMonitor = sb.ToString();
@@ -1598,43 +1600,30 @@ namespace MTC_Adapter
///
private void checkCNCAlarms()
{
-#if false
- // faccio parse allarmi: se ci sono invio e presento
- sendAlarmIfPresent(allarmiCNC.msg1);
- sendAlarmIfPresent(allarmiCNC.msg2);
- sendAlarmIfPresent(allarmiCNC.msg3);
- sendAlarmIfPresent(allarmiCNC.msg4);
- sendAlarmIfPresent(allarmiCNC.msg5);
- sendAlarmIfPresent(allarmiCNC.msg6);
- sendAlarmIfPresent(allarmiCNC.msg7);
- sendAlarmIfPresent(allarmiCNC.msg8);
- sendAlarmIfPresent(allarmiCNC.msg9);
- sendAlarmIfPresent(allarmiCNC.msg10);
-#endif
+ if (allarmiCNC != null)
+ {
+ // faccio parse allarmi: se ci sono invio e presento
+ if (allarmiCNC.Msg1 != null) sendAlarmIfPresent(allarmiCNC.Msg1);
+ if (allarmiCNC.Msg2 != null) sendAlarmIfPresent(allarmiCNC.Msg1);
+ if (allarmiCNC.Msg3 != null) sendAlarmIfPresent(allarmiCNC.Msg1);
+ if (allarmiCNC.Msg4 != null) sendAlarmIfPresent(allarmiCNC.Msg1);
+ }
}
///
/// Invia singolo allarme CNC se presente
///
///
- protected void sendAlarmIfPresent(CMSCncLib.Focas1.ODBALMMSG2_data allarme)
+ protected void sendAlarmIfPresent(string allarme)
{
// controllo valore...
- if (allarme.alm_no > 0)
+ if (allarme != "" && allarme != null)
{
- //if (utils.CRB("verbose")) sb.AppendLine(string.Format("Allarmi CNC: NUM {0} | MESS: {1} | ASSE: {2} | TYPE: {3}", allarme.alm_no, allarme.alm_msg, allarme.axis, allarme.type));
-
- // se ho asse accodo ad asse altrimenti no...
- string codAllarme = string.Format("T{0}-N{1}", allarme.type, allarme.alm_no);
- if (allarme.axis == 0)
+ if (utils.CRI("loglevel") > 5)
{
- mAlarmCNC.Add(MTConnect.Condition.Level.FAULT, allarme.alm_msg, codAllarme, "", "");
- }
- else
- {
- mAlarmCNC.Add(MTConnect.Condition.Level.FAULT, allarme.alm_msg, codAllarme, "", "");
- vettAxis[allarme.axis - 1].mAxAlarmCNC.Add(MTConnect.Condition.Level.FAULT, allarme.alm_msg, codAllarme, "", "");
+ lg.Info(string.Format("Allarmi CNC: {0} ", allarme));
}
+ mAlarmCNC.Add(MTConnect.Condition.Level.FAULT, allarme, allarme, "", "");
}
}