use of org.eclipse.milo.opcua.sdk.client.model.nodes.objects.ServerTypeNode in project milo by eclipse.
the class ReadNodeExample method run.
@Override
public void run(OpcUaClient client, CompletableFuture<OpcUaClient> future) throws Exception {
// synchronous connect
client.connect().get();
// Get a typed reference to the Server object: ServerNode
ServerTypeNode serverNode = (ServerTypeNode) client.getAddressSpace().getObjectNode(Identifiers.Server, Identifiers.ServerType);
// Read properties of the Server object...
String[] serverArray = serverNode.getServerArray();
String[] namespaceArray = serverNode.getNamespaceArray();
logger.info("ServerArray={}", Arrays.toString(serverArray));
logger.info("NamespaceArray={}", Arrays.toString(namespaceArray));
// Read the value of attribute the ServerStatus variable component
ServerStatusDataType serverStatus = serverNode.getServerStatus();
logger.info("ServerStatus={}", serverStatus);
// Get a typed reference to the ServerStatus variable
// component and read value attributes individually
ServerStatusTypeNode serverStatusNode = serverNode.getServerStatusNode();
BuildInfo buildInfo = serverStatusNode.getBuildInfo();
DateTime startTime = serverStatusNode.getStartTime();
DateTime currentTime = serverStatusNode.getCurrentTime();
ServerState state = serverStatusNode.getState();
logger.info("ServerStatus.BuildInfo={}", buildInfo);
logger.info("ServerStatus.StartTime={}", startTime);
logger.info("ServerStatus.CurrentTime={}", currentTime);
logger.info("ServerStatus.State={}", state);
future.complete(client);
}
use of org.eclipse.milo.opcua.sdk.client.model.nodes.objects.ServerTypeNode in project milo by eclipse.
the class UaNodeTest method serverNode_ServerStatusNode_BuildInfo.
@Test
public void serverNode_ServerStatusNode_BuildInfo() throws UaException {
AddressSpace addressSpace = client.getAddressSpace();
ServerTypeNode serverNode = (ServerTypeNode) addressSpace.getNode(Identifiers.Server);
BuildInfo buildInfo1 = serverNode.getServerStatusNode().getBuildInfo();
assertNotNull(buildInfo1);
BuildInfo buildInfo2 = serverNode.getServerStatusNode().readBuildInfo();
assertNotNull(buildInfo2);
assertEquals(buildInfo1, buildInfo2);
}
use of org.eclipse.milo.opcua.sdk.client.model.nodes.objects.ServerTypeNode in project milo by eclipse.
the class UaNodeTest method invalidate.
@Test
public void invalidate() throws UaException {
AddressSpace addressSpace = client.getAddressSpace();
ServerTypeNode serverNode1 = (ServerTypeNode) addressSpace.getNode(Identifiers.Server);
serverNode1.invalidate();
ServerTypeNode serverNode2 = (ServerTypeNode) addressSpace.getNode(Identifiers.Server);
assertNotSame(serverNode1, serverNode2);
}
use of org.eclipse.milo.opcua.sdk.client.model.nodes.objects.ServerTypeNode in project milo by eclipse.
the class AddressSpaceTest method getNode.
@Test
public void getNode() throws UaException {
AddressSpace addressSpace = client.getAddressSpace();
UaNode serverNode = addressSpace.getNode(Identifiers.Server);
assertNotNull(serverNode);
assertTrue(serverNode instanceof ServerTypeNode);
UaNode serverStatusNode = addressSpace.getNode(Identifiers.Server_ServerStatus);
assertNotNull(serverStatusNode);
assertTrue(serverStatusNode instanceof ServerStatusTypeNode);
}
use of org.eclipse.milo.opcua.sdk.client.model.nodes.objects.ServerTypeNode in project milo by eclipse.
the class AddressSpaceTest method getObjectNode.
@Test
public void getObjectNode() throws UaException {
AddressSpace addressSpace = client.getAddressSpace();
ServerTypeNode serverNode = (ServerTypeNode) addressSpace.getObjectNode(Identifiers.Server);
assertNotNull(serverNode);
assertEquals(Identifiers.Server, serverNode.getNodeId());
// should be cached now, check instance equality
assertSame(serverNode, addressSpace.getObjectNode(Identifiers.Server));
}
Aggregations