opc fix
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace Modbus.Net.OPC
|
||||
namespace Modbus.Net.Opc
|
||||
{
|
||||
/// <summary>
|
||||
/// Opc地址编码器
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace Modbus.Net.OPC
|
||||
namespace Modbus.Net.Opc
|
||||
{
|
||||
/// <summary>
|
||||
/// Opc地址解析器
|
||||
|
||||
@@ -5,7 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Modbus.Net.OPC
|
||||
namespace Modbus.Net.Opc
|
||||
{
|
||||
/// <summary>
|
||||
/// Opc Client Extend interface, Unified for DA and UA
|
||||
@@ -18,7 +18,7 @@ namespace Modbus.Net.OPC
|
||||
Node RootNodeBase { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Connect the client to the OPC Server
|
||||
/// Connect the client to the Opc Server
|
||||
/// </summary>
|
||||
void Connect();
|
||||
|
||||
@@ -30,11 +30,11 @@ namespace Modbus.Net.OPC
|
||||
/// The fully-qualified identifier of the tag. You can specify a subfolder by using a comma delimited name.
|
||||
/// E.g: the tag `foo.bar` reads the tag `bar` on the folder `foo`
|
||||
/// </param>
|
||||
/// <returns>The value retrieved from the OPC</returns>
|
||||
/// <returns>The value retrieved from the Opc</returns>
|
||||
ReadEvent<T> Read<T>(string tag);
|
||||
|
||||
/// <summary>
|
||||
/// Write a value on the specified opc tag
|
||||
/// Write a value on the specified Opc tag
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of tag to write on</typeparam>
|
||||
/// <param name="tag">
|
||||
@@ -50,7 +50,7 @@ namespace Modbus.Net.OPC
|
||||
Task<ReadEvent<T>> ReadAsync<T>(string tag);
|
||||
|
||||
/// <summary>
|
||||
/// Write a value on the specified opc tag asynchronously
|
||||
/// Write a value on the specified Opc tag asynchronously
|
||||
/// </summary>
|
||||
Task WriteAsync<T>(string tag, T item);
|
||||
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net462</TargetFramework>
|
||||
<LangVersion>10.0</LangVersion>
|
||||
<AssemblyName>Modbus.Net.OPC</AssemblyName>
|
||||
<RootNamespace>Modbus.Net.OPC</RootNamespace>
|
||||
<PackageId>Modbus.Net.OPC</PackageId>
|
||||
<AssemblyName>Modbus.Net.Opc</AssemblyName>
|
||||
<RootNamespace>Modbus.Net.Opc</RootNamespace>
|
||||
<PackageId>Modbus.Net.Opc</PackageId>
|
||||
<Version>1.4.1</Version>
|
||||
<Authors>Chris L.(Luo Sheng)</Authors>
|
||||
<Company>Hangzhou Delian Science Technology Co.,Ltd.</Company>
|
||||
<Product>Modbus.Net.OPC</Product>
|
||||
<Description>Modbus.Net OPC Implementation</Description>
|
||||
<Product>Modbus.Net.Opc</Product>
|
||||
<Description>Modbus.Net Opc Implementation</Description>
|
||||
<Copyright>Copyright 2023 Hangzhou Delian Science Technology Co.,Ltd.</Copyright>
|
||||
<PackageProjectUrl>https://github.com/parallelbgls/Modbus.Net/tree/master/Modbus.Net/Modbus.Net.OPC</PackageProjectUrl>
|
||||
<PackageProjectUrl>https://github.com/parallelbgls/Modbus.Net/tree/master/Modbus.Net/Modbus.Net.Opc</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/parallelbgls/Modbus.Net</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<PackageTags>hardware communicate protocol modbus Delian</PackageTags>
|
||||
@@ -26,7 +26,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DocumentationFile>bin\Debug\Modbus.Net.OPC.xml</DocumentationFile>
|
||||
<DocumentationFile>bin\Debug\Modbus.Net.Opc.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Modbus.Net.OPC
|
||||
namespace Modbus.Net.Opc
|
||||
{
|
||||
/// <summary>
|
||||
/// Opc连接器
|
||||
@@ -62,12 +62,12 @@ namespace Modbus.Net.OPC
|
||||
Client?.Dispose();
|
||||
Client = null;
|
||||
_connect = false;
|
||||
logger.LogInformation("opc client {ConnectionToken} disconnected success", ConnectionToken);
|
||||
logger.LogInformation("Opc client {ConnectionToken} disconnected success", ConnectionToken);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "opc client {ConnectionToken} disconnected error", ConnectionToken);
|
||||
logger.LogError(ex, "Opc client {ConnectionToken} disconnected error", ConnectionToken);
|
||||
_connect = false;
|
||||
return false;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ namespace Modbus.Net.OPC
|
||||
if (answerTag != null)
|
||||
{
|
||||
var result = await Client.ReadAsync<object>(answerTag);
|
||||
logger.LogDebug($"Opc Machine {ConnectionToken} Read opc tag {answerTag} for value {result.Value}");
|
||||
logger.LogDebug($"Opc Machine {ConnectionToken} Read Opc tag {answerTag} for value {result.Value}");
|
||||
return new OpcParamOut
|
||||
{
|
||||
Success = true,
|
||||
@@ -135,11 +135,11 @@ namespace Modbus.Net.OPC
|
||||
try
|
||||
{
|
||||
await Client.WriteAsync(answerTag, value);
|
||||
logger.LogDebug($"Opc Machine {ConnectionToken} Write opc tag {answerTag} for value {value}");
|
||||
logger.LogDebug($"Opc Machine {ConnectionToken} Write Opc tag {answerTag} for value {value}");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.LogError(e, "opc client {ConnectionToken} write exception", ConnectionToken);
|
||||
logger.LogError(e, "Opc client {ConnectionToken} write exception", ConnectionToken);
|
||||
return new OpcParamOut
|
||||
{
|
||||
Success = false
|
||||
@@ -158,7 +158,7 @@ namespace Modbus.Net.OPC
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.LogError(e, "opc client {ConnectionToken} read exception", ConnectionToken);
|
||||
logger.LogError(e, "Opc client {ConnectionToken} read exception", ConnectionToken);
|
||||
return new OpcParamOut
|
||||
{
|
||||
Success = false,
|
||||
@@ -197,12 +197,12 @@ namespace Modbus.Net.OPC
|
||||
{
|
||||
Client.Connect();
|
||||
_connect = true;
|
||||
logger.LogInformation("opc client {ConnectionToken} connect success", ConnectionToken);
|
||||
logger.LogInformation("Opc client {ConnectionToken} connect success", ConnectionToken);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "opc client {ConnectionToken} connected failed", ConnectionToken);
|
||||
logger.LogError(ex, "Opc client {ConnectionToken} connected failed", ConnectionToken);
|
||||
_connect = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Modbus.Net.OPC
|
||||
namespace Modbus.Net.Opc
|
||||
{
|
||||
/// <summary>
|
||||
/// Opc DA连接实现
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Modbus.Net.OPC
|
||||
namespace Modbus.Net.Opc
|
||||
{
|
||||
/// <summary>
|
||||
/// Opc Da协议
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
|
||||
|
||||
namespace Modbus.Net.OPC
|
||||
namespace Modbus.Net.Opc
|
||||
{
|
||||
/// <summary>
|
||||
/// Opc Da协议连接器
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Modbus.Net.OPC
|
||||
namespace Modbus.Net.Opc
|
||||
{
|
||||
/// <summary>
|
||||
/// Opc设备
|
||||
@@ -17,7 +17,7 @@ namespace Modbus.Net.OPC
|
||||
/// <param name="connectionString">连接地址</param>
|
||||
/// <param name="getAddresses">需要读写的地址</param>
|
||||
/// <param name="isRegexOn">开启正则匹配</param>
|
||||
protected OpcMachine(TKey id, OpcType connectionType, string connectionString, IEnumerable<AddressUnit<TUnitKey>> getAddresses, bool isRegexOn = false)
|
||||
public OpcMachine(TKey id, OpcType connectionType, string connectionString, IEnumerable<AddressUnit<TUnitKey>> getAddresses, bool isRegexOn = false)
|
||||
: base(id, getAddresses, true)
|
||||
{
|
||||
BaseUtility = new OpcUtility(connectionType, connectionString, isRegexOn);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Modbus.Net.OPC
|
||||
namespace Modbus.Net.Opc
|
||||
{
|
||||
/// <summary>
|
||||
/// Opc协议
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Modbus.Net.OPC
|
||||
namespace Modbus.Net.Opc
|
||||
{
|
||||
/// <summary>
|
||||
/// Opc协议连接器
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Modbus.Net.OPC
|
||||
namespace Modbus.Net.Opc
|
||||
{
|
||||
/// <summary>
|
||||
/// Opc UA连接实现
|
||||
@@ -28,7 +28,7 @@ namespace Modbus.Net.OPC
|
||||
/// </summary>
|
||||
/// <param name="host">Opc UA服务地址</param>
|
||||
/// <param name="isRegexOn">是否开启正则匹配</param>
|
||||
/// <returns>OPC UA实例</returns>
|
||||
/// <returns>Opc UA实例</returns>
|
||||
public static OpcUaConnector Instance(string host, bool isRegexOn)
|
||||
{
|
||||
if (!_instances.ContainsKey(host))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Modbus.Net.OPC
|
||||
namespace Modbus.Net.Opc
|
||||
{
|
||||
/// <summary>
|
||||
/// Opc UA协议
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Configuration;
|
||||
|
||||
namespace Modbus.Net.OPC
|
||||
namespace Modbus.Net.Opc
|
||||
{
|
||||
/// <summary>
|
||||
/// Opc UA协议连接器
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Modbus.Net.OPC
|
||||
namespace Modbus.Net.Opc
|
||||
{
|
||||
/// <summary>
|
||||
/// Opc类型
|
||||
@@ -73,9 +73,9 @@ namespace Modbus.Net.OPC
|
||||
/// <param name="isRegexOn">是否开启正则匹配</param>
|
||||
public OpcUtility(int connectionType, string connectionString, bool isRegexOn = false) : base(0, 0)
|
||||
{
|
||||
OpcType = (OpcType)connectionType;
|
||||
ConnectionString = connectionString;
|
||||
IsRegexOn = isRegexOn;
|
||||
OpcType = (OpcType)connectionType;
|
||||
AddressTranslator = new AddressTranslatorOpc();
|
||||
}
|
||||
|
||||
@@ -87,9 +87,9 @@ namespace Modbus.Net.OPC
|
||||
/// <param name="isRegexOn">是否开启正则匹配</param>
|
||||
public OpcUtility(OpcType connectionType, string connectionString, bool isRegexOn = false) : base(0, 0)
|
||||
{
|
||||
OpcType = connectionType;
|
||||
ConnectionString = connectionString;
|
||||
IsRegexOn = isRegexOn;
|
||||
OpcType = connectionType;
|
||||
AddressTranslator = new AddressTranslatorOpc();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Modbus.Net.Modbus.NA200H",
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AnyType", "..\Samples\AnyType\AnyType.csproj", "{1857DA63-3335-428F-84D8-1FA4F8178643}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Modbus.Net.OPC", "Modbus.Net.OPC\Modbus.Net.OPC.csproj", "{C854A379-C5EA-4CAC-9C5F-7291372D1D3F}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Modbus.Net.Opc", "Modbus.Net.OPC\Modbus.Net.Opc.csproj", "{C854A379-C5EA-4CAC-9C5F-7291372D1D3F}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CrossLamp", "..\Samples\CrossLamp\CrossLamp.csproj", "{AA3A42D2-0502-41D3-929A-BAB729DF07D6}"
|
||||
EndProject
|
||||
|
||||
Reference in New Issue
Block a user