use of org.eclipse.milo.opcua.sdk.client.model.nodes.variables.ServerStatusTypeNode 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.variables.ServerStatusTypeNode 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.variables.ServerStatusTypeNode in project milo by eclipse.
the class AddressSpaceTest method getVariableNode.
@Test
public void getVariableNode() throws UaException {
AddressSpace addressSpace = client.getAddressSpace();
ServerStatusTypeNode serverNode = (ServerStatusTypeNode) addressSpace.getVariableNode(Identifiers.Server_ServerStatus);
assertNotNull(serverNode);
assertEquals(Identifiers.Server_ServerStatus, serverNode.getNodeId());
// should be cached now, check instance equality
assertSame(serverNode, addressSpace.getVariableNode(Identifiers.Server_ServerStatus));
}
use of org.eclipse.milo.opcua.sdk.client.model.nodes.variables.ServerStatusTypeNode in project milo by eclipse.
the class ServerTypeNode method setServerStatus.
@Override
public void setServerStatus(ServerStatusDataType serverStatus) throws UaException {
ServerStatusTypeNode node = getServerStatusNode();
ExtensionObject value = ExtensionObject.encode(client.getStaticSerializationContext(), serverStatus);
node.setValue(new Variant(value));
}
Aggregations