2016-01-29 update 1
This commit is contained in:
34
Modbus.Net/Modbus.Net.OPC/OpcDaProtocal.cs
Normal file
34
Modbus.Net/Modbus.Net.OPC/OpcDaProtocal.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ModBus.Net.OPC
|
||||
{
|
||||
public class OpcDaProtocal : OpcProtocal
|
||||
{
|
||||
private int _connectTryCount;
|
||||
|
||||
private readonly string _host;
|
||||
|
||||
public OpcDaProtocal(string host)
|
||||
{
|
||||
_host = host;
|
||||
}
|
||||
|
||||
public override bool Connect()
|
||||
{
|
||||
return AsyncHelper.RunSync(ConnectAsync);
|
||||
}
|
||||
|
||||
public override async Task<bool> ConnectAsync()
|
||||
{
|
||||
_connectTryCount++;
|
||||
ProtocalLinker = new OpcDaProtocalLinker(_host);
|
||||
if (!await ProtocalLinker.ConnectAsync()) return false;
|
||||
_connectTryCount = 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user