123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- using Aitex.Core.RT.Event;
- using Aitex.Core.RT.RecipeCenter;
- using Aitex.Core.Util;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.SCCore;
- using Microsoft.VisualBasic.Devices;
- using RTCommunicatorBase;
- using RTCommunicatorTLV;
- using System;
- 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
- {
- public void Connected(string ip, int port)
- {
- 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);
- 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()
- {
- }
- public void SelectMinicsConfig(string minicsConfigName)
- {
- communicator.SelectConfigFile(minicsConfigName);
- }
- }
- }
|