Search in sources :

Example 1 with EnumeratedValue

use of org.opcfoundation.opcua.binaryschema.EnumeratedValue in project milo by eclipse.

the class DataTypeDictionaryGenerator method createEnumeratedType.

private EnumeratedType createEnumeratedType(EnumDescription description) {
    QualifiedName name = description.getName();
    EnumDefinition definition = description.getEnumDefinition();
    EnumeratedType enumeratedType = new EnumeratedType();
    enumeratedType.setName(name.getName());
    enumeratedType.setLengthInBits(32);
    for (EnumField field : definition.getFields()) {
        EnumeratedValue enumeratedValue = new EnumeratedValue();
        enumeratedValue.setName(field.getName());
        enumeratedValue.setValue(field.getValue().intValue());
        enumeratedType.getEnumeratedValue().add(enumeratedValue);
    }
    return enumeratedType;
}
Also used : EnumField(org.eclipse.milo.opcua.stack.core.types.structured.EnumField) EnumeratedType(org.opcfoundation.opcua.binaryschema.EnumeratedType) QualifiedName(org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName) EnumDefinition(org.eclipse.milo.opcua.stack.core.types.structured.EnumDefinition) EnumeratedValue(org.opcfoundation.opcua.binaryschema.EnumeratedValue)

Aggregations

QualifiedName (org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName)1 EnumDefinition (org.eclipse.milo.opcua.stack.core.types.structured.EnumDefinition)1 EnumField (org.eclipse.milo.opcua.stack.core.types.structured.EnumField)1 EnumeratedType (org.opcfoundation.opcua.binaryschema.EnumeratedType)1 EnumeratedValue (org.opcfoundation.opcua.binaryschema.EnumeratedValue)1