Added api to modify offsets

And magazine signalR
This commit is contained in:
Lucio Maranta
2018-08-29 17:02:51 +02:00
parent a54dd90472
commit 2e22f4db3d
10 changed files with 183 additions and 24 deletions
+39 -1
View File
@@ -449,7 +449,7 @@ public static class ThreadsFunctions
try
{
// Try connection
CmsError libraryError = ncHandler.Connect();
CmsError libraryError = ncHandler.Connect();
if (libraryError.errorCode != 0)
ManageLibraryError(libraryError);
@@ -578,6 +578,44 @@ public static class ThreadsFunctions
}
}
public static void ReadNcMagazineActive()
{
NcHandler ncHandler = new NcHandler();
Stopwatch sw = new Stopwatch();
try
{
// Try connection
CmsError libraryError = ncHandler.Connect();
if (libraryError.errorCode != 0)
ManageLibraryError(libraryError);
while (true)
{
sw.Restart();
// Check if client is connected
if (ncHandler.numericalControl.NC_IsConnected())
{
// Get new data from PLC
libraryError = ncHandler.GetNcMagazineStatus(out Dictionary<int, bool> status);
MessageServices.Current.Publish(NC_MAGAZINE_IS_ACTIVE, null, status);
}
else
TryNcConnection();
sw.Stop();
// Wait
Thread.Sleep(CalcSleepTime(500, (int)sw.ElapsedMilliseconds));
}
}
catch (ThreadAbortException)
{
ncHandler.Dispose();
}
}
#endregion Nc functions threads
#region SupportFunctions