public class
ResultDataType extends Structure implements UaStructure {
public static final ExpandedNodeId TYPE_ID =
ExpandedNodeId.parse("nsu=http://opcfoundation.org/UA/Machinery/Result/;i=3008");
//public static final
ExpandedNodeId TYPE_ID = ExpandedNodeId.parse("nsu=ns=5;i=3008");
public static final ExpandedNodeId
XML_ENCODING_ID =
ExpandedNodeId.parse("nsu=http://opcfoundation.org/UA/;i=12676");
public static final ExpandedNodeId
BINARY_ENCODING_ID =
ExpandedNodeId.parse("nsu=http://opcfoundation.org/UA/Machinery/Result/;i=5008");
// public static final
ExpandedNodeId BINARY_ENCODING_ID =
ExpandedNodeId.parse("nsu=ns=5;i=5008");
private final ResultMetaDataType
resultMetaDataType;
public
ResultDataType(ResultMetaDataType resultMetaDataType) {
super();
this.resultMetaDataType
= resultMetaDataType;
}
@Override
public ExpandedNodeId getTypeId() {
return TYPE_ID;
}
@Override
public ExpandedNodeId getXmlEncodingId()
{
return XML_ENCODING_ID;
}
@Override
public ExpandedNodeId
getBinaryEncodingId() {
return BINARY_ENCODING_ID;
}
public
ResultMetaDataType getResultMetaDataType() {
return
resultMetaDataType;
}
public static final class Codec extends
GenericDataTypeCodec<ResultDataType> {
@Override
public Class<ResultDataType>
getType() {
return ResultDataType.class;
}
@Override
public ResultDataType
decode(SerializationContext context, UaDecoder decoder) {
System.out.println("decode
ResultDataType ");
String
ResultId = null;
UInteger
encodingMask = decoder.readUInt32("EncodingMask");
long
encodingMaskValue = encodingMask.longValue();
if
((encodingMaskValue & (1L << 0)) != 0) {
ResultId
= decoder.readString("ResultId");
}
System.out.println("ResultId
"+ResultId);
ResultMetaDataType
r = new ResultMetaDataType("resultId");
return
new ResultDataType(r);
}
@Override
public
void encode(SerializationContext context, UaEncoder writer,
ResultDataType
value) throws UaSerializationException {
System.out.println("encode
ResultMetaDataType ");
long
encodingMaskValue = 0L;
if (value.resultMetaDataType !=
null) {
encodingMaskValue |= (1L
<< 0);
}
writer.writeUInt32("EncodingMask",
Unsigned.uint(encodingMaskValue));
if (value.resultMetaDataType !=
null) {
//writer.writeString("ResultId", value.ResultId);
writer.writeStruct("ResultMetaDataType",
value, ResultDataType.BINARY_ENCODING_ID);
//writer.writeStruct("ResultMetaDataType",
value,new ResultDataType.Codec().asBinaryCodec() );
}
}
}
}
|