Skip to content

Commit

Permalink
OPC DA 运行时读取Bug修复
Browse files Browse the repository at this point in the history
  • Loading branch information
cdy816 committed Aug 17, 2022
1 parent 143bba5 commit 5c3b9aa
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
16 changes: 4 additions & 12 deletions Run/Driver/Cdy.Spider.OpcDaClient/OpcDAChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace Cdy.Spider.OpcDAClient
/// <summary>
///
/// </summary>
public class OpcUaChannel : ChannelBase2
public class OpcDAChannel : ChannelBase2
{

#region ... Variables ...
Expand Down Expand Up @@ -87,7 +87,7 @@ public class OpcUaChannel : ChannelBase2
/// <param name="host"></param>
private Opc.Da.Server InitClient(Specification spec, string name,string host)
{
Opc.Server[] servers = m_discovery.GetAvailableServers(spec, host, null);
Opc.Server[] servers = m_discovery.GetAvailableServers(spec, host,string.IsNullOrEmpty(mData.UserName)? null:new ConnectData(new System.Net.NetworkCredential() { UserName=mData.UserName,Password=mData.Password}));

if (servers != null)
{
Expand Down Expand Up @@ -121,15 +121,7 @@ public override void Init()
}
}

if (IsSubscriptionMode)
{
mMonitoringGroup.Name = "Monitoring"; // Group Name
mMonitoringGroup.ServerHandle = null; // The handle assigned by the server to the group.
mMonitoringGroup.ClientHandle = Guid.NewGuid().ToString(); // The handle assigned by the client to the group.
mMonitoringGroup.Active = true; // Activate the group.
mMonitoringGroup.UpdateRate = ScanCircle; // The refresh rate is 1 second. -> 1000
mMonitoringGroup.Deadband = 0; // When the dead zone value is set to 0, the server will notify the group of any data changes in the group.
}


base.Init();
}
Expand Down Expand Up @@ -472,7 +464,7 @@ protected override object ReadValueInner(object value, int timeout, out bool res
/// <returns></returns>
public override ICommChannel2 NewApi()
{
return new OpcUaChannel();
return new OpcDAChannel();
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Run/Driver/Cdy.Spider.OpcDaClient/OpcDAChannelData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public override void LoadFromXML(XElement xe)
base.LoadFromXML(xe);
if (xe.Attribute("ServerName") != null)
{
this.ServerIp = xe.Attribute("ServerName").Value;
this.ServerName = xe.Attribute("ServerName").Value;
}
}

Expand Down
1 change: 1 addition & 0 deletions Run/InSpiderRun/Config/ChannelRuntime.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<Channel Assembly="Cdy.Spider.MQTTClient.dll" Class="Cdy.Spider.MQTTClient.MQTTClientChannel" />
<Channel Assembly="Cdy.Spider.MQTTServer.dll" Class="Cdy.Spider.MQTTServer.MQTTServerChannel" />
<Channel Assembly="Cdy.Spider.OpcClient.dll" Class="Cdy.Spider.OpcClient.OpcUaChannel" />
<Channel Assembly="Cdy.Spider.OpcDAClient.dll" Class="Cdy.Spider.OpcDAClient.OpcDAChannel" />
<Channel Assembly="Cdy.Spider.SerisePortClient.dll" Class="Cdy.Spider.SerisePortClient.SerisePortClientChannel" />
<Channel Assembly="Cdy.Spider.TcpClient.dll" Class="Cdy.Spider.TcpClient.TcpClientChannel" />
<Channel Assembly="Cdy.Spider.UdpClient.dll" Class="Cdy.Spider.UdpClient.UdpClientChannel" />
Expand Down
2 changes: 1 addition & 1 deletion Run/InSpiderRun/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"InSpiderRun": {
"commandName": "Executable",
"executablePath": "C:\\Users\\cdy81\\source\\repos\\cdy816\\Spider\\Output\\InSpiderRun.exe"
"executablePath": "C:\\Users\\chongdaoyang.JIUSIYI\\source\\repos\\cdy816\\Spider\\Output\\InSpiderRun.exe"
},
"WSL 2": {
"commandName": "WSL2",
Expand Down

0 comments on commit 5c3b9aa

Please sign in to comment.