Added api to modify offsets
And magazine signalR
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user