| 
					
				 | 
			
			
				@@ -1,12 +1,12 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-using FinsTcp; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using AdsCommunicatorNet8; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using ProtocalGeneral; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 namespace MinicsConsole.Connector; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class PLCNotifier(HardwareAddress address, ILog log) : IMini8DataNotifier, ITcpConnectNority, IDisposable 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private readonly Fins_Tcp _fins = new(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public string Name { get; set; } = "PLC Fins Tcp"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private readonly AdsCommunicator _connector = new(log); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public string Name { get; set; } = "PLC TwinCat Ads"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public bool StartService() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -15,8 +15,8 @@ public class PLCNotifier(HardwareAddress address, ILog log) : IMini8DataNotifier 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (string.IsNullOrEmpty(address.PLCAddress.IPAddress)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this._fins.Initialize(this); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this._fins.Connect(address.PLCAddress.IPAddress, address.PLCAddress.Port, PlcHeartBeatCallBack); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this._connector.Initialize(this); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this._connector.Open(address.PLCAddress.IPAddress, address.PLCAddress.Port); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -24,30 +24,12 @@ public class PLCNotifier(HardwareAddress address, ILog log) : IMini8DataNotifier 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void Dispose() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this._fins?.Dispose(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private bool PlcHeartBeatCallBack() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (address.PLCAddress is null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (string.IsNullOrEmpty(address.PLCAddress.HeartBeatAddress)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        try 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return _fins.SetData<bool>(address.PLCAddress.HeartBeatAddress, true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        catch 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this._connector?.Dispose(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     void IMini8DataNotifier.ChannelInfoNotify(byte mini8, byte channel, ChannelData channelData) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (this._fins is null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (this._connector is null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (!this._PlcConnected) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -60,7 +42,7 @@ public class PLCNotifier(HardwareAddress address, ILog log) : IMini8DataNotifier 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (!this._fins.SetData(channelAddress.PV, channelData.PV)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!this._connector.SetValue(channelAddress.PV, channelData.PV)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             log.Warning($"PLCNotifier ChannelInfoNotify Send Mini8 - {mini8} channel {channel} PV {channelData.PV} Failed"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private bool _PlcConnected = false; 
			 |