Fixed Step-Server & Client closing error + Siemens Nc bug fixes + Machine-Info data exchange fix

This commit is contained in:
CMS3762\carminatini
2018-01-29 17:10:30 +01:00
parent 3e8874090e
commit ecaff5fb7f
16 changed files with 253 additions and 136 deletions
+14 -4
View File
@@ -17,7 +17,7 @@ public static class ThreadsFunctions
private static long ReadNcGenericInfoTimer = 0, ReadNcGenericInfoTimes = 0;
private static long ReadAxesTimer = 0, ReadAxesTimes = 0;
private static long ReadPowerOnTimer = 0, ReadPowerOnTimes = 0;
private static Thread ConnThread;
#region Nc Threads
public static void ReadAlarms()
@@ -221,14 +221,21 @@ public static class ThreadsFunctions
reconnectionIsRunning = true;
// Start reconnection thread
Thread t = new Thread(() =>
ConnThread = new Thread(() =>
WillReconnect()
);
t.Start();
ConnThread.Start();
}
}
public static void AbortNcConnection()
{
if (ConnThread != null && ConnThread.IsAlive)
ConnThread.Abort();
}
public static void ManageLibraryError(CmsError cmsError)
{
switch (cmsError.errorCode)
@@ -254,9 +261,12 @@ public static class ThreadsFunctions
case CMS_ERROR_CODES.NC_LANGUAGE_ERROR:
break;
case CMS_ERROR_CODES.SIEMENS_ENVIRONMENT_NOT_FOUND:
case CMS_ERROR_CODES.SIEMENS_HMI_NOT_RUNNING:
Manage(ERROR_LEVEL.FATAL, cmsError.message);
break;
case CMS_ERROR_CODES.SIEMENS_HMI_NOT_RUNNING:
Manage(ERROR_LEVEL.WARNING, cmsError.message);
TryNcConnection(); // If not connected try reconnection
break;
}
}