Search in sources :

Example 1 with DataTypeTree

use of org.eclipse.milo.opcua.sdk.core.DataTypeTree in project milo by eclipse.

the class MethodExample2 method logArguments.

private void logArguments(OpcUaClient client, UaMethod method) throws UaException {
    DataTypeTree dataTypeTree = DataTypeTreeBuilder.build(client);
    Argument[] inputArguments = method.getInputArguments();
    Argument[] outputArguments = method.getOutputArguments();
    logArguments(inputArguments, dataTypeTree, true);
    logArguments(outputArguments, dataTypeTree, false);
}
Also used : Argument(org.eclipse.milo.opcua.stack.core.types.structured.Argument) DataTypeTree(org.eclipse.milo.opcua.sdk.core.DataTypeTree)

Example 2 with DataTypeTree

use of org.eclipse.milo.opcua.sdk.core.DataTypeTree in project milo by eclipse.

the class MethodExample2 method logArguments.

private void logArguments(Argument[] arguments, DataTypeTree dataTypeTree, boolean input) {
    if (arguments.length == 0) {
        logger.info("{} arguments: none", input ? "Input" : "Output");
    } else {
        logger.info("{} arguments:", input ? "Input" : "Output");
        for (Argument argument : arguments) {
            NodeId dataTypeId = argument.getDataType();
            DataTypeTree.DataType dataType = dataTypeTree.getDataType(dataTypeId);
            assert dataType != null;
            String dataTypeName = dataType.getBrowseName().getName();
            logger.info("  {}: {} ({})", argument.getName(), dataTypeName, dataTypeId.toParseableString());
        }
    }
}
Also used : Argument(org.eclipse.milo.opcua.stack.core.types.structured.Argument) DataTypeTree(org.eclipse.milo.opcua.sdk.core.DataTypeTree) NodeId(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId)

Aggregations

DataTypeTree (org.eclipse.milo.opcua.sdk.core.DataTypeTree)2 Argument (org.eclipse.milo.opcua.stack.core.types.structured.Argument)2 NodeId (org.eclipse.milo.opcua.stack.core.types.builtin.NodeId)1