Compare commits

...

1 Commits

4 changed files with 23 additions and 19 deletions

View File

@@ -1,8 +1,8 @@
<Project>
<PropertyGroup>
<PluginVersion>10.9.11</PluginVersion>
<ProPluginVersion>10.9.11</ProPluginVersion>
<PluginVersion>10.9.12</PluginVersion>
<ProPluginVersion>10.9.12</ProPluginVersion>
<AuthenticationVersion>2.9.5</AuthenticationVersion>
<SourceGeneratorVersion>10.9.5</SourceGeneratorVersion>
<NET8Version>8.0.17</NET8Version>

View File

@@ -1099,7 +1099,7 @@ public class OpcUaMaster : IDisposable
}
private static List<VariableNode> GetVariableNodes(ReadValueIdCollection itemsToRead, DataValueCollection values, DiagnosticInfoCollection diagnosticInfos, ResponseHeader responseHeader, int count = 1)
private List<VariableNode> GetVariableNodes(ReadValueIdCollection itemsToRead, DataValueCollection values, DiagnosticInfoCollection diagnosticInfos, ResponseHeader responseHeader, int count = 1)
{
ClientBase.ValidateResponse(values, itemsToRead);
ClientBase.ValidateDiagnosticInfos(diagnosticInfos, itemsToRead);
@@ -1130,11 +1130,11 @@ public class OpcUaMaster : IDisposable
// NodeId Attribute
if (!DataValue.IsGood(value))
{
throw ServiceResultException.Create(value.StatusCode, 0 + 2 * i, diagnosticInfos, responseHeader.StringTable);
Log(3, ServiceResultException.Create(value.StatusCode, 0 + 2 * i, diagnosticInfos, responseHeader.StringTable), $"Get nodeid {itemsToRead[0 + 2 * i].NodeId} fail");
}
if (value == null)
{
throw ServiceResultException.Create(StatusCodes.BadUnexpectedError, "Node does not support the NodeId attribute.");
Log(3, ServiceResultException.Create(StatusCodes.BadUnexpectedError, "Node does not support the NodeId attribute."), $"Get nodeid {itemsToRead[0 + 2 * i].NodeId} fail");
}
variableNode.NodeId = (NodeId)value.GetValue(typeof(NodeId));

View File

@@ -165,10 +165,11 @@ public class OpcUaMaster : CollectBase
//如果是订阅模式,连接时添加订阅组
if (_plc.OpcUaProperty?.ActiveSubscribe == true && CurrentDevice.VariableSourceReads.Count > 0 && _plc.Session.SubscriptionCount < CurrentDevice.VariableSourceReads.Count)
{
try
{
foreach (var variableSourceRead in CurrentDevice.VariableSourceReads)
foreach (var variableSourceRead in CurrentDevice.VariableSourceReads)
{
try
{
if (_plc.Session.Subscriptions.FirstOrDefault(a => a.DisplayName == variableSourceRead.RegisterAddress) == null)
{
@@ -180,19 +181,22 @@ public class OpcUaMaster : CollectBase
await Task.Delay(100, cancellationToken).ConfigureAwait(false); // allow for subscription to be finished on server?
checkLog = true;
}
catch (Exception ex)
{
if (!checkLog)
LogMessage?.LogWarning(ex, "AddSubscriptions error");
checkLog = false;
}
finally
{
}
LogMessage?.LogInformation("AddSubscriptions done");
checkLog = true;
}
catch (Exception ex)
{
if (!checkLog)
LogMessage?.LogWarning(ex, "AddSubscriptions error");
checkLog = false;
}
finally
{
}
}
}
}

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>10.9.11</Version>
<Version>10.9.12</Version>
</PropertyGroup>
<ItemGroup>