Add an option to enable reading the display name of a published node.
Default is disabled.
This commit is contained in:
Родитель
44694bf0ec
Коммит
13ff205ef3
|
@ -322,16 +322,24 @@ namespace OpcPublisher
|
|||
currentNodeId = new NodeId((NodeId)item.StartNodeId);
|
||||
}
|
||||
|
||||
// get the DisplayName for the node, otherwise use the nodeId
|
||||
Node node = Session.ReadNode(currentNodeId);
|
||||
item.DisplayName = node.DisplayName.Text ?? currentNodeId.ToString();
|
||||
// if configured, get the DisplayName for the node, otherwise use the nodeId
|
||||
Node node;
|
||||
if (FetchOpcNodeDisplayName == true)
|
||||
{
|
||||
node = Session.ReadNode(currentNodeId);
|
||||
item.DisplayName = node.DisplayName.Text ?? currentNodeId.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
item.DisplayName = currentNodeId.ToString();
|
||||
}
|
||||
|
||||
// add the new monitored item.
|
||||
MonitoredItem monitoredItem = new MonitoredItem()
|
||||
{
|
||||
StartNodeId = currentNodeId,
|
||||
AttributeId = item.AttributeId,
|
||||
DisplayName = node.DisplayName.Text,
|
||||
DisplayName = item.DisplayName,
|
||||
MonitoringMode = item.MonitoringMode,
|
||||
SamplingInterval = item.RequestedSamplingInterval,
|
||||
QueueSize = item.QueueSize,
|
||||
|
|
|
@ -72,6 +72,7 @@ namespace OpcPublisher
|
|||
public static int OpcKeepAliveIntervalInSec = 2;
|
||||
public static int OpcSamplingInterval = 1000;
|
||||
public static int OpcPublishingInterval = 0;
|
||||
public static bool FetchOpcNodeDisplayName = false;
|
||||
|
||||
public static string PublisherServerSecurityPolicy = SecurityPolicies.Basic128Rsa15;
|
||||
|
||||
|
@ -294,6 +295,9 @@ namespace OpcPublisher
|
|||
// trust own public cert option
|
||||
{ "tm|trustmyself=", $"the publisher certificate is put into the trusted certificate store automatically.\nDefault: {TrustMyself}", (bool b) => TrustMyself = b },
|
||||
|
||||
// read the display name of the nodes to publish from the server and publish them instead of the node id
|
||||
{ "fd|fetchdisplayname=", $"enable to read the display name of a published node from the server. this will increase the runtime.\nDefault: {FetchOpcNodeDisplayName}", (bool b) => FetchOpcNodeDisplayName = b },
|
||||
|
||||
// own cert store options
|
||||
{ "at|appcertstoretype=", $"the own application cert store type. \n(allowed values: Directory, X509Store)\nDefault: '{OpcOwnCertStoreType}'", (string s) => {
|
||||
if (s.Equals(X509Store, StringComparison.OrdinalIgnoreCase) || s.Equals(Directory, StringComparison.OrdinalIgnoreCase))
|
||||
|
|
Загрузка…
Ссылка в новой задаче