mirror of
https://github.com/ThingsGateway/ThingsGateway.git
synced 2026-10-26 02:17:58 +08:00
更新OPCUAClient,订阅模式适配 分组
This commit is contained in:
+7
-2
@@ -47,7 +47,7 @@ public class OPCUAClient : IDisposable
|
||||
/// <summary>
|
||||
/// 当前保存的变量名称列表
|
||||
/// </summary>
|
||||
public List<string> Variables = new();
|
||||
public List<List<string>> Variables = new();
|
||||
|
||||
/// <summary>
|
||||
/// 当前的变量名称/OPC变量节点
|
||||
@@ -584,7 +584,12 @@ public class OPCUAClient : IDisposable
|
||||
|
||||
//如果是订阅模式,连接时添加订阅组
|
||||
if (OPCNode.ActiveSubscribe)
|
||||
await AddSubscriptionAsync(Guid.NewGuid().ToString(), Variables.ToArray(), OPCNode.LoadType);
|
||||
{
|
||||
foreach (var item in Variables)
|
||||
{
|
||||
await AddSubscriptionAsync(Guid.NewGuid().ToString(), item.ToArray(), OPCNode.LoadType);
|
||||
}
|
||||
}
|
||||
return m_session;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,8 +78,9 @@ public class OPCUAClient : CollectBase
|
||||
public override List<DeviceVariableSourceRead> LoadSourceRead(List<DeviceVariableRunTime> deviceVariables)
|
||||
{
|
||||
_deviceVariables = deviceVariables;
|
||||
_plc.Variables.AddRange(deviceVariables.Select(a => a.VariableAddress).ToList());
|
||||
var dataLists = deviceVariables.ChunkTrivialBetter(driverPropertys.GroupSize);
|
||||
List<List<DeviceVariableRunTime>> dataLists = deviceVariables.ChunkTrivialBetter(driverPropertys.GroupSize);
|
||||
_plc.Variables = new();
|
||||
_plc.Variables.AddRange(dataLists.Select(a => a.Select(a => a.VariableAddress).ToList()).ToList());
|
||||
var dataResult = new List<DeviceVariableSourceRead>();
|
||||
foreach (var variable in dataLists)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user