|
@@ -1,6 +1,5 @@
|
|
|
using Aitex.Core.RT.Event;
|
|
|
using Aitex.Core.RT.RecipeCenter;
|
|
|
-using Aitex.Core.RT.SCCore;
|
|
|
using Aitex.Core.Util;
|
|
|
using MECF.Framework.Common.Equipment;
|
|
|
using MECF.Framework.Common.SCCore;
|
|
@@ -12,39 +11,58 @@ using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Reflection;
|
|
|
using System.Text;
|
|
|
+using System.Threading;
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
namespace MECF.Framework.Common.Minics
|
|
|
{
|
|
|
public class MinicsManager : Singleton<MinicsManager>, IRTMini8Provider
|
|
|
{
|
|
|
- private RTCommunicator_TLV communicator = new RTCommunicator_TLV();
|
|
|
-
|
|
|
public void Connected(string ip, int port)
|
|
|
{
|
|
|
- if (communicator.StartService(ip, port))
|
|
|
- {
|
|
|
- EV.PostInfoLog(ModuleName.Minics.ToString(), $"minics Connected {ip}:{port} sucessful");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- EV.PostAlarmLog(ModuleName.Minics.ToString(), $"minics Connected {ip}:{port} error");
|
|
|
- }
|
|
|
+ Console.WriteLine($"DisconnectedNotify {ip} {port}");
|
|
|
|
|
|
}
|
|
|
public void DisConnected(string ip, int port)
|
|
|
{
|
|
|
Console.WriteLine($"DisconnectedNotify {ip} {port}");
|
|
|
}
|
|
|
+ private RTCommunicator_TLV communicator = new RTCommunicator_TLV();
|
|
|
public void Initialize(string ip = "127.0.0.1", int port = 50052)
|
|
|
{
|
|
|
communicator.Initialize(this);
|
|
|
- Connected(ip, port);
|
|
|
-
|
|
|
+ SWJConnectedMinics(ip, port);
|
|
|
+ }
|
|
|
+ public void SWJConnectedMinics(string ip, int port)
|
|
|
+ {
|
|
|
+ if (communicator.StartService(ip, port))
|
|
|
+ {
|
|
|
+ EV.PostInfoLog(ModuleName.Minics.ToString(), $"minics Connected {ip}:{port} sucessful");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ for (int i = 1; i <= 3; i++)
|
|
|
+ {
|
|
|
+ var status = this.communicator.StartService(ip, port);
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (status)
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ if (i == 3)
|
|
|
+ return;
|
|
|
+ Thread.Sleep(300);
|
|
|
+ EV.PostAlarmLog(ModuleName.Minics.ToString(), $"retry minics Connected {ip}:{port} error {i} times");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
public void End()
|
|
|
{
|
|
|
- communicator.CloseService();
|
|
|
|
|
|
}
|
|
|
public void SelectMinicsConfig(string minicsConfigName)
|