use of org.eclipse.milo.opcua.stack.core.types.structured.EnumDescription 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.stack.core.types.structured.EnumDescription in project tech-pdai-spring-demos by realpdai.
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);
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);
}
Aggregations