Skip to content

Commit

Permalink
Generate new stack and SDK code for OPC UA 1.05 (#1038)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinherron committed Sep 2, 2022
1 parent e672f50 commit c119542
Show file tree
Hide file tree
Showing 2,405 changed files with 264,091 additions and 120,864 deletions.
Expand Up @@ -20,7 +20,7 @@
import com.google.common.base.MoreObjects;
import org.eclipse.milo.opcua.sdk.client.OpcUaClient;
import org.eclipse.milo.opcua.sdk.client.nodes.UaNode;
import org.eclipse.milo.opcua.stack.core.Identifiers;
import org.eclipse.milo.opcua.stack.core.NodeIds;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -40,7 +40,7 @@ public void run(OpcUaClient client, CompletableFuture<OpcUaClient> future) throw
client.connect().get();

// start browsing at root folder
UaNode rootNode = client.getAddressSpace().getNode(Identifiers.RootFolder);
UaNode rootNode = client.getAddressSpace().getNode(NodeIds.RootFolder);

Tree<UaNode> tree = new Tree<>(rootNode);

Expand Down
Expand Up @@ -15,7 +15,7 @@
import java.util.concurrent.ExecutionException;

import org.eclipse.milo.opcua.sdk.client.OpcUaClient;
import org.eclipse.milo.opcua.stack.core.Identifiers;
import org.eclipse.milo.opcua.stack.core.NodeIds;
import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId;
import org.eclipse.milo.opcua.stack.core.types.enumerated.BrowseDirection;
import org.eclipse.milo.opcua.stack.core.types.enumerated.BrowseResultMask;
Expand Down Expand Up @@ -45,7 +45,7 @@ public void run(OpcUaClient client, CompletableFuture<OpcUaClient> future) throw
client.connect().get();

// start browsing at root folder
browseNode("", client, Identifiers.RootFolder);
browseNode("", client, NodeIds.RootFolder);

future.complete(client);
}
Expand All @@ -54,7 +54,7 @@ private void browseNode(String indent, OpcUaClient client, NodeId browseRoot) {
BrowseDescription browse = new BrowseDescription(
browseRoot,
BrowseDirection.Forward,
Identifiers.References,
NodeIds.References,
true,
uint(NodeClass.Object.getValue() | NodeClass.Variable.getValue()),
uint(BrowseResultMask.All.getValue())
Expand Down
Expand Up @@ -15,7 +15,7 @@

import org.eclipse.milo.opcua.sdk.client.OpcUaClient;
import org.eclipse.milo.opcua.sdk.client.nodes.UaNode;
import org.eclipse.milo.opcua.stack.core.Identifiers;
import org.eclipse.milo.opcua.stack.core.NodeIds;
import org.eclipse.milo.opcua.stack.core.UaException;
import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId;
import org.slf4j.Logger;
Expand All @@ -37,7 +37,7 @@ public void run(OpcUaClient client, CompletableFuture<OpcUaClient> future) throw
client.connect().get();

// start browsing at root folder
browseNode("", client, Identifiers.RootFolder);
browseNode("", client, NodeIds.RootFolder);

future.complete(client);
}
Expand Down
Expand Up @@ -19,7 +19,7 @@
import org.eclipse.milo.opcua.sdk.client.api.subscriptions.UaMonitoredItem;
import org.eclipse.milo.opcua.sdk.client.api.subscriptions.UaSubscription;
import org.eclipse.milo.opcua.stack.core.AttributeId;
import org.eclipse.milo.opcua.stack.core.Identifiers;
import org.eclipse.milo.opcua.stack.core.NodeIds;
import org.eclipse.milo.opcua.stack.core.types.builtin.ExtensionObject;
import org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName;
import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger;
Expand Down Expand Up @@ -58,7 +58,7 @@ public void run(OpcUaClient client, CompletableFuture<OpcUaClient> future) throw
.createSubscription(1000.0).get();

ReadValueId readValueId = new ReadValueId(
Identifiers.Server,
NodeIds.Server,
AttributeId.EventNotifier.uid(),
null,
QualifiedName.NULL_VALUE
Expand All @@ -70,27 +70,27 @@ public void run(OpcUaClient client, CompletableFuture<OpcUaClient> future) throw
EventFilter eventFilter = new EventFilter(
new SimpleAttributeOperand[]{
new SimpleAttributeOperand(
Identifiers.BaseEventType,
NodeIds.BaseEventType,
new QualifiedName[]{new QualifiedName(0, "EventId")},
AttributeId.Value.uid(),
null),
new SimpleAttributeOperand(
Identifiers.BaseEventType,
NodeIds.BaseEventType,
new QualifiedName[]{new QualifiedName(0, "EventType")},
AttributeId.Value.uid(),
null),
new SimpleAttributeOperand(
Identifiers.BaseEventType,
NodeIds.BaseEventType,
new QualifiedName[]{new QualifiedName(0, "Severity")},
AttributeId.Value.uid(),
null),
new SimpleAttributeOperand(
Identifiers.BaseEventType,
NodeIds.BaseEventType,
new QualifiedName[]{new QualifiedName(0, "Time")},
AttributeId.Value.uid(),
null),
new SimpleAttributeOperand(
Identifiers.BaseEventType,
NodeIds.BaseEventType,
new QualifiedName[]{new QualifiedName(0, "Message")},
AttributeId.Value.uid(),
null)
Expand Down
Expand Up @@ -15,7 +15,7 @@
import org.eclipse.milo.opcua.sdk.client.OpcUaClient;
import org.eclipse.milo.opcua.sdk.client.subscriptions.ManagedDataItem;
import org.eclipse.milo.opcua.sdk.client.subscriptions.ManagedSubscription;
import org.eclipse.milo.opcua.stack.core.Identifiers;
import org.eclipse.milo.opcua.stack.core.NodeIds;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -46,7 +46,7 @@ public void run(OpcUaClient client, CompletableFuture<OpcUaClient> future) throw
});

ManagedDataItem dataItem = subscription.createDataItem(
Identifiers.Server_ServerStatus_CurrentTime
NodeIds.Server_ServerStatus_CurrentTime
);

if (dataItem.getStatusCode().isGood()) {
Expand Down
Expand Up @@ -17,7 +17,7 @@
import org.eclipse.milo.opcua.sdk.client.subscriptions.EventFilterBuilder;
import org.eclipse.milo.opcua.sdk.client.subscriptions.ManagedEventItem;
import org.eclipse.milo.opcua.sdk.client.subscriptions.ManagedSubscription;
import org.eclipse.milo.opcua.stack.core.Identifiers;
import org.eclipse.milo.opcua.stack.core.NodeIds;
import org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName;
import org.eclipse.milo.opcua.stack.core.types.builtin.Variant;
import org.eclipse.milo.opcua.stack.core.types.structured.EventFilter;
Expand Down Expand Up @@ -58,14 +58,14 @@ public void run(OpcUaClient client, CompletableFuture<OpcUaClient> future) throw
});

EventFilter eventFilter = new EventFilterBuilder()
.select(Identifiers.BaseEventType, new QualifiedName(0, "EventId"))
.select(Identifiers.BaseEventType, new QualifiedName(0, "EventType"))
.select(Identifiers.BaseEventType, new QualifiedName(0, "Severity"))
.select(Identifiers.BaseEventType, new QualifiedName(0, "Time"))
.select(Identifiers.BaseEventType, new QualifiedName(0, "Message"))
.select(NodeIds.BaseEventType, new QualifiedName(0, "EventId"))
.select(NodeIds.BaseEventType, new QualifiedName(0, "EventType"))
.select(NodeIds.BaseEventType, new QualifiedName(0, "Severity"))
.select(NodeIds.BaseEventType, new QualifiedName(0, "Time"))
.select(NodeIds.BaseEventType, new QualifiedName(0, "Message"))
.build();

ManagedEventItem eventItem = subscription.createEventItem(Identifiers.Server, eventFilter);
ManagedEventItem eventItem = subscription.createEventItem(NodeIds.Server, eventFilter);

// wait for some events to arrive before completing
eventLatch.await();
Expand Down
Expand Up @@ -15,7 +15,7 @@

import org.eclipse.milo.opcua.sdk.client.OpcUaClient;
import org.eclipse.milo.opcua.sdk.client.nodes.UaVariableNode;
import org.eclipse.milo.opcua.stack.core.Identifiers;
import org.eclipse.milo.opcua.stack.core.NodeIds;
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue;
import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId;
import org.eclipse.milo.opcua.stack.core.types.enumerated.ServerState;
Expand All @@ -39,7 +39,7 @@ public void run(OpcUaClient client, CompletableFuture<OpcUaClient> future) throw
client.connect().get();

// synchronous read request via VariableNode
UaVariableNode node = client.getAddressSpace().getVariableNode(Identifiers.Server_ServerStatus_StartTime);
UaVariableNode node = client.getAddressSpace().getVariableNode(NodeIds.Server_ServerStatus_StartTime);
DataValue value = node.readValue();

logger.info("StartTime={}", value.getValue().getValue());
Expand All @@ -58,8 +58,8 @@ public void run(OpcUaClient client, CompletableFuture<OpcUaClient> future) throw

private CompletableFuture<List<DataValue>> readServerStateAndTime(OpcUaClient client) {
List<NodeId> nodeIds = List.of(
Identifiers.Server_ServerStatus_State,
Identifiers.Server_ServerStatus_CurrentTime
NodeIds.Server_ServerStatus_State,
NodeIds.Server_ServerStatus_CurrentTime
);

return client.readValues(0.0, TimestampsToReturn.Both, nodeIds);
Expand Down
Expand Up @@ -14,9 +14,9 @@
import java.util.concurrent.CompletableFuture;

import org.eclipse.milo.opcua.sdk.client.OpcUaClient;
import org.eclipse.milo.opcua.sdk.client.model.nodes.objects.ServerTypeNode;
import org.eclipse.milo.opcua.sdk.client.model.nodes.variables.ServerStatusTypeNode;
import org.eclipse.milo.opcua.stack.core.Identifiers;
import org.eclipse.milo.opcua.sdk.client.model.objects.ServerTypeNode;
import org.eclipse.milo.opcua.sdk.client.model.variables.ServerStatusTypeNode;
import org.eclipse.milo.opcua.stack.core.NodeIds;
import org.eclipse.milo.opcua.stack.core.types.builtin.DateTime;
import org.eclipse.milo.opcua.stack.core.types.enumerated.ServerState;
import org.eclipse.milo.opcua.stack.core.types.structured.BuildInfo;
Expand All @@ -41,8 +41,8 @@ public void run(OpcUaClient client, CompletableFuture<OpcUaClient> future) throw

// Get a typed reference to the Server object: ServerNode
ServerTypeNode serverNode = (ServerTypeNode) client.getAddressSpace().getObjectNode(
Identifiers.Server,
Identifiers.ServerType
NodeIds.Server,
NodeIds.ServerType
);

// Read properties of the Server object...
Expand Down
Expand Up @@ -17,7 +17,7 @@
import org.eclipse.milo.opcua.sdk.client.api.subscriptions.UaMonitoredItem;
import org.eclipse.milo.opcua.sdk.client.api.subscriptions.UaSubscription;
import org.eclipse.milo.opcua.stack.core.AttributeId;
import org.eclipse.milo.opcua.stack.core.Identifiers;
import org.eclipse.milo.opcua.stack.core.NodeIds;
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue;
import org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName;
import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger;
Expand Down Expand Up @@ -51,7 +51,7 @@ public void run(OpcUaClient client, CompletableFuture<OpcUaClient> future) throw

// subscribe to the Value attribute of the server's CurrentTime node
ReadValueId readValueId = new ReadValueId(
Identifiers.Server_ServerStatus_CurrentTime,
NodeIds.Server_ServerStatus_CurrentTime,
AttributeId.Value.uid(), null, QualifiedName.NULL_VALUE
);

Expand Down
Expand Up @@ -14,7 +14,7 @@
import java.util.concurrent.CompletableFuture;

import org.eclipse.milo.opcua.sdk.client.OpcUaClient;
import org.eclipse.milo.opcua.stack.core.Identifiers;
import org.eclipse.milo.opcua.stack.core.NodeIds;
import org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName;
import org.eclipse.milo.opcua.stack.core.types.builtin.StatusCode;
import org.eclipse.milo.opcua.stack.core.types.structured.BrowsePath;
Expand Down Expand Up @@ -43,22 +43,22 @@ public void run(OpcUaClient client, CompletableFuture<OpcUaClient> future) throw
client.connect().get();

TranslateBrowsePathsToNodeIdsResponse response = client.translateBrowsePaths(List.of(new BrowsePath(
Identifiers.ObjectsFolder,
NodeIds.ObjectsFolder,
new RelativePath(new RelativePathElement[]{
new RelativePathElement(
Identifiers.HierarchicalReferences,
NodeIds.HierarchicalReferences,
false,
true,
new QualifiedName(2, "HelloWorld")
),
new RelativePathElement(
Identifiers.HierarchicalReferences,
NodeIds.HierarchicalReferences,
false,
true,
new QualifiedName(2, "ScalarTypes")
),
new RelativePathElement(
Identifiers.HierarchicalReferences,
NodeIds.HierarchicalReferences,
false,
true,
new QualifiedName(2, "UInt64")
Expand Down
Expand Up @@ -19,7 +19,7 @@
import org.eclipse.milo.opcua.sdk.client.api.subscriptions.UaMonitoredItem;
import org.eclipse.milo.opcua.sdk.client.api.subscriptions.UaSubscription;
import org.eclipse.milo.opcua.stack.core.AttributeId;
import org.eclipse.milo.opcua.stack.core.Identifiers;
import org.eclipse.milo.opcua.stack.core.NodeIds;
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue;
import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId;
import org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName;
Expand Down Expand Up @@ -69,7 +69,7 @@ public void run(OpcUaClient client, CompletableFuture<OpcUaClient> future) throw

// subscribe to a dynamic value that only samples
ReadValueId readValueId2 = new ReadValueId(
Identifiers.Server_ServerStatus_CurrentTime,
NodeIds.Server_ServerStatus_CurrentTime,
AttributeId.Value.uid(),
null,
QualifiedName.NULL_VALUE
Expand Down

0 comments on commit c119542

Please sign in to comment.