Search in sources :

Example 1 with DataTypeDescriptionTypeNode

use of org.eclipse.milo.opcua.sdk.server.model.nodes.variables.DataTypeDescriptionTypeNode in project milo by eclipse.

the class DataTypeDictionaryManager method registerStructureDescription.

public void registerStructureDescription(StructureDescription description, NodeId binaryEncodingId) {
    structureDescriptions.put(description.getDataTypeId(), description);
    // Add a DataTypeDescriptionTypeNode with a ComponentOf reference to
    // dictionaryNode.
    DataTypeDescriptionTypeNode descriptionNode = new DataTypeDescriptionTypeNode(getNodeContext(), newNodeId(String.format("%s.Description", description.getName())), newQualifiedName(description.getName().getName()), LocalizedText.english(description.getName().getName()), LocalizedText.NULL_VALUE, uint(0), uint(0));
    descriptionNode.setValue(new DataValue(new Variant(description.getName().getName())));
    descriptionNode.setDataType(Identifiers.String);
    descriptionNode.addReference(new Reference(descriptionNode.getNodeId(), Identifiers.HasTypeDefinition, Identifiers.DataTypeDescriptionType.expanded(), Direction.FORWARD));
    descriptionNode.addReference(new Reference(descriptionNode.getNodeId(), Identifiers.HasComponent, dictionaryNode.getNodeId().expanded(), Direction.INVERSE));
    addNode(descriptionNode);
    // Add a DataTypeEncodingTypeNode with a HasDescription reference to
    // descriptionNode and an EncodingOf reference to the DataTypeNode.
    DataTypeEncodingTypeNode dataTypeEncodingNode = new DataTypeEncodingTypeNode(getNodeContext(), binaryEncodingId, new QualifiedName(0, "Default Binary"), LocalizedText.english("Default Binary"), LocalizedText.NULL_VALUE, uint(0), uint(0));
    dataTypeEncodingNode.addReference(new Reference(dataTypeEncodingNode.getNodeId(), Identifiers.HasTypeDefinition, Identifiers.DataTypeEncodingType.expanded(), Direction.FORWARD));
    dataTypeEncodingNode.addReference(new Reference(dataTypeEncodingNode.getNodeId(), Identifiers.HasDescription, descriptionNode.getNodeId().expanded(), Direction.FORWARD));
    dataTypeEncodingNode.addReference(new Reference(dataTypeEncodingNode.getNodeId(), Identifiers.HasEncoding, description.getDataTypeId().expanded(), Direction.INVERSE));
    addNode(dataTypeEncodingNode);
    dictionaryFile.reset();
}
Also used : Variant(org.eclipse.milo.opcua.stack.core.types.builtin.Variant) DataTypeDescriptionTypeNode(org.eclipse.milo.opcua.sdk.server.model.nodes.variables.DataTypeDescriptionTypeNode) DataValue(org.eclipse.milo.opcua.stack.core.types.builtin.DataValue) Reference(org.eclipse.milo.opcua.sdk.core.Reference) QualifiedName(org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName) DataTypeEncodingTypeNode(org.eclipse.milo.opcua.sdk.server.model.nodes.objects.DataTypeEncodingTypeNode)

Example 2 with DataTypeDescriptionTypeNode

use of org.eclipse.milo.opcua.sdk.server.model.nodes.variables.DataTypeDescriptionTypeNode in project milo by eclipse.

the class VariableNodeLoader method loadNode1127.

private void loadNode1127() throws IOException, SAXException {
    DataTypeDescriptionTypeNode node = new DataTypeDescriptionTypeNode(this.context, Identifiers.OpcUa_BinarySchema_RegisteredServer, new QualifiedName(0, "RegisteredServer"), new LocalizedText("en", "RegisteredServer"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.String, -1, new UInteger[] {}, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);
    node.addReference(new Reference(Identifiers.OpcUa_BinarySchema_RegisteredServer, Identifiers.HasTypeDefinition, Identifiers.DataTypeDescriptionType.expanded(), true));
    node.addReference(new Reference(Identifiers.OpcUa_BinarySchema_RegisteredServer, Identifiers.HasComponent, Identifiers.OpcUa_BinarySchema.expanded(), false));
    StringBuilder sb = new StringBuilder();
    sb.append("<String xmlns=\"http://opcfoundation.org/UA/2008/02/Types.xsd\">RegisteredServer</String>");
    String xml = sb.toString();
    OpcUaXmlStreamDecoder decoder = new OpcUaXmlStreamDecoder(context.getServer().getSerializationContext()).setInput(new StringReader(xml));
    Object o = decoder.readVariantValue();
    DataValue value = new DataValue(new Variant(o));
    node.setValue(value);
    this.nodeManager.addNode(node);
}
Also used : Variant(org.eclipse.milo.opcua.stack.core.types.builtin.Variant) DataTypeDescriptionTypeNode(org.eclipse.milo.opcua.sdk.server.model.nodes.variables.DataTypeDescriptionTypeNode) DataValue(org.eclipse.milo.opcua.stack.core.types.builtin.DataValue) Reference(org.eclipse.milo.opcua.sdk.core.Reference) QualifiedName(org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName) StringReader(java.io.StringReader) LocalizedText(org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText) OpcUaXmlStreamDecoder(org.eclipse.milo.opcua.stack.core.serialization.OpcUaXmlStreamDecoder)

Example 3 with DataTypeDescriptionTypeNode

use of org.eclipse.milo.opcua.sdk.server.model.nodes.variables.DataTypeDescriptionTypeNode in project milo by eclipse.

the class VariableNodeLoader method loadNode218.

private void loadNode218() throws IOException, SAXException {
    DataTypeDescriptionTypeNode node = new DataTypeDescriptionTypeNode(this.context, Identifiers.OpcUa_BinarySchema_DiscoveryConfiguration, new QualifiedName(0, "DiscoveryConfiguration"), new LocalizedText("en", "DiscoveryConfiguration"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.String, -1, new UInteger[] {}, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);
    node.addReference(new Reference(Identifiers.OpcUa_BinarySchema_DiscoveryConfiguration, Identifiers.HasTypeDefinition, Identifiers.DataTypeDescriptionType.expanded(), true));
    node.addReference(new Reference(Identifiers.OpcUa_BinarySchema_DiscoveryConfiguration, Identifiers.HasComponent, Identifiers.OpcUa_BinarySchema.expanded(), false));
    StringBuilder sb = new StringBuilder();
    sb.append("<String xmlns=\"http://opcfoundation.org/UA/2008/02/Types.xsd\">DiscoveryConfiguration</String>");
    String xml = sb.toString();
    OpcUaXmlStreamDecoder decoder = new OpcUaXmlStreamDecoder(context.getServer().getSerializationContext()).setInput(new StringReader(xml));
    Object o = decoder.readVariantValue();
    DataValue value = new DataValue(new Variant(o));
    node.setValue(value);
    this.nodeManager.addNode(node);
}
Also used : Variant(org.eclipse.milo.opcua.stack.core.types.builtin.Variant) DataTypeDescriptionTypeNode(org.eclipse.milo.opcua.sdk.server.model.nodes.variables.DataTypeDescriptionTypeNode) DataValue(org.eclipse.milo.opcua.stack.core.types.builtin.DataValue) Reference(org.eclipse.milo.opcua.sdk.core.Reference) QualifiedName(org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName) StringReader(java.io.StringReader) LocalizedText(org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText) OpcUaXmlStreamDecoder(org.eclipse.milo.opcua.stack.core.serialization.OpcUaXmlStreamDecoder)

Example 4 with DataTypeDescriptionTypeNode

use of org.eclipse.milo.opcua.sdk.server.model.nodes.variables.DataTypeDescriptionTypeNode in project milo by eclipse.

the class VariableNodeLoader method loadNode1203.

private void loadNode1203() throws IOException, SAXException {
    DataTypeDescriptionTypeNode node = new DataTypeDescriptionTypeNode(this.context, Identifiers.OpcUa_BinarySchema_XVType, new QualifiedName(0, "XVType"), new LocalizedText("en", "XVType"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.String, -1, new UInteger[] {}, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);
    node.addReference(new Reference(Identifiers.OpcUa_BinarySchema_XVType, Identifiers.HasTypeDefinition, Identifiers.DataTypeDescriptionType.expanded(), true));
    node.addReference(new Reference(Identifiers.OpcUa_BinarySchema_XVType, Identifiers.HasComponent, Identifiers.OpcUa_BinarySchema.expanded(), false));
    StringBuilder sb = new StringBuilder();
    sb.append("<String xmlns=\"http://opcfoundation.org/UA/2008/02/Types.xsd\">XVType</String>");
    String xml = sb.toString();
    OpcUaXmlStreamDecoder decoder = new OpcUaXmlStreamDecoder(context.getServer().getSerializationContext()).setInput(new StringReader(xml));
    Object o = decoder.readVariantValue();
    DataValue value = new DataValue(new Variant(o));
    node.setValue(value);
    this.nodeManager.addNode(node);
}
Also used : Variant(org.eclipse.milo.opcua.stack.core.types.builtin.Variant) DataTypeDescriptionTypeNode(org.eclipse.milo.opcua.sdk.server.model.nodes.variables.DataTypeDescriptionTypeNode) DataValue(org.eclipse.milo.opcua.stack.core.types.builtin.DataValue) Reference(org.eclipse.milo.opcua.sdk.core.Reference) QualifiedName(org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName) StringReader(java.io.StringReader) LocalizedText(org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText) OpcUaXmlStreamDecoder(org.eclipse.milo.opcua.stack.core.serialization.OpcUaXmlStreamDecoder)

Example 5 with DataTypeDescriptionTypeNode

use of org.eclipse.milo.opcua.sdk.server.model.nodes.variables.DataTypeDescriptionTypeNode in project milo by eclipse.

the class VariableNodeLoader method loadNode1178.

private void loadNode1178() throws IOException, SAXException {
    DataTypeDescriptionTypeNode node = new DataTypeDescriptionTypeNode(this.context, Identifiers.OpcUa_BinarySchema_ElementOperand, new QualifiedName(0, "ElementOperand"), new LocalizedText("en", "ElementOperand"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.String, -1, new UInteger[] {}, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);
    node.addReference(new Reference(Identifiers.OpcUa_BinarySchema_ElementOperand, Identifiers.HasTypeDefinition, Identifiers.DataTypeDescriptionType.expanded(), true));
    node.addReference(new Reference(Identifiers.OpcUa_BinarySchema_ElementOperand, Identifiers.HasComponent, Identifiers.OpcUa_BinarySchema.expanded(), false));
    StringBuilder sb = new StringBuilder();
    sb.append("<String xmlns=\"http://opcfoundation.org/UA/2008/02/Types.xsd\">ElementOperand</String>");
    String xml = sb.toString();
    OpcUaXmlStreamDecoder decoder = new OpcUaXmlStreamDecoder(context.getServer().getSerializationContext()).setInput(new StringReader(xml));
    Object o = decoder.readVariantValue();
    DataValue value = new DataValue(new Variant(o));
    node.setValue(value);
    this.nodeManager.addNode(node);
}
Also used : Variant(org.eclipse.milo.opcua.stack.core.types.builtin.Variant) DataTypeDescriptionTypeNode(org.eclipse.milo.opcua.sdk.server.model.nodes.variables.DataTypeDescriptionTypeNode) DataValue(org.eclipse.milo.opcua.stack.core.types.builtin.DataValue) Reference(org.eclipse.milo.opcua.sdk.core.Reference) QualifiedName(org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName) StringReader(java.io.StringReader) LocalizedText(org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText) OpcUaXmlStreamDecoder(org.eclipse.milo.opcua.stack.core.serialization.OpcUaXmlStreamDecoder)

Aggregations

Reference (org.eclipse.milo.opcua.sdk.core.Reference)74 DataTypeDescriptionTypeNode (org.eclipse.milo.opcua.sdk.server.model.nodes.variables.DataTypeDescriptionTypeNode)74 DataValue (org.eclipse.milo.opcua.stack.core.types.builtin.DataValue)74 QualifiedName (org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName)74 Variant (org.eclipse.milo.opcua.stack.core.types.builtin.Variant)74 StringReader (java.io.StringReader)73 OpcUaXmlStreamDecoder (org.eclipse.milo.opcua.stack.core.serialization.OpcUaXmlStreamDecoder)73 LocalizedText (org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText)73 DataTypeEncodingTypeNode (org.eclipse.milo.opcua.sdk.server.model.nodes.objects.DataTypeEncodingTypeNode)1