Search in sources :

Example 1 with UaDataTypeNode

use of org.eclipse.milo.opcua.sdk.server.nodes.UaDataTypeNode in project milo by eclipse.

the class DataTypeDictionaryManager method registerEnumCodec.

public void registerEnumCodec(OpcUaBinaryDataTypeCodec<?> codec, String description, NodeId dataTypeId) {
    dictionary.registerEnumCodec(codec, description, dataTypeId);
    // Add a custom DataTypeNode with a SubtypeOf reference to Enumeration
    UaDataTypeNode dataTypeNode = new UaDataTypeNode(getNodeContext(), dataTypeId, newQualifiedName(description), LocalizedText.english(description), LocalizedText.NULL_VALUE, uint(0), uint(0), false);
    dataTypeNode.addReference(new Reference(dataTypeId, Identifiers.HasSubtype, Identifiers.Enumeration.expanded(), Direction.INVERSE));
    addNode(dataTypeNode);
    // TODO figure out a way to not require re-registration every time...
    getNodeContext().getServer().getDataTypeManager().registerTypeDictionary(dictionary);
}
Also used : Reference(org.eclipse.milo.opcua.sdk.core.Reference) UaDataTypeNode(org.eclipse.milo.opcua.sdk.server.nodes.UaDataTypeNode)

Example 2 with UaDataTypeNode

use of org.eclipse.milo.opcua.sdk.server.nodes.UaDataTypeNode in project milo by eclipse.

the class ExampleNamespace method registerCustomEnumType.

private void registerCustomEnumType() throws Exception {
    NodeId dataTypeId = CustomEnumType.TYPE_ID.toNodeIdOrThrow(getServer().getNamespaceTable());
    dictionaryManager.registerEnumCodec(new CustomEnumType.Codec().asBinaryCodec(), "CustomEnumType", dataTypeId);
    UaNode node = getNodeManager().get(dataTypeId);
    if (node instanceof UaDataTypeNode) {
        UaDataTypeNode dataTypeNode = (UaDataTypeNode) node;
        dataTypeNode.setEnumStrings(new LocalizedText[] { LocalizedText.english("Field0"), LocalizedText.english("Field1"), LocalizedText.english("Field2") });
    }
    EnumField[] fields = new EnumField[] { new EnumField(0L, LocalizedText.english("Field0"), LocalizedText.NULL_VALUE, "Field0"), new EnumField(1L, LocalizedText.english("Field1"), LocalizedText.NULL_VALUE, "Field1"), new EnumField(2L, LocalizedText.english("Field2"), LocalizedText.NULL_VALUE, "Field2") };
    EnumDefinition definition = new EnumDefinition(fields);
    EnumDescription description = new EnumDescription(dataTypeId, new QualifiedName(getNamespaceIndex(), "CustomEnumType"), definition, ubyte(BuiltinDataType.Int32.getTypeId()));
    dictionaryManager.registerEnumDescription(description);
}
Also used : EnumField(org.eclipse.milo.opcua.stack.core.types.structured.EnumField) QualifiedName(org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName) NodeId(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId) UaNode(org.eclipse.milo.opcua.sdk.server.nodes.UaNode) EnumDefinition(org.eclipse.milo.opcua.stack.core.types.structured.EnumDefinition) UaDataTypeNode(org.eclipse.milo.opcua.sdk.server.nodes.UaDataTypeNode) EnumDescription(org.eclipse.milo.opcua.stack.core.types.structured.EnumDescription)

Example 3 with UaDataTypeNode

use of org.eclipse.milo.opcua.sdk.server.nodes.UaDataTypeNode in project milo by eclipse.

the class DataTypeDictionaryManager method registerStructureCodec.

public void registerStructureCodec(OpcUaBinaryDataTypeCodec<?> codec, String description, NodeId dataTypeId, NodeId binaryEncodingId, NodeId parentType) {
    dictionary.registerStructCodec(codec, description, dataTypeId, binaryEncodingId);
    // Add a custom DataTypeNode with a SubtypeOf reference to Structure
    UaDataTypeNode dataTypeNode = new UaDataTypeNode(getNodeContext(), dataTypeId, newQualifiedName(description), LocalizedText.english(description), LocalizedText.NULL_VALUE, uint(0), uint(0), false);
    dataTypeNode.addReference(new Reference(dataTypeId, Identifiers.HasSubtype, parentType.expanded(), Direction.INVERSE));
    addNode(dataTypeNode);
    // TODO figure out a way to not require re-registration every time...
    getNodeContext().getServer().getDataTypeManager().registerTypeDictionary(dictionary);
}
Also used : Reference(org.eclipse.milo.opcua.sdk.core.Reference) UaDataTypeNode(org.eclipse.milo.opcua.sdk.server.nodes.UaDataTypeNode)

Example 4 with UaDataTypeNode

use of org.eclipse.milo.opcua.sdk.server.nodes.UaDataTypeNode in project milo by eclipse.

the class DataTypeNodeLoader method loadNode109.

private void loadNode109() {
    UaDataTypeNode node = new UaDataTypeNode(this.context, Identifiers.SemanticChangeStructureDataType, new QualifiedName(0, "SemanticChangeStructureDataType"), new LocalizedText("en", "SemanticChangeStructureDataType"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), false);
    node.addReference(new Reference(Identifiers.SemanticChangeStructureDataType, Identifiers.HasSubtype, Identifiers.Structure.expanded(), false));
    this.nodeManager.addNode(node);
}
Also used : Reference(org.eclipse.milo.opcua.sdk.core.Reference) QualifiedName(org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName) UaDataTypeNode(org.eclipse.milo.opcua.sdk.server.nodes.UaDataTypeNode) LocalizedText(org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText)

Example 5 with UaDataTypeNode

use of org.eclipse.milo.opcua.sdk.server.nodes.UaDataTypeNode in project milo by eclipse.

the class DataTypeNodeLoader method loadNode52.

private void loadNode52() {
    UaDataTypeNode node = new UaDataTypeNode(this.context, Identifiers.EndpointDescription, new QualifiedName(0, "EndpointDescription"), new LocalizedText("en", "EndpointDescription"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), false);
    node.addReference(new Reference(Identifiers.EndpointDescription, Identifiers.HasSubtype, Identifiers.Structure.expanded(), false));
    this.nodeManager.addNode(node);
}
Also used : Reference(org.eclipse.milo.opcua.sdk.core.Reference) QualifiedName(org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName) UaDataTypeNode(org.eclipse.milo.opcua.sdk.server.nodes.UaDataTypeNode) LocalizedText(org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText)

Aggregations

UaDataTypeNode (org.eclipse.milo.opcua.sdk.server.nodes.UaDataTypeNode)133 Reference (org.eclipse.milo.opcua.sdk.core.Reference)131 QualifiedName (org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName)131 LocalizedText (org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText)130 UaNode (org.eclipse.milo.opcua.sdk.server.nodes.UaNode)1 NodeId (org.eclipse.milo.opcua.stack.core.types.builtin.NodeId)1 EnumDefinition (org.eclipse.milo.opcua.stack.core.types.structured.EnumDefinition)1 EnumDescription (org.eclipse.milo.opcua.stack.core.types.structured.EnumDescription)1 EnumField (org.eclipse.milo.opcua.stack.core.types.structured.EnumField)1