Fix siemens library

Minor Fixes
This commit is contained in:
Lucio Maranta
2018-12-04 16:51:12 +01:00
parent f29f2334d1
commit 019f0cd5fc
6 changed files with 220 additions and 208 deletions
+20 -20
View File
@@ -53,7 +53,7 @@ public static class ThreadsFunctions
libraryError = ncHandler.ManageWatchdog();
}
else
TryNcConnection();
RestoreConnection();
sw.Stop();
@@ -97,7 +97,7 @@ public static class ThreadsFunctions
MessageServices.Current.Publish(SEND_ALARMS, null, alarms);
}
else
TryNcConnection();
RestoreConnection();
sw.Stop();
//Update thread timer
@@ -140,7 +140,7 @@ public static class ThreadsFunctions
MessageServices.Current.Publish(SEND_POWER_ON_DATA, null, powerOnData);
}
else
TryNcConnection();
RestoreConnection();
sw.Stop();
// Update thread timer
@@ -203,7 +203,7 @@ public static class ThreadsFunctions
}
}
else
TryNcConnection();
RestoreConnection();
sw.Stop();
@@ -248,7 +248,7 @@ public static class ThreadsFunctions
MessageServices.Current.Publish(SEND_FUNCTIONALITY_DATA, null, functionsAccessList);
}
else
TryNcConnection();
RestoreConnection();
sw.Stop();
@@ -293,7 +293,7 @@ public static class ThreadsFunctions
MessageServices.Current.Publish(SEND_EXPIRED_MAINTENANCES_DATA, null, expiredMaintenances);
}
else
TryNcConnection();
RestoreConnection();
sw.Stop();
@@ -338,7 +338,7 @@ public static class ThreadsFunctions
MessageServices.Current.Publish(SEND_USER_SOFTKEYS_DATA, null, softKeys);
}
else
TryNcConnection();
RestoreConnection();
sw.Stop();
@@ -383,7 +383,7 @@ public static class ThreadsFunctions
MessageServices.Current.Publish(SEND_HEADS_DATA, null, heads);
}
else
TryNcConnection();
RestoreConnection();
sw.Stop();
@@ -428,7 +428,7 @@ public static class ThreadsFunctions
MessageServices.Current.Publish(SEND_AXIS_NAMES_DATA, null, axes);
}
else
TryNcConnection();
RestoreConnection();
sw.Stop();
@@ -473,7 +473,7 @@ public static class ThreadsFunctions
MessageServices.Current.Publish(SEND_AXES, null, axesPositions);
}
else
TryNcConnection();
RestoreConnection();
sw.Stop();
@@ -518,7 +518,7 @@ public static class ThreadsFunctions
MessageServices.Current.Publish(SEND_MAGAZINES_STATUS, null, magazineStatus);
}
else
TryNcConnection();
RestoreConnection();
sw.Stop();
@@ -564,7 +564,7 @@ public static class ThreadsFunctions
MessageServices.Current.Publish(SEND_ACTIVE_PROGRAM_DATA, null, active);
}
else
TryNcConnection();
RestoreConnection();
sw.Stop();
@@ -614,7 +614,7 @@ public static class ThreadsFunctions
});
}
else
TryNcConnection();
RestoreConnection();
sw.Stop();
//Update thread timer
@@ -658,7 +658,7 @@ public static class ThreadsFunctions
MessageServices.Current.Publish(NC_MAGAZINE_IS_ACTIVE, null, status);
}
else
TryNcConnection();
RestoreConnection();
sw.Stop();
// Wait
@@ -702,7 +702,7 @@ public static class ThreadsFunctions
MessageServices.Current.Publish(SEND_QUEUE_DATA, null, queue);
}
else
TryNcConnection();
RestoreConnection();
sw.Stop();
// Wait
@@ -719,7 +719,7 @@ public static class ThreadsFunctions
#region SupportFunctions
private static void WillReconnect()
private static void TryNcConnection()
{
// Stop all the NC threads
ThreadsHandler.Stop();
@@ -747,7 +747,7 @@ public static class ThreadsFunctions
reconnectionIsRunning = false;
}
public static void TryNcConnection()
public static void RestoreConnection()
{
if (reconnectionIsRunning == false)
{ // Set thread as running state
@@ -755,7 +755,7 @@ public static class ThreadsFunctions
// Start reconnection thread
ConnThread = new Thread(() =>
WillReconnect()
TryNcConnection()
);
ConnThread.Start();
@@ -777,7 +777,7 @@ public static class ThreadsFunctions
break;
case CMS_ERROR_CODES.NOT_CONNECTED:
TryNcConnection(); // If not connected try reconnection
RestoreConnection(); // If not connected try reconnection
break;
case CMS_ERROR_CODES.PROC_NOT_FOUND:
@@ -789,7 +789,7 @@ public static class ThreadsFunctions
case CMS_ERROR_CODES.SIEMENS_HMI_NOT_RUNNING:
Manage(ERROR_LEVEL.WARNING, cmsError.localizationKey);
TryNcConnection(); // If not connected try reconnection
RestoreConnection(); // If not connected try reconnection
break;
}
}