Search code examples
javaopc-ua

Decoding OPC-UA extension object


How does one decode extension object obtained from HistoryReadResult to HistoryData type ? I read documentation that suggessts simply using the decode() method but the only variant I can find in the source code is that of decode(EncoderContext).


Solution

  • You forgot to mention which stack or SDK you are using, but I can guess that it's the OPC Foundation Java Stack, in which case, you can use EncoderContext.getDefaultInstance(). This will work fine with the standard structure types, such as HistoryData. For server specific types, you may need to use a connection specific EncoderContext.