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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations