use of org.eclipse.milo.opcua.stack.core.types.DataTypeEncoding in project milo by eclipse.
the class AttributeReader method transcode.
private static ExtensionObject transcode(AttributeContext context, UaServerNode node, ExtensionObject xo, QualifiedName encodingName) {
if (xo == null || xo.isNull()) {
return xo;
}
if (encodingName == null || encodingName.isNull()) {
// TODO default encoding should be derived from session/transport
encodingName = OpcUaDefaultBinaryEncoding.ENCODING_NAME;
}
DataTypeEncoding newEncoding;
if (OpcUaDefaultBinaryEncoding.ENCODING_NAME.equals(encodingName)) {
newEncoding = OpcUaDefaultBinaryEncoding.getInstance();
} else if (OpcUaDefaultXmlEncoding.ENCODING_NAME.equals(encodingName)) {
newEncoding = OpcUaDefaultXmlEncoding.getInstance();
} else {
// TODO look up registered alternate encodings
newEncoding = OpcUaDefaultBinaryEncoding.getInstance();
}
NodeId newEncodingId = getEncodingId(context, node, encodingName);
if (newEncodingId != null) {
return xo.transcode(context.getServer().getSerializationContext(), newEncodingId, newEncoding);
} else {
return xo;
}
}
Aggregations